aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-03-04 15:34:07 +0100
committerStapleButter <thetotalworm@gmail.com>2017-03-04 15:34:07 +0100
commit8c7b7e23273dc594071c0d7a7db7a6294d6a94c9 (patch)
tree870e44ce16c505c973bc686cade7d1b00f18df82
parentf8770dc8fea7d22319d17f2addd82dd4c9574ddc (diff)
temp. hack preventing evil out-of-bounds write
-rw-r--r--GPU3D.cpp2
-rw-r--r--GPU3D_Soft.cpp4
-rw-r--r--main.cpp2
-rw-r--r--melonDS.depend8
4 files changed, 11 insertions, 5 deletions
diff --git a/GPU3D.cpp b/GPU3D.cpp
index e713252..7c1faae 100644
--- a/GPU3D.cpp
+++ b/GPU3D.cpp
@@ -47,6 +47,8 @@
// Z-buffering mode: val = ((Z * 0x800 * 0x1000) / W) + 0x7FFCFF
// W-buffering mode: val = W - 0x1FF
// 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
diff --git a/GPU3D_Soft.cpp b/GPU3D_Soft.cpp
index 0f8ef69..d796048 100644
--- a/GPU3D_Soft.cpp
+++ b/GPU3D_Soft.cpp
@@ -498,6 +498,10 @@ void RenderPolygon(Polygon* polygon)
s32 tr = ((perspfactorr1 * vrcur->TexCoords[1]) + (perspfactorr2 * vrnext->TexCoords[1])) / (perspfactorr1 + perspfactorr2);
if (xr == xl) xr++;
+
+ // temp.
+ if (xl > 255) continue;
+
s32 xdiv = 0x1000 / (xr - xl);
//printf("y%d: %d->%d %08X %08X\n", y, xl, xr, lfactor, rfactor);
diff --git a/main.cpp b/main.cpp
index 8f21d53..3e713da 100644
--- a/main.cpp
+++ b/main.cpp
@@ -265,7 +265,7 @@ int main()
SetWindowText(melon, melontitle);
}
}
-
+ printf("deinit\n");
NDS::DeInit();
return 0;
diff --git a/melonDS.depend b/melonDS.depend
index 4e93ed7..cecccb8 100644
--- a/melonDS.depend
+++ b/melonDS.depend
@@ -1,5 +1,5 @@
# depslib dependency file v1.0
-1487356459 source:c:\documents\sources\melonds\main.cpp
+1488636452 source:c:\documents\sources\melonds\main.cpp
<stdio.h>
<windows.h>
"NDS.h"
@@ -10,7 +10,7 @@
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>
<string.h>
"NDS.h"
@@ -87,7 +87,7 @@
"NDS.h"
"SPI.h"
-1488594249 source:c:\documents\sources\melonds\gpu2d.cpp
+1488635396 source:c:\documents\sources\melonds\gpu2d.cpp
<stdio.h>
<string.h>
"NDS.h"
@@ -148,7 +148,7 @@
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>
<string.h>
"NDS.h"