From 0c78154c2dd8be9da998a4e3ec0d42429fc6f231 Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Sat, 22 Feb 2025 14:21:21 -0500 Subject: [PATCH] Zero the memory allocated to hold extended actor data --- src/game/recomp_mem_api.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/game/recomp_mem_api.cpp b/src/game/recomp_mem_api.cpp index e0426b4..6ee6a05 100644 --- a/src/game/recomp_mem_api.cpp +++ b/src/game/recomp_mem_api.cpp @@ -137,6 +137,11 @@ extern "C" void recomp_create_actor_data(uint8_t* rdram, recomp_context* ctx) { void* data = recomp::alloc(rdram, alloc_size); alloc_count++; data_ptr = reinterpret_cast(data) - rdram + 0xFFFFFFFF80000000U; + // Zero the allocated memory. + // A memset should be fine here since this data is aligned, but use a byteswapped loop just to be safe. + for (size_t i = 0; i < alloc_size; i++) { + MEM_B(i, data_ptr) = 0; + } } // Add the actor's fields to the actor data slotmap.