apply r7371 from bizhawk to mmc5 IRQ handling to fix metal slader glory credits. this may have impact in other MMC5 programs; not tested
This commit is contained in:
parent
20d0e3d6c2
commit
6e3567ad16
|
@ -512,21 +512,40 @@ void MMC5Synco(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMC5_hb(int scanline) {
|
void MMC5_hb(int scanline) {
|
||||||
if (scanline == 240) {
|
//zero 24-jul-2014 - revised for newer understanding, to fix metal slader glory credits. see r7371 in bizhawk
|
||||||
|
|
||||||
|
int sl = scanline + 1;
|
||||||
|
int ppuon = (PPU[1] & 0x18);
|
||||||
|
|
||||||
|
if (!ppuon || sl >= 241)
|
||||||
|
{
|
||||||
|
// whenever rendering is off for any reason (vblank or forced disable
|
||||||
|
// the irq counter resets, as well as the inframe flag (easily verifiable from software)
|
||||||
|
MMC5IRQR &= ~0x40;
|
||||||
|
MMC5IRQR &= ~0x80;
|
||||||
MMC5LineCounter = 0;
|
MMC5LineCounter = 0;
|
||||||
MMC5IRQR = 0x40;
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (MMC5LineCounter < 240) {
|
|
||||||
if (MMC5LineCounter == IRQScanline) {
|
if (!(MMC5IRQR&0x40))
|
||||||
|
{
|
||||||
|
MMC5IRQR |= 0x40;
|
||||||
|
MMC5IRQR &= ~0x80;
|
||||||
|
MMC5LineCounter = 0;
|
||||||
|
X6502_IRQEnd(FCEU_IQEXT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MMC5LineCounter++;
|
||||||
|
if (MMC5LineCounter == IRQScanline)
|
||||||
|
{
|
||||||
MMC5IRQR |= 0x80;
|
MMC5IRQR |= 0x80;
|
||||||
if (IRQEnable & 0x80)
|
if (IRQEnable & 0x80)
|
||||||
X6502_IRQBegin(FCEU_IQEXT);
|
X6502_IRQBegin(FCEU_IQEXT);
|
||||||
}
|
}
|
||||||
MMC5LineCounter++;
|
|
||||||
}
|
}
|
||||||
if (MMC5LineCounter == 240)
|
|
||||||
MMC5IRQR = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMC5_StateRestore(int version) {
|
void MMC5_StateRestore(int version) {
|
||||||
|
|
|
@ -1221,7 +1221,7 @@ static void DoLine(void) {
|
||||||
int x;
|
int x;
|
||||||
uint8 *target = XBuf + (scanline << 8);
|
uint8 *target = XBuf + (scanline << 8);
|
||||||
|
|
||||||
if (MMC5Hack && (ScreenON || SpriteON)) MMC5_hb(scanline);
|
if (MMC5Hack) MMC5_hb(scanline);
|
||||||
|
|
||||||
X6502_Run(256);
|
X6502_Run(256);
|
||||||
EndRL();
|
EndRL();
|
||||||
|
@ -1790,7 +1790,7 @@ int FCEUPPU_Loop(int skip) {
|
||||||
DEBUG(FCEUD_UpdatePPUView(scanline, 1));
|
DEBUG(FCEUD_UpdatePPUView(scanline, 1));
|
||||||
DoLine();
|
DoLine();
|
||||||
}
|
}
|
||||||
if (MMC5Hack && (ScreenON || SpriteON)) MMC5_hb(scanline);
|
if (MMC5Hack) MMC5_hb(scanline);
|
||||||
for (x = 1, max = 0, maxref = 0; x < 7; x++) {
|
for (x = 1, max = 0, maxref = 0; x < 7; x++) {
|
||||||
if (deempcnt[x] > max) {
|
if (deempcnt[x] > max) {
|
||||||
max = deempcnt[x];
|
max = deempcnt[x];
|
||||||
|
@ -2033,7 +2033,7 @@ int FCEUX_PPU_Loop(int skip) {
|
||||||
DEBUG(FCEUD_UpdateNTView(scanline = yp, 1));
|
DEBUG(FCEUD_UpdateNTView(scanline = yp, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sl != 0) if (MMC5Hack && PPUON) MMC5_hb(yp);
|
if (MMC5Hack) MMC5_hb(yp);
|
||||||
|
|
||||||
|
|
||||||
//twiddle the oam buffers
|
//twiddle the oam buffers
|
||||||
|
@ -2303,7 +2303,7 @@ int FCEUX_PPU_Loop(int skip) {
|
||||||
runppu(1);
|
runppu(1);
|
||||||
} //scanline loop
|
} //scanline loop
|
||||||
|
|
||||||
if (MMC5Hack && PPUON) MMC5_hb(240);
|
if (MMC5Hack) MMC5_hb(240);
|
||||||
|
|
||||||
//idle for one line
|
//idle for one line
|
||||||
runppu(kLineTime);
|
runppu(kLineTime);
|
||||||
|
|
Loading…
Reference in New Issue