Some minor logging improvements that get to tag along the previous commit

This commit is contained in:
Henrik Rydgård 2020-08-22 00:32:51 +02:00
parent 506a86300d
commit 26ba65f385
3 changed files with 18 additions and 11 deletions

View File

@ -324,7 +324,7 @@ ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(const std::string &path, bo
return entry; return entry;
} else { } else {
if (catchError) if (catchError)
ERROR_LOG(FILESYS,"File %s not found", path.c_str()); ERROR_LOG(FILESYS, "File '%s' not found", path.c_str());
return 0; return 0;
} }
@ -337,7 +337,7 @@ int ISOFileSystem::OpenFile(std::string filename, FileAccess access, const char
entry.isBlockSectorMode = false; entry.isBlockSectorMode = false;
if (access & FILEACCESS_WRITE) { if (access & FILEACCESS_WRITE) {
ERROR_LOG(FILESYS, "Can't open file %s with write access on an ISO partition", filename.c_str()); ERROR_LOG(FILESYS, "Can't open file '%s' with write access on an ISO partition", filename.c_str());
return SCE_KERNEL_ERROR_ERRNO_INVALID_FLAG; return SCE_KERNEL_ERROR_ERRNO_INVALID_FLAG;
} }
@ -346,7 +346,7 @@ int ISOFileSystem::OpenFile(std::string filename, FileAccess access, const char
u32 sectorStart = 0xFFFFFFFF, readSize = 0xFFFFFFFF; u32 sectorStart = 0xFFFFFFFF, readSize = 0xFFFFFFFF;
parseLBN(filename, &sectorStart, &readSize); parseLBN(filename, &sectorStart, &readSize);
if (sectorStart > blockDevice->GetNumBlocks()) { 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(FILESYS, "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; return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
} }
else if (sectorStart == blockDevice->GetNumBlocks()) else if (sectorStart == blockDevice->GetNumBlocks())
@ -354,7 +354,7 @@ int ISOFileSystem::OpenFile(std::string filename, FileAccess access, const char
ERROR_LOG(FILESYS, "Should not be able to open the block after the last on disc! %08x", sectorStart); ERROR_LOG(FILESYS, "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(FILESYS, "Got a raw sector open: '%s', sector %08x, size %08x", filename.c_str(), sectorStart, readSize);
u32 newHandle = hAlloc->GetNewHandle(); u32 newHandle = hAlloc->GetNewHandle();
entry.seekPos = 0; entry.seekPos = 0;
entry.file = 0; entry.file = 0;
@ -363,16 +363,16 @@ int ISOFileSystem::OpenFile(std::string filename, FileAccess access, const char
entry.openSize = readSize; entry.openSize = readSize;
// when open as "umd1:/sce_lbn0x0_size0x6B49D200", that mean open umd1 as a block device. // when open as "umd1:/sce_lbn0x0_size0x6B49D200", that mean open umd1 as a block device.
// the param in sceIoLseek and sceIoRead is lba mode. we must mark it. // the param in sceIoLseek and sceIoRead is lba mode. we must mark it.
if (strncmp(devicename, "umd0:", 5)==0 || strncmp(devicename, "umd1:", 5)==0) if (strncmp(devicename, "umd0:", 5) == 0 || strncmp(devicename, "umd1:", 5) == 0)
entry.isBlockSectorMode = true; entry.isBlockSectorMode = true;
entries[newHandle] = entry; entries[newHandle] = entry;
return newHandle; return newHandle;
} }
// May return entireISO for "umd0:" // May return entireISO for "umd0:".
entry.file = GetFromPath(filename); entry.file = GetFromPath(filename, false);
if (!entry.file){ if (!entry.file) {
return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
} }
@ -524,7 +524,13 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) {
if ((s64)e.seekPos + size > fileSize) { if ((s64)e.seekPos + size > fileSize) {
// Clamp to the remaining size, but read what we can. // Clamp to the remaining size, but read what we can.
const s64 newSize = fileSize - (s64)e.seekPos; const s64 newSize = fileSize - (s64)e.seekPos;
WARN_LOG(FILESYS, "Reading beyond end of file, clamping size %lld to %lld", size, newSize); // 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");
} else {
INFO_LOG(FILESYS, "Reading beyond end of file from seekPos %d, clamping size %lld to %lld", e.seekPos, size, newSize);
}
size = newSize; size = newSize;
} }

View File

@ -25,7 +25,7 @@ u8 dummyOpenPSID[16] = { 0x10, 0x02, 0xA3, 0x44, 0x13, 0xF5, 0x93, 0xB0, 0xCC, 0
static int sceOpenPSIDGetOpenPSID(u32 OpenPSIDPtr) static int sceOpenPSIDGetOpenPSID(u32 OpenPSIDPtr)
{ {
ERROR_LOG(HLE, "UNTESTED sceOpenPSIDGetOpenPSID(%d)", OpenPSIDPtr); WARN_LOG(HLE, "UNTESTED sceOpenPSIDGetOpenPSID(%d)", OpenPSIDPtr);
getLocalMac((SceNetEtherAddr*)&dummyOpenPSID); getLocalMac((SceNetEtherAddr*)&dummyOpenPSID);
if (Memory::IsValidAddress(OpenPSIDPtr)) if (Memory::IsValidAddress(OpenPSIDPtr))
@ -40,7 +40,7 @@ static int sceOpenPSIDGetOpenPSID(u32 OpenPSIDPtr)
static int sceOpenPSID_driver_0x19D579F0(u32 OpenPSIDPtr,u32 unknown) static int sceOpenPSID_driver_0x19D579F0(u32 OpenPSIDPtr,u32 unknown)
{ {
ERROR_LOG(HLE, "UNTESTED sceOpenPSID_driver_0x19D579F0(%d,%d)", OpenPSIDPtr,unknown); WARN_LOG(HLE, "UNTESTED sceOpenPSID_driver_0x19D579F0(%d,%d)", OpenPSIDPtr,unknown);
getLocalMac((SceNetEtherAddr*)&dummyOpenPSID); getLocalMac((SceNetEtherAddr*)&dummyOpenPSID);
if (Memory::IsValidAddress(OpenPSIDPtr)) if (Memory::IsValidAddress(OpenPSIDPtr))

1
libretro/.gitignore vendored
View File

@ -2,3 +2,4 @@
*.so *.so
*.dll *.dll
*.dylib *.dylib
*.manifest