DS GX: Fix overflow causing a division crash

This commit is contained in:
Vicki Pfau 2020-07-29 18:03:04 -07:00
parent 510a539a50
commit ec626d723f
2 changed files with 4 additions and 3 deletions

View File

@ -22,6 +22,7 @@ Bugfixes:
- DS: Properly close save file on close
- DS Video: Fix size of VRAM zeroes buffer
- DS GX: Fix depth test scaling
- DS GX: Fix overflow causing a division crash
Misc:
- DS GX: Clean up and unify texture mapping
- DS Core: Add symbol loading

View File

@ -500,7 +500,7 @@ static void _preparePoly(struct DSGXRenderer* renderer, struct DSGXVertex* verts
struct DSGXVertex* v1;
int32_t v0w = v0->viewCoord[3];
if (!v0w) {
if (!v0w || v0w == INT32_MIN) {
v0w = 1;
}
@ -518,7 +518,7 @@ static void _preparePoly(struct DSGXRenderer* renderer, struct DSGXVertex* verts
v1 = &verts[poly->poly->vertIds[v]];
int32_t v1w = v1->viewCoord[3];
if (!v1w) {
if (!v1w || v1w == INT32_MIN) {
v1w = 1;
}
int32_t v1x = (v1->viewCoord[0] + v1w) * (int64_t) (v1->viewportWidth << 12) / (v1w * 2) + (v1->viewportX << 12);
@ -577,7 +577,7 @@ static void _preparePoly(struct DSGXRenderer* renderer, struct DSGXVertex* verts
v1 = &verts[poly->poly->vertIds[0]];
int32_t v1w = v1->viewCoord[3];
if (!v1w) {
if (!v1w || v1w == INT32_MIN) {
v1w = 1;
}
int32_t v1x = (v1->viewCoord[0] + v1w) * (int64_t) (v1->viewportWidth << 12) / (v1w * 2) + (v1->viewportX << 12);