From a297c105b5269f51d85b07308aa1c0c87eb9daca Mon Sep 17 00:00:00 2001 From: KuroiIeWa5Da Date: Mon, 23 Jan 2012 03:59:25 -0600 Subject: updated disassembly program to support a custom stop address hg-commit-id: a2bee0bdb345 --- music/pokeredmusicdisasm/Parser.cpp | 14 ++++++++++++++ music/pokeredmusicdisasm/Parser.h | 6 ++++++ music/pokeredmusicdisasm/main.cpp | 36 ++++++++++++++++++++++++++++++++---- 3 files changed, 52 insertions(+), 4 deletions(-) (limited to 'music') diff --git a/music/pokeredmusicdisasm/Parser.cpp b/music/pokeredmusicdisasm/Parser.cpp index a548b015..f11d57b6 100644 --- a/music/pokeredmusicdisasm/Parser.cpp +++ b/music/pokeredmusicdisasm/Parser.cpp @@ -9,6 +9,7 @@ Parser::Parser() fileLength = 0; filePos = 0; stop = false; + stopAddress = 0; } Parser::Parser(std::string filename) @@ -46,6 +47,16 @@ void Parser::SetFilename(std::string value) Read(); } +unsigned int Parser::GetStopAddress() +{ + return stopAddress; +} + +void Parser::SetStopAddress(unsigned int value) +{ + stopAddress = value; +} + string Parser::GetParsedAsm() { string tmpStr; @@ -192,6 +203,9 @@ void Parser::ParseNext() // Parses the block immidiately following unkCode << "db $" << hex << uppercase << (short)rawBytesFixed[i]; parsedString.push_back(unkCode.str()); } + + // If the stop address parameter is set, break when we get there + if( (stopAddress != 0) && (i >= stopAddress) ) break; } // Now record the postion we left off diff --git a/music/pokeredmusicdisasm/Parser.h b/music/pokeredmusicdisasm/Parser.h index 9f7550c0..515d07ad 100644 --- a/music/pokeredmusicdisasm/Parser.h +++ b/music/pokeredmusicdisasm/Parser.h @@ -37,6 +37,9 @@ public: std::string GetFilename(); void SetFilename(std::string value); + unsigned int GetStopAddress(); + void SetStopAddress(unsigned int value); + std::string GetParsedAsm(); // File Operations @@ -56,6 +59,9 @@ private: unsigned int filePos; bool stop; + // Optional Settings + unsigned int stopAddress; + // A lot of tmp classes Call tmpCall; Duty tmpDuty; diff --git a/music/pokeredmusicdisasm/main.cpp b/music/pokeredmusicdisasm/main.cpp index 919fd719..40fca2ae 100644 --- a/music/pokeredmusicdisasm/main.cpp +++ b/music/pokeredmusicdisasm/main.cpp @@ -7,31 +7,59 @@ using namespace std; int main(int argc, char** argv) { + const unsigned char parameters = 2; + const unsigned char self = 1; + const unsigned char _max_argc = parameters + self; + string arg1; // Offset - string arg2; // File + string arg2; // File or "--" (if "--" then the file is assumed) + + string paramStopAddr; - if(argc >= 3) + if(argc >= _max_argc) { arg1 = argv[1]; arg2 = argv[2]; } - else if(argc == 2) + else if(argc == (_max_argc - 1)) { arg1 = argv[1]; arg2 = "../baserom.gbc"; } + // Process any parameters + if(argc > _max_argc) + { + for(int i = _max_argc; i < argc; i++) + { + string tmpArgv = argv[i]; + if(tmpArgv.substr(0, 7) == "--stop=") paramStopAddr = tmpArgv.substr(7); + } + } + if(arg1 == "") Console::Ask("What offset in the file in hex (0x----): ", arg1); if(arg2 == "") Console::Ask("What file: ", arg2); // Weird way of converting arg1 to an unsigned integer + Parser p(arg2); + stringstream arg1Conv; unsigned int arg1ConvNum; arg1Conv << arg1; arg1Conv << hex; arg1Conv >> arg1ConvNum; - Parser p(arg2); + if(paramStopAddr != "") + { + stringstream paramStopAddrConv; + unsigned int paramStopAddrNum = 0; + paramStopAddrConv.str(""); + paramStopAddrConv << paramStopAddr; + paramStopAddrConv << hex; + paramStopAddrConv >> paramStopAddrNum; + p.SetStopAddress(paramStopAddrNum); + } + p.Parse(arg1ConvNum); Console::PrintLn(p.GetParsedAsm().c_str()); -- cgit v1.3.1-sl0p From 1014adc83cbd6df9bf91a92e5d23d48c601abe07 Mon Sep 17 00:00:00 2001 From: KuroiIeWa5Da Date: Mon, 23 Jan 2012 04:25:21 -0600 Subject: Completed Routes3 music data channel 1 hg-commit-id: be5b52f43ccc --- music.asm | 86 ++++++++++++++++++++++++++++++++++++++- music/pokeredmusicdisasm/main.cpp | 4 +- 2 files changed, 88 insertions(+), 2 deletions(-) (limited to 'music') diff --git a/music.asm b/music.asm index bb0a8d7b..62ca5846 100644 --- a/music.asm +++ b/music.asm @@ -1168,7 +1168,91 @@ Routes2_md_4: ;9F08 - 9FAC ;Routes 3, 4, 5, 6, 7, 8, 9, 10, 16, 17, 18, 19, 20, 21, 22 Routes3_md_1: ;9FAD - A008 -INCBIN "baserom.gbc",$9fad,$a009 - $9fad + ; 9FAD + mus_tempo 0, 148 + mus_volume 119 + mus_duty duty75 + mus_mod 6, 3, 4 + db $E8 + mus_vel 11, 5 + + mus_octave oct2 + mus_note noteE, note16 + mus_note noteF#, note16 + mus_note noteG, note4_8 + mus_note noteF, note16 + mus_note noteG, note16 + mus_note noteE, note16 + mus_note noteRst, note1 + mus_note noteRst, note2_4_8_16 + +branch_9FC3: + mus_vel 11, 5 + mus_note noteE, note4_8 + mus_note noteD, note16 + mus_note noteE, note16 + mus_note noteC, note4 + mus_note noteE, note4 + mus_note noteC, note4_8 + mus_note noteD, note16 + mus_note noteE, note16 + mus_note noteF, note8 + mus_note noteG, note8 + mus_note noteG, note8 + mus_note noteA, note8 + mus_vel 10, 7 + mus_note noteA#, note2 + mus_note noteF, note2 + mus_note noteD, note2 + mus_note noteF, note2 + mus_vel 11, 5 + mus_note noteE, note4_8 + mus_note noteD, note16 + mus_note noteE, note16 + mus_note noteC, note4 + mus_note noteE, note4 + mus_note noteC, note4_8 + mus_note noteD, note16 + mus_note noteE, note16 + mus_note noteF, note8 + mus_note noteG, note8 + mus_note noteG, note8 + mus_note noteA, note8 + mus_vel 10, 7 + mus_note noteA#, note2 + mus_note noteA#, note2 + mus_note noteD, note2 + mus_note noteF, note2 + mus_vel 11, 5 + mus_note noteE, note4 + mus_note noteE, note8 + mus_note noteF, note8 + mus_note noteG, note4 + mus_note noteF, note8 + mus_note noteE, note8 + mus_note noteB, note8 + + mus_octave oct1 + mus_note noteG, note4 + + mus_octave oct2 + mus_note noteB, note2 + mus_note noteA, note8 + db $D8 + mus_note noteRst, note4 + mus_note noteA, note4 + mus_note noteF, note4 + mus_note noteA, note4 + db $D8 + mus_note noteE, note1 + mus_note noteA, note2_4 + db $D8 + mus_note noteA, note16 + mus_note noteF, note2_4 + mus_note noteG, note2_4 + mus_jump 0, branch_9FC3 + ;A008 + ;No end byte until indigo plateu channel 1 Routes3_md_2: ;A009 - A07E INCBIN "baserom.gbc",$a009,$a07f - $a009 diff --git a/music/pokeredmusicdisasm/main.cpp b/music/pokeredmusicdisasm/main.cpp index 40fca2ae..d2841c6b 100644 --- a/music/pokeredmusicdisasm/main.cpp +++ b/music/pokeredmusicdisasm/main.cpp @@ -10,6 +10,7 @@ int main(int argc, char** argv) const unsigned char parameters = 2; const unsigned char self = 1; const unsigned char _max_argc = parameters + self; + const string defFileLoc = "../baserom.gbc"; string arg1; // Offset string arg2; // File or "--" (if "--" then the file is assumed) @@ -24,7 +25,7 @@ int main(int argc, char** argv) else if(argc == (_max_argc - 1)) { arg1 = argv[1]; - arg2 = "../baserom.gbc"; + arg2 = defFileLoc; } // Process any parameters @@ -39,6 +40,7 @@ int main(int argc, char** argv) if(arg1 == "") Console::Ask("What offset in the file in hex (0x----): ", arg1); if(arg2 == "") Console::Ask("What file: ", arg2); + if(arg2 == "--") arg2 = defFileLoc; // You can also put "--" for the default file location // Weird way of converting arg1 to an unsigned integer Parser p(arg2); -- cgit v1.3.1-sl0p From 6a85dc48e1ef04b23a72694ed1d0271a44aa22c3 Mon Sep 17 00:00:00 2001 From: KuroiIeWa5Da Date: Mon, 23 Jan 2012 04:33:56 -0600 Subject: Completed Routes3 music data channel 2 hg-commit-id: ef99ba55bb1b --- music.asm | 123 +++++++++++++++++++++++++++++++++++- music/pokeredmusicdisasm/Parser.cpp | 3 +- 2 files changed, 124 insertions(+), 2 deletions(-) (limited to 'music') diff --git a/music.asm b/music.asm index 62ca5846..4d0ce3a6 100644 --- a/music.asm +++ b/music.asm @@ -1255,7 +1255,128 @@ branch_9FC3: ;No end byte until indigo plateu channel 1 Routes3_md_2: ;A009 - A07E -INCBIN "baserom.gbc",$a009,$a07f - $a009 + ; A009 + mus_mod 8, 2, 3 + mus_duty duty50 + mus_vel 12, 7 + + mus_octave oct2 + mus_note noteG, note16 + mus_note noteA#, note16 + mus_note noteB, note4_8 + mus_note noteA, note16 + mus_note noteB, note16 + + mus_octave oct3 + mus_note noteC, note16 + mus_note noteRst, note2_4_8_16 + mus_note noteRst, note1 + mus_vel 12, 7 + mus_duty duty50 + + mus_octave oct3 + mus_note noteC, note4_8 + + mus_octave oct2 + mus_note noteG, note16 + + mus_octave oct3 + mus_note noteC, note16 + mus_note noteE, note2_8 + + mus_octave oct2 + mus_note noteG, note8 + + mus_octave oct3 + mus_note noteC, note8 + mus_note noteG, note8 + mus_note noteF, note8 + mus_note noteE, note8 + mus_note noteD, note8 + mus_note noteC, note8 + mus_note noteD, note2 + mus_note noteF, note2 + mus_vel 12, 5 + mus_duty duty75 + + mus_octave oct2 + mus_note noteA#, note2 + mus_note noteA, note2 + mus_vel 12, 7 + mus_duty duty50 + + mus_octave oct3 + mus_note noteC, note4_8 + + mus_octave oct2 + mus_note noteG, note16 + + mus_octave oct3 + mus_note noteC, note16 + mus_note noteE, note2_8 + + mus_octave oct2 + mus_note noteG, note8 + + mus_octave oct3 + mus_note noteC, note8 + mus_note noteG, note8 + mus_note noteF, note8 + mus_note noteE, note8 + mus_note noteD, note8 + mus_note noteC, note8 + mus_note noteD, note2 + mus_note noteF, note2 + mus_vel 12, 5 + mus_duty duty75 + + mus_octave oct2 + mus_note noteA#, note2 + + mus_octave oct3 + mus_note noteD, note4_8 + mus_vel 12, 7 + mus_duty duty50 + mus_note noteC, note16 + mus_note noteD, note16 + mus_note noteE, note8 + mus_note noteD, note8 + mus_note noteE, note8 + mus_note noteC, note2 + + mus_octave oct2 + mus_note noteB, note16 + + mus_octave oct3 + mus_note noteC, note16 + mus_note noteD, note8 + + mus_octave oct2 + mus_note noteG, note4 + + mus_octave oct3 + mus_note noteG, note2 + mus_note noteF, note16 + mus_note noteE, note16 + db $D8 + db $D3 + mus_note noteF, note4 + mus_note noteE, note4 + db $D8 + mus_note noteRst, note4_16 + mus_note noteC, note4 + db $D8 + mus_note noteRst, note4_8 + mus_note noteC, note2_4 + mus_vel 10, 0 + mus_duty duty75 + + mus_octave oct2 + mus_note noteA, note2 + mus_note noteB, note2 + mus_jump 0, $601A + ; A07E + ;No end byte until indigo plateu channel 1 Routes3_md_3: ;A07F - 6130 INCBIN "baserom.gbc",$a07f,$a131 - $a07f diff --git a/music/pokeredmusicdisasm/Parser.cpp b/music/pokeredmusicdisasm/Parser.cpp index f11d57b6..9fa0af7f 100644 --- a/music/pokeredmusicdisasm/Parser.cpp +++ b/music/pokeredmusicdisasm/Parser.cpp @@ -114,7 +114,6 @@ void Parser::ParseNext() // Parses the block immidiately following for(unsigned int i = filePos; (i <= fileLength) && (stop == false); i++) { // There's a way to make this block shorter but for now it does it's job - filePos = i; // Check to see if it's the correct data type and if so then use it if(tmpCall.IsValid(&rawBytesFixed[i])) // Should have made IsValid static @@ -204,6 +203,8 @@ void Parser::ParseNext() // Parses the block immidiately following parsedString.push_back(unkCode.str()); } + filePos = i; + // If the stop address parameter is set, break when we get there if( (stopAddress != 0) && (i >= stopAddress) ) break; } -- cgit v1.3.1-sl0p From 0ea0ae063f862809d7c2c715c520b836cd4f34db Mon Sep 17 00:00:00 2001 From: KuroiIeWa5Da Date: Mon, 23 Jan 2012 05:07:16 -0600 Subject: Completed Routes4 music data channel 1 and fixed minor program bug hg-commit-id: ce15c0659a12 --- music.asm | 162 +++++++++++++++++++++++++++++++- music/pokeredmusicdisasm/Modulation.cpp | 2 +- 2 files changed, 162 insertions(+), 2 deletions(-) (limited to 'music') diff --git a/music.asm b/music.asm index 177896d3..a833b434 100644 --- a/music.asm +++ b/music.asm @@ -1887,10 +1887,170 @@ branch_A17A: mus_note noteC#, note8_16 mus_jump 0, branch_A17A ; A269 + ;No end byte until indigo plateu channel 1 ;Routes 11, 12, 13, 14, 15 Routes4_md_1: ;a26a - a303 -INCBIN "baserom.gbc",$a26a,$a304 - $a26a + ; A26A + mus_tempo 0, 148 + mus_volume 119 + mus_duty duty75 + mus_mod 10, 3, 4 + db $E8 + mus_vel 10, 2 + + mus_octave oct1 + mus_note noteG#, note4 + mus_note noteG#, note4 + mus_note noteG#, note4 + mus_vel 7, 15 + mus_note noteG#, note4 + mus_vel 10, 2 + mus_note noteG#, note4 + mus_note noteG#, note4 + mus_note noteG#, note4 + mus_vel 11, 7 + mus_note noteB, note16 + + mus_octave oct2 + mus_note noteE, note16 + mus_note noteF#, note16 + mus_note noteB, note16 + +branch_A28A: + mus_vel 11, 7 + mus_note noteB, note4_8 + mus_note noteE, note8 + mus_note noteE, note4 + + mus_octave oct3 + mus_note noteE, note4 + mus_note noteD, note4 + mus_note noteC#, note4 + + mus_octave oct2 + mus_note noteB, note4 + mus_note noteA, note4 + mus_vel 11, 1 + mus_note noteG#, note8_16 + mus_vel 11, 7 + mus_note noteE, note16 + mus_note noteF#, note2_4 + mus_note noteE, note2 + mus_note noteD#, note4 + mus_note noteF#, note4 + mus_note noteB, note4_8 + mus_note noteE, note8 + mus_note noteE, note4 + + mus_octave oct3 + mus_note noteE, note4 + mus_note noteD, note4 + mus_note noteC#, note4 + + mus_octave oct2 + mus_note noteB, note4 + + mus_octave oct3 + mus_note noteC#, note4 + mus_vel 11, 1 + mus_note noteE, note8_16 + mus_vel 11, 7 + mus_note noteD#, note16 + mus_note noteE, note2_4 + + mus_octave oct2 + mus_note noteB, note8_16 + mus_note noteA, note16 + mus_note noteG#, note2 + + mus_octave oct3 + mus_note noteE, note4 + + mus_octave oct2 + mus_note noteD, note8 + mus_note noteE, note8 + mus_note noteF#, note8 + mus_note noteG#, note8 + mus_note noteA, note8 + mus_note noteB, note8 + + mus_octave oct3 + mus_note noteC#, note8 + mus_note noteD, note8 + mus_note noteD, note8 + + mus_octave oct2 + mus_note noteA, note8 + mus_note noteF#, note8 + mus_note noteE, note8 + mus_note noteD, note8 + mus_note noteE, note8 + mus_note noteF#, note8 + mus_note noteA, note8 + mus_note noteG#, note8 + mus_note noteF#, note8 + mus_note noteE, note8 + mus_note noteF#, note8 + mus_note noteG#, note8 + mus_note noteA, note8 + mus_note noteB, note8 + + mus_octave oct3 + mus_note noteD#, note8 + mus_note noteE, note8 + + mus_octave oct2 + mus_note noteB, note8 + mus_note noteG#, note8 + mus_note noteF#, note8 + mus_note noteE, note8 + mus_note noteF#, note8 + mus_note noteG#, note8 + mus_note noteB, note8 + db $D8 + mus_note noteB, note4_8 + mus_note noteA, note4 + mus_note noteG#, note4 + mus_note noteF#, note4 + + mus_octave oct3 + mus_note noteE, note4 + mus_note noteD#, note4 + mus_note noteC#, note4 + mus_note noteC#, note4 + + mus_octave oct2 + mus_note noteB, note4 + mus_note noteA, note4 + mus_note noteB, note4 + + mus_octave oct3 + mus_note noteC#, note4 + mus_note noteD#, note4 + + mus_octave oct2 + mus_note noteE, note8_16 + mus_note noteF#, note8_16 + mus_note noteG#, note8_16 + mus_note noteA, note8_16 + mus_note noteB, note4 + + mus_octave oct3 + mus_note noteC#, note4 + mus_note noteD#, note4 + mus_note noteE, note8_16 + + mus_octave oct2 + mus_note noteB, note8_16 + mus_note noteG#, note8_16 + mus_note noteF#, note8_16 + mus_note noteE, note8_16 + mus_note noteF#, note8_16 + mus_note noteG#, note8_16 + mus_note noteA, note8_16 + mus_jump 0, branch_A28A + ; A303 Routes4_md_2: ;a304 - a3c3 INCBIN "baserom.gbc",$a304,$a3c4 - $a304 diff --git a/music/pokeredmusicdisasm/Modulation.cpp b/music/pokeredmusicdisasm/Modulation.cpp index 61ccbf82..eed78183 100644 --- a/music/pokeredmusicdisasm/Modulation.cpp +++ b/music/pokeredmusicdisasm/Modulation.cpp @@ -72,7 +72,7 @@ string Modulation::GenAsm() if(tmpRet != "") return tmpRet; stringstream tmpAsmOut; - tmpAsmOut << "mus_mod " << hex << (short)delay << ", " << (short)depth << ", " << (short)rate; + tmpAsmOut << "mus_mod " << (short)delay << ", " << (short)depth << ", " << (short)rate; return tmpAsmOut.str(); } -- cgit v1.3.1-sl0p