From 8bcc19248ed563ef935da12db7fbc86f1f887934 Mon Sep 17 00:00:00 2001 From: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com> Date: Sat, 9 May 2026 03:13:47 -0500 Subject: [PATCH] Core: Fix argv[0] value (#4378) * Fix executable path * Remove args.empty() check Emulator::Run adds the guest executable path, so arguments will never be empty. --- src/core/linker.cpp | 16 +++++++--------- src/emulator.cpp | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/core/linker.cpp b/src/core/linker.cpp index 0897b63f7..0d591c9e9 100644 --- a/src/core/linker.cpp +++ b/src/core/linker.cpp @@ -135,17 +135,15 @@ void Linker::Execute(const std::vector& args) { } ASSERT_MSG(result == 0, "Unable to emulate libSceGnmDriver initialization"); - // Start main module. + // Add all guest arguments, we will always have the executable path in argv[0] EntryParams& params = Libraries::Kernel::entry_params; - params.argc = 1; - params.argv[0] = "eboot.bin"; - if (!args.empty()) { - constexpr int MaxArgs = sizeof(params.argv) / sizeof(params.argv[0]); - params.argc = std::min(args.size(), MaxArgs); - for (int i = 0; i < params.argc; i++) { - params.argv[i] = args[i].c_str(); - } + constexpr int MaxArgs = sizeof(params.argv) / sizeof(params.argv[0]); + params.argc = std::min(args.size(), MaxArgs); + for (int i = 0; i < params.argc; i++) { + params.argv[i] = args[i].c_str(); } + + // Run the game's entry function params.entry_addr = module->GetEntryAddress(); RunMainEntry(¶ms); }); diff --git a/src/emulator.cpp b/src/emulator.cpp index af0480576..f5a8ab2ab 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -482,7 +482,7 @@ void Emulator::Run(std::filesystem::path file, std::vector args, }); } - args.insert(args.begin(), eboot_name.generic_string()); + args.insert(args.begin(), guest_eboot_path); linker->Execute(args); window->InitTimers();