temp. hack preventing evil out-of-bounds write

This commit is contained in:
StapleButter 2017-03-04 15:34:07 +01:00
parent f8770dc8fe
commit 8c7b7e2327
4 changed files with 11 additions and 5 deletions

View File

@ -47,6 +47,8 @@
// Z-buffering mode: val = ((Z * 0x800 * 0x1000) / W) + 0x7FFCFF // Z-buffering mode: val = ((Z * 0x800 * 0x1000) / W) + 0x7FFCFF
// W-buffering mode: val = W - 0x1FF // W-buffering mode: val = W - 0x1FF
// TODO: confirm W, because it's weird // TODO: confirm W, because it's weird
// ... nope, that shit above isn't right
// also, the formula for the clear depth on GBAtek appears to be wrong
namespace GPU3D namespace GPU3D

View File

@ -498,6 +498,10 @@ void RenderPolygon(Polygon* polygon)
s32 tr = ((perspfactorr1 * vrcur->TexCoords[1]) + (perspfactorr2 * vrnext->TexCoords[1])) / (perspfactorr1 + perspfactorr2); s32 tr = ((perspfactorr1 * vrcur->TexCoords[1]) + (perspfactorr2 * vrnext->TexCoords[1])) / (perspfactorr1 + perspfactorr2);
if (xr == xl) xr++; if (xr == xl) xr++;
// temp.
if (xl > 255) continue;
s32 xdiv = 0x1000 / (xr - xl); s32 xdiv = 0x1000 / (xr - xl);
//printf("y%d: %d->%d %08X %08X\n", y, xl, xr, lfactor, rfactor); //printf("y%d: %d->%d %08X %08X\n", y, xl, xr, lfactor, rfactor);

View File

@ -265,7 +265,7 @@ int main()
SetWindowText(melon, melontitle); SetWindowText(melon, melontitle);
} }
} }
printf("deinit\n");
NDS::DeInit(); NDS::DeInit();
return 0; return 0;

View File

@ -1,5 +1,5 @@
# depslib dependency file v1.0 # depslib dependency file v1.0
1487356459 source:c:\documents\sources\melonds\main.cpp 1488636452 source:c:\documents\sources\melonds\main.cpp
<stdio.h> <stdio.h>
<windows.h> <windows.h>
"NDS.h" "NDS.h"
@ -10,7 +10,7 @@
1481161027 c:\documents\sources\melonds\types.h 1481161027 c:\documents\sources\melonds\types.h
1488635272 source:c:\documents\sources\melonds\nds.cpp 1488635597 source:c:\documents\sources\melonds\nds.cpp
<stdio.h> <stdio.h>
<string.h> <string.h>
"NDS.h" "NDS.h"
@ -87,7 +87,7 @@
"NDS.h" "NDS.h"
"SPI.h" "SPI.h"
1488594249 source:c:\documents\sources\melonds\gpu2d.cpp 1488635396 source:c:\documents\sources\melonds\gpu2d.cpp
<stdio.h> <stdio.h>
<string.h> <string.h>
"NDS.h" "NDS.h"
@ -148,7 +148,7 @@
1488497796 c:\documents\sources\melonds\gpu3d.h 1488497796 c:\documents\sources\melonds\gpu3d.h
1488594938 source:c:\documents\sources\melonds\gpu3d.cpp 1488637250 source:c:\documents\sources\melonds\gpu3d.cpp
<stdio.h> <stdio.h>
<string.h> <string.h>
"NDS.h" "NDS.h"