diff --git a/src/component/Texture.cpp b/src/component/Texture.cpp index 888126c..371b09e 100644 --- a/src/component/Texture.cpp +++ b/src/component/Texture.cpp @@ -164,6 +164,22 @@ int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t force) { return 1; } +BlpPalPixel* TextureCacheGetPal(void* handle) { + auto entry = static_cast(handle); + + if (entry->IsMissing() || !entry->m_data) { + return nullptr; + } + + auto blpHeader = static_cast(entry->m_data); + + if (blpHeader->colorEncoding != COLOR_PAL) { + return nullptr; + } + + return blpHeader->extended.palette; +} + int32_t TextureCacheHasMips(void* handle) { auto entry = static_cast(handle); return entry && entry->m_data && !entry->IsMissing(); diff --git a/src/component/Texture.hpp b/src/component/Texture.hpp index ca1aa31..a515e28 100644 --- a/src/component/Texture.hpp +++ b/src/component/Texture.hpp @@ -5,6 +5,8 @@ class CAsyncObject; +struct BlpPalPixel; + struct TCTEXTUREINFO { uint16_t width; uint16_t height; @@ -44,6 +46,8 @@ void TextureCacheDestroyTexture(void* texture); int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t a3); +BlpPalPixel* TextureCacheGetPal(void* handle); + int32_t TextureCacheHasMips(void* handle); #endif