From bd8905aa44fe9d1fecc191ff619f8b93e992e064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 25 Oct 2024 15:19:44 +0200 Subject: [PATCH] Avoid crashing on PSX EBOOTs renamed to ISO (people try strange things...) --- Core/FileSystems/BlockDevices.cpp | 11 +++++++++++ UI/MainScreen.cpp | 1 + Windows/main.cpp | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Core/FileSystems/BlockDevices.cpp b/Core/FileSystems/BlockDevices.cpp index 1e7dd8402c..c5e2add3fd 100644 --- a/Core/FileSystems/BlockDevices.cpp +++ b/Core/FileSystems/BlockDevices.cpp @@ -395,6 +395,17 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader) ERROR_LOG(Log::Loader, "Invalid NPUMDIMG header!"); } + u32 psar_id; + fileLoader->ReadAt(psarOffset, 4, 1, &psar_id); + + INFO_LOG(Log::Loader, "NPDRM: PSAR ID: %08x"); + // PS1 PSAR begins with "PSISOIMG0000" + if (psar_id == 'SISP') { + lbaSize_ = 0; // Mark invalid + ERROR_LOG(Log::Loader, "PSX not supported! Should have been caught earlier."); + return; + } + kirk_init(); // getkey diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 40a3558869..411e5f59c1 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -1072,6 +1072,7 @@ UI::EventReturn GameBrowser::GridSettingsClick(UI::EventParams &e) { } UI::EventReturn GameBrowser::OnRecentClear(UI::EventParams &e) { + _assert_(screenManager_); screenManager_->RecreateAllViews(); System_Notify(SystemNotification::UI); return UI::EVENT_DONE; diff --git a/Windows/main.cpp b/Windows/main.cpp index 57e13bb7de..01f6b1dfb3 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -121,7 +121,7 @@ static double g_lastActivity = 0.0; static double g_lastKeepAwake = 0.0; // Time until we stop considering the core active without user input. // Should this be configurable? 2 hours currently. -static const double ACTIVITY_IDLE_TIMEOUT = 2.0 * 3600.0; +static constexpr double ACTIVITY_IDLE_TIMEOUT = 2.0 * 3600.0; void System_LaunchUrl(LaunchUrlType urlType, const char *url) { ShellExecute(NULL, L"open", ConvertUTF8ToWString(url).c_str(), NULL, NULL, SW_SHOWNORMAL);