Exitspawn support renewal

Implemented _sys_process_exit2 syscall
Rewritten sys_game_process_exitspawn
Rewritten sys_game_process_exitspawn2
Implemented _sys_process_atexitspawn
Implemented _sys_process_at_Exitspawn
And some other changes
This commit is contained in:
Nekotekina 2017-09-18 19:16:36 +03:00
parent 18d472b7e1
commit 519f21db18
15 changed files with 285 additions and 198 deletions

View file

@ -228,12 +228,6 @@ void Emulator::Init()
fxm::make_always<patch_engine>()->append(fs::get_config_dir() + "/patch.yml");
}
void Emulator::SetPath(const std::string& path, const std::string& elf_path)
{
m_path = path;
m_elf_path = elf_path;
}
bool Emulator::BootGame(const std::string& path, bool direct, bool add_only)
{
static const char* boot_list[] =
@ -246,7 +240,7 @@ bool Emulator::BootGame(const std::string& path, bool direct, bool add_only)
if (direct && fs::is_file(path))
{
SetPath(path);
m_path = path;
Load(add_only);
return true;
@ -258,7 +252,7 @@ bool Emulator::BootGame(const std::string& path, bool direct, bool add_only)
if (fs::is_file(elf))
{
SetPath(elf);
m_path = elf;
Load(add_only);
return true;
@ -380,7 +374,7 @@ void Emulator::Load(bool add_only)
if (fs::rename(elf_dir + "/../../", hdd0_disc + elf_dir.substr(hdd0_game.size()) + "/../../", false))
{
LOG_SUCCESS(LOADER, "Disc game %s moved to special location /dev_hdd0/disc/", m_title_id);
return SetPath(hdd0_disc + m_path.substr(hdd0_game.size())), Load();
return m_path = hdd0_disc + m_path.substr(hdd0_game.size()), Load();
}
else
{
@ -460,7 +454,7 @@ void Emulator::Load(bool add_only)
{
// Booting game update
LOG_SUCCESS(LOADER, "Updates found at /dev_hdd0/game/%s/!", m_title_id);
return SetPath(hdd0_boot), Load();
return m_path = hdd0_boot, Load();
}
// Mount /host_root/ if necessary
@ -528,25 +522,25 @@ void Emulator::Load(bool add_only)
vm::ps3::init();
if (m_elf_path.empty())
if (argv.empty())
{
if (m_path.find(hdd0_game) != -1)
{
m_elf_path = "/dev_hdd0/game/" + m_path.substr(hdd0_game.size());
argv.emplace_back("/dev_hdd0/game/" + m_path.substr(hdd0_game.size()));
}
else if (!bdvd_dir.empty() && fs::is_dir(bdvd_dir))
{
//Disc games are on /dev_bdvd/
size_t pos = m_path.rfind("PS3_GAME");
m_elf_path = "/dev_bdvd/" + m_path.substr(pos);
// Disc games are on /dev_bdvd/
const std::size_t pos = m_path.rfind("PS3_GAME");
argv.emplace_back("/dev_bdvd/" + m_path.substr(pos));
}
else
{
//For homebrew
m_elf_path = "/host_root/" + m_path;
// For homebrew
argv.emplace_back("/host_root/" + m_path);
}
LOG_NOTICE(LOADER, "Elf path: %s", m_elf_path);
LOG_NOTICE(LOADER, "Elf path: %s", argv[0]);
}
ppu_load_exec(ppu_exec);
@ -579,10 +573,10 @@ void Emulator::Load(bool add_only)
GetCallbacks().on_ready();
vm::psv::init();
if (m_elf_path.empty())
if (argv.empty())
{
m_elf_path = "host_root:" + m_path;
LOG_NOTICE(LOADER, "Elf path: %s", m_elf_path);
argv.emplace_back("host_root:" + m_path);
LOG_NOTICE(LOADER, "Elf path: %s", argv[0]);
}
arm_load_exec(arm_exec);
@ -794,6 +788,10 @@ void Emulator::Stop()
extern void jit_finalize();
jit_finalize();
#endif
argv.clear();
envp.clear();
data.clear();
}
s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_info* sup2, u64 arg2)