mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 17:53:42 +01:00
Logging API change (refactor) (#19324)
* Rename LogType to Log * Explicitly use the Log:: enum when logging. Allows for autocomplete when editing. * Mac/ARM64 buildfix * Do the same with the hle result log macros * Rename the log names to mixed case while at it. * iOS buildfix * Qt buildfix attempt, ARM32 buildfix
This commit is contained in:
1 parent
ae3ff686f0
commit
e01ca5b057
393 files changed
+6198
-6193
No files matched your search
@@ -44,7 +44,7 @@ BlockDevice *constructBlockDevice(FileLoader *fileLoader) {
|
||||
return nullptr;
|
||||
}
|
||||
if (fileLoader->IsDirectory()) {
|
||||
ERROR_LOG(LOADER, "Can't open directory directly as block device: %s", fileLoader->GetPath().c_str());
|
||||
ERROR_LOG(Log::Loader, "Can't open directory directly as block device: %s", fileLoader->GetPath().c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ bool FileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) {
|
||||
FileLoader::Flags flags = uncached ? FileLoader::Flags::HINT_UNCACHED : FileLoader::Flags::NONE;
|
||||
size_t retval = fileLoader_->ReadAt((u64)blockNumber * (u64)GetBlockSize(), 1, 2048, outPtr, flags);
|
||||
if (retval != 2048) {
|
||||
DEBUG_LOG(FILESYS, "Could not read 2048 byte block, at block offset %d. Only got %d bytes", blockNumber, (int)retval);
|
||||
DEBUG_LOG(Log::FileSystem, "Could not read 2048 byte block, at block offset %d. Only got %d bytes", blockNumber, (int)retval);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ bool FileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) {
|
||||
bool FileBlockDevice::ReadBlocks(u32 minBlock, int count, u8 *outPtr) {
|
||||
size_t retval = fileLoader_->ReadAt((u64)minBlock * (u64)GetBlockSize(), 2048, count, outPtr);
|
||||
if (retval != (size_t)count) {
|
||||
ERROR_LOG(FILESYS, "Could not read %d blocks, at block offset %d. Only got %d blocks", count, minBlock, (int)retval);
|
||||
ERROR_LOG(Log::FileSystem, "Could not read %d blocks, at block offset %d. Only got %d blocks", count, minBlock, (int)retval);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -145,17 +145,17 @@ CISOFileBlockDevice::CISOFileBlockDevice(FileLoader *fileLoader)
|
||||
CISO_H hdr;
|
||||
size_t readSize = fileLoader->ReadAt(0, sizeof(CISO_H), 1, &hdr);
|
||||
if (readSize != 1 || memcmp(hdr.magic, "CISO", 4) != 0) {
|
||||
WARN_LOG(LOADER, "Invalid CSO!");
|
||||
WARN_LOG(Log::Loader, "Invalid CSO!");
|
||||
}
|
||||
if (hdr.ver > 1) {
|
||||
WARN_LOG(LOADER, "CSO version too high!");
|
||||
WARN_LOG(Log::Loader, "CSO version too high!");
|
||||
}
|
||||
|
||||
frameSize = hdr.block_size;
|
||||
if ((frameSize & (frameSize - 1)) != 0)
|
||||
ERROR_LOG(LOADER, "CSO block size %i unsupported, must be a power of two", frameSize);
|
||||
ERROR_LOG(Log::Loader, "CSO block size %i unsupported, must be a power of two", frameSize);
|
||||
else if (frameSize < 0x800)
|
||||
ERROR_LOG(LOADER, "CSO block size %i unsupported, must be at least one sector", frameSize);
|
||||
ERROR_LOG(Log::Loader, "CSO block size %i unsupported, must be at least one sector", frameSize);
|
||||
|
||||
// Determine the translation from block to frame.
|
||||
blockShift = 0;
|
||||
@@ -166,7 +166,7 @@ CISOFileBlockDevice::CISOFileBlockDevice(FileLoader *fileLoader)
|
||||
const u64 totalSize = hdr.total_bytes;
|
||||
numFrames = (u32)((totalSize + frameSize - 1) / frameSize);
|
||||
numBlocks = (u32)(totalSize / GetBlockSize());
|
||||
VERBOSE_LOG(LOADER, "CSO numBlocks=%i numFrames=%i align=%i", numBlocks, numFrames, indexShift);
|
||||
VERBOSE_LOG(Log::Loader, "CSO numBlocks=%i numFrames=%i align=%i", numBlocks, numFrames, indexShift);
|
||||
|
||||
// We might read a bit of alignment too, so be prepared.
|
||||
if (frameSize + (1 << indexShift) < CSO_READ_BUFFER_SIZE)
|
||||
@@ -207,7 +207,7 @@ CISOFileBlockDevice::CISOFileBlockDevice(FileLoader *fileLoader)
|
||||
u64 lastIndexPos = index[indexSize - 1] & 0x7FFFFFFF;
|
||||
u64 expectedFileSize = lastIndexPos << indexShift;
|
||||
if (expectedFileSize > fileSize) {
|
||||
ERROR_LOG(LOADER, "Expected CSO to at least be %lld bytes, but file is %lld bytes. File: '%s'",
|
||||
ERROR_LOG(Log::Loader, "Expected CSO to at least be %lld bytes, but file is %lld bytes. File: '%s'",
|
||||
expectedFileSize, fileSize, fileLoader->GetPath().c_str());
|
||||
NotifyReadError();
|
||||
}
|
||||
@@ -258,7 +258,7 @@ bool CISOFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached)
|
||||
z.zfree = Z_NULL;
|
||||
z.opaque = Z_NULL;
|
||||
if (inflateInit2(&z, -15) != Z_OK) {
|
||||
ERROR_LOG(LOADER, "GetBlockSize() ERROR: %s\n", (z.msg) ? z.msg : "?");
|
||||
ERROR_LOG(Log::Loader, "GetBlockSize() ERROR: %s\n", (z.msg) ? z.msg : "?");
|
||||
NotifyReadError();
|
||||
return false;
|
||||
}
|
||||
@@ -269,14 +269,14 @@ bool CISOFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached)
|
||||
|
||||
int status = inflate(&z, Z_FINISH);
|
||||
if (status != Z_STREAM_END) {
|
||||
ERROR_LOG(LOADER, "block %d: inflate : %s[%d]\n", blockNumber, (z.msg) ? z.msg : "error", status);
|
||||
ERROR_LOG(Log::Loader, "block %d: inflate : %s[%d]\n", blockNumber, (z.msg) ? z.msg : "error", status);
|
||||
NotifyReadError();
|
||||
inflateEnd(&z);
|
||||
memset(outPtr, 0, GetBlockSize());
|
||||
return false;
|
||||
}
|
||||
if (z.total_out != frameSize) {
|
||||
ERROR_LOG(LOADER, "block %d: block size error %d != %d\n", blockNumber, (u32)z.total_out, frameSize);
|
||||
ERROR_LOG(Log::Loader, "block %d: block size error %d != %d\n", blockNumber, (u32)z.total_out, frameSize);
|
||||
NotifyReadError();
|
||||
inflateEnd(&z);
|
||||
memset(outPtr, 0, GetBlockSize());
|
||||
@@ -314,7 +314,7 @@ bool CISOFileBlockDevice::ReadBlocks(u32 minBlock, int count, u8 *outPtr) {
|
||||
|
||||
z_stream z{};
|
||||
if (inflateInit2(&z, -15) != Z_OK) {
|
||||
ERROR_LOG(LOADER, "Unable to initialize inflate: %s\n", (z.msg) ? z.msg : "?");
|
||||
ERROR_LOG(Log::Loader, "Unable to initialize inflate: %s\n", (z.msg) ? z.msg : "?");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -358,11 +358,11 @@ bool CISOFileBlockDevice::ReadBlocks(u32 minBlock, int count, u8 *outPtr) {
|
||||
|
||||
int status = inflate(&z, Z_FINISH);
|
||||
if (status != Z_STREAM_END) {
|
||||
ERROR_LOG(LOADER, "Inflate frame %d: failed - %s[%d]\n", frame, (z.msg) ? z.msg : "error", status);
|
||||
ERROR_LOG(Log::Loader, "Inflate frame %d: failed - %s[%d]\n", frame, (z.msg) ? z.msg : "error", status);
|
||||
NotifyReadError();
|
||||
memset(outPtr, 0, frameBlocks * GetBlockSize());
|
||||
} else if (z.total_out != frameSize) {
|
||||
ERROR_LOG(LOADER, "Inflate frame %d: block size error %d != %d\n", frame, (u32)z.total_out, frameSize);
|
||||
ERROR_LOG(Log::Loader, "Inflate frame %d: block size error %d != %d\n", frame, (u32)z.total_out, frameSize);
|
||||
NotifyReadError();
|
||||
memset(outPtr, 0, frameBlocks * GetBlockSize());
|
||||
} else if (frameBlocks != blocksPerFrame) {
|
||||
@@ -395,7 +395,7 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader)
|
||||
fileLoader_->ReadAt(0x24, 1, 4, &psarOffset);
|
||||
size_t readSize = fileLoader_->ReadAt(psarOffset, 1, 256, &np_header);
|
||||
if (readSize != 256){
|
||||
ERROR_LOG(LOADER, "Invalid NPUMDIMG header!");
|
||||
ERROR_LOG(Log::Loader, "Invalid NPUMDIMG header!");
|
||||
}
|
||||
|
||||
kirk_init();
|
||||
@@ -428,7 +428,7 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader)
|
||||
|
||||
readSize = fileLoader_->ReadAt(psarOffset + tableOffset, 1, tableSize, table);
|
||||
if(readSize!=tableSize){
|
||||
ERROR_LOG(LOADER, "Invalid NPUMDIMG table!");
|
||||
ERROR_LOG(Log::Loader, "Invalid NPUMDIMG table!");
|
||||
}
|
||||
|
||||
u32 *p = (u32*)table;
|
||||
@@ -510,7 +510,7 @@ bool NPDRMDemoBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached)
|
||||
if(table[block].size<blockSize){
|
||||
lzsize = lzrc_decompress(blockBuf, 0x00100000, readBuf, table[block].size);
|
||||
if(lzsize!=blockSize){
|
||||
ERROR_LOG(LOADER, "LZRC decompress error! lzsize=%d\n", lzsize);
|
||||
ERROR_LOG(Log::Loader, "LZRC decompress error! lzsize=%d\n", lzsize);
|
||||
NotifyReadError();
|
||||
return false;
|
||||
}
|
||||
@@ -593,7 +593,7 @@ CHDFileBlockDevice::CHDFileBlockDevice(FileLoader *fileLoader)
|
||||
|
||||
chd_error err = chd_read_header(paths[0].c_str(), &childHeader);
|
||||
if (err != CHDERR_NONE) {
|
||||
ERROR_LOG(LOADER, "Error loading CHD header for '%s': %s", paths[0].c_str(), chd_error_string(err));
|
||||
ERROR_LOG(Log::Loader, "Error loading CHD header for '%s': %s", paths[0].c_str(), chd_error_string(err));
|
||||
NotifyReadError();
|
||||
return;
|
||||
}
|
||||
@@ -616,7 +616,7 @@ CHDFileBlockDevice::CHDFileBlockDevice(FileLoader *fileLoader)
|
||||
|
||||
if (chd_read_header(filepath.c_str(), &parentHeader) == CHDERR_NONE &&
|
||||
memcmp(parentHeader.sha1, childHeader.parentsha1, sizeof(parentHeader.sha1)) == 0) {
|
||||
// ERROR_LOG(LOADER, "Checking '%s'", filepath.c_str());
|
||||
// ERROR_LOG(Log::Loader, "Checking '%s'", filepath.c_str());
|
||||
paths[++depth] = filepath;
|
||||
break;
|
||||
}
|
||||
@@ -624,7 +624,7 @@ CHDFileBlockDevice::CHDFileBlockDevice(FileLoader *fileLoader)
|
||||
|
||||
// Check if parentHeader was opened
|
||||
if (parentHeader.length == 0) {
|
||||
ERROR_LOG(LOADER, "Error loading CHD '%s': parents not found", fileLoader->GetPath().c_str());
|
||||
ERROR_LOG(Log::Loader, "Error loading CHD '%s': parents not found", fileLoader->GetPath().c_str());
|
||||
NotifyReadError();
|
||||
return;
|
||||
}
|
||||
@@ -636,7 +636,7 @@ CHDFileBlockDevice::CHDFileBlockDevice(FileLoader *fileLoader)
|
||||
chd_file *file = nullptr;
|
||||
chd_error err = chd_open_core_file(&core_file_->core, CHD_OPEN_READ, NULL, &file);
|
||||
if (err != CHDERR_NONE) {
|
||||
ERROR_LOG(LOADER, "Error loading CHD '%s': %s", paths[depth].c_str(), chd_error_string(err));
|
||||
ERROR_LOG(Log::Loader, "Error loading CHD '%s': %s", paths[depth].c_str(), chd_error_string(err));
|
||||
NotifyReadError();
|
||||
return;
|
||||
}
|
||||
@@ -661,7 +661,7 @@ CHDFileBlockDevice::~CHDFileBlockDevice()
|
||||
bool CHDFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached)
|
||||
{
|
||||
if (!impl_->chd) {
|
||||
ERROR_LOG(LOADER, "ReadBlock: CHD not open. %s", fileLoader_->GetPath().c_str());
|
||||
ERROR_LOG(Log::Loader, "ReadBlock: CHD not open. %s", fileLoader_->GetPath().c_str());
|
||||
return false;
|
||||
}
|
||||
if ((u32)blockNumber >= numBlocks) {
|
||||
@@ -674,7 +674,7 @@ bool CHDFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached)
|
||||
if (currentHunk != hunk) {
|
||||
chd_error err = chd_read(impl_->chd, hunk, readBuffer);
|
||||
if (err != CHDERR_NONE) {
|
||||
ERROR_LOG(LOADER, "CHD read failed: %d %d %s", blockNumber, hunk, chd_error_string(err));
|
||||
ERROR_LOG(Log::Loader, "CHD read failed: %d %d %s", blockNumber, hunk, chd_error_string(err));
|
||||
NotifyReadError();
|
||||
}
|
||||
currentHunk = hunk;
|
||||
|
||||
Reference in new issue
Block a user