feat(component): add TextureCacheGetPal

This commit is contained in:
fallenoak 2025-10-22 16:32:39 -05:00
parent a7d5417a3b
commit 15deaf2ce0
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 20 additions and 0 deletions

View File

@ -164,6 +164,22 @@ int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t force) {
return 1; return 1;
} }
BlpPalPixel* TextureCacheGetPal(void* handle) {
auto entry = static_cast<CACHEENTRY*>(handle);
if (entry->IsMissing() || !entry->m_data) {
return nullptr;
}
auto blpHeader = static_cast<BLPHeader*>(entry->m_data);
if (blpHeader->colorEncoding != COLOR_PAL) {
return nullptr;
}
return blpHeader->extended.palette;
}
int32_t TextureCacheHasMips(void* handle) { int32_t TextureCacheHasMips(void* handle) {
auto entry = static_cast<CACHEENTRY*>(handle); auto entry = static_cast<CACHEENTRY*>(handle);
return entry && entry->m_data && !entry->IsMissing(); return entry && entry->m_data && !entry->IsMissing();

View File

@ -5,6 +5,8 @@
class CAsyncObject; class CAsyncObject;
struct BlpPalPixel;
struct TCTEXTUREINFO { struct TCTEXTUREINFO {
uint16_t width; uint16_t width;
uint16_t height; uint16_t height;
@ -44,6 +46,8 @@ void TextureCacheDestroyTexture(void* texture);
int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t a3); int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t a3);
BlpPalPixel* TextureCacheGetPal(void* handle);
int32_t TextureCacheHasMips(void* handle); int32_t TextureCacheHasMips(void* handle);
#endif #endif