mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Reduce logspam from fonts, and a less angry error message for missing textures.zip.
This commit is contained in:
parent
8484dd4917
commit
66d2fb2aa4
@ -561,7 +561,7 @@ int DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const
|
||||
OpenFileEntry entry;
|
||||
entry.hFile.fileSystemFlags_ = flags;
|
||||
u32 err = 0;
|
||||
bool success = entry.hFile.Open(basePath, filename, access, err);
|
||||
bool success = entry.hFile.Open(basePath, filename, (FileAccess)(access & FILEACCESS_PSP_FLAGS), err);
|
||||
if (err == 0 && !success) {
|
||||
err = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
}
|
||||
@ -577,7 +577,9 @@ int DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const
|
||||
#else
|
||||
logError = (int)errno;
|
||||
#endif
|
||||
ERROR_LOG(FILESYS, "DirectoryFileSystem::OpenFile('%s'): FAILED, %d - access = %d '%s'", filename.c_str(), logError, (int)access, errorString.c_str());
|
||||
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());
|
||||
}
|
||||
return err;
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
@ -589,7 +591,7 @@ int DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const
|
||||
u32 newHandle = hAlloc->GetNewHandle();
|
||||
|
||||
entry.guestFilename = filename;
|
||||
entry.access = access;
|
||||
entry.access = (FileAccess)(access & FILEACCESS_PSP_FLAGS);
|
||||
|
||||
entries[newHandle] = entry;
|
||||
|
||||
|
@ -34,6 +34,11 @@ enum FileAccess {
|
||||
FILEACCESS_CREATE = 8,
|
||||
FILEACCESS_TRUNCATE = 16,
|
||||
FILEACCESS_EXCL = 32,
|
||||
|
||||
FILEACCESS_PSP_FLAGS = 63, // Sum of all the above.
|
||||
|
||||
// Non-PSP flags
|
||||
FILEACCESS_PPSSPP_QUIET = 128,
|
||||
};
|
||||
|
||||
enum FileMove {
|
||||
|
@ -581,8 +581,12 @@ size_t MetaFileSystem::SeekFile(u32 handle, s32 position, FileMove type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MetaFileSystem::ReadEntireFile(const std::string &filename, std::vector<u8> &data) {
|
||||
int handle = OpenFile(filename, FILEACCESS_READ);
|
||||
int MetaFileSystem::ReadEntireFile(const std::string &filename, std::vector<u8> &data, bool quiet) {
|
||||
FileAccess access = FILEACCESS_READ;
|
||||
if (quiet) {
|
||||
access = (FileAccess)(access | FILEACCESS_PPSSPP_QUIET);
|
||||
}
|
||||
int handle = OpenFile(filename, access);
|
||||
if (handle < 0)
|
||||
return handle;
|
||||
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
u64 FreeSpace(const std::string &path) override;
|
||||
|
||||
// Convenience helper - returns < 0 on failure.
|
||||
int ReadEntireFile(const std::string &filename, std::vector<u8> &data);
|
||||
int ReadEntireFile(const std::string &filename, std::vector<u8> &data, bool quiet = false);
|
||||
|
||||
void SetStartingDirectory(const std::string &dir) {
|
||||
std::lock_guard<std::recursive_mutex> guard(lock);
|
||||
|
@ -340,7 +340,7 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con
|
||||
return newHandle;
|
||||
}
|
||||
|
||||
if (filename.compare(0,8,"/sce_lbn") == 0)
|
||||
if (filename.compare(0, 8, "/sce_lbn") == 0)
|
||||
{
|
||||
u32 sectorStart = 0xFFFFFFFF, readSize = 0xFFFFFFFF;
|
||||
parseLBN(filename, §orStart, &readSize);
|
||||
@ -365,11 +365,13 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con
|
||||
bool success = entry.Open(basePath, fileList[entry.fileIndex].fileName, FILEACCESS_READ);
|
||||
|
||||
if (!success) {
|
||||
if (!(access & FILEACCESS_PPSSPP_QUIET)) {
|
||||
#ifdef _WIN32
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, %i", (int)GetLastError());
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, %i", (int)GetLastError());
|
||||
#else
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED");
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED");
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -388,15 +390,16 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con
|
||||
if (entry.fileIndex != (u32)-1 && fileList[entry.fileIndex].handler != NULL) {
|
||||
entry.handler = fileList[entry.fileIndex].handler;
|
||||
}
|
||||
bool success = entry.Open(basePath, filename, access);
|
||||
bool success = entry.Open(basePath, filename, (FileAccess)(access & FILEACCESS_PSP_FLAGS));
|
||||
|
||||
if (!success) {
|
||||
if (!(access & FILEACCESS_PPSSPP_QUIET)) {
|
||||
#ifdef _WIN32
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, %i - access = %i", (int)GetLastError(), (int)access);
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, %i - access = %i", (int)GetLastError(), (int)access);
|
||||
#else
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, access = %i", (int)access);
|
||||
ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, access = %i", (int)access);
|
||||
#endif
|
||||
//wwwwaaaaahh!!
|
||||
}
|
||||
return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
} else {
|
||||
u32 newHandle = hAlloc->GetNewHandle();
|
||||
|
@ -891,12 +891,12 @@ static void __LoadInternalFonts() {
|
||||
bool bufferRead = false;
|
||||
|
||||
std::string fontFilename = gameFontPath + entry.fileName;
|
||||
bufferRead = pspFileSystem.ReadEntireFile(fontFilename, buffer) >= 0;
|
||||
bufferRead = pspFileSystem.ReadEntireFile(fontFilename, buffer, true) >= 0;
|
||||
|
||||
if (!bufferRead) {
|
||||
// No game font, let's try override path.
|
||||
fontFilename = fontOverridePath + entry.fileName;
|
||||
bufferRead = pspFileSystem.ReadEntireFile(fontFilename, buffer) >= 0;
|
||||
bufferRead = pspFileSystem.ReadEntireFile(fontFilename, buffer, true) >= 0;
|
||||
}
|
||||
|
||||
if (!bufferRead) {
|
||||
|
Loading…
Reference in New Issue
Block a user