RaymanControlPanel icon indicating copy to clipboard operation
RaymanControlPanel copied to clipboard

[Feature Rquest] Add support for Rayman Origins 3DS .ipk files

Open Adamillo opened this issue 2 years ago • 21 comments

The reason is that I'm working on a (very early WIP) mod that replaces the muddy audio inside the 3DS version of Rayman Origins to higher quality audio included in the PC version of Rayman Origins, but I can't repackage the changes back to an .ipk file, since I can only extract the 3DS .ipk file using a quickbms script, not repackage it

Adamillo avatar Apr 09 '24 18:04 Adamillo

Hi! That sounds interesting! 🙂 I'll go ahead and add support for Origins 3DS support for the next update. The .ipk files are structured a bit differently, but I'm familiar with the format and it shouldn't be too hard to add. I'll comment here again once the update is out. Good luck with your mod!

RayCarrot avatar Apr 09 '24 19:04 RayCarrot

I've now released the beta for the next RCP update, adding support for Rayman Origins 3DS .ipk files there. I'll close the issue now, but please let me know if there are any issues with it!

RayCarrot avatar Apr 17 '24 16:04 RayCarrot

Unfortunately when I try to load up the modified IPK as romfs the game does not boot at all. To make sure that my mod wasn't the issue I simply replaced the mus_main_menu.wav file inside the 3DS IPK with the same exact mus_main_menu.wav from the extracted 3DS IPK from quickbms and it still didn't boot. I tested it with Citra. Don't be fooled by the file name btw, the structure of the audio files on the 3DS version is quite different and cannot be easily loaded up with tools like Audacity. Internally, the audio files are Nintendo's BCWAV format and this game uses ADPCM 4-bit

Adamillo avatar Apr 17 '24 17:04 Adamillo

I don't have the tools needed to test it myself but I think I found the issue. Can you test out this (had to upload to google drive since it's too big to upload here)? If this fixes the issue then I'll release this as a new bug fix update.

RayCarrot avatar Apr 17 '24 17:04 RayCarrot

The build from Google Drive didn't fix the issue

Adamillo avatar Apr 17 '24 17:04 Adamillo

Oh nvm it does work correctly in that google drive build. I still had the broken IPK. Now to see if the mod works... Edit: The mod doesn't seem to work, it's just completely silent, hmm

Adamillo avatar Apr 17 '24 18:04 Adamillo

Strange, the game refuses to output any of the replaced audio that I throw at it. Doesn't matter if it's PCM16, PCM8 or DSPADPCM, at least in the BCWAV format. Wonder if it'll maybe accept normal WAV file, probably not, but it's worth a try Edit: Nope, it doesn't accept the normal WAV file either...

Adamillo avatar Apr 17 '24 18:04 Adamillo

Great that repacking the ipk works now! I'll release this as a bug fix update then. As for replacing the audio file, how are you doing it? I'm thinking there might be some values in the file header that need to change besides just the audio data itself. At least that's the case for the texture files which have a custom header before the data itself.

RayCarrot avatar Apr 17 '24 18:04 RayCarrot

I'm using something called cwavtool in order to convert a normal WAV file to the BCWAV file format. It's a command line tool, and here's the link to it: https://github.com/PabloMK7/cwavtool

Adamillo avatar Apr 17 '24 19:04 Adamillo

Seems like it even refuses to load the replaced audio on mono, 11KHz and DSPADPCM with my audio, even though the game uses those exact audio file configurations to play. Wonder what's making it refuse to output the audio...

Adamillo avatar Apr 17 '24 19:04 Adamillo

Can you upload one of your custom wav files? I could have a quick look and see if I notice anything with the headers. (btw, I published a new beta update now with the bug fix from the build I sent you)

RayCarrot avatar Apr 17 '24 19:04 RayCarrot

Alrighty then. Here's the custom audio. It has the same configuration as the original one, at least in theory: https://drive.google.com/file/d/1pupPxmKXJoJZxNcskUbObO9AM1V51z_H/view?usp=sharing I also recommend using DSP LLE on Citra, since the output of DSP HLE is a little messy in this game

Adamillo avatar Apr 17 '24 19:04 Adamillo

DSP LLE is slower though, so keep that in mind if you don't have a powerful CPU. If you don't like the way it stretches the audio when it slows down, you can disable that too. Though it will crackle when it slows down this time, but if you strangely prefer that like I do then you can leave it turned off like it did

Adamillo avatar Apr 17 '24 19:04 Adamillo

Try this and see if it works: mus_menu_main_custom.zip

RayCarrot avatar Apr 17 '24 19:04 RayCarrot

What changed in that audio file?

Adamillo avatar Apr 17 '24 19:04 Adamillo

The game appears to contain the CWAV file data inside of a RIFF header. So I added the RIFF header to the beginning of the file: HxD_JWuK8ERDdc I'm not sure if this will work, but this is how all the other .wav files are structured in the game.

RayCarrot avatar Apr 17 '24 19:04 RayCarrot

Unfortunately that didn't work...

Adamillo avatar Apr 17 '24 19:04 Adamillo

It seems that there is still a difference between the 2 files. Maybe the game has a checksum? image

Adamillo avatar Apr 17 '24 19:04 Adamillo

The audio data is completely different in the two files yeah. I don't really know anything about this format or how the tool works though, so not sure why.

RayCarrot avatar Apr 17 '24 20:04 RayCarrot

Could we debug this somehow? With an emulator like Citra we could find out what the game is doing and why it refuses to load the audio, right?

Adamillo avatar Apr 18 '24 10:04 Adamillo