diff --git a/data/dynos.cpp.h b/data/dynos.cpp.h index b99fd527..a33d85f0 100644 --- a/data/dynos.cpp.h +++ b/data/dynos.cpp.h @@ -695,6 +695,7 @@ s16 *DynOS_Level_GetWarpDeath(s32 aLevel, s32 aArea); void DynOS_Lvl_Add(const SysPath &aPackFolder, const char *aLevelName); LevelScript* DynOS_Lvl_Get(const char* levelName); +DataNode *DynOS_Lvl_Texture_Get(void *aPtr); // // Warps diff --git a/data/dynos_gfx_texture.cpp b/data/dynos_gfx_texture.cpp index 18b8e7f0..0cfa8af4 100644 --- a/data/dynos_gfx_texture.cpp +++ b/data/dynos_gfx_texture.cpp @@ -257,7 +257,7 @@ static DataNode *DynOS_Gfx_RetrieveNode(void *aPtr) { } } } - return NULL; + return DynOS_Lvl_Texture_Get(aPtr); } static bool DynOS_Gfx_ImportTexture_Typed(THN **aOutput, void *aPtr, s32 aTile, GRAPI *aGfxRApi, THN **aHashMap, THN *aPool, u32 *aPoolPos, u32 aPoolSize) { diff --git a/data/dynos_misc.cpp b/data/dynos_misc.cpp index 043598bc..9518839c 100644 --- a/data/dynos_misc.cpp +++ b/data/dynos_misc.cpp @@ -638,3 +638,17 @@ LevelScript* DynOS_Lvl_Get(const char* levelName) { } return NULL; } + +DataNode *DynOS_Lvl_Texture_Get(void *aPtr) { + for (s32 i = 0; i < sDynosCustomLevelScripts.Count(); ++i) { + auto &mTextures = sDynosCustomLevelScripts[i].second->mTextures; + for (s32 j = 0; j < mTextures.Count(); j++) { + auto &texture = mTextures[j]; + if (texture == aPtr) { + return texture; + } + + } + } + return NULL; +} \ No newline at end of file