From 416c00eae085dd64f35b16949dd76832ca144e9f Mon Sep 17 00:00:00 2001 From: dborth Date: Wed, 13 Jan 2010 05:53:42 +0000 Subject: [PATCH] fix for ROMs > 3 MB, search for gg and fds bios in /fceugx --- source/ngc/cheatmgr.cpp | 13 ++++++++++++- source/ngc/fceugx.cpp | 2 +- source/ngc/fceugx.h | 2 -- source/ngc/fceuload.cpp | 5 ++++- source/ngc/filebrowser.cpp | 12 +----------- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/source/ngc/cheatmgr.cpp b/source/ngc/cheatmgr.cpp index 76d25ff..9841731 100644 --- a/source/ngc/cheatmgr.cpp +++ b/source/ngc/cheatmgr.cpp @@ -151,6 +151,12 @@ bool FindGameGenie() if (GENIEROM) return true; + if(GCSettings.LoadMethod == DEVICE_AUTO) + GCSettings.LoadMethod = autoLoadMethod(); + + if(GCSettings.LoadMethod == DEVICE_AUTO) + return false; + char * tmpbuffer = (char *) memalign(32, 512 * 1024); if(!tmpbuffer) return false; @@ -158,8 +164,13 @@ bool FindGameGenie() size_t romSize = 0; char filepath[1024]; - if (MakeFilePath(filepath, FILE_GGROM)) + sprintf (filepath, "%s%s/gg.rom", pathPrefix[GCSettings.LoadMethod], APPFOLDER); + romSize = LoadFile(tmpbuffer, filepath, 0, SILENT); + if(romSize == 0 && strlen(appPath) > 0) + { + sprintf (filepath, "%s/gg.rom", appPath); romSize = LoadFile(tmpbuffer, filepath, 0, SILENT); + } if (romSize > 0) { diff --git a/source/ngc/fceugx.cpp b/source/ngc/fceugx.cpp index 31dd7d7..78fdd92 100644 --- a/source/ngc/fceugx.cpp +++ b/source/ngc/fceugx.cpp @@ -288,7 +288,7 @@ int main(int argc, char *argv[]) InitGUIThreads(); // allocate memory to store rom - nesrom = (unsigned char *)memalign(32,1024*1024*3); // 3 MB should be plenty + nesrom = (unsigned char *)memalign(32,1024*1024*4); // 4 MB should be plenty /*** Minimal Emulation Loop ***/ if (!FCEUI_Initialize()) diff --git a/source/ngc/fceugx.h b/source/ngc/fceugx.h index c2bad43..1c8a82e 100644 --- a/source/ngc/fceugx.h +++ b/source/ngc/fceugx.h @@ -41,8 +41,6 @@ enum { FILE_RAM, FILE_STATE, FILE_ROM, - FILE_FDSBIOS, - FILE_GGROM, FILE_CHEAT }; diff --git a/source/ngc/fceuload.cpp b/source/ngc/fceuload.cpp index 30b2ef3..a436d54 100644 --- a/source/ngc/fceuload.cpp +++ b/source/ngc/fceuload.cpp @@ -89,8 +89,11 @@ int GCMemROM(int size) char filepath[1024]; - if (MakeFilePath(filepath, FILE_FDSBIOS)) + sprintf (filepath, "%s%s/disksys.rom", pathPrefix[GCSettings.LoadMethod], APPFOLDER); + biosSize = LoadFile(tmpbuffer, filepath, 0, SILENT); + if(biosSize == 0 && strlen(appPath) > 0) { + sprintf (filepath, "%s/disksys.rom", appPath); biosSize = LoadFile(tmpbuffer, filepath, 0, SILENT); } diff --git a/source/ngc/filebrowser.cpp b/source/ngc/filebrowser.cpp index 5ed934f..1636de8 100644 --- a/source/ngc/filebrowser.cpp +++ b/source/ngc/filebrowser.cpp @@ -292,16 +292,6 @@ bool MakeFilePath(char filepath[], int type, char * filename, int filenum) } break; - case FILE_FDSBIOS: - sprintf(folder, "fceugx"); - sprintf(file, "disksys.rom"); - break; - - case FILE_GGROM: - sprintf(folder, "fceugx"); - sprintf(file, "gg.rom"); - break; - case FILE_CHEAT: sprintf(folder, GCSettings.CheatFolder); sprintf(file, "%s.cht", romFilename); @@ -353,7 +343,7 @@ static bool IsValidROM() { // file size should be between 8K and 3MB if(browserList[browser.selIndex].length < (1024*8) || - browserList[browser.selIndex].length > (1024*1024*3)) + browserList[browser.selIndex].length > (1024*1024*4)) { ErrorPrompt("Invalid file size!"); return false;