savestate and other bugfixes
[fceu.git] / drivers / gp2x / main.c
index 05724c6..ac48a2d 100644 (file)
@@ -39,6 +39,7 @@
 #include "../common/cheat.h"
 
 #include "../../fce.h"
+#include "../../cart.h"
 
 #include "dface.h"
 
@@ -249,7 +250,7 @@ static int DoArgs(int argc, char *argv[])
          {"-input1",0,&inputa[0],0x4001},{"-input2",0,&inputa[1],0x4001},
          {"-fcexp",0,&fcexp,0x4001},
 
-         {"-gg",&docheckie[1],0,0},
+         {"-gg",0,&eoptions,0x8000|EO_GG},
          {"-no8lim",0,&eoptions,0x8000|EO_NO8LIM},
          {"-snapname",0,&eoptions,0x8000|EO_SNAPNAME},
         {"-nofs",0,&eoptions,0x8000|EO_NOFOURSCORE},
@@ -274,8 +275,7 @@ static int DoArgs(int argc, char *argv[])
        }
        if(docheckie[0])
         Settings.region_force=2;
-       if(docheckie[1])
-        FCEUI_SetGameGenie(1);
+       FCEUI_SetGameGenie(eoptions&EO_GG);
         FCEUI_DisableSpriteLimitation(eoptions&EO_NO8LIM);
        FCEUI_SetSnapName(eoptions&EO_SNAPNAME);
 
@@ -388,7 +388,12 @@ int CLImain(int argc, char *argv[])
           ParseGI(fceugi);
           InitOtherInput();
 
-          GameInterface(GI_INFOSTRING, infostring);
+          if ((eoptions&EO_GG) && geniestage == 0) {
+           strcpy(infostring, "gg.rom is missing, GG disabled");
+           eoptions&=~EO_GG;
+           FCEUI_SetGameGenie(0);
+          } else
+           GameInterface(GI_INFOSTRING, infostring);
           FCEU_DispMessage("%s", infostring);
          }
          else
@@ -447,7 +452,7 @@ static int DriverInitialize(void)
 static void DriverKill(void)
 {
  // SaveConfig(NULL); // done explicitly in menu now
- SetSignals(SIG_IGN);
+ SetSignals(SIG_DFL);
 
  if(cpalette) free(cpalette);
  cpalette=0;
@@ -461,11 +466,13 @@ static void DriverKill(void)
 
 void FCEUD_Update(uint8 *xbuf, int16 *Buffer, int Count)
 {
- if(!Count && !(eoptions&EO_NOTHROTTLE))
+ if(!(eoptions&EO_NOTHROTTLE))
+ {
+  if(Count)
+   WriteSound(Buffer,Count);
   SpeedThrottle();
+ }
+ FCEUD_UpdateInput();  // must update input before blitting because of save confirmation stuff
  BlitScreen(xbuf);
- if(Count && !(eoptions&EO_NOTHROTTLE))
-  WriteSound(Buffer,Count);
- FCEUD_UpdateInput();
 }