From ab5b0fee4bf88b08dce225908a8c55fa1f4ecee0 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Wed, 9 Feb 2022 21:02:36 +0100 Subject: [PATCH] Add OSDynLoad_GetLoaderHeapStatistics --- include/coreinit/dynload.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/coreinit/dynload.h b/include/coreinit/dynload.h index 7d2f27c1..59d72f9c 100644 --- a/include/coreinit/dynload.h +++ b/include/coreinit/dynload.h @@ -14,6 +14,7 @@ extern "C" { #endif typedef struct OSDynLoad_NotifyData OSDynLoad_NotifyData; +typedef struct OSDynLoad_LoaderHeapStatistics OSDynLoad_LoaderHeapStatistics; typedef void *OSDynLoad_Module; typedef enum OSDynLoad_Error @@ -67,6 +68,23 @@ WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x20, readOffset); WUT_CHECK_OFFSET(OSDynLoad_NotifyData, 0x24, readSize); WUT_CHECK_SIZE(OSDynLoad_NotifyData, 0x28); +struct OSDynLoad_LoaderHeapStatistics +{ + uint32_t codeHeapUsed; + uint32_t unk_0x04; + uint32_t codeHeapFree; + uint32_t codeHeapLargestFree; + uint32_t dataHeapUsed; + uint32_t unk_0x14; +}; +WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x00, codeHeapUsed); +WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x04, unk_0x04); +WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x08, codeHeapFree); +WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x0C, codeHeapLargestFree); +WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x10, dataHeapUsed); +WUT_CHECK_OFFSET(OSDynLoad_LoaderHeapStatistics, 0x14, unk_0x14); +WUT_CHECK_SIZE(OSDynLoad_LoaderHeapStatistics, 0x18); + typedef enum OSDynLoad_NotifyReason { OS_DYNLOAD_NOTIFY_UNLOADED = 0, @@ -143,6 +161,13 @@ OSDynLoad_GetTLSAllocator(OSDynLoadAllocFn *outAllocFn, OSDynLoadFreeFn *outFreeFn); +/** + * Get laoder heap statistics. + */ +OSDynLoad_Error +OSDynLoad_GetLoaderHeapStatistics(OSDynLoad_LoaderHeapStatistics *outLoaderHeapStatistics); + + /** * Gets the name for a given module handle. * Using the value "-1" as module handle gets the name of the running main rpl