Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
706 changes: 706 additions & 0 deletions soh/soh/Enhancements/Restorations/HeapFragmentation.cpp

Large diffs are not rendered by default.

73 changes: 40 additions & 33 deletions soh/soh/Enhancements/debugger/valueViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ void GfxPrint_SetPos(GfxPrint* printer, s32 x, s32 y);
s32 GfxPrint_Printf(GfxPrint* printer, const char* fmt, ...);
}

extern Arena sHeapFragmentationSystemArena;
extern Arena sHeapFragmentationZeldaArena;
static u32 sHeapFragmentationZeldaMaxFree, sHeapFragmentationZeldaFree, sHeapFragmentationZeldaAlloc;

#define CVAR_NAME CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting")
#define CVAR_DEFAULT 0
#define CVAR_VALUE CVarGetInteger(CVAR_NAME, CVAR_DEFAULT)
Expand All @@ -27,39 +31,42 @@ std::map<ValueViewerEntry, ValueSetting> valueViewerSettings;

// clang-format off
std::array<ValueTableElement, VVE_MAX> valueTable = {{
{ "Time", "gSaveContext.dayTime", "TIME:", TYPE_U16, false, []() -> void* { return &gSaveContext.dayTime; }},
{ "Age", "gSaveContext.linkAge", "AGE:", TYPE_S32, false, []() -> void* { return &gSaveContext.linkAge; }},
{ "Health", "gSaveContext.health", "HP:", TYPE_S16, false, []() -> void* { return &gSaveContext.health; }},
{ "Navi Timer", "gSaveContext.naviTimer", "NAVI:", TYPE_U16, false, []() -> void* { return &gSaveContext.naviTimer; }},
{ "Scene ID", "play->sceneNum", "SCENE:", TYPE_S16, true, []() -> void* { return &gPlayState->sceneNum; }},
{ "Room ID", "play->roomCtx.curRoom.num", "ROOM:", TYPE_S8, true, []() -> void* { return &gPlayState->roomCtx.curRoom.num; }},
{ "Entrance ID", "gSaveContext.entranceIndex", "ENTR:", TYPE_S32, false, []() -> void* { return &gSaveContext.entranceIndex; }},
{ "Cutscene ID", "gSaveContext.cutsceneIndex", "CUTS:", TYPE_S32, false, []() -> void* { return &gSaveContext.cutsceneIndex; }},
{ "Link X", "Player->actor.world.pos.x", "X:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.world.pos.x; }},
{ "Link Y", "Player->actor.world.pos.y", "Y:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.world.pos.y; }},
{ "Link Z", "Player->actor.world.pos.z", "Z:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.world.pos.z; }},
{ "Link Yaw", "Player->actor.world.rot.y", "ROT:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.world.rot.y; }},
{ "Link Velocity", "Player->linearVelocity", "V:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->linearVelocity; }},
{ "Link X Velocity", "Player->actor.velocity.x", "XV:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.velocity.x; }},
{ "Link Y Velocity", "Player->actor.velocity.y", "YV:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.velocity.y; }},
{ "Link Z Velocity", "Player->actor.velocity.z", "ZV:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.velocity.z; }},
{ "Text ID", "play->msgCtx.textId", "TEXTID:", TYPE_U16, true, []() -> void* { return &gPlayState->msgCtx.textId; }},
{ "Analog Stick X", "play->state.input->cur.stick_x", "AX:", TYPE_S8, true, []() -> void* { return &gPlayState->state.input->cur.stick_x; }},
{ "Analog Stick Y", "play->state.input->cur.stick_y", "AY:", TYPE_S8, true, []() -> void* { return &gPlayState->state.input->cur.stick_y; }},
{ "getItemID", "Player->getItemId", "ITEM:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->getItemId; }},
{ "getItemEntry", "Player->getItemEntry", "IE:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->getItemEntry.itemId; }},
{ "Movement Angle", "Player->yaw", "YAW:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->yaw; }},
{ "Last Item Pressed", "Player->heldItemButton", "LASTI:", TYPE_S8, true, []() -> void* { return &GET_PLAYER(gPlayState)->heldItemButton; }},
{ "Stick Timer", "Player->unk_860", "STICK:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->unk_860; }},
{ "Last damage value", "Player->melee[0].info.dmgFlags", "DMG:", TYPE_U32, true, []() -> void* { return &GET_PLAYER(gPlayState)->meleeWeaponQuads[0].info.toucher.dmgFlags; }},
{ "Camera Angle", "play->mainCamera.camDir.y", "CAMY:", TYPE_S16, true, []() -> void* { return &gPlayState->mainCamera.camDir.y; }},
{ "Camera XZ Speed", "play->mainCamera.xzSpeed", "CAMXZV:", TYPE_FLOAT, true, []() -> void* { return &gPlayState->mainCamera.xzSpeed; }},
{ "Frame Counter", "play->state.frames", "FRAM:", TYPE_S32, true, []() -> void* { return &gPlayState->state.frames; }},
{ "Cutscene Pointer", "play->csCtx.segment", "CSP:", TYPE_PTR, true, []() -> void* { return &gPlayState->csCtx.segment; }},
{ "Framerate Divisor", "R_UPDATE_RATE", "FRDV:", TYPE_S16, false, []() -> void* { return &R_UPDATE_RATE; }},
{ "Next HUD mode", "gSaveContext.nextHudMode", "HUD:", TYPE_S16, false, []() -> void* { return &gSaveContext.unk_13E8; }},
{ "Temp B Value", "gSaveContext.buttonStatus[0]", "TEMPB:", TYPE_U8, false, []() -> void* { return &gSaveContext.buttonStatus[0]; }},
{ "Blue Warp Timer", "DoorWarp1->warpTimer", "WARPT:", TYPE_U16, true, []() -> void* { DoorWarp1 *actor = (DoorWarp1 *)Actor_Find(&gPlayState->actorCtx, ACTOR_DOOR_WARP1 ,ACTORCAT_ITEMACTION); if(actor) { return &actor->warpTimer; } else { return nullptr; }}},
{ "Time", "gSaveContext.dayTime", "TIME:", TYPE_U16, false, []() -> void* { return &gSaveContext.dayTime; }},
{ "Age", "gSaveContext.linkAge", "AGE:", TYPE_S32, false, []() -> void* { return &gSaveContext.linkAge; }},
{ "Health", "gSaveContext.health", "HP:", TYPE_S16, false, []() -> void* { return &gSaveContext.health; }},
{ "Navi Timer", "gSaveContext.naviTimer", "NAVI:", TYPE_U16, false, []() -> void* { return &gSaveContext.naviTimer; }},
{ "Scene ID", "play->sceneNum", "SCENE:", TYPE_S16, true, []() -> void* { return &gPlayState->sceneNum; }},
{ "Room ID", "play->roomCtx.curRoom.num", "ROOM:", TYPE_S8, true, []() -> void* { return &gPlayState->roomCtx.curRoom.num; }},
{ "Entrance ID", "gSaveContext.entranceIndex", "ENTR:", TYPE_S32, false, []() -> void* { return &gSaveContext.entranceIndex; }},
{ "Cutscene ID", "gSaveContext.cutsceneIndex", "CUTS:", TYPE_S32, false, []() -> void* { return &gSaveContext.cutsceneIndex; }},
{ "Link X", "Player->actor.world.pos.x", "X:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.world.pos.x; }},
{ "Link Y", "Player->actor.world.pos.y", "Y:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.world.pos.y; }},
{ "Link Z", "Player->actor.world.pos.z", "Z:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.world.pos.z; }},
{ "Link Yaw", "Player->actor.world.rot.y", "ROT:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.world.rot.y; }},
{ "Link Velocity", "Player->linearVelocity", "V:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->linearVelocity; }},
{ "Link X Velocity", "Player->actor.velocity.x", "XV:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.velocity.x; }},
{ "Link Y Velocity", "Player->actor.velocity.y", "YV:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.velocity.y; }},
{ "Link Z Velocity", "Player->actor.velocity.z", "ZV:", TYPE_FLOAT, true, []() -> void* { return &GET_PLAYER(gPlayState)->actor.velocity.z; }},
{ "Text ID", "play->msgCtx.textId", "TEXTID:", TYPE_U16, true, []() -> void* { return &gPlayState->msgCtx.textId; }},
{ "Analog Stick X", "play->state.input->cur.stick_x", "AX:", TYPE_S8, true, []() -> void* { return &gPlayState->state.input->cur.stick_x; }},
{ "Analog Stick Y", "play->state.input->cur.stick_y", "AY:", TYPE_S8, true, []() -> void* { return &gPlayState->state.input->cur.stick_y; }},
{ "getItemID", "Player->getItemId", "ITEM:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->getItemId; }},
{ "getItemEntry", "Player->getItemEntry", "IE:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->getItemEntry.itemId; }},
{ "Movement Angle", "Player->yaw", "YAW:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->yaw; }},
{ "Last Item Pressed", "Player->heldItemButton", "LASTI:", TYPE_S8, true, []() -> void* { return &GET_PLAYER(gPlayState)->heldItemButton; }},
{ "Stick Timer", "Player->unk_860", "STICK:", TYPE_S16, true, []() -> void* { return &GET_PLAYER(gPlayState)->unk_860; }},
{ "Last damage value", "Player->melee[0].info.dmgFlags", "DMG:", TYPE_U32, true, []() -> void* { return &GET_PLAYER(gPlayState)->meleeWeaponQuads[0].info.toucher.dmgFlags; }},
{ "Camera Angle", "play->mainCamera.camDir.y", "CAMY:", TYPE_S16, true, []() -> void* { return &gPlayState->mainCamera.camDir.y; }},
{ "Camera XZ Speed", "play->mainCamera.xzSpeed", "CAMXZV:", TYPE_FLOAT, true, []() -> void* { return &gPlayState->mainCamera.xzSpeed; }},
{ "Frame Counter", "play->state.frames", "FRAM:", TYPE_S32, true, []() -> void* { return &gPlayState->state.frames; }},
{ "Cutscene Pointer", "play->csCtx.segment", "CSP:", TYPE_PTR, true, []() -> void* { return &gPlayState->csCtx.segment; }},
{ "Framerate Divisor", "R_UPDATE_RATE", "FRDV:", TYPE_S16, false, []() -> void* { return &R_UPDATE_RATE; }},
{ "Next HUD mode", "gSaveContext.nextHudMode", "HUD:", TYPE_S16, false, []() -> void* { return &gSaveContext.unk_13E8; }},
{ "Temp B Value", "gSaveContext.buttonStatus[0]", "TEMPB:", TYPE_U8, false, []() -> void* { return &gSaveContext.buttonStatus[0]; }},
{ "Blue Warp Timer", "DoorWarp1->warpTimer", "WARPT:", TYPE_U16, true, []() -> void* { DoorWarp1 *actor = (DoorWarp1 *)Actor_Find(&gPlayState->actorCtx, ACTOR_DOOR_WARP1 ,ACTORCAT_ITEMACTION); if(actor) { return &actor->warpTimer; } else { return nullptr; }}},
{ "Heap-Frag: maxFree", "", "HF-MAX:", TYPE_U32, true, []() -> void* { ArenaImpl_GetSizes(&sHeapFragmentationZeldaArena, &sHeapFragmentationZeldaMaxFree, &sHeapFragmentationZeldaFree, &sHeapFragmentationZeldaAlloc); return &sHeapFragmentationZeldaMaxFree; } },
{ "Heap-Frag: free", "", "HF-FREE:", TYPE_U32, true, []() -> void* { ArenaImpl_GetSizes(&sHeapFragmentationZeldaArena, &sHeapFragmentationZeldaMaxFree, &sHeapFragmentationZeldaFree, &sHeapFragmentationZeldaAlloc); return &sHeapFragmentationZeldaFree; } },
{ "Heap-Frag: alloc", "", "HF-ALLOC:", TYPE_U32, true, []() -> void* { ArenaImpl_GetSizes(&sHeapFragmentationZeldaArena, &sHeapFragmentationZeldaMaxFree, &sHeapFragmentationZeldaFree, &sHeapFragmentationZeldaAlloc); return &sHeapFragmentationZeldaAlloc; } },
/* TODO: Find these (from GZ)
"Last RNG Value" x32 0x80105A80
"Analog Stick Angle" s16 0x803AA698
Expand Down
3 changes: 3 additions & 0 deletions soh/soh/Enhancements/debugger/valueViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ typedef enum {
VVE_NEXT_HUD_MOD,
VVE_TEMP_B_VALUE,
VVE_BLUE_WARP_TIMER,
VVE_HF_OM,
VVE_HF_OF,
VVE_HF_OA,
VVE_MAX,
} ValueViewerEntry;

Expand Down
14 changes: 14 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,17 @@ DEFINE_HOOK(OnSeqPlayerInit, (int32_t playerIdx, int32_t seqId));
DEFINE_HOOK(OnRandoSetCheckStatus, (RandomizerCheck rc, RandomizerCheckStatus status));
DEFINE_HOOK(OnRandoSetIsSkipped, (RandomizerCheck rc, bool isSkipped));
DEFINE_HOOK(OnRandoEntranceDiscovered, (u16 entranceIndex, u8 isReversedEntrance));

// Heap
DEFINE_HOOK(OnSystemArenaAlloc, (uintptr_t ptr, size_t size));
DEFINE_HOOK(OnSystemArenaAllocR, (uintptr_t ptr, size_t size));
DEFINE_HOOK(OnSystemArenaFree, (uintptr_t ptr));
DEFINE_HOOK(OnGameStateRealloc, (uintptr_t gameArena, size_t size));
DEFINE_HOOK(OnGameStateAlloc, (size_t size));
DEFINE_HOOK(OnZeldaArenaInit, ());
DEFINE_HOOK(OnZeldaArenaAlloc, (uintptr_t ptr, size_t size));
DEFINE_HOOK(OnZeldaArenaAllocR, (uintptr_t ptr, size_t size));
DEFINE_HOOK(OnZeldaArenaFree, (uintptr_t ptr));
DEFINE_HOOK(OnZeldaArenaCleanup, ());
DEFINE_HOOK(OnActorOverlayLoad, (int16_t actorId));
DEFINE_HOOK(OnActorOverlayFree, (int16_t actorId));
49 changes: 49 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,52 @@ void GameInteractor_ExecuteOnRandoEntranceDiscovered(u16 entranceIndex, u8 isRev
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnRandoEntranceDiscovered>(entranceIndex,
isReversedEntrance);
}

// MARK: - Heap
void GameInteractor_ExecuteOnSystemArenaAlloc(uintptr_t ptr, size_t size) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSystemArenaAlloc>(ptr, size);
}

void GameInteractor_ExecuteOnSystemArenaAllocR(uintptr_t ptr, size_t size) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSystemArenaAllocR>(ptr, size);
}

void GameInteractor_ExecuteOnSystemArenaFree(uintptr_t ptr) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSystemArenaFree>(ptr);
}

void GameInteractor_ExecuteOnGameStateRealloc(uintptr_t gameArena, size_t size) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnGameStateRealloc>(gameArena, size);
}

void GameInteractor_ExecuteOnGameStateAlloc(size_t size) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnGameStateAlloc>(size);
}

void GameInteractor_ExecuteOnZeldaArenaInit(void) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnZeldaArenaInit>();
}

void GameInteractor_ExecuteOnZeldaArenaAlloc(uintptr_t ptr, size_t size) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnZeldaArenaAlloc>(ptr, size);
}

void GameInteractor_ExecuteOnZeldaArenaAllocR(uintptr_t ptr, size_t size) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnZeldaArenaAllocR>(ptr, size);
}

void GameInteractor_ExecuteOnZeldaArenaFree(uintptr_t ptr) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnZeldaArenaFree>(ptr);
}

void GameInteractor_ExecuteOnZeldaArenaCleanup(void) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnZeldaArenaCleanup>();
}

void GameInteractor_ExecuteOnActorOverlayLoad(int16_t actorId) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnActorOverlayLoad>(actorId);
}

void GameInteractor_ExecuteOnActorOverlayFree(int16_t actorId) {
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnActorOverlayFree>(actorId);
}
14 changes: 14 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ void GameInteractor_ExecuteOnSeqPlayerInit(int32_t playerIdx, int32_t seqId);
// MARK: - Rando
void GameInteractor_ExecuteOnRandoEntranceDiscovered(u16 entranceIndex, u8 isReversedEntrance);

// MARK: - Heap
void GameInteractor_ExecuteOnSystemArenaAlloc(uintptr_t ptr, size_t size);
void GameInteractor_ExecuteOnSystemArenaAllocR(uintptr_t ptr, size_t size);
void GameInteractor_ExecuteOnSystemArenaFree(uintptr_t ptr);
void GameInteractor_ExecuteOnGameStateRealloc(uintptr_t gameArena, size_t size);
void GameInteractor_ExecuteOnGameStateAlloc(size_t size);
void GameInteractor_ExecuteOnZeldaArenaInit(void);
void GameInteractor_ExecuteOnZeldaArenaAlloc(uintptr_t ptr, size_t size);
void GameInteractor_ExecuteOnZeldaArenaAllocR(uintptr_t ptr, size_t size);
void GameInteractor_ExecuteOnZeldaArenaFree(uintptr_t ptr);
void GameInteractor_ExecuteOnZeldaArenaCleanup(void);
void GameInteractor_ExecuteOnActorOverlayLoad(int16_t actorId);
void GameInteractor_ExecuteOnActorOverlayFree(int16_t actorId);

#ifdef __cplusplus
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2965,7 +2965,15 @@ typedef enum {
// ```
// #### `args`
// - `*int32_t (camId)`
VB_SHOULD_LOAD_BG_IMAGE
VB_SHOULD_LOAD_BG_IMAGE,

// #### `result`
// ```c
// true
// ```
// #### `args`
// - `*Actor (actor)`
VB_LOAD_ACTOR
} GIVanillaBehavior;

#endif
5 changes: 5 additions & 0 deletions soh/soh/SohGui/SohMenuEnhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,11 @@ void SohMenu::AddMenuEnhancements() {
.Options(CheckboxOptions().Tooltip(
"Restores a bug from NTSC 1.0/1.1 that allows you to obtain the eyeball frog from King Zora "
"instead of the Zora Tunic by Holding Shield."));
AddWidget(path, "Heap Fragmentation", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_ENHANCEMENT("HeapFragmentation"))
.Options(CheckboxOptions().Tooltip(
"Restore bugs relating to fragmentation of the heap, stopping certain actors from spawning, such as parts "
"of the graveyard and the light trial block. (May not 100%% accurately emulate the heap.)"));

AddWidget(path, "Misc Restorations", WIDGET_SEPARATOR_TEXT);
AddWidget(path, "Fix L&Z Page Switch in Pause Menu", WIDGET_CVAR_CHECKBOX)
Expand Down
2 changes: 2 additions & 0 deletions soh/src/code/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ void GameState_Realloc(GameState* gameState, size_t size) {
osSyncPrintf("ハイラル再確保 サイズ=%u バイト\n", size); // "Hyral reallocate size = %u bytes"
gameArena = GAMESTATE_MALLOC_DEBUG(alloc, size);
if (gameArena != NULL) {
GameInteractor_ExecuteOnGameStateRealloc((uintptr_t)gameArena, size);
THA_Ct(&gameState->tha, gameArena, size);
osSyncPrintf("ハイラル再確保成功\n"); // "Successful reacquisition of Hyrule"
} else {
Expand Down Expand Up @@ -531,6 +532,7 @@ void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line) {
osSyncPrintf("game_alloc(%08x) %08x-%08x [%s:%d]\n", size, ret, (uintptr_t)ret + size, file, line);
osSyncPrintf(VT_RST);
}
GameInteractor_ExecuteOnGameStateAlloc(size);
return ret;
}

Expand Down
4 changes: 4 additions & 0 deletions soh/src/code/system_malloc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "global.h"
#include <string.h>
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"

#define LOG_SEVERITY_NOLOG 0
#define LOG_SEVERITY_ERROR 2
Expand Down Expand Up @@ -31,13 +32,15 @@ void* SystemArena_Malloc(size_t size) {

void* SystemArena_MallocDebug(size_t size, const char* file, s32 line) {
void* ptr = __osMallocDebug(&gSystemArena, size, file, line);
GameInteractor_ExecuteOnSystemArenaAlloc((uintptr_t)ptr, size);

SystemArena_CheckPointer(ptr, size, "malloc_DEBUG", "確保"); // "Secure"
return ptr;
}

void* SystemArena_MallocR(size_t size) {
void* ptr = __osMallocR(&gSystemArena, size);
GameInteractor_ExecuteOnSystemArenaAllocR((uintptr_t)ptr, size);

SystemArena_CheckPointer(ptr, size, "malloc_r", "確保"); // "Secure"
return ptr;
Expand Down Expand Up @@ -67,6 +70,7 @@ void SystemArena_Free(void* ptr) {
}

void SystemArena_FreeDebug(void* ptr, const char* file, s32 line) {
GameInteractor_ExecuteOnSystemArenaFree((uintptr_t)ptr);
__osFreeDebug(&gSystemArena, ptr, file, line);
}

Expand Down
Loading
Loading