DS GX: Texture mode 2
Vicki Pfau vi@endrift.com
Thu, 02 Mar 2017 01:07:38 -0800
1 files changed,
11 insertions(+),
2 deletions(-)
jump to
M
src/ds/gx/software.c
→
src/ds/gx/software.c
@@ -82,10 +82,15 @@ return _finishColor(ep->cr, ep->cg, ep->cb);
case 1: return _finishColor(0, 0, 0x3F); case 2: - return _finishColor(0, 0x3F, 0); + texel = ((uint8_t*) poly->texBase)[texelCoord >> 2]; + if (texelCoord & 0x3) { + texel >>= 2 * texel & 3; + } + texel &= 0x3; + break; case 3: texel = ((uint8_t*) poly->texBase)[texelCoord >> 1]; - if ((ep->s >> 4) & 0x1) { + if (texelCoord & 0x1) { texel >>= 4; } texel &= 0xF;@@ -271,6 +276,10 @@ case 0:
case 7: poly->texBase = NULL; poly->palBase = NULL; + break; + case 2: + poly->texBase = &renderer->tex[DSGXTexParamsGetVRAMBase(poly->poly->texParams) >> VRAM_BLOCK_OFFSET][(DSGXTexParamsGetVRAMBase(poly->poly->texParams) << 2) & 0xFFFF]; + poly->palBase = &renderer->texPal[poly->poly->palBase >> 12][(poly->poly->palBase << 2) & 0x1FFF]; break; default: poly->texBase = &renderer->tex[DSGXTexParamsGetVRAMBase(poly->poly->texParams) >> VRAM_BLOCK_OFFSET][(DSGXTexParamsGetVRAMBase(poly->poly->texParams) << 2) & 0xFFFF];