From 232800a8238f918e066fa9cc1a217e0e4020679b Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Mon, 8 Feb 2016 23:15:00 +0600 Subject: [PATCH] Fix TMEM address mask for tlut_en case. Thanks angrylion for the hint. Fixed texture mapping for 3D objects in Mischief Makers. --- src/Textures.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Textures.cpp b/src/Textures.cpp index c6011e9c..ce08a9c5 100644 --- a/src/Textures.cpp +++ b/src/Textures.cpp @@ -971,13 +971,14 @@ void TextureCache::_getTextureDestData(CachedTexture& tmptex, } } else { j = 0; + const u32 tMemMask = gDP.otherMode.textureLUT == G_TT_NONE ? 0x1FF : 0xFF; for (y = 0; y < tmptex.realHeight; ++y) { ty = min(y, clampTClamp) & maskTMask; if (y & mirrorTBit) ty ^= maskTMask; - pSrc = &TMEM[(tmptex.tMem + *pLine * ty) & 0x1FF]; + pSrc = &TMEM[(tmptex.tMem + *pLine * ty) & tMemMask]; i = (ty & 1) << 1; for (x = 0; x < tmptex.realWidth; ++x) {