FullscreenUI: Fix assert when booting+loading state

pull/3396/head
Stenzek 8 months ago
parent 03d7af2efc
commit 9411e40c20
No known key found for this signature in database

@ -5033,10 +5033,9 @@ void FullscreenUI::DrawGraphicsSettingsPage()
if (is_hardware) if (is_hardware)
{ {
DrawIntListSetting( DrawIntListSetting(bsi, FSUI_ICONSTR(ICON_FA_EXPAND_ALT, "Internal Resolution"),
bsi, FSUI_ICONSTR(ICON_FA_EXPAND_ALT, "Internal Resolution"), FSUI_CSTR("Upscales the game's rendering by the specified multiplier."), "GPU",
FSUI_CSTR("Upscales the game's rendering by the specified multiplier."), "ResolutionScale", 1, resolution_scales);
"GPU", "ResolutionScale", 1, resolution_scales);
DrawEnumSetting(bsi, FSUI_ICONSTR(ICON_FA_COMPRESS_ALT, "Downsampling"), DrawEnumSetting(bsi, FSUI_ICONSTR(ICON_FA_COMPRESS_ALT, "Downsampling"),
FSUI_CSTR("Downsamples the rendered image prior to displaying it. Can improve " FSUI_CSTR("Downsamples the rendered image prior to displaying it. Can improve "
@ -7339,34 +7338,37 @@ void FullscreenUI::DoLoadState(std::string path)
std::string boot_path = std::move(s_state.save_state_selector_game_path); std::string boot_path = std::move(s_state.save_state_selector_game_path);
CloseSaveStateSelector(); CloseSaveStateSelector();
Host::RunOnCPUThread([boot_path = std::move(boot_path), path = std::move(path)]() mutable { if (GPUThread::HasGPUBackend())
if (System::IsValid()) {
{ Host::RunOnCPUThread([boot_path = std::move(boot_path), path = std::move(path)]() mutable {
if (path.empty()) if (System::IsValid())
{ {
// Loading undo state. if (path.empty())
if (!System::UndoLoadState())
{ {
GPUThread::RunOnThread( // Loading undo state.
[]() { ShowToast(std::string(), TRANSLATE_STR("System", "Failed to undo load state.")); }); if (!System::UndoLoadState())
{
GPUThread::RunOnThread(
[]() { ShowToast(std::string(), TRANSLATE_STR("System", "Failed to undo load state.")); });
}
} }
} else
else
{
Error error;
if (!System::LoadState(path.c_str(), &error, true, false))
{ {
GPUThread::RunOnThread([error_desc = error.TakeDescription()]() { Error error;
ShowToast(std::string(), fmt::format(TRANSLATE_FS("System", "Failed to load state: {}"), error_desc)); if (!System::LoadState(path.c_str(), &error, true, false))
}); {
GPUThread::RunOnThread([error_desc = error.TakeDescription()]() {
ShowToast(std::string(), fmt::format(TRANSLATE_FS("System", "Failed to load state: {}"), error_desc));
});
}
} }
} }
} });
else }
{ else
DoStartPath(std::move(boot_path), std::move(path)); {
} DoStartPath(std::move(boot_path), std::move(path));
}); }
} }
void FullscreenUI::DoSaveState(s32 slot, bool global) void FullscreenUI::DoSaveState(s32 slot, bool global)

Loading…
Cancel
Save