Replace '/' with '|' in OSDynload_Acquire with name starts with '~'

This commit is contained in:
Maschell 2023-03-16 12:01:20 +01:00
parent 52e9a80255
commit 5cc25551e5

View File

@ -3,6 +3,7 @@
#include "loader_defines.h" #include "loader_defines.h"
#include "logger.h" #include "logger.h"
#include <coreinit/dynload.h> #include <coreinit/dynload.h>
#include <cstdio>
#include <cstring> #include <cstring>
#include <wums.h> #include <wums.h>
@ -27,11 +28,21 @@ DECL_FUNCTION(OSDynLoad_Error, OSDynLoad_Acquire, char const *name, OSDynLoad_Mo
} }
} }
OSDynLoad_Error result = real_OSDynLoad_Acquire(name, outModule); if (name != nullptr && name[0] == '~') {
if (result == OS_DYNLOAD_OK) { char cpy[64] = {};
return OS_DYNLOAD_OK; snprintf(cpy, sizeof(cpy), "%s", name);
char *curPtr = &cpy[1];
while (*curPtr != '\0') {
if (*curPtr == '/') {
*curPtr = '|';
}
curPtr++;
}
return real_OSDynLoad_Acquire(cpy, outModule);
} }
OSDynLoad_Error result = real_OSDynLoad_Acquire(name, outModule);
return result; return result;
} }