fix newppu rendering of justbreed BG (due to extended nametable mode). did i break other mmc5 games?

This commit is contained in:
zeromus 2016-12-26 23:38:07 +00:00
parent 2c80da6cc7
commit 3f0647fb5f
2 changed files with 20 additions and 9 deletions

View File

@ -136,16 +136,27 @@ static void mmc5_PPUWrite(uint32 A, uint8 V) {
}
}
extern uint32 NTRefreshAddr;
uint8 FASTCALL mmc5_PPURead(uint32 A) {
if (A < 0x2000) {
if (ppuphase == PPUPHASE_BG
if (A < 0x2000)
{
if (ppuphase == PPUPHASE_BG )
{
//uhhh call through to this more sophisticated function, only if it's really needed?
//we should probably reuse it completely, if we can
if (MMC5HackCHRMode == 1) {
return *FCEUPPU_GetCHR(A,NTRefreshAddr);
}
//zero 03-aug-2014 - added this to fix Uchuu Keibitai SDF. The game reads NT entries from CHR rom while PPU is disabled.
//obviously we have enormous numbers of bugs springing from our terrible emulation of ppu-disabled states, but this does the job for fixing this one
&& (PPU[1] & 0x10)
)
return *MMC5BGVRAMADR(A);
else return MMC5SPRVPage[(A) >> 10][(A)];
} else {
if(PPU[1] & 0x10)
return *MMC5BGVRAMADR(A);
}
return MMC5SPRVPage[(A) >> 10][(A)];
}
else
{
return vnapage[(A >> 10) & 0x3][A & 0x3FF];
}
}

View File

@ -351,7 +351,7 @@ uint8 vtoggle = 0;
uint8 XOffset = 0;
uint8 SpriteDMA = 0; // $4014 / Writing $xx copies 256 bytes by reading from $xx00-$xxFF and writing to $2004 (OAM data)
uint32 TempAddr = 0, RefreshAddr = 0, DummyRead = 0;
uint32 TempAddr = 0, RefreshAddr = 0, DummyRead = 0, NTRefreshAddr = 0;
static int maxsprites = 8;
@ -1970,7 +1970,7 @@ struct BGData {
uint8 nt, pecnt, at, pt[2];
INLINE void Read() {
RefreshAddr = ppur.get_ntread();
NTRefreshAddr = RefreshAddr = ppur.get_ntread();
if (PEC586Hack)
ppur.s = (RefreshAddr & 0x200) >> 9;
pecnt = (RefreshAddr & 1) << 3;