Fix DeIndexTexture

This commit is contained in:
Henrik Rydgård 2022-04-12 09:23:36 +02:00
parent e6df3ab23a
commit 35e0bfeacc
2 changed files with 8 additions and 4 deletions

View file

@ -1313,7 +1313,7 @@ static void ReverseColors(void *dstBuf, const void *srcBuf, GETextureFormat fmt,
case GE_TFMT_4444:
ConvertRGBA4444ToABGR4444((u16 *)dstBuf, (const u16 *)srcBuf, numPixels);
break;
// Final Fantasy 2 uses this heavily in animated textures.
// Final Fantasy 2 uses this heavily in animated textures.
case GE_TFMT_5551:
ConvertRGBA5551ToABGR1555((u16 *)dstBuf, (const u16 *)srcBuf, numPixels);
break;

View file

@ -109,17 +109,21 @@ inline void DeIndexTexture(/*WRITEONLY*/ ClutT *dest, const IndexT *indexed, int
if (sizeof(IndexT) == 1) {
for (int i = 0; i < length; ++i) {
ClutT color = clut[*indexed++];
alphaSum &= color;
*dest++ = color;
}
} else {
for (int i = 0; i < length; ++i) {
*dest++ = clut[(*indexed++) & 0xFF];
ClutT color = (*indexed++) & 0xFF;
alphaSum &= color;
*dest++ = color;
}
}
} else {
for (int i = 0; i < length; ++i) {
*dest++ = clut[gstate.transformClutIndex(*indexed++)];
ClutT color = clut[gstate.transformClutIndex(*indexed++)];
alphaSum &= color;
*dest++ = color;
}
}
}