Skip to content

Fix sound effects in Koei games by adding missing MMC5 features#805

Open
awjackson wants to merge 1 commit intoTASEmulators:masterfrom
awjackson:mmc5
Open

Fix sound effects in Koei games by adding missing MMC5 features#805
awjackson wants to merge 1 commit intoTASEmulators:masterfrom
awjackson:mmc5

Conversation

@awjackson
Copy link
Copy Markdown
Contributor

This patch implements the length counters and envelopes for the MMC5 pulse channels, fixing missing sound effects in the Japanese versions of various Koei games. It also halves the volume of the MMC5 pulse channels to bring them in line with the APU channels.

I've hooked up the 240Hz "frame" sequencer via MapIRQHook, which makes me vaguely queasy since it has nothing to do with IRQs, but I don't see a better way of doing it, and it matches how the corresponding sequencer in the NES APU is hooked up (MapIRQHook and FCEU_SoundCPUHook are called from the same place in the CPU loop, with the same argument).

This patch probably breaks compatibility with existing savestates and movies for MMC5 games since it adds a whole bunch of saved state variables to the mapper (and deletes one).

@awjackson
Copy link
Copy Markdown
Contributor Author

Missing sound effects in Koei games is Sourceforge bug 797

@awjackson
Copy link
Copy Markdown
Contributor Author

Since this pull has been sitting idle for more than half a year, I checked save state compatibility and there actually seems to be no problem? FCEUX's save state handling must be more robust than I thought. Steps followed:

  • Made a FCEUX build without this patch.
  • Loaded Nobunaga no Yabou: Sengoku Gunyuu Den (JP version of Nobunaga's Ambition II; has a very obvious wrong sound effect on the title screen if MMC5 length counters aren't implemented)
  • Made a save state right before the wrong sound effect plays.
  • Made a second FCEUX build with this patch applied.
  • Loaded the save state that was made on the unpatched build.
  • Result: Not only does the state load successfully, the title screen sound effect plays correctly!

So I don't see any reason this pull can't be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant