diff options
| author | iimarckus <iimarckus@gmail.com> | 2013-10-13 23:35:43 -0700 |
|---|---|---|
| committer | iimarckus <iimarckus@gmail.com> | 2013-10-13 23:35:43 -0700 |
| commit | ad402f12435ab661aa9b745a79d419fcae9340fc (patch) | |
| tree | 5a410d83d4180cb4179ac03b3ccd00bd1a89de1c /music/pokeredmusicdisasm | |
| parent | Fix CheckIfInOutsideMap comments. (diff) | |
| parent | Add song alternate start labels (diff) | |
| download | pokeyellow-ad402f12435ab661aa9b745a79d419fcae9340fc.tar.gz pokeyellow-ad402f12435ab661aa9b745a79d419fcae9340fc.tar.xz pokeyellow-ad402f12435ab661aa9b745a79d419fcae9340fc.zip | |
Merge pull request #11 from dannye/music
Music
Diffstat (limited to 'music/pokeredmusicdisasm')
36 files changed, 0 insertions, 2345 deletions
diff --git a/music/pokeredmusicdisasm/AbstractData.cpp b/music/pokeredmusicdisasm/AbstractData.cpp deleted file mode 100644 index 542922fe..00000000 --- a/music/pokeredmusicdisasm/AbstractData.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "AbstractData.h"
-using namespace std;
-
-AbstractData::AbstractData()
-{
- error = false;
-}
-
-// This method must always return "" if true but can return
-// any other value for false
-string AbstractData::GenAsm()
-{
- if(error) return ";#Error";
- else return "";
-}
-
-bool AbstractData::IsValid(unsigned char* byte)
-{
- return true;
-}
-
-bool AbstractData::Parse(unsigned char* byte)
-{
- // If it's not valid, don't even bother parsing
- if(!IsValid(byte)) return false;
- return true;
-}
-
-unsigned int AbstractData::Arguments()
-{
- return 0;
-}
-
-bool AbstractData::GetError()
-{
- return error;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/AbstractData.h b/music/pokeredmusicdisasm/AbstractData.h deleted file mode 100644 index 0b49255d..00000000 --- a/music/pokeredmusicdisasm/AbstractData.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef ABSTRACTDATA_H
-#define ABSTRACTDATA_H
-
-#include <string>
-
-// All information types inherit from here
-class AbstractData
-{
-public:
- AbstractData();
-
- virtual std::string GenAsm(); // Generate Assembly Output
- virtual bool Parse(unsigned char* byte); // Parse Given Data
- virtual bool GetError(); // Get Error (No Write, Error is read only)
-
- virtual bool IsValid(unsigned char* byte); // Check for byte validity
- virtual unsigned int Arguments(); // Number of arguments taken
-
-protected:
- bool error; // Whether there's an error in parsing or not
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Call.cpp b/music/pokeredmusicdisasm/Call.cpp deleted file mode 100644 index bbc2c21e..00000000 --- a/music/pokeredmusicdisasm/Call.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include <sstream>
-#include "Call.h"
-using namespace std;
-
-Call::Call()
-{
- error = false;
- address = 0;
-}
-
-Call::Call(unsigned char* byte)
-{
- Parse(byte);
-}
-
-Call::Call(unsigned short value, bool)
-{
- SetAddress(value);
-}
-
-unsigned short Call::GetAddress()
-{
- return address;
-}
-
-void Call::SetAddress(unsigned short value)
-{
- address = value;
-}
-
-string Call::GenAsm()
-{
- string tmpRet = AbstractData::GenAsm();
- if(tmpRet != "") return tmpRet;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_call" << " $" << hex << uppercase << address;
- return tmpAsmOut.str();
-}
-
-bool Call::IsValid(unsigned char* byte)
-{
- if(byte[0] == 0xFD)
- {
- error = false;
- return true;
- }
- else
- {
- error = true;
- return false;
- }
-}
-
-bool Call::Parse(unsigned char* byte)
-{
- if(!AbstractData::Parse(byte)) return false;
-
- // Get Address
- address = byte[2];
- address <<= 8;
- address |= byte[1];
-
- return true;
-}
-
-unsigned int Call::Arguments()
-{
- // 1 2-byte argument = 2 bytes
- return 2;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Call.h b/music/pokeredmusicdisasm/Call.h deleted file mode 100644 index d6fd9c97..00000000 --- a/music/pokeredmusicdisasm/Call.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef CALL_H
-#define CALL_H
-
-#include "AbstractData.h"
-
-// Represents 1 call
-class Call : public AbstractData
-{
-public:
- // Constructors
- Call(); // Default
- Call(unsigned char* byte); // Parse Immidiately
- Call(unsigned short value, bool); // Set value
-
- // Direct Getter/Setter Functions
- unsigned short GetAddress();
- void SetAddress(unsigned short value);
-
- // The standard re-implementations from AbstractData
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-
-private:
- unsigned short address;
-};
-
-#endif
-
-// Rqandom Notes
-//ED Speed of song
-//EC Instrument
-//DC Volume
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Console.cpp b/music/pokeredmusicdisasm/Console.cpp deleted file mode 100644 index 35033bb6..00000000 --- a/music/pokeredmusicdisasm/Console.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "Console.h"
-
-using namespace std;
-
-// Basic
-void Console::Get(char* value)
-{
- cin >> value;
-}
-void Console::Get(string& value)
-{
- cin >> value;
-}
-void Console::Print(const char* value)
-{
- cout << value;
-}
-void Console::Error(const char* value)
-{
- cerr << value;
-}
-
-// Upper-Basic
-void Console::PrintLn(const char* value)
-{
- Print(value);
- cout << endl;
-}
-void Console::ErrorLn(const char* value)
-{
- Error(value);
- cerr << endl;
-}
-
-// Higher
-/*void Console::Ask(const char* question, char* answer)
-{
- Print(question);
- Get(answer);
-}
-void Console::Ask(const char* question, string& answer)
-{
- Print(question);
- Get(answer);
-}*/
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Console.h b/music/pokeredmusicdisasm/Console.h deleted file mode 100644 index 1de9ee55..00000000 --- a/music/pokeredmusicdisasm/Console.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef CONSOLE_H
-#define CONSOLE_H
-
-#include <iostream>
-#include <string>
-#include <sstream>
-
-// Just a Console Utility Library
-class Console
-{
-public:
- // Basic
- static void Get(char* value);
- static void Get(std::string& value);
- static void Print(const char* value);
- static void Error(const char* value);
-
- // Upper-Basic
- static void PrintLn(const char* value);
- static void ErrorLn(const char* value);
-
- // Higher
- //static void Ask(const char* question, char* answer);
- //static void Ask(const char* question, std::string& answer);
-
- template<class T>
- static void Ask(const char* question, T& answer, std::ios_base::fmtflags flags = std::ios_base::dec)
- {
- std::stringstream _tmpstr;
- std::string _tmp;
-
- Print(question);
- Get(_tmp);
-
- _tmpstr << _tmp;
- _tmpstr.flags(flags);
- _tmpstr >> answer;
- }
-};
-
-#endif // CONSOLE_H
diff --git a/music/pokeredmusicdisasm/Duty.cpp b/music/pokeredmusicdisasm/Duty.cpp deleted file mode 100644 index 0723074b..00000000 --- a/music/pokeredmusicdisasm/Duty.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include <sstream>
-#include "Duty.h"
-using namespace std;
-
-Duty::Duty()
-{
- duty = 0;
-}
-
-Duty::Duty(unsigned char* byte) // Parse Immidiately
-{
- Parse(byte);
-}
-
-Duty::Duty(unsigned char value, bool) // Set value
-{
- SetDuty(value);
-}
-
-unsigned char Duty::GetDuty()
-{
- return duty;
-}
-
-void Duty::SetDuty(unsigned char value)
-{
- // Clamp duty to 3 since that's the highest possible
- duty = value;
- if(duty >= 3) duty = 3;
-}
-
-// Byte 0 - The Command Code
-// Byte 1 - The Value
-bool Duty::IsValid(unsigned char* byte)
-{
- if((byte[0] == 0xEC) &&
- (byte[1] >= 0x0) &&
- (byte[1] <= 0x3))
- {
- error = false; // Unblock assembling
- return true;
- }
- else
- {
- error = true; // Block assembling
- return false;
- }
-}
-
-string Duty::GenAsm()
-{
- string ret = AbstractData::GenAsm();
- if(ret != "") return ret;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_duty " << LookupDutyString();
- return tmpAsmOut.str();
-}
-
-bool Duty::Parse(unsigned char* byte)
-{
- if(!AbstractData::Parse(byte)) return false;
-
- duty = byte[1];
- return true;
-}
-
-string Duty::LookupDutyString()
-{
- // In case some error happens and the values doesn't match the list below
- stringstream defTmp;
-
- switch(duty)
- {
- case duty12_5:
- return "duty12_5";
- case duty25:
- return "duty25";
- case duty50:
- return "duty50";
- case duty75:
- return "duty75";
- default:
- defTmp << "$" << uppercase << hex << (short)duty;
- return defTmp.str();
- }
-}
-
-unsigned int Duty::Arguments()
-{
- //1 1-byte argument = 1
- return 1;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Duty.h b/music/pokeredmusicdisasm/Duty.h deleted file mode 100644 index aa3f0d0d..00000000 --- a/music/pokeredmusicdisasm/Duty.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef DUTY_H
-#define DUTY_H
-
-#include "AbstractData.h"
-
-//Represents 1 Duty data
-class Duty : public AbstractData
-{
-public:
- // Constructors
- Duty();
- Duty(unsigned char* byte); // Parse Immidiately
- Duty(unsigned char value, bool); // Set value
-
- // Re-Implementations from Parent
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-
- // Direct Getters and Setters
- unsigned char GetDuty();
- void SetDuty(unsigned char value);
-
- // Custom Functions
- std::string LookupDutyString();
-
- enum dutyList : unsigned char
- {
- duty12_5 = 0x0,
- duty25 = 0x1,
- duty50 = 0x2,
- duty75 = 0x3
- };
-
-private:
- unsigned char duty;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/File.h b/music/pokeredmusicdisasm/File.h deleted file mode 100644 index de1e6998..00000000 --- a/music/pokeredmusicdisasm/File.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef FILE_H
-#define FILE_H
-
-#include <string>
-#include <vector>
-#include <fstream>
-
-class File
-{
-public:
- File();
- File(std::string filename, unsigned int offset = 0, unsigned int length = 0);
-
- string GetFileName();
- void SetFilename(string value);
-
-private:
- std::string filename;
- std::vector<unsigned char> fileBuffer;
- std::fstream fileHandle;
-
- std::vector<unsigned char>::iterator start;
- std::vector<unsigned char>::iterator cur;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Jump.cpp b/music/pokeredmusicdisasm/Jump.cpp deleted file mode 100644 index 8b094996..00000000 --- a/music/pokeredmusicdisasm/Jump.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include <sstream>
-#include "Jump.h"
-using namespace std;
-
-Jump::Jump()
-{
- address = 0x0000;
- loop = 0;
-}
-
-Jump::Jump(unsigned char* byte) // Parse Immidiately
-{
- Parse(byte);
-}
-
-Jump::Jump(unsigned short value, unsigned char loop, bool) // Set value
-{
- SetAddress(value);
- SetLoop(loop);
-}
-
-unsigned short Jump::GetAddress()
-{
- return address;
-}
-
-void Jump::SetAddress(unsigned short value)
-{
- address = value;
-}
-
-unsigned char Jump::GetLoop()
-{
- return loop;
-}
-
-void Jump::SetLoop(unsigned char value)
-{
- loop = value;
-}
-
-string Jump::GenAsm()
-{
- string tmpRet = AbstractData::GenAsm();
- if(tmpRet != "") return tmpRet;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_jump" << " " << (short)loop << ", $" << hex << uppercase << address;
- return tmpAsmOut.str();
-}
-
-bool Jump::IsValid(unsigned char* byte)
-{
- if(byte[0] == 0xFE)
- {
- error = false;
- return true;
- }
- else
- {
- error = true;
- return false;
- }
-}
-
-bool Jump::Parse(unsigned char* byte)
-{
- if(!AbstractData::Parse(byte)) return false;
-
- loop = byte[1];
-
- address = byte[3];
- address <<= 8;
- address |= byte[2];
-
- return true;
-}
-
-unsigned int Jump::Arguments()
-{
- // 1 1-byte command, 1 1-byte loop, 1 2-byte pointer = 4 bytes
- return 3;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Jump.h b/music/pokeredmusicdisasm/Jump.h deleted file mode 100644 index 64273fb7..00000000 --- a/music/pokeredmusicdisasm/Jump.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef JUMP_H
-#define JUMP_H
-
-#include "AbstractData.h"
-
-// Represents 1 Jump Class
-class Jump : public AbstractData
-{
-public:
- // Constructors
- Jump(); // Default
- Jump(unsigned char* byte); // Parse Immidiately
- Jump(unsigned short value, unsigned char loop, bool); // Set value
-
- // Direct Getter/Setter Functions
- unsigned short GetAddress();
- void SetAddress(unsigned short value);
-
- unsigned char GetLoop();
- void SetLoop(unsigned char value);
-
- // The standard re-implementations from AbstractData
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-
-private:
- unsigned short address;
- unsigned char loop;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Makefile b/music/pokeredmusicdisasm/Makefile deleted file mode 100644 index 352f87a7..00000000 --- a/music/pokeredmusicdisasm/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -
-OBJECTS = main.o Jump.o Modulation.o Note.o Octave.o Parser.o Stop.o \
-Tempo.o UnkCode.o UnkEB.o Velocity.o Volume.o Console.o AbstractData.o Call.o \
-Duty.o args.o
-
-CC = g++
-CFLAGS = -std=c++0x
-
-pokeredmusicdisasm: $(OBJECTS)
- $(CC) $(CFLAGS) $(OBJECTS) -o "../../extras/pokeredmusicdisasm.exe"
-
-Parser.o: Jump.h Modulation.h Note.h Octave.h Parser.h Stop.h \
-Tempo.h UnkCode.h UnkEB.h Velocity.h Volume.h
- $(CC) $(CFLAGS) -c main.cpp Jump.cpp Modulation.cpp \
-Note.cpp Octave.cpp Parser.cpp Stop.cpp Tempo.cpp UnkCode.cpp UnkEB.cpp \
-Velocity.cpp Volume.cpp
-
-Duty.o: Duty.h AbstractData.h
- $(CC) $(CFLAGS) -c Duty.cpp AbstractData.cpp
-
-Console.o: Console.h
- $(CC) $(CFLAGS) -c Console.cpp
-
-AbstractData.o: AbstractData.h
- $(CC) $(CFLAGS) -c AbstractData.cpp
-
-Call.o: Call.h Call.cpp AbstractData.h
- $(CC) $(CFLAGS) -c Call.cpp AbstractData.cpp
-
-main.o: main.cpp Console.h Parser.h args.h
- $(CC) $(CFLAGS) -c main.cpp Console.cpp Parser.cpp args.cpp
-
-Jump.o: Jump.h AbstractData.h
- $(CC) $(CFLAGS) -c Jump.cpp AbstractData.cpp
-
-Modulation.o: Modulation.h AbstractData.h
- $(CC) $(CFLAGS) -c Modulation.cpp AbstractData.cpp
-
-Note.o: Note.h AbstractData.h
- $(CC) $(CFLAGS) -c Note.cpp AbstractData.cpp
-
-Octave.o: Octave.h AbstractData.h
- $(CC) $(CFLAGS) -c Octave.cpp AbstractData.cpp
-
-Stop.o: Stop.h AbstractData.h
- $(CC) $(CFLAGS) -c Stop.cpp AbstractData.cpp
-
-Tempo.o: Tempo.h AbstractData.h
- $(CC) $(CFLAGS) -c Tempo.cpp AbstractData.cpp
-
-UnkCode.o: UnkCode.h AbstractData.h
- $(CC) $(CFLAGS) -c UnkCode.cpp AbstractData.cpp
-
-UnkEB.o: UnkEB.h AbstractData.h
- $(CC) $(CFLAGS) -c UnkEB.cpp AbstractData.cpp
-
-Velocity.o: Velocity.h AbstractData.h
- $(CC) $(CFLAGS) -c Velocity.cpp AbstractData.cpp
-
-Volume.o: Volume.h AbstractData.h
- $(CC) $(CFLAGS) -c Volume.cpp AbstractData.cpp
-
-args.o: args.h
- $(CC) $(CFLAGS) -c args.cpp
-
-clean:
- rm *.o
- rm ../../extras/pokeredmusicdisasm.exe
diff --git a/music/pokeredmusicdisasm/Modulation.cpp b/music/pokeredmusicdisasm/Modulation.cpp deleted file mode 100644 index eed78183..00000000 --- a/music/pokeredmusicdisasm/Modulation.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include <sstream>
-#include "Modulation.h"
-using namespace std;
-
-Modulation::Modulation()
-{
- delay = 0;
- depth = 0;
- rate = 0;
-}
-
-Modulation::Modulation(unsigned char* byte) // Parse Immidiately
-{
- Parse(byte);
-}
-
-Modulation::Modulation(unsigned char delay, unsigned char depth, unsigned char rate, bool) // Set value
-{
- SetDelay(delay);
- SetDepth(depth);
- SetRate(rate);
-}
-
-// Direct Getter/Setter Functions
-unsigned char Modulation::GetDelay()
-{
- return delay;
-}
-
-void Modulation::SetDelay(unsigned char value)
-{
- delay = value;
-}
-
-unsigned char Modulation::GetDepth()
-{
- return depth;
-}
-
-void Modulation::SetDepth(unsigned char value)
-{
- depth = value;
-}
-
-unsigned char Modulation::GetRate()
-{
- return rate;
-}
-
-void Modulation::SetRate(unsigned char value)
-{
- rate = value;
-}
-
-bool Modulation::IsValid(unsigned char* byte)
-{
- if(byte[0] == 0xEA)
- {
- error = false; // Unblock assembling
- return true;
- }
- else
- {
- error = true; // Block assembling
- return false;
- }
-}
-
-string Modulation::GenAsm()
-{
- string tmpRet = AbstractData::GenAsm();
- if(tmpRet != "") return tmpRet;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_mod " << (short)delay << ", " << (short)depth << ", " << (short)rate;
- return tmpAsmOut.str();
-}
-
-bool Modulation::Parse(unsigned char* byte)
-{
- if(!AbstractData::Parse(byte)) return false;
-
- delay = byte[1];
-
- depth = byte[2] & 0xF0;
- depth >>= 4;
-
- rate = byte[2] & 0x0F;
- return true;
-}
-
-unsigned int Modulation::Arguments()
-{
- // 2 1-byte arguments = 2
- return 2;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Modulation.h b/music/pokeredmusicdisasm/Modulation.h deleted file mode 100644 index 38c84791..00000000 --- a/music/pokeredmusicdisasm/Modulation.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef MODULATION_H
-#define MODULATION_H
-
-#include "AbstractData.h"
-
-//Represents 1 modulation value
-class Modulation : public AbstractData
-{
-public:
- // Constructors
- Modulation();
- Modulation(unsigned char* byte); // Parse Immidiately
- Modulation(unsigned char delay, unsigned char depth, unsigned char rate, bool); // Set value
-
- // Direct Getter/Setter Functions
- unsigned char GetDelay();
- void SetDelay(unsigned char value);
-
- unsigned char GetDepth();
- void SetDepth(unsigned char value);
-
- unsigned char GetRate();
- void SetRate(unsigned char value);
-
- // Re-implemented
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-
-private:
- unsigned char delay;
- unsigned char depth;
- unsigned char rate;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Note.cpp b/music/pokeredmusicdisasm/Note.cpp deleted file mode 100644 index 0b62f1f9..00000000 --- a/music/pokeredmusicdisasm/Note.cpp +++ /dev/null @@ -1,174 +0,0 @@ -#include <sstream>
-#include "Note.h"
-
-using namespace std;
-
-Note::Note()
-{
- pitch = 0x0;
- delay = 0x0;
-}
-
-Note::Note(unsigned char* byte) // Parse Immidiately
-{
- Parse(byte);
-}
-
-Note::Note(unsigned char pitch, unsigned char delay,bool) // Set value
-{
- SetPitch(pitch);
- SetDelay(delay);
-}
-
-unsigned char Note::GetPitch()
-{
- return pitch;
-}
-
-void Note::SetPitch(unsigned char value)
-{
- pitch = value;
-}
-
-unsigned char Note::GetDelay()
-{
- return delay;
-}
-
-void Note::SetDelay(unsigned char value)
-{
- delay = value;
-}
-
-bool Note::IsValid(unsigned char* byte)
-{
- // A Note is a byte that is between 0x00 and 0xCF
- if((byte[0] >= 0x00) &&
- (byte[0] <= 0xCF))
- {
- error = false; // Unblock assembling
- return true;
- }
- else
- {
- error = true; // Block assembling
- return false;
- }
-}
-
-// Generates the assembly for this note
-string Note::GenAsm()
-{
- string tmpRet = AbstractData::GenAsm();
- if(tmpRet != "") return tmpRet;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_note" << " " << LookupPitchStr() << ", " << LookupDelayStr();
- return tmpAsmOut.str();
-}
-
-// Takes the raw byte and parses it's data, storing it
-bool Note::Parse(unsigned char* byte)
-{
- if(!AbstractData::Parse(byte)) return false;
-
- pitch = byte[0] & 0xF0;
- pitch >>= 4;
-
- delay = byte[0] & 0x0F;
- return true;
-}
-
-// Fetches the asm string name for the pitch
-string Note::LookupPitchStr()
-{
- // In case some error happens and the values doesn't match the list below
- stringstream defTmp;
-
- switch(pitch)
- {
- case noteC:
- return "noteC";
- case noteCS:
- return "noteC#";
- case noteD:
- return "noteD";
- case noteDS:
- return "noteD#";
- case noteE:
- return "noteE";
- case noteF:
- return "noteF";
- case noteFS:
- return "noteF#";
- case noteG:
- return "noteG";
- case noteGS:
- return "noteG#";
- case noteA:
- return "noteA";
- case noteAS:
- return "noteA#";
- case noteB:
- return "noteB";
- case noteRst:
- return "noteRst";
- default:
- defTmp.setf(ios_base::uppercase | ios_base::hex);
- defTmp << "$" << pitch;
- return defTmp.str();
- }
-}
-
-// Fetches the asm string name for the delay
-string Note::LookupDelayStr()
-{
- // In case some error happens and the values doesn't match the list below
- stringstream defTmp;
-
- switch(delay)
- {
- case note16:
- return "note16";
- case note8:
- return "note8";
- case note8_16:
- return "note8_16";
- case note4:
- return "note4";
- case note4_16:
- return "note4_16";
- case note4_8:
- return "note4_8";
- case note4_8_16:
- return "note4_8_16";
- case note2:
- return "note2";
- case note2_16:
- return "note2_16";
- case note2_8:
- return "note2_8";
- case note2_8_16:
- return "note2_8_16";
- case note2_4:
- return "note2_4";
- case note2_4_16:
- return "note2_4_16";
- case note2_4_8:
- return "note2_4_8";
- case note2_4_8_16:
- return "note2_4_8_16";
- case note1:
- return "note1";
- default:
- defTmp.setf(ios_base::uppercase | ios_base::hex);
- defTmp << "$" << (short)pitch;
- return defTmp.str();
- }
-}
-
-unsigned int Note::Arguments()
-{
- // No Arguments
- return 0;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Note.h b/music/pokeredmusicdisasm/Note.h deleted file mode 100644 index 599d66f7..00000000 --- a/music/pokeredmusicdisasm/Note.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef NOTE_H
-#define NOTE_H
-
-#include "AbstractData.h"
-
-// Holds a single note
-class Note : public AbstractData
-{
-public:
- // Constructors
- Note();
- Note(unsigned char* byte); // Parse Immidiately
- Note(unsigned char pitch, unsigned char delay,bool); // Set value
-
- // Reimplementations
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-
- // Getters and Setters
- unsigned char GetPitch();
- void SetPitch(unsigned char value);
-
- unsigned char GetDelay();
- void SetDelay(unsigned char value);
-
- // Specific Methods
- std::string LookupPitchStr();
- std::string LookupDelayStr();
-
- enum pitch_code : unsigned char
- {
- noteC = 0x0,
- noteCS = 0x1,
- noteD = 0x2,
- noteDS = 0x3,
- noteE = 0x4,
- noteF = 0x5,
- noteFS = 0x6,
- noteG = 0x7,
- noteGS = 0x8,
- noteA = 0x9,
- noteAS = 0xA,
- noteB = 0xB,
- noteRst = 0xC
- };
-
- enum delay_code : unsigned char
- {
- note16 = 0x0,
- note8 = 0x1,
- note8_16 = 0x2,
- note4 = 0x3,
- note4_16 = 0x4,
- note4_8 = 0x5,
- note4_8_16 = 0x6,
- note2 = 0x7,
- note2_16 = 0x8,
- note2_8 = 0x9,
- note2_8_16 = 0xA,
- note2_4 = 0xB,
- note2_4_16 = 0xC,
- note2_4_8 = 0xD,
- note2_4_8_16 = 0xE,
- note1 = 0xF
- };
-private:
- unsigned char pitch;
- unsigned char delay;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Octave.cpp b/music/pokeredmusicdisasm/Octave.cpp deleted file mode 100644 index 3da6609b..00000000 --- a/music/pokeredmusicdisasm/Octave.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include <sstream>
-#include "Octave.h"
-using namespace std;
-
-Octave::Octave()
-{
- octave = 0;
-}
-
-Octave::Octave(unsigned char* byte) // Parse Immidiately
-{
- Parse(byte);
-}
-
-Octave::Octave(unsigned char octave, bool) // Set value
-{
- SetOctave(octave);
-}
-
-unsigned char Octave::GetOctave()
-{
- return octave;
-}
-
-void Octave::SetOctave(unsigned char value)
-{
- octave = value;
-}
-
-bool Octave::IsValid(unsigned char* byte)
-{
- if((byte[0] >= 0xE0) &&
- (byte[0] <= 0xE7))
- {
- error = false; // Unblock assembling
- return true;
- }
- else
- {
- error = true; // Block assembling
- return false;
- }
-}
-
-string Octave::GenAsm()
-{
- string tmpRet = AbstractData::GenAsm();
- if(tmpRet != "") return tmpRet;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_octave" << " " << LookupOctString();
- return tmpAsmOut.str();
-}
-
-bool Octave::Parse(unsigned char* byte)
-{
- if(!AbstractData::Parse(byte)) return false;
-
- octave = byte[0];
- return true;
-}
-
-string Octave::LookupOctString()
-{
- // In case some error happens and the values doesn't match the list below
- stringstream defTmp;
-
- switch(octave)
- {
- case oct0:
- return "oct0";
- case oct1:
- return "oct1";
- case oct2:
- return "oct2";
- case oct3:
- return "oct3";
- case oct4:
- return "oct4";
- case oct5:
- return "oct5";
- case oct6:
- return "oct6";
- case oct7:
- return "oct7";
- default:
- defTmp.setf(ios_base::uppercase | ios_base::hex);
- defTmp << "$" << (short)octave;
- return defTmp.str();
- }
-}
-
-unsigned int Octave::Arguments()
-{
- // No Arguments
- return 0;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Octave.h b/music/pokeredmusicdisasm/Octave.h deleted file mode 100644 index c51ea7b1..00000000 --- a/music/pokeredmusicdisasm/Octave.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef OCTAVE_H
-#define OCTAVE_H
-
-#include "AbstractData.h"
-
-//Represents 1 octave value
-class Octave : public AbstractData
-{
-public:
- // Constructors
- Octave();
- Octave(unsigned char* byte); // Parse Immidiately
- Octave(unsigned char octave, bool); // Set value
-
- // Direct Getters / Setters
- unsigned char GetOctave();
- void SetOctave(unsigned char value);
-
- // Overides
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-
- std::string LookupOctString();
-
- enum OctaveCode : unsigned char
- {
- oct0 = 0xE7,
- oct1 = 0xE6,
- oct2 = 0xE5,
- oct3 = 0xE4,
- oct4 = 0xE3,
- oct5 = 0xE2,
- oct6 = 0xE1,
- oct7 = 0xE0
- };
-
-private:
- unsigned char octave;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Parser.cpp b/music/pokeredmusicdisasm/Parser.cpp deleted file mode 100644 index 765766ec..00000000 --- a/music/pokeredmusicdisasm/Parser.cpp +++ /dev/null @@ -1,300 +0,0 @@ -#include <sstream>
-#include "Parser.h"
-using namespace std;
-
-// Constructors
-Parser::Parser()
-{
- rawBytes = 0;
- fileLength = 0;
- filePos = 0;
- stop = false;
- stopAddress = 0;
- force = false;
-}
-
-Parser::Parser(std::string filename)
-{
- rawBytes = 0;
- fileLength = 0;
- filePos = 0;
- stop = false;
- stopAddress = 0;
- force = false;
-
- SetFilename(filename);
-}
-
-// Deconstructors
-Parser::~Parser()
-{
- // Clear out temporary buffer
- delete[] rawBytes;
-
- // Clear out parsed buffer
- for(unsigned int i = 0; i < parsedBytes.size(); i++)
- {
- delete parsedBytes[i];
- }
-}
-
-// Getters / Setters
-string Parser::GetFilename()
-{
- return filename;
-}
-
-void Parser::SetFilename(std::string value)
-{
- filename = value;
- Read();
-}
-
-unsigned int Parser::GetStopAddress()
-{
- return stopAddress;
-}
-
-void Parser::SetStopAddress(unsigned int value)
-{
- stopAddress = value;
-}
-
-bool Parser::GetForce()
-{
- return force;
-}
-
-void Parser::SetForce(bool value)
-{
- force = value;
-}
-
-string Parser::GetParsedAsm()
-{
- string tmpStr;
-
- for(unsigned int i = 0; i < parsedString.size(); i++)
- {
- // Ensure each line isn't already a new-line, this prevents double or tripple empty lines from piling up
- if(parsedString[i] != "\n") tmpStr += parsedString[i] + "\n";
- else tmpStr += parsedString[i];
- }
-
- return tmpStr;
-}
-
-// File Operations
-// Absolutely no error checking at all - likely needs to be done at somepoint
-void Parser::Read()
-{
- // open File
- fstream tmpFile(filename, ios_base::in | ios_base::binary);
-
- // Get Length
- tmpFile.seekg(0, ios::end);
- fileLength = tmpFile.tellg();
- tmpFile.seekg(0, ios::beg);
-
- // Allocate proper memory
- rawBytes = new char[fileLength];
-
- // Read filedata
- tmpFile.read(rawBytes, fileLength);
- tmpFile.close();
-
- rawBytesFixed = (unsigned char*)rawBytes;
-}
-
-// Code Operations
-void Parser::Parse(unsigned int offset)
-{
- filePos = offset;
- ParseNext();
-}
-
-template<class T>
-bool Parser::ParseData(unsigned int& pos, bool reado)
-{
- // Create the class to use if correct and a dummy class for validating
- T* tmpC = 0;
- T dummy;
-
- // If the bytes are this data type then create and save it
- if(dummy.IsValid(&rawBytesFixed[pos]))
- {
- // Ensure this whole opperation isn't read-only (just peeking)
- if(!reado)
- {
- // Initialize the class
- tmpC = new T(&rawBytesFixed[pos]);
-
- // Push it onto the stack and it's assembly generation onto the output class
- parsedBytes.push_back(tmpC); //
- parsedString.push_back(tmpC->GenAsm());
-
- // If the class had any arguments, increment the counter that much forward
- pos += tmpC->Arguments();
- }
- return true; // Let the code know this class was valid
- }
-
- return false; // Let the code know this class wasn't valid
-}
-
-void Parser::ParseNext() // Parses the block immidiately following
-{
- stringstream tmpStr;
- stop = false;
-
- // Smart generation
- bool firstNonNote = false; // (unused so far)First byte wasn't a note or octacve switch, add ";Setup" comment
- bool firstNote = false; // (unused so far) First note or octave
- unsigned char lDataType = DATA_NA;
- bool newBranch = false; // Create a new branch
-
- stringstream pos;
- pos << "; " << hex << uppercase << (unsigned int)filePos;
- parsedString.push_back(pos.str());
-
- unsigned int count = 1; // Counter for processed instructions
- newBranch = true;
- for(unsigned int i = filePos; (i <= fileLength) && (stop == false); i++)
- {
- if(newBranch)
- {
- stringstream _tmpBr;
- _tmpBr << "\n";
- _tmpBr << "UnknSong_md_" << hex << i << ":";
- parsedString.push_back(_tmpBr.str());
-
- _tmpBr.str("");
- newBranch = false;
- }
-
- // First peek to see what kind of data it is, then perform any pre and post setup
- if(ParseData<Call>(i, true))
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<Call>(i);
- lDataType = DATA_CALL;
- }
- else if(ParseData<Duty>(i, true))
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<Duty>(i);
- lDataType = DATA_DUTY;
- }
- else if(ParseData<Jump>(i, true))
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<Jump>(i);
- lDataType = DATA_JUMP;
- }
- else if(ParseData<Modulation>(i, true))
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<Modulation>(i);
- lDataType = DATA_MODULATION;
- }
- else if(ParseData<Note>(i, true))
- {
- // Insert a newline after certain types
- if((lDataType == DATA_UNKCODE) ||
- (lDataType == DATA_UNKEB)) parsedString.push_back("\n");
-
- // If the previous item was a rest note then insert a new line
- else if(lDataType == DATA_NOTE)
- {
- Note* _tmpNote = (Note*)parsedBytes[parsedBytes.size() - 1];
- if(_tmpNote->GetPitch() == _tmpNote->noteRst) parsedString.push_back("\n");
- }
-
- ParseData<Note>(i);
-
- // Further indent each note
- parsedString[parsedString.size() - 1] = "\t" + parsedString[parsedString.size() - 1];
- lDataType = DATA_NOTE;
- }
- else if(ParseData<Octave>(i, true))
- {
- // Insert new-line if previous line isn't a newline
- if(parsedString[parsedString.size() - 1] != "\n") parsedString.push_back("\n");
-
- ParseData<Octave>(i);
- lDataType = DATA_OCTAVE;
- }
- else if(ParseData<Tempo>(i, true))
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<Tempo>(i);
- lDataType = DATA_TEMPO;
- }
- else if(ParseData<Velocity>(i, true))
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<Velocity>(i);
- lDataType = DATA_VELOCITY;
- }
- else if(ParseData<Volume>(i, true))
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<Volume>(i);
- lDataType = DATA_VOLUME;
- }
- else if(ParseData<UnkEB>(i, true)) // The opcode is 0xEB which is unknown and takes a 1-byte argument
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<UnkEB>(i);
- lDataType = DATA_UNKEB;
- }
- else if(ParseData<Stop>(i, true))
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<Stop>(i);
- if(!force) stop = true; // Raise the stop flag informing the parser to stop
- newBranch = true;
- lDataType = DATA_STOP;
- }
- else
- {
- if(lDataType == DATA_NOTE) parsedString.push_back("\n"); // Insert a newline after notes
-
- ParseData<UnkCode>(i); // The opcode is unknown - process the raw byte and move on
- lDataType = DATA_UNKCODE;
- }
-
- // Put everything tabbed over at least 1 time to fix some weird RGBDS bug by pre-pending a tab character
- parsedString[parsedString.size() - 1] = "\t" + parsedString[parsedString.size() - 1];
-
- // Append File Position in hexidecimal at end of line every 5 instructions
- if((count % 5) == 0)
- {
- stringstream _tmpCount;
- _tmpCount << hex << uppercase << i;
- parsedString[parsedString.size() - 1] = parsedString[parsedString.size() - 1] + "; " + _tmpCount.str();
- }
-
- filePos = i;
- count++;
-
- // 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
- pos.str("");
- pos << "; " << hex << uppercase << (unsigned int)filePos;
- parsedString.push_back(pos.str());
-
- filePos += 1; // increment 1 for the start of the next possible song
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Parser.h b/music/pokeredmusicdisasm/Parser.h deleted file mode 100644 index 385195ec..00000000 --- a/music/pokeredmusicdisasm/Parser.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef PARSER_H
-#define PARSER_H
-
-#include <fstream>
-#include <string>
-#include <vector>
-
-#include "AbstractData.h"
-#include "Call.h"
-#include "Console.h"
-#include "Duty.h"
-#include "Jump.h"
-#include "Modulation.h"
-#include "Note.h"
-#include "Octave.h"
-#include "Stop.h"
-#include "Tempo.h"
-#include "Velocity.h"
-#include "Volume.h"
-#include "UnkCode.h"
-#include "UnkEB.h"
-
-// This is the final class, it takes all of the data types, abstract class, and helper functions and uses them
-// for parsing
-
-// the final decided plan was to read the whole file into memory (a rom isn't exactly a big memory breaker)
-class Parser
-{
-public:
- // Constructors
- Parser();
- Parser(std::string filename);
-
- // Deconstructors
- ~Parser();
-
- // Getters / Setters
- std::string GetFilename();
- void SetFilename(std::string value);
-
- unsigned int GetStopAddress();
- void SetStopAddress(unsigned int value);
-
- bool GetForce();
- void SetForce(bool value);
-
- std::string GetParsedAsm();
-
- // File Operations
- void Read();
-
- // Code Operations
- void Parse(unsigned int offset);
- void ParseNext(); // Parses the block immidiately following
-
- // Templates
- template<class T>
- bool ParseData(unsigned int& pos, bool reado = false);
-
- enum dataType : unsigned char
- {
- DATA_NA,
- DATA_CALL,
- DATA_DUTY,
- DATA_JUMP,
- DATA_MODULATION,
- DATA_NOTE,
- DATA_OCTAVE,
- DATA_STOP,
- DATA_TEMPO,
- DATA_UNKCODE,
- DATA_UNKEB,
- DATA_VELOCITY,
- DATA_VOLUME
- };
-
-private:
- std::string filename;
- std::vector<AbstractData*> parsedBytes;
- std::vector<std::string> parsedString;
-
- char* rawBytes;
- unsigned char* rawBytesFixed;
- unsigned int fileLength;
- unsigned int filePos;
- bool stop;
- bool force;
-
- // Optional Settings
- unsigned int stopAddress;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/README.txt b/music/pokeredmusicdisasm/README.txt deleted file mode 100644 index c1c659eb..00000000 --- a/music/pokeredmusicdisasm/README.txt +++ /dev/null @@ -1,26 +0,0 @@ -Usage: [<offset> [<file> | --]] -Usage: [--offset=<offset> | -o <offset>] [--file=[<file> | --] | -f [<file> | --]] [--stop=<offset> | -s <offset>] -Usage: [-h | --help] - -Used without parameters will start in limited interactive mode where the program will ask you the file and offset -An offset is a requirement but the file may be blank or explicitly set, whenever the file is set you may use '--' to substitute for the default file '../baserom.gbc' -If parameter options are not used the ordering is important: -There is an intentional glitch in the program, since long paramaters must be specified with --xxx= with or without a value, you may use the short option instead -xxx even though it's suppose to be -xxx= - * <offset> <file> -If parameter options are used the ordering does not matter, ensure the <offset> parameter option or parameter is present -You may mix and match parameters and parameter options, keep in mind that bare parameters must be in a certain order -If the offset parameter is missing in any way the program will prompt you for it -The program will stop parsing when it encounters mus_end regardlessly -Parameter types - * <xxx> - Bare parameter, they must be in a certain order - * -xxx=xxx - Long parameter option, it can be in any order but is case sensitive, can contain no spaces, must contain the equal sign, and is read literally - * -xxx xxx - Short parameter option, it can be in any order but is case sensitive, must contain 1 space and is read literally ----- -Breakdown of parameters: -<offset> - A bare parameter, it must be in hexidecimal eith alone or prefixed with 0x and be the first parameter. It tells the parser where to start parsing -<file> - A bare parameter, it must be the second parameter and tells the parser which rom file to parse --- - A special file path value meaning use the default file '../baserom.gbc' ---offset, -o - the parameterized offset in hexidecimal, It tells the parser where to start parsing ---file, -f - the parameterized file path, It tells the parser which rom file to parse ---stop, -s - tells the parser to stop at that hexidecimal address or until it reaches mus_end. -help, --help, -h - prints this info and exits, if the bare parameter is used it must be the first parameter diff --git a/music/pokeredmusicdisasm/Stop.cpp b/music/pokeredmusicdisasm/Stop.cpp deleted file mode 100644 index de6aa062..00000000 --- a/music/pokeredmusicdisasm/Stop.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include <sstream>
-#include "Stop.h"
-using namespace std;
-
-Stop::Stop()
-{}
-
-Stop::Stop(unsigned char* byte)
-{
- Parse(byte);
-}
-
-bool Stop::IsValid(unsigned char* byte)
-{
- if(byte[0] == 0xFF)
- {
- error = false; // Unblock assembling
- return true;
- }
- else
- {
- error = true; // Block assembling
- return false;
- }
-}
-
-string Stop::GenAsm()
-{
- string tmpRet = AbstractData::GenAsm();
- if(tmpRet != "") return tmpRet;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_end";
- return tmpAsmOut.str();
-}
-
-bool Stop::Parse(unsigned char* byte)
-{
- if(AbstractData::Parse(byte)) return false;
- return true;
-}
-
-unsigned int Stop::Arguments()
-{
- // No Arguments
- return 0;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Stop.h b/music/pokeredmusicdisasm/Stop.h deleted file mode 100644 index f97a888b..00000000 --- a/music/pokeredmusicdisasm/Stop.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef STOP_H
-#define STOP_H
-
-#include "AbstractData.h"
-
-//Represents 1 end music data
-class Stop : public AbstractData
-{
-public:
- // Constructors
- Stop();
- Stop(unsigned char* byte); // Parse Immidiately
-
- // Re-Implementations
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Tempo.cpp b/music/pokeredmusicdisasm/Tempo.cpp deleted file mode 100644 index a41de4a8..00000000 --- a/music/pokeredmusicdisasm/Tempo.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include <sstream>
-#include "Tempo.h"
-using namespace std;
-
-Tempo::Tempo()
-{
- divider = 0;
- modifier = 0;
-}
-
-Tempo::Tempo(unsigned char* byte) // Parse Immidiately
-{
- Parse(byte);
-}
-
-Tempo::Tempo(unsigned char divider, unsigned char modifier, bool) // Set value
-{
- SetDivider(divider);
- SetModifier(modifier);
-}
-
-unsigned char Tempo::GetDivider()
-{
- return divider;
-}
-
-void Tempo::SetDivider(unsigned char value)
-{
- divider = value;
-}
-
-unsigned char Tempo::Getmodifier()
-{
- return modifier;
-}
-
-void Tempo::SetModifier(unsigned char value)
-{
- modifier = value;
-}
-
-bool Tempo::IsValid(unsigned char* byte)
-{
- if(byte[0] == 0xED)
- {
- error = false;
- return true;
- }
- else
- {
- error = true;
- return false;
- }
-}
-
-string Tempo::GenAsm()
-{
- string tmpRet = AbstractData::GenAsm();
- if(tmpRet != "") return tmpRet;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_tempo" << " " << (short)divider << ", " << (short)modifier;
- return tmpAsmOut.str();
-}
-
-bool Tempo::Parse(unsigned char* byte)
-{
- if(!AbstractData::Parse(byte)) return false;
-
- divider = byte[1];
- modifier = byte[2];
-
- return true;
-}
-
-unsigned int Tempo::Arguments()
-{
- // 2 1-byte arguments = 2
- return 2;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Tempo.h b/music/pokeredmusicdisasm/Tempo.h deleted file mode 100644 index 185c3a94..00000000 --- a/music/pokeredmusicdisasm/Tempo.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef TEMPO_H
-#define TEMPO_H
-
-#include "AbstractData.h"
-
-class Tempo : public AbstractData
-{
-public:
- // Constructors
- Tempo();
- Tempo(unsigned char* byte); // Parse Immidiately
- Tempo(unsigned char divider, unsigned char modifier, bool); // Set value
-
- // Direct Getters and Setters
- unsigned char GetDivider();
- void SetDivider(unsigned char value);
-
- unsigned char Getmodifier();
- void SetModifier(unsigned char value);
-
- // Overides
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-
-private:
- unsigned char divider;
- unsigned char modifier;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/UnkCode.cpp b/music/pokeredmusicdisasm/UnkCode.cpp deleted file mode 100644 index da3cd02f..00000000 --- a/music/pokeredmusicdisasm/UnkCode.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include <sstream>
-#include "UnkCode.h"
-
-using namespace std;
-
-UnkCode::UnkCode()
-{
- code = 0;
-}
-
-UnkCode::UnkCode(unsigned char* byte)
-{
- code = 0;
- Parse(byte);
-}
-
-UnkCode::UnkCode(unsigned char code, bool)
-{
- SetCode(code);
-}
-
-// Getters / Setters
-unsigned char UnkCode::GetCode()
-{
- return code;
-}
-
-void UnkCode::SetCode(unsigned char value)
-{
- code = value;
-}
-
-// Re-implemented
-string UnkCode::GenAsm()
-{
- stringstream tmpAsmOut;
- tmpAsmOut << "db $" << hex << (short)code;
- return tmpAsmOut.str();
-}
-
-bool UnkCode::Parse(unsigned char* byte)
-{
- code = byte[0];
- return true;
-}
-
-bool UnkCode::IsValid(unsigned char* byte)
-{
- return true;
-}
-
-unsigned int UnkCode::Arguments()
-{
- return 0;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/UnkCode.h b/music/pokeredmusicdisasm/UnkCode.h deleted file mode 100644 index 28204448..00000000 --- a/music/pokeredmusicdisasm/UnkCode.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef UNKCODE_H
-#define UNKCODE_H
-
-#include "AbstractData.h"
-
-// Represents an unknown opcode
-class UnkCode : public AbstractData
-{
-public:
- // Constructors
- UnkCode();
- UnkCode(unsigned char* byte); // Parse Immidiately
- UnkCode(unsigned char code, bool); // Set Value
-
- // Getters / Setters
- unsigned char GetCode();
- void SetCode(unsigned char value);
-
- // Re-implemented
- virtual std::string GenAsm();
- virtual bool Parse(unsigned char* byte);
- virtual bool IsValid(unsigned char* byte);
- virtual unsigned int Arguments();
-
-private:
- unsigned char code;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/UnkEB.cpp b/music/pokeredmusicdisasm/UnkEB.cpp deleted file mode 100644 index 39007f30..00000000 --- a/music/pokeredmusicdisasm/UnkEB.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include <sstream>
-#include "UnkEB.h"
-
-using namespace std;
-
-UnkEB::UnkEB()
-{
- param = 0;
-}
-
-UnkEB::UnkEB(unsigned char* byte)
-{
- param = 0;
- Parse(byte);
-}
-
-UnkEB::UnkEB(unsigned char code, bool)
-{
- SetParam(code);
-}
-
-// Getters / Setters
-unsigned char UnkEB::GetParam()
-{
- return param;
-}
-
-void UnkEB::SetParam(unsigned char value)
-{
- param = value;
-}
-
-// Re-implemented
-string UnkEB::GenAsm()
-{
- stringstream tmpAsmOut;
- tmpAsmOut << hex << "db $" << (short)0xEB << ", $" << (short)param;
- return tmpAsmOut.str();
-}
-
-bool UnkEB::Parse(unsigned char* byte)
-{
- param = byte[1];
- return true;
-}
-
-bool UnkEB::IsValid(unsigned char* byte)
-{
- if(byte[0] == 0xEB) return true;
- else return false;
-}
-
-unsigned int UnkEB::Arguments()
-{
- // 1 1-Byte param
- return 1;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/UnkEB.h b/music/pokeredmusicdisasm/UnkEB.h deleted file mode 100644 index ab11a655..00000000 --- a/music/pokeredmusicdisasm/UnkEB.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef UNKEB_H
-#define UNKEB_H
-
-#include "AbstractData.h"
-
-// Represents an unknown opcode
-class UnkEB : public AbstractData
-{
-public:
- // Constructors
- UnkEB();
- UnkEB(unsigned char* byte); // Parse Immidiately
- UnkEB(unsigned char code, bool); // Set Value
-
- // Getters / Setters
- unsigned char GetParam();
- void SetParam(unsigned char value);
-
- // Re-implemented
- virtual std::string GenAsm();
- virtual bool Parse(unsigned char* byte);
- virtual bool IsValid(unsigned char* byte);
- virtual unsigned int Arguments();
-
-private:
- unsigned char param;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Velocity.cpp b/music/pokeredmusicdisasm/Velocity.cpp deleted file mode 100644 index 0000d4ba..00000000 --- a/music/pokeredmusicdisasm/Velocity.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include <sstream>
-#include "Velocity.h"
-using namespace std;
-
-Velocity::Velocity()
-{
- velocity = 0;
- length = 0;
-}
-
-Velocity::Velocity(unsigned char* byte) // Parse Immidiately
-{
- Parse(byte);
-}
-
-Velocity::Velocity(unsigned char velocity, unsigned char length, bool) // Set value
-{
- SetVelocity(velocity);
- SetLength(length);
-}
-
-// Direct Getters/Setters
-unsigned char Velocity::GetVelocity()
-{
- return velocity;
-}
-
-void Velocity::SetVelocity(unsigned char value)
-{
- velocity = value;
-}
-
-unsigned char Velocity::GetLength()
-{
- return length;
-}
-
-void Velocity::SetLength(unsigned char value)
-{
- length = value;
-}
-
-bool Velocity::IsValid(unsigned char* byte)
-{
- if(byte[0] == 0xDC)
- {
- error = false;
- return true;
- }
- else
- {
- error = true;
- return false;
- }
-}
-
-string Velocity::GenAsm()
-{
- string tmpRet = AbstractData::GenAsm();
- if(tmpRet != "") return tmpRet;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_vel" << " " << (short)velocity << ", " << (short)length;
- return tmpAsmOut.str();
-}
-
-bool Velocity::Parse(unsigned char* byte)
-{
- if(!AbstractData::Parse(byte)) return false;
-
- velocity = byte[1] & 0xF0;
- velocity >>= 4;
-
- length = byte[1] & 0x0F;
- return true;
-}
-
-unsigned int Velocity::Arguments()
-{
- // 1 1-byte argument
- return 1;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Velocity.h b/music/pokeredmusicdisasm/Velocity.h deleted file mode 100644 index 5f541b96..00000000 --- a/music/pokeredmusicdisasm/Velocity.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef VELOCITY_H
-#define VELOCITY_H
-
-#include "AbstractData.h"
-
-class Velocity : public AbstractData
-{
-public:
- // Constructors
- Velocity();
- Velocity(unsigned char* byte); // Parse Immidiately
- Velocity(unsigned char velocity, unsigned char length, bool); // Set value
-
- // Direct Getters/Setters
- unsigned char GetVelocity();
- void SetVelocity(unsigned char value);
-
- unsigned char GetLength();
- void SetLength(unsigned char value);
-
- // Overides
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-
-private:
- unsigned char velocity;
- unsigned char length;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Volume.cpp b/music/pokeredmusicdisasm/Volume.cpp deleted file mode 100644 index a0c2d192..00000000 --- a/music/pokeredmusicdisasm/Volume.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include <sstream>
-#include "Volume.h"
-using namespace std;
-
-Volume::Volume()
-{
- volume = 0;
-}
-
-Volume::Volume(unsigned char* byte) // Parse Immidiately
-{
- Parse(byte);
-}
-
-Volume::Volume(unsigned char volume, bool) // Set value
-{
- SetVolume(volume);
-}
-
-unsigned char Volume::GetVolume()
-{
- return volume;
-}
-
-void Volume::SetVolume(unsigned char value)
-{
- volume = value;
-}
-
-bool Volume::IsValid(unsigned char* byte)
-{
- if(byte[0] == 0xF0)
- {
- error = false;
- return true;
- }
- else
- {
- error = true;
- return false;
- }
-}
-
-string Volume::GenAsm()
-{
- string tmpRet = AbstractData::GenAsm();
- if(tmpRet != "") return tmpRet;
-
- stringstream tmpAsmOut;
- tmpAsmOut << "mus_volume" << " " << (short)volume;
- return tmpAsmOut.str();
-}
-
-bool Volume::Parse(unsigned char* byte)
-{
- // If it's not a Note, don't even bother parsing
- if(!AbstractData::Parse(byte)) return false;
-
- volume = byte[1];
- return true;
-}
-
-unsigned int Volume::Arguments()
-{
- // 1 1-byte argument = 1
- return 1;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/Volume.h b/music/pokeredmusicdisasm/Volume.h deleted file mode 100644 index e716e910..00000000 --- a/music/pokeredmusicdisasm/Volume.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef VOLUME_H
-#define VOLUME_H
-
-#include "AbstractData.h"
-
-class Volume : public AbstractData
-{
-public:
- // Constructors
- Volume();
- Volume(unsigned char* byte); // Parse Immidiately
- Volume(unsigned char volume, bool); // Set value
-
- // Direct Getters / Setters
- unsigned char GetVolume();
- void SetVolume(unsigned char value);
-
- // Re-implementations
- virtual std::string GenAsm();
- virtual bool IsValid(unsigned char* byte);
- virtual bool Parse(unsigned char* byte);
- virtual unsigned int Arguments();
-
-private:
- unsigned char volume;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/args.cpp b/music/pokeredmusicdisasm/args.cpp deleted file mode 100644 index f57c9557..00000000 --- a/music/pokeredmusicdisasm/args.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include <sstream>
-#include "args.h"
-using namespace std;
-
-Args::Args(int _argc, char**& _argv)
-{
- argc = _argc;
- for(int i = 0; i < _argc; i++)
- {
- argv.push_back(string(_argv[i]));
- }
-}
-
-//template<class T>
-/*export void Args::GetArg(unsigned int ind, T& var, ios_base::fmtflags flags)
-{
- string stream _tmpstr;
-
- _tmpstr << flags;
- _tmpstr << GetArgv(ind);
- _tmpstr >> var;
-}*/
-
-int Args::GetArgs()
-{
- return argv.size();
-}
-
-string Args::GetArgv(int ind)
-{
- return argv[ind];
-}
-
-bool Args::IsLongOption(int ind) // Is that argument a --long-key=value
-{
- if(GetArgv(ind).substr(0, 2) == "--") return true;
- else return false;
-}
-
-bool Args::IsShortOption(int ind, bool param2) // Is that argument a --long-key=value
-{
- if(param2)
- {
- if(GetArgv(ind).substr(0, 1) == "-" && // The argument must start with -
- GetArgv(ind).substr(0, 2) != "--" && // The argument can't start with "--"
- ind + 1 < GetArgs()) return true; // The second argument must exist
- }
- else
- {
- if(GetArgv(ind).substr(0, 1) == "-" && // The argument must start with -
- GetArgv(ind).substr(0, 2) != "--") return true; // The argument can't start with "--"
- }
-
- return false;
-}
-
-string Args::GetKey(int ind) // Get the key, if not a key/value then returns the arg
-{
- if(IsLongOption(ind) && GetArgv(ind).find("=") != string::npos) return GetArgv(ind).substr(2, GetArgv(ind).find("=") - 2);
- else if(IsShortOption(ind)) return GetArgv(ind).substr(1);
- else return GetArgv(ind);
-}
-
-string Args::GetValue(int ind, bool param2) // Get the value , if not a key/value then returns the arg
-{
- if(IsLongOption(ind) && GetArgv(ind).find("=") != string::npos) return GetArgv(ind).substr(GetArgv(ind).find("=") + 1);
- else if(IsShortOption(ind, param2))
- {
- if(param2) return GetArgv(ind + 1);
- else return GetArgv(ind);
- }
-
- return GetArgv(ind);
-}
-
-int Args::SearchKeys(const char* str)
-{
- string needle = str;
- string scr = "";
- unsigned int pos = -1;
-
- for(int i = 0; i < GetArgs(); i++)
- {
- scr = GetKey(i);
- if(scr == needle)
- {
- pos = i;
- break;
- }
- }
-
- return pos;
-}
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/args.h b/music/pokeredmusicdisasm/args.h deleted file mode 100644 index c8e931f2..00000000 --- a/music/pokeredmusicdisasm/args.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef ARGS_H
-#define ARGS_H
-
-#include <string>
-#include <vector>
-#include <sstream>
-
-class Args
-{
-public:
- Args(int _argc, char**& _argv);
-
- template<class T> // Get the argument automatically in any format that stringstream can output to
- void GetValueC(int ind, T& var, std::ios_base::fmtflags flags = std::ios_base::dec, bool param2 = false)
- {
- std::stringstream _tmpstr;
-
- _tmpstr << GetValue(ind, param2);
- _tmpstr.flags(flags);
- _tmpstr >> var;
- }
-
- int GetArgs(); // Get number of args
- std::string GetArgv(int ind); // Get the arg based on true index
- bool IsLongOption(int ind); // Is that argument a --long-key=value
- bool IsShortOption(int ind, bool param2 = false); // Is that argument a --long-key=value
-
- std::string GetKey(int ind); // Get the key, if not a key/value then returns the arg
- std::string GetValue(int ind, bool param2 = false); // Get the value, if not a key/value then returns the arg
-
- int SearchKeys(const char* str); // Return the index number of found key or -1 if not found
-
-private:
- int argc;
- std::vector<std::string> argv;
-};
-
-#endif
\ No newline at end of file diff --git a/music/pokeredmusicdisasm/main.cpp b/music/pokeredmusicdisasm/main.cpp deleted file mode 100644 index 19d302b4..00000000 --- a/music/pokeredmusicdisasm/main.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include "Console.h"
-#include "Parser.h"
-#include "args.h"
-#include <sstream>
-#include <string>
-
-using namespace std;
-
-void PrintUsage()
-{
- Console::PrintLn("Usage: [<offset> [<file> | --]]");
- Console::PrintLn("Usage: [--offset=<offset> | -o <offset>] [--file=[<file> | --] | -f [<file> | --]] [--stop=<offset> | -s <offset>]");
- Console::PrintLn("Usage: [-h | --help]");
- Console::PrintLn("");
- Console::PrintLn("Used without parameters will start in limited interactive mode where the program will ask you the file and offset");
- Console::PrintLn("An offset is a requirement but the file may be blank or explicitly set, whenever the file is set you may use '--' to substitute for the default file '../baserom.gbc'");
- Console::PrintLn("If parameter options are not used the ordering is important:");
- Console::PrintLn("There is an intentional glitch in the program, since long paramaters must be specified with --xxx= with or without a value, you may use the short option instead -xxx even though it's suppose to be -xxx=");
- Console::PrintLn("\t* <offset> <file>");
- Console::PrintLn("If parameter options are used the ordering does not matter, ensure the <offset> parameter option or parameter is present");
- Console::PrintLn("You may mix and match parameters and parameter options, keep in mind that bare parameters must be in a certain order");
- Console::PrintLn("If the offset parameter is missing in any way the program will prompt you for it");
- Console::PrintLn("The program will stop parsing when it encounters mus_end regardlessly");
- Console::PrintLn("Parameter types");
- Console::PrintLn("\t* <xxx> - Bare parameter, they must be in a certain order");
- Console::PrintLn("\t* -xxx=xxx - Long parameter option, it can be in any order but is case sensitive, can contain no spaces, must contain the equal sign, and is read literally");
- Console::PrintLn("\t* -xxx xxx - Short parameter option, it can be in any order but is case sensitive, must contain 1 space and is read literally");
- Console::PrintLn("----");
- Console::PrintLn("Breakdown of parameters:");
- Console::PrintLn("<offset> - A bare parameter, it must be in hexidecimal eith alone or prefixed with 0x and be the first parameter. It tells the parser where to start parsing");
- Console::PrintLn("<file> - A bare parameter, it must be the second parameter and tells the parser which rom file to parse");
- Console::PrintLn("-- - A special file path value meaning use the default file '../baserom.gbc'");
- Console::PrintLn("--offset, -o - the parameterized offset in hexidecimal, It tells the parser where to start parsing");
- Console::PrintLn("--file, -f - the parameterized file path, It tells the parser which rom file to parse");
- Console::PrintLn("--stop, -s - tells the parser to stop at that hexidecimal address or until it reaches mus_end.");
- Console::PrintLn("-fo - must be used with --stop, forces the program to proceed on despite discovering any mus_end");
- Console::PrintLn("help, --help, -h - prints this info and exits, if the bare parameter is used it must be the first parameter");
-}
-
-/*
- Usage:
- pokeredmusicdisasm [<offset> [<file> | --]]
- pokeredmusicdisasm [--offset=<offset> | -o <offset>] [--file=[<file> | --] | -f [<file> | --]] [--stop=<offset> | -s <offset>]
-*/
-int main(int argc, char** argv)
-{
- Args a(argc, argv);
-
- const unsigned char parameters = 2;
- const string defFileLoc = "../baserom.gbc";
-
- string filePath = "";
- unsigned int offset = 0;
- unsigned int stop = 0;
- bool force = false;
-
- // Get the file path, this can be set with -f filename, --file=filename, arg #2, or missing (missing means default)
- // the filepath can contain the actual filename or -- to use the built-in path, if the path is not missing then it must be set (can't be blank)
-
- // Is the user asking for help with -h, --help=, or help
- if((a.SearchKeys("h") != -1) || (a.SearchKeys("help") != -1) || (a.GetArgv(1) == "help"))
- {
- PrintUsage();
- return 0;
- }
-
- // Does a -f or --file key exist
- if(a.SearchKeys("f") != -1) filePath = a.GetValue(a.SearchKeys("f"), true);
- else if(a.SearchKeys("file") != -1) filePath = a.GetValue(a.SearchKeys("file"));
-
- // BUG FIX: a short parameter can be either 1 or 2 parts so this causes the if statement below to load incorrect info if
- // -f or --file isn't specified and the first argument is a short parameter "-x x"
- else if((a.GetArgs() == (2 + 1)) && (a.IsShortOption(1, true))) filePath = defFileLoc;
-
- // Does arg #2 exist
- else if(a.GetArgs() >= 2 + 1) a.GetValueC<string>(2, filePath);
-
- // Is there at least 1 arg (In that case it's missing and the default can be assumed)
- else if(a.GetArgs() >= 1 + 1) filePath = defFileLoc;
-
- // Ask the user
- else Console::Ask("Filepath: ", filePath);
-
- if(filePath == "--") filePath = defFileLoc;
- else if(filePath == "")
- {
- Console::PrintLn("Filename can't be blank");
- return 1;
- }
-
- // Get the offset, this can be set with -o <offset>, --offset=<offset>, or as arg #1
- if(a.SearchKeys("o") != -1) a.GetValueC<unsigned int>(a.SearchKeys("o"), offset, ios_base::hex | ios_base::uppercase, true);
- else if(a.SearchKeys("offset") != -1) a.GetValueC(a.SearchKeys("offset"), offset, ios_base::hex | ios_base::uppercase);
-
- // Does arg #1 exist
- else if(a.GetArgs() >= 1 + 1) a.GetValueC<unsigned int>(1, offset, ios_base::hex | ios_base::uppercase);
-
- // Ask the user
- else Console::Ask<unsigned int>("Offset: ", offset, ios_base::hex | ios_base::uppercase);
-
- // Get the stop parameter, this can be set with -s <offset>, --stop=<offset> (it must be set via args)
- if(a.SearchKeys("s") != -1) a.GetValueC<unsigned int>(a.SearchKeys("s"), stop, ios_base::hex | ios_base::uppercase, true);
- else if(a.SearchKeys("stop") != -1) filePath = a.GetValue(a.SearchKeys("stop"));
-
- // Get the force parameter, this can be set with -f (it must be set via args)
- if(a.SearchKeys("fo") != -1) force = true;
-
- if((stop == 0) && (force == true))
- {
- Console::ErrorLn("Error! You set the force command but did not set the stop command, this means it will parse every line until the end of the rom.");
- return 1;
- }
-
- Parser p(filePath);
- if(stop != 0) p.SetStopAddress(stop);
- if(force) p.SetForce(true);
- p.Parse(offset);
-
- Console::PrintLn(p.GetParsedAsm().c_str());
-
- return 0;
-}
\ No newline at end of file |
