diff --git a/source/patches/patches_replacements.cpp b/source/patches/patches_replacements.cpp index 398fa1b..cf4bc8c 100644 --- a/source/patches/patches_replacements.cpp +++ b/source/patches/patches_replacements.cpp @@ -5,10 +5,17 @@ #include #include +static inline bool IsInHardcodedHomebrewMemoryRegion(void *addr) { + if ((uint32_t) addr >= 0x00800000 && (uint32_t) addr < 0x01000000) { + return true; + } + return false; +} + DECL_FUNCTION(FSStatus, FSAddClient, FSClient *client, FSErrorFlag errorMask) { auto res = real_FSAddClient(client, errorMask); if (res == FS_STATUS_OK) { - if (((uint32_t) client & 0xF0000000) != gHeapMask) { + if (((uint32_t) client & 0xF0000000) != gHeapMask && !IsInHardcodedHomebrewMemoryRegion(client)) { gNonHomebrewFSClientCount++; } } @@ -18,7 +25,7 @@ DECL_FUNCTION(FSStatus, FSAddClient, FSClient *client, FSErrorFlag errorMask) { DECL_FUNCTION(FSStatus, FSDelClient, FSClient *client, FSErrorFlag errorMask) { auto res = real_FSDelClient(client, errorMask); if (res == FS_STATUS_OK) { - if (((uint32_t) client & 0xF0000000) != gHeapMask) { + if (((uint32_t) client & 0xF0000000) != gHeapMask && !IsInHardcodedHomebrewMemoryRegion(client)) { gNonHomebrewFSClientCount--; } }