mirror of
https://github.com/wiiu-env/homebrew_on_menu_plugin.git
synced 2024-11-22 10:39:16 +01:00
Clear filewrapper info on exit
This commit is contained in:
parent
f5ab00a4d9
commit
e882e0b1e0
@ -26,6 +26,27 @@ int FileHandleWrapper_GetSlot() {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FileHandleWrapper_FreeSlot(uint32_t slot) {
|
||||||
|
if (slot >= FILE_WRAPPER_SIZE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
OSLockMutex(&fileWrapperMutex);
|
||||||
|
gFileHandleWrapper[slot].handle = 0;
|
||||||
|
gFileHandleWrapper[slot].inUse = false;
|
||||||
|
OSMemoryBarrier();
|
||||||
|
OSUnlockMutex(&fileWrapperMutex);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FileHandleWrapper_FreeAll() {
|
||||||
|
OSLockMutex(&fileWrapperMutex);
|
||||||
|
for (int i = 0; i < FILE_WRAPPER_SIZE; i++) {
|
||||||
|
FileHandleWrapper_FreeSlot(i);
|
||||||
|
}
|
||||||
|
OSUnlockMutex(&fileWrapperMutex);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int OpenFileForID(int id, const char *filepath, int *handle) {
|
int OpenFileForID(int id, const char *filepath, int *handle) {
|
||||||
if (!mountRomfs(id)) {
|
if (!mountRomfs(id)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -10,3 +10,4 @@ typedef struct FileHandleWrapper_t {
|
|||||||
extern FileHandleWrapper gFileHandleWrapper[FILE_WRAPPER_SIZE];
|
extern FileHandleWrapper gFileHandleWrapper[FILE_WRAPPER_SIZE];
|
||||||
|
|
||||||
int OpenFileForID(int id, const char *path, int32_t *handle);
|
int OpenFileForID(int id, const char *path, int32_t *handle);
|
||||||
|
bool FileHandleWrapper_FreeAll();
|
@ -72,6 +72,7 @@ ON_APPLICATION_START() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ON_APPLICATION_ENDS() {
|
ON_APPLICATION_ENDS() {
|
||||||
|
FileHandleWrapper_FreeAll();
|
||||||
deinitLogging();
|
deinitLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user