Fix /dev_bdvd/ for exitspawn

This commit is contained in:
Nekotekina 2017-11-01 00:23:09 +03:00
parent 0b788f5b43
commit 0e7e40f2cb
3 changed files with 19 additions and 9 deletions

View file

@ -288,13 +288,14 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr<sys_exit2_param> ar
vm::temporary_unlock(ppu);
Emu.CallAfter([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data)]()
Emu.CallAfter([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data), disc = vfs::get("/dev_bdvd/")]() mutable
{
sys_process.success("Process finished -> %s", argv[0]);
Emu.Stop();
Emu.argv = std::move(argv);
Emu.envp = std::move(envp);
Emu.data = std::move(data);
Emu.disc = std::move(disc);
Emu.BootGame(path, true);
if (Emu.IsReady() && !g_cfg.misc.autostart)

View file

@ -190,7 +190,7 @@ void Emulator::Init()
{
g_tty.open(fs::get_config_dir() + "TTY.log", fs::rewrite + fs::append);
}
idm::init();
fxm::init();
@ -308,10 +308,13 @@ void Emulator::Load(bool add_only)
{
return sfov;
}
else
if (Emu.disc.size())
{
return fs::file(elf_dir + "/../PARAM.SFO");
return fs::file{Emu.disc + "/PS3_GAME/PARAM.SFO"};
}
return fs::file(elf_dir + "/../PARAM.SFO");
}());
m_title = psf::get_string(_psf, "TITLE", m_path);
m_title_id = psf::get_string(_psf, "TITLE_ID");
@ -370,7 +373,7 @@ void Emulator::Load(bool add_only)
const std::string hdd0_game = vfs::get("/dev_hdd0/game/");
const std::string hdd0_disc = vfs::get("/dev_hdd0/disc/");
if (_cat == "DG" && m_path.find(hdd0_game) != -1)
if (_cat == "DG" && m_path.find(hdd0_game) != -1 && Emu.disc.empty())
{
// Booting disc game from wrong location
LOG_ERROR(LOADER, "Disc game %s found at invalid location /dev_hdd0/game/", m_title_id);
@ -389,7 +392,7 @@ void Emulator::Load(bool add_only)
}
// Booting disc game
if (_cat == "DG" && bdvd_dir.empty())
if (_cat == "DG" && bdvd_dir.empty() && Emu.disc.empty())
{
// Mount /dev_bdvd/ if necessary
if (auto pos = elf_dir.rfind("/PS3_GAME/") + 1)
@ -399,7 +402,7 @@ void Emulator::Load(bool add_only)
}
// Booting patch data
if (_cat == "GD" && bdvd_dir.empty())
if (_cat == "GD" && bdvd_dir.empty() && Emu.disc.empty())
{
// Load /dev_bdvd/ from game list if available
if (auto node = games[m_title_id])
@ -413,7 +416,7 @@ void Emulator::Load(bool add_only)
}
// Check /dev_bdvd/
if (!bdvd_dir.empty() && fs::is_dir(bdvd_dir))
if (Emu.disc.empty() && !bdvd_dir.empty() && fs::is_dir(bdvd_dir))
{
fs::file sfb_file;
@ -440,6 +443,11 @@ void Emulator::Load(bool add_only)
out << games;
fs::file(fs::get_config_dir() + "/games.yml", fs::rewrite).write(out.c_str(), out.size());
}
else if (!Emu.disc.empty())
{
vfs::mount("dev_bdvd", Emu.disc);
LOG_NOTICE(LOADER, "Disk: %s", vfs::get("/dev_bdvd"));
}
else if (_cat == "DG" || _cat == "GD")
{
LOG_ERROR(LOADER, "Failed to mount disc directory for the disc game %s", m_title_id);
@ -641,7 +649,6 @@ void Emulator::Run()
return;
}
GetCallbacks().on_run();
m_pause_start_time = 0;
@ -839,6 +846,7 @@ void Emulator::Stop()
argv.clear();
envp.clear();
data.clear();
disc.clear();
}
s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_info* sup2, u64 arg2)

View file

@ -215,6 +215,7 @@ public:
std::vector<std::string> argv;
std::vector<std::string> envp;
std::vector<u8> data;
std::string disc;
const std::string& GetBoot() const
{