Fix big picture crash on some compiled builds (#4321)

* Update main.cpp

* pass executable name to big picture mode
This commit is contained in:
rainmakerv2 2026-04-27 15:03:51 +08:00 committed by GitHub
parent e33a185423
commit 5d506c98aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 12 deletions

View File

@ -33,7 +33,7 @@ static std::vector<Game> 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<Core::Emulator>::Instance();
emulator->executableName = executableName;
emulator->Run(runEbootPath);
}
}

View File

@ -16,7 +16,7 @@ struct Game {
bool focusState;
};
void Launch();
void Launch(char* executableName);
void SetGameIcons(std::vector<Game>& games);
void GetGameInfo(std::vector<Game>& games, bool AddGlobalSettings, SDL_Texture* texture = {});
std::filesystem::path UpdateChecker(const std::string sceItem, std::filesystem::path game_folder);

View File

@ -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<Core::Emulator>::Instance();
emulator->executableName = argv[0];
emulator->waitForDebuggerBeforeRun = waitForDebugger;
emulator->Run(ebootPath, gameArgs, overrideRoot);
}
auto* emulator = Common::Singleton<Core::Emulator>::Instance();
emulator->executableName = argv[0];
emulator->waitForDebuggerBeforeRun = waitForDebugger;
emulator->Run(ebootPath, gameArgs, overrideRoot);
return 0;
}