misc minor JAI fixes

This commit is contained in:
LagoLunatic
2024-07-06 13:49:32 -04:00
parent ee8b3967a5
commit 3bef4f90d4
8 changed files with 46 additions and 36 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ public:
void stopAllSound(u32);
void stopAllSound(u32, void*);
void deleteObject(void*);
int getSoundOffsetNumberFromID(u32);
u16 getSoundOffsetNumberFromID(u32);
void setSeCategoryVolume(u8, u8);
static u16 setParameterSeqSync(JASystem::TTrack*, u16);
bool allocStreamBuffer(void*, s32);
+2 -2
View File
@@ -17,7 +17,7 @@ public:
/* 0x04 */ u8 field_0x4[0x8 - 0x4];
/* 0x08 */ f32 field_0x8;
/* 0x0C */ u8 field_0xc[0x18 - 0xc];
/* 0x10 */ f32 field_0x18;
/* 0x18 */ f32 field_0x18;
};
JAISound();
@@ -85,7 +85,7 @@ public:
void getAct() {}
void getAdjustPriority() {}
void getFadetime() {}
void getID() {}
u32 getID() { return mSoundID; }
void getInfoPointer() {}
void getMapInfo() {}
void getNextSound() {}
+12 -4
View File
@@ -16,8 +16,9 @@ namespace JASystem {
namespace JAInter {
class Actor;
struct streamUpdate_t {
streamUpdate_t() { field_0x14 = 0; }
streamUpdate_t() { mpSound = NULL; }
/* 0x00 */ u8 field_0x0;
/* 0x01 */ u8 field_0x1;
@@ -26,7 +27,13 @@ namespace JAInter {
/* 0x08 */ f32 field_0x8;
/* 0x0C */ f32 field_0xc;
/* 0x10 */ int field_0x10;
/* 0x14 */ JAISound* field_0x14;
/* 0x14 */ JAISound* mpSound;
};
struct streamList_t {
/* 0x00 */ u8 field_0x00[0x10 - 0x00];
/* 0x10 */ char field_0x10[0x10];
/* 0x20 */ u8 field_0x20[0x10];
};
class StreamParameter {
@@ -61,13 +68,14 @@ namespace JAInter {
u8 flag6 : 1;
u8 flag7 : 1;
u8 flag8 : 1;
u8 flag9 : 1;
};
extern LinkSound streamControl;
extern flags_t flags;
extern streamUpdate_t* streamUpdate;
extern u8* streamList;
extern u8* initOnCodeStrm;
extern streamList_t* streamList;
extern streamList_t* initOnCodeStrm;
inline streamUpdate_t* getUpdateInfo() { return streamUpdate; }
}
+6 -7
View File
@@ -200,8 +200,8 @@ void JAIZelBasic::resetProcess() {
data->field_0x48->setSeqInterVolume(6, 0.0f, 1);
}
}
if (JAInter::StreamMgr::getUpdateInfo()->field_0x14) {
JAInter::StreamMgr::getUpdateInfo()->field_0x14->stop(1);
if (JAInter::StreamMgr::getUpdateInfo()->mpSound) {
JAInter::StreamMgr::getUpdateInfo()->mpSound->stop(1);
}
if (JAInter::SeMgr::seHandle) {
JAInter::SeMgr::seHandle->setSeqInterVolume(6, 0.0f, 1);
@@ -463,7 +463,7 @@ bool JAIZelBasic::checkBgmPlaying() {
/* 802A59D8-802A59F4 .text checkPlayingMainBgmFlag__11JAIZelBasicFv */
int JAIZelBasic::checkPlayingMainBgmFlag() {
if (mpMainBgmSound) {
return mpMainBgmSound->mSoundID;
return mpMainBgmSound->getID();
} else {
return -1;
}
@@ -481,7 +481,7 @@ BOOL JAIZelBasic::checkSubBgmPlaying() {
/* 802A5A04-802A5A20 .text checkPlayingSubBgmFlag__11JAIZelBasicFv */
int JAIZelBasic::checkPlayingSubBgmFlag() {
if (mpSubBgmSound) {
return mpSubBgmSound->mSoundID;
return mpSubBgmSound->getID();
} else {
return -1;
}
@@ -489,11 +489,10 @@ int JAIZelBasic::checkPlayingSubBgmFlag() {
/* 802A5A20-802A5A40 .text checkPlayingStreamBgmFlag__11JAIZelBasicFv */
int JAIZelBasic::checkPlayingStreamBgmFlag() {
JAInter::streamUpdate_t* temp = JAInter::StreamMgr::getUpdateInfo();
if (temp->field_0x14 == NULL) {
if (JAInter::StreamMgr::getUpdateInfo()->mpSound == NULL) {
return -1;
} else {
return temp->field_0x14->mSoundID;
return JAInter::StreamMgr::getUpdateInfo()->mpSound->getID();
}
}
+1 -1
View File
@@ -297,7 +297,7 @@ f32 JAIBasic::getMapInfoFxParameter(u32 param_1) {
}
/* 80290DC4-80290E14 .text getSoundOffsetNumberFromID__8JAIBasicFUl */
int JAIBasic::getSoundOffsetNumberFromID(u32) {
u16 JAIBasic::getSoundOffsetNumberFromID(u32) {
/* Nonmatching */
}
+4 -3
View File
@@ -84,9 +84,10 @@ void JAInter::InitData::checkInitDataOnMemory() {
r30 += 3;
break;
case 5:
StreamMgr::initOnCodeStrm = transInitDataFile((u8*)(aafPointer + r30), 8);
*(u8**)StreamMgr::initOnCodeStrm = transInitDataFile((u8*)aafPointer + aafPointer[r30], aafPointer[r30 + 1]);
StreamMgr::streamList = *(u8**)StreamMgr::initOnCodeStrm;
StreamMgr::initOnCodeStrm = (JAInter::streamList_t*)transInitDataFile((u8*)(aafPointer + r30), 8);
// fakematch?
*(JAInter::streamList_t**)StreamMgr::initOnCodeStrm = (JAInter::streamList_t*)transInitDataFile((u8*)aafPointer + aafPointer[r30], aafPointer[r30 + 1]);
StreamMgr::streamList = *(JAInter::streamList_t**)StreamMgr::initOnCodeStrm;
r30 += 3;
break;
case 6: {
+18 -16
View File
@@ -44,8 +44,8 @@ int JAInter::StreamLib::LOOP_SAMPLESIZE = 0xF000;
int JAInter::StreamLib::outputmode = 1;
JAInter::StreamMgr::flags_t JAInter::StreamMgr::flags;
JAInter::streamUpdate_t* JAInter::StreamMgr::streamUpdate;
u8* JAInter::StreamMgr::streamList;
u8* JAInter::StreamMgr::initOnCodeStrm;
JAInter::streamList_t* JAInter::StreamMgr::streamList;
JAInter::streamList_t* JAInter::StreamMgr::initOnCodeStrm;
u32 JAInter::StreamLib::adpcm_remain;
u32 JAInter::StreamLib::adpcm_loadpoint;
u32 JAInter::StreamLib::loadsize;
@@ -115,7 +115,7 @@ void JAInter::StreamMgr::init() {
tmp->field_0x8 = 1.0f;
tmp->field_0xc = 0.5f;
tmp->field_0x10 = 0;
tmp->field_0x14 = 0;
tmp->mpSound = 0;
}
/* 8029BEB4-8029C04C .text storeStreamBuffer__Q27JAInter9StreamMgrFPP8JAISoundPQ27JAInter5ActorUlUlUcPv */
@@ -153,7 +153,7 @@ void JAInter::StreamMgr::releaseStreamBuffer(JAISound* param_1, u32 param_2) {
if (param_2 == 0 || param_1->field_0x5 < 4) {
StreamLib::stop();
param_1->field_0x5 = 0;
streamUpdate->field_0x14 = 0;
streamUpdate->mpSound = 0;
param_1->clearMainSoundPPointer();
streamControl.releaseSound(param_1);
JASystem::Dvd::unpauseDvdT();
@@ -190,15 +190,14 @@ void JAInter::StreamMgr::checkEntriedStream() {
tmp->field_0x8 = 1.0f;
tmp->field_0xc = 0.5f;
tmp->field_0x10 = 0;
tmp->field_0x14 = 0;
streamUpdate->field_0x14 = sound;
tmp->mpSound = 0;
streamUpdate->mpSound = sound;
}
}
/* 8029C1D8-8029C2AC .text checkWaitStream__Q27JAInter9StreamMgrFv */
void JAInter::StreamMgr::checkWaitStream() {
/* Nonmatching */
JAISound* sound = streamUpdate->field_0x14;
JAISound* sound = streamUpdate->mpSound;
if (!sound) {
return;
}
@@ -207,17 +206,17 @@ void JAInter::StreamMgr::checkWaitStream() {
}
char buffer[64];
strcpy(buffer, JAIGlobalParameter::getParamStreamPath());
//strcat(buffer, streamList[JAIBasic::getInterface()->getSoundOffsetNumberFromID(sound->field_0xc)].field_0x10);
strcat(buffer, streamList[JAIBasic::getInterface()->getSoundOffsetNumberFromID(sound->getID())].field_0x10);
JAIBasic::getInterface()->setSeExtParameter(sound);
sound->field_0x5 = 3;
checkPlayingStream();
//StreamLib::start(buffer, sound->getStreamParameter()->field_0x4, streamList[sound->field_0xc]->field_0x20);
StreamLib::start(buffer, sound->getStreamParameter()->field_0x4, streamList[sound->getID() & 0x3FF].field_0x20);
StreamLib::setPrepareFlag(1);
}
/* 8029C2AC-8029C344 .text checkRequestStream__Q27JAInter9StreamMgrFv */
void JAInter::StreamMgr::checkRequestStream() {
JAISound* sound = streamUpdate->field_0x14;
JAISound* sound = streamUpdate->mpSound;
if (!sound) {
return;
}
@@ -326,10 +325,12 @@ bool JAInter::StreamLib::deallocBuffer() {
/* 8029CC50-8029CCA4 .text getNeedBufferSize__Q27JAInter9StreamLibFv */
u32 JAInter::StreamLib::getNeedBufferSize() {
/* Nonmatching */
u32 size = 0x20;
for (u32 i = 0; i < 2; i++) {
size += ((LOOP_BLOCKS << 2) & ~0x1F) + 0x20;
/* Nonmatching - regalloc */
u32 i = 0;
u32 size;
u32 r0 = ((LOOP_BLOCKS << 2) & ~0x1F) + 0x20;
for (size = 0x20; i < 2; i++) {
size += r0;
for (u32 j = 0; j < LOOP_BLOCKS; j++) {
size += 0x2820;
}
@@ -361,10 +362,11 @@ void JAInter::StreamLib::sync(s32 param_1) {
/* 8029CCD0-8029CD8C .text __DecodePCM__Q27JAInter9StreamLibFv */
void JAInter::StreamLib::__DecodePCM() {
/* Nonmatching */
int i;
s16* dst1 = loop_buffer[0][playside];
s16* dst2 = loop_buffer[1][playside];
s16* src = adpcm_buffer;
for (int i = 0; i < loadsize >> 2; dst2++, i++, dst1++, src += 2) {
for (i = 0; i < loadsize >> 2; dst2++, i++, dst1++, src += 2) {
dst1[0] = src[0];
dst2[0] = src[1];
}
+2 -2
View File
@@ -37,7 +37,7 @@ int JAInter::SystemInterface::checkSeqActiveFlag(JASystem::TTrack* param_1) {
/* 8029E2A0-8029E478 .text trackToSeqp__Q27JAInter15SystemInterfaceFP8JAISoundUc */
JASystem::TTrack* JAInter::SystemInterface::trackToSeqp(JAISound* seq, u8 trackNo) {
JASystem::TTrack* result = NULL;
if (!IsJAISoundIDInUse(seq->mSoundID)) {
if (!IsJAISoundIDInUse(seq->getID())) {
JASystem::TTrack* rootTrack = seq->getSeqParameter()->getRootTrackPointer();
JASystem::TTrack* childTrack = rootTrack->getChild(trackNo >> 4);
if (childTrack != NULL) {
@@ -71,7 +71,7 @@ void JAInter::SystemInterface::rootInit(JAInter::SeqUpdateData* updateData) {
void JAInter::SystemInterface::trackInit(JAInter::SeqUpdateData* updateData) {
JAISound* seq = updateData->field_0x48;
u32 max = 16;
if (!IsJAISoundIDInUse(seq->mSoundID)) {
if (!IsJAISoundIDInUse(seq->getID())) {
max = JAIGlobalParameter::getParamSeqTrackMax();
}
for (u32 i = 0; i < max; i++) {