aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2018-12-09 01:26:51 +0100
committerStapleButter <thetotalworm@gmail.com>2018-12-09 01:26:51 +0100
commitb569c03884a8384c94187c6a7896982d42446490 (patch)
treee5d4246bd4953183e2103b8d0a9296906e8963aa /src
parent29bca33bc68610d79914484e7e34ddd4e372d07c (diff)
make it fasterer
Diffstat (limited to 'src')
-rw-r--r--src/ARM.cpp6
-rw-r--r--src/CP15.cpp3
-rw-r--r--src/DMA.cpp4
-rw-r--r--src/NDS.cpp4
4 files changed, 10 insertions, 7 deletions
diff --git a/src/ARM.cpp b/src/ARM.cpp
index 6f58343..09ee17d 100644
--- a/src/ARM.cpp
+++ b/src/ARM.cpp
@@ -506,9 +506,9 @@ s32 ARMv5::Execute()
AddCycles_C();
}
- s32 diff = Cycles - lastcycles;
- NDS::RunTimingCriticalDevices(0, diff >> ClockShift);
- lastcycles = Cycles - (diff & ClockDiffMask);
+ //s32 diff = Cycles - lastcycles;
+ //NDS::RunTimingCriticalDevices(0, diff >> ClockShift);
+ //lastcycles = Cycles - (diff & ClockDiffMask);
// TODO optimize this shit!!!
if (Halted)
diff --git a/src/CP15.cpp b/src/CP15.cpp
index 0d1be76..a23629a 100644
--- a/src/CP15.cpp
+++ b/src/CP15.cpp
@@ -24,6 +24,9 @@
// access timing for cached regions
// this would be an average between cache hits and cache misses
+// this was measured to be close to hardware average
+// a value of 1 would represent a perfect cache, but that causes
+// games to run too fast, causing a number of issues
const int kDataCacheTiming = 2;
const int kCodeCacheTiming = 1;
diff --git a/src/DMA.cpp b/src/DMA.cpp
index 90eb910..9edbf4b 100644
--- a/src/DMA.cpp
+++ b/src/DMA.cpp
@@ -246,8 +246,6 @@ s32 DMA::Run(s32 cycles)
writefn(CurDstAddr, readfn(CurSrcAddr));
cycles -= unitcycles;
- NDS::RunTimingCriticalDevices(CPU, unitcycles);
-
CurSrcAddr += SrcAddrInc<<1;
CurDstAddr += DstAddrInc<<1;
IterCount--;
@@ -310,8 +308,6 @@ s32 DMA::Run(s32 cycles)
writefn(CurDstAddr, readfn(CurSrcAddr));
cycles -= unitcycles;
- NDS::RunTimingCriticalDevices(CPU, unitcycles);
-
CurSrcAddr += SrcAddrInc<<2;
CurDstAddr += DstAddrInc<<2;
IterCount--;
diff --git a/src/NDS.cpp b/src/NDS.cpp
index 12cd8a5..28d459d 100644
--- a/src/NDS.cpp
+++ b/src/NDS.cpp
@@ -804,14 +804,18 @@ u32 RunFrame()
ndscyclestorun = ARM9->Cycles >> 1;
}
+ RunTimingCriticalDevices(0, ndscyclestorun);
+
if (CPUStop & 0x0FFF0000)
{
s32 cycles = ndscyclestorun - ARM7Offset;
+ s32 critcycles = cycles;
cycles = DMAs[4]->Run(cycles);
if (cycles > 0) cycles = DMAs[5]->Run(cycles);
if (cycles > 0) cycles = DMAs[6]->Run(cycles);
if (cycles > 0) cycles = DMAs[7]->Run(cycles);
ARM7Offset = -cycles;
+ RunTimingCriticalDevices(1, critcycles);
}
else
{