mirror of
https://github.com/wiiu-env/RPXLoadingModule.git
synced 2024-11-22 09:59:17 +01:00
Formatting and cleanup
This commit is contained in:
parent
0797cb9b9a
commit
85838b1a42
@ -130,7 +130,8 @@ DECL_FUNCTION(int32_t, FSReadFile, FSClient *client, FSCmdBlock *block, void *bu
|
||||
return real_FSReadFile(client, block, buffer, size, count, handle, unk1, errorMask);
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, FSReadFileAsync, FSClient *client, FSCmdBlock *block, void *buffer, uint32_t size, uint32_t count, FSFileHandle handle, uint32_t unk1, FSErrorFlag errorMask, FSAsyncData *asyncData) {
|
||||
DECL_FUNCTION(int32_t, FSReadFileAsync, FSClient *client, FSCmdBlock *block, void *buffer, uint32_t size, uint32_t count, FSFileHandle handle, uint32_t unk1, FSErrorFlag errorMask,
|
||||
FSAsyncData *asyncData) {
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("");
|
||||
FSStatus result = FSReadFileWrapper(buffer, size, count, handle, unk1, errorMask, ASYNC_RESULT_HANDLER);
|
||||
if (result != FS_STATUS_USE_REAL_OS) {
|
||||
@ -152,7 +153,8 @@ DECL_FUNCTION(FSStatus, FSReadFileWithPos, FSClient *client, FSCmdBlock *block,
|
||||
return res;
|
||||
}
|
||||
|
||||
DECL_FUNCTION(int32_t, FSReadFileWithPosAsync, FSClient *client, FSCmdBlock *block, void *buffer, uint32_t size, uint32_t count, uint32_t pos, FSFileHandle handle, int32_t unk1, FSErrorFlag errorMask, FSAsyncData *asyncData) {
|
||||
DECL_FUNCTION(int32_t, FSReadFileWithPosAsync, FSClient *client, FSCmdBlock *block, void *buffer, uint32_t size, uint32_t count, uint32_t pos, FSFileHandle handle, int32_t unk1, FSErrorFlag errorMask,
|
||||
FSAsyncData *asyncData) {
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("");
|
||||
FSStatus result = FSReadFileWithPosWrapper(buffer, size, count, pos, handle, unk1, errorMask, ASYNC_RESULT_HANDLER);
|
||||
if (result != FS_STATUS_USE_REAL_OS) {
|
||||
@ -228,7 +230,8 @@ DECL_FUNCTION(FSStatus, FSWriteFile, FSClient *client, FSCmdBlock *block, uint8_
|
||||
return real_FSWriteFile(client, block, buffer, size, count, handle, unk1, errorMask);
|
||||
}
|
||||
|
||||
DECL_FUNCTION(FSStatus, FSWriteFileAsync, FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, uint32_t count, FSFileHandle handle, uint32_t unk1, FSErrorFlag errorMask, FSAsyncData *asyncData) {
|
||||
DECL_FUNCTION(FSStatus, FSWriteFileAsync, FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, uint32_t count, FSFileHandle handle, uint32_t unk1, FSErrorFlag errorMask,
|
||||
FSAsyncData *asyncData) {
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("");
|
||||
FSStatus result = FSWriteFileWrapper(buffer, size, count, handle, unk1, errorMask, ASYNC_RESULT_HANDLER);
|
||||
if (result != FS_STATUS_USE_REAL_OS) {
|
||||
|
@ -83,7 +83,7 @@ bool isValidFileHandle(int32_t handle) {
|
||||
|
||||
int32_t getNewDirHandleIndex() {
|
||||
dir_handle_mutex.lock();
|
||||
int32_t handle_id;
|
||||
int32_t handle_id = -1;
|
||||
for (int i = 0; i < DIR_HANDLES_LENGTH; i++) {
|
||||
if (!dir_handles[i].in_use) {
|
||||
handle_id = i;
|
||||
@ -137,8 +137,8 @@ void freeDirHandle(uint32_t handle) {
|
||||
FSStatus FSOpenDirWrapper(char *path,
|
||||
FSDirectoryHandle *handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted)) {
|
||||
return FS_STATUS_USE_REAL_OS;
|
||||
@ -201,7 +201,7 @@ FSStatus FSOpenDirWrapper(char *path,
|
||||
FSStatus FSReadDirWrapper(FSDirectoryHandle handle,
|
||||
FSDirectoryEntry *entry,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
@ -253,7 +253,7 @@ FSStatus FSReadDirWrapper(FSDirectoryHandle handle,
|
||||
|
||||
FSStatus FSCloseDirWrapper(FSDirectoryHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
!isValidDirHandle(handle)) {
|
||||
@ -281,7 +281,7 @@ FSStatus FSCloseDirWrapper(FSDirectoryHandle handle,
|
||||
|
||||
FSStatus FSRewindDirWrapper(FSDirectoryHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
!isValidDirHandle(handle)) {
|
||||
@ -303,8 +303,8 @@ FSStatus FSRewindDirWrapper(FSDirectoryHandle handle,
|
||||
|
||||
FSStatus FSMakeDirWrapper(char *path,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_PATH) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted)) {
|
||||
@ -334,8 +334,8 @@ FSStatus FSOpenFileWrapper(char *path,
|
||||
const char *mode,
|
||||
FSFileHandle *handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted)) {
|
||||
return FS_STATUS_USE_REAL_OS;
|
||||
@ -424,7 +424,7 @@ FSStatus FSOpenFileWrapper(char *path,
|
||||
|
||||
FSStatus FSCloseFileWrapper(FSFileHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
!isValidFileHandle(handle)) {
|
||||
@ -456,8 +456,8 @@ FSStatus FSCloseFileWrapper(FSFileHandle handle,
|
||||
}
|
||||
|
||||
FSStatus FSGetStatWrapper(char *path, FSStat *stats, FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted)) {
|
||||
return FS_STATUS_USE_REAL_OS;
|
||||
@ -531,7 +531,7 @@ static inline void replaceContentPath(char *pathForCheck, int pathForCheckSize,
|
||||
FSStatus FSGetStatFileWrapper(FSFileHandle handle,
|
||||
FSStat *stats,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
!isValidFileHandle(handle)) {
|
||||
@ -574,7 +574,7 @@ FSStatus FSReadFileWrapper(void *buffer,
|
||||
FSFileHandle handle,
|
||||
uint32_t unk1,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
!isValidFileHandle(handle)) {
|
||||
@ -621,7 +621,7 @@ FSStatus FSReadFileWithPosWrapper(void *buffer,
|
||||
FSFileHandle handle,
|
||||
int32_t unk1,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
!isValidFileHandle(handle)) {
|
||||
@ -648,7 +648,7 @@ FSStatus FSReadFileWithPosWrapper(void *buffer,
|
||||
FSStatus FSSetPosFileWrapper(FSFileHandle handle,
|
||||
uint32_t pos,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
!isValidFileHandle(handle)) {
|
||||
@ -680,7 +680,7 @@ FSStatus FSSetPosFileWrapper(FSFileHandle handle,
|
||||
FSStatus FSGetPosFileWrapper(FSFileHandle handle,
|
||||
uint32_t *pos,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
!isValidFileHandle(handle)) {
|
||||
@ -713,7 +713,7 @@ FSStatus FSGetPosFileWrapper(FSFileHandle handle,
|
||||
|
||||
FSStatus FSIsEofWrapper(FSFileHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
!isValidFileHandle(handle)) {
|
||||
@ -749,7 +749,7 @@ FSStatus FSIsEofWrapper(FSFileHandle handle,
|
||||
|
||||
FSStatus FSTruncateFileWrapper(FSFileHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_PATH) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
@ -775,7 +775,7 @@ FSStatus FSWriteFileWrapper(uint8_t *buffer,
|
||||
FSFileHandle handle,
|
||||
uint32_t unk1,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_PATH) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted) ||
|
||||
@ -791,8 +791,8 @@ FSStatus FSWriteFileWrapper(uint8_t *buffer,
|
||||
|
||||
FSStatus FSRemoveWrapper(char *path,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_PATH) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted)) {
|
||||
@ -822,8 +822,8 @@ FSStatus FSRemoveWrapper(char *path,
|
||||
FSStatus FSRenameWrapper(char *oldPath,
|
||||
char *newPath,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_oldPath, char *_newPath)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler) {
|
||||
const std::function<FSStatus(char *, char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_PATH) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted)) {
|
||||
@ -852,7 +852,7 @@ FSStatus FSRenameWrapper(char *oldPath,
|
||||
return result_handler(result);
|
||||
}
|
||||
|
||||
FSStatus FSFlushFileWrapper(FSFileHandle handle, FSErrorFlag errorMask, std::function<FSStatus(FSStatus)> result_handler) {
|
||||
FSStatus FSFlushFileWrapper(FSFileHandle handle, FSErrorFlag errorMask, const std::function<FSStatus(FSStatus)>& result_handler) {
|
||||
if ((gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_NONE) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_PATH) ||
|
||||
(gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE && !gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted)) {
|
||||
|
@ -37,48 +37,48 @@ extern fileMagic_t file_handles[FILE_HANDLES_LENGTH];
|
||||
FSStatus FSOpenDirWrapper(char *path,
|
||||
FSDirectoryHandle *handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSReadDirWrapper(FSDirectoryHandle handle,
|
||||
FSDirectoryEntry *entry,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSCloseDirWrapper(FSDirectoryHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSRewindDirWrapper(FSDirectoryHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSMakeDirWrapper(char *path,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSOpenFileWrapper(char *path,
|
||||
const char *mode,
|
||||
FSFileHandle *handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSCloseFileWrapper(FSFileHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSGetStatWrapper(char *path,
|
||||
FSStat *stats,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSGetStatFileWrapper(FSFileHandle handle,
|
||||
FSStat *stats,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSReadFileWrapper(void *buffer,
|
||||
uint32_t size,
|
||||
@ -86,7 +86,7 @@ FSStatus FSReadFileWrapper(void *buffer,
|
||||
FSFileHandle handle,
|
||||
uint32_t unk1,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSReadFileWithPosWrapper(void *buffer,
|
||||
uint32_t size,
|
||||
@ -95,25 +95,25 @@ FSStatus FSReadFileWithPosWrapper(void *buffer,
|
||||
FSFileHandle handle,
|
||||
int32_t unk1,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSSetPosFileWrapper(FSFileHandle handle,
|
||||
uint32_t pos,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSGetPosFileWrapper(FSFileHandle handle,
|
||||
uint32_t *pos,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSIsEofWrapper(FSFileHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSTruncateFileWrapper(FSFileHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSWriteFileWrapper(uint8_t *buffer,
|
||||
uint32_t size,
|
||||
@ -121,22 +121,22 @@ FSStatus FSWriteFileWrapper(uint8_t *buffer,
|
||||
FSFileHandle handle,
|
||||
uint32_t unk1,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSRemoveWrapper(char *path,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_path)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSRenameWrapper(char *oldPath,
|
||||
char *newPath,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(char *_oldPath, char *_newPath)> fallback_function,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(char *, char *)>& fallback_function,
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
FSStatus FSFlushFileWrapper(FSFileHandle handle,
|
||||
FSErrorFlag errorMask,
|
||||
std::function<FSStatus(FSStatus)> result_handler);
|
||||
const std::function<FSStatus(FSStatus)>& result_handler);
|
||||
|
||||
int32_t getNewDirHandleIndex();
|
||||
|
||||
|
@ -77,7 +77,6 @@ DECL_FUNCTION(FSStatus, RPX_FSCloseFile, FSClient *client, FSCmdBlock *block, FS
|
||||
}
|
||||
|
||||
DECL_FUNCTION(void, Loader_ReportWarn) {
|
||||
return;
|
||||
}
|
||||
|
||||
function_replacement_data_t rpx_utils_function_replacements[] = {
|
||||
|
@ -25,7 +25,7 @@ int FileReader::read(uint8_t *buffer, uint32_t size) {
|
||||
}
|
||||
|
||||
FileReader::FileReader(std::string &path) {
|
||||
int fd = -1;
|
||||
int fd;
|
||||
if ((fd = open(path.c_str(), O_RDONLY)) >= 0) {
|
||||
this->isReadFromFile = true;
|
||||
this->isReadFromBuffer = false;
|
||||
|
@ -10,6 +10,7 @@ class FileReader {
|
||||
|
||||
public:
|
||||
FileReader(uint8_t *buffer, uint32_t size);
|
||||
|
||||
explicit FileReader(std::string &path);
|
||||
|
||||
virtual ~FileReader();
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "FileReaderCompressed.h"
|
||||
|
||||
int FileReaderCompressed::read(uint8_t *buffer, uint32_t size) {
|
||||
if(!initDone){
|
||||
return -11;
|
||||
}
|
||||
int startValue = this->strm.total_out;
|
||||
uint32_t newSize = 0;
|
||||
int ret = 0;
|
||||
|
@ -1,122 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are based on the article posted at the
|
||||
* following location:
|
||||
*
|
||||
* http://crascit.com/2015/06/03/on-leaving-scope-part-2/
|
||||
*
|
||||
* The material in that article has some commonality with the code made
|
||||
* available as part of Facebook's folly library at:
|
||||
*
|
||||
* https://github.com/facebook/folly/blob/master/folly/ScopeGuard.h
|
||||
*
|
||||
* Furthermore, similar material is currently part of a draft proposal
|
||||
* to the C++ standards committee, referencing the same work by Andrei
|
||||
* Alexandresu that led to the folly implementation. The draft proposal
|
||||
* can be found at:
|
||||
*
|
||||
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4189.pdf
|
||||
*
|
||||
* With the above in mind, the content below is made available under
|
||||
* the same license terms as folly to minimize any legal concerns.
|
||||
* Should there be ambiguity over copyright ownership between Facebook
|
||||
* and myself for any material included in this file, it should be
|
||||
* interpreted that Facebook is the copyright owner for the ambiguous
|
||||
* section of code concerned.
|
||||
*
|
||||
* Craig Scott
|
||||
* 3rd June 2015
|
||||
*
|
||||
* ----------------------------------------------------------------------
|
||||
*
|
||||
* Copyright 2015 Craig Scott
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef CRASCIT_ONLEAVINGSCOPE_H
|
||||
#define CRASCIT_ONLEAVINGSCOPE_H
|
||||
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
/**
|
||||
* This class is intended to be used only to create a local object on the
|
||||
* stack. It accepts a function object in its constructor and will invoke
|
||||
* that function object in its destructor. The class provides a move
|
||||
* constructor so it can be used with the onLeavingScope factory function,
|
||||
* but it cannot be copied.
|
||||
*
|
||||
* Do no use this function directly, use the onLeavingScope() factory
|
||||
* function instead.
|
||||
*/
|
||||
template<typename Func>
|
||||
class OnLeavingScope
|
||||
{
|
||||
public:
|
||||
// Prevent copying
|
||||
OnLeavingScope(const OnLeavingScope&) = delete;
|
||||
OnLeavingScope& operator=(const OnLeavingScope&) = delete;
|
||||
|
||||
// Allow moving
|
||||
OnLeavingScope(OnLeavingScope&& other) :
|
||||
m_func(std::move(other.m_func)),
|
||||
m_owner(other.m_owner)
|
||||
{
|
||||
other.m_owner = false;
|
||||
}
|
||||
|
||||
OnLeavingScope(const Func& f) :
|
||||
m_func(f),
|
||||
m_owner(true)
|
||||
{
|
||||
}
|
||||
OnLeavingScope(Func&& f) :
|
||||
m_func(std::move(f)),
|
||||
m_owner(true)
|
||||
{
|
||||
}
|
||||
~OnLeavingScope()
|
||||
{
|
||||
if (m_owner)
|
||||
m_func();
|
||||
}
|
||||
|
||||
private:
|
||||
Func m_func;
|
||||
bool m_owner;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Factory function for creating an OnLeavingScope object. It is intended
|
||||
* to be used like so:
|
||||
*
|
||||
* auto cleanup = onLeavingScope(...);
|
||||
*
|
||||
* where the ... could be a lambda function, function object or pointer to
|
||||
* a free function to be invoked when the cleanup object goes out of scope.
|
||||
* The function object must take no function arguments, but can return any
|
||||
* type (the return value is ignored).
|
||||
*
|
||||
* The \a Func template parameter would rarely, if ever, be manually
|
||||
* specified. Normally, it would be deduced automatically by the compiler
|
||||
* from the object passed as the function argument.
|
||||
*/
|
||||
template<typename Func>
|
||||
OnLeavingScope<typename std::decay<Func>::type> onLeavingScope(Func&& f)
|
||||
{
|
||||
return OnLeavingScope<typename std::decay<Func>::type>(std::forward<Func>(f));
|
||||
}
|
||||
|
||||
#endif // CRASCIT_ONLEAVINGSCOPE_H
|
@ -290,7 +290,6 @@ char *StringTools::str_replace(char *orig, char *rep, char *with) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* hash: compute hash value of string */
|
||||
uint32_t StringTools::hash(char *str) {
|
||||
unsigned int h;
|
||||
|
@ -4,7 +4,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <whb/log.h>
|
||||
#include "utils.h"
|
||||
|
||||
@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
#define DEBUG_FUNCTION_LINE(FMT, ARGS...)do { \
|
||||
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \
|
||||
} while (0);
|
||||
} while (0)
|
||||
|
||||
#define OSFATAL_FUNCTION_LINE(FMT, ARGS...)do { \
|
||||
OSFatal_printf("[%s]%s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \
|
||||
|
@ -43,8 +43,8 @@ void dumpHex(const void *data, size_t size) {
|
||||
}
|
||||
|
||||
BOOL OSFatal_printf(const char *fmt, ...) {
|
||||
char *buf1 = memalign(4,PRINTF_BUFFER_LENGTH);
|
||||
char *buf2 = memalign(4,PRINTF_BUFFER_LENGTH);
|
||||
char *buf1 = (char *) memalign(4, PRINTF_BUFFER_LENGTH);
|
||||
char *buf2 = (char *) memalign(4, PRINTF_BUFFER_LENGTH);
|
||||
va_list va;
|
||||
|
||||
if (!buf1) {
|
Loading…
Reference in New Issue
Block a user