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.
This commit is contained in:
Stephen Miller 2026-05-09 03:13:47 -05:00 committed by GitHub
parent 442a07a707
commit 8bcc19248e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 10 deletions

View File

@ -135,17 +135,15 @@ void Linker::Execute(const std::vector<std::string>& 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<int>(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<int>(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(&params);
});

View File

@ -482,7 +482,7 @@ void Emulator::Run(std::filesystem::path file, std::vector<std::string> args,
});
}
args.insert(args.begin(), eboot_name.generic_string());
args.insert(args.begin(), guest_eboot_path);
linker->Execute(args);
window->InitTimers();