From fed8987d79fea6ce8df026c8d4a6c3dfb7059842 Mon Sep 17 00:00:00 2001 From: MysterD Date: Wed, 16 Mar 2022 19:57:45 -0700 Subject: [PATCH] Fixed custom lua models --- data/dynos_misc.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/data/dynos_misc.cpp b/data/dynos_misc.cpp index 3af462a2..37c8439d 100644 --- a/data/dynos_misc.cpp +++ b/data/dynos_misc.cpp @@ -348,7 +348,11 @@ void DynOS_Geo_AddActorCustom(const SysPath &aPackFolder, const char *aActorName } } - GfxData *_GfxData = DynOS_Gfx_LoadFromBinary(aPackFolder, aActorName); + u16 actorLen = strlen(aActorName); + char* actorName = (char*)calloc(1, sizeof(char) * (actorLen + 1)); + strcpy(actorName, aActorName); + + GfxData *_GfxData = DynOS_Gfx_LoadFromBinary(aPackFolder, actorName); if (!_GfxData) { return; } @@ -360,13 +364,13 @@ void DynOS_Geo_AddActorCustom(const SysPath &aPackFolder, const char *aActorName // Add to custom actors s32 index = DynOS_Geo_GetActorCount(); - sDynosCustomActors.Add({ strdup(aActorName), geoLayout }); + sDynosCustomActors.Add({ actorName, geoLayout }); // Alloc and init the actors gfx list Array &pActorGfxList = DynOS_Gfx_GetActorList(); pActorGfxList.Resize(DynOS_Geo_GetActorCount()); pActorGfxList[index].mPackIndex = -1; - pActorGfxList[index].mGfxData = NULL; // maybe _GfxData? + pActorGfxList[index].mGfxData = _GfxData; pActorGfxList[index].mGraphNode = (GraphNode *) DynOS_Geo_GetGraphNode(DynOS_Geo_GetActorLayout(index), true); }