From 5d506c98aa569b57f5e75c101247acb32a75f066 Mon Sep 17 00:00:00 2001 From: rainmakerv2 <30595646+rainmakerv3@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:03:51 +0800 Subject: [PATCH] Fix big picture crash on some compiled builds (#4321) * Update main.cpp * pass executable name to big picture mode --- src/imgui/big_picture.cpp | 3 ++- src/imgui/big_picture.h | 2 +- src/main.cpp | 21 +++++++++++---------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/imgui/big_picture.cpp b/src/imgui/big_picture.cpp index 3ac1c7039..108d4f2b3 100644 --- a/src/imgui/big_picture.cpp +++ b/src/imgui/big_picture.cpp @@ -33,7 +33,7 @@ static std::vector gameVec = {}; static float uiScale = 1.0f; static SDL_Renderer* renderer; -void Launch() { +void Launch(char* executableName) { if (!SDL_Init(SDL_INIT_VIDEO)) { LOG_ERROR(ImGui, "SDL_INIT_VIDEO Error: {}", SDL_GetError()); SDL_Quit(); @@ -231,6 +231,7 @@ void Launch() { if (runEbootPath != "") { auto* emulator = Common::Singleton::Instance(); + emulator->executableName = executableName; emulator->Run(runEbootPath); } } diff --git a/src/imgui/big_picture.h b/src/imgui/big_picture.h index b5f035541..56b6b327c 100644 --- a/src/imgui/big_picture.h +++ b/src/imgui/big_picture.h @@ -16,7 +16,7 @@ struct Game { bool focusState; }; -void Launch(); +void Launch(char* executableName); void SetGameIcons(std::vector& games); void GetGameInfo(std::vector& games, bool AddGlobalSettings, SDL_Texture* texture = {}); std::filesystem::path UpdateChecker(const std::string sceItem, std::filesystem::path game_folder); diff --git a/src/main.cpp b/src/main.cpp index 919673a8d..3baf3cf76 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -140,6 +140,11 @@ int main(int argc, char* argv[]) { Common::Log::g_should_append |= EmulatorSettings.IsLogAppend(); Common::Log::Setup("shad_log.txt"); + if (bigPicture) { + BigPictureMode::Launch(argv[0]); + return 0; + } + // ---- Utility commands ---- if (addGameFolder) { EmulatorSettings.AddGameInstallDir(*addGameFolder); @@ -155,7 +160,7 @@ int main(int argc, char* argv[]) { return 0; } - if (!gamePath.has_value() && !bigPicture) { + if (!gamePath.has_value()) { if (!gameArgs.empty()) { gamePath = gameArgs.front(); gameArgs.erase(gameArgs.begin()); @@ -212,20 +217,16 @@ int main(int argc, char* argv[]) { break; } } - if (!found && !bigPicture) { + if (!found) { std::cerr << "Error: Game ID or file path not found: " << *gamePath << "\n"; return 1; } } - if (bigPicture) { - BigPictureMode::Launch(); - } else { - auto* emulator = Common::Singleton::Instance(); - emulator->executableName = argv[0]; - emulator->waitForDebuggerBeforeRun = waitForDebugger; - emulator->Run(ebootPath, gameArgs, overrideRoot); - } + auto* emulator = Common::Singleton::Instance(); + emulator->executableName = argv[0]; + emulator->waitForDebuggerBeforeRun = waitForDebugger; + emulator->Run(ebootPath, gameArgs, overrideRoot); return 0; }