diff --git a/include/mgba/internal/ds/gx/software.h b/include/mgba/internal/ds/gx/software.h index 7c75cd69b..c9201da24 100644 --- a/include/mgba/internal/ds/gx/software.h +++ b/include/mgba/internal/ds/gx/software.h @@ -20,8 +20,8 @@ struct DSGXSoftwarePolygon { uint16_t* texBase; uint16_t* palBase; int texFormat; - unsigned texW; - unsigned texH; + int texW; + int texH; int32_t topY; int32_t bottomY; int32_t topZ; diff --git a/src/ds/gx/software.c b/src/ds/gx/software.c index 64bbada2f..8e6973391 100644 --- a/src/ds/gx/software.c +++ b/src/ds/gx/software.c @@ -43,8 +43,8 @@ static color_t _lookupColor(struct DSGXSoftwareEndpoint* ep, struct DSGXSoftware // TODO: Optimize uint16_t texel; - uint16_t s = ep->s >> 4; - uint16_t t = ep->t >> 4; + int16_t s = ep->s >> 4; + int16_t t = ep->t >> 4; if (!DSGXTexParamsIsSRepeat(poly->poly->texParams)) { if (s < 0) { s = 0; @@ -62,7 +62,7 @@ static color_t _lookupColor(struct DSGXSoftwareEndpoint* ep, struct DSGXSoftware if (!DSGXTexParamsIsTRepeat(poly->poly->texParams)) { if (t < 0) { t = 0; - } else if (s >= poly->texH) { + } else if (t >= poly->texH) { t = poly->texW - 1; } } else if (DSGXTexParamsIsTMirror(poly->poly->texParams)) {