From f65388d4a2cea6ace12d790f645c37d468e7cfc8 Mon Sep 17 00:00:00 2001 From: "SND\\shalma_cp" Date: Mon, 8 Nov 2010 02:09:55 +0000 Subject: Vampire Hunter D - gpu.c - allow changes to linked list in middle of dma2 chain before GPU gets to it - fixes title screen - also fixes Einhander gallery images git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@59304 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- libpcsxcore/gpu.c | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'libpcsxcore/gpu.c') diff --git a/libpcsxcore/gpu.c b/libpcsxcore/gpu.c index 5b2568b4..e82e45b9 100644 --- a/libpcsxcore/gpu.c +++ b/libpcsxcore/gpu.c @@ -60,8 +60,8 @@ static u32 gpuDmaChainSize(u32 addr) { lUsedAddr[0] = lUsedAddr[1] = lUsedAddr[2] = 0xffffff; - // initial linked list ptr (bytes) - size = 4; + // initial linked list ptr (word) + size = 1; do { addr &= 0x1ffffc; @@ -70,11 +70,11 @@ static u32 gpuDmaChainSize(u32 addr) { if (CheckForEndlessLoop(addr)) break; // # 32-bit blocks to transfer - size += psxMu8( addr + 3 ) * 4; + size += psxMu8( addr + 3 ); // next 32-bit pointer addr = psxMu32( addr & ~0x3 ) & 0xffffff; - size += 4; + size += 1; } while (addr != 0xffffff); return size; @@ -88,22 +88,6 @@ int gpuReadStatus() { hard = GPU_readStatus(); -#if 0 - // ePSXe 1.7.0 - Chrono Cross interlace hack - if (hard & 0x400000) { - switch (Config.PsxType) { - case PSX_TYPE_NTSC: - if (hSyncCount > 262 - 240) hard ^= 0x80000000; - break; - - case PSX_TYPE_PAL: - if (hSyncCount > 312 - 256) hard ^= 0x80000000; - break; - } - } -#endif - - // NOTE: // Backup option when plugins fail to simulate 'busy gpu' @@ -177,14 +161,11 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU #ifdef PSXDMA_LOG PSXDMA_LOG("*** DMA 2 - GPU dma chain *** %lx addr = %lx size = %lx\n", chcr, madr, bcr); #endif - GPU_dmaChain((u32 *)psxM, madr & 0x1fffff); - //size = gpuDmaChainSize(madr); - - // HACK: Rebel Assault 2 wants longer time (stage 6) - size = gpuDmaChainSize(madr) * 1.5; + // HACK: Vampire Hunter D (title screen) + size = gpuDmaChainSize(madr) * 2.5; - GPUDMA_INT(size / 4); + GPUDMA_INT(size); return; #ifdef PSXDMA_LOG @@ -199,6 +180,23 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU } void gpuInterrupt() { + /* + GPU processing during DMA2 chains + + 1 - never updates linked list (99/100 games) + + 2 - updates linked list -before- GPU gets to it + - Einhander: fixes art gallery images + post-gallery corruption (2+ cycles / 4 bytes) + - Vampire Hunter D: shows title screen (3+ cycles / 4 bytes) + + 3 - updates linked list -after- GPU reads it, -before- chain finishes + - ??? (display would fail this test) + */ + + if( HW_DMA2_CHCR == 0x01000401 ) + GPU_dmaChain((u32 *)psxM, HW_DMA2_MADR & 0x1fffff); + + HW_DMA2_CHCR &= SWAP32(~0x01000000); DMA_INTERRUPT(2); } -- cgit v1.2.3