diff --git a/Makefile_cygwin.caanoo b/Makefile_cygwin.caanoo index 1732bb6..1dcea6f 100644 --- a/Makefile_cygwin.caanoo +++ b/Makefile_cygwin.caanoo @@ -5,7 +5,7 @@ UNZIP=1 #GLIDE=1 #OPENGL=1 -#THREAD_SOUND=1 +THREAD_SOUND=1 CHEATS=1 #ASMKREED=1 #ZSNESC4=1 diff --git a/Makefile_cygwin.dingoo b/Makefile_cygwin.dingoo index 8e3caea..d468279 100644 --- a/Makefile_cygwin.dingoo +++ b/Makefile_cygwin.dingoo @@ -117,7 +117,7 @@ STRIP := $(BINPATH)/mipsel-linux-uclibc-strip AS := $(BINPATH)/mipsel-linux-uclibc-as GASM := $(BINPATH)/mipsel-linux-uclibc-g++ -OPTIMISE= -D_ZAURUS -O2 -ffast-math -fstrict-aliasing -fomit-frame-pointer -ftree-vectorize -funroll-all-loops -fpeel-loops -ftracer -funswitch-loops -finline-functions -G 0 -march=mips32 -mtune=r4600 -mno-mips16 -msoft-float +OPTIMISE= -D_ZAURUS -O3 -ffast-math -fstrict-aliasing -fomit-frame-pointer -ftree-vectorize -funroll-all-loops -fpeel-loops -ftracer -funswitch-loops -finline-functions -G 0 -march=mips32 -mtune=r4600 -mno-mips16 -msoft-float # -fprofile-use -ftest-coverage -fprofile-arcs CCFLAGS = $(OPTIMISE) \ diff --git a/Makefile_cygwin.wizz b/Makefile_cygwin.wizz index 1dc6b1b..7fe8053 100644 --- a/Makefile_cygwin.wizz +++ b/Makefile_cygwin.wizz @@ -119,9 +119,9 @@ STRIP := ${BINPATH}/$(ARCH)-strip AS := ${BINPATH}/$(ARCH)-as GASM := ${BINPATH}/$(ARCH)-g++ -# OPTIMISE= -mcpu=arm926ej-s -mtune=arm926ej-s -D_ZAURUS -O2 -ffast-math -fstrict-aliasing -fomit-frame-pointer -ftree-vectorize -funroll-all-loops -fpeel-loops -ftracer -funswitch-loops -finline-functions 0 -msoft-float OPTIMISE = -mcpu=arm926ej-s -mtune=arm926ej-s -g -I. -I$(TOOLCHAINDIR)/arm-open2x-linux/include -O3 -D_ZAURUS -D__WIZ__ -DUSE_SA1 -OPTIMISE += -ffast-math -fexpensive-optimizations -finline -finline-functions -msoft-float -falign-functions=32 -falign-loops -falign-labels -falign-jumps -fomit-frame-pointer +OPTIMISE += -ffast-math -fexpensive-optimizations -finline -finline-functions -falign-functions=32 -falign-loops -falign-labels -falign-jumps -fomit-frame-pointer +#-msoft-float CCFLAGS = $(OPTIMISE) \ -I. \ diff --git a/display.h b/display.h index c43e2aa..10497c6 100644 --- a/display.h +++ b/display.h @@ -60,7 +60,6 @@ void S9xInitInputDevices (); void S9xSetTitle (const char *title); void S9xProcessEvents (bool8_32 block); void S9xPutImage (int width, int height); -void S9xParseDisplayArg (char **argv, int &index, int argc); void S9xToggleSoundChannel (int channel); void S9xSetInfoString (const char *string); int S9xMinCommandLineArgs (); diff --git a/unix/caanoo.h b/unix/caanoo.h index 4b8a556..1578431 100644 --- a/unix/caanoo.h +++ b/unix/caanoo.h @@ -8,8 +8,9 @@ #define CAANOO_BUTTON_Y 3 #define CAANOO_BUTTON_L 4 #define CAANOO_BUTTON_R 5 -#define CAANOO_BUTTON_START 6 -#define CAANOO_BUTTON_SELECT 9 +#define CAANOO_BUTTON_HOME 6 +#define CAANOO_BUTTON_HELP1 8 +#define CAANOO_BUTTON_HELP2 9 #define CAANOO_BUTTON_UP 11 #define CAANOO_BUTTON_DOWN 12 #define CAANOO_BUTTON_LEFT 13 diff --git a/unix/keydef.h b/unix/keydef.h index c3ccd9c..f4cd0b8 100644 --- a/unix/keydef.h +++ b/unix/keydef.h @@ -6,35 +6,14 @@ #define Y_1 3 #define L_1 4 #define R_1 5 -#define START_1 6 -#define SELECT_1 9 +#define QUIT 6 //CAANOO_BUTTON_HOME +#define START_1 8 //CAANOO_BUTTON_HELP1 +#define SELECT_1 9 //CAANOO_BUTTON_HELP2 #define UP_1 11 #define DOWN_1 12 #define LEFT_1 13 #define RIGHT_1 14 -#define ACCEL 50 -#define QUIT 51 -#define HELP 52 - -#define SHIFTL 30 -#define SHIFTR 31 -#define CTRLL 32 -#define CTRLR 33 - -#define UP_2 20 -#define DOWN_2 21 -#define LEFT_2 22 -#define RIGHT_2 23 -#define LU_2 24 -#define LD_2 25 -#define RU_2 26 -#define RD_2 27 - -#define ACCEL 50 -#define QUIT 51 -#define HELP 52 - #else #define A_1 0 @@ -43,24 +22,26 @@ #define Y_1 3 #define L_1 4 #define R_1 5 +#define START_1 12 +#define SELECT_1 13 +#define UP_1 16 +#define DOWN_1 17 +#define LEFT_1 18 +#define RIGHT_1 19 + #define A_2 6 #define B_2 7 #define X_2 8 #define Y_2 9 #define L_2 10 #define R_2 11 -#define START_1 12 -#define SELECT_1 13 #define START_2 14 #define SELECT_2 15 -#define UP_1 16 -#define DOWN_1 17 -#define LEFT_1 18 -#define RIGHT_1 19 #define UP_2 20 #define DOWN_2 21 #define LEFT_2 22 #define RIGHT_2 23 + #define LU_2 24 #define LD_2 25 #define RU_2 26 diff --git a/unix/svga.cpp b/unix/svga.cpp index 9590ff3..9e18739 100644 --- a/unix/svga.cpp +++ b/unix/svga.cpp @@ -51,9 +51,9 @@ #include #ifdef PANDORA -#include -#include -#include + #include + #include + #include #endif #include "snes9x.h" @@ -68,15 +68,14 @@ #define COUNT(a) (sizeof(a) / sizeof(a[0])) -SDL_Surface *screen, *gfxscreen;// *hwscreen; -uint16 *RGBconvert; +SDL_Surface *screen, *gfxscreen; extern uint32 xs, ys, cl, cs; extern bool8_32 Scale; #ifdef PANDORA -#include "blitscale.h" -extern blit_scaler_e g_scale; -extern unsigned char g_fullscreen; + #include "blitscale.h" + extern blit_scaler_e g_scale; + extern unsigned char g_fullscreen; #endif #ifndef _ZAURUS @@ -94,27 +93,25 @@ void S9xTextMode () } #endif + #ifdef CAANOO extern SDL_Joystick* keyssnes; #else extern uint8 *keyssnes; #endif + void S9xInitDisplay (int /*argc*/, char ** /*argv*/) { #ifdef CAANOO if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK|(Settings.NextAPUEnabled ? SDL_INIT_AUDIO : 0)) < 0 ) - { - printf("Could not initialize SDL(%s)\n", SDL_GetError()); - S9xExit(); - } #else if (SDL_Init(SDL_INIT_VIDEO | (Settings.NextAPUEnabled ? SDL_INIT_AUDIO : 0)) < 0 ) - { +#endif + { printf("Could not initialize SDL(%s)\n", SDL_GetError()); S9xExit(); } -#endif atexit(SDL_Quit); // No more MOUSE-CURSOR @@ -126,8 +123,6 @@ void S9xInitDisplay (int /*argc*/, char ** /*argv*/) keyssnes = SDL_GetKeyState(NULL); #endif - //screen = SDL_CreateRGBSurface(SDL_HWSURFACE, xs, ys, 16, 0, 0, 0, 0); - //hwscreen = SDL_SetVideoMode(xs, ys, 16, SDL_HWSURFACE|SDL_FULLSCREEN); #ifdef PANDORA //screen = SDL_SetVideoMode(xs * blit_scalers [ g_scale ].scale_x, ys * blit_scalers [ g_scale ].scale_y, 16, // g_fullscreen ? SDL_SWSURFACE|SDL_FULLSCREEN : SDL_SWSURFACE); @@ -144,20 +139,22 @@ void S9xInitDisplay (int /*argc*/, char ** /*argv*/) } // for LCD refresh rate - switch ( (int) Memory.ROMFramesPerSecond ) { - case 60: - fprintf ( stderr, "Assuming 60hz LCD\n" ); - break; // nothing to do - case 50: - fprintf ( stderr, "Switching to 50hz LCD\n" ); - system ( "/usr/bin/sudo -n /usr/pandora/scripts/op_lcdrate.sh 50" ); - break; - default: - fprintf ( stderr, "Game reports %d hz display; ignoring.\n", (int) Memory.ROMFramesPerSecond ); - break; + switch ( (int) Memory.ROMFramesPerSecond ) + { + case 60: + fprintf ( stderr, "Assuming 60hz LCD\n" ); + break; // nothing to do + case 50: + fprintf ( stderr, "Switching to 50hz LCD\n" ); + system ( "/usr/bin/sudo -n /usr/pandora/scripts/op_lcdrate.sh 50" ); + break; + default: + fprintf ( stderr, "Game reports %d hz display; ignoring.\n", (int) Memory.ROMFramesPerSecond ); + break; } #else + //DINGOO / CAANOO screen = SDL_SetVideoMode(xs, ys, 16, SDL_SWSURFACE); //SDL_HWSURFACE #endif @@ -199,27 +196,15 @@ void S9xInitDisplay (int /*argc*/, char ** /*argv*/) GFX.SubScreen = (uint8 *)malloc(512 * 480 * 2); GFX.ZBuffer = (uint8 *)malloc(512 * 480 * 2); GFX.SubZBuffer = (uint8 *)malloc(512 * 480 * 2); - -/* - RGBconvert = (uint16 *)malloc(65536 * 2); - if (!RGBconvert) - { -// OutOfMemory(); - S9xExit(); - } - for (uint32 i = 0; i < 65536; i++) - ((uint16 *)(RGBconvert))[i] = ((i >> 11) << 10) | ((((i >> 5) & 63) >> 1) << 5) | (i & 31); -*/ } void S9xDeinitDisplay () { -// SDL_FreeSurface(gfxscreen); - #ifdef PANDORA - // for vsync - extern int g_fb; - if ( g_fb >= 0 ) { + // for vsync + extern int g_fb; + if ( g_fb >= 0 ) + { close ( g_fb ); } // for LCD refresh @@ -250,53 +235,37 @@ const char *S9xSelectFilename (const char *def, const char *dir1, S9xTextMode (); printf ("\n%s (default: %s): ", title, def); fflush (stdout); + if (fgets (buffer, sizeof (buffer) - 1, stdin)) { - char *p = buffer; - while (isspace (*p) || *p == '\n') - p++; - if (!*p) - { - strcpy (buffer, def); - p = buffer; - } - - char *q = strrchr (p, '\n'); - if (q) - *q = 0; - - char fname [PATH_MAX]; - char drive [_MAX_DRIVE]; - char dir [_MAX_DIR]; - char ext [_MAX_EXT]; - - _splitpath (p, drive, dir, fname, ext); - _makepath (path, drive, *dir ? dir : dir1, fname, *ext ? ext : ext1); - S9xGraphicsMode (); - return (path); + char *p = buffer; + while (isspace (*p) || *p == '\n') + p++; + if (!*p) + { + strcpy (buffer, def); + p = buffer; + } + + char *q = strrchr (p, '\n'); + if (q) + *q = 0; + + char fname [PATH_MAX]; + char drive [_MAX_DRIVE]; + char dir [_MAX_DIR]; + char ext [_MAX_EXT]; + + _splitpath (p, drive, dir, fname, ext); + _makepath (path, drive, *dir ? dir : dir1, fname, *ext ? ext : ext1); + S9xGraphicsMode (); + return (path); } + S9xGraphicsMode (); return (NULL); } -void S9xParseDisplayArg (char **argv, int &ind, int) -{ - if (strcasecmp (argv [ind], "-scale") == 0 || - strcasecmp (argv [ind], "-sc") == 0) - stretch = TRUE; - else - if (strcasecmp (argv [ind], "-y") == 0 || - strcasecmp (argv [ind], "-interpolation") == 0) - { - interpolation = TRUE; - Settings.SixteenBit = TRUE; - Settings.SupportHiRes = TRUE; - Settings.Transparency = TRUE; - } - else - S9xUsage (); -} - void S9xExtraUsage () { } diff --git a/unix/unix.cpp b/unix/unix.cpp index 149bf76..7d435a3 100644 --- a/unix/unix.cpp +++ b/unix/unix.cpp @@ -236,13 +236,8 @@ void S9xParseArg (char **argv, int &i, int argc) } else S9xUsage (); -// S9xParseDisplayArg (argv, i, argc); } -//#ifdef CHEATS -//#include "cheats.h" -//#endif - extern "C" int main (int argc, char **argv) { @@ -251,7 +246,7 @@ int main (int argc, char **argv) S9xUsage (); ZeroMemory (&Settings, sizeof (Settings)); - Settings.JoystickEnabled = FALSE; + Settings.JoystickEnabled = FALSE; //unused Settings.SoundPlaybackRate = 2; Settings.Stereo = TRUE; Settings.SoundBufferSize = 512; //256 @@ -469,34 +464,23 @@ Uint16 sfc_key[256]; void S9xInitInputDevices () { memset(sfc_key, 0, 256); - sfc_key[QUIT] = SDLK_a; #ifdef CAANOO // Caanoo mapping - sfc_key[A_1] = CAANOO_BUTTON_A; - sfc_key[B_1] = CAANOO_BUTTON_B; - sfc_key[X_1] = CAANOO_BUTTON_X; - sfc_key[Y_1] = CAANOO_BUTTON_Y; + sfc_key[A_1] = CAANOO_BUTTON_B; //Snes A + sfc_key[B_1] = CAANOO_BUTTON_X; //Snes B + sfc_key[X_1] = CAANOO_BUTTON_Y; //Snes X + sfc_key[Y_1] = CAANOO_BUTTON_A; //Snes Y sfc_key[L_1] = CAANOO_BUTTON_L; sfc_key[R_1] = CAANOO_BUTTON_R; - sfc_key[START_1] = CAANOO_BUTTON_START; - sfc_key[SELECT_1] = CAANOO_BUTTON_SELECT; + sfc_key[START_1] = CAANOO_BUTTON_HELP1; + sfc_key[SELECT_1] = CAANOO_BUTTON_HELP2; sfc_key[LEFT_1] = CAANOO_BUTTON_LEFT; sfc_key[RIGHT_1] = CAANOO_BUTTON_RIGHT; sfc_key[UP_1] = CAANOO_BUTTON_UP; sfc_key[DOWN_1] = CAANOO_BUTTON_DOWN; - sfc_key[LEFT_2] = SDLK_g; - sfc_key[RIGHT_2] = SDLK_j; - sfc_key[UP_2] = SDLK_u; - sfc_key[DOWN_2] = SDLK_n; - sfc_key[LU_2] = SDLK_y; - sfc_key[LD_2] = SDLK_b; - sfc_key[RU_2] = SDLK_i; - sfc_key[RD_2] = SDLK_m; - - sfc_key[QUIT] = SDLK_d; - sfc_key[ACCEL] = SDLK_u; + sfc_key[QUIT] = CAANOO_BUTTON_HOME; #elif PANDORA // Pandora mapping sfc_key[A_1] = SDLK_END; //DINGOO_BUTTON_A; A = B @@ -511,7 +495,7 @@ void S9xInitInputDevices () sfc_key[RIGHT_1] = SDLK_RIGHT; //DINGOO_BUTTON_RIGHT; sfc_key[UP_1] = SDLK_UP; //DINGOO_BUTTON_UP; sfc_key[DOWN_1] = SDLK_DOWN; //DINGOO_BUTTON_DOWN; - +/* // for now, essentially unmapped sfc_key[LEFT_2] = SDLK_g; sfc_key[RIGHT_2] = SDLK_j; @@ -524,6 +508,7 @@ void S9xInitInputDevices () sfc_key[QUIT] = SDLK_ESCAPE; sfc_key[ACCEL] = SDLK_TAB; +*/ #else // Dingoo mapping sfc_key[A_1] = DINGOO_BUTTON_A; @@ -538,7 +523,7 @@ void S9xInitInputDevices () sfc_key[RIGHT_1] = DINGOO_BUTTON_RIGHT; sfc_key[UP_1] = DINGOO_BUTTON_UP; sfc_key[DOWN_1] = DINGOO_BUTTON_DOWN; - +/* // for now, essentially unmapped sfc_key[LEFT_2] = SDLK_g; sfc_key[RIGHT_2] = SDLK_j; @@ -551,6 +536,7 @@ void S9xInitInputDevices () sfc_key[QUIT] = SDLK_d; sfc_key[ACCEL] = SDLK_u; +*/ #endif int i = 0; @@ -569,15 +555,15 @@ void S9xInitInputDevices () else if (i == 6) sfc_key[R_1] = atoi(envp); else if (i == 7) sfc_key[START_1] = atoi(envp); else if (i == 8) sfc_key[SELECT_1] = atoi(envp); - else if (i == 9) sfc_key[LEFT_2] = atoi(envp); - else if (i == 10) sfc_key[RIGHT_2] = atoi(envp); - else if (i == 11) sfc_key[UP_2] = atoi(envp); - else if (i == 12) sfc_key[DOWN_2] = atoi(envp); - else if (i == 13) sfc_key[LU_2] = atoi(envp); + else if (i == 9) sfc_key[LEFT_1] = atoi(envp); + else if (i == 10) sfc_key[RIGHT_1] = atoi(envp); + else if (i == 11) sfc_key[UP_1] = atoi(envp); + else if (i == 12) sfc_key[DOWN_1] = atoi(envp); +/* else if (i == 13) sfc_key[LU_2] = atoi(envp); else if (i == 14) sfc_key[LD_2] = atoi(envp); else if (i == 15) sfc_key[RU_2] = atoi(envp); else if (i == 16) sfc_key[RD_2] = atoi(envp); - envp = j + 1; +*/ envp = j + 1; ++i; } while(j); } @@ -1105,12 +1091,12 @@ void S9xSyncSpeed () { if (IPPU.SkippedFrames == 0) { - do - { - CHECK_SOUND (); - // S9xProcessEvents (FALSE); - while (gettimeofday (&now, NULL) < 0) ; - } while (timercmp(&next1, &now, >)); + do + { + CHECK_SOUND (); +// S9xProcessEvents (FALSE); + while (gettimeofday (&now, NULL) < 0) ; + } while (timercmp(&next1, &now, >)); } IPPU.RenderThisFrame = TRUE; IPPU.SkippedFrames = 0; @@ -1153,93 +1139,109 @@ void S9xSyncSpeed () } } -#ifdef CAANOO -void S9xProcessEvents (bool8_32 block) { +void S9xProcessEvents (bool8_32 block) +{ SDL_Event event; - while(SDL_PollEvent(&event)) { - switch (event.type) { + while(SDL_PollEvent(&event)) + { + switch(event.type) + { + // CAANOO ------------------------------------------------------------- +#ifdef CAANOO keyssnes = SDL_JoystickOpen(0); - case SDL_JOYBUTTONDOWN: - switch(event.jbutton.button) { - if (SDL_JoystickGetButton(keyssnes, 9) && SDL_JoystickGetButton(keyssnes, 6) && SDL_JoystickGetButton(keyssnes, 2)) - S9xReset(); - /* My Crap in here ... */ + switch(event.jbutton.button) + { + //QUIT Emulator + if ( SDL_JoystickGetButton(keyssnes, sfc_key[QUIT]) && SDL_JoystickGetButton(keyssnes, sfc_key[X_1] ) ) + { + S9xExit(); + } + // MAINMENU + else if ( SDL_JoystickGetButton(keyssnes, sfc_key[QUIT]) ) + { + gp2x_sound_volume(0, 0); + menu_loop(); + gp2x_sound_volume(vol, vol); + } + break; } break; case SDL_JOYBUTTONUP: - switch(event.jbutton.button) { + switch(event.jbutton.button) + { } break; - } - } -} - #else + //PANDORA & DINGOO ------------------------------------------------------ + case SDL_KEYDOWN: + keyssnes = SDL_GetKeyState(NULL); -void S9xProcessEvents (bool8_32 block) -{ - SDL_Event event; - - while(SDL_PollEvent(&event)) - { - switch(event.type) { - case SDL_KEYDOWN: - keyssnes = SDL_GetKeyState(NULL); - -#ifdef PANDORA // shortcut - if ( event.key.keysym.sym == SDLK_q ) { - exit ( 0 ); // just die - } -#endif - - if ((keyssnes[sfc_key[SELECT_1]] == SDL_PRESSED) && (keyssnes[sfc_key[START_1]] == SDL_PRESSED) && (keyssnes[sfc_key[B_1]] == SDL_PRESSED)) - S9xReset(); - else if ( (keyssnes[sfc_key[SELECT_1]] == SDL_PRESSED) &&(keyssnes[sfc_key[START_1]] == SDL_PRESSED) && (keyssnes[sfc_key[X_1]] == SDL_PRESSED) ) - S9xExit(); - else if ( (keyssnes[sfc_key[START_1]] == SDL_PRESSED) && (keyssnes[sfc_key[R_1]] == SDL_PRESSED) ) { - //extern char snapscreen; - char fname[256], ext[20]; -// Scale_disp=Scale; - gp2x_sound_volume(0, 0); - sprintf(ext, ".00%d", SaveSlotNum); - strcpy(fname, S9xGetFilename (ext)); - S9xFreezeGame (fname); - capt_screenshot(); - sprintf(ext, ".s0%d", SaveSlotNum); - strcpy(fname, S9xGetFilename (ext)); - save_screenshot(fname); - gp2x_sound_volume(vol, vol); - } - else if ( (keyssnes[sfc_key[START_1]] == SDL_PRESSED) && (keyssnes[sfc_key[L_1]] == SDL_PRESSED) ) { - char fname[256], ext[8]; - gp2x_sound_volume(0, 0); - sprintf(ext, ".00%d", SaveSlotNum); - strcpy(fname, S9xGetFilename (ext)); - S9xLoadSnapshot (fname); - gp2x_sound_volume(vol, vol); - } - else if ((keyssnes[sfc_key[SELECT_1]] == SDL_PRESSED)&&(keyssnes[sfc_key[B_1]] == SDL_PRESSED) ) { - gp2x_sound_volume(0, 0); - menu_loop(); - gp2x_sound_volume(vol, vol); + // shortcut #ifdef PANDORA - } else if (event.key.keysym.sym == SDLK_SPACE) { // another shortcut I'm afraid - gp2x_sound_volume(0, 0); - menu_loop(); - gp2x_sound_volume(vol, vol); -#endif - } - break; - case SDL_KEYUP: - keyssnes = SDL_GetKeyState(NULL); + if ( event.key.keysym.sym == SDLK_q ) { + exit ( 0 ); // just die + } +#endif //PANDORA + //QUIT Emulator + if ( (keyssnes[sfc_key[SELECT_1]] == SDL_PRESSED) &&(keyssnes[sfc_key[START_1]] == SDL_PRESSED) && (keyssnes[sfc_key[X_1]] == SDL_PRESSED) ) + S9xExit(); + //RESET ROM Playback + else if ((keyssnes[sfc_key[SELECT_1]] == SDL_PRESSED) && (keyssnes[sfc_key[START_1]] == SDL_PRESSED) && (keyssnes[sfc_key[B_1]] == SDL_PRESSED)) + S9xReset(); + //SAVE State + else if ( (keyssnes[sfc_key[START_1]] == SDL_PRESSED) && (keyssnes[sfc_key[R_1]] == SDL_PRESSED) ) + { + //extern char snapscreen; + char fname[256], ext[20]; + gp2x_sound_volume(0, 0); + sprintf(ext, ".00%d", SaveSlotNum); + strcpy(fname, S9xGetFilename (ext)); + S9xFreezeGame (fname); + capt_screenshot(); + sprintf(ext, ".s0%d", SaveSlotNum); + strcpy(fname, S9xGetFilename (ext)); + save_screenshot(fname); + gp2x_sound_volume(vol, vol); + } + //LOAD State + else if ( (keyssnes[sfc_key[START_1]] == SDL_PRESSED) && (keyssnes[sfc_key[L_1]] == SDL_PRESSED) ) + { + char fname[256], ext[8]; + gp2x_sound_volume(0, 0); + sprintf(ext, ".00%d", SaveSlotNum); + strcpy(fname, S9xGetFilename (ext)); + S9xLoadSnapshot (fname); + gp2x_sound_volume(vol, vol); + } + // MAINMENU + else if ((keyssnes[sfc_key[SELECT_1]] == SDL_PRESSED)&&(keyssnes[sfc_key[B_1]] == SDL_PRESSED) ) + { + gp2x_sound_volume(0, 0); + menu_loop(); + gp2x_sound_volume(vol, vol); +#ifdef PANDORA + } + // another shortcut I'm afraid + else if (event.key.keysym.sym == SDLK_SPACE) + { + gp2x_sound_volume(0, 0); + menu_loop(); + gp2x_sound_volume(vol, vol); +#endif //PANDORA + } + break; + case SDL_KEYUP: + keyssnes = SDL_GetKeyState(NULL); + break; +#endif //CAANOO } } } -#endif +//#endif static long log2 (long num) { @@ -1553,8 +1555,8 @@ void gp2x_sound_volume(int l, int r) ioctl(mixerdev, SOUND_MIXER_WRITE_VOLUME, &l); } -#ifdef CAANOO -uint32 S9xReadJoypad (int which1) { +uint32 S9xReadJoypad (int which1) +{ uint32 val=0x80000000; if (SDL_JoystickGetButton(keyssnes, 4)) val |= SNES_TL_MASK; @@ -1572,13 +1574,38 @@ uint32 S9xReadJoypad (int which1) { return(val); } - -#else - +/* uint32 S9xReadJoypad (int which1) { uint32 val=0x80000000; +// if (which1 > 4) +// return 0; + +// if (which1 == 0 && !Settings.NetPlay) +// S9xLinuxScanJoypads (); + +#ifdef NETPLAY_SUPPORT + if (Settings.NetPlay) + return (S9xNPGetJoypad (which1)); +#endif + +#ifdef CAANOO + //player1 + if (SDL_JoystickGetButton(keyssnes, sfc_key[L_1])) val |= SNES_TL_MASK; + if (SDL_JoystickGetButton(keyssnes, sfc_key[R_1])) val |= SNES_TR_MASK; + if (SDL_JoystickGetButton(keyssnes, sfc_key[X_1])) val |= SNES_X_MASK; + if (SDL_JoystickGetButton(keyssnes, sfc_key[Y_1])) val |= SNES_Y_MASK; + if (SDL_JoystickGetButton(keyssnes, sfc_key[B_1])) val |= SNES_B_MASK; + if (SDL_JoystickGetButton(keyssnes, sfc_key[A_1])) val |= SNES_A_MASK; + if (SDL_JoystickGetButton(keyssnes, sfc_key[START_1])) val |= SNES_START_MASK; + if (SDL_JoystickGetButton(keyssnes, sfc_key[SELECT_1])) val |= SNES_SELECT_MASK; + if (SDL_JoystickGetAxis(keyssnes, 1) < -20000) val |= SNES_UP_MASK; + if (SDL_JoystickGetAxis(keyssnes, 1) > 20000) val |= SNES_DOWN_MASK; + if (SDL_JoystickGetAxis(keyssnes, 0) < -20000) val |= SNES_LEFT_MASK; + if (SDL_JoystickGetAxis(keyssnes, 0) > 20000) val |= SNES_RIGHT_MASK; +#else + //player1 if (keyssnes[sfc_key[L_1]] == SDL_PRESSED) val |= SNES_TL_MASK; if (keyssnes[sfc_key[R_1]] == SDL_PRESSED) val |= SNES_TR_MASK; if (keyssnes[sfc_key[X_1]] == SDL_PRESSED) val |= SNES_X_MASK; @@ -1591,6 +1618,7 @@ uint32 S9xReadJoypad (int which1) if (keyssnes[sfc_key[DOWN_1]] == SDL_PRESSED) val |= SNES_DOWN_MASK; if (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED) val |= SNES_LEFT_MASK; if (keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED) val |= SNES_RIGHT_MASK; + //player2 if (keyssnes[sfc_key[UP_2]] == SDL_PRESSED) val |= SNES_UP_MASK; if (keyssnes[sfc_key[DOWN_2]] == SDL_PRESSED) val |= SNES_DOWN_MASK; if (keyssnes[sfc_key[LEFT_2]] == SDL_PRESSED) val |= SNES_LEFT_MASK; @@ -1599,8 +1627,8 @@ uint32 S9xReadJoypad (int which1) if (keyssnes[sfc_key[LD_2]] == SDL_PRESSED) val |= SNES_LEFT_MASK | SNES_DOWN_MASK; if (keyssnes[sfc_key[RU_2]] == SDL_PRESSED) val |= SNES_RIGHT_MASK | SNES_UP_MASK; if (keyssnes[sfc_key[RD_2]] == SDL_PRESSED) val |= SNES_RIGHT_MASK | SNES_DOWN_MASK; - +#endif + return(val); } - -#endif +*/