Add SRAM_IMPORT_EXPORT path setting to separate from the auto-save battery location.

This commit is contained in:
SuuperW 2018-11-04 06:08:08 -06:00
parent c8306de8d2
commit c8d534299f
4 changed files with 14 additions and 6 deletions

View File

@ -179,7 +179,7 @@ bool importSave(HWND hwnd, HINSTANCE hAppInst)
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "sav";
ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
std::string dir = path.getpath(path.BATTERY);
std::string dir = path.getpath(path.SRAM_IMPORT_EXPORT);
ofn.lpstrInitialDir = dir.c_str();
if(!GetOpenFileName(&ofn))
@ -189,8 +189,8 @@ bool importSave(HWND hwnd, HINSTANCE hAppInst)
if (res < MAX_SAVE_TYPES)
{
std::string dir = Path::GetFileDirectoryPath(SavFName);
path.setpath(path.BATTERY, dir);
WritePrivateProfileString(SECTION, BATTERYKEY, dir.c_str(), IniName);
path.setpath(path.SRAM_IMPORT_EXPORT, dir);
WritePrivateProfileString(SECTION, SRAMIMPORTKEY, dir.c_str(), IniName);
res = MMU_new.backupDevice.importData(SavFName, save_types[res+1].size);
if (res)
@ -219,15 +219,15 @@ bool exportSave(HWND hwnd, HINSTANCE hAppInst)
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "sav";
ofn.Flags = OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
std::string dir = path.getpath(path.BATTERY);
std::string dir = path.getpath(path.SRAM_IMPORT_EXPORT);
ofn.lpstrInitialDir = dir.c_str();
if (!GetSaveFileName(&ofn))
return true;
dir = Path::GetFileDirectoryPath(SavFName);
path.setpath(path.BATTERY, dir);
WritePrivateProfileString(SECTION, BATTERYKEY, dir.c_str(), IniName);
path.setpath(path.SRAM_IMPORT_EXPORT, dir);
WritePrivateProfileString(SECTION, SRAMIMPORTKEY, dir.c_str(), IniName);
if (ofn.nFilterIndex == 2) strcat(SavFName, "*");

View File

@ -107,6 +107,7 @@ void WritePathSettings()
{
WritePrivateProfileString(SECTION, ROMKEY, path.pathToRoms, IniName);
WritePrivateProfileString(SECTION, BATTERYKEY, path.pathToBattery, IniName);
WritePrivateProfileString(SECTION, SRAMIMPORTKEY, path.pathToSramImportExport, IniName);
WritePrivateProfileString(SECTION, STATEKEY, path.pathToStates, IniName);
WritePrivateProfileString(SECTION, STATESLOTKEY, path.pathToStateSlots, IniName);
WritePrivateProfileString(SECTION, SCREENSHOTKEY, path.pathToScreenshots, IniName);

View File

@ -253,6 +253,7 @@ void PathInfo::ReadPathSettings()
ReadKey(pathToRoms, ROMKEY);
ReadKey(pathToBattery, BATTERYKEY);
ReadKey(pathToSramImportExport, SRAMIMPORTKEY);
ReadKey(pathToStates, STATEKEY);
ReadKey(pathToStateSlots, STATESLOTKEY);
ReadKey(pathToScreenshots, SCREENSHOTKEY);
@ -293,6 +294,9 @@ void PathInfo::SwitchPath(Action action, KnownPath path, char *buffer)
case BATTERY:
pathToCopy = pathToBattery;
break;
case SRAM_IMPORT_EXPORT:
pathToCopy = pathToSramImportExport;
break;
case STATES:
pathToCopy = pathToStates;
break;

View File

@ -72,6 +72,7 @@ public:
#define ROMKEY "Roms"
#define BATTERYKEY "Battery"
#define SRAMIMPORTKEY "SramImportExport"
#define STATEKEY "States"
#define STATESLOTKEY "StateSlots"
#define SCREENSHOTKEY "Screenshots"
@ -94,6 +95,7 @@ public:
FIRSTKNOWNPATH = 0,
ROMS = 0,
BATTERY,
SRAM_IMPORT_EXPORT,
STATES,
STATE_SLOTS,
SCREENSHOTS,
@ -108,6 +110,7 @@ public:
char pathToRoms[MAX_PATH];
char pathToBattery[MAX_PATH];
char pathToSramImportExport[MAX_PATH];
char pathToStates[MAX_PATH];
char pathToStateSlots[MAX_PATH];
char pathToScreenshots[MAX_PATH];