System: Fix blank display on pause-on-start
This commit is contained in:
parent
3be4f1983d
commit
e554456a00
|
@ -7165,7 +7165,7 @@ void FullscreenUI::DoLoadState(std::string path)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error error;
|
Error error;
|
||||||
if (!System::LoadState(path.c_str(), &error, true))
|
if (!System::LoadState(path.c_str(), &error, true, false))
|
||||||
{
|
{
|
||||||
GPUThread::RunOnThread([error_desc = error.TakeDescription()]() {
|
GPUThread::RunOnThread([error_desc = error.TakeDescription()]() {
|
||||||
ShowToast(std::string(), fmt::format(TRANSLATE_FS("System", "Failed to load state: {}"), error_desc));
|
ShowToast(std::string(), fmt::format(TRANSLATE_FS("System", "Failed to load state: {}"), error_desc));
|
||||||
|
|
|
@ -88,7 +88,7 @@ static void HotkeyLoadStateSlot(bool global, s32 slot)
|
||||||
}
|
}
|
||||||
|
|
||||||
Error error;
|
Error error;
|
||||||
if (!System::LoadState(path.c_str(), &error, true))
|
if (!System::LoadState(path.c_str(), &error, true, false))
|
||||||
{
|
{
|
||||||
Host::AddKeyedOSDMessage(
|
Host::AddKeyedOSDMessage(
|
||||||
"LoadState",
|
"LoadState",
|
||||||
|
|
|
@ -1282,7 +1282,7 @@ void SaveStateSelectorUI::LoadCurrentSlot()
|
||||||
{
|
{
|
||||||
Host::RunOnCPUThread([path = std::move(path)]() {
|
Host::RunOnCPUThread([path = std::move(path)]() {
|
||||||
Error error;
|
Error error;
|
||||||
if (!System::LoadState(path.c_str(), &error, true))
|
if (!System::LoadState(path.c_str(), &error, true, false))
|
||||||
{
|
{
|
||||||
Host::AddKeyedOSDMessage("LoadState",
|
Host::AddKeyedOSDMessage("LoadState",
|
||||||
fmt::format(TRANSLATE_FS("OSDMessage", "Failed to load state from slot {0}:\n{1}"),
|
fmt::format(TRANSLATE_FS("OSDMessage", "Failed to load state from slot {0}:\n{1}"),
|
||||||
|
|
|
@ -1823,8 +1823,11 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error)
|
||||||
std::atomic_thread_fence(std::memory_order_release);
|
std::atomic_thread_fence(std::memory_order_release);
|
||||||
SPU::GetOutputStream()->SetPaused(false);
|
SPU::GetOutputStream()->SetPaused(false);
|
||||||
|
|
||||||
|
// Immediately pausing?
|
||||||
|
const bool start_paused = (ShouldStartPaused() || parameters.override_start_paused.value_or(false));
|
||||||
|
|
||||||
// try to load the state, if it fails, bail out
|
// try to load the state, if it fails, bail out
|
||||||
if (!parameters.save_state.empty() && !LoadState(parameters.save_state.c_str(), error, false))
|
if (!parameters.save_state.empty() && !LoadState(parameters.save_state.c_str(), error, false, start_paused))
|
||||||
{
|
{
|
||||||
Error::AddPrefixFmt(error, "Failed to load save state file '{}' for booting:\n",
|
Error::AddPrefixFmt(error, "Failed to load save state file '{}' for booting:\n",
|
||||||
Path::GetFileName(parameters.save_state));
|
Path::GetFileName(parameters.save_state));
|
||||||
|
@ -1852,7 +1855,7 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error)
|
||||||
if (parameters.start_media_capture)
|
if (parameters.start_media_capture)
|
||||||
StartMediaCapture({});
|
StartMediaCapture({});
|
||||||
|
|
||||||
if (ShouldStartPaused() || parameters.override_start_paused.value_or(false))
|
if (start_paused)
|
||||||
PauseSystem(true);
|
PauseSystem(true);
|
||||||
|
|
||||||
UpdateSpeedLimiterState();
|
UpdateSpeedLimiterState();
|
||||||
|
@ -2808,7 +2811,7 @@ std::string System::GetMediaPathFromSaveState(const char* path)
|
||||||
return std::move(buffer.media_path);
|
return std::move(buffer.media_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool System::LoadState(const char* path, Error* error, bool save_undo_state)
|
bool System::LoadState(const char* path, Error* error, bool save_undo_state, bool force_update_display)
|
||||||
{
|
{
|
||||||
if (!IsValid() || IsReplayingGPUDump())
|
if (!IsValid() || IsReplayingGPUDump())
|
||||||
{
|
{
|
||||||
|
@ -2818,11 +2821,12 @@ bool System::LoadState(const char* path, Error* error, bool save_undo_state)
|
||||||
|
|
||||||
if (Achievements::IsHardcoreModeActive())
|
if (Achievements::IsHardcoreModeActive())
|
||||||
{
|
{
|
||||||
Achievements::ConfirmHardcoreModeDisableAsync(TRANSLATE("Achievements", "Loading state"),
|
Achievements::ConfirmHardcoreModeDisableAsync(
|
||||||
[path = std::string(path), save_undo_state](bool approved) {
|
TRANSLATE("Achievements", "Loading state"),
|
||||||
if (approved)
|
[path = std::string(path), save_undo_state, force_update_display](bool approved) {
|
||||||
LoadState(path.c_str(), nullptr, save_undo_state);
|
if (approved)
|
||||||
});
|
LoadState(path.c_str(), nullptr, save_undo_state, force_update_display);
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2849,7 +2853,7 @@ bool System::LoadState(const char* path, Error* error, bool save_undo_state)
|
||||||
|
|
||||||
SaveStateBuffer buffer;
|
SaveStateBuffer buffer;
|
||||||
if (!LoadStateBufferFromFile(&buffer, fp.get(), error, false, true, false, true) ||
|
if (!LoadStateBufferFromFile(&buffer, fp.get(), error, false, true, false, true) ||
|
||||||
!LoadStateFromBuffer(buffer, error, IsPaused()))
|
!LoadStateFromBuffer(buffer, error, force_update_display || IsPaused()))
|
||||||
{
|
{
|
||||||
if (save_undo_state)
|
if (save_undo_state)
|
||||||
UndoLoadState();
|
UndoLoadState();
|
||||||
|
@ -2950,7 +2954,7 @@ bool System::LoadStateDataFromBuffer(std::span<const u8> data, u32 version, Erro
|
||||||
ResetThrottler();
|
ResetThrottler();
|
||||||
|
|
||||||
if (update_display)
|
if (update_display)
|
||||||
GPUThread::PresentCurrentFrame();
|
g_gpu.UpdateDisplay(true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ void ResetSystem();
|
||||||
size_t GetMaxSaveStateSize();
|
size_t GetMaxSaveStateSize();
|
||||||
|
|
||||||
/// Loads state from the specified path.
|
/// Loads state from the specified path.
|
||||||
bool LoadState(const char* path, Error* error, bool save_undo_state);
|
bool LoadState(const char* path, Error* error, bool save_undo_state, bool force_update_display);
|
||||||
bool SaveState(std::string path, Error* error, bool backup_existing_save, bool ignore_memcard_busy);
|
bool SaveState(std::string path, Error* error, bool backup_existing_save, bool ignore_memcard_busy);
|
||||||
bool SaveResumeState(Error* error);
|
bool SaveResumeState(Error* error);
|
||||||
|
|
||||||
|
|
|
@ -806,7 +806,7 @@ void EmuThread::bootOrLoadState(std::string path)
|
||||||
if (System::IsValid())
|
if (System::IsValid())
|
||||||
{
|
{
|
||||||
Error error;
|
Error error;
|
||||||
if (!System::LoadState(path.c_str(), &error, true))
|
if (!System::LoadState(path.c_str(), &error, true, false))
|
||||||
{
|
{
|
||||||
emit errorReported(tr("Error"),
|
emit errorReported(tr("Error"),
|
||||||
tr("Failed to load state: %1").arg(QString::fromStdString(error.GetDescription())));
|
tr("Failed to load state: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||||
|
|
Loading…
Reference in New Issue