From be6d6c9ce9a86231482eafacd4be867285809366 Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Fri, 16 Mar 2018 20:36:39 -0500 Subject: Update squarenote and noisenote parameters --- pokemontools/redsfxdisasm.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/pokemontools/redsfxdisasm.py b/pokemontools/redsfxdisasm.py index 10e265d..0f6c263 100755 --- a/pokemontools/redsfxdisasm.py +++ b/pokemontools/redsfxdisasm.py @@ -398,10 +398,28 @@ for bank in banks: command_length = 2 elif byte < 0x30 and not executemusic: if channelnumber == 7: - output += "\tnoisenote {}, {}, {}".format(byte % 0x10, rom[address + 1], rom[address + 2]) + param = rom[address + 1] + if param & 0b111 == 0: + if param % 0x10 > 7: + output += "\tnoisenote {}, {}, {}, {}".format(byte % 0x10, param >> 4, 8, rom[address + 2]) + else: + output += "\tnoisenote {}, {}, {}, {}".format(byte % 0x10, param >> 4, 0, rom[address + 2]) + elif param % 0x10 > 7: + output += "\tnoisenote {}, {}, {}, {}".format(byte % 0x10, param >> 4, (param & 0b0111) * -1, rom[address + 2]) + else: + output += "\tnoisenote {}, {}, {}, {}".format(byte % 0x10, param >> 4, param % 0x10, rom[address + 2]) command_length = 3 else: - output += "\tsquarenote {}, {}, {}, {}".format(byte % 0x10, rom[address + 1], rom[address + 2], rom[address + 3]) + param = rom[address + 1] + if param & 0b111 == 0: + if param % 0x10 > 7: + output += "\tsquarenote {}, {}, {}, {}".format(byte % 0x10, param >> 4, 8, rom[address + 3] * 0x100 + rom[address + 2]) + else: + output += "\tsquarenote {}, {}, {}, {}".format(byte % 0x10, param >> 4, 0, rom[address + 3] * 0x100 + rom[address + 2]) + elif param % 0x10 > 7: + output += "\tsquarenote {}, {}, {}, {}".format(byte % 0x10, param >> 4, (param & 0b0111) * -1, rom[address + 3] * 0x100 + rom[address + 2]) + else: + output += "\tsquarenote {}, {}, {}, {}".format(byte % 0x10, param >> 4, param % 0x10, rom[address + 3] * 0x100 + rom[address + 2]) command_length = 4 elif byte < 0xc0: output += "\t{} {}".format(music_notes[byte >> 4], byte % 0x10 + 1) -- cgit v1.2.3