-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
READ THE README! provided by owlisnotacat
- Loading branch information
1 parent
7676551
commit 7682483
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <Majoras Mask Decompressed Rom.z64>") | ||
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() |