From a57d8b9583534ee754227448fbe4d0405516f7aa Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 30 Apr 2017 00:16:33 +0000 Subject: [PATCH] mmc5 - fix oldppu 2007 reads, and tidy --- trunk/src/boards/mmc5.cpp | 16 ++++++---------- trunk/src/ppu.cpp | 11 ++++++++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/trunk/src/boards/mmc5.cpp b/trunk/src/boards/mmc5.cpp index 98d996a6..d70feb6b 100644 --- a/trunk/src/boards/mmc5.cpp +++ b/trunk/src/boards/mmc5.cpp @@ -119,7 +119,7 @@ uint8* MMC5BGVRAMADR(uint32 A) { if(Sprite16) { - bool isPattern = PPUON; + bool isPattern = !!PPUON; if (ppuphase == PPUPHASE_OBJ && isPattern) return &ABANKS[(A) >> 10][(A)]; if (ppuphase == PPUPHASE_BG && isPattern) @@ -129,7 +129,7 @@ uint8* MMC5BGVRAMADR(uint32 A) else return &BBANKS[(A) >> 10][(A)]; } - else return &ABANKS[(A) >> 10][(A)];; + else return &ABANKS[(A) >> 10][(A)]; } static void mmc5_PPUWrite(uint32 A, uint8 V) { @@ -177,7 +177,7 @@ uint8 FASTCALL mmc5_PPURead(uint32 A) { if(Sprite16) { - bool isPattern = PPUON; + bool isPattern = !!PPUON; if (ppuphase == PPUPHASE_OBJ && isPattern) return ABANKS[(A) >> 10][(A)]; if (ppuphase == PPUPHASE_BG && isPattern) @@ -242,15 +242,11 @@ uint8 FASTCALL mmc5_PPURead(uint32 A) if((A&0x3FF)>=0x3C0) { uint8 byte = ExRAM[NTRefreshAddr & 0x3ff]; - //get attribute part + //get attribute part and paste it 4x across the byte byte >>= 6; - //adjust it to the right position within the byte - int x = NTRefreshAddr&31; - int y = NTRefreshAddr>>5; - if(y&2) byte <<= 4; - if(x&2) byte <<= 2; + byte *= 0x55; return byte; - } + } } return vnapage[(A >> 10) & 0x3][A & 0x3FF]; diff --git a/trunk/src/ppu.cpp b/trunk/src/ppu.cpp index ee043a70..992435c9 100644 --- a/trunk/src/ppu.cpp +++ b/trunk/src/ppu.cpp @@ -706,6 +706,8 @@ static DECLFR(A2007) { RefreshAddr = ppur.get_2007access(); return ret; } else { + + //OLDPPU FCEUPPU_LineUpdate(); if (tmp >= 0x3F00) { // Palette RAM tied directly to the output data, without VRAM buffer @@ -735,9 +737,16 @@ static DECLFR(A2007) { if (PPU_hook) PPU_hook(tmp); PPUGenLatch = VRAMBuffer; if (tmp < 0x2000) { + if (debug_loggingCD) LogAddress = GetCHRAddress(tmp); - VRAMBuffer = VPage[tmp >> 10][tmp]; + if(MMC5Hack) + { + //probably wrong CD logging in this case... + VRAMBuffer = *MMC5BGVRAMADR(tmp); + } + else VRAMBuffer = VPage[tmp >> 10][tmp]; + } else if (tmp < 0x3F00) VRAMBuffer = vnapage[(tmp >> 10) & 0x3][tmp & 0x3FF]; }