From 8840be027c559e327433bcb4d052d130d33af772 Mon Sep 17 00:00:00 2001 From: zeromus Date: Mon, 12 Oct 2015 20:32:06 -0500 Subject: [PATCH] Revert "un-Revert "neshawk - change ppu poweron process (fixes time lord, breaks ? ? ?)""" This reverts commit a53200d98ebafa2375b0089ff7ef9104c4476802. --- .../Consoles/Nintendo/NES/PPU.regs.cs | 1 - .../Consoles/Nintendo/NES/PPU.run.cs | 42 ++++++------------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.regs.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.regs.cs index 34f1606372..203f0820d6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.regs.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.regs.cs @@ -376,7 +376,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES { Reg2002_objhit = Reg2002_objoverflow = 0; Reg2002_vblank_clear_pending = true; - //TODO - unfreeze ppu registers after poweron } //OAM ADDRESS (write) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs index 0be21faf44..f06cd93649 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/PPU.run.cs @@ -102,7 +102,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES { BGDataRecord *bgdata = stackalloc BGDataRecord[34]; //one at the end is junk, it can never be rendered - if(ppudead != 0) + //262 scanlines + if (ppudead != 0) { FrameAdvance_ppudead(); return; @@ -127,7 +128,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES runppu(postNMIlines * kLineTime - delay); //this seems to run just before the dummy scanline begins - //ACTUALLY. it should run 3 cycles later clear_2002(); TempOAM* oams = stackalloc TempOAM[128]; @@ -448,33 +448,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES void FrameAdvance_ppudead() { - if (ppudead == 2) - { - //"dead frame 0:" - - //run scanlines 0 through 239. - runppu(240 * kLineTime); - - //ok, that was a long time. let's call it a frame - } - - if (ppudead == 1) - { - //"dead frame 1:" - - //run pre-nmi idle (normally 1 scanline, sometimes longer) - runppu(preNMIlines * kLineTime); - - //we're at the line where NMI is triggered. it happens 1 cycle in, but we're not worrying about that now. - - //well, look at that. its time to begin the next frame in the normal FrameAdvance method - - //this frame wasn't very long compared to the other one. oh well - //we need to keep 2 dead frames to keep from ruining old movies.. - //i hope the basic timing changes doesnt wreck anything's logic. - } - - ppudead--; + //not quite emulating all the NES power up behavior + //since it is known that the NES ignores writes to some + //register before around a full frame, but no games + //should write to those regs during that time, it needs + //to wait for vblank + ppur.status.sl = 241; + runppu(postNMIlines * kLineTime); + ppur.status.sl = 0; + runppu(241 * kLineTime); + runppu(preNMIlines * kLineTime); + --ppudead; } } }