mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-08 07:51:19 +12:00
coreinit: Implement several FSA functions and fix some bugs (#844)
This commit is contained in:
parent
ae4cb45cf3
commit
f1ebfa9941
10 changed files with 1032 additions and 121 deletions
|
@ -302,6 +302,15 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool fscRewindDir() override
|
||||
{
|
||||
if (!dirIterator)
|
||||
return true;
|
||||
|
||||
dirIterator->index = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void addUniqueDirEntry(const FSCDirEntry& dirEntry)
|
||||
{
|
||||
// skip if already in list
|
||||
|
@ -378,6 +387,7 @@ FSCVirtualFile* fsc_open(const char* path, FSC_ACCESS_FLAG accessFlags, sint32*
|
|||
{
|
||||
// return first found file
|
||||
cemu_assert_debug(HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::OPEN_FILE));
|
||||
fscVirtualFile->m_isAppend = HAS_FLAG(accessFlags, FSC_ACCESS_FLAG::IS_APPEND);
|
||||
fscLeave();
|
||||
return fscVirtualFile;
|
||||
}
|
||||
|
@ -598,6 +608,9 @@ uint32 fsc_writeFile(FSCVirtualFile* fscFile, void* buffer, uint32 size)
|
|||
fscLeave();
|
||||
return 0;
|
||||
}
|
||||
if (fscFile->m_isAppend)
|
||||
fsc_setFileSeek(fscFile, fsc_getFileSize(fscFile));
|
||||
|
||||
uint32 fscStatus = fscFile->fscWriteData(buffer, size);
|
||||
fscLeave();
|
||||
return fscStatus;
|
||||
|
|
|
@ -24,7 +24,10 @@ enum class FSC_ACCESS_FLAG : uint8
|
|||
// which types can be opened
|
||||
// invalid operation if neither is set
|
||||
OPEN_DIR = (1 << 4),
|
||||
OPEN_FILE = (1 << 5)
|
||||
OPEN_FILE = (1 << 5),
|
||||
|
||||
// Writing seeks to the end of the file if set
|
||||
IS_APPEND = (1 << 6)
|
||||
};
|
||||
DEFINE_ENUM_FLAG_OPERATORS(FSC_ACCESS_FLAG);
|
||||
|
||||
|
@ -149,7 +152,15 @@ struct FSCVirtualFile
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual bool fscRewindDir()
|
||||
{
|
||||
cemu_assert_unimplemented();
|
||||
return false;
|
||||
}
|
||||
|
||||
FSCDirIteratorState* dirIterator{};
|
||||
|
||||
bool m_isAppend{ false };
|
||||
};
|
||||
|
||||
#define FSC_PRIORITY_BASE (0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue