From 6c69cf33c2de2a094da23c8d504675a1ff496b92 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 13 Aug 2022 13:59:58 +1000 Subject: [PATCH] System: Fix loading states with different media path --- src/core/system.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/system.cpp b/src/core/system.cpp index a5beaaf65..8e0eb210f 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -1047,7 +1047,9 @@ bool System::BootSystem(SystemBootParameters parameters) if (!parameters.save_state.empty()) { // loading a state, so pull the media path from the save state to avoid a double change - parameters.filename = GetMediaPathFromSaveState(parameters.save_state.c_str()); + std::string state_media(GetMediaPathFromSaveState(parameters.save_state.c_str())); + if (FileSystem::FileExists(state_media.c_str())) + parameters.filename = std::move(state_media); } if (parameters.filename.empty()) @@ -1777,6 +1779,7 @@ bool System::DoLoadState(ByteStream* state, bool force_software_renderer, bool u "existing image '%s', this may result in instability."), media_filename.c_str(), error.GetCodeAndMessage().GetCharArray(), old_media->GetFileName().c_str()); media = std::move(old_media); + header.media_subimage_index = media->GetCurrentSubImage(); } else {