Add a toggle to hide/show the "Save RAM" button (#474)

This commit is contained in:
InfiniteBlueGX 2022-10-09 20:46:49 -05:00 committed by GitHub
parent 2246982692
commit 622b1a29a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 24 deletions

View File

@ -121,6 +121,7 @@ struct SGCSettings
int Rumble; int Rumble;
int language; int language;
int PreviewImage; int PreviewImage;
int HideRAMSaving;
int TurboModeEnabled; // 0 - disabled, 1 - enabled int TurboModeEnabled; // 0 - disabled, 1 - enabled
}; };

View File

@ -269,7 +269,10 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
} }
else else
{ {
selectedItem -= 1; if(saveBtn[selectedItem-1]->IsVisible())
{
selectedItem -= 1;
}
} }
} }
else if(t->Down() || arrowDownBtn->GetState() == STATE_CLICKED) else if(t->Down() || arrowDownBtn->GetState() == STATE_CLICKED)
@ -307,7 +310,10 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
} }
else else
{ {
selectedItem -= 2; if(saveBtn[selectedItem-2]->IsVisible())
{
selectedItem -= 2;
}
} }
} }
@ -324,20 +330,25 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
if(listOffset+i < 0 && action == 1) if(listOffset+i < 0 && action == 1)
{ {
saveDate[0]->SetText(NULL); saveDate[0]->SetText(NULL);
saveDate[1]->SetText(NULL);
saveTime[0]->SetText("New"); saveTime[0]->SetText("New");
saveTime[1]->SetText("New"); saveType[0]->SetText("State");
saveType[0]->SetText("RAM");
saveType[1]->SetText("State");
savePreviewImg[0]->SetImage(gameSaveBlank); savePreviewImg[0]->SetImage(gameSaveBlank);
savePreviewImg[1]->SetImage(gameSaveBlank);
saveBtn[0]->SetVisible(true); saveBtn[0]->SetVisible(true);
saveBtn[1]->SetVisible(true);
if(saveBtn[0]->GetState() == STATE_DISABLED) if(saveBtn[0]->GetState() == STATE_DISABLED)
saveBtn[0]->SetState(STATE_DEFAULT); saveBtn[0]->SetState(STATE_DEFAULT);
if(saveBtn[1]->GetState() == STATE_DISABLED)
saveBtn[1]->SetState(STATE_DEFAULT); if (GCSettings.HideRAMSaving == 0)
{
saveDate[1]->SetText(NULL);
saveTime[1]->SetText("New");
saveType[1]->SetText("RAM");
savePreviewImg[1]->SetImage(gameSaveBlank);
saveBtn[1]->SetVisible(true);
if(saveBtn[1]->GetState() == STATE_DISABLED)
saveBtn[1]->SetState(STATE_DEFAULT);
}
} }
else if(listOffset+i < saves->length) else if(listOffset+i < saves->length)
{ {

View File

@ -1998,20 +1998,7 @@ static int MenuGameSaves(int action)
} }
else // save else // save
{ {
if(ret == -2) // new RAM if(ret == -2) // new State
{
for(i=1; i < 100; i++)
if(saves.files[FILE_RAM][i] == 0)
break;
if(i < 100)
{
MakeFilePath(filepath, FILE_RAM, romFilename, i);
SaveRAM(filepath, NOTSILENT);
menu = MENU_GAME_SAVE;
}
}
else if(ret == -1) // new State
{ {
for(i=1; i < 100; i++) for(i=1; i < 100; i++)
if(saves.files[FILE_STATE][i] == 0) if(saves.files[FILE_STATE][i] == 0)
@ -2024,6 +2011,19 @@ static int MenuGameSaves(int action)
menu = MENU_GAME_SAVE; menu = MENU_GAME_SAVE;
} }
} }
else if(ret == -1 && GCSettings.HideRAMSaving == 0) // new RAM
{
for(i=1; i < 100; i++)
if(saves.files[FILE_RAM][i] == 0)
break;
if(i < 100)
{
MakeFilePath(filepath, FILE_RAM, romFilename, i);
SaveRAM(filepath, NOTSILENT);
menu = MENU_GAME_SAVE;
}
}
else // overwrite RAM/State else // overwrite RAM/State
{ {
MakeFilePath(filepath, saves.type[ret], saves.filename[ret]); MakeFilePath(filepath, saves.type[ret], saves.filename[ret]);
@ -3943,6 +3943,7 @@ static int MenuSettingsMenu()
sprintf(options.name[i++], "Rumble"); sprintf(options.name[i++], "Rumble");
sprintf(options.name[i++], "Language"); sprintf(options.name[i++], "Language");
sprintf(options.name[i++], "Preview Image"); sprintf(options.name[i++], "Preview Image");
sprintf(options.name[i++], "Hide RAM Saving");
options.length = i; options.length = i;
for(i=0; i < options.length; i++) for(i=0; i < options.length; i++)
@ -4028,6 +4029,9 @@ static int MenuSettingsMenu()
if(GCSettings.PreviewImage > 2) if(GCSettings.PreviewImage > 2)
GCSettings.PreviewImage = 0; GCSettings.PreviewImage = 0;
break; break;
case 7:
GCSettings.HideRAMSaving ^= 1;
break;
} }
if(ret >= 0 || firstRun) if(ret >= 0 || firstRun)
@ -4077,6 +4081,11 @@ static int MenuSettingsMenu()
else else
sprintf (options.value[4], "Disabled"); sprintf (options.value[4], "Disabled");
if (GCSettings.HideRAMSaving == 1)
sprintf (options.value[7], "On");
else
sprintf (options.value[7], "Off");
switch(GCSettings.language) switch(GCSettings.language)
{ {
case LANG_JAPANESE: sprintf(options.value[5], "Japanese"); break; case LANG_JAPANESE: sprintf(options.value[5], "Japanese"); break;

View File

@ -169,6 +169,7 @@ preparePrefsData ()
createXMLSetting("Rumble", "Rumble", toStr(GCSettings.Rumble)); createXMLSetting("Rumble", "Rumble", toStr(GCSettings.Rumble));
createXMLSetting("language", "Language", toStr(GCSettings.language)); createXMLSetting("language", "Language", toStr(GCSettings.language));
createXMLSetting("PreviewImage", "Preview Image", toStr(GCSettings.PreviewImage)); createXMLSetting("PreviewImage", "Preview Image", toStr(GCSettings.PreviewImage));
createXMLSetting("HideRAMSaving", "Hide RAM Saving", toStr(GCSettings.HideRAMSaving));
createXMLSection("Controller", "Controller Settings"); createXMLSection("Controller", "Controller Settings");
@ -342,6 +343,7 @@ decodePrefsData ()
loadXMLSetting(&GCSettings.Rumble, "Rumble"); loadXMLSetting(&GCSettings.Rumble, "Rumble");
loadXMLSetting(&GCSettings.language, "language"); loadXMLSetting(&GCSettings.language, "language");
loadXMLSetting(&GCSettings.PreviewImage, "PreviewImage"); loadXMLSetting(&GCSettings.PreviewImage, "PreviewImage");
loadXMLSetting(&GCSettings.HideRAMSaving, "HideRAMSaving");
// Controller Settings // Controller Settings
@ -439,6 +441,7 @@ DefaultSettings ()
GCSettings.SFXVolume = 40; GCSettings.SFXVolume = 40;
GCSettings.Rumble = 1; // Enabled GCSettings.Rumble = 1; // Enabled
GCSettings.PreviewImage = 0; GCSettings.PreviewImage = 0;
GCSettings.HideRAMSaving = 0;
#ifdef HW_RVL #ifdef HW_RVL
GCSettings.language = CONF_GetLanguage(); GCSettings.language = CONF_GetLanguage();