diff --git a/create_mm_audiobin README.txt b/create_mm_audiobin README.txt new file mode 100644 index 00000000..d4402d04 --- /dev/null +++ b/create_mm_audiobin README.txt @@ -0,0 +1,16 @@ +Majora's Mask Audio Bin Generator + +This script automates the creation of an MM Audio Bin file for The Legend of Zelda: Majora's Mask. With this tool, you can easily integrate custom music into the game. + +This script requires a decompressed ROM file of the US version of Majora's Mask to function correctly. + +Usage +- Simply drag and drop your decompressed US-Majora's Mask ROM onto the script. +- The script will generate the MM-Audio.bin file automatically. +- Move the MM-Audio.bin file to your .../Data/Music folder. + +Enjoy the enhanced experience with custom music from Majoras Mask Randomizer in Ocarina of Time Randomizer!' + +IMPORTANT: +For the time being i suggest not using the "Display Custom Music Names" Option, due to it showing you under circumstances the full path of the file used instead of the Cusom Music Title. +Also given MMR Music is not "copyright issue" checked as DJ. Use at your own risk. \ No newline at end of file diff --git a/create_mm_audiobin.py b/create_mm_audiobin.py new file mode 100644 index 00000000..0c108d7a --- /dev/null +++ b/create_mm_audiobin.py @@ -0,0 +1,71 @@ +import os +import sys +import shutil + +AudioBank_Index_Offset = 0x00C776C0 +AudioBank_Index_Size = 0x000002A0 +AudioBank_Offset = 0x00020700 +AudioBank_Size = 0x000263F0 +AudioTable_Index_Offset = 0x00C78380 +AudioTable_Index_Size = 0x00000040 +AudioTable_Offset = 0x00097F70 +AudioTable_Size = 0x00548770 + +def main(): + if len(sys.argv) != 2: + print("Usage: python mm_audiobin.py ") + sys.exit(1) + + input_file = sys.argv[1] + + if not os.path.exists(input_file): + print(f"Error: The file {input_file} does not exist.") + sys.exit(1) + + tmp_directory = "tmp" + parent_directory = os.path.dirname(os.path.abspath(__file__)) + + path = os.path.join(parent_directory, tmp_directory) + + os.makedirs(path, mode=0o777, exist_ok=True) + + with open(input_file, 'rb') as rom: + rom.seek(AudioBank_Index_Offset) + Audiobank_Index = rom.read(AudioBank_Index_Size) + file_name = "Audiobank_Index" + file_path = os.path.join(tmp_directory, file_name) + with open(file_path, "wb") as file: + file.write(Audiobank_Index) + + rom.seek(AudioBank_Offset) + Audiobank = rom.read(AudioBank_Size) + file_name = "Audiobank" + file_path = os.path.join(tmp_directory, file_name) + with open(file_path, "wb") as file: + file.write(Audiobank) + + rom.seek(AudioTable_Index_Offset) + Audiotable_Index = rom.read(AudioTable_Index_Size) + file_name = "Audiotable_Index" + file_path = os.path.join(tmp_directory, file_name) + with open(file_path, "wb") as file: + file.write(Audiotable_Index) + + rom.seek(AudioTable_Offset) + Audiotable = rom.read(AudioTable_Size) + file_name = "Audiotable" + file_path = os.path.join(tmp_directory, file_name) + with open(file_path, "wb") as file: + file.write(Audiotable) + + shutil.make_archive("MM", 'zip', tmp_directory) + os.rename("MM.zip", "MM.audiobin") + + shutil.rmtree(tmp_directory) + + + + + +if __name__ == "__main__": + main() \ No newline at end of file