From 420c5e77dedd3f3a91b3fd181a553c591d6b354e Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sun, 21 Jan 2024 22:48:34 +0000 Subject: [PATCH] Handle animated texture cycle lists not being the same size as keyframes (#91) --- OTRExporter | 2 +- mm/2s2h/resource/importer/TextureAnimationFactory.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/OTRExporter b/OTRExporter index ed1bcb695..91615dd1c 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit ed1bcb69591a2427808614696c6c999cb48d0f01 +Subproject commit 91615dd1c1d08827621c3b05fd628d134b153608 diff --git a/mm/2s2h/resource/importer/TextureAnimationFactory.cpp b/mm/2s2h/resource/importer/TextureAnimationFactory.cpp index 7da2b7f60..80470166c 100644 --- a/mm/2s2h/resource/importer/TextureAnimationFactory.cpp +++ b/mm/2s2h/resource/importer/TextureAnimationFactory.cpp @@ -100,12 +100,13 @@ void LUS::TextureAnimationFactoryV0::ParseFileBinary(std::shared_ptrkeyFrameLength = reader->ReadUInt16(); - e->textureList = new void*[e->keyFrameLength]; + uint32_t textureListSize = reader->ReadUInt32(); + e->textureList = new void*[textureListSize]; e->textureIndexList = new uint8_t[e->keyFrameLength]; - tAnim->textureCycleTextures.reserve(e->keyFrameLength); + tAnim->textureCycleTextures.reserve(textureListSize); - for (size_t i = 0; i < e->keyFrameLength; i++) { + for (size_t i = 0; i < textureListSize; i++) { tAnim->textureCycleTextures.emplace_back("__OTR__" + reader->ReadString()); e->textureList[i] = (Gfx*)tAnim->textureCycleTextures[i].c_str(); }