Fixs for klics

This commit is contained in:
clienthax 2017-03-21 18:43:37 +00:00 committed by Ivan
parent 620ec7ef25
commit 44e62c5c92

View file

@ -47,8 +47,8 @@ s32 npDrmIsAvailable(vm::cptr<u8> k_licensee_addr, vm::cptr<char> drm_path)
return CELL_ENOENT;
}
std::string k_licensee_str = "0";
std::array<u8,0x10> k_licensee;
std::string k_licensee_str = "";
std::array<u8, 0x10> k_licensee;
if (k_licensee_addr)
{
@ -65,7 +65,11 @@ s32 npDrmIsAvailable(vm::cptr<u8> k_licensee_addr, vm::cptr<char> drm_path)
u32 magic;
enc_file.read<u32>(magic);
enc_file.seek(0);
if (magic != "NPD\0"_u32)
if (magic == "SCE\0"_u32) {
sceNp.notice("npDrmIsAvailable(): Assuming file is encrypted at %s", enc_drm_path);
//sprx
}
else if (magic != "NPD\0"_u32)
{
// for now assume its just unencrypted
sceNp.notice("npDrmIsAvailable(): Assuming edat file is unencrypted at %s", enc_drm_path);
@ -73,7 +77,9 @@ s32 npDrmIsAvailable(vm::cptr<u8> k_licensee_addr, vm::cptr<char> drm_path)
}
sceNp.warning("npDrmIsAvailable(): Found DRM license file at %s", enc_drm_path);
sceNp.warning("npDrmIsAvailable(): Using k_licensee 0x%s", k_licensee_str);
if (k_licensee_addr) {
sceNp.notice("npDrmIsAvailable(): KLicense key %s", k_licensee_str);
}
// TODO: Make more explicit what this actually does (currently it copies "XXXXXXXX" from drm_path (== "/dev_hdd0/game/XXXXXXXXX/*" assumed)
const std::string& drm_file_dir = enc_drm_path.substr(15);
@ -84,6 +90,7 @@ s32 npDrmIsAvailable(vm::cptr<u8> k_licensee_addr, vm::cptr<char> drm_path)
auto edatkeys = fxm::get_always<EdatKeys_t>();
// Search for a compatible RAP file.
if (!k_licensee_addr) {
for (const auto& entry : fs::dir(rap_lpath))
{
if (entry.name.find(title_id) != -1)
@ -100,6 +107,7 @@ s32 npDrmIsAvailable(vm::cptr<u8> k_licensee_addr, vm::cptr<char> drm_path)
}
else
edatkeys->rifKey = GetEdatRifKeyFromRapFile(fs::file{ rap_lpath });
}
if (VerifyEDATHeaderWithKLicense(enc_file, enc_drm_path_local, k_licensee))
{