summaryrefslogtreecommitdiff
path: root/libpcsxcore/gpu.c
diff options
context:
space:
mode:
authorSND\shalma_cp <SND\shalma_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-09-16 00:48:29 +0000
committerSND\shalma_cp <SND\shalma_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-09-16 00:48:29 +0000
commit111694051e4f2f22a8da02c7acaaecfed623703c (patch)
tree3034e6f43a71db0c8ffb80de740a85d4858a719b /libpcsxcore/gpu.c
parent177c42d1148d60947b039c47fedf58007cf4219b (diff)
downloadpcsxr-111694051e4f2f22a8da02c7acaaecfed623703c.tar.gz
Rebel Assault 2
- MDEC: Fix DMA timing (byte ptrs) - GPU: Fix DMA timing (word sizes, chain counting) git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@57226 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore/gpu.c')
-rw-r--r--libpcsxcore/gpu.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/libpcsxcore/gpu.c b/libpcsxcore/gpu.c
index 4388cfee..5b2568b4 100644
--- a/libpcsxcore/gpu.c
+++ b/libpcsxcore/gpu.c
@@ -55,21 +55,26 @@ static inline boolean CheckForEndlessLoop(u32 laddr) {
}
static u32 gpuDmaChainSize(u32 addr) {
- unsigned int DMACommandCounter = 0;
- u32 size = 0;
+ u32 size;
+ u32 DMACommandCounter = 0;
lUsedAddr[0] = lUsedAddr[1] = lUsedAddr[2] = 0xffffff;
+ // initial linked list ptr (bytes)
+ size = 4;
+
do {
addr &= 0x1ffffc;
if (DMACommandCounter++ > 2000000) break;
if (CheckForEndlessLoop(addr)) break;
- size += 4;
- size += psxMu8(addr + 3);
+ // # 32-bit blocks to transfer
+ size += psxMu8( addr + 3 ) * 4;
- addr = psxMu32(addr & ~0x3) & 0xffffff;
+ // next 32-bit pointer
+ addr = psxMu32( addr & ~0x3 ) & 0xffffff;
+ size += 4;
} while (addr != 0xffffff);
return size;
@@ -140,11 +145,13 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU
#endif
break;
}
+ // BA blocks * BS words (word = 32-bits)
size = (bcr >> 16) * (bcr & 0xffff);
GPU_readDataMem(ptr, size);
psxCpu->Clear(madr, size);
- GPUDMA_INT(size / 4);
+ // already 32-bit word size ((size * 4) / 4)
+ GPUDMA_INT(size);
return;
case 0x01000201: // mem2vram
@@ -158,10 +165,12 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU
#endif
break;
}
+ // BA blocks * BS words (word = 32-bits)
size = (bcr >> 16) * (bcr & 0xffff);
GPU_writeDataMem(ptr, size);
- GPUDMA_INT(size / 4);
+ // already 32-bit word size ((size * 4) / 4)
+ GPUDMA_INT(size);
return;
case 0x01000401: // dma chain
@@ -170,7 +179,11 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU
#endif
GPU_dmaChain((u32 *)psxM, madr & 0x1fffff);
- size = gpuDmaChainSize(madr);
+ //size = gpuDmaChainSize(madr);
+
+ // HACK: Rebel Assault 2 wants longer time (stage 6)
+ size = gpuDmaChainSize(madr) * 1.5;
+
GPUDMA_INT(size / 4);
return;