JASTrackInterrupt

This commit is contained in:
Jcw87
2023-10-16 18:55:14 -07:00
parent 097a9a6900
commit bf77eba324
3 changed files with 76 additions and 13 deletions
+1 -1
View File
@@ -668,7 +668,7 @@ config.libs = [
Object(NonMatching, "JSystem/JAudio/JASSeqCtrl.cpp"),
Object(NonMatching, "JSystem/JAudio/JASSeqParser.cpp"),
Object(NonMatching, "JSystem/JAudio/JASTrack.cpp"),
Object(NonMatching, "JSystem/JAudio/JASTrackInterrupt.cpp"),
Object(Matching, "JSystem/JAudio/JASTrackInterrupt.cpp"),
Object(Matching, "JSystem/JAudio/JASTrackPort.cpp"),
Object(NonMatching, "JSystem/JAudio/JASBank.cpp"),
Object(NonMatching, "JSystem/JAudio/JASWaveBank.cpp"),
@@ -0,0 +1,26 @@
#ifndef JASTRACKINTERRUPT_H
#define JASTRACKINTERRUPT_H
#include "dolphin/types.h"
namespace JASystem {
class TIntrMgr {
public:
void init();
void request(u32);
void setIntr(u32, void*);
void resetInter(u32);
void* checkIntr();
void timerProcess();
/* 0x00 */ u8 field_0x0;
/* 0x01 */ u8 field_0x1;
/* 0x02 */ u8 field_0x2;
/* 0x03 */ u8 field_0x3;
/* 0x04 */ u32 field_0x4;
/* 0x08 */ u32 field_0x8;
/* 0x0C */ void* field_0xc[8];
};
}
#endif /* JASTRACKINTERRUPT_H */
+49 -12
View File
@@ -3,36 +3,73 @@
// Translation Unit: JASTrackInterrupt.cpp
//
#include "JASTrackInterrupt.h"
#include "dolphin/types.h"
#include "JSystem/JAudio/JASTrackInterrupt.h"
/* 80284118-80284158 .text init__Q28JASystem8TIntrMgrFv */
void JASystem::TIntrMgr::init() {
/* Nonmatching */
field_0x0 = 1;
field_0x1 = 0;
field_0x2 = 0;
field_0x3 = 0;
field_0x4 = 0;
field_0x8 = 0;
for (int i = 0; i < 8; i++) {
field_0xc[i] = NULL;
}
}
/* 80284158-8028417C .text request__Q28JASystem8TIntrMgrFUl */
void JASystem::TIntrMgr::request(unsigned long) {
/* Nonmatching */
void JASystem::TIntrMgr::request(u32 param_1) {
if ((field_0x2 & 1 << param_1) == 0) {
return;
}
field_0x1 |= 1 << param_1;
}
/* 8028417C-802841A0 .text setIntr__Q28JASystem8TIntrMgrFUlPv */
void JASystem::TIntrMgr::setIntr(unsigned long, void*) {
/* Nonmatching */
void JASystem::TIntrMgr::setIntr(u32 param_1, void* param_2) {
field_0x2 |= 1 << param_1;
field_0xc[param_1] = param_2;
}
/* 802841A0-802841B8 .text resetInter__Q28JASystem8TIntrMgrFUl */
void JASystem::TIntrMgr::resetInter(unsigned long) {
void JASystem::TIntrMgr::resetInter(u32 param_1) {
/* Nonmatching */
field_0x2 &= ~(1 << param_1);
}
/* 802841B8-80284224 .text checkIntr__Q28JASystem8TIntrMgrFv */
void JASystem::TIntrMgr::checkIntr() {
/* Nonmatching */
void* JASystem::TIntrMgr::checkIntr() {
if (field_0x0 == 0) {
return NULL;
}
u32 r4 = field_0x2 & field_0x1;
for (u32 i = 0; r4; i++) {
if (r4 & 1) {
field_0x1 &= ~(1 << i);
return field_0xc[i];
}
r4 >>= 1;
}
return NULL;
}
/* 80284224-802842A8 .text timerProcess__Q28JASystem8TIntrMgrFv */
void JASystem::TIntrMgr::timerProcess() {
/* Nonmatching */
if (field_0x4 == 0) {
return;
}
field_0x4--;
if (field_0x4 != 0) {
return;
}
request(6);
if (field_0x3) {
field_0x3--;
if (field_0x3) {
field_0x4 = field_0x8;
}
} else {
field_0x4 = field_0x8;
}
}