mirror of
https://github.com/wiiu-env/homebrew_on_menu_plugin.git
synced 2024-11-22 02:29:15 +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;
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!mountRomfs(id)) {
|
||||
return -1;
|
||||
|
@ -9,4 +9,5 @@ typedef struct FileHandleWrapper_t {
|
||||
#define FILE_WRAPPER_SIZE 64
|
||||
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() {
|
||||
FileHandleWrapper_FreeAll();
|
||||
deinitLogging();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user