\r
if (is_sram)\r
{\r
- romfname_ext(saveFname, (PicoAHW & PAHW_MCD) ? "brm"PATH_SEP : "srm"PATH_SEP,\r
- (PicoAHW & PAHW_MCD) ? ".brm" : ".srm");\r
- if (load) {\r
- if (try_ropen_file(saveFname)) return saveFname;\r
- // try in current dir..\r
- romfname_ext(saveFname, NULL, (PicoAHW & PAHW_MCD) ? ".brm" : ".srm");\r
- if (try_ropen_file(saveFname)) return saveFname;\r
- return NULL; // give up\r
- }\r
+ strcpy(ext, (PicoAHW & PAHW_MCD) ? ".brm" : ".srm");\r
+ romfname_ext(saveFname, (PicoAHW & PAHW_MCD) ? "brm"PATH_SEP : "srm"PATH_SEP, ext);\r
+ if (!load)\r
+ return saveFname;\r
+\r
+ if (try_ropen_file(saveFname))\r
+ return saveFname;\r
+\r
+ romfname_ext(saveFname, NULL, ext);\r
+ if (try_ropen_file(saveFname))\r
+ return saveFname;\r
}\r
else\r
{\r
+ const char *ext_main = (currentConfig.EmuOpt & EOPT_GZIP_SAVES) ? ".mds.gz" : ".mds";\r
+ const char *ext_othr = (currentConfig.EmuOpt & EOPT_GZIP_SAVES) ? ".mds" : ".mds.gz";\r
ext[0] = 0;\r
- if(slot > 0 && slot < 10) sprintf(ext, ".%i", slot);\r
- strcat(ext, (currentConfig.EmuOpt & EOPT_GZIP_SAVES) ? ".mds.gz" : ".mds");\r
+ if (slot > 0 && slot < 10)\r
+ sprintf(ext, ".%i", slot);\r
+ strcat(ext, ext_main);\r
+\r
+ if (!load) {\r
+ romfname_ext(saveFname, "mds" PATH_SEP, ext);\r
+ return saveFname;\r
+ }\r
+ else {\r
+ romfname_ext(saveFname, "mds" PATH_SEP, ext);\r
+ if (try_ropen_file(saveFname))\r
+ return saveFname;\r
\r
- romfname_ext(saveFname, "mds" PATH_SEP, ext);\r
- if (load) {\r
- if (try_ropen_file(saveFname)) return saveFname;\r
romfname_ext(saveFname, NULL, ext);\r
- if (try_ropen_file(saveFname)) return saveFname;\r
- // no gzipped states, search for non-gzipped\r
- if (currentConfig.EmuOpt & EOPT_GZIP_SAVES)\r
- {\r
- ext[0] = 0;\r
- if(slot > 0 && slot < 10) sprintf(ext, ".%i", slot);\r
- strcat(ext, ".mds");\r
-\r
- romfname_ext(saveFname, "mds"PATH_SEP, ext);\r
- if (try_ropen_file(saveFname)) return saveFname;\r
- romfname_ext(saveFname, NULL, ext);\r
- if (try_ropen_file(saveFname)) return saveFname;\r
- }\r
- return NULL;\r
+ if (try_ropen_file(saveFname))\r
+ return saveFname;\r
+\r
+ // try the other ext\r
+ ext[0] = 0;\r
+ if (slot > 0 && slot < 10)\r
+ sprintf(ext, ".%i", slot);\r
+ strcat(ext, ext_othr);\r
+\r
+ romfname_ext(saveFname, "mds"PATH_SEP, ext);\r
+ if (try_ropen_file(saveFname))\r
+ return saveFname;\r
}\r
}\r
\r
- return saveFname;\r
+ return NULL;\r
}\r
\r
int emu_check_save_file(int slot)\r