Fixed custom lua models

This commit is contained in:
MysterD 2022-03-16 19:57:45 -07:00
parent 469e4ac4e4
commit fed8987d79

View file

@ -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) { if (!_GfxData) {
return; return;
} }
@ -360,13 +364,13 @@ void DynOS_Geo_AddActorCustom(const SysPath &aPackFolder, const char *aActorName
// Add to custom actors // Add to custom actors
s32 index = DynOS_Geo_GetActorCount(); s32 index = DynOS_Geo_GetActorCount();
sDynosCustomActors.Add({ strdup(aActorName), geoLayout }); sDynosCustomActors.Add({ actorName, geoLayout });
// Alloc and init the actors gfx list // Alloc and init the actors gfx list
Array<ActorGfx> &pActorGfxList = DynOS_Gfx_GetActorList(); Array<ActorGfx> &pActorGfxList = DynOS_Gfx_GetActorList();
pActorGfxList.Resize(DynOS_Geo_GetActorCount()); pActorGfxList.Resize(DynOS_Geo_GetActorCount());
pActorGfxList[index].mPackIndex = -1; 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); pActorGfxList[index].mGraphNode = (GraphNode *) DynOS_Geo_GetGraphNode(DynOS_Geo_GetActorLayout(index), true);
} }