mirror of
https://github.com/wiiu-env/AromaBaseModule.git
synced 2024-11-27 05:54:15 +01:00
Improve detecting FSClients which have been added by homebrew
This commit is contained in:
parent
72ff59de95
commit
ef42550673
@ -5,10 +5,17 @@
|
|||||||
#include <coreinit/filesystem_fsa.h>
|
#include <coreinit/filesystem_fsa.h>
|
||||||
#include <coreinit/title.h>
|
#include <coreinit/title.h>
|
||||||
|
|
||||||
|
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) {
|
DECL_FUNCTION(FSStatus, FSAddClient, FSClient *client, FSErrorFlag errorMask) {
|
||||||
auto res = real_FSAddClient(client, errorMask);
|
auto res = real_FSAddClient(client, errorMask);
|
||||||
if (res == FS_STATUS_OK) {
|
if (res == FS_STATUS_OK) {
|
||||||
if (((uint32_t) client & 0xF0000000) != gHeapMask) {
|
if (((uint32_t) client & 0xF0000000) != gHeapMask && !IsInHardcodedHomebrewMemoryRegion(client)) {
|
||||||
gNonHomebrewFSClientCount++;
|
gNonHomebrewFSClientCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18,7 +25,7 @@ DECL_FUNCTION(FSStatus, FSAddClient, FSClient *client, FSErrorFlag errorMask) {
|
|||||||
DECL_FUNCTION(FSStatus, FSDelClient, FSClient *client, FSErrorFlag errorMask) {
|
DECL_FUNCTION(FSStatus, FSDelClient, FSClient *client, FSErrorFlag errorMask) {
|
||||||
auto res = real_FSDelClient(client, errorMask);
|
auto res = real_FSDelClient(client, errorMask);
|
||||||
if (res == FS_STATUS_OK) {
|
if (res == FS_STATUS_OK) {
|
||||||
if (((uint32_t) client & 0xF0000000) != gHeapMask) {
|
if (((uint32_t) client & 0xF0000000) != gHeapMask && !IsInHardcodedHomebrewMemoryRegion(client)) {
|
||||||
gNonHomebrewFSClientCount--;
|
gNonHomebrewFSClientCount--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user