mirror of
https://github.com/izzy2lost/ppsspp.git
synced 2026-03-10 12:43:04 -07: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:
@@ -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;
|
||||
|
||||
@@ -123,7 +123,7 @@ bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, File
|
||||
|
||||
#if HOST_IS_CASE_SENSITIVE
|
||||
if (access & (FILEACCESS_APPEND | FILEACCESS_CREATE | FILEACCESS_WRITE)) {
|
||||
DEBUG_LOG(FILESYS, "Checking case for path %s", fileName.c_str());
|
||||
DEBUG_LOG(Log::FileSystem, "Checking case for path %s", fileName.c_str());
|
||||
if (!FixPathCase(basePath, fileName, FPC_PATH_MUST_EXIST)) {
|
||||
error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
return false; // or go on and attempt (for a better error code than just 0?)
|
||||
@@ -225,7 +225,7 @@ bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, File
|
||||
// Success
|
||||
return true;
|
||||
} else {
|
||||
ERROR_LOG(FILESYS, "File::OpenFD returned an error");
|
||||
ERROR_LOG(Log::FileSystem, "File::OpenFD returned an error");
|
||||
// TODO: Need better error codes from OpenFD so we can distinguish
|
||||
// disk full. Just set not found for now.
|
||||
error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
@@ -262,7 +262,7 @@ bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, File
|
||||
return false;
|
||||
}
|
||||
fullName = GetLocalPath(basePath, fileName);
|
||||
DEBUG_LOG(FILESYS, "Case may have been incorrect, second try opening %s (%s)", fullName.c_str(), fileName.c_str());
|
||||
DEBUG_LOG(Log::FileSystem, "Case may have been incorrect, second try opening %s (%s)", fullName.c_str(), fileName.c_str());
|
||||
|
||||
// And try again with the correct case this time
|
||||
#ifdef _WIN32
|
||||
@@ -361,7 +361,7 @@ size_t DirectoryFileHandle::Write(const u8* pointer, s64 size)
|
||||
MemoryStick_NotifyWrite();
|
||||
|
||||
if (diskFull) {
|
||||
ERROR_LOG(FILESYS, "Disk full");
|
||||
ERROR_LOG(Log::FileSystem, "Disk full");
|
||||
auto err = GetI18NCategory(I18NCat::ERRORS);
|
||||
g_OSD.Show(OSDType::MESSAGE_ERROR, err->T("Disk full while writing data"));
|
||||
// We only return an error when the disk is actually full.
|
||||
@@ -419,12 +419,12 @@ void DirectoryFileHandle::Close()
|
||||
#ifdef _WIN32
|
||||
Seek((s32)needsTrunc_, FILEMOVE_BEGIN);
|
||||
if (SetEndOfFile(hFile) == 0) {
|
||||
ERROR_LOG_REPORT(FILESYS, "Failed to truncate file.");
|
||||
ERROR_LOG_REPORT(Log::FileSystem, "Failed to truncate file.");
|
||||
}
|
||||
#elif !PPSSPP_PLATFORM(SWITCH)
|
||||
// Note: it's not great that Switch cannot truncate appropriately...
|
||||
if (ftruncate(hFile, (off_t)needsTrunc_) != 0) {
|
||||
ERROR_LOG_REPORT(FILESYS, "Failed to truncate file.");
|
||||
ERROR_LOG_REPORT(Log::FileSystem, "Failed to truncate file.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -439,7 +439,7 @@ void DirectoryFileHandle::Close()
|
||||
|
||||
void DirectoryFileSystem::CloseAll() {
|
||||
for (auto iter = entries.begin(); iter != entries.end(); ++iter) {
|
||||
INFO_LOG(FILESYS, "DirectoryFileSystem::CloseAll(): Force closing %d (%s)", (int)iter->first, iter->second.guestFilename.c_str());
|
||||
INFO_LOG(Log::FileSystem, "DirectoryFileSystem::CloseAll(): Force closing %d (%s)", (int)iter->first, iter->second.guestFilename.c_str());
|
||||
iter->second.hFile.Close();
|
||||
}
|
||||
entries.clear();
|
||||
@@ -577,7 +577,7 @@ int DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const
|
||||
logError = (int)errno;
|
||||
#endif
|
||||
if (!(access & FILEACCESS_PPSSPP_QUIET)) {
|
||||
ERROR_LOG(FILESYS, "DirectoryFileSystem::OpenFile('%s'): FAILED, %d - access = %d '%s'", filename.c_str(), logError, (int)(access & FILEACCESS_PSP_FLAGS), errorString.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "DirectoryFileSystem::OpenFile('%s'): FAILED, %d - access = %d '%s'", filename.c_str(), logError, (int)(access & FILEACCESS_PSP_FLAGS), errorString.c_str());
|
||||
}
|
||||
return err;
|
||||
} else {
|
||||
@@ -606,7 +606,7 @@ void DirectoryFileSystem::CloseFile(u32 handle) {
|
||||
entries.erase(iter);
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"Cannot close file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"Cannot close file that hasn't been opened: %08x", handle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -632,7 +632,7 @@ size_t DirectoryFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &use
|
||||
EntryMap::iterator iter = entries.find(handle);
|
||||
if (iter != entries.end()) {
|
||||
if (size < 0) {
|
||||
ERROR_LOG_REPORT(FILESYS, "Invalid read for %lld bytes from disk %s", size, iter->second.guestFilename.c_str());
|
||||
ERROR_LOG_REPORT(Log::FileSystem, "Invalid read for %lld bytes from disk %s", size, iter->second.guestFilename.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ size_t DirectoryFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &use
|
||||
return bytesRead;
|
||||
} else {
|
||||
// This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"Cannot read file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"Cannot read file that hasn't been opened: %08x", handle);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -657,7 +657,7 @@ size_t DirectoryFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size, i
|
||||
return bytesWritten;
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"Cannot write to file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"Cannot write to file that hasn't been opened: %08x", handle);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -668,7 +668,7 @@ size_t DirectoryFileSystem::SeekFile(u32 handle, s32 position, FileMove type) {
|
||||
return iter->second.hFile.Seek(position,type);
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"Cannot seek in file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"Cannot seek in file that hasn't been opened: %08x", handle);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -774,7 +774,7 @@ static std::string SimulateVFATBug(std::string filename) {
|
||||
}
|
||||
|
||||
if (apply_hack) {
|
||||
VERBOSE_LOG(FILESYS, "Applying VFAT hack to filename: %s", filename.c_str());
|
||||
VERBOSE_LOG(Log::FileSystem, "Applying VFAT hack to filename: %s", filename.c_str());
|
||||
// In this situation, NT would write UPPERCASE, and just set a flag to say "actually lowercase".
|
||||
// That VFAT flag isn't read by the PSP firmware, so let's pretend to "not read it."
|
||||
std::transform(filename.begin(), filename.end(), filename.begin(), toupper);
|
||||
@@ -920,13 +920,13 @@ void DirectoryFileSystem::DoState(PointerWrap &p) {
|
||||
u32 err;
|
||||
bool brokenFile = false;
|
||||
if (!entry.hFile.Open(basePath,entry.guestFilename,entry.access, err)) {
|
||||
ERROR_LOG(FILESYS, "Failed to reopen file while loading state: %s", entry.guestFilename.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "Failed to reopen file while loading state: %s", entry.guestFilename.c_str());
|
||||
brokenFile = true;
|
||||
}
|
||||
u32 position;
|
||||
Do(p, position);
|
||||
if (position != entry.hFile.Seek(position, FILEMOVE_BEGIN)) {
|
||||
ERROR_LOG(FILESYS, "Failed to restore seek position while loading state: %s", entry.guestFilename.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "Failed to restore seek position while loading state: %s", entry.guestFilename.c_str());
|
||||
brokenFile = true;
|
||||
}
|
||||
if (s >= 2) {
|
||||
@@ -990,18 +990,18 @@ bool VFSFileSystem::RemoveFile(const std::string &filename) {
|
||||
|
||||
int VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {
|
||||
if (access != FILEACCESS_READ) {
|
||||
ERROR_LOG(FILESYS, "VFSFileSystem only supports plain reading");
|
||||
ERROR_LOG(Log::FileSystem, "VFSFileSystem only supports plain reading");
|
||||
return SCE_KERNEL_ERROR_ERRNO_INVALID_FLAG;
|
||||
}
|
||||
|
||||
std::string fullName = GetLocalPath(filename);
|
||||
const char *fullNameC = fullName.c_str();
|
||||
VERBOSE_LOG(FILESYS, "VFSFileSystem actually opening %s (%s)", fullNameC, filename.c_str());
|
||||
VERBOSE_LOG(Log::FileSystem, "VFSFileSystem actually opening %s (%s)", fullNameC, filename.c_str());
|
||||
|
||||
size_t size;
|
||||
u8 *data = g_VFS.ReadFile(fullNameC, &size);
|
||||
if (!data) {
|
||||
ERROR_LOG(FILESYS, "VFSFileSystem failed to open %s", filename.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "VFSFileSystem failed to open %s", filename.c_str());
|
||||
return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -1040,7 +1040,7 @@ void VFSFileSystem::CloseFile(u32 handle) {
|
||||
entries.erase(iter);
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"Cannot close file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"Cannot close file that hasn't been opened: %08x", handle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1063,7 +1063,7 @@ size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) {
|
||||
}
|
||||
|
||||
size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
|
||||
DEBUG_LOG(FILESYS,"VFSFileSystem::ReadFile %08x %p %i", handle, pointer, (u32)size);
|
||||
DEBUG_LOG(Log::FileSystem,"VFSFileSystem::ReadFile %08x %p %i", handle, pointer, (u32)size);
|
||||
EntryMap::iterator iter = entries.find(handle);
|
||||
if (iter != entries.end())
|
||||
{
|
||||
@@ -1075,7 +1075,7 @@ size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
|
||||
iter->second.seekPos += size;
|
||||
return bytesRead;
|
||||
} else {
|
||||
ERROR_LOG(FILESYS,"Cannot read file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"Cannot read file that hasn't been opened: %08x", handle);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1101,7 +1101,7 @@ size_t VFSFileSystem::SeekFile(u32 handle, s32 position, FileMove type) {
|
||||
return iter->second.seekPos;
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"Cannot seek in file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"Cannot seek in file that hasn't been opened: %08x", handle);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1125,6 +1125,6 @@ void VFSFileSystem::DoState(PointerWrap &p) {
|
||||
|
||||
if (num != 0) {
|
||||
p.SetError(p.ERROR_WARNING);
|
||||
ERROR_LOG(FILESYS, "FIXME: Open files during savestate, could go badly.");
|
||||
ERROR_LOG(Log::FileSystem, "FIXME: Open files during savestate, could go badly.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, BlockDevice *_blockDevic
|
||||
treeroot->valid = false;
|
||||
|
||||
if (memcmp(desc.cd001, "CD001", 5)) {
|
||||
ERROR_LOG(FILESYS, "ISO looks bogus, expected CD001 signature not present? Giving up...");
|
||||
ERROR_LOG(Log::FileSystem, "ISO looks bogus, expected CD001 signature not present? Giving up...");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) {
|
||||
u8 theSector[2048];
|
||||
if (!blockDevice->ReadBlock(secnum, theSector)) {
|
||||
blockDevice->NotifyReadError();
|
||||
ERROR_LOG(FILESYS, "Error reading block for directory '%s' in sector %d - skipping", root->name.c_str(), secnum);
|
||||
ERROR_LOG(Log::FileSystem, "Error reading block for directory '%s' in sector %d - skipping", root->name.c_str(), secnum);
|
||||
root->valid = true; // Prevents re-reading
|
||||
return;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) {
|
||||
const int IDENTIFIER_OFFSET = 33;
|
||||
if (offset + IDENTIFIER_OFFSET + dir.identifierLength > 2048) {
|
||||
blockDevice->NotifyReadError();
|
||||
ERROR_LOG(FILESYS, "Directory entry crosses sectors, corrupt iso?");
|
||||
ERROR_LOG(Log::FileSystem, "Directory entry crosses sectors, corrupt iso?");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -236,18 +236,18 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) {
|
||||
entry->startsector = dir.firstDataSector;
|
||||
entry->dirsize = dir.dataLength;
|
||||
entry->valid = isFile; // Can pre-mark as valid if file, as we don't recurse into those.
|
||||
VERBOSE_LOG(FILESYS, "%s: %s %08x %08x %d", entry->isDirectory ? "D" : "F", entry->name.c_str(), (u32)dir.firstDataSector, entry->startingPosition, entry->startingPosition);
|
||||
VERBOSE_LOG(Log::FileSystem, "%s: %s %08x %08x %d", entry->isDirectory ? "D" : "F", entry->name.c_str(), (u32)dir.firstDataSector, entry->startingPosition, entry->startingPosition);
|
||||
|
||||
// Round down to avoid any false reports.
|
||||
if (isFile && dir.firstDataSector + (dir.dataLength / 2048) > blockDevice->GetNumBlocks()) {
|
||||
blockDevice->NotifyReadError();
|
||||
ERROR_LOG(FILESYS, "File '%s' starts or ends outside ISO. firstDataSector: %d len: %d", entry->BuildPath().c_str(), (int)dir.firstDataSector, (int)dir.dataLength);
|
||||
ERROR_LOG(Log::FileSystem, "File '%s' starts or ends outside ISO. firstDataSector: %d len: %d", entry->BuildPath().c_str(), (int)dir.firstDataSector, (int)dir.dataLength);
|
||||
}
|
||||
|
||||
if (entry->isDirectory && !relative) {
|
||||
if (entry->startsector == root->startsector) {
|
||||
blockDevice->NotifyReadError();
|
||||
ERROR_LOG(FILESYS, "WARNING: Appear to have a recursive file system, breaking recursion. Probably corrupt ISO.");
|
||||
ERROR_LOG(Log::FileSystem, "WARNING: Appear to have a recursive file system, breaking recursion. Probably corrupt ISO.");
|
||||
}
|
||||
}
|
||||
root->children.push_back(entry);
|
||||
@@ -313,7 +313,7 @@ ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(const std::string &path, bo
|
||||
return entry;
|
||||
} else {
|
||||
if (catchError)
|
||||
ERROR_LOG(FILESYS, "File '%s' not found", path.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "File '%s' not found", path.c_str());
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -326,7 +326,7 @@ int ISOFileSystem::OpenFile(std::string filename, FileAccess access, const char
|
||||
entry.isBlockSectorMode = false;
|
||||
|
||||
if (access & FILEACCESS_WRITE) {
|
||||
ERROR_LOG(FILESYS, "Can't open file '%s' with write access on an ISO partition", filename.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "Can't open file '%s' with write access on an ISO partition", filename.c_str());
|
||||
return SCE_KERNEL_ERROR_ERRNO_INVALID_FLAG;
|
||||
}
|
||||
|
||||
@@ -335,15 +335,15 @@ int ISOFileSystem::OpenFile(std::string filename, FileAccess access, const char
|
||||
u32 sectorStart = 0xFFFFFFFF, readSize = 0xFFFFFFFF;
|
||||
parseLBN(filename, §orStart, &readSize);
|
||||
if (sectorStart > blockDevice->GetNumBlocks()) {
|
||||
WARN_LOG(FILESYS, "Unable to open raw sector, out of range: '%s', sector %08x, max %08x", filename.c_str(), sectorStart, blockDevice->GetNumBlocks());
|
||||
WARN_LOG(Log::FileSystem, "Unable to open raw sector, out of range: '%s', sector %08x, max %08x", filename.c_str(), sectorStart, blockDevice->GetNumBlocks());
|
||||
return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
}
|
||||
else if (sectorStart == blockDevice->GetNumBlocks())
|
||||
{
|
||||
ERROR_LOG(FILESYS, "Should not be able to open the block after the last on disc! %08x", sectorStart);
|
||||
ERROR_LOG(Log::FileSystem, "Should not be able to open the block after the last on disc! %08x", sectorStart);
|
||||
}
|
||||
|
||||
DEBUG_LOG(FILESYS, "Got a raw sector open: '%s', sector %08x, size %08x", filename.c_str(), sectorStart, readSize);
|
||||
DEBUG_LOG(Log::FileSystem, "Got a raw sector open: '%s', sector %08x, size %08x", filename.c_str(), sectorStart, readSize);
|
||||
u32 newHandle = hAlloc->GetNewHandle();
|
||||
entry.seekPos = 0;
|
||||
entry.file = 0;
|
||||
@@ -383,7 +383,7 @@ void ISOFileSystem::CloseFile(u32 handle) {
|
||||
entries.erase(iter);
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS, "Hey, what are you doing? Closing non-open files?");
|
||||
ERROR_LOG(Log::FileSystem, "Hey, what are you doing? Closing non-open files?");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ bool ISOFileSystem::OwnsHandle(u32 handle) {
|
||||
int ISOFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) {
|
||||
EntryMap::iterator iter = entries.find(handle);
|
||||
if (iter == entries.end()) {
|
||||
ERROR_LOG(FILESYS, "Ioctl on a bad file handle");
|
||||
ERROR_LOG(Log::FileSystem, "Ioctl on a bad file handle");
|
||||
return SCE_KERNEL_ERROR_BADF;
|
||||
}
|
||||
|
||||
@@ -405,23 +405,23 @@ int ISOFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outd
|
||||
// Get ISO9660 volume descriptor (from open ISO9660 file.)
|
||||
case 0x01020001:
|
||||
if (e.isBlockSectorMode) {
|
||||
ERROR_LOG(FILESYS, "Unsupported read volume descriptor command on a umd block device");
|
||||
ERROR_LOG(Log::FileSystem, "Unsupported read volume descriptor command on a umd block device");
|
||||
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (!Memory::IsValidRange(outdataPtr, 0x800) || outlen < 0x800) {
|
||||
WARN_LOG_REPORT(FILESYS, "sceIoIoctl: Invalid out pointer %08x while reading ISO9660 volume descriptor", outdataPtr);
|
||||
WARN_LOG_REPORT(Log::FileSystem, "sceIoIoctl: Invalid out pointer %08x while reading ISO9660 volume descriptor", outdataPtr);
|
||||
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
INFO_LOG(SCEIO, "sceIoIoctl: reading ISO9660 volume descriptor read");
|
||||
INFO_LOG(Log::sceIo, "sceIoIoctl: reading ISO9660 volume descriptor read");
|
||||
blockDevice->ReadBlock(16, Memory::GetPointerWriteUnchecked(outdataPtr));
|
||||
return 0;
|
||||
|
||||
// Get ISO9660 path table (from open ISO9660 file.)
|
||||
case 0x01020002:
|
||||
if (e.isBlockSectorMode) {
|
||||
ERROR_LOG(FILESYS, "Unsupported read path table command on a umd block device");
|
||||
ERROR_LOG(Log::FileSystem, "Unsupported read path table command on a umd block device");
|
||||
return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
|
||||
OpenFileEntry &e = iter->second;
|
||||
|
||||
if (size < 0) {
|
||||
ERROR_LOG_REPORT(FILESYS, "Invalid read for %lld bytes from umd %s", size, e.file ? e.file->name.c_str() : "device");
|
||||
ERROR_LOG_REPORT(Log::FileSystem, "Invalid read for %lld bytes from umd %s", size, e.file ? e.file->name.c_str() : "device");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
|
||||
positionOnIso = e.sectorStart * 2048ULL + e.seekPos;
|
||||
fileSize = (s64)e.openSize;
|
||||
} else if (e.file == nullptr) {
|
||||
ERROR_LOG(FILESYS, "File no longer exists (loaded savestate with different ISO?)");
|
||||
ERROR_LOG(Log::FileSystem, "File no longer exists (loaded savestate with different ISO?)");
|
||||
return 0;
|
||||
} else {
|
||||
positionOnIso = e.file->startingPosition + e.seekPos;
|
||||
@@ -509,7 +509,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
|
||||
}
|
||||
|
||||
if ((s64)e.seekPos > fileSize) {
|
||||
WARN_LOG(FILESYS, "Read starting outside of file, at %lld / %lld", (s64)e.seekPos, fileSize);
|
||||
WARN_LOG(Log::FileSystem, "Read starting outside of file, at %lld / %lld", (s64)e.seekPos, fileSize);
|
||||
return 0;
|
||||
}
|
||||
if ((s64)e.seekPos + size > fileSize) {
|
||||
@@ -518,9 +518,9 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
|
||||
// Reading beyond the file is really quite normal behavior (if return value handled correctly), so
|
||||
// not doing WARN here. Still, can potentially be useful to see so leaving at INFO.
|
||||
if (newSize == 0) {
|
||||
INFO_LOG(FILESYS, "Attempted read at end of file, 0-size read simulated");
|
||||
INFO_LOG(Log::FileSystem, "Attempted read at end of file, 0-size read simulated");
|
||||
} else {
|
||||
INFO_LOG(FILESYS, "Reading beyond end of file from seekPos %d, clamping size %lld to %lld", e.seekPos, size, newSize);
|
||||
INFO_LOG(Log::FileSystem, "Reading beyond end of file from seekPos %d, clamping size %lld to %lld", e.seekPos, size, newSize);
|
||||
}
|
||||
size = newSize;
|
||||
}
|
||||
@@ -534,7 +534,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
|
||||
u8 theSector[2048];
|
||||
|
||||
if ((middleSize & 2047) != 0) {
|
||||
ERROR_LOG(FILESYS, "Remaining size should be aligned");
|
||||
ERROR_LOG(Log::FileSystem, "Remaining size should be aligned");
|
||||
}
|
||||
|
||||
const u8 *const start = pointer;
|
||||
@@ -565,18 +565,18 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
|
||||
return (size_t)totalBytes;
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS, "Hey, what are you doing? Reading non-open files?");
|
||||
ERROR_LOG(Log::FileSystem, "Hey, what are you doing? Reading non-open files?");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
size_t ISOFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size) {
|
||||
ERROR_LOG(FILESYS, "Hey, what are you doing? You can't write to an ISO!");
|
||||
ERROR_LOG(Log::FileSystem, "Hey, what are you doing? You can't write to an ISO!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t ISOFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size, int &usec) {
|
||||
ERROR_LOG(FILESYS, "Hey, what are you doing? You can't write to an ISO!");
|
||||
ERROR_LOG(Log::FileSystem, "Hey, what are you doing? You can't write to an ISO!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ size_t ISOFileSystem::SeekFile(u32 handle, s32 position, FileMove type) {
|
||||
return (size_t)e.seekPos;
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS, "Hey, what are you doing? Seeking in non-open files?");
|
||||
ERROR_LOG(Log::FileSystem, "Hey, what are you doing? Seeking in non-open files?");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ static bool ApplyPathStringToComponentsVector(std::vector<std::string> &vector,
|
||||
else
|
||||
{
|
||||
// The PSP silently ignores attempts to .. to parent of root directory
|
||||
WARN_LOG(FILESYS, "RealPath: ignoring .. beyond root - root directory is its own parent: \"%s\"", pathString.c_str());
|
||||
WARN_LOG(Log::FileSystem, "RealPath: ignoring .. beyond root - root directory is its own parent: \"%s\"", pathString.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -102,26 +102,26 @@ static bool RealPath(const std::string ¤tDirectory, const std::string &inP
|
||||
size_t curDirLen = currentDirectory.length();
|
||||
if (curDirLen == 0)
|
||||
{
|
||||
ERROR_LOG(FILESYS, "RealPath: inPath \"%s\" is relative, but current directory is empty", inPath.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "RealPath: inPath \"%s\" is relative, but current directory is empty", inPath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t curDirColon = currentDirectory.find(':');
|
||||
if (curDirColon == std::string::npos)
|
||||
{
|
||||
ERROR_LOG(FILESYS, "RealPath: inPath \"%s\" is relative, but current directory \"%s\" has no prefix", inPath.c_str(), currentDirectory.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "RealPath: inPath \"%s\" is relative, but current directory \"%s\" has no prefix", inPath.c_str(), currentDirectory.c_str());
|
||||
return false;
|
||||
}
|
||||
if (curDirColon + 1 == curDirLen)
|
||||
{
|
||||
WARN_LOG(FILESYS, "RealPath: inPath \"%s\" is relative, but current directory \"%s\" is all prefix and no path. Using \"/\" as path for current directory.", inPath.c_str(), currentDirectory.c_str());
|
||||
WARN_LOG(Log::FileSystem, "RealPath: inPath \"%s\" is relative, but current directory \"%s\" is all prefix and no path. Using \"/\" as path for current directory.", inPath.c_str(), currentDirectory.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::string curDirAfter = currentDirectory.substr(curDirColon + 1);
|
||||
if (! ApplyPathStringToComponentsVector(cmpnts, curDirAfter) )
|
||||
{
|
||||
ERROR_LOG(FILESYS,"RealPath: currentDirectory is not a valid path: \"%s\"", currentDirectory.c_str());
|
||||
ERROR_LOG(Log::FileSystem,"RealPath: currentDirectory is not a valid path: \"%s\"", currentDirectory.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ static bool RealPath(const std::string ¤tDirectory, const std::string &inP
|
||||
|
||||
if (! ApplyPathStringToComponentsVector(cmpnts, inAfterColon) )
|
||||
{
|
||||
WARN_LOG(FILESYS, "RealPath: inPath is not a valid path: \"%s\"", inPath.c_str());
|
||||
WARN_LOG(Log::FileSystem, "RealPath: inPath is not a valid path: \"%s\"", inPath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath
|
||||
// Special handling: host0:command.txt (as seen in Super Monkey Ball Adventures, for example)
|
||||
// appears to mean the current directory on the UMD. Let's just assume the current directory.
|
||||
if (strncasecmp(inpath.c_str(), "host0:", strlen("host0:")) == 0) {
|
||||
INFO_LOG(FILESYS, "Host0 path detected, stripping: %s", inpath.c_str());
|
||||
INFO_LOG(Log::FileSystem, "Host0 path detected, stripping: %s", inpath.c_str());
|
||||
// However, this causes trouble when running tests, since our test framework uses host0:.
|
||||
// Maybe it's really just supposed to map to umd0 or something?
|
||||
if (PSP_CoreParameter().headLess) {
|
||||
@@ -220,7 +220,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath
|
||||
if (inpath.find(':') == std::string::npos /* means path is relative */)
|
||||
{
|
||||
error = SCE_KERNEL_ERROR_NOCWD;
|
||||
WARN_LOG(FILESYS, "Path is relative, but current directory not set for thread %i. returning 8002032C(SCE_KERNEL_ERROR_NOCWD) instead.", currentThread);
|
||||
WARN_LOG(Log::FileSystem, "Path is relative, but current directory not set for thread %i. returning 8002032C(SCE_KERNEL_ERROR_NOCWD) instead.", currentThread);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -243,7 +243,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath
|
||||
outpath = realpath.substr(prefixPos + 1);
|
||||
*system = &(fileSystems[i]);
|
||||
|
||||
VERBOSE_LOG(FILESYS, "MapFilePath: mapped \"%s\" to prefix: \"%s\", path: \"%s\"", inpath.c_str(), fileSystems[i].prefix.c_str(), outpath.c_str());
|
||||
VERBOSE_LOG(Log::FileSystem, "MapFilePath: mapped \"%s\" to prefix: \"%s\", path: \"%s\"", inpath.c_str(), fileSystems[i].prefix.c_str(), outpath.c_str());
|
||||
|
||||
return error == SCE_KERNEL_ERROR_NOCWD ? error : 0;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath
|
||||
error = SCE_KERNEL_ERROR_NODEV;
|
||||
}
|
||||
|
||||
DEBUG_LOG(FILESYS, "MapFilePath: failed mapping \"%s\", returning false", inpath.c_str());
|
||||
DEBUG_LOG(Log::FileSystem, "MapFilePath: failed mapping \"%s\", returning false", inpath.c_str());
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -414,13 +414,13 @@ int MetaFileSystem::ChDir(const std::string &dir)
|
||||
if (strncasecmp(prefix.c_str(), dir.c_str(), prefix.size()) == 0)
|
||||
{
|
||||
// The PSP is completely happy with invalid current dirs as long as they have a valid device.
|
||||
WARN_LOG(FILESYS, "ChDir failed to map path \"%s\", saving as current directory anyway", dir.c_str());
|
||||
WARN_LOG(Log::FileSystem, "ChDir failed to map path \"%s\", saving as current directory anyway", dir.c_str());
|
||||
currentDir[curThread] = dir;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
WARN_LOG_REPORT(FILESYS, "ChDir failed to map device for \"%s\", failing", dir.c_str());
|
||||
WARN_LOG_REPORT(Log::FileSystem, "ChDir failed to map device for \"%s\", failing", dir.c_str());
|
||||
return SCE_KERNEL_ERROR_NODEV;
|
||||
}
|
||||
}
|
||||
@@ -637,7 +637,7 @@ void MetaFileSystem::DoState(PointerWrap &p)
|
||||
skipPfat0 = true;
|
||||
} else {
|
||||
p.SetError(p.ERROR_FAILURE);
|
||||
ERROR_LOG(FILESYS, "Savestate failure: number of filesystems doesn't match.");
|
||||
ERROR_LOG(Log::FileSystem, "Savestate failure: number of filesystems doesn't match.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ void VirtualDiscFileSystem::LoadFileListIndex() {
|
||||
// Syntax: HEXPOS filename or HEXPOS filename:handler
|
||||
size_t filename_pos = line.find(' ');
|
||||
if (filename_pos == line.npos) {
|
||||
ERROR_LOG(FILESYS, "Unexpected line in %s: %s", INDEX_FILENAME.c_str(), line.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "Unexpected line in %s: %s", INDEX_FILENAME.c_str(), line.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ void VirtualDiscFileSystem::LoadFileListIndex() {
|
||||
entry.totalSize = (u32)temp.Seek(0, FILEMOVE_END);
|
||||
temp.Close();
|
||||
} else {
|
||||
ERROR_LOG(FILESYS, "Unable to open virtual file: %s", entry.fileName.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "Unable to open virtual file: %s", entry.fileName.c_str());
|
||||
}
|
||||
} else {
|
||||
entry.totalSize = File::GetFileSize(GetLocalPath(entry.fileName));
|
||||
@@ -207,7 +207,7 @@ void VirtualDiscFileSystem::DoState(PointerWrap &p)
|
||||
|
||||
bool success = of.Open(basePath, fileList[of.fileIndex].fileName, FILEACCESS_READ);
|
||||
if (!success) {
|
||||
ERROR_LOG(FILESYS, "Failed to create file handle for %s.", fileList[of.fileIndex].fileName.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "Failed to create file handle for %s.", fileList[of.fileIndex].fileName.c_str());
|
||||
} else {
|
||||
if (of.type == VFILETYPE_LBN) {
|
||||
of.Seek(of.curOffset + of.startOffset, FILEMOVE_BEGIN);
|
||||
@@ -352,7 +352,7 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con
|
||||
int fileIndex = getFileListIndex(sectorStart,readSize);
|
||||
if (fileIndex == -1)
|
||||
{
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem: sce_lbn used without calling fileinfo.");
|
||||
ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem: sce_lbn used without calling fileinfo.");
|
||||
return 0;
|
||||
}
|
||||
entry.fileIndex = (u32)fileIndex;
|
||||
@@ -368,9 +368,9 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con
|
||||
if (!success) {
|
||||
if (!(access & FILEACCESS_PPSSPP_QUIET)) {
|
||||
#ifdef _WIN32
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, %i", (int)GetLastError());
|
||||
ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem::OpenFile: FAILED, %i", (int)GetLastError());
|
||||
#else
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED");
|
||||
ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem::OpenFile: FAILED");
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
@@ -396,9 +396,9 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con
|
||||
if (!success) {
|
||||
if (!(access & FILEACCESS_PPSSPP_QUIET)) {
|
||||
#ifdef _WIN32
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, %i - access = %i", (int)GetLastError(), (int)access);
|
||||
ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem::OpenFile: FAILED, %i - access = %i", (int)GetLastError(), (int)access);
|
||||
#else
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, access = %i", (int)access);
|
||||
ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem::OpenFile: FAILED, access = %i", (int)access);
|
||||
#endif
|
||||
}
|
||||
return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
@@ -448,7 +448,7 @@ size_t VirtualDiscFileSystem::SeekFile(u32 handle, s32 position, FileMove type)
|
||||
return 0;
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot seek in file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot seek in file that hasn't been opened: %08x", handle);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -462,7 +462,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u
|
||||
EntryMap::iterator iter = entries.find(handle);
|
||||
if (iter != entries.end()) {
|
||||
if (size < 0) {
|
||||
ERROR_LOG_REPORT(FILESYS, "Invalid read for %lld bytes from virtual umd", size);
|
||||
ERROR_LOG_REPORT(Log::FileSystem, "Invalid read for %lld bytes from virtual umd", size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u
|
||||
int fileIndex = getFileListIndex(iter->second.curOffset,size*2048,true);
|
||||
if (fileIndex == -1)
|
||||
{
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Reading from unknown address in %08x at %08llx", handle, iter->second.curOffset);
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Reading from unknown address in %08x at %08llx", handle, iter->second.curOffset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u
|
||||
|
||||
if (!success)
|
||||
{
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Error opening file %s", fileList[fileIndex].fileName.c_str());
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Error opening file %s", fileList[fileIndex].fileName.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u
|
||||
if (iter->second.type == VFILETYPE_LBN && iter->second.curOffset + size > iter->second.size) {
|
||||
// Clamp to the remaining size, but read what we can.
|
||||
const s64 newSize = iter->second.size - iter->second.curOffset;
|
||||
WARN_LOG(FILESYS, "VirtualDiscFileSystem: Reading beyond end of file, clamping size %lld to %lld", size, newSize);
|
||||
WARN_LOG(Log::FileSystem, "VirtualDiscFileSystem: Reading beyond end of file, clamping size %lld to %lld", size, newSize);
|
||||
size = newSize;
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u
|
||||
return bytesRead;
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot read file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot read file that hasn't been opened: %08x", handle);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -543,7 +543,7 @@ void VirtualDiscFileSystem::CloseFile(u32 handle) {
|
||||
entries.erase(iter);
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot close file that hasn't been opened: %08x", handle);
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot close file that hasn't been opened: %08x", handle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) {
|
||||
if (x.type != FILETYPE_DIRECTORY) {
|
||||
File::FileInfo details;
|
||||
if (!File::GetFileInfo(fullName, &details)) {
|
||||
ERROR_LOG(FILESYS, "DirectoryFileSystem::GetFileInfo: GetFileInfo failed: %s", fullName.c_str());
|
||||
ERROR_LOG(Log::FileSystem, "DirectoryFileSystem::GetFileInfo: GetFileInfo failed: %s", fullName.c_str());
|
||||
x.size = 0;
|
||||
x.access = 0;
|
||||
} else {
|
||||
@@ -735,7 +735,7 @@ std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(const std::string
|
||||
#endif
|
||||
|
||||
if (dp == NULL) {
|
||||
ERROR_LOG(FILESYS,"Error opening directory %s\n", path.c_str());
|
||||
ERROR_LOG(Log::FileSystem,"Error opening directory %s\n", path.c_str());
|
||||
if (exists)
|
||||
*exists = false;
|
||||
return myVector;
|
||||
@@ -779,37 +779,37 @@ std::vector<PSPFileInfo> VirtualDiscFileSystem::GetDirListing(const std::string
|
||||
|
||||
size_t VirtualDiscFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size)
|
||||
{
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot write to file on virtual disc");
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot write to file on virtual disc");
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t VirtualDiscFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size, int &usec)
|
||||
{
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot write to file on virtual disc");
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot write to file on virtual disc");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool VirtualDiscFileSystem::MkDir(const std::string &dirname)
|
||||
{
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot create directory on virtual disc");
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot create directory on virtual disc");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VirtualDiscFileSystem::RmDir(const std::string &dirname)
|
||||
{
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot remove directory on virtual disc");
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot remove directory on virtual disc");
|
||||
return false;
|
||||
}
|
||||
|
||||
int VirtualDiscFileSystem::RenameFile(const std::string &from, const std::string &to)
|
||||
{
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot rename file on virtual disc");
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot rename file on virtual disc");
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool VirtualDiscFileSystem::RemoveFile(const std::string &filename)
|
||||
{
|
||||
ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot remove file on virtual disc");
|
||||
ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot remove file on virtual disc");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -826,9 +826,9 @@ void VirtualDiscFileSystem::HandlerLogger(void *arg, HandlerHandle handle, LogLe
|
||||
}
|
||||
|
||||
if (filename != NULL) {
|
||||
GENERIC_LOG(LogType::FILESYS, level, "%s: %s", filename, msg);
|
||||
GENERIC_LOG(Log::FileSystem, level, "%s: %s", filename, msg);
|
||||
} else {
|
||||
GENERIC_LOG(LogType::FILESYS, level, "%s", msg);
|
||||
GENERIC_LOG(Log::FileSystem, level, "%s", msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -862,16 +862,16 @@ VirtualDiscFileSystem::Handler::Handler(const char *filename, VirtualDiscFileSys
|
||||
}
|
||||
|
||||
if (!Init || !Shutdown || !Open || !Seek || !Read || !Close) {
|
||||
ERROR_LOG(FILESYS, "Unable to find all handler functions: %s", filename);
|
||||
ERROR_LOG(Log::FileSystem, "Unable to find all handler functions: %s", filename);
|
||||
dlclose(library);
|
||||
library = NULL;
|
||||
} else if (!Init(&HandlerLogger, sys)) {
|
||||
ERROR_LOG(FILESYS, "Unable to initialize handler: %s", filename);
|
||||
ERROR_LOG(Log::FileSystem, "Unable to initialize handler: %s", filename);
|
||||
dlclose(library);
|
||||
library = NULL;
|
||||
}
|
||||
} else {
|
||||
ERROR_LOG(FILESYS, "Unable to load handler '%s': %s", filename, GetLastErrorMsg().c_str());
|
||||
ERROR_LOG(Log::FileSystem, "Unable to load handler '%s': %s", filename, GetLastErrorMsg().c_str());
|
||||
}
|
||||
#ifdef _WIN32
|
||||
#undef dlopen
|
||||
|
||||
Reference in New Issue
Block a user