mirror of
https://github.com/wiiu-env/RPXLoadingModule.git
synced 2024-11-22 09:59:17 +01:00
Replace DCFlushRange with OSMemoryBarrier
This commit is contained in:
parent
142aa827d2
commit
83c1cef208
@ -168,7 +168,7 @@ DECL_FUNCTION(FSStatus, FSChangeDirAsync, FSClient *client, FSCmdBlock *block, c
|
||||
gReplacementInfo.contentReplacementInfo.workingDir[len - 1] = '/';
|
||||
gReplacementInfo.contentReplacementInfo.workingDir[len] = 0;
|
||||
}
|
||||
DCFlushRange(gReplacementInfo.contentReplacementInfo.workingDir, sizeof(gReplacementInfo.contentReplacementInfo.workingDir));
|
||||
OSMemoryBarrier();
|
||||
return real_FSChangeDirAsync(client, block, path, errorMask, asyncData);
|
||||
}
|
||||
|
||||
|
@ -63,8 +63,7 @@ int getNewFileHandleIndex() {
|
||||
OSFatal("Failed to alloc memory for mutex");
|
||||
}
|
||||
OSInitMutex(file_handles[i].mutex);
|
||||
DCFlushRange(file_handles[i].mutex, sizeof(OSMutex));
|
||||
DCFlushRange(&file_handles[i], sizeof(fileMagic_t));
|
||||
OSMemoryBarrier();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -93,8 +92,7 @@ int32_t getNewDirHandleIndex() {
|
||||
if (!dir_handles[i].mutex) {
|
||||
OSFatal("Failed to alloc memory for mutex");
|
||||
}
|
||||
DCFlushRange(dir_handles[i].mutex, sizeof(OSMutex));
|
||||
DCFlushRange(&dir_handles[i], sizeof(dirMagic_t));
|
||||
OSMemoryBarrier();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -114,7 +112,7 @@ void freeFileHandle(uint32_t handle) {
|
||||
free(file_handles[handle].mutex);
|
||||
file_handles[handle].mutex = nullptr;
|
||||
}
|
||||
DCFlushRange(&file_handles[handle], sizeof(fileMagic_t));
|
||||
OSMemoryBarrier();
|
||||
file_handle_mutex.unlock();
|
||||
}
|
||||
|
||||
@ -130,7 +128,7 @@ void freeDirHandle(uint32_t handle) {
|
||||
dir_handles[handle].mutex = nullptr;
|
||||
}
|
||||
dir_handles[handle] = {};
|
||||
DCFlushRange(&dir_handles[handle], sizeof(dirMagic_t));
|
||||
OSMemoryBarrier();
|
||||
dir_handle_mutex.unlock();
|
||||
}
|
||||
|
||||
@ -198,7 +196,7 @@ FSStatus FSOpenDirWrapper(char *path,
|
||||
} else {
|
||||
DEBUG_FUNCTION_LINE("Global FSClient or FSCmdBlock were null");
|
||||
}
|
||||
DCFlushRange(dir_info, sizeof(dirMagic_t));
|
||||
OSMemoryBarrier();
|
||||
}
|
||||
|
||||
OSUnlockMutex(dir_handles[handle_index].mutex);
|
||||
@ -252,7 +250,7 @@ FSStatus FSReadDirWrapper(FSDirectoryHandle handle,
|
||||
dir_info->readResultCapacity = 1;
|
||||
}
|
||||
}
|
||||
DCFlushRange(dir_info, sizeof(dirMagic_t));
|
||||
OSMemoryBarrier();
|
||||
}
|
||||
|
||||
struct dirent *entry_ = readdir(dir);
|
||||
@ -296,8 +294,7 @@ FSStatus FSReadDirWrapper(FSDirectoryHandle handle,
|
||||
memcpy(&dir_info->readResult[dir_info->readResultNumberOfEntries], entry, sizeof(FSDirectoryEntry));
|
||||
dir_info->readResultNumberOfEntries++;
|
||||
|
||||
DCFlushRange(dir_info->readResult, sizeof(FSDirectoryEntry) * dir_info->readResultNumberOfEntries);
|
||||
DCFlushRange(dir_info, sizeof(dirMagic_t));
|
||||
OSMemoryBarrier();
|
||||
}
|
||||
|
||||
result = FS_STATUS_OK;
|
||||
@ -393,7 +390,7 @@ FSStatus FSCloseDirWrapper(FSDirectoryHandle handle,
|
||||
dir_info->readResultCapacity = 0;
|
||||
dir_info->readResultNumberOfEntries = 0;
|
||||
}
|
||||
DCFlushRange(dir_info, sizeof(dirMagic_t));
|
||||
OSMemoryBarrier();
|
||||
}
|
||||
|
||||
OSUnlockMutex(dir_handles[handle_index].mutex);
|
||||
@ -441,7 +438,7 @@ FSStatus FSRewindDirWrapper(FSDirectoryHandle handle,
|
||||
DEBUG_FUNCTION_LINE("Global FSClient or FSCmdBlock were null");
|
||||
}
|
||||
}
|
||||
DCFlushRange(dir_info, sizeof(dirMagic_t));
|
||||
OSMemoryBarrier();
|
||||
}
|
||||
|
||||
OSUnlockMutex(dir_handles[handle_index].mutex);
|
||||
@ -544,7 +541,7 @@ FSStatus FSOpenFileWrapper(char *path,
|
||||
*handle = file_handles[handle_index].handle;
|
||||
file_handles[handle_index].fd = fd;
|
||||
file_handles[handle_index].in_use = true;
|
||||
DCFlushRange(&file_handles[handle_index], sizeof(fileMagic_t));
|
||||
OSMemoryBarrier();
|
||||
} else {
|
||||
DEBUG_FUNCTION_LINE("File not found %s", pathForCheck);
|
||||
if (gReplacementInfo.contentReplacementInfo.fallbackOnError) {
|
||||
|
@ -179,7 +179,7 @@ bool RL_LoadFromSDOnNextLaunch(const char *bundle_path) {
|
||||
request.path[0] = '\0';
|
||||
strncat(request.path, bundle_path, sizeof(request.path) - 1);
|
||||
|
||||
DCFlushRange(&request, sizeof(request));
|
||||
OSMemoryBarrier();
|
||||
|
||||
int success = false;
|
||||
int mcpFd = IOS_Open("/dev/mcp", (IOSOpenMode) 0);
|
||||
@ -193,7 +193,7 @@ bool RL_LoadFromSDOnNextLaunch(const char *bundle_path) {
|
||||
IOS_Close(mcpFd);
|
||||
}
|
||||
|
||||
DCFlushRange(&gReplacementInfo, sizeof(gReplacementInfo));
|
||||
OSMemoryBarrier();
|
||||
|
||||
if (!success) {
|
||||
gReplacementInfo.rpxReplacementInfo.willRPXBeReplaced = false;
|
||||
@ -229,7 +229,7 @@ bool RL_LoadFromSDOnNextLaunch(const char *bundle_path) {
|
||||
}
|
||||
}
|
||||
|
||||
DCFlushRange(&gReplacementInfo, sizeof(gReplacementInfo));
|
||||
OSMemoryBarrier();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -251,7 +251,7 @@ bool RL_UnmountCurrentRunningBundle() {
|
||||
DEBUG_FUNCTION_LINE("Unmount /vol/content");
|
||||
romfsUnmount("rom");
|
||||
gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted = false;
|
||||
DCFlushRange(&gReplacementInfo, sizeof(gReplacementInfo));
|
||||
OSMemoryBarrier();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ WUMS_APPLICATION_ENDS() {
|
||||
DEBUG_FUNCTION_LINE("Unmount /vol/content");
|
||||
romfsUnmount("rom");
|
||||
gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted = false;
|
||||
DCFlushRange(&gReplacementInfo, sizeof(gReplacementInfo));
|
||||
OSMemoryBarrier();
|
||||
}
|
||||
}
|
||||
gReplacementInfo.rpxReplacementInfo.isRPXReplaced = false;
|
||||
@ -94,7 +94,7 @@ WUMS_APPLICATION_STARTS() {
|
||||
DEBUG_FUNCTION_LINE("Set mode to CONTENTREDIRECT_NONE and replaceSave to false");
|
||||
gReplacementInfo.contentReplacementInfo.mode = CONTENTREDIRECT_NONE;
|
||||
gReplacementInfo.contentReplacementInfo.replaceSave = false;
|
||||
DCFlushRange(&gReplacementInfo, sizeof(gReplacementInfo));
|
||||
OSMemoryBarrier();
|
||||
} else {
|
||||
if (gReplacementInfo.contentReplacementInfo.mode == CONTENTREDIRECT_FROM_WUHB_BUNDLE) {
|
||||
uint32_t currentHash = StringTools::hash(gReplacementInfo.contentReplacementInfo.bundleMountInformation.toMountPath);
|
||||
@ -137,6 +137,6 @@ WUMS_APPLICATION_STARTS() {
|
||||
}
|
||||
}
|
||||
|
||||
DCFlushRange(&gReplacementInfo, sizeof(gReplacementInfo));
|
||||
OSMemoryBarrier();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user