FullscreenUI: Fix slot disappearing after delete in save state menu
This commit is contained in:
parent
ea82dacb0e
commit
738c96ffb3
|
@ -399,8 +399,7 @@ struct SaveStateListEntry
|
||||||
bool global;
|
bool global;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void InitializePlaceholderSaveStateListEntry(SaveStateListEntry* li, const std::string& serial, s32 slot,
|
static void InitializePlaceholderSaveStateListEntry(SaveStateListEntry* li, s32 slot, bool global);
|
||||||
bool global);
|
|
||||||
static bool InitializeSaveStateListEntryFromSerial(SaveStateListEntry* li, const std::string& serial, s32 slot,
|
static bool InitializeSaveStateListEntryFromSerial(SaveStateListEntry* li, const std::string& serial, s32 slot,
|
||||||
bool global);
|
bool global);
|
||||||
static bool InitializeSaveStateListEntryFromPath(SaveStateListEntry* li, std::string path, s32 slot, bool global);
|
static bool InitializeSaveStateListEntryFromPath(SaveStateListEntry* li, std::string path, s32 slot, bool global);
|
||||||
|
@ -6276,8 +6275,7 @@ void FullscreenUI::DrawPauseMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullscreenUI::InitializePlaceholderSaveStateListEntry(SaveStateListEntry* li, const std::string& serial, s32 slot,
|
void FullscreenUI::InitializePlaceholderSaveStateListEntry(SaveStateListEntry* li, s32 slot, bool global)
|
||||||
bool global)
|
|
||||||
{
|
{
|
||||||
li->title = (global || slot > 0) ? fmt::format(global ? FSUI_FSTR("Global Slot {0}##global_slot_{0}") :
|
li->title = (global || slot > 0) ? fmt::format(global ? FSUI_FSTR("Global Slot {0}##global_slot_{0}") :
|
||||||
FSUI_FSTR("Game Slot {0}##game_slot_{0}"),
|
FSUI_FSTR("Game Slot {0}##game_slot_{0}"),
|
||||||
|
@ -6298,7 +6296,7 @@ bool FullscreenUI::InitializeSaveStateListEntryFromSerial(SaveStateListEntry* li
|
||||||
(global ? System::GetGlobalSaveStateFileName(slot) : System::GetGameSaveStateFileName(serial, slot));
|
(global ? System::GetGlobalSaveStateFileName(slot) : System::GetGameSaveStateFileName(serial, slot));
|
||||||
if (!InitializeSaveStateListEntryFromPath(li, path.c_str(), slot, global))
|
if (!InitializeSaveStateListEntryFromPath(li, path.c_str(), slot, global))
|
||||||
{
|
{
|
||||||
InitializePlaceholderSaveStateListEntry(li, serial, slot, global);
|
InitializePlaceholderSaveStateListEntry(li, slot, global);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6575,7 +6573,11 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
|
||||||
else if (FileSystem::DeleteFile(entry.path.c_str()))
|
else if (FileSystem::DeleteFile(entry.path.c_str()))
|
||||||
{
|
{
|
||||||
ShowToast({}, fmt::format(FSUI_FSTR("{} deleted."), ImGuiFullscreen::RemoveHash(entry.title)));
|
ShowToast({}, fmt::format(FSUI_FSTR("{} deleted."), ImGuiFullscreen::RemoveHash(entry.title)));
|
||||||
|
if (is_loading)
|
||||||
s_state.save_state_selector_slots.erase(s_state.save_state_selector_slots.begin() + i);
|
s_state.save_state_selector_slots.erase(s_state.save_state_selector_slots.begin() + i);
|
||||||
|
else
|
||||||
|
InitializePlaceholderSaveStateListEntry(&entry, entry.slot, entry.global);
|
||||||
|
|
||||||
removed = true;
|
removed = true;
|
||||||
|
|
||||||
if (s_state.save_state_selector_slots.empty())
|
if (s_state.save_state_selector_slots.empty())
|
||||||
|
|
Loading…
Reference in New Issue