#include <stdlib.h>
#include <stdio.h>
+#ifdef GP2X
+#include <unistd.h> // for sync()
+#endif
+
#include "types.h"
#include "fce.h"
#include "ppu.h"
fwrite(LocalHWInfo->SaveGame[x],1,
LocalHWInfo->SaveGameLen[x],sp);
}
+ fclose(sp);
+#ifdef GP2X
+ sync();
+#endif
}
free(soot);
}
for(x=0;x<4;x++)
if(LocalHWInfo->SaveGame[x])
fread(LocalHWInfo->SaveGame[x],1,LocalHWInfo->SaveGameLen[x],sp);
+ fclose(sp);
}
free(soot);
}
#include "dface.h"
-// TODO! broken fs0, sram saves
-
void CleanSurface(void);
// internals
if (Settings.region_force)
FCEUI_SetVidSystem(Settings.region_force - 1);
ParseGI(fceugi);
- //RefreshThrottleFPS();
InitOtherInput();
GameInterface(GI_INFOSTRING, infostring);
}
PrepareOtherInput();
+ RefreshThrottleFPS();
FCEUI_GetCurrentVidSystem(&srendline,&erendline);
gp2x_video_changemode(Settings.scaling == 3 ? 15 : 8);
switch (Settings.scaling & 3) {
#include "gp2x.h"
#include "throttle.h"
-#if 0
-static uint64 tfreq;
-static uint64 desiredfps;
-
-void RefreshThrottleFPS(void)
-{
- uint64 f=FCEUI_GetDesiredFPS();
- // great, a bit faster than before
- //f = (f*65) >> 6;
- desiredfps=f>>8;
- tfreq=1000000;
- tfreq<<=16; /* Adjustment for fps returned from FCEUI_GetDesiredFPS(). */
-}
-
-static uint64 GetCurTime(void)
-{
- uint64 ret;
- struct timeval tv;
-
- gettimeofday(&tv,0);
- ret=(uint64)tv.tv_sec*1000000;
- ret+=tv.tv_usec;
- return(ret);
-}
-
-INLINE void SpeedThrottle(void)
-{
- static uint64 ttime,ltime;
-
- waiter:
-
- ttime=GetCurTime();
-
- if( (ttime-ltime) < (tfreq/desiredfps) )
- {
- goto waiter;
- }
- if( (ttime-ltime) >= (tfreq*4/desiredfps))
- ltime=ttime;
- else
- ltime+=tfreq/desiredfps;
-}
-
-#else
extern uint8 PAL;
extern int FSkip;
static int usec_aim = 0, usec_done = 0;
static int skip_count = 0;
-INLINE void SpeedThrottle(void)
+void RefreshThrottleFPS(void)
+{
+ usec_aim = usec_done = skip_count = 0;
+}
+
+void SpeedThrottle(void)
{
static struct timeval tv_prev;
struct timeval tv_now;
usec_done = usec_done - usec_aim + 1; // reset to prevent overflows
usec_aim = 0;
}
-#endif
#include <stdlib.h>\r
#include <string.h>\r
\r
+#ifdef GP2X\r
+#include <unistd.h> // for sync()\r
+#endif\r
+\r
#include "types.h"\r
#include "x6502.h"\r
#include "fce.h"\r
{\r
FILE *fp;\r
int x;\r
- char *fn=FCEU_MakeFName(FCEUMKF_FDS,0,0);\r
+ char *fn;\r
\r
if(!DiskWritten) return;\r
\r
+ fn=FCEU_MakeFName(FCEUMKF_FDS,0,0);\r
+\r
if(!(fp=FCEUD_UTF8fopen(fn,"wb")))\r
{\r
free(fn);\r
}\r
FreeFDSMemory();\r
fclose(fp);\r
+#ifdef GP2X\r
+ sync();\r
+#endif\r
}\r
+\r