mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
Logging system rework
* use one central unified log with channels/priorities ad-hoc listener registration and de-registration * disable buffering by default * add multi-threaded ringbuffer implementation * use buffered listener for the gui (using the ringbuffer)
This commit is contained in:
parent
394b698e92
commit
21da317453
165 changed files with 1731 additions and 1519 deletions
|
@ -1,5 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/ConLog.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/FS/vfsLocalFile.h"
|
||||
#include "unself.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
// Check SCE magic.
|
||||
if (!sce_hdr.CheckMagic())
|
||||
{
|
||||
ConLog.Error("SELF: Not a SELF file!");
|
||||
LOGF_ERROR(LOADER, "SELF: Not a SELF file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
phdr32_arr.clear();
|
||||
if(elf32_hdr.e_phoff == 0 && elf32_hdr.e_phnum)
|
||||
{
|
||||
ConLog.Error("SELF: ELF program header offset is null!");
|
||||
LOGF_ERROR(LOADER, "SELF: ELF program header offset is null!");
|
||||
return false;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_phdroff);
|
||||
|
@ -56,7 +56,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
phdr64_arr.clear();
|
||||
if(elf64_hdr.e_phoff == 0 && elf64_hdr.e_phnum)
|
||||
{
|
||||
ConLog.Error("SELF: ELF program header offset is null!");
|
||||
LOGF_ERROR(LOADER, "SELF: ELF program header offset is null!");
|
||||
return false;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_phdroff);
|
||||
|
@ -101,7 +101,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
shdr32_arr.clear();
|
||||
if(elf32_hdr.e_shoff == 0 && elf32_hdr.e_shnum)
|
||||
{
|
||||
ConLog.Warning("SELF: ELF section header offset is null!");
|
||||
LOGF_WARNING(LOADER, "SELF: ELF section header offset is null!");
|
||||
return true;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_shdroff);
|
||||
|
@ -116,7 +116,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
shdr64_arr.clear();
|
||||
if(elf64_hdr.e_shoff == 0 && elf64_hdr.e_shnum)
|
||||
{
|
||||
ConLog.Warning("SELF: ELF section header offset is null!");
|
||||
LOGF_WARNING(LOADER, "SELF: ELF section header offset is null!");
|
||||
return true;
|
||||
}
|
||||
self_f.Seek(self_hdr.se_shdroff);
|
||||
|
@ -132,46 +132,46 @@ bool SELFDecrypter::LoadHeaders(bool isElf32)
|
|||
|
||||
void SELFDecrypter::ShowHeaders(bool isElf32)
|
||||
{
|
||||
ConLog.Write("SCE header");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "SCE header");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
sce_hdr.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("SELF header");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "SELF header");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
self_hdr.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("APP INFO");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "APP INFO");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
app_info.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("ELF header");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "ELF header");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
isElf32 ? elf32_hdr.Show() : elf64_hdr.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("ELF program headers");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "ELF program headers");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ((isElf32) ? phdr32_arr.size() : phdr64_arr.size()); i++)
|
||||
isElf32 ? phdr32_arr[i].Show() : phdr64_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("Section info");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "Section info");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < secinfo_arr.size(); i++)
|
||||
secinfo_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("SCE version info");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "SCE version info");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
scev_info.Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("Control info");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "Control info");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ctrlinfo_arr.size(); i++)
|
||||
ctrlinfo_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
ConLog.Write("ELF section headers");
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "ELF section headers");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
for(unsigned int i = 0; i < ((isElf32) ? shdr32_arr.size() : shdr64_arr.size()); i++)
|
||||
isElf32 ? shdr32_arr[i].Show() : shdr64_arr[i].Show();
|
||||
ConLog.Write("----------------------------------------------------");
|
||||
LOGF_NOTICE(LOADER, "----------------------------------------------------");
|
||||
}
|
||||
|
||||
bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
||||
|
@ -195,7 +195,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
|||
// If not, the data has no NPDRM layer.
|
||||
if (!ctrl)
|
||||
{
|
||||
ConLog.Warning("SELF: No NPDRM control info found!");
|
||||
LOGF_WARNING(LOADER, "SELF: No NPDRM control info found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
|||
|
||||
if (ctrl->npdrm.license == 1) // Network license.
|
||||
{
|
||||
ConLog.Error("SELF: Can't decrypt network NPDRM!");
|
||||
LOGF_ERROR(LOADER, "SELF: Can't decrypt network NPDRM!");
|
||||
return false;
|
||||
}
|
||||
else if (ctrl->npdrm.license == 2) // Local license.
|
||||
|
@ -216,7 +216,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))
|
||||
{
|
||||
ConLog.Error("SELF: Can't find RAP file for NPDRM decryption!");
|
||||
LOGF_ERROR(LOADER, "SELF: Can't find RAP file for NPDRM decryption!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size)
|
|||
}
|
||||
else
|
||||
{
|
||||
ConLog.Error("SELF: Invalid NPDRM license type!");
|
||||
LOGF_ERROR(LOADER, "SELF: Invalid NPDRM license type!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ bool SELFDecrypter::LoadMetadata()
|
|||
if ((meta_info.key_pad[0] != 0x00) ||
|
||||
(meta_info.iv_pad[0] != 0x00))
|
||||
{
|
||||
ConLog.Error("SELF: Failed to decrypt metadata info!");
|
||||
LOGF_ERROR(LOADER, "SELF: Failed to decrypt metadata info!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,7 @@ bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32)
|
|||
rFile e(elf.c_str(), rFile::write);
|
||||
if(!e.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not create ELF file! (%s)", elf.c_str());
|
||||
LOGF_ERROR(LOADER, "Could not create ELF file! (%s)", elf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,7 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
|
|||
// Check if we have a valid RAP file.
|
||||
if (!rFile::Exists(rap_path))
|
||||
{
|
||||
ConLog.Error("This application requires a valid RAP file for decryption!");
|
||||
LOGF_ERROR(LOADER, "This application requires a valid RAP file for decryption!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -519,11 +519,11 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
|
|||
|
||||
if (!rap_file.IsOpened())
|
||||
{
|
||||
ConLog.Error("Failed to load RAP file!");
|
||||
LOGF_ERROR(LOADER, "Failed to load RAP file!");
|
||||
return false;
|
||||
}
|
||||
|
||||
ConLog.Write("Loading RAP file %s", (ci_str + ".rap").c_str());
|
||||
LOGF_NOTICE(LOADER, "Loading RAP file %s", (ci_str + ".rap").c_str());
|
||||
rap_file.Read(rap_key, 0x10);
|
||||
rap_file.Close();
|
||||
|
||||
|
@ -573,7 +573,7 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf)
|
|||
|
||||
if(!s.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not open SELF file! (%s)", self.c_str());
|
||||
LOGF_ERROR(LOADER, "Could not open SELF file! (%s)", self.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf)
|
|||
// Check for DEBUG version.
|
||||
if(swap16(key_version) == 0x8000)
|
||||
{
|
||||
ConLog.Warning("Debug SELF detected! Removing fake header...");
|
||||
LOGF_WARNING(LOADER, "Debug SELF detected! Removing fake header...");
|
||||
|
||||
// Get the real elf offset.
|
||||
s.Seek(0x10);
|
||||
|
@ -600,7 +600,7 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf)
|
|||
rFile e(elf, rFile::write);
|
||||
if(!e.IsOpened())
|
||||
{
|
||||
ConLog.Error("Could not create ELF file! (%s)", elf.c_str());
|
||||
LOGF_ERROR(LOADER, "Could not create ELF file! (%s)", elf.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -640,28 +640,28 @@ bool DecryptSelf(const std::string& elf, const std::string& self)
|
|||
// Load the SELF file headers.
|
||||
if (!self_dec.LoadHeaders(isElf32))
|
||||
{
|
||||
ConLog.Error("SELF: Failed to load SELF file headers!");
|
||||
LOGF_ERROR(LOADER, "SELF: Failed to load SELF file headers!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load and decrypt the SELF file metadata.
|
||||
if (!self_dec.LoadMetadata())
|
||||
{
|
||||
ConLog.Error("SELF: Failed to load SELF file metadata!");
|
||||
LOGF_ERROR(LOADER, "SELF: Failed to load SELF file metadata!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decrypt the SELF file data.
|
||||
if (!self_dec.DecryptData())
|
||||
{
|
||||
ConLog.Error("SELF: Failed to decrypt SELF file data!");
|
||||
LOGF_ERROR(LOADER, "SELF: Failed to decrypt SELF file data!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make a new ELF file from this SELF.
|
||||
if (!self_dec.MakeElf(elf, isElf32))
|
||||
{
|
||||
ConLog.Error("SELF: Failed to make ELF file from SELF!");
|
||||
LOGF_ERROR(LOADER, "SELF: Failed to make ELF file from SELF!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue