diff --git a/src/component/Texture.cpp b/src/component/Texture.cpp index 371b09e..21c8d24 100644 --- a/src/component/Texture.cpp +++ b/src/component/Texture.cpp @@ -164,6 +164,23 @@ int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t force) { return 1; } +uint8_t* TextureCacheGetMip(void* handle, uint32_t mipLevel) { + auto entry = static_cast(handle); + + if (!entry || entry->IsMissing() || !entry->m_data) { + return nullptr; + } + + if (mipLevel >= entry->Info().mipCount) { + return nullptr; + } + + auto blpHeader = static_cast(entry->m_data); + auto mipOffset = blpHeader->mipOffsets[mipLevel]; + + return static_cast(entry->m_data) + mipOffset; +} + BlpPalPixel* TextureCacheGetPal(void* handle) { auto entry = static_cast(handle); diff --git a/src/component/Texture.hpp b/src/component/Texture.hpp index a515e28..135ea7c 100644 --- a/src/component/Texture.hpp +++ b/src/component/Texture.hpp @@ -46,6 +46,8 @@ void TextureCacheDestroyTexture(void* texture); int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t a3); +uint8_t* TextureCacheGetMip(void* handle, uint32_t mipLevel); + BlpPalPixel* TextureCacheGetPal(void* handle); int32_t TextureCacheHasMips(void* handle);