libgme / game-music-emu

Blargg's video game music emulation library, which allows audio applications to easily add playback support for the music of many classic video game consoles.
GNU Lesser General Public License v2.1
68 stars 12 forks source link

Inaccurate GB sound emulation #22

Closed Wohlstand closed 3 years ago

Wohlstand commented 6 years ago

Original report by Anonymous.


Tried the library on the first soundtrack that came to my mind: Pokemon Red. Compiled the "player" demo, and ran it on this gbs: https://www.zophar.net/music/gameboy-gbs/pokemon-red

In the very first track, noise percussion is clearly out of sync. (You can compare it with streamed audio on Zophar's Domain).

What is even stranger is that deadbeef supposedly uses GME under the hood, but this track plays fine there...

Wohlstand commented 6 years ago

Original comment by Michael Pyne (Bitbucket: mpyne, GitHub: mpyne).


Thanks for the report. It's possible that the emulation was broken in between the version used by deadbeef and git-master with some of the security fixes applied.

I had started on a test suite to at least document when file outputs change between libgme versions, but it's both slow and still hard to use.

Wohlstand commented 3 years ago

Original comment by Leandro Nini (Bitbucket: [Leandro Nini](https://bitbucket.org/Leandro Nini), ).


The problem here is that the AF register is inverted. This is noticeable when pushing it on the stack and accessing the stack bytes directly. Grandia is affected too.

A fix is coming

Wohlstand commented 3 years ago

Original comment by Michael Pyne (Bitbucket: mpyne, GitHub: mpyne).


Register A and F are inverted in position so swap them when pushing/pulling from the stack. Fixes issue #20