X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=fds.c;h=501aefcc86a2ef3c8d86d2835c003b4bd7af9956;hp=41b3a5d7553aea5d98cd8b4c0596c3dee8da66a1;hb=642070a99a18726024c5b214263221a0340e6987;hpb=e1591a12a775a600572ffccb2d6f8f4d6343b7dd diff --git a/fds.c b/fds.c index 41b3a5d..501aefc 100644 --- a/fds.c +++ b/fds.c @@ -22,6 +22,10 @@ #include #include +#ifdef GP2X +#include // for sync() +#endif + #include "types.h" #include "x6502.h" #include "fce.h" @@ -85,12 +89,13 @@ static uint8 SelectDisk,InDisk; #define DC_INC 1 -void FDSGI(int h) +void FDSGI(int h, void *param) { switch(h) { case GI_CLOSE: FDSClose();break; case GI_POWER: FDSInit();break; + case GI_INFOSTRING: sprintf(param, "FDS, Sides: %d", TotalSides);break; } } @@ -150,9 +155,9 @@ static void FDSInit(void) int page; // asm code needs pages to be set again.. for (page=12; page<28; page++) // 0x6000-0xdfff 32K RAM - Page[page]=FDSRAM - (page<<11) + ((page-12)<<11); + Page[page]=FDSRAM - (12<<11); for (; page<32; page++) // 0xe000-0xffff 8K BIOS - Page[page]=FDSBIOS - (page<<11) + ((page-28)<<11); + Page[page]=FDSBIOS - (28<<11); } #endif } @@ -819,6 +824,7 @@ int FDSLoad(const char *name, int fp) FCEU_PrintError("FDS BIOS ROM image missing!"); FreeFDSMemory(); free(fn); + LoadGameLastError = 10; return 0; } @@ -829,6 +835,7 @@ int FDSLoad(const char *name, int fp) fclose(zp); FreeFDSMemory(); FCEU_PrintError("Error reading FDS BIOS ROM image."); + LoadGameLastError = 10; return 0; } @@ -853,6 +860,7 @@ int FDSLoad(const char *name, int fp) { FCEU_PrintError("Error reading auxillary FDS file."); free(fn); + LoadGameLastError = 11; return(0); } FCEU_fclose(tp); @@ -907,26 +915,41 @@ void FDSClose(void) { FILE *fp; int x; - char *fn=FCEU_MakeFName(FCEUMKF_FDS,0,0); - - if(!DiskWritten) return; + char *fn; - if(!(fp=FCEUD_UTF8fopen(fn,"wb"))) + if(!DiskWritten) { - free(fn); - return; - } - free(fn); + fn=FCEU_MakeFName(FCEUMKF_FDS,0,0); - for(x=0;x