From 052d0c3c3501898d75e4240ce83adcfa4bf51b9e Mon Sep 17 00:00:00 2001 From: Vishwanath Martur <64204611+vishwamartur@users.noreply.github.com> Date: Tue, 26 Nov 2024 18:46:37 +0530 Subject: [PATCH 1/2] Fix toast warning in SDL build Related to #18951 Add toast warning for unpacked ISO directories in SDL build. * Check if the path to a directory containing an unpacked ISO is passed as a command line argument. * Display the toast warning "Warning: Playing unpacked games may cause issues." if an unpacked ISO directory is detected. --- SDL/SDLMain.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 7ef52538d470..d9bd6480c1b3 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -1,7 +1,3 @@ -// SDL/EGL implementation of the framework. -// This is quite messy due to platform-specific implementations and #ifdef's. -// If your platform is not supported, it is suggested to use Qt instead. - #include #include #include @@ -1496,6 +1492,16 @@ int main(int argc, char *argv[]) { bool waitOnExit = g_Config.iGPUBackend == (int)GPUBackend::OPENGL; + // P2cd0 + // Check if the path to a directory containing an unpacked ISO is passed as a command line argument + for (int i = 1; i < argc; i++) { + if (File::IsDirectory(argv[i])) { + // Display the toast warning + System_Toast("Warning: Playing unpacked games may cause issues."); + break; + } + } + if (!mainThreadIsRender) { // Vulkan mode uses this. // We should only be a message pump. This allows for lower latency From 0a8ded56aea481ed01652e42428cd0e8641e1d74 Mon Sep 17 00:00:00 2001 From: Vishwanath Martur <64204611+vishwamartur@users.noreply.github.com> Date: Wed, 27 Nov 2024 07:59:59 +0530 Subject: [PATCH 2/2] Convert `argv[i]` to `Path` type before passing it to `File::IsDirectory` * Fix the error by converting `argv[i]` to `Path` type before passing it to `File::IsDirectory` --- SDL/SDLMain.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index d9bd6480c1b3..4937cd2ace34 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -1492,10 +1492,9 @@ int main(int argc, char *argv[]) { bool waitOnExit = g_Config.iGPUBackend == (int)GPUBackend::OPENGL; - // P2cd0 // Check if the path to a directory containing an unpacked ISO is passed as a command line argument for (int i = 1; i < argc; i++) { - if (File::IsDirectory(argv[i])) { + if (File::IsDirectory(Path(argv[i]))) { // Display the toast warning System_Toast("Warning: Playing unpacked games may cause issues."); break;