From 093754ae1b0e106494bb4b9d5267fc3515be843e Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 13 May 2023 02:42:35 -0700 Subject: [PATCH] Fix some memory mismanagement --- data/dynos_bin_ambient_t.cpp | 3 ++- data/dynos_main.cpp | 4 ++-- data/dynos_mgr_actor.cpp | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/dynos_bin_ambient_t.cpp b/data/dynos_bin_ambient_t.cpp index 9bd3a2a2..c409b1fa 100644 --- a/data/dynos_bin_ambient_t.cpp +++ b/data/dynos_bin_ambient_t.cpp @@ -55,7 +55,8 @@ void DynOS_AmbientT_Load(BinFile *aFile, GfxData *aGfxData) { _Node->mName.Read(aFile); // Data - _Node->mData = New(); + // HACK: allocate for Light_t size due to PC port rendering all ambients as lights + _Node->mData = (Ambient_t*)New(); *_Node->mData = aFile->Read(); // Append diff --git a/data/dynos_main.cpp b/data/dynos_main.cpp index 19c315cf..4470530a 100644 --- a/data/dynos_main.cpp +++ b/data/dynos_main.cpp @@ -55,9 +55,9 @@ void *DynOS_SwapCmd(void *aCmd) { void *DynOS_UpdateCmd(void *aCmd) { if (!aCmd) { return NULL; } + static const uintptr_t sCmdLevelEntry[] = { CALL(0, lvl_init_or_update) }; - if (!sCmdLevelEntry) { return NULL; } - sDynosIsLevelEntry |= (memcmp(aCmd, sCmdLevelEntry, sizeof(sCmdLevelEntry)) == 0); + sDynosIsLevelEntry |= (((uintptr_t*)aCmd)[0] == sCmdLevelEntry[0] && ((uintptr_t*)aCmd)[1] == sCmdLevelEntry[1]); return DynOS_Warp_Update(aCmd, sDynosIsLevelEntry); } diff --git a/data/dynos_mgr_actor.cpp b/data/dynos_mgr_actor.cpp index ff8ea9fc..c04da6fd 100644 --- a/data/dynos_mgr_actor.cpp +++ b/data/dynos_mgr_actor.cpp @@ -187,7 +187,6 @@ void DynOS_Actor_ModShutdown() { for (auto it = _ValidActors.cbegin(); it != _ValidActors.cend();) { auto& actorGfx = it->second; if (actorGfx.mPackIndex == MOD_PACK_INDEX) { - free(actorGfx.mGraphNode); DynOS_Gfx_Free(actorGfx.mGfxData); _ValidActors.erase(it++); } else {