feat(component): add TextureCacheGetPal

This commit is contained in:
fallenoak committed 2025-10-22 16:32:39 -05:00
1 parent a7d5417a3b
commit 15deaf2ce0
2 files changed
+20

No files matched your search

+16
View File
@@ -164,6 +164,22 @@ int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t force) {
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) {
auto entry = static_cast<CACHEENTRY*>(handle);
return entry && entry->m_data && !entry->IsMissing();
+4
View File
@@ -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