EmulatorArchive / gb-enhanced

Automatically exported from code.google.com/p/gb-enhanced
2 stars 0 forks source link

LoZ Oracle games experience lag #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Load Oracle of Ages or Oracle of Seasons. Specifically, play enough to 
obtain a sword, explore outside town.
2. The "overworld" will slightly lag (video and audio will slowdown ever so 
slightly).

What is the expected output? What do you see instead?
The game should not experience a dip in speed of any sort.

Original issue reported on code.google.com by shon...@gmail.com on 27 May 2014 at 2:51

GoogleCodeExporter commented 9 years ago
This isn't some coding issue on the part of Nintendo. The game does not slow 
down on a real CGB unit. The issue is possibly inaccurate timing from the CPU 
(which would also affect the LCD). 

Even though the APU currently is not cycle-based, the music probably slows down 
because the CPU isn't setting the correct MMIO registers fast enough, and GBE 
plays certain notes longer than they should.

Interestingly enough this is not a bottleneck in GBE as a program. During the 
lag, the emulated LCD does not report abnormally late blits (so it's running at 
60 FPS). As a matter of accuracy, GBE should aim for getting the cycles correct 
anyway.

Original comment by shon...@gmail.com on 27 May 2014 at 2:56

GoogleCodeExporter commented 9 years ago
The problem could just be with the APU itself. I know these games rely on 
setting the correct bits in the NRxx MMIO registers that indicate whenever a 
sound is finished playing. It's conceivable that the games actually halt 
processing the rest of the game logic until it can be sure the next note needs 
to be played.

Essentially: CPU sets NRxx MMIO register -> APU plays sound -> CPU continues 
game logic -> CPU keeps checking status of the NRxx register until it gets what 
it's looking for -> Repeat

If the emulated APU is actually being slower than expected (since it operates 
in real-time, not based on cycles, this is very likely in many cases, but 
unnoticeable ordinarily) it could actually hold up execution of the game logic. 
Fwiw, Oracle of Seasons at least seems to slow down during certain musical 
segments of the game's version of the "Hyrule Field" tune.

Original comment by shon...@gmail.com on 28 May 2014 at 5:10

GoogleCodeExporter commented 9 years ago
Confirming this is an APU issue. Artificially slowing down APU emulation (while 
maintaining CPU and LCD emulation speed) drops the in-game speed when playing 
in the overworld. Dungeons and towns are unaffected. 

Interesting that Nintendo would do something like that.

Original comment by shon...@gmail.com on 29 May 2014 at 3:49