Fixes for booting PS1 games

This commit is contained in:
Nekotekina 2018-06-23 17:30:16 +03:00
parent 8b449ce76c
commit 6229b3ca8d
2 changed files with 23 additions and 8 deletions

View file

@ -1218,7 +1218,16 @@ extern void ppu_initialize()
}
// New PPU cache location
_main->cache = fmt::format("%sdata/%s/ppu-%s-%s/", fs::get_config_dir(), Emu.GetTitleID(), fmt::base57(_main->sha1), Emu.GetBoot().substr(Emu.GetBoot().find_last_of('/') + 1));
_main->cache = fs::get_config_dir() + "data/";
if (!Emu.GetTitleID().empty() && Emu.GetCat() != "1P")
{
// TODO
_main->cache += Emu.GetTitleID();
_main->cache += '/';
}
fmt::append(_main->cache, "ppu-%s-%s/", fmt::base57(_main->sha1), _main->path.substr(_main->path.find_last_of('/') + 1));
if (!fs::create_path(_main->cache))
{

View file

@ -927,9 +927,7 @@ void Emulator::Load(bool add_only)
fs::file card_2_file(vfs::get("/dev_hdd0/savedata/vmc/" + argv[2]), fs::write + fs::create);
card_2_file.trunc(128 * 1024);
//Rewrite the path to be the emulator
m_path = vfs::get(argv[0]);
m_cache_path = fs::get_data_dir("", vfs::get(argv[0]));
}
else if (m_cat != "DG" && m_cat != "GD")
{
@ -1042,11 +1040,19 @@ void Emulator::Load(bool add_only)
}
// Open SELF or ELF
fs::file elf_file(m_path);
std::string elf_path = m_path;
if (m_cat == "1P")
{
// Use emulator path
elf_path = vfs::get(argv[0]);
}
fs::file elf_file(elf_path);
if (!elf_file)
{
LOG_ERROR(LOADER, "Failed to open executable: %s", m_path);
LOG_ERROR(LOADER, "Failed to open executable: %s", elf_path);
return;
}
@ -1087,7 +1093,7 @@ void Emulator::Load(bool add_only)
if (!elf_file)
{
LOG_ERROR(LOADER, "Failed to decrypt SELF: %s", m_path);
LOG_ERROR(LOADER, "Failed to decrypt SELF: %s", elf_path);
return;
}
else if (ppu_exec.open(elf_file) == elf_error::ok)
@ -1157,7 +1163,7 @@ void Emulator::Load(bool add_only)
}
else
{
LOG_ERROR(LOADER, "Invalid or unsupported file format: %s", m_path);
LOG_ERROR(LOADER, "Invalid or unsupported file format: %s", elf_path);
LOG_WARNING(LOADER, "** ppu_exec -> %s", ppu_exec.get_error());
LOG_WARNING(LOADER, "** ppu_prx -> %s", ppu_prx.get_error());