mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-07 08:05:23 +13:00
made changes in repo
hg-commit-id: 1145e088ee27
This commit is contained in:
parent
21caa525cc
commit
4d0797bc3a
30 changed files with 1748 additions and 0 deletions
97
music/pokeredmusicdisasm/Octave.cpp
Normal file
97
music/pokeredmusicdisasm/Octave.cpp
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue