Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import argv
- from struct import unpack
- import string
- import SmashULib
- # for use with bgm_mymusic.mmb
- mymusic = open(argv[1], 'rb')
- assert mymusic.read(3) == "MMB"
- mymusic.seek(8)
- # Getting the amount of "stages" (some are just single song menus)
- count = unpack('<I', mymusic.read(4))[0]
- # Stage offset table starts at 0xc
- # Stage offset is 0xc + count * 4
- stageStartOffset = 0xc + count * 4
- for m in range(0,count):
- mymusic.seek(0xc + m * 4)
- offset = unpack('<I', mymusic.read(4))[0]
- mymusic.seek(stageStartOffset + offset)
- # 0x20 bytes are reserved for the stage string, and just removing null bytes for now
- stage = string.replace(mymusic.read(0x20), "\x00", "")
- print stage
- songCount = unpack('<I', mymusic.read(4))[0]
- for s in range(0, songCount):
- # Each song entry for a stage is 0x3c bytes
- mymusic.seek(stageStartOffset + offset + 0x24 + s * 0x3c)
- songID = unpack('<I', mymusic.read(4))[0]
- songSlot = unpack('<H', mymusic.read(2))[0]
- # Skiping 0xffff
- mymusic.seek(2, 1)
- priority = unpack('<I', mymusic.read(4))[0]
- print "\tSlot " + str(songSlot) + " -\t" + SmashULib.smashSongs[songID] + "\t" + str(priority) + "%"
- # The final 0x30 bytes are 0xffff, followed by 0x2e bytes of 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement