nba-emu / NanoBoyAdvance

A cycle-accurate Nintendo Game Boy Advance emulator.
GNU General Public License v3.0
955 stars 53 forks source link

Video is not correct in Final Fantasy 1 and 2 #297

Closed branchus closed 1 year ago

branchus commented 1 year ago

Windows 11 Pro - NanoBoyAdvance 1.7 Notice the bottom area, the video is not correct.

Screenshot 2023-04-29 104751

How to reproduce start the game, have couple fights, come back to village try to talk to any npc

branchus commented 1 year ago

Two more screenshots, seem it can be on bottom as well as on top.

Screenshot 2023-04-29 143210 Screenshot 2023-04-29 143249

fleroviux commented 1 year ago

This appears to be a regression from NBA 1.6. Possibly related to the PPU rewrite.

fleroviux commented 1 year ago

Looks like 1fbe80bbc61d0ade64e80e5f44a0c87e6411b9f7 is the regressing commit.

fleroviux commented 1 year ago

This was caused by a really old oversight in my code that somehow was not triggered until this recent change.

If the CPU is halted the code would check if there are any DMAs to execute and then fast-forward in time to the next hardware event. It would then check if the CPU should wake up. However it is possible that the condition for waking up the CPU becomes true during the DMA, which means that still fast-forwarding to the next event is incorrect in that case.

The fix addresses this by checking if the CPU should wake up after executing a DMA and not skipping to the next event in that case.

The corruptions should be fixed in the latest dev builds.