100% JASSeqReader.o

This commit is contained in:
Headpenguin 2023-07-31 13:44:51 -04:00
parent 59fd3cb3dd
commit d9b42c8e51
4 changed files with 127 additions and 18 deletions

View File

@ -42,7 +42,7 @@ def main(compile_non_matching, use_ninja, clean_ninja, link):
isNotWindows = os.name != "nt"
flags = "-c -nodefaults -nostdlib -proc gekko -align powerpc -enum int -enc SJIS -fp hard -Cpp_exceptions off -rtti off -DEPPC -DGEKKO -O4,p -inline auto "
flags = flags = "-c -nodefaults -nostdlib -proc gekko -align powerpc -enum int -enc SJIS -fp hard -Cpp_exceptions off -rtti off -DEPPC -DGEKKO -O4,s -sdata 4 -sdata2 4 -inline auto -ipa file "
includes = "-i . -I- -i include "
msl_path = pathlib.Path("../MSL_C/include")

View File

@ -189,15 +189,15 @@ __ct__16JASRegisterParamFv,JASRegisterParam.o,JAudio2.a,false
init__16JASRegisterParamFv,JASRegisterParam.o,JAudio2.a,false
write__16JASRegisterParamFQ216JASRegisterParam5RegIDUl,JASRegisterParam.o,JAudio2.a,false
read__16JASRegisterParamFQ216JASRegisterParam5RegID,JASRegisterParam.o,JAudio2.a,false
__ct__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,false
init__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,false
start__10JASSeqCtrlFPvUl,JASSeqCtrl.o,JAudio2.a,false
tickProc__10JASSeqCtrlFP8JASTrack,JASSeqCtrl.o,JAudio2.a,false
interrupt__10JASSeqCtrlFQ210JASSeqCtrl8IntrType,JASSeqCtrl.o,JAudio2.a,false
setIntrMask__10JASSeqCtrlFUl,JASSeqCtrl.o,JAudio2.a,false
clrIntrMask__10JASSeqCtrlFUl,JASSeqCtrl.o,JAudio2.a,false
retIntr__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,false
findIntr__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,false
__ct__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,true
init__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,true
start__10JASSeqCtrlFPvUl,JASSeqCtrl.o,JAudio2.a,true
tickProc__10JASSeqCtrlFP8JASTrack,JASSeqCtrl.o,JAudio2.a,true
interrupt__10JASSeqCtrlFQ210JASSeqCtrl8IntrType,JASSeqCtrl.o,JAudio2.a,true
setIntrMask__10JASSeqCtrlFUl,JASSeqCtrl.o,JAudio2.a,true
clrIntrMask__10JASSeqCtrlFUl,JASSeqCtrl.o,JAudio2.a,true
retIntr__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,true
findIntr__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,true
checkIntr__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,false
timerProcess__10JASSeqCtrlFv,JASSeqCtrl.o,JAudio2.a,false
__sinit_\JASSeqCtrl_cpp,JASSeqCtrl.o,JAudio2.a,false
@ -271,14 +271,14 @@ parseCommand__12JASSeqParserFP8JASTrackUcUs,JASSeqParser.o,JAudio2.a,false
parseRegCommand__12JASSeqParserFP8JASTracki,JASSeqParser.o,JAudio2.a,false
parse__12JASSeqParserFP8JASTrack,JASSeqParser.o,JAudio2.a,false
__sinit_\JASSeqParser_cpp,JASSeqParser.o,JAudio2.a,false
init__12JASSeqReaderFv,JASSeqReader.o,JAudio2.a,false
init__12JASSeqReaderFPv,JASSeqReader.o,JAudio2.a,false
call__12JASSeqReaderFUl,JASSeqReader.o,JAudio2.a,false
loopStart__12JASSeqReaderFUl,JASSeqReader.o,JAudio2.a,false
loopEnd__12JASSeqReaderFv,JASSeqReader.o,JAudio2.a,false
ret__12JASSeqReaderFv,JASSeqReader.o,JAudio2.a,false
readMidiValue__12JASSeqReaderFv,JASSeqReader.o,JAudio2.a,false
getStackPtr__12JASSeqReaderCFUl,JASSeqReader.o,JAudio2.a,false
init__12JASSeqReaderFv,JASSeqReader.o,JAudio2.a,true
init__12JASSeqReaderFPv,JASSeqReader.o,JAudio2.a,true
call__12JASSeqReaderFUl,JASSeqReader.o,JAudio2.a,true
loopStart__12JASSeqReaderFUl,JASSeqReader.o,JAudio2.a,true
loopEnd__12JASSeqReaderFv,JASSeqReader.o,JAudio2.a,true
ret__12JASSeqReaderFv,JASSeqReader.o,JAudio2.a,true
readMidiValue__12JASSeqReaderFv,JASSeqReader.o,JAudio2.a,true
getStackPtr__12JASSeqReaderCFUl,JASSeqReader.o,JAudio2.a,true
initSystem__13JASAramStreamFUlUl,JASAramStream.o,JAudio2.a,false
__ct__13JASAramStreamFv,JASAramStream.o,JAudio2.a,false
init__13JASAramStreamFUlUlPFUlP13JASAramStreamPv_vPv,JASAramStream.o,JAudio2.a,false

1 Symbol Name Object File Library Archive Matching
189 init__16JASRegisterParamFv JASRegisterParam.o JAudio2.a false
190 write__16JASRegisterParamFQ216JASRegisterParam5RegIDUl JASRegisterParam.o JAudio2.a false
191 read__16JASRegisterParamFQ216JASRegisterParam5RegID JASRegisterParam.o JAudio2.a false
192 __ct__10JASSeqCtrlFv JASSeqCtrl.o JAudio2.a false true
193 init__10JASSeqCtrlFv JASSeqCtrl.o JAudio2.a false true
194 start__10JASSeqCtrlFPvUl JASSeqCtrl.o JAudio2.a false true
195 tickProc__10JASSeqCtrlFP8JASTrack JASSeqCtrl.o JAudio2.a false true
196 interrupt__10JASSeqCtrlFQ210JASSeqCtrl8IntrType JASSeqCtrl.o JAudio2.a false true
197 setIntrMask__10JASSeqCtrlFUl JASSeqCtrl.o JAudio2.a false true
198 clrIntrMask__10JASSeqCtrlFUl JASSeqCtrl.o JAudio2.a false true
199 retIntr__10JASSeqCtrlFv JASSeqCtrl.o JAudio2.a false true
200 findIntr__10JASSeqCtrlFv JASSeqCtrl.o JAudio2.a false true
201 checkIntr__10JASSeqCtrlFv JASSeqCtrl.o JAudio2.a false
202 timerProcess__10JASSeqCtrlFv JASSeqCtrl.o JAudio2.a false
203 __sinit_\JASSeqCtrl_cpp JASSeqCtrl.o JAudio2.a false
271 parseRegCommand__12JASSeqParserFP8JASTracki JASSeqParser.o JAudio2.a false
272 parse__12JASSeqParserFP8JASTrack JASSeqParser.o JAudio2.a false
273 __sinit_\JASSeqParser_cpp JASSeqParser.o JAudio2.a false
274 init__12JASSeqReaderFv JASSeqReader.o JAudio2.a false true
275 init__12JASSeqReaderFPv JASSeqReader.o JAudio2.a false true
276 call__12JASSeqReaderFUl JASSeqReader.o JAudio2.a false true
277 loopStart__12JASSeqReaderFUl JASSeqReader.o JAudio2.a false true
278 loopEnd__12JASSeqReaderFv JASSeqReader.o JAudio2.a false true
279 ret__12JASSeqReaderFv JASSeqReader.o JAudio2.a false true
280 readMidiValue__12JASSeqReaderFv JASSeqReader.o JAudio2.a false true
281 getStackPtr__12JASSeqReaderCFUl JASSeqReader.o JAudio2.a false true
282 initSystem__13JASAramStreamFUlUl JASAramStream.o JAudio2.a false
283 __ct__13JASAramStreamFv JASAramStream.o JAudio2.a false
284 init__13JASAramStreamFUlUlPFUlP13JASAramStreamPv_vPv JASAramStream.o JAudio2.a false

View File

@ -0,0 +1,25 @@
#pragma once
#include <revolution/types.h>
struct int24 {
unsigned num: 24;
};
class JASSeqReader {
public:
void init();
void init(void *);
bool call(u32);
bool loopStart(u32);
bool loopEnd();
bool ret();
u32 readMidiValue();
void* getStackPtr(u32) const;
void* _0;
void* _4;
u32 _8;
void* _C[8];
u16 _2C[8];
};

View File

@ -0,0 +1,84 @@
#include "JSystem/JAudio2/JASSeqReader.h"
void JASSeqReader::init() {
_0 = nullptr;
_4 = nullptr;
_8 = 0;
for(u32 i = 0; i < 8; i++) {
_C[i] = 0;
_2C[i] = 0;
}
}
void JASSeqReader::init(void *buf) {
_0 = buf;
_4 = buf;
_8 = 0;
for(u32 i = 0; i < 8; i++) {
_C[i] = 0;
_2C[i] = 0;
}
}
bool JASSeqReader::call(u32 num) {
if(_8 >= 8) return false;
else {
_C[_8++] = _4;
_4 = (char*)_0 + num;
return true;
}
}
bool JASSeqReader::loopStart(u32 num) {
if(_8 >= 8) return false;
else {
_C[_8] = _4;
_2C[_8++] = num;
return true;
}
}
bool JASSeqReader::loopEnd() {
if(_8 == 0) return false;
else {
u16 end = _2C[_8 - 1];
if(end > 0) end--;
if(end == 0) {
_8--;
return true;
}
_2C[_8 - 1] = end;
_4 = _C[_8 - 1];
return true;
}
}
bool JASSeqReader::ret() {
if(_8 == 0) return false;
else {
_4 = _C[--_8];
return true;
}
}
u32 JASSeqReader::readMidiValue() {
u8 byte = *((u8*)_4)++;
if(!(byte & 0x80)) return byte;
u32 byte2 = byte & 0x7f;
s32 i = 0;
u8 byte4;
do {
if(i > 2) return 0;
byte2 = byte2 << 7;
byte4 = *((u8*)_4)++;
byte2 |= byte4 & 0x7f;
if(!(byte4 & 0x80)) break;
i++;
} while(true);
return byte2;
}
void* JASSeqReader::getStackPtr(u32 idx) const {
if(idx >= _8) return nullptr;
else return _C[idx];
}