#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
-\r
- if(!DiskWritten) return;\r
+ char *fn;\r
\r
- if(!(fp=FCEUD_UTF8fopen(fn,"wb")))\r
+ if(!DiskWritten)\r
{\r
- free(fn);\r
- return;\r
- }\r
- free(fn);\r
+ fn=FCEU_MakeFName(FCEUMKF_FDS,0,0);\r
\r
- for(x=0;x<TotalSides;x++)\r
- {\r
- if(fwrite(diskdata[x],1,65500,fp)!=65500)\r
+ if(!(fp=FCEUD_UTF8fopen(fn,"wb")))\r
{\r
- FCEU_PrintError("Error saving FDS image!");\r
- fclose(fp);\r
+ free(fn);\r
return;\r
}\r
+ free(fn);\r
+\r
+ for(x=0;x<TotalSides;x++)\r
+ {\r
+ if(fwrite(diskdata[x],1,65500,fp)!=65500)\r
+ {\r
+ FCEU_PrintError("Error saving FDS image!");\r
+ fclose(fp);\r
+ return;\r
+ }\r
+ }\r
+ fclose(fp);\r
+#ifdef GP2X\r
+ sync();\r
+#endif\r
}\r
+\r
FreeFDSMemory();\r
- fclose(fp);\r
+ for(x=0;x<TotalSides;x++)\r
+ if(diskdatao[x])\r
+ {\r
+ free(diskdatao[x]);\r
+ diskdatao[x]=0;\r
+ }\r
+ ResetExState(0,0);\r
}\r
+\r