Implement Emulator::GetFakeCat()

I still have nightmares about that cat.
This commit is contained in:
Eladash 2021-09-16 02:34:20 +03:00 committed by Megamouse
parent 73bdf7481e
commit 1f3b1e1c99
5 changed files with 24 additions and 4 deletions

View File

@ -472,7 +472,9 @@ error_code cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr
std::string dir;
psf::registry sfo;
if (Emu.GetCat() == "DG")
const std::string& cat = Emu.GetFakeCat();
if (cat == "DG")
{
*type = CELL_GAME_GAMETYPE_DISC;
*attributes = 0; // TODO
@ -480,7 +482,7 @@ error_code cellGameBootCheck(vm::ptr<u32> type, vm::ptr<u32> attributes, vm::ptr
sfo = psf::load_object(fs::file(vfs::get("/dev_bdvd/PS3_GAME/PARAM.SFO")));
}
else if (Emu.GetCat() == "GD")
else if (cat == "GD")
{
*type = CELL_GAME_GAMETYPE_DISC;
*attributes = CELL_GAME_ATTRIBUTE_PATCH; // TODO

View File

@ -458,7 +458,7 @@ error_code npDrmIsAvailable(vm::cptr<u8> k_licensee_addr, vm::cptr<char> drm_pat
sceNp.notice("npDrmIsAvailable(): KLicense key %s", std::bit_cast<be_t<u128>>(k_licensee));
}
if (Emu.GetCat() == "PE")
if (Emu.GetFakeCat() == "PE")
{
std::memcpy(&k_licensee, NP_PSP_KEY_2, sizeof(k_licensee));
sceNp.success("npDrmIsAvailable(): PSP remaster KLicense key applied.");

View File

@ -1906,4 +1906,20 @@ bool Emulator::IsPathInsideDir(std::string_view path, std::string_view dir) cons
return (GetCallbacks().resolve_path(path) + '/').starts_with(GetCallbacks().resolve_path(dir) + '/');
};
const std::string& Emulator::GetFakeCat() const
{
if (m_cat == "DG")
{
const std::string mount_point = vfs::get("/dev_bdvd");
if (mount_point.empty() || !IsPathInsideDir(m_path, mount_point))
{
static const std::string s_hg = "HG";
return s_hg;
}
}
return m_cat;
};
Emulator Emu;

View File

@ -189,6 +189,8 @@ public:
return m_cat;
}
const std::string& GetFakeCat() const;
const std::string& GetDir() const
{
return m_dir;

View File

@ -312,7 +312,7 @@ void kernel_explorer::update()
root->setText(0, qstr(fmt::format("Process 0x%08x: Total Memory Usage: 0x%x/0x%x (%0.2f/%0.2f MB)", process_getpid(), total_memory_usage, dct->size, 1. * total_memory_usage / (1024 * 1024)
, 1. * dct->size / (1024 * 1024))));
add_solid_node(find_node(root, additional_nodes::process_info), qstr(fmt::format("Process Info, Sdk Version: 0x%08x, PPC SEG: %#x, SFO Category: %s", g_ps3_process_info.sdk_ver, g_ps3_process_info.ppc_seg, Emu.GetCat())));
add_solid_node(find_node(root, additional_nodes::process_info), qstr(fmt::format("Process Info, Sdk Version: 0x%08x, PPC SEG: %#x, SFO Category: %s (Fake: %s)", g_ps3_process_info.sdk_ver, g_ps3_process_info.ppc_seg, Emu.GetCat(), Emu.GetFakeCat())));
auto display_program_segments = [this](QTreeWidgetItem* tree, const ppu_module& m)
{