pret / pokeruby

Decompilation of Pokémon Ruby/Sapphire
799 stars 224 forks source link

Make a seperate repository for the GBA-Soundlibrary #54

Open JaceCear opened 8 years ago

JaceCear commented 8 years ago

This would help other GBA-Reverse Engineering projects immensely and allow for improvements more easily/efficiently. I imagine it being compilable in these steps:

ghost commented 8 years ago

There are many variations of the sound library. The particular version in this repo is only used in Pokémon Ruby, Sapphire, Fire Red, Leaf Green, and Emerald. It has been modified to support playing Pokémon cries. I haven't tried to decompile versions of the library used in any other GBA games, so I am not sure how much work it would be to convert this version.

JaceCear commented 8 years ago

Well, I can say that Sonic Advance 3 uses almost 1:1 of another library I found online, except 2 functions being slightly different and 2-3 small functions added. But since I don't know whether that's an official one by Nintendo (which is likely hence the ~99% equality), we obviously can't use that for our own projects. All in all it doesn't really matter, which version is being used in an OpenSource variant I would say, since almost no GBA-games use proprietary ones and I assume if we decompile one out of the later games (like Pokémon Emerald or SA3) it's more likely close to being the final (or most reliable) version. Are you sure that the cry-routines aren't just added by GameFreak and the "official" music-library isn't still intact? I never dug too much into Gen 3's cries but I remember that there was just a decompression algorithm which put out the Cry-Samples as "normal" sound samples into the Direct Sound channels, which can either be done manually or by calling the libarary.

camthesaxman commented 8 years ago

The m4a library was included in Nintendo's Gameboy Advance SDK, so it was used by many (but not all) games. I think it was just distributed as a .o file without source code, which would be difficult to modify. I haven't peeked into the sound code too much, but the struct named PokemonCrySong is probably not just for Pokémon cries, and could be used for other stuff, though this game uses it to implement Pokémon cries. We haven't reverse engineered all of the m4a code, yet. There are still some unknown functions in m4a_1.s, which was likely written in assembly, and there's one rather large function in m4a_3.s, which was likely written in C.

ghost commented 8 years ago

While I haven't attempted to fully decompile any other games' sound driver code, as I said, I have looked at several other games and none have the cry functions.

Incineroar commented 7 years ago

@YamaArashi

While I haven't attempted to fully decompile any other games' sound driver code, as I said, I have looked at several other games and none have the cry functions.

Have you considered looking at non-M4A audio engines, just out of sheer curiosity?

ghost commented 7 years ago

Not too much. I did look at the sound engine used in the Super Mario Advance series a bit. I assume they used a different engine so they could use data from the SNES games more easily, although the result wasn't that great.

PikalaxALT commented 4 years ago

lol is this even still relevant?