mirror of
https://github.com/wiiu-env/FunctionPatcherModule.git
synced 2026-08-28 19:55:49 -05:00
Update the malloc/free pointers used for threads to fix apps which use a custom heap
This commit is contained in:
@@ -33,9 +33,9 @@ public:
|
||||
//! save attribute assignment
|
||||
iAttributes = iAttr;
|
||||
//! allocate the thread on the default Cafe OS heap
|
||||
pThread = (OSThread *) gRealMEMAllocFromDefaultHeapEx(sizeof(OSThread), 0x10);
|
||||
pThread = (OSThread *) gMEMAllocFromDefaultHeapExForThreads(sizeof(OSThread), 0x10);
|
||||
//! allocate the stack on the default Cafe OS heap
|
||||
pThreadStack = (uint8_t *) gRealMEMAllocFromDefaultHeapEx(iStackSize, 0x20);
|
||||
pThreadStack = (uint8_t *) gMEMAllocFromDefaultHeapExForThreads(iStackSize, 0x20);
|
||||
//! create the thread
|
||||
if (pThread && pThreadStack) {
|
||||
// clang-format off
|
||||
@@ -125,10 +125,10 @@ public:
|
||||
}
|
||||
//! free the thread stack buffer
|
||||
if (pThreadStack) {
|
||||
gMEMFreeToDefaultHeap(pThreadStack);
|
||||
gMEMFreeToDefaultHeapForThreads(pThreadStack);
|
||||
}
|
||||
if (pThread) {
|
||||
gMEMFreeToDefaultHeap(pThread);
|
||||
gMEMFreeToDefaultHeapForThreads(pThread);
|
||||
}
|
||||
pThread = nullptr;
|
||||
pThreadStack = nullptr;
|
||||
|
||||
@@ -7,5 +7,5 @@ std::shared_ptr<FunctionAddressProvider> gFunctionAddressProvider;
|
||||
std::mutex gPatchedFunctionsMutex;
|
||||
std::vector<std::shared_ptr<PatchedFunctionData>> gPatchedFunctions;
|
||||
|
||||
void *(*gRealMEMAllocFromDefaultHeapEx)(uint32_t size, int align);
|
||||
void (*gMEMFreeToDefaultHeap)(void *ptr);
|
||||
void *(*gMEMAllocFromDefaultHeapExForThreads)(uint32_t size, int align);
|
||||
void (*gMEMFreeToDefaultHeapForThreads)(void *ptr);
|
||||
@@ -12,5 +12,5 @@ extern std::shared_ptr<FunctionAddressProvider> gFunctionAddressProvider;
|
||||
extern std::mutex gPatchedFunctionsMutex;
|
||||
extern std::vector<std::shared_ptr<PatchedFunctionData>> gPatchedFunctions;
|
||||
|
||||
extern void *(*gRealMEMAllocFromDefaultHeapEx)(uint32_t size, int align);
|
||||
extern void (*gMEMFreeToDefaultHeap)(void *ptr);
|
||||
extern void *(*gMEMAllocFromDefaultHeapExForThreads)(uint32_t size, int align);
|
||||
extern void (*gMEMFreeToDefaultHeapForThreads)(void *ptr);
|
||||
Reference in New Issue
Block a user