mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 17:23:40 +01: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:
1 parent
45516783f6
commit
913121cf2b
18 files changed
+80
-86
No files matched your search
@@ -62,7 +62,7 @@ namespace
|
||||
bool ReadPSPFile(std::string filename, u8 **data, s64 dataSize, s64 *readSize)
|
||||
{
|
||||
u32 handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ);
|
||||
if (handle == 0)
|
||||
if (handle < 0)
|
||||
return false;
|
||||
|
||||
if(dataSize == -1)
|
||||
@@ -82,7 +82,7 @@ namespace
|
||||
bool WritePSPFile(std::string filename, u8 *data, SceSize dataSize)
|
||||
{
|
||||
u32 handle = pspFileSystem.OpenFile(filename, (FileAccess)(FILEACCESS_WRITE | FILEACCESS_CREATE | FILEACCESS_TRUNCATE));
|
||||
if (handle == 0)
|
||||
if (handle < 0)
|
||||
return false;
|
||||
|
||||
size_t result = pspFileSystem.WriteFile(handle, data, dataSize);
|
||||
@@ -209,7 +209,7 @@ void SavedataParam::Init()
|
||||
// Create a nomedia file to hide save icons form Android image viewer
|
||||
#ifdef __ANDROID__
|
||||
int handle = pspFileSystem.OpenFile(savePath + ".nomedia", (FileAccess)(FILEACCESS_CREATE | FILEACCESS_WRITE), 0);
|
||||
if (handle) {
|
||||
if (handle >= 0) {
|
||||
pspFileSystem.CloseFile(handle);
|
||||
} else {
|
||||
ELOG("Failed to create .nomedia file");
|
||||
|
||||
Reference in new issue
Block a user