From c637e2b3376f20992dde67a58551f3d22f8cf924 Mon Sep 17 00:00:00 2001
From: Stenzek <stenzek@gmail.com>
Date: Fri, 31 May 2024 21:08:45 +1000
Subject: [PATCH] System: Fix title after loading state for EXE-boot

---
 src/core/system.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/core/system.cpp b/src/core/system.cpp
index 97004db61..3f583abb4 100644
--- a/src/core/system.cpp
+++ b/src/core/system.cpp
@@ -2564,8 +2564,14 @@ bool System::LoadStateFromStream(ByteStream* state, Error* error, bool update_di
         }
       }
     }
+    else
+    {
+      // Skip updating media if there is none, and none in the state. That way we don't wipe out EXE boot.
+      ignore_media = !CDROM::HasMedia();
+    }
 
-    UpdateRunningGame(media_filename.c_str(), media.get(), false);
+    if (!ignore_media)
+      UpdateRunningGame(media_filename.c_str(), media.get(), false);
 
     if (media && header.version >= 51)
     {