Remove legacy LOADER log channel

This commit is contained in:
Nekotekina 2020-02-01 07:36:53 +03:00
parent d9a0619ddd
commit 3eca2d5d6c
17 changed files with 377 additions and 361 deletions

View file

@ -110,7 +110,6 @@ namespace logs
namespace logs
{
/* Small set of predefined channels */
inline channel LOADER("LDR");
LOG_CHANNEL(RSX);
LOG_CHANNEL(HLE);
LOG_CHANNEL(PPU);

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -8,6 +8,8 @@
#include "yaml-cpp/yaml.h"
#include "Utilities/asm.h"
LOG_CHANNEL(ppu_validator);
const ppu_decoder<ppu_itype> s_ppu_itype;
template<>
@ -68,14 +70,14 @@ void ppu_module::validate(u32 reloc)
while (addr > found && index + 1 < funcs.size())
{
LOG_WARNING(LOADER, "%s.yml : unexpected function at 0x%x (0x%x, 0x%x)", path, found, addr, size);
ppu_validator.warning("%s.yml : unexpected function at 0x%x (0x%x, 0x%x)", path, found, addr, size);
index++;
found = funcs[index].addr - reloc;
}
if (addr < found)
{
LOG_ERROR(LOADER, "%s.yml : function not found (0x%x, 0x%x)", path, addr, size);
ppu_validator.error("%s.yml : function not found (0x%x, 0x%x)", path, addr, size);
continue;
}
@ -83,7 +85,7 @@ void ppu_module::validate(u32 reloc)
{
if (size + 4 != funcs[index].size || vm::read32(addr + size) != ppu_instructions::NOP())
{
LOG_ERROR(LOADER, "%s.yml : function size mismatch at 0x%x(size=0x%x) (0x%x, 0x%x)", path, found, funcs[index].size, addr, size);
ppu_validator.error("%s.yml : function size mismatch at 0x%x(size=0x%x) (0x%x, 0x%x)", path, found, funcs[index].size, addr, size);
}
}
@ -91,7 +93,7 @@ void ppu_module::validate(u32 reloc)
}
else
{
LOG_ERROR(LOADER, "%s.yml : function not found at the end (0x%x, 0x%x)", path, addr, size);
ppu_validator.error("%s.yml : function not found at the end (0x%x, 0x%x)", path, addr, size);
break;
}
}
@ -105,13 +107,13 @@ void ppu_module::validate(u32 reloc)
{
if (funcs[index].size)
{
LOG_ERROR(LOADER, "%s.yml : function not covered at 0x%x (size=0x%x)", path, funcs[index].addr, funcs[index].size);
ppu_validator.error("%s.yml : function not covered at 0x%x (size=0x%x)", path, funcs[index].addr, funcs[index].size);
}
index++;
}
LOG_SUCCESS(LOADER, "%s.yml : validation completed", path);
ppu_validator.success("%s.yml : validation completed", path);
}
}

View file

@ -23,7 +23,7 @@
#include <set>
#include <algorithm>
LOG_CHANNEL(ppu_loader);
extern void ppu_initialize_syscalls();
extern std::string ppu_get_function_name(const std::string& module, u32 fnid);
@ -308,7 +308,7 @@ static void ppu_initialize_modules(ppu_linkage_info* link)
// "Use" all the modules for correct linkage
for (auto& module : registered)
{
LOG_TRACE(LOADER, "Registered static module: %s", module->name);
ppu_loader.trace("Registered static module: %s", module->name);
}
for (auto& pair : ppu_module_manager::get())
@ -318,7 +318,7 @@ static void ppu_initialize_modules(ppu_linkage_info* link)
for (auto& function : module->functions)
{
LOG_TRACE(LOADER, "** 0x%08X: %s", function.first, function.second.name);
ppu_loader.trace("** 0x%08X: %s", function.first, function.second.name);
if (is_first)
{
@ -337,7 +337,7 @@ static void ppu_initialize_modules(ppu_linkage_info* link)
for (auto& variable : module->variables)
{
LOG_TRACE(LOADER, "** &0x%08X: %s (size=0x%x, align=0x%x)", variable.first, variable.second.name, variable.second.size, variable.second.align);
ppu_loader.trace("** &0x%08X: %s (size=0x%x, align=0x%x)", variable.first, variable.second.name, variable.second.size, variable.second.align);
// Allocate HLE variable
if (variable.second.size >= 4096 || variable.second.align >= 4096)
@ -367,7 +367,7 @@ static void ppu_initialize_modules(ppu_linkage_info* link)
variable.second.var->set(variable.second.addr);
}
LOG_TRACE(LOADER, "Allocated HLE variable %s.%s at 0x%x", module->name, variable.second.name, variable.second.var->addr());
ppu_loader.trace("Allocated HLE variable %s.%s at 0x%x", module->name, variable.second.name, variable.second.var->addr());
// Initialize HLE variable
if (variable.second.init)
@ -399,7 +399,7 @@ static void ppu_patch_refs(std::vector<ppu_reloc>* out_relocs, u32 fref, u32 fad
for (auto ref = vm::ptr<ref_t>::make(fref); ref->type; ref++)
{
if (ref->addend) LOG_WARNING(LOADER, "**** REF(%u): Addend value(0x%x, 0x%x)", ref->type, ref->addr, ref->addend);
if (ref->addend) ppu_loader.warning("**** REF(%u): Addend value(0x%x, 0x%x)", ref->type, ref->addr, ref->addend);
const u32 raddr = ref->addr;
const u32 rtype = ref->type;
@ -421,32 +421,32 @@ static void ppu_patch_refs(std::vector<ppu_reloc>* out_relocs, u32 fref, u32 fad
case 1:
{
const u32 value = vm::_ref<u32>(ref->addr) = rdata;
LOG_TRACE(LOADER, "**** REF(1): 0x%x <- 0x%x", ref->addr, value);
ppu_loader.trace("**** REF(1): 0x%x <- 0x%x", ref->addr, value);
break;
}
case 4:
{
const u16 value = vm::_ref<u16>(ref->addr) = static_cast<u16>(rdata);
LOG_TRACE(LOADER, "**** REF(4): 0x%x <- 0x%04x (0x%llx)", ref->addr, value, faddr);
ppu_loader.trace("**** REF(4): 0x%x <- 0x%04x (0x%llx)", ref->addr, value, faddr);
break;
}
case 6:
{
const u16 value = vm::_ref<u16>(ref->addr) = static_cast<u16>(rdata >> 16) + (rdata & 0x8000 ? 1 : 0);
LOG_TRACE(LOADER, "**** REF(6): 0x%x <- 0x%04x (0x%llx)", ref->addr, value, faddr);
ppu_loader.trace("**** REF(6): 0x%x <- 0x%04x (0x%llx)", ref->addr, value, faddr);
break;
}
case 57:
{
const u16 value = vm::_ref<ppu_bf_t<be_t<u16>, 0, 14>>(ref->addr) = static_cast<u16>(rdata) >> 2;
LOG_TRACE(LOADER, "**** REF(57): 0x%x <- 0x%04x (0x%llx)", ref->addr, value, faddr);
ppu_loader.trace("**** REF(57): 0x%x <- 0x%04x (0x%llx)", ref->addr, value, faddr);
break;
}
default: LOG_ERROR(LOADER, "**** REF(%u): Unknown/Illegal type (0x%x, 0x%x)", rtype, raddr, ref->addend);
default: ppu_loader.error("**** REF(%u): Unknown/Illegal type (0x%x, 0x%x)", rtype, raddr, ref->addend);
}
}
}
@ -492,11 +492,11 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
if (i < lib.num_func)
{
LOG_NOTICE(LOADER, "** Special: [%s] at 0x%x", ppu_get_function_name({}, nid), addr);
ppu_loader.notice("** Special: [%s] at 0x%x", ppu_get_function_name({}, nid), addr);
}
else
{
LOG_NOTICE(LOADER, "** Special: &[%s] at 0x%x", ppu_get_variable_name({}, nid), addr);
ppu_loader.notice("** Special: &[%s] at 0x%x", ppu_get_variable_name({}, nid), addr);
}
result.emplace(nid, addr);
@ -508,11 +508,11 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
const std::string module_name(lib.name.get_ptr());
LOG_NOTICE(LOADER, "** Exported module '%s' (0x%x, 0x%x, 0x%x, 0x%x)", module_name, lib.vnids, lib.vstubs, lib.unk4, lib.unk5);
ppu_loader.notice("** Exported module '%s' (0x%x, 0x%x, 0x%x, 0x%x)", module_name, lib.vnids, lib.vstubs, lib.unk4, lib.unk5);
if (lib.num_tlsvar)
{
LOG_FATAL(LOADER, "Unexpected num_tlsvar (%u)!", lib.num_tlsvar);
ppu_loader.fatal("Unexpected num_tlsvar (%u)!", lib.num_tlsvar);
}
// Static module
@ -529,7 +529,7 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
{
const u32 fnid = fnids[i];
const u32 faddr = faddrs[i];
LOG_NOTICE(LOADER, "**** %s export: [%s] at 0x%x", module_name, ppu_get_function_name(module_name, fnid), faddr);
ppu_loader.notice("**** %s export: [%s] at 0x%x", module_name, ppu_get_function_name(module_name, fnid), faddr);
// Function linkage info
auto& flink = mlink.functions[fnid];
@ -541,7 +541,7 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
if (flink.export_addr)
{
LOG_ERROR(LOADER, "Already linked function '%s' in module '%s'", ppu_get_function_name(module_name, fnid), module_name);
ppu_loader.error("Already linked function '%s' in module '%s'", ppu_get_function_name(module_name, fnid), module_name);
}
//else
{
@ -566,7 +566,7 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
}
else
{
LOG_FATAL(LOADER, "Failed to patch function at 0x%x (0x%x)", _entry, target);
ppu_loader.fatal("Failed to patch function at 0x%x (0x%x)", _entry, target);
}
}
else
@ -578,7 +578,7 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
for (const u32 addr : flink.imports)
{
vm::write32(addr, faddr);
//LOG_WARNING(LOADER, "Exported function '%s' in module '%s'", ppu_get_function_name(module_name, fnid), module_name);
//ppu_loader.warning("Exported function '%s' in module '%s'", ppu_get_function_name(module_name, fnid), module_name);
}
for (const u32 fref : flink.frefss)
@ -597,7 +597,7 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
{
const u32 vnid = vnids[i];
const u32 vaddr = vaddrs[i];
LOG_NOTICE(LOADER, "**** %s export: &[%s] at 0x%x", module_name, ppu_get_variable_name(module_name, vnid), vaddr);
ppu_loader.notice("**** %s export: &[%s] at 0x%x", module_name, ppu_get_variable_name(module_name, vnid), vaddr);
// Variable linkage info
auto& vlink = mlink.variables[vnid];
@ -609,7 +609,7 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
if (vlink.export_addr)
{
LOG_ERROR(LOADER, "Already linked variable '%s' in module '%s'", ppu_get_variable_name(module_name, vnid), module_name);
ppu_loader.error("Already linked variable '%s' in module '%s'", ppu_get_variable_name(module_name, vnid), module_name);
}
//else
{
@ -620,7 +620,7 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
for (const auto vref : vlink.imports)
{
ppu_patch_refs(nullptr, vref, vaddr);
//LOG_WARNING(LOADER, "Exported variable '%s' in module '%s'", ppu_get_variable_name(module_name, vnid), module_name);
//ppu_loader.warning("Exported variable '%s' in module '%s'", ppu_get_variable_name(module_name, vnid), module_name);
}
}
}
@ -641,11 +641,11 @@ static auto ppu_load_imports(std::vector<ppu_reloc>& relocs, ppu_linkage_info* l
const std::string module_name(lib.name.get_ptr());
LOG_NOTICE(LOADER, "** Imported module '%s' (ver=0x%x, attr=0x%x, 0x%x, 0x%x) [0x%x]", module_name, lib.version, lib.attributes, lib.unk4, lib.unk5, addr);
ppu_loader.notice("** Imported module '%s' (ver=0x%x, attr=0x%x, 0x%x, 0x%x) [0x%x]", module_name, lib.version, lib.attributes, lib.unk4, lib.unk5, addr);
if (lib.num_tlsvar)
{
LOG_FATAL(LOADER, "Unexpected num_tlsvar (%u)!", lib.num_tlsvar);
ppu_loader.fatal("Unexpected num_tlsvar (%u)!", lib.num_tlsvar);
}
// Static module
@ -662,7 +662,7 @@ static auto ppu_load_imports(std::vector<ppu_reloc>& relocs, ppu_linkage_info* l
const u32 fnid = fnids[i];
const u32 fstub = faddrs[i];
const u32 faddr = (faddrs + i).addr();
LOG_NOTICE(LOADER, "**** %s import: [%s] -> 0x%x", module_name, ppu_get_function_name(module_name, fnid), fstub);
ppu_loader.notice("**** %s import: [%s] -> 0x%x", module_name, ppu_get_function_name(module_name, fnid), fstub);
// Function linkage info
auto& flink = link->modules[module_name].functions[fnid];
@ -686,7 +686,7 @@ static auto ppu_load_imports(std::vector<ppu_reloc>& relocs, ppu_linkage_info* l
ppu_patch_refs(&relocs, frefs, link_addr);
}
//LOG_WARNING(LOADER, "Imported function '%s' in module '%s' (0x%x)", ppu_get_function_name(module_name, fnid), module_name, faddr);
//ppu_loader.warning("Imported function '%s' in module '%s' (0x%x)", ppu_get_function_name(module_name, fnid), module_name, faddr);
}
const auto vnids = +lib.vnids;
@ -696,7 +696,7 @@ static auto ppu_load_imports(std::vector<ppu_reloc>& relocs, ppu_linkage_info* l
{
const u32 vnid = vnids[i];
const u32 vref = vstubs[i];
LOG_NOTICE(LOADER, "**** %s import: &[%s] (ref=*0x%x)", module_name, ppu_get_variable_name(module_name, vnid), vref);
ppu_loader.notice("**** %s import: &[%s] (ref=*0x%x)", module_name, ppu_get_variable_name(module_name, vnid), vref);
// Variable linkage info
auto& vlink = link->modules[module_name].variables[vnid];
@ -709,7 +709,7 @@ static auto ppu_load_imports(std::vector<ppu_reloc>& relocs, ppu_linkage_info* l
// Link if available
ppu_patch_refs(&relocs, vref, vlink.export_addr);
//LOG_WARNING(LOADER, "Imported variable '%s' in module '%s' (0x%x)", ppu_get_variable_name(module_name, vnid), module_name, vlink.first);
//ppu_loader.warning("Imported variable '%s' in module '%s' (0x%x)", ppu_get_variable_name(module_name, vnid), module_name, vlink.first);
}
addr += lib.size ? lib.size : sizeof(ppu_prx_module_info);
@ -735,7 +735,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
for (const auto& prog : elf.progs)
{
LOG_NOTICE(LOADER, "** Segment: p_type=0x%x, p_vaddr=0x%llx, p_filesz=0x%llx, p_memsz=0x%llx, flags=0x%x", prog.p_type, prog.p_vaddr, prog.p_filesz, prog.p_memsz, prog.p_flags);
ppu_loader.notice("** Segment: p_type=0x%x, p_vaddr=0x%llx, p_filesz=0x%llx, p_memsz=0x%llx, flags=0x%x", prog.p_type, prog.p_vaddr, prog.p_filesz, prog.p_memsz, prog.p_flags);
// Hash big-endian values
sha1_update(&sha, reinterpret_cast<const uchar*>(&prog.p_type), sizeof(prog.p_type));
@ -761,7 +761,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
// Copy segment data
std::memcpy(vm::base(addr), prog.bin.data(), file_size);
LOG_WARNING(LOADER, "**** Loaded to 0x%x (size=0x%x)", addr, mem_size);
ppu_loader.warning("**** Loaded to 0x%x (size=0x%x)", addr, mem_size);
// Hash segment
sha1_update(&sha, reinterpret_cast<const uchar*>(&prog.p_vaddr), sizeof(prog.p_vaddr));
@ -788,13 +788,13 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
case 0x700000a4: break; // Relocations
default: LOG_ERROR(LOADER, "Unknown segment type! 0x%08x", p_type);
default: ppu_loader.error("Unknown segment type! 0x%08x", p_type);
}
}
for (const auto& s : elf.shdrs)
{
LOG_NOTICE(LOADER, "** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", s.sh_type, s.sh_addr, s.sh_size, s.sh_flags);
ppu_loader.notice("** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", s.sh_type, s.sh_addr, s.sh_size, s.sh_flags);
const u32 addr = vm::cast(s.sh_addr);
const u32 size = vm::cast(s.sh_size);
@ -853,72 +853,72 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
case 1: // R_PPC64_ADDR32
{
const u32 value = vm::_ref<u32>(raddr) = static_cast<u32>(rdata);
LOG_TRACE(LOADER, "**** RELOCATION(1): 0x%x <- 0x%08x (0x%llx)", raddr, value, rdata);
ppu_loader.trace("**** RELOCATION(1): 0x%x <- 0x%08x (0x%llx)", raddr, value, rdata);
break;
}
case 4: //R_PPC64_ADDR16_LO
{
const u16 value = vm::_ref<u16>(raddr) = static_cast<u16>(rdata);
LOG_TRACE(LOADER, "**** RELOCATION(4): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata);
ppu_loader.trace("**** RELOCATION(4): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata);
break;
}
case 5: //R_PPC64_ADDR16_HI
{
const u16 value = vm::_ref<u16>(raddr) = static_cast<u16>(rdata >> 16);
LOG_TRACE(LOADER, "**** RELOCATION(5): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata);
ppu_loader.trace("**** RELOCATION(5): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata);
break;
}
case 6: //R_PPC64_ADDR16_HA
{
const u16 value = vm::_ref<u16>(raddr) = static_cast<u16>(rdata >> 16) + (rdata & 0x8000 ? 1 : 0);
LOG_TRACE(LOADER, "**** RELOCATION(6): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata);
ppu_loader.trace("**** RELOCATION(6): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata);
break;
}
case 10: //R_PPC64_REL24
{
const u32 value = vm::_ref<ppu_bf_t<be_t<u32>, 6, 24>>(raddr) = static_cast<u32>(rdata - raddr) >> 2;
LOG_WARNING(LOADER, "**** RELOCATION(10): 0x%x <- 0x%06x (0x%llx)", raddr, value, rdata);
ppu_loader.warning("**** RELOCATION(10): 0x%x <- 0x%06x (0x%llx)", raddr, value, rdata);
break;
}
case 11: //R_PPC64_REL14
{
const u32 value = vm::_ref<ppu_bf_t<be_t<u32>, 16, 14>>(raddr) = static_cast<u32>(rdata - raddr) >> 2;
LOG_WARNING(LOADER, "**** RELOCATION(11): 0x%x <- 0x%06x (0x%llx)", raddr, value, rdata);
ppu_loader.warning("**** RELOCATION(11): 0x%x <- 0x%06x (0x%llx)", raddr, value, rdata);
break;
}
case 38: //R_PPC64_ADDR64
{
const u64 value = vm::_ref<u64>(raddr) = rdata;
LOG_TRACE(LOADER, "**** RELOCATION(38): 0x%x <- 0x%016llx (0x%llx)", raddr, value, rdata);
ppu_loader.trace("**** RELOCATION(38): 0x%x <- 0x%016llx (0x%llx)", raddr, value, rdata);
break;
}
case 44: //R_PPC64_REL64
{
const u64 value = vm::_ref<u64>(raddr) = rdata - raddr;
LOG_TRACE(LOADER, "**** RELOCATION(44): 0x%x <- 0x%016llx (0x%llx)", raddr, value, rdata);
ppu_loader.trace("**** RELOCATION(44): 0x%x <- 0x%016llx (0x%llx)", raddr, value, rdata);
break;
}
case 57: //R_PPC64_ADDR16_LO_DS
{
const u16 value = vm::_ref<ppu_bf_t<be_t<u16>, 0, 14>>(raddr) = static_cast<u16>(rdata) >> 2;
LOG_TRACE(LOADER, "**** RELOCATION(57): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata);
ppu_loader.trace("**** RELOCATION(57): 0x%x <- 0x%04x (0x%llx)", raddr, value, rdata);
break;
}
default: LOG_ERROR(LOADER, "**** RELOCATION(%u): Illegal/Unknown type! (addr=0x%x; 0x%llx)", rtype, raddr, rdata);
default: ppu_loader.error("**** RELOCATION(%u): Illegal/Unknown type! (addr=0x%x; 0x%llx)", rtype, raddr, rdata);
}
if (rdata == 0)
{
LOG_TODO(LOADER, "**** RELOCATION(%u): 0x%x <- (zero-based value)", rtype, raddr);
ppu_loader.todo("**** RELOCATION(%u): 0x%x <- (zero-based value)", rtype, raddr);
}
}
@ -950,7 +950,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
prx->module_info_version[1] = lib_info->version[1];
prx->module_info_attributes = lib_info->attributes;
LOG_WARNING(LOADER, "Library %s (rtoc=0x%x):", lib_name, lib_info->toc);
ppu_loader.warning("Library %s (rtoc=0x%x):", lib_name, lib_info->toc);
prx->specials = ppu_load_exports(link, lib_info->exports_start, lib_info->exports_end);
prx->imports = ppu_load_imports(prx->relocs, link, lib_info->imports_start, lib_info->imports_end);
@ -959,7 +959,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
}
else
{
LOG_FATAL(LOADER, "Library %s: PRX library info not found");
ppu_loader.fatal("Library %s: PRX library info not found");
}
prx->start.set(prx->specials[0xbc9a0086]);
@ -990,7 +990,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
applied += g_fxo->get<patch_engine>()->apply(Emu.GetTitleID() + '-' + hash, vm::g_base_addr);
}
LOG_NOTICE(LOADER, "PRX library hash: %s (<- %u)", hash, applied);
ppu_loader.notice("PRX library hash: %s (<- %u)", hash, applied);
if (Emu.IsReady() && g_fxo->get<ppu_module>()->segs.empty())
{
@ -1067,7 +1067,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
// Allocate memory at fixed positions
for (const auto& prog : elf.progs)
{
LOG_NOTICE(LOADER, "** Segment: p_type=0x%x, p_vaddr=0x%llx, p_filesz=0x%llx, p_memsz=0x%llx, flags=0x%x", prog.p_type, prog.p_vaddr, prog.p_filesz, prog.p_memsz, prog.p_flags);
ppu_loader.notice("** Segment: p_type=0x%x, p_vaddr=0x%llx, p_filesz=0x%llx, p_memsz=0x%llx, flags=0x%x", prog.p_type, prog.p_vaddr, prog.p_filesz, prog.p_memsz, prog.p_flags);
ppu_segment _seg;
const u32 addr = _seg.addr = vm::cast(prog.p_vaddr, HERE);
@ -1108,7 +1108,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
// Load section list, used by the analyser
for (const auto& s : elf.shdrs)
{
LOG_NOTICE(LOADER, "** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", s.sh_type, s.sh_addr, s.sh_size, s.sh_flags);
ppu_loader.notice("** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", s.sh_type, s.sh_addr, s.sh_size, s.sh_flags);
ppu_segment _sec;
const u32 addr = _sec.addr = vm::cast(s.sh_addr);
@ -1143,7 +1143,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
applied += g_fxo->get<patch_engine>()->apply(Emu.GetTitleID() + '-' + hash, vm::g_base_addr);
}
LOG_NOTICE(LOADER, "PPU executable hash: %s (<- %u)", hash, applied);
ppu_loader.notice("PPU executable hash: %s (<- %u)", hash, applied);
// Initialize HLE modules
ppu_initialize_modules(link);
@ -1218,7 +1218,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
}
}
LOG_NOTICE(LOADER, "SPU executable hash: %s (<- %u)%s", hash, applied, dump);
ppu_loader.notice("SPU executable hash: %s (<- %u)%s", hash, applied, dump);
}
@ -1245,7 +1245,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
{
if (!std::exchange(not_found, false))
{
LOG_ERROR(LOADER, "More than one control flags header found! (flags1=0x%x)",
ppu_loader.error("More than one control flags header found! (flags1=0x%x)",
ctrl.control_flags.ctrl_flag1);
break;
}
@ -1254,7 +1254,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
}
}
LOG_NOTICE(LOADER, "SELF header information found: ctrl_flags1=0x%x, authid=0x%llx",
ppu_loader.notice("SELF header information found: ctrl_flags1=0x%x, authid=0x%llx",
g_ps3_process_info.ctrl_flags1, g_ps3_process_info.self_info.app_info.authid);
}
@ -1294,12 +1294,12 @@ void ppu_load_exec(const ppu_exec_object& elf)
if (info.size < sizeof(process_param_t))
{
LOG_WARNING(LOADER, "Bad process_param size! [0x%x : 0x%x]", info.size, sizeof(process_param_t));
ppu_loader.warning("Bad process_param size! [0x%x : 0x%x]", info.size, sizeof(process_param_t));
}
if (info.magic != 0x13bcc5f6)
{
LOG_ERROR(LOADER, "Bad process_param magic! [0x%x]", info.magic);
ppu_loader.error("Bad process_param magic! [0x%x]", info.magic);
}
else
{
@ -1315,12 +1315,12 @@ void ppu_load_exec(const ppu_exec_object& elf)
malloc_pagesize = info.malloc_pagesize;
ppc_seg = info.ppc_seg;
LOG_NOTICE(LOADER, "*** sdk version: 0x%x", info.sdk_version);
LOG_NOTICE(LOADER, "*** primary prio: %d", info.primary_prio);
LOG_NOTICE(LOADER, "*** primary stacksize: 0x%x", info.primary_stacksize);
LOG_NOTICE(LOADER, "*** malloc pagesize: 0x%x", info.malloc_pagesize);
LOG_NOTICE(LOADER, "*** ppc seg: 0x%x", info.ppc_seg);
//LOG_NOTICE(LOADER, "*** crash dump param addr: 0x%x", info.crash_dump_param_addr);
ppu_loader.notice("*** sdk version: 0x%x", info.sdk_version);
ppu_loader.notice("*** primary prio: %d", info.primary_prio);
ppu_loader.notice("*** primary stacksize: 0x%x", info.primary_stacksize);
ppu_loader.notice("*** malloc pagesize: 0x%x", info.malloc_pagesize);
ppu_loader.notice("*** ppc seg: 0x%x", info.ppc_seg);
//ppu_loader.notice("*** crash dump param addr: 0x%x", info.crash_dump_param_addr);
}
}
break;
@ -1347,10 +1347,10 @@ void ppu_load_exec(const ppu_exec_object& elf)
const auto& proc_prx_param = vm::_ref<const ppu_proc_prx_param_t>(vm::cast(prog.p_vaddr, HERE));
LOG_NOTICE(LOADER, "* libent_start = *0x%x", proc_prx_param.libent_start);
LOG_NOTICE(LOADER, "* libstub_start = *0x%x", proc_prx_param.libstub_start);
LOG_NOTICE(LOADER, "* unk0 = 0x%x", proc_prx_param.unk0);
LOG_NOTICE(LOADER, "* unk2 = 0x%x", proc_prx_param.unk2);
ppu_loader.notice("* libent_start = *0x%x", proc_prx_param.libent_start);
ppu_loader.notice("* libstub_start = *0x%x", proc_prx_param.libstub_start);
ppu_loader.notice("* unk0 = 0x%x", proc_prx_param.unk0);
ppu_loader.notice("* unk2 = 0x%x", proc_prx_param.unk2);
if (proc_prx_param.magic != 0x1b434cec)
{
@ -1365,7 +1365,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
}
default:
{
LOG_ERROR(LOADER, "Unknown phdr type (0x%08x)", p_type);
ppu_loader.error("Unknown phdr type (0x%08x)", p_type);
}
}
}
@ -1404,7 +1404,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
if (!fs::is_dir(lle_dir) || !fs::is_file(lle_dir + "libsysmodule.sprx"))
{
LOG_ERROR(LOADER, "PS3 firmware is not installed or the installed firmware is invalid."
ppu_loader.error("PS3 firmware is not installed or the installed firmware is invalid."
"\nYou should install the PS3 Firmware (Menu: File -> Install Firmware)."
"\nVisit https://rpcs3.net/ for Quickstart Guide and more information.");
}
@ -1415,13 +1415,13 @@ void ppu_load_exec(const ppu_exec_object& elf)
if (obj == elf_error::ok)
{
LOG_WARNING(LOADER, "Loading library: %s", name);
ppu_loader.warning("Loading library: %s", name);
auto prx = ppu_load_prx(obj, lle_dir + name);
if (prx->funcs.empty())
{
LOG_FATAL(LOADER, "Module %s has no functions!", name);
ppu_loader.fatal("Module %s has no functions!", name);
}
else
{
@ -1466,7 +1466,7 @@ void ppu_load_exec(const ppu_exec_object& elf)
{
if (ppc_seg != 0x1)
{
LOG_TODO(LOADER, "Unknown ppc_seg flag value = 0x%x", ppc_seg);
ppu_loader.todo("Unknown ppc_seg flag value = 0x%x", ppc_seg);
}
// Additional segment for fixed allocations
@ -1637,7 +1637,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
// Allocate memory at fixed positions
for (const auto& prog : elf.progs)
{
LOG_NOTICE(LOADER, "** Segment: p_type=0x%x, p_vaddr=0x%llx, p_filesz=0x%llx, p_memsz=0x%llx, flags=0x%x", prog.p_type, prog.p_vaddr, prog.p_filesz, prog.p_memsz, prog.p_flags);
ppu_loader.notice("** Segment: p_type=0x%x, p_vaddr=0x%llx, p_filesz=0x%llx, p_memsz=0x%llx, flags=0x%x", prog.p_type, prog.p_vaddr, prog.p_filesz, prog.p_memsz, prog.p_flags);
ppu_segment _seg;
const u32 addr = _seg.addr = vm::cast(prog.p_vaddr, HERE);
@ -1678,7 +1678,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
// Load section list, used by the analyser
for (const auto& s : elf.shdrs)
{
LOG_NOTICE(LOADER, "** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", s.sh_type, s.sh_addr, s.sh_size, s.sh_flags);
ppu_loader.notice("** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", s.sh_type, s.sh_addr, s.sh_size, s.sh_flags);
ppu_segment _sec;
const u32 addr = _sec.addr = vm::cast(s.sh_addr);
@ -1713,7 +1713,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
applied += g_fxo->get<patch_engine>()->apply(Emu.GetTitleID() + '-' + hash, vm::g_base_addr);
}
LOG_NOTICE(LOADER, "OVL executable hash: %s (<- %u)", hash, applied);
ppu_loader.notice("OVL executable hash: %s (<- %u)", hash, applied);
// Load other programs
for (auto& prog : elf.progs)
@ -1740,16 +1740,16 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
if (info.size < sizeof(process_param_t))
{
LOG_WARNING(LOADER, "Bad process_param size! [0x%x : 0x%x]", info.size, u32{sizeof(process_param_t)});
ppu_loader.warning("Bad process_param size! [0x%x : 0x%x]", info.size, u32{sizeof(process_param_t)});
}
if (info.magic != 0x4f564c4d) //string "OVLM"
{
LOG_ERROR(LOADER, "Bad process_param magic! [0x%x]", info.magic);
ppu_loader.error("Bad process_param magic! [0x%x]", info.magic);
}
else
{
LOG_NOTICE(LOADER, "*** sdk version: 0x%x", info.sdk_version);
ppu_loader.notice("*** sdk version: 0x%x", info.sdk_version);
}
}
break;
@ -1776,10 +1776,10 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
const auto& proc_prx_param = vm::_ref<const ppu_proc_prx_param_t>(vm::cast(prog.p_vaddr, HERE));
LOG_NOTICE(LOADER, "* libent_start = *0x%x", proc_prx_param.libent_start);
LOG_NOTICE(LOADER, "* libstub_start = *0x%x", proc_prx_param.libstub_start);
LOG_NOTICE(LOADER, "* unk0 = 0x%x", proc_prx_param.unk0);
LOG_NOTICE(LOADER, "* unk2 = 0x%x", proc_prx_param.unk2);
ppu_loader.notice("* libent_start = *0x%x", proc_prx_param.libent_start);
ppu_loader.notice("* libstub_start = *0x%x", proc_prx_param.libstub_start);
ppu_loader.notice("* unk0 = 0x%x", proc_prx_param.unk0);
ppu_loader.notice("* unk2 = 0x%x", proc_prx_param.unk2);
if (proc_prx_param.magic != 0x1b434cec)
{
@ -1793,7 +1793,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
}
default:
{
LOG_ERROR(LOADER, "Unknown phdr type (0x%08x)", p_type);
ppu_loader.error("Unknown phdr type (0x%08x)", p_type);
}
}
}

View file

@ -139,7 +139,7 @@ void sys_spu_image::deploy(u32 loc, sys_spu_segment* segs, u32 nsegs)
applied += g_fxo->get<patch_engine>()->apply(Emu.GetTitleID() + '-' + hash, vm::_ptr<u8>(loc));
}
LOG_NOTICE(LOADER, "Loaded SPU image: %s (<- %u)%s", hash, applied, dump);
LOG_NOTICE(SPU, "Loaded SPU image: %s (<- %u)%s", hash, applied, dump);
}
// Get spu thread ptr, returns group ptr as well for refcounting
@ -435,7 +435,7 @@ error_code sys_spu_thread_group_create(ppu_thread& ppu, vm::ptr<u32> id, u32 num
}
*id = idm::last_id();
sys_spu.warning(u8"sys_spu_thread_group_create(): Thread group “%s” created (id=0x%x)", group->name, idm::last_id());
sys_spu.warning(u8"sys_spu_thread_group_create(): Thread group “%s” created (id=0x%x)", group->name, idm::last_id());
return CELL_OK;
}

View file

@ -615,13 +615,13 @@ bool Emulator::BootRsxCapture(const std::string& path)
if (frame->magic != rsx::FRAME_CAPTURE_MAGIC)
{
LOG_ERROR(LOADER, "Invalid rsx capture file!");
sys_log.error("Invalid rsx capture file!");
return false;
}
if (frame->version != rsx::FRAME_CAPTURE_VERSION)
{
LOG_ERROR(LOADER, "Rsx capture file version not supported! Expected %d, found %d", rsx::FRAME_CAPTURE_VERSION, frame->version);
sys_log.error("Rsx capture file version not supported! Expected %d, found %d", rsx::FRAME_CAPTURE_VERSION, frame->version);
return false;
}
@ -947,7 +947,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
games.reset();
}
LOG_NOTICE(LOADER, "Path: %s", m_path);
sys_log.notice("Path: %s", m_path);
const std::string elf_dir = fs::get_parent_dir(m_path);
@ -998,14 +998,14 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (!_psf.empty() && m_cat.empty())
{
LOG_FATAL(LOADER, "Corrupted PARAM.SFO found! Assuming category GD. Try reinstalling the game.");
sys_log.fatal("Corrupted PARAM.SFO found! Assuming category GD. Try reinstalling the game.");
m_cat = "GD";
}
LOG_NOTICE(LOADER, "Title: %s", GetTitle());
LOG_NOTICE(LOADER, "Serial: %s", GetTitleID());
LOG_NOTICE(LOADER, "Category: %s", GetCat());
LOG_NOTICE(LOADER, "Version: %s / %s", version_app, version_disc);
sys_log.notice("Title: %s", GetTitle());
sys_log.notice("Serial: %s", GetTitleID());
sys_log.notice("Category: %s", GetCat());
sys_log.notice("Version: %s / %s", version_app, version_disc);
if (!force_global_config)
{
@ -1015,14 +1015,14 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
// Load custom config-1
if (fs::file cfg_file{ config_path_old })
{
LOG_NOTICE(LOADER, "Applying custom config: %s", config_path_old);
sys_log.notice("Applying custom config: %s", config_path_old);
g_cfg.from_string(cfg_file.to_string());
}
// Load custom config-2
if (fs::file cfg_file{ config_path_new })
{
LOG_NOTICE(LOADER, "Applying custom config: %s", config_path_new);
sys_log.notice("Applying custom config: %s", config_path_new);
g_cfg.from_string(cfg_file.to_string());
g_cfg.name = config_path_new;
}
@ -1030,7 +1030,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
// Load custom config-3
if (fs::file cfg_file{ m_path + ".yml" })
{
LOG_NOTICE(LOADER, "Applying custom config: %s.yml", m_path);
sys_log.notice("Applying custom config: %s.yml", m_path);
g_cfg.from_string(cfg_file.to_string());
}
}
@ -1038,11 +1038,11 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
#if defined(_WIN32) || defined(HAVE_VULKAN)
if (g_cfg.video.renderer == video_renderer::vulkan)
{
LOG_NOTICE(LOADER, "Vulkan SDK Revision: %d", VK_HEADER_VERSION);
sys_log.notice("Vulkan SDK Revision: %d", VK_HEADER_VERSION);
}
#endif
LOG_NOTICE(LOADER, "Used configuration:\n%s\n", g_cfg.to_string());
sys_log.notice("Used configuration:\n%s\n", g_cfg.to_string());
// Set RTM usage
g_use_rtm = utils::has_rtm() && ((utils::has_mpx() && g_cfg.core.enable_TSX == tsx_usage::enabled) || g_cfg.core.enable_TSX == tsx_usage::forced);
@ -1070,7 +1070,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (!hdd1.empty())
{
vfs::mount("/dev_hdd1", hdd1);
LOG_NOTICE(LOADER, "Hdd1: %s", vfs::get("/dev_hdd1"));
sys_log.notice("Hdd1: %s", vfs::get("/dev_hdd1"));
}
// Special boot mode (directory scan)
@ -1111,7 +1111,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
break;
}
LOG_NOTICE(LOADER, "Scanning directory: %s", dir_queue[i]);
sys_log.notice("Scanning directory: %s", dir_queue[i]);
for (auto&& entry : fs::dir(dir_queue[i]))
{
@ -1153,7 +1153,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
{
const auto& path = file_queue[i].first;
LOG_NOTICE(LOADER, "Trying to load SPRX: %s", path);
sys_log.notice("Trying to load SPRX: %s", path);
// Load MSELF or SPRX
fs::file src{path};
@ -1189,7 +1189,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
}
}
LOG_ERROR(LOADER, "Failed to load SPRX '%s' (%s)", path, obj.get_error());
sys_log.error("Failed to load SPRX '%s' (%s)", path, obj.get_error());
g_progr_fdone++;
}
@ -1217,17 +1217,17 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (bdvd_pos && from_hdd0_game)
{
// Booting disc game from wrong location
LOG_ERROR(LOADER, "Disc game %s found at invalid location /dev_hdd0/game/", m_title_id);
sys_log.error("Disc game %s found at invalid location /dev_hdd0/game/", m_title_id);
// Move and retry from correct location
if (fs::rename(elf_dir + "/../../", hdd0_disc + elf_dir.substr(hdd0_game.size()) + "/../../", false))
{
LOG_SUCCESS(LOADER, "Disc game %s moved to special location /dev_hdd0/disc/", m_title_id);
sys_log.success("Disc game %s moved to special location /dev_hdd0/disc/", m_title_id);
return m_path = hdd0_disc + m_path.substr(hdd0_game.size()), Load();
}
else
{
LOG_ERROR(LOADER, "Failed to move disc game %s to /dev_hdd0/disc/ (%s)", m_title_id, fs::g_tls_error);
sys_log.error("Failed to move disc game %s to /dev_hdd0/disc/ (%s)", m_title_id, fs::g_tls_error);
return;
}
}
@ -1254,7 +1254,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
}
else
{
LOG_FATAL(LOADER, "Disc directory not found. Try to run the game from the actual game disc directory.");
sys_log.fatal("Disc directory not found. Try to run the game from the actual game disc directory.");
}
}
@ -1264,14 +1264,14 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
fs::file sfb_file;
vfs::mount("/dev_bdvd", bdvd_dir);
LOG_NOTICE(LOADER, "Disc: %s", vfs::get("/dev_bdvd"));
sys_log.notice("Disc: %s", vfs::get("/dev_bdvd"));
vfs::mount("/dev_bdvd/PS3_GAME", bdvd_dir + m_game_dir + "/");
LOG_NOTICE(LOADER, "Game: %s", vfs::get("/dev_bdvd/PS3_GAME"));
sys_log.notice("Game: %s", vfs::get("/dev_bdvd/PS3_GAME"));
if (!sfb_file.open(vfs::get("/dev_bdvd/PS3_DISC.SFB")) || sfb_file.size() < 4 || sfb_file.read<u32>() != ".SFB"_u32)
{
LOG_ERROR(LOADER, "Invalid disc directory for the disc game %s", m_title_id);
sys_log.error("Invalid disc directory for the disc game %s", m_title_id);
return;
}
@ -1279,7 +1279,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (bdvd_title_id != m_title_id)
{
LOG_ERROR(LOADER, "Unexpected disc directory for the disc game %s (found %s)", m_title_id, bdvd_title_id);
sys_log.error("Unexpected disc directory for the disc game %s (found %s)", m_title_id, bdvd_title_id);
return;
}
@ -1292,11 +1292,11 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
else if (m_cat == "1P" && from_hdd0_game)
{
//PS1 Classics
LOG_NOTICE(LOADER, "PS1 Game: %s, %s", m_title_id, m_title);
sys_log.notice("PS1 Game: %s, %s", m_title_id, m_title);
std::string gamePath = m_path.substr(m_path.find("/dev_hdd0/game/"), 24);
LOG_NOTICE(LOADER, "Forcing manual lib loading mode");
sys_log.notice("Forcing manual lib loading mode");
g_cfg.core.lib_loading.from_string(fmt::format("%s", lib_loading_type::manual));
g_cfg.core.load_libraries.from_list({});
@ -1326,23 +1326,23 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
else if (m_cat == "DG" && from_hdd0_game)
{
vfs::mount("/dev_bdvd/PS3_GAME", hdd0_game + m_path.substr(hdd0_game.size(), 10));
LOG_NOTICE(LOADER, "Game: %s", vfs::get("/dev_bdvd/PS3_GAME"));
sys_log.notice("Game: %s", vfs::get("/dev_bdvd/PS3_GAME"));
}
else if (disc.empty())
{
LOG_ERROR(LOADER, "Failed to mount disc directory for the disc game %s", m_title_id);
sys_log.error("Failed to mount disc directory for the disc game %s", m_title_id);
return;
}
else
{
bdvd_dir = disc;
vfs::mount("/dev_bdvd", bdvd_dir);
LOG_NOTICE(LOADER, "Disk: %s", vfs::get("/dev_bdvd"));
sys_log.notice("Disk: %s", vfs::get("/dev_bdvd"));
}
if (add_only)
{
LOG_NOTICE(LOADER, "Finished to add data to games.yml by boot for: %s", m_path);
sys_log.notice("Finished to add data to games.yml by boot for: %s", m_path);
m_path = m_path_old; // Reset m_path to fix boot from gui
return;
}
@ -1363,14 +1363,14 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (lock_file && fs::is_dir(ins_dir))
{
LOG_NOTICE(LOADER, "Found INSDIR: %s", ins_dir);
sys_log.notice("Found INSDIR: %s", ins_dir);
for (auto&& entry : fs::dir{ins_dir})
{
const std::string pkg = ins_dir + entry.name;
if (!entry.is_directory && ends_with(entry.name, ".PKG") && !InstallPkg(pkg))
{
LOG_ERROR(LOADER, "Failed to install %s", pkg);
sys_log.error("Failed to install %s", pkg);
return;
}
}
@ -1378,7 +1378,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (lock_file && fs::is_dir(pkg_dir))
{
LOG_NOTICE(LOADER, "Found PKGDIR: %s", pkg_dir);
sys_log.notice("Found PKGDIR: %s", pkg_dir);
for (auto&& entry : fs::dir{pkg_dir})
{
@ -1388,7 +1388,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (fs::is_file(pkg_file) && !InstallPkg(pkg_file))
{
LOG_ERROR(LOADER, "Failed to install %s", pkg_file);
sys_log.error("Failed to install %s", pkg_file);
return;
}
}
@ -1397,7 +1397,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (lock_file && fs::is_dir(extra_dir))
{
LOG_NOTICE(LOADER, "Found PS3_EXTRA: %s", extra_dir);
sys_log.notice("Found PS3_EXTRA: %s", extra_dir);
for (auto&& entry : fs::dir{extra_dir})
{
@ -1407,7 +1407,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (fs::is_file(pkg_file) && !InstallPkg(pkg_file))
{
LOG_ERROR(LOADER, "Failed to install %s", pkg_file);
sys_log.error("Failed to install %s", pkg_file);
return;
}
}
@ -1421,7 +1421,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (disc.empty() && m_cat == "DG" && fs::is_file(hdd0_boot))
{
// Booting game update
LOG_SUCCESS(LOADER, "Updates found at /dev_hdd0/game/%s/!", m_title_id);
sys_log.success("Updates found at /dev_hdd0/game/%s/!", m_title_id);
return m_path = hdd0_boot, Load();
}
@ -1434,7 +1434,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (!bdvd_title.empty() && bdvd_title != m_title)
{
LOG_NOTICE(LOADER, "Title was set from %s to %s", m_title, bdvd_title);
sys_log.notice("Title was set from %s to %s", m_title, bdvd_title);
m_title = bdvd_title;
}
}
@ -1465,7 +1465,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (!elf_file)
{
LOG_ERROR(LOADER, "Failed to open executable: %s", elf_path);
sys_log.error("Failed to open executable: %s", elf_path);
return;
}
@ -1496,7 +1496,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
}
else
{
LOG_ERROR(LOADER, "Failed to create boot.elf");
sys_log.error("Failed to create boot.elf");
}
}
}
@ -1507,7 +1507,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
if (!elf_file)
{
LOG_ERROR(LOADER, "Failed to decrypt SELF: %s", elf_path);
sys_log.error("Failed to decrypt SELF: %s", elf_path);
return;
}
@ -1534,13 +1534,13 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
{
argv[0] = "/dev_bdvd/PS3_GAME/" + m_path.substr(hdd0_game.size() + 10);
m_dir = "/dev_hdd0/game/" + m_path.substr(hdd0_game.size(), 10);
LOG_NOTICE(LOADER, "Disc path: %s", m_dir);
sys_log.notice("Disc path: %s", m_dir);
}
else if (from_hdd0_game)
{
argv[0] = "/dev_hdd0/game/" + m_path.substr(hdd0_game.size());
m_dir = "/dev_hdd0/game/" + m_path.substr(hdd0_game.size(), 10);
LOG_NOTICE(LOADER, "Boot path: %s", m_dir);
sys_log.notice("Boot path: %s", m_dir);
}
else if (!bdvd_dir.empty() && fs::is_dir(bdvd_dir))
{
@ -1556,7 +1556,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
m_dir = "/host_root/" + elf_dir + '/';
}
LOG_NOTICE(LOADER, "Elf path: %s", argv[0]);
sys_log.notice("Elf path: %s", argv[0]);
}
const auto _main = g_fxo->init<ppu_module>();
@ -1580,7 +1580,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
}
else
{
LOG_NOTICE(LOADER, "Cache: %s", _main->cache);
sys_log.notice("Cache: %s", _main->cache);
}
g_fxo->init();
@ -1609,11 +1609,11 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
}
else
{
LOG_ERROR(LOADER, "Invalid or unsupported file format: %s", elf_path);
sys_log.error("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());
LOG_WARNING(LOADER, "** spu_exec -> %s", spu_exec.get_error());
sys_log.warning("** ppu_exec -> %s", ppu_exec.get_error());
sys_log.warning("** ppu_prx -> %s", ppu_prx.get_error());
sys_log.warning("** spu_exec -> %s", spu_exec.get_error());
return;
}
@ -1630,7 +1630,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
}
catch (const std::exception& e)
{
LOG_FATAL(LOADER, "%s thrown: %s", typeid(e).name(), e.what());
sys_log.fatal("%s thrown: %s", typeid(e).name(), e.what());
Stop();
}
}

View file

@ -1,6 +1,8 @@
#include "stdafx.h"
#include "PSF.h"
LOG_CHANNEL(psf_log);
template<>
void fmt_class_string<psf::format>::format(std::string& out, u64 arg)
{
@ -176,7 +178,7 @@ namespace psf
else
{
// Possibly unsupported format, entry ignored
LOG_ERROR(LOADER, "Unknown entry format (key='%s', fmt=0x%x, len=0x%x, max=0x%x)", key, indices[i].param_fmt, indices[i].param_len, indices[i].param_max);
psf_log.error("Unknown entry format (key='%s', fmt=0x%x, len=0x%x, max=0x%x)", key, indices[i].param_fmt, indices[i].param_len, indices[i].param_max);
}
}
@ -250,7 +252,7 @@ namespace psf
if (value.size() + (fmt == format::string) > max)
{
// TODO: check real limitations of PSF format
LOG_ERROR(LOADER, "Entry value shrinkage (key='%s', value='%s', size=0x%zx, max=0x%x)", entry.first, value, size, max);
psf_log.error("Entry value shrinkage (key='%s', value='%s', size=0x%zx, max=0x%x)", entry.first, value, size, max);
}
stream.write(value);

View file

@ -5,6 +5,8 @@
#include "Emu/System.h"
#include "TROPUSR.h"
LOG_CHANNEL(trp_log);
bool TROPUSRLoader::Load(const std::string& filepath, const std::string& configpath)
{
const std::string& path = vfs::get(filepath);
@ -223,13 +225,13 @@ u32 TROPUSRLoader::GetUnlockedPlatinumID(u32 trophy_id, const std::string& confi
if (trophy_id >= m_table6.size() || trophy_id >= m_table4.size())
{
LOG_WARNING(LOADER, "TROPUSRLoader::GetUnlockedPlatinumID: Invalid id=%d", trophy_id);
trp_log.warning("TROPUSRLoader::GetUnlockedPlatinumID: Invalid id=%d", trophy_id);
return invalid_trophy_id;
}
if (m_table6.size() != m_table4.size())
{
LOG_WARNING(LOADER, "TROPUSRLoader::GetUnlockedPlatinumID: Table size mismatch: %d vs. %d", m_table6.size(), m_table4.size());
trp_log.warning("TROPUSRLoader::GetUnlockedPlatinumID: Table size mismatch: %d vs. %d", m_table6.size(), m_table4.size());
return invalid_trophy_id;
}
@ -295,7 +297,7 @@ u32 TROPUSRLoader::GetTrophyGrade(u32 id)
{
if (id >= m_table4.size())
{
LOG_WARNING(LOADER, "TROPUSRLoader::GetTrophyGrade: Invalid id=%d", id);
trp_log.warning("TROPUSRLoader::GetTrophyGrade: Invalid id=%d", id);
return trophy_grade::unknown;
}
@ -306,7 +308,7 @@ u32 TROPUSRLoader::GetTrophyUnlockState(u32 id)
{
if (id >= m_table6.size())
{
LOG_WARNING(LOADER, "TROPUSRLoader::GetTrophyUnlockState: Invalid id=%d", id);
trp_log.warning("TROPUSRLoader::GetTrophyUnlockState: Invalid id=%d", id);
return 0;
}
@ -317,7 +319,7 @@ u64 TROPUSRLoader::GetTrophyTimestamp(u32 id)
{
if (id >= m_table6.size())
{
LOG_WARNING(LOADER, "TROPUSRLoader::GetTrophyTimestamp: Invalid id=%d", id);
trp_log.warning("TROPUSRLoader::GetTrophyTimestamp: Invalid id=%d", id);
return 0;
}
@ -329,7 +331,7 @@ bool TROPUSRLoader::UnlockTrophy(u32 id, u64 timestamp1, u64 timestamp2)
{
if (id >= m_table6.size())
{
LOG_WARNING(LOADER, "TROPUSRLoader::UnlockTrophy: Invalid id=%d", id);
trp_log.warning("TROPUSRLoader::UnlockTrophy: Invalid id=%d", id);
return false;
}

View file

@ -4,6 +4,8 @@
#include "Crypto/sha1.h"
#include "Utilities/StrUtil.h"
LOG_CHANNEL(trp_log);
TRPLoader::TRPLoader(const fs::file& f)
: trp_f(f)
{
@ -57,7 +59,7 @@ bool TRPLoader::LoadHeader(bool show)
if (show)
{
LOG_NOTICE(LOADER, "TRP version: 0x%x", m_header.trp_version);
trp_log.notice("TRP version: 0x%x", m_header.trp_version);
}
if (m_header.trp_version >= 2)
@ -68,7 +70,7 @@ bool TRPLoader::LoadHeader(bool show)
trp_f.seek(0);
if (!trp_f.read(file_contents))
{
LOG_NOTICE(LOADER, "Failed verifying checksum");
trp_log.notice("Failed verifying checksum");
}
else
{
@ -77,7 +79,7 @@ bool TRPLoader::LoadHeader(bool show)
if (memcmp(hash, m_header.sha1, 20) != 0)
{
LOG_ERROR(LOADER, "Invalid checksum of TROPHY.TRP file");
trp_log.error("Invalid checksum of TROPHY.TRP file");
return false;
}
}
@ -97,7 +99,7 @@ bool TRPLoader::LoadHeader(bool show)
if (show)
{
LOG_NOTICE(LOADER, "TRP entry #%d: %s", m_entries[i].name);
trp_log.notice("TRP entry #%d: %s", m_entries[i].name);
}
}

View file

@ -16,6 +16,8 @@
#include "Emu/RSX/CgBinaryProgram.h"
LOG_CHANNEL(gui_log);
constexpr auto qstr = QString::fromStdString;
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
@ -29,7 +31,7 @@ cg_disasm_window::cg_disasm_window(std::shared_ptr<gui_settings> xSettings): xgu
resize(QSize(620, 395));
m_path_last = xgui_settings->GetValue(gui::fd_cg_disasm).toString();
m_disasm_text = new QTextEdit(this);
m_disasm_text->setReadOnly(true);
m_disasm_text->setWordWrapMode(QTextOption::NoWrap);
@ -119,7 +121,7 @@ void cg_disasm_window::ShowDisasm()
}
else if (!m_path_last.isEmpty())
{
LOG_ERROR(LOADER, "CgDisasm: Failed to open %s", sstr(m_path_last));
gui_log.error("CgDisasm: Failed to open %s", sstr(m_path_last));
}
}

View file

@ -324,7 +324,7 @@ void emu_settings::SaveSettings()
if (!Emu.IsStopped()) // Don't spam the log while emulation is stopped. The config will be logged on boot anyway.
{
LOG_NOTICE(LOADER, "Updated configuration:\n%s\n", g_cfg.to_string());
cfg_log.notice("Updated configuration:\n%s\n", g_cfg.to_string());
}
}

View file

@ -30,6 +30,7 @@
#include <QClipboard>
LOG_CHANNEL(game_list_log);
LOG_CHANNEL(sys_log);
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
@ -845,7 +846,7 @@ void game_list_frame::doubleClickedSlot(QTableWidgetItem *item)
return;
}
LOG_NOTICE(LOADER, "Booting from gamelist per doubleclick...");
sys_log.notice("Booting from gamelist per doubleclick...");
Q_EMIT RequestBoot(game);
}
@ -894,7 +895,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
boot_custom->setFont(f);
connect(boot_custom, &QAction::triggered, [=]
{
LOG_NOTICE(LOADER, "Booting from gamelist per context menu...");
sys_log.notice("Booting from gamelist per context menu...");
Q_EMIT RequestBoot(gameinfo);
});
}
@ -1006,7 +1007,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
connect(boot, &QAction::triggered, [=]
{
LOG_NOTICE(LOADER, "Booting from gamelist per context menu...");
sys_log.notice("Booting from gamelist per context menu...");
Q_EMIT RequestBoot(gameinfo, gameinfo->hasCustomConfig);
});
connect(configure, &QAction::triggered, [=]
@ -1863,7 +1864,7 @@ bool game_list_frame::eventFilter(QObject *object, QEvent *event)
if (!gameinfo)
return false;
LOG_NOTICE(LOADER, "Booting from gamelist by pressing %s...", keyEvent->key() == Qt::Key_Enter ? "Enter" : "Return");
sys_log.notice("Booting from gamelist by pressing %s...", keyEvent->key() == Qt::Key_Enter ? "Enter" : "Return");
Q_EMIT RequestBoot(gameinfo);
return true;

View file

@ -262,7 +262,7 @@ void main_window::Boot(const std::string& path, const std::string& title_id, boo
if (Emu.BootGame(path, title_id, direct, add_only, force_global_config))
{
LOG_SUCCESS(LOADER, "Boot successful.");
gui_log.success("Boot successful.");
const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] ";
if (!add_only)
{
@ -309,7 +309,7 @@ void main_window::BootElf()
guiSettings->SetValue(gui::fd_boot_elf, filePath);
const std::string path = sstr(QFileInfo(filePath).canonicalFilePath());
LOG_NOTICE(LOADER, "Booting from BootElf...");
gui_log.notice("Booting from BootElf...");
Boot(path, "", true);
}
@ -335,7 +335,7 @@ void main_window::BootGame()
guiSettings->SetValue(gui::fd_boot_game, QFileInfo(dirPath).path());
const std::string path = sstr(dirPath);
LOG_NOTICE(LOADER, "Booting from BootGame...");
gui_log.notice("Booting from BootGame...");
Boot(path);
}
@ -373,7 +373,7 @@ void main_window::BootRsxCapture(std::string path)
}
else
{
LOG_SUCCESS(LOADER, "Capture Boot Success. path: %s", path);
gui_log.success("Capture Boot Success. path: %s", path);
}
}
@ -394,7 +394,7 @@ void main_window::InstallPackages(QStringList file_paths, bool show_confirm)
if (QMessageBox::question(this, tr("PKG Decrypter / Installer"), tr("Install package: %1?").arg(file_paths.front()),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
{
LOG_NOTICE(LOADER, "PKG: Cancelled installation from drop. File: %s", sstr(file_paths.front()));
gui_log.notice("PKG: Cancelled installation from drop. File: %s", sstr(file_paths.front()));
return;
}
}
@ -516,7 +516,7 @@ void main_window::InstallPup(QString file_path)
if (QMessageBox::question(this, tr("RPCS3 Firmware Installer"), tr("Install firmware: %1?").arg(file_path),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes)
{
LOG_NOTICE(LOADER, "Firmware: Cancelled installation from drop. File: %s", sstr(file_path));
gui_log.notice("Firmware: Cancelled installation from drop. File: %s", sstr(file_path));
return;
}
}
@ -1041,7 +1041,7 @@ void main_window::BootRecentAction(const QAction* act)
return;
}
LOG_NOTICE(LOADER, "Booting from recent games list...");
gui_log.notice("Booting from recent games list...");
Boot(path, "", true);
}
@ -1124,7 +1124,7 @@ void main_window::AddRecentAction(const q_string_pair& entry)
}
else if (m_rg_entries.count() > 9)
{
LOG_ERROR(LOADER, "Recent games entrylist too big");
gui_log.error("Recent games entrylist too big");
}
if (m_rg_entries.count() < 9)

View file

@ -57,7 +57,7 @@ namespace
if (psf.empty())
{
LOG_ERROR(LOADER, "Failed to load savedata: %s", base_dir + "/" + entry.name);
gui_log.error("Failed to load savedata: %s", base_dir + "/" + entry.name);
continue;
}