From 8a7d51928f138a94cae682f4afc544bdcd0e6356 Mon Sep 17 00:00:00 2001 From: libertyernie Date: Wed, 30 Aug 2017 18:44:18 -0500 Subject: [PATCH] Port option to not append " Auto" from vbagx --- source/fceugx.h | 1 + source/fceuram.cpp | 3 +++ source/filebrowser.cpp | 5 ++++- source/menu.cpp | 10 ++++++++++ source/preferences.cpp | 2 ++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/source/fceugx.h b/source/fceugx.h index e170b60..e1f45fb 100644 --- a/source/fceugx.h +++ b/source/fceugx.h @@ -83,6 +83,7 @@ struct SGCSettings int AutoSave; int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB) int SaveMethod; // For SRAM, Freeze, Prefs: Auto, SD, USB, SMB + int AppendAuto; // 0 - no, 1 - yes char LoadFolder[MAXPATHLEN]; // Path to game files char LastFileLoaded[MAXPATHLEN]; //Last file loaded filename char SaveFolder[MAXPATHLEN]; // Path to save files diff --git a/source/fceuram.cpp b/source/fceuram.cpp index fb70548..b2f6624 100644 --- a/source/fceuram.cpp +++ b/source/fceuram.cpp @@ -154,6 +154,9 @@ LoadRAMAuto (bool silent) if (LoadRAM(filepath, silent)) return true; + if (!GCSettings.AppendAuto) + return false; + // look for file with no number or Auto appended if(!MakeFilePath(filepath2, FILE_RAM, romFilename, -1)) return false; diff --git a/source/filebrowser.cpp b/source/filebrowser.cpp index 1333ff7..6aa7abb 100644 --- a/source/filebrowser.cpp +++ b/source/filebrowser.cpp @@ -280,7 +280,10 @@ bool MakeFilePath(char filepath[], int type, char * filename, int filenum) if(filenum == -1) sprintf(file, "%s.%s", filename, ext); else if(filenum == 0) - sprintf(file, "%s Auto.%s", filename, ext); + if (GCSettings.AppendAuto <= 0) + sprintf(file, "%s.%s", filename, ext); + else + sprintf(file, "%s Auto.%s", filename, ext); else sprintf(file, "%s %i.%s", filename, filenum, ext); } diff --git a/source/menu.cpp b/source/menu.cpp index 4f8d41b..34f45be 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -3549,6 +3549,7 @@ static int MenuSettingsFile() sprintf(options.name[i++], "Screenshots Folder"); sprintf(options.name[i++], "Auto Load"); sprintf(options.name[i++], "Auto Save"); + sprintf(options.name[i++], "Append Auto to .SAV Files"); options.length = i; for(i=0; i < options.length; i++) @@ -3634,6 +3635,12 @@ static int MenuSettingsFile() if (GCSettings.AutoSave > 3) GCSettings.AutoSave = 0; break; + + case 8: + GCSettings.AppendAuto++; + if (GCSettings.AppendAuto > 1) + GCSettings.AppendAuto = 0; + break; } if(ret >= 0 || firstRun) @@ -3706,6 +3713,9 @@ static int MenuSettingsFile() else if (GCSettings.AutoSave == 2) sprintf (options.value[7],"State"); else if (GCSettings.AutoSave == 3) sprintf (options.value[7],"Both"); + if (GCSettings.AppendAuto == 0) sprintf (options.value[10], "Off"); + else if (GCSettings.AppendAuto == 1) sprintf (options.value[10], "On"); + optionBrowser.TriggerUpdate(); } diff --git a/source/preferences.cpp b/source/preferences.cpp index 5dcf121..cb2e8fe 100644 --- a/source/preferences.cpp +++ b/source/preferences.cpp @@ -126,6 +126,7 @@ preparePrefsData () createXMLSetting("LoadFolder", "Load Folder", GCSettings.LoadFolder); createXMLSetting("LastFileLoaded", "Last File Loaded", GCSettings.LastFileLoaded); createXMLSetting("SaveFolder", "Save Folder", GCSettings.SaveFolder); + createXMLSetting("AppendAuto", "Append Auto to .SAV Files", toStr(GCSettings.AppendAuto)); createXMLSetting("CheatFolder", "Cheats Folder", GCSettings.CheatFolder); createXMLSetting("gamegenie", "Game Genie", toStr(GCSettings.gamegenie)); createXMLSetting("ScreenshotsFolder", "Screenshots Folder", GCSettings.ScreenshotsFolder); @@ -299,6 +300,7 @@ decodePrefsData () loadXMLSetting(GCSettings.LoadFolder, "LoadFolder", sizeof(GCSettings.LoadFolder)); loadXMLSetting(GCSettings.LastFileLoaded, "LastFileLoaded", sizeof(GCSettings.LastFileLoaded)); loadXMLSetting(GCSettings.SaveFolder, "SaveFolder", sizeof(GCSettings.SaveFolder)); + loadXMLSetting(&GCSettings.AppendAuto, "AppendAuto"); loadXMLSetting(GCSettings.CheatFolder, "CheatFolder", sizeof(GCSettings.CheatFolder)); loadXMLSetting(&GCSettings.gamegenie, "gamegenie"); loadXMLSetting(GCSettings.ScreenshotsFolder, "ScreenshotsFolder", sizeof(GCSettings.ScreenshotsFolder));