Skip to content

Commit

Permalink
JASSeqParser 99%
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Sep 8, 2024
1 parent a0fdc41 commit 0352a53
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 120 deletions.
4 changes: 2 additions & 2 deletions include/JSystem/JAudio/JASRegisterParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ namespace JASystem {

void getAddress(int) const {}
void getBendSense() const {}
void getFlag() const {}
u16 getFlag() const { return field_0x0[3]; }
void getPanPowerBank() const {}
void getPanPowerExt() const {}
void getPanPowerOsc() const {}
void getPanPowerParent() const {}
void getPanPowerTrack() const {}
void getPriority() const {}
void setAddress(int, u32) {}
void setFlag(u16) {}
void setFlag(u16 flag) { field_0x0[3] = flag; }
void setPanPower(int i, u16 power) { mPanPower[i] = power; }

/* 0x00 */ u16 field_0x0[6];
Expand Down
2 changes: 1 addition & 1 deletion include/JSystem/JAudio/JASSeqCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace JASystem {
u16 get16(u32) const;
u32 get24(u32) const;
u32 get32(u32) const;
u32 read16();
u16 read16();
u32 read24();

/* 0x00 */ u8* mRawFilePtr;
Expand Down
8 changes: 7 additions & 1 deletion include/JSystem/JAudio/JASSeqParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace JASystem {
class TTrack;
class TSeqParser {
public:
typedef int (TSeqParser::*CmdFunc)(JASystem::TTrack*, u32*);

int cmdOpenTrack(TTrack*, u32*);
int cmdOpenTrackBros(TTrack*, u32*);
int cmdCall(TTrack*, u32*);
Expand Down Expand Up @@ -71,7 +73,11 @@ namespace JASystem {
static int (TSeqParser::*sCmdPList[])(TTrack*, u32*);
};

extern const u16 Arglist[0x40][2];
struct Arg_s { // Fake name
u16 m00;
u16 m02;
};
extern const Arg_s Arglist[0x40];
}

#endif /* JASSEQPARSER_H */
28 changes: 18 additions & 10 deletions include/JSystem/JAudio/JASTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ namespace JASystem {

class TNoteMgr {
public:
void setBaseTime(u32 time) { mBaseTime = time; }
u8 getConnectCase() const { return mConnectCase; }
void setConnectCase(u8 val) { mConnectCase = val; }
u8 getLastNote() const { return mLastNote; }
void setLastNote(u8 note) { mLastNote = note; }
bool checkBeforeTieMode() const { return mBeforeTieMode; }
void setBeforeTieMode(bool mode) { mBeforeTieMode = mode; }

void init();
void endProcess();
void setChannel(int, TChannel*);
Expand All @@ -151,10 +159,10 @@ namespace JASystem {

/* 0x00 */ TChannel* field_0x0[8];
/* 0x20 */ u16 field_0x20[8];
/* 0x30 */ int field_0x30;
/* 0x34 */ u8 field_0x34;
/* 0x35 */ u8 field_0x35;
/* 0x36 */ u8 field_0x36;
/* 0x30 */ int mBaseTime;
/* 0x34 */ u8 mConnectCase;
/* 0x35 */ u8 mLastNote;
/* 0x36 */ u8 mBeforeTieMode;
};

static const int MAX_CHILDREN = 16;
Expand Down Expand Up @@ -227,26 +235,26 @@ namespace JASystem {

TOuterParam* getOuterParam() { return mOuterParam; }

bool checkImport(int i) const { return mTrackPort.checkImport(i); }
bool checkExport(int i) const { return mTrackPort.checkExport(i); }
u8 checkImport(int i) const { return mTrackPort.checkImport(i); }
u8 checkExport(int i) const { return mTrackPort.checkExport(i); }
void getActivity() const {}
void getRoute() const {}
TSeqCtrl* getSeq() { return &mSeqCtrl; }
// void operator delete(void*, u32) {}
// void* operator new(size_t) {}
void pauseTrackAll() {}
void pauseTrackAll() { pause(true, true); }
void unPauseTrackAll() { pause(false, true); }
void setPanPower(int i, u16 power) { mRegisterParam.setPanPower(i, power); }
void setPauseStatus(u8) {}
void setPauseStatus(u8 status) { mPauseStatus = status; }
void setTranspose(s32 transpose) { field_0x37a = transpose; }
void setVolumeMode(u8 mode) { mVolumeMode = mode; }
void unPauseTrackAll() {}

/* 0x000 */ union {
TSeqCtrl mSeqCtrl;
TTrack* next;
};
/* 0x048 */ TTrackPort mTrackPort;
/* 0x088 */ TIntrMgr field_0x88;
/* 0x088 */ TIntrMgr mIntrMgr;
/* 0x0B4 */ TNoteMgr mNoteMgr;
/* 0x0EC */ TVibrate mVibrate;
/* 0x0F8 */ TChannelMgr mChannelUpdater;
Expand Down
8 changes: 8 additions & 0 deletions include/JSystem/JAudio/JASTrackInterrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
namespace JASystem {
class TIntrMgr {
public:
void disable() { field_0x0 = 0; }
void enable() { field_0x0 = 1; }
void setTimer(u32 param_1, u32 param_2) {
field_0x3 = param_1;
field_0x4 = param_2;
field_0x8 = param_2;
}

void init();
void request(u32);
void setIntr(u32, void*);
Expand Down
4 changes: 2 additions & 2 deletions include/JSystem/JAudio/JASTrackPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace JASystem {
void writeImport(int, u16);
void writeExport(int, u16);

bool checkImport(int i) const { return mImportFlag[i] != 0; }
bool checkExport(int i) const { return mExportFlag[i] != 0; }
u8 checkImport(int i) const { return mImportFlag[i]; }
u8 checkExport(int i) const { return mExportFlag[i]; }
u16 get(u32 i) { return mValue[i]; }

/* 0x00 */ u8 mImportFlag[TRACKPORT_MAX];
Expand Down
4 changes: 2 additions & 2 deletions src/JSystem/JAudio/JAISound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void JAISound::setPauseMode(u8 param_1, u8 param_2) {
break;
case 2:
JASystem::TTrack* track = getSeqParameter()->getRootTrackPointer();
track->pause(true, true);
track->pauseTrackAll();
break;
}
} else {
Expand All @@ -559,7 +559,7 @@ void JAISound::setPauseMode(u8 param_1, u8 param_2) {
break;
case 2:
JASystem::TTrack* track = getSeqParameter()->getRootTrackPointer();
track->pause(false, true);
track->unPauseTrackAll();
break;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/JSystem/JAudio/JASNoteMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ static const int MULTI_MAX = 8;

/* 8027DD54-8027DD94 .text init__Q38JASystem6TTrack8TNoteMgrFv */
void JASystem::TTrack::TNoteMgr::init() {
field_0x30 = 0;
field_0x34 = 0;
field_0x35 = 0;
field_0x36 = 0;
mBaseTime = 0;
mConnectCase = 0;
mLastNote = 0;
mBeforeTieMode = 0;
for (int i = 0; i < MULTI_MAX; i++) {
field_0x0[i] = NULL;
field_0x20[i] = 0;
Expand All @@ -23,10 +23,10 @@ void JASystem::TTrack::TNoteMgr::init() {

/* 8027DD94-8027DDBC .text endProcess__Q38JASystem6TTrack8TNoteMgrFv */
void JASystem::TTrack::TNoteMgr::endProcess() {
if (field_0x30 == 0xffffffff) {
if (mBaseTime == 0xffffffff) {
return;
}
if (field_0x34 != 0) {
if (mConnectCase != 0) {
return;
}
field_0x0[0] = NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/JSystem/JAudio/JASSeqCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ u32 JASystem::TSeqCtrl::get32(u32 param_1) const {
}

/* 8027E614-8027E63C .text read16__Q28JASystem8TSeqCtrlFv */
u32 JASystem::TSeqCtrl::read16() {
u32 result = readByte() << 8;
u16 JASystem::TSeqCtrl::read16() {
u16 result = readByte() << 8;
result |= readByte();
return result;
}
Expand Down
Loading

0 comments on commit 0352a53

Please sign in to comment.