mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
Remove legacy LOADER log channel
This commit is contained in:
parent
d9a0619ddd
commit
3eca2d5d6c
17 changed files with 377 additions and 361 deletions
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include <cmath>
|
||||
|
||||
LOG_CHANNEL(edat_log);
|
||||
|
||||
void generate_key(int crypto_mode, int version, unsigned char *key_final, unsigned char *iv_final, unsigned char *key, unsigned char *iv)
|
||||
{
|
||||
int mode = crypto_mode & 0xF0000000;
|
||||
|
|
@ -78,7 +80,7 @@ bool decrypt(int hash_mode, int crypto_mode, int version, unsigned char *in, uns
|
|||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Unknown crypto algorithm!");
|
||||
edat_log.error("EDAT: Unknown crypto algorithm!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +98,7 @@ bool decrypt(int hash_mode, int crypto_mode, int version, unsigned char *in, uns
|
|||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Unknown hashing algorithm!");
|
||||
edat_log.error("EDAT: Unknown hashing algorithm!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -280,7 +282,7 @@ s64 decrypt_block(const fs::file* in, u8* out, EDAT_HEADER *edat, NPD_HEADER *np
|
|||
// Call main crypto routine on this data block.
|
||||
if (!decrypt(hash_mode, crypto_mode, (npd->version == 4), enc_data.get(), dec_data.get(), length, key_result, iv, hash, hash_result))
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Block at offset 0x%llx has invalid hash!", offset);
|
||||
edat_log.error("EDAT: Block at offset 0x%llx has invalid hash!", offset);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -296,7 +298,7 @@ s64 decrypt_block(const fs::file* in, u8* out, EDAT_HEADER *edat, NPD_HEADER *np
|
|||
{
|
||||
if (res < 0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Decompression failed!");
|
||||
edat_log.error("EDAT: Decompression failed!");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -324,7 +326,7 @@ int decrypt_data(const fs::file* in, const fs::file* out, EDAT_HEADER *edat, NPD
|
|||
u64 res = decrypt_block(in, data.get(), edat, npd, crypt_key, i, total_blocks, size_left);
|
||||
if (res == -1)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Decrypt Block failed!");
|
||||
edat_log.error("EDAT: Decrypt Block failed!");
|
||||
return 1;
|
||||
}
|
||||
size_left -= res;
|
||||
|
|
@ -349,7 +351,7 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
{
|
||||
if (edat->flags & 0x7EFFFFFE)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Bad header flags!");
|
||||
edat_log.error("EDAT: Bad header flags!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -357,7 +359,7 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
{
|
||||
if (edat->flags & 0x7EFFFFE0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Bad header flags!");
|
||||
edat_log.error("EDAT: Bad header flags!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -365,13 +367,13 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
{
|
||||
if (edat->flags & 0x7EFFFFC0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Bad header flags!");
|
||||
edat_log.error("EDAT: Bad header flags!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Unknown version!");
|
||||
edat_log.error("EDAT: Unknown version!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -391,7 +393,7 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
hash_mode |= 0x01000000;
|
||||
|
||||
if (verbose)
|
||||
LOG_WARNING(LOADER, "EDAT: DEBUG data detected!");
|
||||
edat_log.warning("EDAT: DEBUG data detected!");
|
||||
}
|
||||
|
||||
// Setup header key and iv buffers.
|
||||
|
|
@ -402,12 +404,12 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
if (!decrypt(hash_mode, crypto_mode, (npd->version == 4), header, empty_header, 0xA0, header_key, header_iv, key, header_hash))
|
||||
{
|
||||
if (verbose)
|
||||
LOG_WARNING(LOADER, "EDAT: Header hash is invalid!");
|
||||
edat_log.warning("EDAT: Header hash is invalid!");
|
||||
|
||||
// If the header hash test fails and the data is not DEBUG, then RAP/RIF/KLIC key is invalid.
|
||||
if ((edat->flags & EDAT_DEBUG_DATA_FLAG) != EDAT_DEBUG_DATA_FLAG)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: RAP/RIF/KLIC key is invalid!");
|
||||
edat_log.error("EDAT: RAP/RIF/KLIC key is invalid!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -417,7 +419,7 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
if (((edat->flags & EDAT_COMPRESSED_FLAG) != 0))
|
||||
{
|
||||
if (verbose)
|
||||
LOG_WARNING(LOADER, "EDAT: COMPRESSED data detected!");
|
||||
edat_log.warning("EDAT: COMPRESSED data detected!");
|
||||
}
|
||||
|
||||
const int block_num = static_cast<int>((edat->file_size + edat->block_size - 1) / edat->block_size);
|
||||
|
|
@ -452,7 +454,7 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
if (!decrypt(hash_mode, crypto_mode, (npd->version == 4), metadata.get(), empty_metadata.get(), metadata_size, header_key, header_iv, key, metadata_hash))
|
||||
{
|
||||
if (verbose)
|
||||
LOG_WARNING(LOADER, "EDAT: Metadata section hash is invalid!");
|
||||
edat_log.warning("EDAT: Metadata section hash is invalid!");
|
||||
}
|
||||
|
||||
// Checking ECDSA signatures.
|
||||
|
|
@ -480,7 +482,7 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
memcpy(signature_r + 01, metadata_signature, 0x14);
|
||||
memcpy(signature_s + 01, metadata_signature + 0x14, 0x14);
|
||||
if ((!memcmp(signature_r, zero_buf, 0x15)) || (!memcmp(signature_s, zero_buf, 0x15)))
|
||||
LOG_WARNING(LOADER, "EDAT: Metadata signature is invalid!");
|
||||
edat_log.warning("EDAT: Metadata signature is invalid!");
|
||||
else
|
||||
{
|
||||
// Setup signature hash.
|
||||
|
|
@ -497,9 +499,9 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
|
||||
if (!ecdsa_verify(signature_hash, signature_r, signature_s))
|
||||
{
|
||||
LOG_WARNING(LOADER, "EDAT: Metadata signature is invalid!");
|
||||
edat_log.warning("EDAT: Metadata signature is invalid!");
|
||||
if (((edat->block_size + 0ull) * block_num) > 0x100000000)
|
||||
LOG_WARNING(LOADER, "EDAT: *Due to large file size, metadata signature status may be incorrect!");
|
||||
edat_log.warning("EDAT: *Due to large file size, metadata signature status may be incorrect!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -511,7 +513,7 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
memcpy(signature_s + 01, header_signature + 0x14, 0x14);
|
||||
|
||||
if ((!memcmp(signature_r, zero_buf, 0x15)) || (!memcmp(signature_s, zero_buf, 0x15)))
|
||||
LOG_WARNING(LOADER, "EDAT: Header signature is invalid!");
|
||||
edat_log.warning("EDAT: Header signature is invalid!");
|
||||
else
|
||||
{
|
||||
// Setup header signature hash.
|
||||
|
|
@ -522,7 +524,7 @@ int check_data(unsigned char *key, EDAT_HEADER *edat, NPD_HEADER *npd, const fs:
|
|||
sha1(header_buf.get(), 0xD8, signature_hash );
|
||||
|
||||
if (!ecdsa_verify(signature_hash, signature_r, signature_s))
|
||||
LOG_WARNING(LOADER, "EDAT: Header signature is invalid!");
|
||||
edat_log.warning("EDAT: Header signature is invalid!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -589,9 +591,9 @@ int validate_npd_hashes(const char* file_name, const u8* klicensee, NPD_HEADER *
|
|||
if (verbose)
|
||||
{
|
||||
if (title_hash_result)
|
||||
LOG_NOTICE(LOADER, "EDAT: NPD title hash is valid!");
|
||||
edat_log.notice("EDAT: NPD title hash is valid!");
|
||||
else
|
||||
LOG_WARNING(LOADER, "EDAT: NPD title hash is invalid!");
|
||||
edat_log.warning("EDAT: NPD title hash is invalid!");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -635,16 +637,16 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
|
|||
unsigned char npd_magic[4] = {0x4E, 0x50, 0x44, 0x00}; //NPD0
|
||||
if (memcmp(&NPD.magic, npd_magic, 4))
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: %s has invalid NPD header or already decrypted.", input_file_name);
|
||||
edat_log.error("EDAT: %s has invalid NPD header or already decrypted.", input_file_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "NPD HEADER");
|
||||
LOG_NOTICE(LOADER, "NPD version: %d", NPD.version);
|
||||
LOG_NOTICE(LOADER, "NPD license: %d", NPD.license);
|
||||
LOG_NOTICE(LOADER, "NPD type: %d", NPD.type);
|
||||
edat_log.notice("NPD HEADER");
|
||||
edat_log.notice("NPD version: %d", NPD.version);
|
||||
edat_log.notice("NPD license: %d", NPD.license);
|
||||
edat_log.notice("NPD type: %d", NPD.type);
|
||||
}
|
||||
|
||||
// Set decryption key.
|
||||
|
|
@ -655,10 +657,10 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
|
|||
{
|
||||
if (verbose)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "SDAT HEADER");
|
||||
LOG_NOTICE(LOADER, "SDAT flags: 0x%08X", EDAT.flags);
|
||||
LOG_NOTICE(LOADER, "SDAT block size: 0x%08X", EDAT.block_size);
|
||||
LOG_NOTICE(LOADER, "SDAT file size: 0x%08X", EDAT.file_size);
|
||||
edat_log.notice("SDAT HEADER");
|
||||
edat_log.notice("SDAT flags: 0x%08X", EDAT.flags);
|
||||
edat_log.notice("SDAT block size: 0x%08X", EDAT.block_size);
|
||||
edat_log.notice("SDAT file size: 0x%08X", EDAT.file_size);
|
||||
}
|
||||
|
||||
// Generate SDAT key.
|
||||
|
|
@ -668,10 +670,10 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
|
|||
{
|
||||
if (verbose)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "EDAT HEADER");
|
||||
LOG_NOTICE(LOADER, "EDAT flags: 0x%08X", EDAT.flags);
|
||||
LOG_NOTICE(LOADER, "EDAT block size: 0x%08X", EDAT.block_size);
|
||||
LOG_NOTICE(LOADER, "EDAT file size: 0x%08X", EDAT.file_size);
|
||||
edat_log.notice("EDAT HEADER");
|
||||
edat_log.notice("EDAT flags: 0x%08X", EDAT.flags);
|
||||
edat_log.notice("EDAT block size: 0x%08X", EDAT.block_size);
|
||||
edat_log.notice("EDAT file size: 0x%08X", EDAT.file_size);
|
||||
}
|
||||
|
||||
// Perform header validation (EDAT only).
|
||||
|
|
@ -682,7 +684,7 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
|
|||
// Ignore header validation in DEBUG data.
|
||||
if ((EDAT.flags & EDAT_DEBUG_DATA_FLAG) != EDAT_DEBUG_DATA_FLAG)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: NPD hash validation failed!");
|
||||
edat_log.error("EDAT: NPD hash validation failed!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -707,48 +709,48 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
|
|||
|
||||
if (!test)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: A valid RAP file is needed for this EDAT file!");
|
||||
edat_log.error("EDAT: A valid RAP file is needed for this EDAT file!");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if ((NPD.license & 0x1) == 0x1) // Type 1: Use network activation.
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Network license not supported!");
|
||||
edat_log.error("EDAT: Network license not supported!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
int i;
|
||||
LOG_NOTICE(LOADER, "DEVKLIC: ");
|
||||
edat_log.notice("DEVKLIC: ");
|
||||
for (i = 0; i < 0x10; i++)
|
||||
LOG_NOTICE(LOADER, "%02X", devklic[i]);
|
||||
edat_log.notice("%02X", devklic[i]);
|
||||
|
||||
LOG_NOTICE(LOADER, "RIF KEY: ");
|
||||
edat_log.notice("RIF KEY: ");
|
||||
for (i = 0; i < 0x10; i++)
|
||||
LOG_NOTICE(LOADER, "%02X", rifkey[i]);
|
||||
edat_log.notice("%02X", rifkey[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
int i;
|
||||
LOG_NOTICE(LOADER, "DECRYPTION KEY: ");
|
||||
edat_log.notice("DECRYPTION KEY: ");
|
||||
for (i = 0; i < 0x10; i++)
|
||||
LOG_NOTICE(LOADER, "%02X", key[i]);
|
||||
edat_log.notice("%02X", key[i]);
|
||||
}
|
||||
|
||||
input->seek(0);
|
||||
if (check_data(key, &EDAT, &NPD, input, verbose))
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Data parsing failed!");
|
||||
edat_log.error("EDAT: Data parsing failed!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
input->seek(0);
|
||||
if (decrypt_data(input, output, &EDAT, &NPD, key, verbose))
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Data decryption failed!");
|
||||
edat_log.error("EDAT: Data decryption failed!");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -779,13 +781,13 @@ bool VerifyEDATHeaderWithKLicense(const fs::file& input, const std::string& inpu
|
|||
unsigned char npd_magic[4] = { 0x4E, 0x50, 0x44, 0x00 }; //NPD0
|
||||
if (memcmp(&NPD.magic, npd_magic, 4))
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: %s has invalid NPD header or already decrypted.", input_file_name);
|
||||
edat_log.error("EDAT: %s has invalid NPD header or already decrypted.", input_file_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((EDAT.flags & SDAT_FLAG) == SDAT_FLAG)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: SDATA file given to edat function");
|
||||
edat_log.error("EDAT: SDATA file given to edat function");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -797,7 +799,7 @@ bool VerifyEDATHeaderWithKLicense(const fs::file& input, const std::string& inpu
|
|||
// Ignore header validation in DEBUG data.
|
||||
if ((EDAT.flags & EDAT_DEBUG_DATA_FLAG) != EDAT_DEBUG_DATA_FLAG)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: NPD hash validation failed!");
|
||||
edat_log.error("EDAT: NPD hash validation failed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -848,13 +850,13 @@ fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name,
|
|||
memcpy(devklic, custom_klic, 0x10);
|
||||
else
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Invalid custom klic!");
|
||||
edat_log.error("EDAT: Invalid custom klic!");
|
||||
return fs::file{};
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_ERROR(LOADER, "EDAT: Invalid mode!");
|
||||
edat_log.error("EDAT: Invalid mode!");
|
||||
return fs::file{};
|
||||
}
|
||||
|
||||
|
|
@ -901,7 +903,7 @@ bool EDATADecrypter::ReadHeader()
|
|||
// verify key
|
||||
if (validate_dev_klic(dev_key.data(), &npdHeader) == 0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Failed validating klic");
|
||||
edat_log.error("EDAT: Failed validating klic");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -914,12 +916,12 @@ bool EDATADecrypter::ReadHeader()
|
|||
|
||||
if (dec_key == std::array<u8, 0x10>{0})
|
||||
{
|
||||
LOG_WARNING(LOADER, "EDAT: Empty Dec key!");
|
||||
edat_log.warning("EDAT: Empty Dec key!");
|
||||
}
|
||||
}
|
||||
else if ((npdHeader.license & 0x1) == 0x1) // Type 1: Use network activation.
|
||||
{
|
||||
LOG_ERROR(LOADER, "EDAT: Network license not supported!");
|
||||
edat_log.error("EDAT: Network license not supported!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -966,7 +968,7 @@ u64 EDATADecrypter::ReadData(u64 pos, u8* data, u64 size)
|
|||
u64 res = decrypt_block(&edata_file, &data_buf[writeOffset], &edatHeader, &npdHeader, dec_key.data(), i, total_blocks, edatHeader.file_size);
|
||||
if (res == -1)
|
||||
{
|
||||
LOG_ERROR(LOADER, "Error Decrypting data");
|
||||
edat_log.error("Error Decrypting data");
|
||||
return 0;
|
||||
}
|
||||
writeOffset += res;
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@
|
|||
#include "Emu/VFS.h"
|
||||
#include "unpkg.h"
|
||||
|
||||
LOG_CHANNEL(pkg_log);
|
||||
|
||||
bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
||||
{
|
||||
if (!fs::is_file(path))
|
||||
{
|
||||
LOG_ERROR(LOADER, "PKG file not found!");
|
||||
pkg_log.error("PKG file not found!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -76,13 +78,13 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
|
||||
if (archive_read(&header, sizeof(header)) != sizeof(header))
|
||||
{
|
||||
LOG_ERROR(LOADER, "PKG file is too short!");
|
||||
pkg_log.error("PKG file is too short!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (header.pkg_magic != "\x7FPKG"_u32)
|
||||
{
|
||||
LOG_ERROR(LOADER, "Not a PKG file!");
|
||||
pkg_log.error("Not a PKG file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +94,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
case PKG_RELEASE_TYPE_RELEASE: break;
|
||||
default:
|
||||
{
|
||||
LOG_ERROR(LOADER, "Unknown PKG type (0x%x)", type);
|
||||
pkg_log.error("Unknown PKG type (0x%x)", type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -103,7 +105,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
case PKG_PLATFORM_TYPE_PSP: break;
|
||||
default:
|
||||
{
|
||||
LOG_ERROR(LOADER, "Unknown PKG platform (0x%x)", platform);
|
||||
pkg_log.error("Unknown PKG platform (0x%x)", platform);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -113,7 +115,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
// Check if multi-files pkg
|
||||
if (path.size() < 7 || path.compare(path.size() - 7, 7, "_00.pkg", 7) != 0)
|
||||
{
|
||||
LOG_ERROR(LOADER, "PKG file size mismatch (pkg_size=0x%llx)", header.pkg_size);
|
||||
pkg_log.error("PKG file size mismatch (pkg_size=0x%llx)", header.pkg_size);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +128,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
fs::file archive_file(archive_filename);
|
||||
if (!archive_file)
|
||||
{
|
||||
LOG_ERROR(LOADER, "Missing part of the multi-files pkg: %s", archive_filename);
|
||||
pkg_log.error("Missing part of the multi-files pkg: %s", archive_filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +139,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
|
||||
if (header.data_size + header.data_offset > header.pkg_size)
|
||||
{
|
||||
LOG_ERROR(LOADER, "PKG data size mismatch (data_size=0x%llx, data_offset=0x%llx, file_size=0x%llx)", header.data_size, header.data_offset, header.pkg_size);
|
||||
pkg_log.error("PKG data size mismatch (data_size=0x%llx, data_offset=0x%llx, file_size=0x%llx)", header.data_size, header.data_offset, header.pkg_size);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +213,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
|
||||
if (!fs::create_path(dir))
|
||||
{
|
||||
LOG_ERROR(LOADER, "PKG: Could not create the installation directory %s", dir);
|
||||
pkg_log.error("PKG: Could not create the installation directory %s", dir);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +316,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
if (entry.name_size > 256)
|
||||
{
|
||||
num_failures++;
|
||||
LOG_ERROR(LOADER, "PKG name size is too big (0x%x)", entry.name_size);
|
||||
pkg_log.error("PKG name size is too big (0x%x)", entry.name_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -322,7 +324,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
|
||||
std::string name{reinterpret_cast<char*>(buf.get()), entry.name_size};
|
||||
|
||||
LOG_NOTICE(LOADER, "Entry 0x%08x: %s", entry.type, name);
|
||||
pkg_log.notice("Entry 0x%08x: %s", entry.type, name);
|
||||
|
||||
switch (entry.type & 0xff)
|
||||
{
|
||||
|
|
@ -344,7 +346,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
|
||||
if (did_overwrite && (entry.type & PKG_FILE_ENTRY_OVERWRITE) == 0)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Didn't overwrite %s", name);
|
||||
pkg_log.notice("Didn't overwrite %s", name);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -358,14 +360,14 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
if (decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : dec_key.data()) != block_size)
|
||||
{
|
||||
extract_success = false;
|
||||
LOG_ERROR(LOADER, "Failed to extract file %s", path);
|
||||
pkg_log.error("Failed to extract file %s", path);
|
||||
break;
|
||||
}
|
||||
|
||||
if (out.write(buf.get(), block_size) != block_size)
|
||||
{
|
||||
extract_success = false;
|
||||
LOG_ERROR(LOADER, "Failed to write file %s", path);
|
||||
pkg_log.error("Failed to write file %s", path);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +375,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
{
|
||||
if (was_null)
|
||||
{
|
||||
LOG_ERROR(LOADER, "Package installation cancelled: %s", dir);
|
||||
pkg_log.error("Package installation cancelled: %s", dir);
|
||||
out.close();
|
||||
fs::remove_all(dir, true);
|
||||
return false;
|
||||
|
|
@ -385,14 +387,14 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
}
|
||||
|
||||
if (extract_success)
|
||||
{
|
||||
{
|
||||
if (did_overwrite)
|
||||
{
|
||||
LOG_WARNING(LOADER, "Overwritten file %s", name);
|
||||
pkg_log.warning("Overwritten file %s", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Created file %s", name);
|
||||
pkg_log.notice("Created file %s", name);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -403,7 +405,7 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
else
|
||||
{
|
||||
num_failures++;
|
||||
LOG_ERROR(LOADER, "Failed to create file %s", path);
|
||||
pkg_log.error("Failed to create file %s", path);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -416,16 +418,16 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
|
||||
if (fs::create_dir(path))
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Created directory %s", name);
|
||||
pkg_log.notice("Created directory %s", name);
|
||||
}
|
||||
else if (fs::is_dir(path))
|
||||
{
|
||||
LOG_WARNING(LOADER, "Reused existing directory %s", name);
|
||||
pkg_log.warning("Reused existing directory %s", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
num_failures++;
|
||||
LOG_ERROR(LOADER, "Failed to create directory %s", path);
|
||||
pkg_log.error("Failed to create directory %s", path);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -434,19 +436,19 @@ bool pkg_install(const std::string& path, atomic_t<double>& sync)
|
|||
default:
|
||||
{
|
||||
num_failures++;
|
||||
LOG_ERROR(LOADER, "Unknown PKG entry type (0x%x) %s", entry.type, name);
|
||||
pkg_log.error("Unknown PKG entry type (0x%x) %s", entry.type, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num_failures == 0)
|
||||
{
|
||||
LOG_SUCCESS(LOADER, "Package successfully installed to %s", dir);
|
||||
pkg_log.success("Package successfully installed to %s", dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
fs::remove_all(dir, true);
|
||||
LOG_ERROR(LOADER, "Package installation failed: %s", dir);
|
||||
pkg_log.error("Package installation failed: %s", dir);
|
||||
}
|
||||
return num_failures == 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,10 +203,10 @@ void AppInfo::Load(const fs::file& f)
|
|||
|
||||
void AppInfo::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "AuthID: 0x%llx", authid);
|
||||
LOG_NOTICE(LOADER, "VendorID: 0x%08x", vendor_id);
|
||||
LOG_NOTICE(LOADER, "SELF type: 0x%08x", self_type);
|
||||
LOG_NOTICE(LOADER, "Version: 0x%llx", version);
|
||||
self_log.notice("AuthID: 0x%llx", authid);
|
||||
self_log.notice("VendorID: 0x%08x", vendor_id);
|
||||
self_log.notice("SELF type: 0x%08x", self_type);
|
||||
self_log.notice("Version: 0x%llx", version);
|
||||
}
|
||||
|
||||
void SectionInfo::Load(const fs::file& f)
|
||||
|
|
@ -221,12 +221,12 @@ void SectionInfo::Load(const fs::file& f)
|
|||
|
||||
void SectionInfo::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Offset: 0x%llx", offset);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%llx", size);
|
||||
LOG_NOTICE(LOADER, "Compressed: 0x%08x", compressed);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2);
|
||||
LOG_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted);
|
||||
self_log.notice("Offset: 0x%llx", offset);
|
||||
self_log.notice("Size: 0x%llx", size);
|
||||
self_log.notice("Compressed: 0x%08x", compressed);
|
||||
self_log.notice("Unknown1: 0x%08x", unknown1);
|
||||
self_log.notice("Unknown2: 0x%08x", unknown2);
|
||||
self_log.notice("Encrypted: 0x%08x", encrypted);
|
||||
}
|
||||
|
||||
void SCEVersionInfo::Load(const fs::file& f)
|
||||
|
|
@ -239,10 +239,10 @@ void SCEVersionInfo::Load(const fs::file& f)
|
|||
|
||||
void SCEVersionInfo::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Sub-header type: 0x%08x", subheader_type);
|
||||
LOG_NOTICE(LOADER, "Present: 0x%08x", present);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%08x", size);
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%08x", unknown);
|
||||
self_log.notice("Sub-header type: 0x%08x", subheader_type);
|
||||
self_log.notice("Present: 0x%08x", present);
|
||||
self_log.notice("Size: 0x%08x", size);
|
||||
self_log.notice("Unknown: 0x%08x", unknown);
|
||||
}
|
||||
|
||||
void ControlInfo::Load(const fs::file& f)
|
||||
|
|
@ -293,20 +293,20 @@ void ControlInfo::Load(const fs::file& f)
|
|||
|
||||
void ControlInfo::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", type);
|
||||
LOG_NOTICE(LOADER, "Size: 0x%08x", size);
|
||||
LOG_NOTICE(LOADER, "Next: 0x%llx", next);
|
||||
self_log.notice("Type: 0x%08x", type);
|
||||
self_log.notice("Size: 0x%08x", size);
|
||||
self_log.notice("Next: 0x%llx", next);
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Control flag 1: 0x%08x", control_flags.ctrl_flag1);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", control_flags.unknown1);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", control_flags.unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%08x", control_flags.unknown3);
|
||||
LOG_NOTICE(LOADER, "Unknown4: 0x%08x", control_flags.unknown4);
|
||||
LOG_NOTICE(LOADER, "Unknown5: 0x%08x", control_flags.unknown5);
|
||||
LOG_NOTICE(LOADER, "Unknown6: 0x%08x", control_flags.unknown6);
|
||||
LOG_NOTICE(LOADER, "Unknown7: 0x%08x", control_flags.unknown7);
|
||||
self_log.notice("Control flag 1: 0x%08x", control_flags.ctrl_flag1);
|
||||
self_log.notice("Unknown1: 0x%08x", control_flags.unknown1);
|
||||
self_log.notice("Unknown2: 0x%08x", control_flags.unknown2);
|
||||
self_log.notice("Unknown3: 0x%08x", control_flags.unknown3);
|
||||
self_log.notice("Unknown4: 0x%08x", control_flags.unknown4);
|
||||
self_log.notice("Unknown5: 0x%08x", control_flags.unknown5);
|
||||
self_log.notice("Unknown6: 0x%08x", control_flags.unknown6);
|
||||
self_log.notice("Unknown7: 0x%08x", control_flags.unknown7);
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
|
|
@ -316,8 +316,8 @@ void ControlInfo::Show()
|
|||
for (int i = 0; i < 20; i++)
|
||||
digest_str += fmt::format("%02x", file_digest_30.digest[i]);
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest: %s", digest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_30.unknown);
|
||||
self_log.notice("Digest: %s", digest_str.c_str());
|
||||
self_log.notice("Unknown: 0x%llx", file_digest_30.unknown);
|
||||
}
|
||||
else if (size == 0x40)
|
||||
{
|
||||
|
|
@ -329,9 +329,9 @@ void ControlInfo::Show()
|
|||
digest_str2 += fmt::format("%02x", file_digest_40.digest2[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Digest1: %s", digest_str1.c_str());
|
||||
LOG_NOTICE(LOADER, "Digest2: %s", digest_str2.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_40.unknown);
|
||||
self_log.notice("Digest1: %s", digest_str1.c_str());
|
||||
self_log.notice("Digest2: %s", digest_str2.c_str());
|
||||
self_log.notice("Unknown: 0x%llx", file_digest_40.unknown);
|
||||
}
|
||||
}
|
||||
else if (type == 3)
|
||||
|
|
@ -349,16 +349,16 @@ void ControlInfo::Show()
|
|||
xordigest_str += fmt::format("%02x", npdrm.xordigest[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Magic: 0x%08x", npdrm.magic);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", npdrm.unknown1);
|
||||
LOG_NOTICE(LOADER, "License: 0x%08x", npdrm.license);
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", npdrm.type);
|
||||
LOG_NOTICE(LOADER, "ContentID: %s", contentid_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Digest: %s", digest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Inverse digest: %s", invdigest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "XOR digest: %s", xordigest_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%llx", npdrm.unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%llx", npdrm.unknown3);
|
||||
self_log.notice("Magic: 0x%08x", npdrm.magic);
|
||||
self_log.notice("Unknown1: 0x%08x", npdrm.unknown1);
|
||||
self_log.notice("License: 0x%08x", npdrm.license);
|
||||
self_log.notice("Type: 0x%08x", npdrm.type);
|
||||
self_log.notice("ContentID: %s", contentid_str.c_str());
|
||||
self_log.notice("Digest: %s", digest_str.c_str());
|
||||
self_log.notice("Inverse digest: %s", invdigest_str.c_str());
|
||||
self_log.notice("XOR digest: %s", xordigest_str.c_str());
|
||||
self_log.notice("Unknown2: 0x%llx", npdrm.unknown2);
|
||||
self_log.notice("Unknown3: 0x%llx", npdrm.unknown3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -384,10 +384,10 @@ void MetadataInfo::Show()
|
|||
iv_pad_str += fmt::format("%02x", iv_pad[i]);
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Key: %s", key_str.c_str());
|
||||
LOG_NOTICE(LOADER, "Key pad: %s", key_pad_str.c_str());
|
||||
LOG_NOTICE(LOADER, "IV: %s", iv_str.c_str());
|
||||
LOG_NOTICE(LOADER, "IV pad: %s", iv_pad_str.c_str());
|
||||
self_log.notice("Key: %s", key_str.c_str());
|
||||
self_log.notice("Key pad: %s", key_pad_str.c_str());
|
||||
self_log.notice("IV: %s", iv_str.c_str());
|
||||
self_log.notice("IV pad: %s", iv_pad_str.c_str());
|
||||
}
|
||||
|
||||
void MetadataHeader::Load(u8* in)
|
||||
|
|
@ -412,13 +412,13 @@ void MetadataHeader::Load(u8* in)
|
|||
|
||||
void MetadataHeader::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Signature input length: 0x%llx", signature_input_length);
|
||||
LOG_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1);
|
||||
LOG_NOTICE(LOADER, "Section count: 0x%08x", section_count);
|
||||
LOG_NOTICE(LOADER, "Key count: 0x%08x", key_count);
|
||||
LOG_NOTICE(LOADER, "Optional header size: 0x%08x", opt_header_size);
|
||||
LOG_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2);
|
||||
LOG_NOTICE(LOADER, "Unknown3: 0x%08x", unknown3);
|
||||
self_log.notice("Signature input length: 0x%llx", signature_input_length);
|
||||
self_log.notice("Unknown1: 0x%08x", unknown1);
|
||||
self_log.notice("Section count: 0x%08x", section_count);
|
||||
self_log.notice("Key count: 0x%08x", key_count);
|
||||
self_log.notice("Optional header size: 0x%08x", opt_header_size);
|
||||
self_log.notice("Unknown2: 0x%08x", unknown2);
|
||||
self_log.notice("Unknown3: 0x%08x", unknown3);
|
||||
}
|
||||
|
||||
void MetadataSectionHeader::Load(u8* in)
|
||||
|
|
@ -449,16 +449,16 @@ void MetadataSectionHeader::Load(u8* in)
|
|||
|
||||
void MetadataSectionHeader::Show()
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Data offset: 0x%llx", data_offset);
|
||||
LOG_NOTICE(LOADER, "Data size: 0x%llx", data_size);
|
||||
LOG_NOTICE(LOADER, "Type: 0x%08x", type);
|
||||
LOG_NOTICE(LOADER, "Program index: 0x%08x", program_idx);
|
||||
LOG_NOTICE(LOADER, "Hashed: 0x%08x", hashed);
|
||||
LOG_NOTICE(LOADER, "SHA1 index: 0x%08x", sha1_idx);
|
||||
LOG_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted);
|
||||
LOG_NOTICE(LOADER, "Key index: 0x%08x", key_idx);
|
||||
LOG_NOTICE(LOADER, "IV index: 0x%08x", iv_idx);
|
||||
LOG_NOTICE(LOADER, "Compressed: 0x%08x", compressed);
|
||||
self_log.notice("Data offset: 0x%llx", data_offset);
|
||||
self_log.notice("Data size: 0x%llx", data_size);
|
||||
self_log.notice("Type: 0x%08x", type);
|
||||
self_log.notice("Program index: 0x%08x", program_idx);
|
||||
self_log.notice("Hashed: 0x%08x", hashed);
|
||||
self_log.notice("SHA1 index: 0x%08x", sha1_idx);
|
||||
self_log.notice("Encrypted: 0x%08x", encrypted);
|
||||
self_log.notice("Key index: 0x%08x", key_idx);
|
||||
self_log.notice("IV index: 0x%08x", iv_idx);
|
||||
self_log.notice("Compressed: 0x%08x", compressed);
|
||||
}
|
||||
|
||||
void SectionHash::Load(const fs::file& f)
|
||||
|
|
@ -664,7 +664,7 @@ bool SCEDecrypter::LoadHeaders()
|
|||
// Check SCE magic.
|
||||
if (!sce_hdr.CheckMagic())
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Not a SELF file!");
|
||||
self_log.error("SELF: Not a SELF file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -708,7 +708,7 @@ bool SCEDecrypter::LoadMetadata(const u8 erk[32], const u8 riv[16])
|
|||
if ((meta_info.key_pad[0] != 0x00) ||
|
||||
(meta_info.iv_pad[0] != 0x00))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to decrypt metadata info!");
|
||||
self_log.error("SELF: Failed to decrypt metadata info!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -899,7 +899,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info)
|
|||
// Check SCE magic.
|
||||
if (!sce_hdr.CheckMagic())
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Not a SELF file!");
|
||||
self_log.error("SELF: Not a SELF file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -929,7 +929,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info)
|
|||
phdr32_arr.clear();
|
||||
if(elf32_hdr.e_phoff == 0 && elf32_hdr.e_phnum)
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: ELF program header offset is null!");
|
||||
self_log.error("SELF: ELF program header offset is null!");
|
||||
return false;
|
||||
}
|
||||
self_f.seek(self_hdr.se_phdroff);
|
||||
|
|
@ -945,7 +945,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info)
|
|||
|
||||
if (elf64_hdr.e_phoff == 0 && elf64_hdr.e_phnum)
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: ELF program header offset is null!");
|
||||
self_log.error("SELF: ELF program header offset is null!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -997,7 +997,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info)
|
|||
|
||||
if (elf32_hdr.e_shoff == 0 && elf32_hdr.e_shnum)
|
||||
{
|
||||
LOG_WARNING(LOADER, "SELF: ELF section header offset is null!");
|
||||
self_log.warning("SELF: ELF section header offset is null!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1014,7 +1014,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info)
|
|||
shdr64_arr.clear();
|
||||
if (elf64_hdr.e_shoff == 0 && elf64_hdr.e_shnum)
|
||||
{
|
||||
LOG_WARNING(LOADER, "SELF: ELF section header offset is null!");
|
||||
self_log.warning("SELF: ELF section header offset is null!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1037,46 +1037,46 @@ bool SELFDecrypter::LoadHeaders(bool isElf32, SelfAdditionalInfo* out_info)
|
|||
|
||||
void SELFDecrypter::ShowHeaders(bool isElf32)
|
||||
{
|
||||
LOG_NOTICE(LOADER, "SCE header");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("SCE header");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
sce_hdr.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "SELF header");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("SELF header");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_hdr.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "APP INFO");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("APP INFO");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
app_info.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "ELF header");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("ELF header");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
isElf32 ? elf32_hdr.Show() : elf64_hdr.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "ELF program headers");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("ELF program headers");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ((isElf32) ? phdr32_arr.size() : phdr64_arr.size()); i++)
|
||||
isElf32 ? phdr32_arr[i].Show() : phdr64_arr[i].Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "Section info");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("Section info");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < secinfo_arr.size(); i++)
|
||||
secinfo_arr[i].Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "SCE version info");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("SCE version info");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
scev_info.Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "Control info");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("Control info");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ctrlinfo_arr.size(); i++)
|
||||
ctrlinfo_arr[i].Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOG_NOTICE(LOADER, "ELF section headers");
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
self_log.notice("ELF section headers");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ((isElf32) ? shdr32_arr.size() : shdr64_arr.size()); i++)
|
||||
isElf32 ? shdr32_arr[i].Show() : shdr64_arr[i].Show();
|
||||
LOG_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_log.notice("----------------------------------------------------");
|
||||
}
|
||||
|
||||
bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
||||
|
|
@ -1100,13 +1100,13 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
|||
// If not, the data has no NPDRM layer.
|
||||
if (!ctrl)
|
||||
{
|
||||
LOG_TRACE(LOADER, "SELF: No NPDRM control info found!");
|
||||
self_log.trace("SELF: No NPDRM control info found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ctrl->npdrm.license == 1) // Network license.
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Can't decrypt network NPDRM!");
|
||||
self_log.error("SELF: Can't decrypt network NPDRM!");
|
||||
return false;
|
||||
}
|
||||
else if (ctrl->npdrm.license == 2) // Local license.
|
||||
|
|
@ -1114,7 +1114,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
|||
// Try to find a RAP file to get the key.
|
||||
if (!GetKeyFromRap(ctrl->npdrm.content_id, npdrm_key))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Can't find RAP file for NPDRM decryption!");
|
||||
self_log.error("SELF: Can't find RAP file for NPDRM decryption!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1128,7 +1128,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
|||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Invalid NPDRM license type!");
|
||||
self_log.error("SELF: Invalid NPDRM license type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1194,7 +1194,7 @@ bool SELFDecrypter::LoadMetadata(u8* klic_key)
|
|||
if ((meta_info.key_pad[0] != 0x00) ||
|
||||
(meta_info.iv_pad[0] != 0x00))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to decrypt metadata info!");
|
||||
self_log.error("SELF: Failed to decrypt metadata info!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1319,13 +1319,13 @@ bool SELFDecrypter::GetKeyFromRap(u8* content_id, u8* npdrm_key)
|
|||
|
||||
if (!rap_file)
|
||||
{
|
||||
LOG_FATAL(LOADER, "Failed to locate the game license file: %s."
|
||||
self_log.fatal("Failed to locate the game license file: %s."
|
||||
"\nEnsure the .rap license file is placed in the dev_hdd0/home/00000001/exdata folder with a lowercase file extension."
|
||||
"\nIf you need assistance on dumping the license file from your PS3, read our quickstart guide: https://rpcs3.net/quickstart", rap_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_NOTICE(LOADER, "Loading RAP file %s.rap", ci_str);
|
||||
self_log.notice("Loading RAP file %s.rap", ci_str);
|
||||
rap_file.read(rap_key, 0x10);
|
||||
|
||||
// Convert the RAP key.
|
||||
|
|
@ -1369,7 +1369,7 @@ static bool CheckDebugSelf(fs::file& s)
|
|||
// Check for DEBUG version.
|
||||
if (key_version == 0x80 || key_version == 0xc0)
|
||||
{
|
||||
LOG_WARNING(LOADER, "Debug SELF detected! Removing fake header...");
|
||||
self_log.warning("Debug SELF detected! Removing fake header...");
|
||||
|
||||
// Get the real elf offset.
|
||||
s.seek(0x10);
|
||||
|
|
@ -1421,21 +1421,21 @@ fs::file decrypt_self(fs::file elf_or_self, u8* klic_key, SelfAdditionalInfo* ou
|
|||
// Load the SELF file headers.
|
||||
if (!self_dec.LoadHeaders(isElf32, out_info))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to load SELF file headers!");
|
||||
self_log.error("SELF: Failed to load SELF file headers!");
|
||||
return fs::file{};
|
||||
}
|
||||
|
||||
// Load and decrypt the SELF file metadata.
|
||||
if (!self_dec.LoadMetadata(klic_key))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to load SELF file metadata!");
|
||||
self_log.error("SELF: Failed to load SELF file metadata!");
|
||||
return fs::file{};
|
||||
}
|
||||
|
||||
// Decrypt the SELF file data.
|
||||
if (!self_dec.DecryptData())
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to decrypt SELF file data!");
|
||||
self_log.error("SELF: Failed to decrypt SELF file data!");
|
||||
return fs::file{};
|
||||
}
|
||||
|
||||
|
|
@ -1464,14 +1464,14 @@ bool verify_npdrm_self_headers(const fs::file& self, u8* klic_key)
|
|||
// Load the SELF file headers.
|
||||
if (!self_dec.LoadHeaders(isElf32))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to load SELF file headers!");
|
||||
self_log.error("SELF: Failed to load SELF file headers!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load and decrypt the SELF file metadata.
|
||||
if (!self_dec.LoadMetadata(klic_key))
|
||||
{
|
||||
LOG_ERROR(LOADER, "SELF: Failed to load SELF file metadata!");
|
||||
self_log.error("SELF: Failed to load SELF file metadata!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@
|
|||
#include "Utilities/File.h"
|
||||
#include "Utilities/Log.h"
|
||||
|
||||
struct AppInfo
|
||||
LOG_CHANNEL(self_log);
|
||||
|
||||
struct AppInfo
|
||||
{
|
||||
u64 authid;
|
||||
u32 vendor_id;
|
||||
|
|
@ -338,7 +340,7 @@ struct SelfHeader
|
|||
u64 se_controloff;
|
||||
u64 se_controlsize;
|
||||
u64 pad;
|
||||
|
||||
|
||||
void Load(const fs::file& f);
|
||||
void Show(){}
|
||||
};
|
||||
|
|
@ -387,7 +389,7 @@ class SELFDecrypter
|
|||
SceHeader sce_hdr;
|
||||
SelfHeader self_hdr;
|
||||
AppInfo app_info;
|
||||
|
||||
|
||||
// ELF64 header and program header/section header arrays.
|
||||
Elf64_Ehdr elf64_hdr;
|
||||
std::vector<Elf64_Shdr> shdr64_arr;
|
||||
|
|
@ -469,9 +471,9 @@ private:
|
|||
// Check for errors (TODO: Probably safe to remove this once these changes have passed testing.)
|
||||
switch (rv)
|
||||
{
|
||||
case Z_MEM_ERROR: LOG_ERROR(LOADER, "MakeELF encountered a Z_MEM_ERROR!"); break;
|
||||
case Z_BUF_ERROR: LOG_ERROR(LOADER, "MakeELF encountered a Z_BUF_ERROR!"); break;
|
||||
case Z_DATA_ERROR: LOG_ERROR(LOADER, "MakeELF encountered a Z_DATA_ERROR!"); break;
|
||||
case Z_MEM_ERROR: self_log.error("MakeELF encountered a Z_MEM_ERROR!"); break;
|
||||
case Z_BUF_ERROR: self_log.error("MakeELF encountered a Z_BUF_ERROR!"); break;
|
||||
case Z_DATA_ERROR: self_log.error("MakeELF encountered a Z_DATA_ERROR!"); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue