Skip to content

Commit

Permalink
catch up to gl
Browse files Browse the repository at this point in the history
  • Loading branch information
tjwei committed Aug 31, 2017
1 parent 5ce75ed commit ba90714
Showing 45 changed files with 6,821 additions and 383 deletions.
19 changes: 19 additions & 0 deletions buildall_gl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
clang -g -Wpointer-sign -Wno-unused-result -O2 -o pcsx_gl -I./include -I./libpcsxcore \
-D USESDLSOUND \
gui/LnxMain.c gui/Plugin.c gui/Config.c \
libpcsxcore/psxbios.c libpcsxcore/cdrom.c libpcsxcore/psxcounters.c \
libpcsxcore/psxdma.c libpcsxcore/disr3000a.c libpcsxcore/spu.c libpcsxcore/sio.c \
libpcsxcore/psxhw.c libpcsxcore/mdec.c libpcsxcore/psxmem.c libpcsxcore/misc.c \
libpcsxcore/plugins.c libpcsxcore/decode_xa.c libpcsxcore/r3000a.c libpcsxcore/psxinterpreter.c \
libpcsxcore/gte.c libpcsxcore/psxhle.c libpcsxcore/psxcommon.c \
libpcsxcore/cdriso.c libpcsxcore/ppf.c \
plugins/dfOpenGL/cfg.c plugins/dfOpenGL/fps.c plugins/dfOpenGL/gllog.c \
plugins/dfOpenGL/primitive_drawing.c plugins/dfOpenGL/GPU.c \
plugins/dfsound/sdl.c plugins/dfsound/spu.c plugins/dfsound/cfg.c plugins/dfsound/dma.c plugins/dfsound/registers.c \
plugins/sdlinput/cfg.c plugins/sdlinput/pad.c plugins/sdlinput/xkb.c \
plugins/sdlinput/sdljoy.c plugins/sdlinput/analog.c \
-lm -lSDL -lXxf86vm -lXext -lX11 -lGL

# plugins/nullspu/spunull.c \
#plugins/dfsound/sdl.c plugins/dfsound/dma.c plugins/dfsound/freeze.c plugins/dfsound/cfg.c \
#plugins/dfsound/spu.c plugins/dfsound/xa.c plugins/dfsound/registers.c \
10 changes: 5 additions & 5 deletions buildall_ww1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
emcc -O3 -Wno-unused-result -o pcsx_worker.js -D USESDLSOUND -D WORKER \
-s USE_ZLIB=1 -s AGGRESSIVE_VARIABLE_ELIMINATION=1 \
-s TOTAL_MEMORY=536870912 --llvm-lto 1 -s WASM=1 --post-js worker_funcs.js \
-s EXPORTED_FUNCTIONS="['_main', '_pcsx_init', '_one_iter', '_get_render_param_ptr', '_set_KeyStatus']" \
-s USE_ZLIB=1 \
-s TOTAL_MEMORY=440401920 --llvm-lto 1 -s WASM=1 --post-js worker_funcs.js \
-s EXPORTED_FUNCTIONS="['_main', '_pcsx_init', '_one_iter', '_get_ptr', '_ls', '_playcdda']" \
-I./include -I./libpcsxcore \
gui/workerMain.c gui/Plugin.c gui/Config.c \
libpcsxcore/psxbios.c libpcsxcore/cdrom.c libpcsxcore/psxcounters.c \
@@ -12,8 +12,8 @@ libpcsxcore/gte.c libpcsxcore/psxhle.c libpcsxcore/psxcommon.c \
libpcsxcore/cdriso.c libpcsxcore/ppf.c \
plugins/dfxvideo/cfg.c plugins/dfxvideo/fps.c plugins/dfxvideo/key.c \
plugins/dfxvideo/prim.c plugins/dfxvideo/zn.c plugins/dfxvideo/draw_null.c \
plugins/dfxvideo/gpu.c plugins/dfxvideo/soft_modified.c \
plugins/nullspu/spunull.c \
plugins/dfxvideo/gpu.c plugins/dfxvideo/soft.c \
plugins/dfsound/spu.c plugins/dfsound/cfg.c plugins/dfsound/dma.c plugins/dfsound/registers.c plugins/dfsound/worker.c \
plugins/sdlinput/cfg.c plugins/sdlinput/pad_worker.c \
plugins/sdlinput/analog.c \
-lm
4 changes: 3 additions & 1 deletion buildall_ww2
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@ emcc -O3 -Wno-unused-result -o pcsx_ww.html -D USESDLSOUND \
--llvm-lto 1 -s WASM=1 \
-s WASM=1 --shell-file shell_ww.html --llvm-lto 1 \
plugins/sdlinput/cfg.c plugins/sdlinput/xkb.c gui/wwGUI.c \
-s EXPORTED_FUNCTIONS="['_main','_get_ptr', '_render','_LoadPADConfig', '_CheckKeyboard', '_get_KeyStatus' ]" \
plugins/sdlinput/sdljoy.c plugins/sdlinput/analog.c \
plugins/dfsound/sdl.c \
-s EXPORTED_FUNCTIONS="['_main','_get_ptr', '_render','_LoadPADConfig', '_CheckKeyboard', '_CheckJoy', '_SoundFeedStreamData', '_SoundGetBytesBuffered']" \
-I./include -I./libpcsxcore \
-lSDL
206 changes: 108 additions & 98 deletions gui/LnxMain.c
Original file line number Diff line number Diff line change
@@ -34,132 +34,142 @@

#include "Linux.h"

static void CreateMemcard(char *filename, char *conf_mcd) {
struct stat buf;
strcpy(conf_mcd, getenv("HOME"));
strcat(conf_mcd, MEMCARD_DIR);
strcat(conf_mcd, filename);
/* Only create a memory card if an existing one does not exist */
if (stat(conf_mcd, &buf) == -1) {
printf(_("Creating memory card: %s\n"), conf_mcd);
CreateMcd(conf_mcd);
}

static void CreateMemcard(char *filename, char *conf_mcd)
{
struct stat buf;
strcpy(conf_mcd, getenv("HOME"));
strcat(conf_mcd, MEMCARD_DIR);
strcat(conf_mcd, filename);
/* Only create a memory card if an existing one does not exist */
if (stat(conf_mcd, &buf) == -1)
{
printf(_("Creating memory card: %s\n"), conf_mcd);
CreateMcd(conf_mcd);
}
}
void execI();
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
extern int updated_display;
void one_iter(){
updated_display = 0;
while(!updated_display){
execI();
}
void one_iter()
{
updated_display = 0;
while (!updated_display)
{
execI();
}
}
void run() __attribute__((used));
int mainloop(const char *isofilename);
void run(){
mainloop("_.bin");
void run()
{
mainloop("_.bin");
}
#endif


int mainloop(const char *isofilename) {
char file[MAXPATHLEN] = "";
char path[MAXPATHLEN];
int loadst = 0;
int i;
SetIsoFile(isofilename);
memset(&Config, 0, sizeof(PcsxConfig));
strcpy(Config.Net, "Disabled");
Config.PsxAuto = 1;
strcpy(Config.Gpu, "./libDFXVideo.so");
strcpy(Config.Spu, "./libspuPeteNull.so.1.0.1");
strcpy(Config.Cdr, "Disabled");
strcpy(Config.Pad1, "./libDFInput.so");
strcpy(Config.Pad2, "./libDFInput.so");
strcpy(Config.Bios, "HLE");
Config.HLE = TRUE;

// create & load default memcards if they don't exist
CreateMemcard("card1.mcd", Config.Mcd1);
CreateMemcard("card2.mcd", Config.Mcd2);

LoadMcds(Config.Mcd1, Config.Mcd2);
// switch to plugin dotdir
// this lets plugins work without modification!
//chdir(plugin_default_dir);

if (SysInit() == -1) return 1;
// the following only occurs if the gui isn't started
if (LoadPlugins() == -1) {
printf("Error Failed loading plugins!");
return 1;
}

if (OpenPlugins() == -1 ) {
return 1;
}

SysReset();
CheckCdrom();
if (LoadCdrom() == -1) {
ClosePlugins();
printf("Could not load CD-ROM!\n");
return -1;
}




int mainloop(const char *isofilename)
{
char file[MAXPATHLEN] = "";
char path[MAXPATHLEN];
int loadst = 0;
int i;

SetIsoFile(isofilename);
memset(&Config, 0, sizeof(PcsxConfig));
strcpy(Config.Net, "Disabled");
Config.PsxAuto = 1;
strcpy(Config.Gpu, "./libDFXVideo.so");
strcpy(Config.Spu, "./libspuPeteNull.so.1.0.1");
strcpy(Config.Cdr, "Disabled");
strcpy(Config.Pad1, "./libDFInput.so");
strcpy(Config.Pad2, "./libDFInput.so");
strcpy(Config.Bios, "HLE");
Config.HLE = TRUE;

// create & load default memcards if they don't exist
CreateMemcard("card1.mcd", Config.Mcd1);
CreateMemcard("card2.mcd", Config.Mcd2);

LoadMcds(Config.Mcd1, Config.Mcd2);
// switch to plugin dotdir
// this lets plugins work without modification!
//chdir(plugin_default_dir);

if (SysInit() == -1)
return 1;
// the following only occurs if the gui isn't started
if (LoadPlugins() == -1)
{
printf("Error Failed loading plugins!");
return 1;
}

if (OpenPlugins() == -1)
{
return 1;
}

SysReset();
CheckCdrom();
if (LoadCdrom() == -1)
{
ClosePlugins();
printf("Could not load CD-ROM!\n");
return -1;
}

#ifdef __EMSCRIPTEN__
// void emscripten_set_main_loop(em_callback_func func, int fps, int simulate_infinite_loop);
emscripten_set_main_loop(one_iter, 0, 0);
// void emscripten_set_main_loop(em_callback_func func, int fps, int simulate_infinite_loop);
emscripten_set_main_loop(one_iter, 0, 0);
#else
while (1) {
execI();
}
while (1)
{
execI();
}
#endif

return 0;
return 0;
}

int SysInit() {
int SysInit()
{

if (EmuInit() == -1) {
printf(_("PSX emulator couldn't be initialized.\n"));
return -1;
}
LoadMcds(Config.Mcd1, Config.Mcd2);
return 0;
if (EmuInit() == -1)
{
printf(_("PSX emulator couldn't be initialized.\n"));
return -1;
}
LoadMcds(Config.Mcd1, Config.Mcd2);
return 0;
}

void SysReset() {
EmuReset();
void SysReset()
{
EmuReset();
}

void SysClose() {
EmuShutdown();
//ReleasePlugins();
void SysClose()
{
EmuShutdown();
//ReleasePlugins();
}


void SysUpdate() {
PADhandleKey(PAD1_keypressed());
PADhandleKey(PAD2_keypressed());
void SysUpdate()
{
PADhandleKey(PAD1_keypressed());
PADhandleKey(PAD2_keypressed());
}

int main(int argc, char *argv[]) {
char file[MAXPATHLEN] = "";
char path[MAXPATHLEN];
int loadst = 0;
int i;

int main(int argc, char *argv[])
{
char file[MAXPATHLEN] = "";
char path[MAXPATHLEN];
int loadst = 0;
int i;

#ifdef __EMSCRIPTEN__
emscripten_exit_with_live_runtime();
emscripten_exit_with_live_runtime();
#else
return mainloop(argv[1]);
return mainloop(argv[1]);
#endif
}
Loading

0 comments on commit ba90714

Please sign in to comment.