mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-05-12 16:09:42 -06:00
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:
parent
442a07a707
commit
8bcc19248e
@ -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(¶ms);
|
||||
});
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user