project-slippi / Ishiiruka

GNU General Public License v2.0
330 stars 142 forks source link

feat: add menu + stage music support #386

Closed DarylPinto closed 1 year ago

DarylPinto commented 1 year ago

What is this?

In a nutshell, this feature brings music back to Slippi Online. By checking the following box, game music will be restored: image

How does it work?

When the checkbox is toggled on, a pair of threads that are completely detached from emulation are spawned. These threads read from game memory to determine which music tracks should be played. When a track should play, a chunk of the iso containing the song is loaded into memory, decoded into audio and played back over the default audio device. No external audio files are used and nothing is ever written to disk.

Features

  1. Alternate stage music has a 12.5% chance of playing. Holding triggers to force alternate tracks to play is not supported.

  2. In some 1P modes, stage music will differ from vs mode. This behavior is not supported by jukebox. Additionally, the following songs will not play:

    • Classic "Stage Clear" Jingle
    • Classic "Continue?" and "Game Over" Jingles
    • Credits music
    • Post-credits congratulations fmv music

Limitations

Technical Details

The code that adds music support can be found here:

This pull request includes the addition of a Rust submodule, a first for the project. See this comment for details about Rust's integration into Slippi.

ryanmcgrath commented 1 year ago

🐸x 🦀

Just adding on some notes and context to DRL's amazing work to get music back into the game.

In order to facilitate using a Rust lib, I had to make some changes to the Dolphin codebase and build process. A general changelog is below but can expand on anything as needed:

(Edit) one more bit of context:

ryanmcgrath commented 1 year ago

(@eigenform may be a good candidate for extra eyes on this with regards to the C++/C/Rust interactions)