#pragma once #include #include #include #include #include typedef struct dirMagic { uint32_t handle; DIR *dir; bool in_use; char path[255]; OSMutex *mutex; } dirMagic_t; typedef struct fileMagic { uint32_t handle; bool in_use; int fd; OSMutex *mutex; } fileMagic_t; #define HANDLE_INDICATOR_MASK 0xFFFFFF00 #define HANDLE_MASK (0x000000FF) #define DIR_HANDLE_MAGIC 0x30000000 #define FILE_HANDLE_MAGIC 0x30000100 #define FILE_HANDLES_LENGTH 64 #define DIR_HANDLES_LENGTH 64 #define FS_STATUS_USE_REAL_OS (FSStatus) 0xFFFF0000 extern dirMagic_t dir_handles[DIR_HANDLES_LENGTH]; extern fileMagic_t file_handles[FILE_HANDLES_LENGTH]; FSStatus FSOpenDirWrapper(char *path, FSDirectoryHandle *handle, FSErrorFlag errorMask, std::function fallback_function, std::function result_handler); FSStatus FSReadDirWrapper(FSDirectoryHandle handle, FSDirectoryEntry *entry, FSErrorFlag errorMask, std::function result_handler); FSStatus FSCloseDirWrapper(FSDirectoryHandle handle, FSErrorFlag errorMask, std::function result_handler); FSStatus FSRewindDirWrapper(FSDirectoryHandle handle, FSErrorFlag errorMask, std::function result_handler); FSStatus FSMakeDirWrapper(char *path, FSErrorFlag errorMask, std::function fallback_function, std::function result_handler); FSStatus FSOpenFileWrapper(char *path, const char *mode, FSFileHandle *handle, FSErrorFlag errorMask, std::function fallback_function, std::function result_handler); FSStatus FSCloseFileWrapper(FSFileHandle handle, FSErrorFlag errorMask, std::function result_handler); FSStatus FSGetStatWrapper(char *path, FSStat *stats, FSErrorFlag errorMask, std::function fallback_function, std::function result_handler); FSStatus FSGetStatFileWrapper(FSFileHandle handle, FSStat *stats, FSErrorFlag errorMask, std::function result_handler); FSStatus FSReadFileWrapper(void *buffer, uint32_t size, uint32_t count, FSFileHandle handle, uint32_t unk1, FSErrorFlag errorMask, std::function result_handler); FSStatus FSReadFileWithPosWrapper(void *buffer, uint32_t size, uint32_t count, uint32_t pos, FSFileHandle handle, int32_t unk1, FSErrorFlag errorMask, std::function result_handler); FSStatus FSSetPosFileWrapper(FSFileHandle handle, uint32_t pos, FSErrorFlag errorMask, std::function result_handler); FSStatus FSGetPosFileWrapper(FSFileHandle handle, uint32_t *pos, FSErrorFlag errorMask, std::function result_handler); FSStatus FSIsEofWrapper(FSFileHandle handle, FSErrorFlag errorMask, std::function result_handler); FSStatus FSTruncateFileWrapper(FSFileHandle handle, FSErrorFlag errorMask, std::function result_handler); FSStatus FSWriteFileWrapper(uint8_t *buffer, uint32_t size, uint32_t count, FSFileHandle handle, uint32_t unk1, FSErrorFlag errorMask, std::function result_handler); FSStatus FSRemoveWrapper(char *path, FSErrorFlag errorMask, std::function fallback_function, std::function result_handler); FSStatus FSRenameWrapper(char *oldPath, char *newPath, FSErrorFlag errorMask, std::function fallback_function, std::function result_handler); FSStatus FSFlushFileWrapper(FSFileHandle handle, FSErrorFlag errorMask, std::function result_handler); int32_t getNewDirHandleIndex(); int32_t getNewFileHandleIndex(); bool isValidDirHandle(int32_t handle); bool isValidFileHandle(int32_t handle);