RockmanEXEZone / chaudloader

Mod loader for Mega Man Battle Network Legacy Collection.
https://forums.therockmanexezone.com/mmbnlc-pc-chaudloader-mod-loader-for-mega-man-batt-t16732.html
MIT License
30 stars 4 forks source link

Implement 2 methods for replacing Wems in Pck files #19

Closed StraDaMa closed 2 months ago

StraDaMa commented 2 months ago

This implements 2 lua methods for replacing wem files from the Pck files for the purposes of music modding. The underlying method is the same for both types implementations. By generating a loading a new .pck file with the same IDs as the original and loading it before the Vol1/2.pck file, when the game looks up a song by its ID it will find it in the mod .pck files before checking the Vol1/2.pck files and play the new wem. This lets modders replace music without having to permanently modify the original game files or regenerate the entire 400+MB pck file.

Method 1: chaudloader.pck.replace_wem This takes the ID being replaced and the replacment wem as parameters. After all mods add their replacement wems with this method, chaudloader generates a chaudloader.pck file in the audio folder and loads it before the volume pck file. As an example, this is a port of the existing BN5 DS music mod using this method. https://www.dropbox.com/scl/fi/51ku123q9ht9gkg43zpe2/bn5ds_music_port.zip

chaudloader.pck.replace_wem(19075677, "wem/BGM_IMPRESS.wem")
chaudloader.pck.replace_wem(51797322, "wem/BGM_SAKUGANJO_DENNOU.wem")
chaudloader.pck.replace_wem(54996477, "wem/BGM_BOSS_MAE.wem")

Method 2: chaudloader.pck.load_pck the only parameter for this function is a pck file containing the replacement wem files. For this method the pck file would have to be generated before and distributed with the mod. The function then copies it to the audio folder and loads it before the volume pck file As an example, this is a mod that replaces Virus, Boss, and Final Boss music for BN6 using this method. This also contains a python script for generating a pck file given a list of wem files and IDs. https://www.dropbox.com/scl/fi/wefjj1xahelo4heed2oby/bn6_pck_test.zip

chaudloader.pck.load_pck("bn6_mod.pck")

In the end I don't think both methods are necessary so I am going to need some feedback concerning what approach would be better for music modding.