mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-25 00:04:49 +02:00
Io: Consistently use error codes with OpenFile().
This gets rid of OpenWithError(), and just always returns a negative value on error for OpenFile(). Also fixed the sequence rollover, which could've returned 0. 0 should be considered a valid handle ideally, but left it never returning 0 to simplify cleanup in some areas.
This commit is contained in:
@@ -607,7 +607,7 @@ bool DirectoryFileSystem::RemoveFile(const std::string &filename) {
|
||||
return ReplayApplyDisk(ReplayAction::FILE_REMOVE, retValue, CoreTiming::GetGlobalTimeUs()) != 0;
|
||||
}
|
||||
|
||||
u32 DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {
|
||||
int DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {
|
||||
OpenFileEntry entry;
|
||||
u32 err = 0;
|
||||
bool success = entry.hFile.Open(basePath, filename, access, err);
|
||||
@@ -1044,10 +1044,10 @@ bool VFSFileSystem::RemoveFile(const std::string &filename) {
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {
|
||||
int VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {
|
||||
if (access != FILEACCESS_READ) {
|
||||
ERROR_LOG(FILESYS, "VFSFileSystem only supports plain reading");
|
||||
return 0;
|
||||
return SCE_KERNEL_ERROR_ERRNO_INVALID_FLAG;
|
||||
}
|
||||
|
||||
std::string fullName = GetLocalPath(filename);
|
||||
@@ -1058,7 +1058,7 @@ u32 VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char
|
||||
u8 *data = VFSReadFile(fullNameC, &size);
|
||||
if (!data) {
|
||||
ERROR_LOG(FILESYS, "VFSFileSystem failed to open %s", filename.c_str());
|
||||
return 0;
|
||||
return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
OpenFileEntry entry;
|
||||
|
||||
Reference in New Issue
Block a user