aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2019-03-25 23:48:57 +0200
committerGitHub2019-03-25 23:48:57 +0200
commit9d3801c90db3dee73a7a30d898857ad1a5821e59 (patch)
tree164816528c484d0dffd7a7aba79e1febed2673c5
parent90f000f6c23cf8a17c14c0149de4916ea63f373e (diff)
parent8cb04d2205b117d583b3cc4085fab4a285b74ce2 (diff)
downloadpcsx_rearmed-9d3801c90db3dee73a7a30d898857ad1a5821e59.tar.gz
pcsx_rearmed-9d3801c90db3dee73a7a30d898857ad1a5821e59.tar.bz2
pcsx_rearmed-9d3801c90db3dee73a7a30d898857ad1a5821e59.zip
Merge pull request #127 from retro-wertz/fix_rtps_rtpt
gte: backport fix for RTPS/RTPT
-rw-r--r--libpcsxcore/gte.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libpcsxcore/gte.c b/libpcsxcore/gte.c
index 31213ef..77dff1b 100644
--- a/libpcsxcore/gte.c
+++ b/libpcsxcore/gte.c
@@ -404,6 +404,7 @@ static u32 DIVIDE_(s16 n, u16 d) {
void gteRTPS(psxCP2Regs *regs) {
int quotient;
+ s64 tmp;
#ifdef GTE_LOG
GTE_LOG("GTE RTPS\n");
@@ -426,14 +427,16 @@ void gteRTPS(psxCP2Regs *regs) {
gteSX2 = limG1(F((s64)gteOFX + ((s64)gteIR1 * quotient)) >> 16);
gteSY2 = limG2(F((s64)gteOFY + ((s64)gteIR2 * quotient)) >> 16);
- gteMAC0 = F((s64)gteDQB + ((s64)gteDQA * quotient));
- gteIR0 = limH(gteMAC0 >> 12);
+ tmp = (s64)gteDQB + ((s64)gteDQA * quotient);
+ gteMAC0 = F(tmp);
+ gteIR0 = limH(tmp >> 12);
}
void gteRTPT(psxCP2Regs *regs) {
int quotient;
int v;
s32 vx, vy, vz;
+ s64 tmp;
#ifdef GTE_LOG
GTE_LOG("GTE RTPT\n");
@@ -456,8 +459,10 @@ void gteRTPT(psxCP2Regs *regs) {
fSX(v) = limG1(F((s64)gteOFX + ((s64)gteIR1 * quotient)) >> 16);
fSY(v) = limG2(F((s64)gteOFY + ((s64)gteIR2 * quotient)) >> 16);
}
- gteMAC0 = F((s64)gteDQB + ((s64)gteDQA * quotient));
- gteIR0 = limH(gteMAC0 >> 12);
+
+ tmp = (s64)gteDQB + ((s64)gteDQA * quotient);
+ gteMAC0 = F(tmp);
+ gteIR0 = limH(tmp >> 12);
}
void gteMVMVA(psxCP2Regs *regs) {