diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index 496310a62..1f982d107 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -80,6 +80,7 @@ override_allowed_functions = { override_disallowed_functions = { "src/audio/external.h": [ " func_" ], "src/engine/math_util.h": [ "atan2s", "atan2f", "vec3s_sub" ], + "src/engine/surface_load.h", [ "alloc_surface_poools" ], "src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ], "src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ], "src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ], diff --git a/src/engine/surface_load.c b/src/engine/surface_load.c index bd61efd41..a84200533 100644 --- a/src/engine/surface_load.c +++ b/src/engine/surface_load.c @@ -529,6 +529,9 @@ void alloc_surface_pools(void) { gSurfaceNodesAllocated = 0; gSurfacesAllocated = 0; + clear_static_surfaces(); + clear_dynamic_surfaces(); + gCCMEnteredSlide = 0; reset_red_coins_collected(); } diff --git a/src/game/mario.c b/src/game/mario.c index 90a443bb5..a3f090c39 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -2002,11 +2002,6 @@ static u8 prevent_hang(u32 hangPreventionActions[], u8* hangPreventionIndex) { logfile_close(LFT_HANG); - // force the crash in debug mode -#ifdef DEBUG - SOFT_ASSERT_RETURN(hangPreventionIndex == 0, TRUE); -#endif - return TRUE; } diff --git a/src/game/mario_actions_moving.c b/src/game/mario_actions_moving.c index ee04a5a3e..9bc5337b3 100644 --- a/src/game/mario_actions_moving.c +++ b/src/game/mario_actions_moving.c @@ -628,6 +628,9 @@ void anim_and_audio_for_walk(struct MarioState *m) { val0C = FALSE; } break; + default: + val0C = false; + break; } } } diff --git a/src/game/memory.c b/src/game/memory.c index 5ab4d8467..84f5361e8 100644 --- a/src/game/memory.c +++ b/src/game/memory.c @@ -25,6 +25,7 @@ void* dynamic_pool_alloc(struct DynamicPool *pool, u32 size) { struct DynamicPoolNode* node = calloc(1, sizeof(struct DynamicPoolNode)); node->ptr = calloc(1, size); node->prev = pool->tail; + node->size = size; pool->tail = node; pool->usedSpace += size; @@ -46,6 +47,7 @@ void dynamic_pool_free(struct DynamicPool *pool, void* ptr) { } else { next->prev = prev; } + pool->usedSpace -= node->size; free(node->ptr); free(node); return; diff --git a/src/game/memory.h b/src/game/memory.h index d3ce04ce1..910ae91cc 100644 --- a/src/game/memory.h +++ b/src/game/memory.h @@ -20,6 +20,7 @@ struct DynamicPool struct DynamicPoolNode { void* ptr; + u32 size; struct DynamicPoolNode* prev; };