findloc OFFSET string "BMD0" #Starts by finding the first instance of text string "BMD0" do goto OFFSET #Goes to the address identified above get DUMMY long #Skips four bytes get DUMMY long #Skips four bytes get SIZE long #Records the next four bytes as the file size getdstring DUMMY 0x28 #Skips 0x28 bytes getdstring NAME 0xC #Records the next 0xC bytes as the file name string NAME + ".NSBMD" #Modifies the recorded filename by adding the ".NSBMD" extension log NAME OFFSET SIZE #Writes the file defined by the above lines findloc NEXT_OFFSET string "BMD0" 0 "" #Finds the next instance of text string "BMD0" and records its address as the variable NEXT_OFFSET math OFFSET = NEXT_OFFSET #Sets the OFFSET variable to equal NEXT_OFFSET defined above while NEXT_OFFSET < 0xC4C460 #Loops back to the first line of code after the "do" command, provided a NEXT_OFFSET was found before address 0xC4C460. We stop at this address because all uncompressed .BMD0 files are found earlier in the game.