diff --git a/configure.py b/configure.py index bd902af9b..31bfe1925 100644 --- a/configure.py +++ b/configure.py @@ -709,8 +709,8 @@ config.libs = [ Object(NonMatching, "JSystem/JAudio/JAIAnimation.cpp"), Object(NonMatching, "JSystem/JAudio/JAIBasic.cpp"), Object(NonMatching, "JSystem/JAudio/JAIBankWave.cpp"), - Object(NonMatching, "JSystem/JAudio/JAIConst.cpp"), - Object(NonMatching, "JSystem/JAudio/JAIDummyObject.cpp"), + Object(Matching, "JSystem/JAudio/JAIConst.cpp"), + Object(Matching, "JSystem/JAudio/JAIDummyObject.cpp"), Object(NonMatching, "JSystem/JAudio/JAIFx.cpp"), Object(Matching, "JSystem/JAudio/JAIGlobalParameter.cpp"), Object(NonMatching, "JSystem/JAudio/JAIInitData.cpp"), diff --git a/include/JSystem/JAudio/JAIBasic.h b/include/JSystem/JAudio/JAIBasic.h index bda26f2d0..be44cb8e8 100644 --- a/include/JSystem/JAudio/JAIBasic.h +++ b/include/JSystem/JAudio/JAIBasic.h @@ -9,6 +9,7 @@ class JKRSolidHeap; namespace JAInter { class Actor; + class Camera; } namespace JASystem { @@ -34,7 +35,7 @@ public: void setCameraInfo(Vec*, Vec*, f32(*)[4], u32); void initAudioThread(JKRSolidHeap*, u32, u8); void initCamera(); - bool initReadFile(); + BOOL initReadFile(); void processFrameWork(); void startSoundVec(u32, JAISound**, Vec*, u32, u32, u8); void startSoundActor(u32, JAISound**, JAInter::Actor*, u32, u8); @@ -56,7 +57,7 @@ public: bool allocStreamBuffer(void*, s32); bool deallocStreamBuffer(); - /* 0x04 */ void* field_0x4; + /* 0x04 */ JAInter::Camera* mAudioCamera; /* 0x08 */ JKRSolidHeap* field_0x8; /* 0x0C */ u8 initLoadFileSw; /* 0x0D */ u8 field_0xd; @@ -73,7 +74,7 @@ public: /* 0x10 */ int field_0x10; /* 0x14 */ int field_0x14; /* 0x18 */ int field_0x18; - /* 0x1C */ int field_0x1c; + /* 0x1C */ u8** field_0x1c; static JAIBasic* getInterface() { return msBasic; } static JKRSolidHeap* getCurrentJAIHeap() { diff --git a/include/JSystem/JAudio/JAIConst.h b/include/JSystem/JAudio/JAIConst.h index 96820d12f..22792939f 100644 --- a/include/JSystem/JAudio/JAIConst.h +++ b/include/JSystem/JAudio/JAIConst.h @@ -2,6 +2,7 @@ #define JAICONST_H #include "JSystem/JMath/random.h" +#include "dolphin/mtx/mtx.h" #include "dolphin/mtx/vec.h" namespace JAInter { @@ -10,8 +11,42 @@ namespace JAInter { void deleteTmpDVDFile(u8**); u32 routeToTrack(u32); + class Actor { + public: + Actor(Vec* p1, Vec* p2, u32 p3, void* p4) { + field_0x0 = p1; + field_0x4 = p2; + field_0x8 = p3; + field_0xc = p4; + } + + // order is unclear + Vec* field_0x0; + Vec* field_0x4; + u32 field_0x8; + void* field_0xc; + }; + + class Camera { + public: + Camera(Vec* p1 = NULL, Vec* p2 = NULL, MtxP p3 = NULL) { + field_0x0 = p1; + field_0x4 = p2; + field_0x8 = p3; + } + Vec* field_0x0; + Vec* field_0x4; + MtxP field_0x8; + }; + namespace Const { + extern Camera nullCamera; + extern Actor nullActor; + extern Mtx camMtx; + extern Vec camTrans; + extern Vec camPreTrans; extern Vec dummyZeroVec; + extern u8 sCInfos_0[]; extern JMath::TRandom_fast_ random; } } diff --git a/include/JSystem/JAudio/JAIDummyObject.h b/include/JSystem/JAudio/JAIDummyObject.h new file mode 100644 index 000000000..f83ce7294 --- /dev/null +++ b/include/JSystem/JAudio/JAIDummyObject.h @@ -0,0 +1,32 @@ +#ifndef JAIDUMMYOBJECT_H +#define JAIDUMMYOBJECT_H + +#include "dolphin/types.h" + +class JAISound; + +namespace JAInter { + struct DummyVec { + DummyVec* field_0x0; + DummyVec* field_0x4; + JAISound* field_0x8; + u32 field_0xc; + int field_0x10; + int field_0x14; + u32 field_0x18; + bool field_0x1c; + }; + + namespace DummyObjectMgr { + void init(); + DummyVec* getPointer(u32 param_1, bool param_2); + void releasePointer(DummyVec* param_1); + void check(); + + extern DummyVec* deadObjectFreePointer; + extern DummyVec* deadObjectUsedPointer; + extern DummyVec* deadObjectObject; + } +} + +#endif /* JAIDUMMYOBJECT_H */ diff --git a/include/JSystem/JAudio/JAIFx.h b/include/JSystem/JAudio/JAIFx.h new file mode 100644 index 000000000..3b7244125 --- /dev/null +++ b/include/JSystem/JAudio/JAIFx.h @@ -0,0 +1,42 @@ +#ifndef JAIFX_H +#define JAIFX_H + +#include "dolphin/types.h" + +namespace JASystem { + namespace DSPInterface { + struct FxlineConfig_; + } +} + +namespace JAInter { + namespace Fx { + struct initOnCodeFxScene_s { + u32 field_0x0; + u32 field_0x4; + u32 field_0x8; + u32 field_0xc; + u32 field_0x10; + u32 field_0x14[1]; + }; + + void init(); + void setSceneMax(u8 param_1); + void setBufferMax(u32 param_1, u32 param_2, u32 param_3, u32 param_4); + void setTablePointer(void** param_1); + void setBufferPointer(u8 param_1, short* param_2); + void setScenePointer(u8 param_1, void* param_2); + u8 getSceneMax(); + u32 getBufferSizeMax(u8 param_1); + s16* getBufferPointer(u8 param_1); + JASystem::DSPInterface::FxlineConfig_** getFxconfigTable(); + + extern initOnCodeFxScene_s* initOnCodeFxScene; + extern u8 mSceneMax; + extern u32* mBufferSizeMax; + extern s16** mBufferPointer; + extern void** mFxconfigTable; + } +} + +#endif /* JAIFX_H */ diff --git a/include/JSystem/JAudio/JAIGlobalParameter.h b/include/JSystem/JAudio/JAIGlobalParameter.h index 8b228992a..a7fb8b2ad 100644 --- a/include/JSystem/JAudio/JAIGlobalParameter.h +++ b/include/JSystem/JAudio/JAIGlobalParameter.h @@ -38,7 +38,7 @@ namespace JAIGlobalParameter { void setParamAudioCameraMax(u32); void setParamSystemTrackMax(s32); void setParamSoundOutputMode(u32); - int getParamSeCategoryMax(); + u32 getParamSeCategoryMax(); u32 getParamSoundSceneMax(); u32 getParamSeRegistMax(); u32 getParamSeTrackMax(); diff --git a/include/JSystem/JAudio/JAISeMgr.h b/include/JSystem/JAudio/JAISeMgr.h new file mode 100644 index 000000000..2d83a9cdf --- /dev/null +++ b/include/JSystem/JAudio/JAISeMgr.h @@ -0,0 +1,72 @@ +#ifndef JAISEMGR_H +#define JAISEMGR_H + +#include "JSystem/JAudio/JAISound.h" + +namespace JAInter { + class SeqUpdateData; + + class SeParameter { + public: + SeParameter(); + + u16 field_0x0[18]; + MoveParaSet field_0x24[16]; + MoveParaSet field_0x124[8]; + MoveParaSetInitHalf field_0x1a4[8]; + MoveParaSet field_0x224[8]; + MoveParaSetInitZero field_0x2a4[8]; + MoveParaSetInitZero field_0x324[8]; + MoveParaSet field_0x3a4[8]; + f32* field_0x424; + f32 field_0x428; + u8 field_0x42c[0x43c - 0x42c]; + SeParameter* field_0x43c; + SeParameter* field_0x440; + }; + + namespace SeMgr { + void init(); + void startSeSequence(); + void processGFrameSe(); + void checkNextFrameSe(); + void checkPlayingSe(); + void setSeqMuteFromSeStart(JAISound* param_1); + void clearSeqMuteFromSeStop(JAISound* param_1); + void checkSeMovePara(); + void sendSeAllParameter(JAISound* param_1); + void checkPlayingSeUpdateMultiplication(JAISound* param_1, SeqUpdateData* param_2, f32* param_3, MoveParaSet* param_4, f32 param_5, u8 param_6, f32* param_7); + void checkPlayingSeUpdateAddition(JAISound* param_1, SeqUpdateData* param_2, f32* param_3, MoveParaSet* param_4, u8 param_5, f32* param_6, f32 param_7); + u8 changeIDToCategory(u32 param_1); + void releaseSeRegist(JAISound* param_1); + SeParameter* getSeParametermeterPointer(); + void releaseSeParameterPointer(SeParameter* param_1); + void storeSeBuffer(JAISound** param_1, Actor* param_2, u32 param_3, u32 param_4, u8 param_5, void* param_6); + void releaseSeBuffer(JAISound* param_1, u32 param_2); + + struct seTrackUpdate_s { + u8 field_0x0; + f32 field_0x4; + f32 field_0x8; + f32 field_0xc; + f32 field_0x10; + f32 field_0x14; + }; + + extern seTrackUpdate_s* seTrackUpdate; + extern u8** categoryInfoTable; + extern u32** sePlaySound; + extern SeParameter* seParameterFreeStartPointer; + extern SeParameter* seParameterUsedEndPointer; + extern LinkSound* seRegist; + extern JAISound** seRegistBuffer; + extern JAISound* seHandle; + extern u8 seScene; + extern int seqMuteFlagFromSe; + extern f32* seCategoryVolume; + extern u8* seEntryCancel; + } +} + + +#endif /* JAISEMGR_H */ diff --git a/include/JSystem/JAudio/JAISequenceHeap.h b/include/JSystem/JAudio/JAISequenceHeap.h new file mode 100644 index 000000000..427b36d13 --- /dev/null +++ b/include/JSystem/JAudio/JAISequenceHeap.h @@ -0,0 +1,47 @@ +#ifndef JAISEQUENCEHEAP_H +#define JAISEQUENCEHEAP_H + +#include "dolphin/types.h" + +namespace JAInter { + class HeapBlock { + public: + HeapBlock(); + + u8 getStatus() { return mStatus; } + void setStatus(u8 status) { mStatus = status; } + void* getPointer() { return mPointer; } + void setPointer(void* pointer) { mPointer = pointer; } + // TODO + u32 getUseCounter() {} + void setUseCounter(u32) {} + u32 getDataNumber() {} + void setDataNumber(u32) {} + u32 getEndAddress() {} + void setEndAddress(u32) {} + + /* 0x00 */ u8 mStatus; + /* 0x04 */ void* mPointer; + /* 0x08 */ u32 field_0x8; + /* 0x0C */ u32 field_0xc; + /* 0x10 */ u32 field_0x10; + }; + + namespace HeapMgr { + void init(u8, u32, u8, u32); + JAInter::HeapBlock* getAutoHeapPointer(); + void* checkOnMemory(u32, u8*); + void releaseAutoHeapPointer(u8); + u8 checkUsefulAutoHeapPosition(); + void* getFreeAutoHeapPointer(u8, u32); + void* getFreeStayHeapPointer(u32, u32); + void setAutoHeapLoadedFlag(u8, u8); + + extern HeapBlock* sAutoHeap; + extern HeapBlock* sStayHeap; + extern u32 sAutoHeapCount; + extern u32 sStayHeapCount; + } +} + +#endif /* JAISEQUENCEHEAP_H */ diff --git a/src/JSystem/JAudio/JAIBasic.cpp b/src/JSystem/JAudio/JAIBasic.cpp index a3a43dfb5..c05ba7632 100644 --- a/src/JSystem/JAudio/JAIBasic.cpp +++ b/src/JSystem/JAudio/JAIBasic.cpp @@ -4,9 +4,16 @@ // #include "JSystem/JAudio/JAIBasic.h" +#include "JSystem/JAudio/JAIBankWave.h" +#include "JSystem/JAudio/JAIConst.h" +#include "JSystem/JAudio/JAIDummyObject.h" +#include "JSystem/JAudio/JAIFx.h" #include "JSystem/JAudio/JAIGlobalParameter.h" #include "JSystem/JAudio/JAIInitData.h" +#include "JSystem/JAudio/JAISeMgr.h" +#include "JSystem/JAudio/JAISequenceHeap.h" #include "JSystem/JAudio/JAISequenceMgr.h" +#include "JSystem/JAudio/JAIStreamMgr.h" #include "JSystem/JAudio/JASAudioThread.h" #include "JSystem/JAudio/JASDriverIF.h" #include "JSystem/JAudio/JASSystemHeap.h" @@ -33,7 +40,7 @@ JAIBasic::JAIBasic() { field_0xe.flag4 = 0; field_0xe.flag5 = 0; field_0x14 = 0; - field_0x4 = NULL; + mAudioCamera = NULL; field_0x10 = 0; initLoadFileSw = 2; field_0x1c = 0; @@ -54,7 +61,26 @@ void JAIBasic::initInterface(u8) { /* 8028FD04-8028FDC0 .text initInterfaceMain__8JAIBasicFv */ void JAIBasic::initInterfaceMain() { - /* Nonmatching */ + initHeap(); + initResourcePath(); + initArchive(); + if (initReadFile()) { + if (!field_0xe.flag1) { + JAInter::BankWave::setWaveScene(); + } + JAInter::DummyObjectMgr::init(); + JAInter::Fx::init(); + JAInter::SequenceMgr::init(); + JAInter::SeMgr::init(); + JAInter::StreamMgr::init(); + JAInter::HeapMgr::init(JAIGlobalParameter::stayHeapMax, JAIGlobalParameter::stayHeapSize, JAIGlobalParameter::autoHeapMax, JAIGlobalParameter::autoHeapRoomSize); + initCamera(); + initStream(); + JAInter::SeMgr::startSeSequence(); + if (!field_0xe.flag1) { + JAInter::SequenceMgr::checkEntriedSeq(); + } + } } /* 8028FDC0-8028FE78 .text initHeap__8JAIBasicFv */ @@ -94,13 +120,20 @@ void JAIBasic::initResourcePath() { } /* 8028FFF8-8029002C .text setCameraInfo__8JAIBasicFP3VecP3VecPA4_fUl */ -void JAIBasic::setCameraInfo(Vec*, Vec*, f32(*)[4], u32) { - /* Nonmatching */ +void JAIBasic::setCameraInfo(Vec* param_1, Vec* param_2, MtxP param_3, u32 param_4) { + if (JAIGlobalParameter::audioCameraMax <= param_4) { + return; + } + mAudioCamera[param_4].field_0x0 = param_1; + mAudioCamera[param_4].field_0x4 = param_2; + mAudioCamera[param_4].field_0x8 = param_3; } /* 8029002C-80290068 .text initStream__8JAIBasicFv */ void JAIBasic::initStream() { - /* Nonmatching */ + if (!field_0xe.flag4) { + JAInter::StreamLib::init(field_0xe.flag5); + } } /* 80290068-80290090 .text setRegisterTrackCallback__8JAIBasicFv */ @@ -123,12 +156,32 @@ void JAIBasic::initAudioThread(JKRSolidHeap* param_1, u32 param_2, u8 param_3) { /* 8029011C-8029031C .text initCamera__8JAIBasicFv */ void JAIBasic::initCamera() { - /* Nonmatching */ + mAudioCamera = new (JAIBasic::getCurrentJAIHeap(), 0x20) JAInter::Camera[JAIGlobalParameter::audioCameraMax]; + JUT_ASSERT_MSG(291, mAudioCamera, "JAIBasic::initAllocParameter Cannot Alloc Heap!! (mAudioCamera)\n"); + if (!mAudioCamera->field_0x0) { + JAInter::Const::nullCamera.field_0x0->x = 0.0f; + JAInter::Const::nullCamera.field_0x0->y = 0.0f; + JAInter::Const::nullCamera.field_0x0->z = -50.0f; + JAInter::Const::nullCamera.field_0x4->x = 0.0f; + JAInter::Const::nullCamera.field_0x4->y = 0.0f; + JAInter::Const::nullCamera.field_0x4->z = -50.0f; + Vec local_2c; + local_2c.x = 0.0f; + local_2c.y = 1.0f; + local_2c.z = 0.0f; + Vec local_38; + local_38.x = JAInter::Const::dummyZeroVec.x; + local_38.y = JAInter::Const::dummyZeroVec.y; + local_38.z = JAInter::Const::dummyZeroVec.z; + C_MTXLookAt(JAInter::Const::camMtx, JAInter::Const::nullCamera.field_0x0, &local_2c, &local_38); + for (u32 i = 0; i < JAIGlobalParameter::audioCameraMax; i++) { + setCameraInfo(JAInter::Const::nullCamera.field_0x0, JAInter::Const::nullCamera.field_0x4, JAInter::Const::camMtx, i); + } + } } /* 80290330-8029046C .text initReadFile__8JAIBasicFv */ -bool JAIBasic::initReadFile() { - /* Nonmatching */ +BOOL JAIBasic::initReadFile() { switch (initLoadFileSw) { case 2: if (JAIInitData::checkInitDataFile()) { diff --git a/src/JSystem/JAudio/JAIConst.cpp b/src/JSystem/JAudio/JAIConst.cpp index 9a874ce0c..5d97836c8 100644 --- a/src/JSystem/JAudio/JAIConst.cpp +++ b/src/JSystem/JAudio/JAIConst.cpp @@ -11,7 +11,16 @@ #include "JSystem/JKernel/JKRSolidHeap.h" #include "JSystem/JUtility/JUTAssert.h" +JAInter::Camera JAInter::Const::nullCamera(&camTrans, &camPreTrans, camMtx); +JAInter::Actor JAInter::Const::nullActor(NULL, NULL, 0, NULL); +Mtx JAInter::Const::camMtx; +Vec JAInter::Const::camTrans; +Vec JAInter::Const::camPreTrans; Vec JAInter::Const::dummyZeroVec = {0.0f, 0.0f, 0.0f}; +u8 JAInter::Const::sCInfos_0[] = { + 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, + 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, +}; JMath::TRandom_fast_ JAInter::Const::random(0); /* 80291704-802917D8 .text transInitDataFile__7JAInterFPUcUl */ @@ -47,6 +56,17 @@ void JAInter::deleteTmpDVDFile(u8** tmpPointer) { } /* 802918FC-8029193C .text routeToTrack__7JAInterFUl */ -u32 JAInter::routeToTrack(u32) { - /* Nonmatching */ +u32 JAInter::routeToTrack(u32 param_1) { + u32 r4; + u32 r5 = 0; + r4 = param_1 & 0xF0000000; + if (r4 == 0) { + return 0; + } + if (r4 == 0x10000000) { + r5 = 0x0F; + } else if (r4 == 0x20000000) { + r5 = 0xFF; + } + return param_1 & r5; } diff --git a/src/JSystem/JAudio/JAIDummyObject.cpp b/src/JSystem/JAudio/JAIDummyObject.cpp index 59088649d..7312e9057 100644 --- a/src/JSystem/JAudio/JAIDummyObject.cpp +++ b/src/JSystem/JAudio/JAIDummyObject.cpp @@ -4,24 +4,93 @@ // #include "JSystem/JAudio/JAIDummyObject.h" -#include "dolphin/types.h" +#include "JSystem/JAudio/JAIBasic.h" +#include "JSystem/JAudio/JAIGlobalParameter.h" +#include "JSystem/JAudio/JAISound.h" +#include "JSystem/JKernel/JKRSolidHeap.h" + +JAInter::DummyVec* JAInter::DummyObjectMgr::deadObjectFreePointer; +JAInter::DummyVec* JAInter::DummyObjectMgr::deadObjectUsedPointer; +JAInter::DummyVec* JAInter::DummyObjectMgr::deadObjectObject; /* 802919A0-80291B40 .text init__Q27JAInter14DummyObjectMgrFv */ void JAInter::DummyObjectMgr::init() { - /* Nonmatching */ + deadObjectObject = new (JAIBasic::getCurrentJAIHeap(), 0x20) DummyVec[JAIGlobalParameter::getParamDummyObjectMax()]; + JUT_ASSERT_MSG(37, deadObjectObject, "JAIDummyObjectMgr::init Cannot Alloc Heap!!\n"); + deadObjectFreePointer = deadObjectObject; + deadObjectUsedPointer = NULL; + deadObjectObject[0].field_0x0 = NULL; + deadObjectObject[0].field_0x4 = deadObjectObject + 1; + int i; + for (i = 1; i < JAIGlobalParameter::getParamDummyObjectMax() - 1; i++) { + deadObjectObject[i].field_0x0 = deadObjectObject + (i - 1); + deadObjectObject[i].field_0x4 = deadObjectObject + (i + 1); + } + deadObjectObject[i].field_0x0 = deadObjectObject + (i - 1); + deadObjectObject[i].field_0x4 = NULL; } /* 80291B40-80291BAC .text getPointer__Q27JAInter14DummyObjectMgrFUlb */ -void JAInter::DummyObjectMgr::getPointer(unsigned long, bool) { - /* Nonmatching */ +JAInter::DummyVec* JAInter::DummyObjectMgr::getPointer(u32 param_1, bool param_2) { + DummyVec** r5 = &deadObjectFreePointer; + DummyVec** r6 = &deadObjectUsedPointer; + DummyVec* r7; + if (deadObjectFreePointer) { + r7 = *r5; + *r5 = r7->field_0x4; + if (*r6) { + r7->field_0x4 = *r6; + (*r6)->field_0x0 = r7; + } else { + r7->field_0x4 = NULL; + } + r7->field_0x0 = NULL; + *r6 = r7; + r7->field_0x18 = param_1; + r7->field_0x1c = param_2; + r7->field_0x8 = NULL; + } else { + r7 = NULL; + } + return r7; } /* 80291BAC-80291C20 .text releasePointer__Q27JAInter14DummyObjectMgrFPQ27JAInter8DummyVec */ -void JAInter::DummyObjectMgr::releasePointer(JAInter::DummyVec*) { - /* Nonmatching */ +void JAInter::DummyObjectMgr::releasePointer(DummyVec* param_1) { + DummyVec** r5 = &deadObjectFreePointer; + DummyVec** r4 = &deadObjectUsedPointer; + if (deadObjectUsedPointer != param_1) { + param_1->field_0x0->field_0x4 = param_1->field_0x4; + if (param_1->field_0x4) { + param_1->field_0x4->field_0x0 = param_1->field_0x0; + } + } else { + *r4 = param_1->field_0x4; + if (param_1->field_0x4) { + param_1->field_0x4->field_0x0 = NULL; + } + } + param_1->field_0x4 = *r5; + if (param_1->field_0x4) { + param_1->field_0x4->field_0x0 = param_1; + } + *r5 = param_1; } /* 80291C20-80291CCC .text check__Q27JAInter14DummyObjectMgrFv */ void JAInter::DummyObjectMgr::check() { - /* Nonmatching */ + DummyVec* r31 = deadObjectUsedPointer; + while (r31) { + DummyVec* r30 = r31->field_0x4; + r31->field_0x18--; + if (r31->field_0x18 == 0 || (!r31->field_0x1c && r31->field_0x8 == NULL)) { + if (r31->field_0x1c == true) { + JAIBasic::getInterface()->stopAllSound(&r31->field_0xc); + } else if (r31->field_0x8) { + r31->field_0x8->stop(0); + } + releasePointer(r31); + } + r31 = r30; + } } diff --git a/src/JSystem/JAudio/JAIFx.cpp b/src/JSystem/JAudio/JAIFx.cpp index 7a58820db..c7efa1a7e 100644 --- a/src/JSystem/JAudio/JAIFx.cpp +++ b/src/JSystem/JAudio/JAIFx.cpp @@ -4,54 +4,87 @@ // #include "JSystem/JAudio/JAIFx.h" -#include "dolphin/types.h" +#include "JSystem/JAudio/JAIBasic.h" +#include "JSystem/JAudio/JASDSPInterface.h" +#include "JSystem/JKernel/JKRSolidHeap.h" + +JAInter::Fx::initOnCodeFxScene_s* JAInter::Fx::initOnCodeFxScene; +u8 JAInter::Fx::mSceneMax; +u32* JAInter::Fx::mBufferSizeMax; +s16** JAInter::Fx::mBufferPointer; +void** JAInter::Fx::mFxconfigTable; /* 80291CCC-80292068 .text init__Q27JAInter2FxFv */ void JAInter::Fx::init() { /* Nonmatching */ + if (initOnCodeFxScene) { + mBufferSizeMax = new (JAIBasic::getCurrentJAIHeap(), 4) u32[4]; + mBufferPointer = new (JAIBasic::getCurrentJAIHeap(), 4) s16*[4]; + initOnCodeFxScene_s* r31 = initOnCodeFxScene; + setSceneMax(r31->field_0x0); + setBufferMax(r31->field_0x4, r31->field_0x8, r31->field_0xc, r31->field_0x10); + void** _heap = new (JAIBasic::getCurrentJAIHeap(), 0x20) void*[getSceneMax()]; + JUT_ASSERT_MSG(46, _heap, "JAIFx::initHeap Cannot Alloc Heap!!\n"); + setTablePointer(_heap); + for (u8 i = 0; i < getSceneMax(); i++) { + setScenePointer(i, (u8*)initOnCodeFxScene + r31->field_0x14[i]); + } + for (u8 i = 0; i < 4; i++) { + if (getBufferSizeMax(i)) { + s16* _buf = new (JAIBasic::getCurrentJAIHeap(), 0x20) s16[ALIGN_PREV(getBufferSizeMax(i) * 160, 2) / 2]; + JUT_ASSERT_MSG(57, _buf, "JAIFx::initHeap Cannot Alloc Heap!!\n"); + setBufferPointer(i, _buf); + JASystem::DSPInterface::FxlineConfig_* config = &getFxconfigTable()[0][i]; + JASystem::DSPInterface::getFXHandle(i)->setFXLine(getBufferPointer(i), config); + } + } + } } /* 80292068-80292070 .text setSceneMax__Q27JAInter2FxFUc */ -void JAInter::Fx::setSceneMax(unsigned char) { - /* Nonmatching */ +void JAInter::Fx::setSceneMax(u8 param_1) { + mSceneMax = param_1; } /* 80292070-80292094 .text setBufferMax__Q27JAInter2FxFUlUlUlUl */ -void JAInter::Fx::setBufferMax(unsigned long, unsigned long, unsigned long, unsigned long) { - /* Nonmatching */ +void JAInter::Fx::setBufferMax(u32 param_1, u32 param_2, u32 param_3, u32 param_4) { + mBufferSizeMax[0] = param_1; + mBufferSizeMax[1] = param_2; + mBufferSizeMax[2] = param_3; + mBufferSizeMax[3] = param_4; } /* 80292094-8029209C .text setTablePointer__Q27JAInter2FxFPPv */ -void JAInter::Fx::setTablePointer(void**) { - /* Nonmatching */ +void JAInter::Fx::setTablePointer(void** param_1) { + mFxconfigTable = param_1; } /* 8029209C-802920AC .text setBufferPointer__Q27JAInter2FxFUcPs */ -void JAInter::Fx::setBufferPointer(unsigned char, short*) { - /* Nonmatching */ +void JAInter::Fx::setBufferPointer(u8 param_1, s16* param_2) { + mBufferPointer[param_1] = param_2; } /* 802920AC-802920BC .text setScenePointer__Q27JAInter2FxFUcPv */ -void JAInter::Fx::setScenePointer(unsigned char, void*) { - /* Nonmatching */ +void JAInter::Fx::setScenePointer(u8 param_1, void* param_2) { + mFxconfigTable[param_1] = param_2; } /* 802920BC-802920C4 .text getSceneMax__Q27JAInter2FxFv */ -void JAInter::Fx::getSceneMax() { - /* Nonmatching */ +u8 JAInter::Fx::getSceneMax() { + return mSceneMax; } /* 802920C4-802920D4 .text getBufferSizeMax__Q27JAInter2FxFUc */ -void JAInter::Fx::getBufferSizeMax(unsigned char) { - /* Nonmatching */ +u32 JAInter::Fx::getBufferSizeMax(u8 param_1) { + return mBufferSizeMax[param_1]; } /* 802920D4-802920E4 .text getBufferPointer__Q27JAInter2FxFUc */ -void JAInter::Fx::getBufferPointer(unsigned char) { - /* Nonmatching */ +s16* JAInter::Fx::getBufferPointer(u8 param_1) { + return mBufferPointer[param_1]; } /* 802920E4-802920EC .text getFxconfigTable__Q27JAInter2FxFv */ -void JAInter::Fx::getFxconfigTable() { - /* Nonmatching */ +JASystem::DSPInterface::FxlineConfig_** JAInter::Fx::getFxconfigTable() { + return (JASystem::DSPInterface::FxlineConfig_**)mFxconfigTable; } diff --git a/src/JSystem/JAudio/JAIGlobalParameter.cpp b/src/JSystem/JAudio/JAIGlobalParameter.cpp index e155ea0ae..e75fd324f 100644 --- a/src/JSystem/JAudio/JAIGlobalParameter.cpp +++ b/src/JSystem/JAudio/JAIGlobalParameter.cpp @@ -204,7 +204,7 @@ void JAIGlobalParameter::setParamSoundOutputMode(u32 value) { } /* 80292334-80292358 .text getParamSeCategoryMax__18JAIGlobalParameterFv */ -int JAIGlobalParameter::getParamSeCategoryMax() { +u32 JAIGlobalParameter::getParamSeCategoryMax() { return JAInter::SoundTable::getCategotyMax(); } diff --git a/src/JSystem/JAudio/JAISeMgr.cpp b/src/JSystem/JAudio/JAISeMgr.cpp index 0642b050c..936edcaf7 100644 --- a/src/JSystem/JAudio/JAISeMgr.cpp +++ b/src/JSystem/JAudio/JAISeMgr.cpp @@ -4,26 +4,116 @@ // #include "JSystem/JAudio/JAISeMgr.h" -#include "dolphin/types.h" +#include "JSystem/JAudio/JAIBasic.h" +#include "JSystem/JAudio/JAIConst.h" +#include "JSystem/JAudio/JAIGlobalParameter.h" +#include "JSystem/JAudio/JAISequenceMgr.h" +#include "JSystem/JKernel/JKRSolidHeap.h" + +namespace JAISeMgr = JAInter::SeMgr; + +JAInter::SeMgr::seTrackUpdate_s* JAInter::SeMgr::seTrackUpdate; +u8** JAInter::SeMgr::categoryInfoTable; +u32** JAInter::SeMgr::sePlaySound; +JAInter::SeParameter* JAInter::SeMgr::seParameterFreeStartPointer; +JAInter::SeParameter* JAInter::SeMgr::seParameterUsedEndPointer; +JAInter::LinkSound* JAInter::SeMgr::seRegist; +JAISound** JAInter::SeMgr::seRegistBuffer; +JAISound* JAInter::SeMgr::seHandle; +u8 JAInter::SeMgr::seScene; +int JAInter::SeMgr::seqMuteFlagFromSe; +f32* JAInter::SeMgr::seCategoryVolume; +u8* JAInter::SeMgr::seEntryCancel; /* 8029285C-80293370 .text init__Q27JAInter5SeMgrFv */ void JAInter::SeMgr::init() { /* Nonmatching */ + if (JAIBasic::getInterface()->field_0x1c) { + JAIGlobalParameter::setParamSeTrackMax(0); + for (int i = 0; i < JAIGlobalParameter::getParamSoundSceneMax(); i++) { + int r31 = 0; + for (int j = 0; j < JAIGlobalParameter::getParamSeCategoryMax(); j++) { + r31 += JAIBasic::getInterface()->field_0x1c[i][j]; + } + if (JAIGlobalParameter::getParamSeTrackMax() < r31) { + JAIGlobalParameter::setParamSeTrackMax(r31); + } + } + } + seRegist = new (JAIBasic::getCurrentJAIHeap(), 0x20) LinkSound[JAIGlobalParameter::getParamSeCategoryMax()]; + JUT_ASSERT_MSG(63, seRegist, "JAIData::initHeap Cannot Alloc Heap!!\n"); + sePlaySound = new (JAIBasic::getCurrentJAIHeap(), 0x20) u32*[JAIGlobalParameter::getParamSeCategoryMax()]; + JUT_ASSERT_MSG(65, sePlaySound, "JAIData::initHeap Cannot Alloc Heap!!\n"); + seRegistBuffer = new (JAIBasic::getCurrentJAIHeap(), 0x20) JAISound*[JAIGlobalParameter::getParamSeCategoryMax()]; + JUT_ASSERT_MSG(67, seRegistBuffer, "JAIData::initHeap Cannot Alloc Heap!!\n"); + for (int i = 0; i < JAIGlobalParameter::getParamSeCategoryMax(); i++) { + seRegistBuffer[i] = JAIBasic::getInterface()->makeSound(JAIGlobalParameter::getParamSeRegistMax()); + JUT_ASSERT_MSG(72, seRegistBuffer[i], "JAIData::initHeap Cannot Alloc Heap!!\n"); + seRegist[i].init(seRegistBuffer[i], JAIGlobalParameter::getParamSeRegistMax()); + sePlaySound[i] = new (JAIBasic::getCurrentJAIHeap(), 0x20) u32[0x10]; + JUT_ASSERT_MSG(78, sePlaySound[i], "JAIData::initHeap Cannot Alloc Heap!!\n"); + for (int j = 0; j < 16; j++) { + sePlaySound[i][j] = 0; + } + } + seTrackUpdate = new (JAIBasic::getCurrentJAIHeap(), 0x20) seTrackUpdate_s[JAIGlobalParameter::getParamSeTrackMax()]; + JUT_ASSERT_MSG(86, seTrackUpdate, "JAIData::initHeap Cannot Alloc Heap!!\n"); + for (int i = 0; i < JAIGlobalParameter::getParamSeTrackMax(); i++) { + seTrackUpdate_s* tmp = &seTrackUpdate[i]; + tmp->field_0x4 = 1.0f; + tmp->field_0x8 = 1.0f; + tmp->field_0xc = 0.0f; + tmp->field_0x10 = 0.5f; + tmp->field_0x0 = 0xff; + tmp->field_0x14 = 0.0f; + } + SeParameter* parameterObject = new (JAIBasic::getCurrentJAIHeap(), 0x20) SeParameter[JAIGlobalParameter::getParamSeCategoryMax() * JAIGlobalParameter::getParamSeRegistMax()]; + JUT_ASSERT_MSG(99, parameterObject, "JAIData::initHeap Cannot Alloc Heap!!\n"); + seParameterFreeStartPointer = parameterObject; + seParameterUsedEndPointer = NULL; + parameterObject[0].field_0x43c = NULL; + parameterObject[0].field_0x440 = parameterObject + 1; + int r27; + for (r27 = 1; r27 < JAIGlobalParameter::getParamSeCategoryMax() * JAIGlobalParameter::getParamSeRegistMax() - 1; r27++) { + parameterObject[r27].field_0x43c = parameterObject + (r27 - 1); + parameterObject[r27].field_0x440 = parameterObject + (r27 + 1); + } + parameterObject[r27].field_0x43c = parameterObject + (r27 - 1); + parameterObject[r27].field_0x440 = NULL; + if (JAIBasic::getInterface()->field_0x1c) { + categoryInfoTable = JAIBasic::getInterface()->field_0x1c; + } else { + categoryInfoTable = new (JAIBasic::getCurrentJAIHeap(), 0x20) u8*[JAIGlobalParameter::getParamSoundSceneMax()]; + JUT_ASSERT_MSG(124, categoryInfoTable, "JAIData::initHeap Cannot Alloc Heap!!\n"); + for (int i = 0; i < JAIGlobalParameter::getParamSoundSceneMax(); i++) { + categoryInfoTable[i] = Const::sCInfos_0; + } + } + seEntryCancel = new (JAIBasic::getCurrentJAIHeap(), 0x20) u8[JAIGlobalParameter::getParamSeCategoryMax()]; + JUT_ASSERT_MSG(132, seEntryCancel, "JAIBasic::initAllocParameter Cannot Alloc Heap!! (seEntryCancel)\n"); + seCategoryVolume = new (JAIBasic::getCurrentJAIHeap(), 0x20) f32[JAIGlobalParameter::getParamSeCategoryMax()]; + JUT_ASSERT_MSG(134, seCategoryVolume, "JAIBasic::initAllocParameter Cannot Alloc Heap!!(seCategoryVolume)\n"); + for (int i = 0; i < JAIGlobalParameter::getParamSeCategoryMax(); i++) { + seEntryCancel[i] = 0; + seCategoryVolume[i] = 1.0f; + } } /* 80293370-80293460 .text __ct__Q27JAInter11SeParameterFv */ -JAInter::SeParameter::SeParameter() { - /* Nonmatching */ -} +JAInter::SeParameter::SeParameter() {} /* 80293460-80293508 .text startSeSequence__Q27JAInter5SeMgrFv */ void JAInter::SeMgr::startSeSequence() { - /* Nonmatching */ + seHandle = NULL; + JAIBasic::msBasic->startSoundActor(0x80000800, &seHandle, NULL, 1, 4); + JUT_ASSERT_MSG(149, JAISeMgr::seHandle, "SEシーケンスの再生に失敗しました。\n") } /* 80293508-80293530 .text processGFrameSe__Q27JAInter5SeMgrFv */ void JAInter::SeMgr::processGFrameSe() { - /* Nonmatching */ + checkNextFrameSe(); + checkPlayingSe(); + checkSeMovePara(); } /* 80293530-80293C94 .text checkNextFrameSe__Q27JAInter5SeMgrFv */ @@ -49,6 +139,20 @@ void JAInter::SeMgr::clearSeqMuteFromSeStop(JAISound*) { /* 80294380-802944A0 .text checkSeMovePara__Q27JAInter5SeMgrFv */ void JAInter::SeMgr::checkSeMovePara() { /* Nonmatching */ + if (seHandle && seHandle->getSeqParameter()->field_0x1261 != 2) { + for (u8 i = 0; i < JAIGlobalParameter::getParamSeCategoryMax(); i++) { + for (JAISound* sound = seRegist[i].field_0x4; sound; sound = sound->field_0x34) { + for (u8 j = 0; j < 8; j++) { + sound->getSeParameter()->field_0x124[j].move(); + sound->getSeParameter()->field_0x1a4[j].move(); + sound->getSeParameter()->field_0x2a4[j].move(); + sound->getSeParameter()->field_0x324[j].move(); + sound->getSeParameter()->field_0x3a4[j].move(); + sound->getSeParameter()->field_0x224[j].move(); + } + } + } + } } /* 802944A0-802945FC .text sendSeAllParameter__Q27JAInter5SeMgrFP8JAISound */ @@ -57,17 +161,17 @@ void JAInter::SeMgr::sendSeAllParameter(JAISound*) { } /* 802945FC-802946F0 .text checkPlayingSeUpdateMultiplication__Q27JAInter5SeMgrFP8JAISoundPQ27JAInter13SeqUpdateDataPfPQ27JAInter11MoveParaSetfUcPf */ -void JAInter::SeMgr::checkPlayingSeUpdateMultiplication(JAISound*, JAInter::SeqUpdateData*, float*, JAInter::MoveParaSet*, float, unsigned char, float*) { +void JAInter::SeMgr::checkPlayingSeUpdateMultiplication(JAISound*, JAInter::SeqUpdateData*, f32*, JAInter::MoveParaSet*, f32, u8, f32*) { /* Nonmatching */ } /* 802946F0-8029480C .text checkPlayingSeUpdateAddition__Q27JAInter5SeMgrFP8JAISoundPQ27JAInter13SeqUpdateDataPfPQ27JAInter11MoveParaSetUcPff */ -void JAInter::SeMgr::checkPlayingSeUpdateAddition(JAISound*, JAInter::SeqUpdateData*, float*, JAInter::MoveParaSet*, unsigned char, float*, float) { +void JAInter::SeMgr::checkPlayingSeUpdateAddition(JAISound*, JAInter::SeqUpdateData*, f32*, JAInter::MoveParaSet*, u8, f32*, f32) { /* Nonmatching */ } /* 8029480C-80294814 .text changeIDToCategory__Q27JAInter5SeMgrFUl */ -void JAInter::SeMgr::changeIDToCategory(unsigned long) { +u8 JAInter::SeMgr::changeIDToCategory(u32) { /* Nonmatching */ } @@ -77,7 +181,7 @@ void JAInter::SeMgr::releaseSeRegist(JAISound*) { } /* 80294938-80294994 .text getSeParametermeterPointer__Q27JAInter5SeMgrFv */ -void JAInter::SeMgr::getSeParametermeterPointer() { +JAInter::SeParameter* JAInter::SeMgr::getSeParametermeterPointer() { /* Nonmatching */ } @@ -87,26 +191,11 @@ void JAInter::SeMgr::releaseSeParameterPointer(JAInter::SeParameter*) { } /* 80294A10-80294EBC .text storeSeBuffer__Q27JAInter5SeMgrFPP8JAISoundPQ27JAInter5ActorUlUlUcPv */ -void JAInter::SeMgr::storeSeBuffer(JAISound**, JAInter::Actor*, unsigned long, unsigned long, unsigned char, void*) { +void JAInter::SeMgr::storeSeBuffer(JAISound**, JAInter::Actor*, u32, u32, u8, void*) { /* Nonmatching */ } /* 80294EBC-80294F14 .text releaseSeBuffer__Q27JAInter5SeMgrFP8JAISoundUl */ -void JAInter::SeMgr::releaseSeBuffer(JAISound*, unsigned long) { - /* Nonmatching */ -} - -/* 80294F14-80294F2C .text __ct__Q27JAInter19MoveParaSetInitZeroFv */ -JAInter::MoveParaSetInitZero::MoveParaSetInitZero() { - /* Nonmatching */ -} - -/* 80294F2C-80294F44 .text __ct__Q27JAInter19MoveParaSetInitHalfFv */ -JAInter::MoveParaSetInitHalf::MoveParaSetInitHalf() { - /* Nonmatching */ -} - -/* 80294F44-80294F5C .text __defctor__Q27JAInter11MoveParaSetFv */ -void JAInter::MoveParaSet::__defctor() { +void JAInter::SeMgr::releaseSeBuffer(JAISound*, u32) { /* Nonmatching */ } diff --git a/src/JSystem/JAudio/JAISequenceHeap.cpp b/src/JSystem/JAudio/JAISequenceHeap.cpp index 772260d0b..f7c2c67b4 100644 --- a/src/JSystem/JAudio/JAISequenceHeap.cpp +++ b/src/JSystem/JAudio/JAISequenceHeap.cpp @@ -4,49 +4,145 @@ // #include "JSystem/JAudio/JAISequenceHeap.h" -#include "dolphin/types.h" +#include "JSystem/JAudio/JAIBasic.h" +#include "JSystem/JAudio/JAIGlobalParameter.h" +#include "JSystem/JKernel/JKRSolidHeap.h" + +JAInter::HeapBlock* JAInter::HeapMgr::sAutoHeap; +JAInter::HeapBlock* JAInter::HeapMgr::sStayHeap; +u32 JAInter::HeapMgr::sAutoHeapCount; +u32 JAInter::HeapMgr::sStayHeapCount; /* 80294F5C-8029531C .text init__Q27JAInter7HeapMgrFUcUlUcUl */ -void JAInter::HeapMgr::init(unsigned char, unsigned long, unsigned char, unsigned long) { - /* Nonmatching */ +void JAInter::HeapMgr::init(u8 param_1, u32 param_2, u8 param_3, u32 param_4) { + sAutoHeap = new (JAIBasic::getCurrentJAIHeap(), 0x20) HeapBlock[param_3]; + JUT_ASSERT_MSG(38, sAutoHeap, "JAIHeapMgr::initHeap Cannot Alloc Heap!!\n"); + for (u32 i = 0; i < param_3; i++) { + sAutoHeap[i].mStatus = 0; + sAutoHeap[i].field_0xc = 0; + sAutoHeap[i].field_0x8 = -1; + sAutoHeap[i].field_0x10 = -1; + sAutoHeap[i].mPointer = new (JAIBasic::getCurrentJAIHeap(), 0x20) u8[param_4]; + } + sStayHeap = new (JAIBasic::getCurrentJAIHeap(), 0x20) HeapBlock[param_1]; + JUT_ASSERT_MSG(48, sStayHeap, "JAIHeapMgr::initHeap Cannot Alloc Heap!!\n"); + sStayHeap->mPointer = new (JAIBasic::getCurrentJAIHeap(), 0x20) u8[param_2]; + for (u32 i = 0; i < param_1; i++) { + sStayHeap[i].mStatus = 0; + sStayHeap[i].field_0xc = 0; + sStayHeap[i].field_0x8 = -1; + sStayHeap[i].field_0x10 = -1; + } } /* 8029531C-80295324 .text getAutoHeapPointer__Q27JAInter7HeapMgrFv */ -void JAInter::HeapMgr::getAutoHeapPointer() { - /* Nonmatching */ +JAInter::HeapBlock* JAInter::HeapMgr::getAutoHeapPointer() { + return sAutoHeap; } /* 80295324-8029541C .text checkOnMemory__Q27JAInter7HeapMgrFUlPUc */ -void JAInter::HeapMgr::checkOnMemory(unsigned long, unsigned char*) { - /* Nonmatching */ +void* JAInter::HeapMgr::checkOnMemory(u32 param_1, u8* param_2) { + for (u8 i = 0; i < JAIGlobalParameter::getParamAutoHeapMax(); i++) { + if (param_1 != sAutoHeap[i].field_0x8) { + continue; + } + if (sAutoHeap[i].mStatus == 1) { + return (void*)-1; + } + if (param_2) { + *param_2 = i; + } + return sAutoHeap[i].getPointer(); + } + for (u8 i = 0; i < sStayHeapCount; i++) { + if (param_1 != sStayHeap[i].field_0x8) { + continue; + } + if (param_2) { + *param_2 = 0xff; + } + return sStayHeap[i].getPointer(); + } + return NULL; } /* 8029541C-80295440 .text releaseAutoHeapPointer__Q27JAInter7HeapMgrFUc */ -void JAInter::HeapMgr::releaseAutoHeapPointer(unsigned char) { +void JAInter::HeapMgr::releaseAutoHeapPointer(u8 param_1) { /* Nonmatching */ + if (param_1 == 0xff) { + return; + } + sAutoHeap[param_1].field_0x10 = -1; } /* 80295440-80295518 .text checkUsefulAutoHeapPosition__Q27JAInter7HeapMgrFv */ -void JAInter::HeapMgr::checkUsefulAutoHeapPosition() { - /* Nonmatching */ +u8 JAInter::HeapMgr::checkUsefulAutoHeapPosition() { + int i = 0; + u32 r29 = -1; + int r28 = 0; + for (; i < JAIGlobalParameter::getParamAutoHeapMax(); i++) { + if (sAutoHeap[i].field_0x8 == -1) { + break; + } + } + if (i == JAIGlobalParameter::getParamAutoHeapMax()) { + for (i = 0; i < JAIGlobalParameter::getParamAutoHeapMax(); i++) { + if (r29 > sAutoHeap[i].field_0xc && sAutoHeap[i].field_0x10 == -1) { + r28 = i; + r29 = sAutoHeap[i].field_0xc; + } + } + if (r29 != -1) { + i = r28; + } + } + return i; } /* 80295518-80295560 .text getFreeAutoHeapPointer__Q27JAInter7HeapMgrFUcUl */ -void JAInter::HeapMgr::getFreeAutoHeapPointer(unsigned char, unsigned long) { +void* JAInter::HeapMgr::getFreeAutoHeapPointer(u8 param_1, u32 param_2) { /* Nonmatching */ + sAutoHeap[param_1].field_0x8 = param_2; + void* result = sAutoHeap[param_1].mPointer; + sAutoHeap[param_1].field_0x10 = sAutoHeapCount; + sAutoHeap[param_1].field_0xc = sAutoHeapCount; + sAutoHeapCount++; + return result; } /* 80295560-80295658 .text getFreeStayHeapPointer__Q27JAInter7HeapMgrFUlUl */ -void JAInter::HeapMgr::getFreeStayHeapPointer(unsigned long, unsigned long) { +void* JAInter::HeapMgr::getFreeStayHeapPointer(u32 param_1, u32 param_2) { /* Nonmatching */ + if (sStayHeapCount >= JAIGlobalParameter::getParamStayHeapMax()) { + return NULL; + } + void* r30 = sStayHeap[0].getPointer(); + void* r29 = sStayHeap[sStayHeapCount].getPointer(); + if (u32(r29) + param_1 < u32(r30) + JAIGlobalParameter::getParamStayHeapSize() && sStayHeapCount < JAIGlobalParameter::getParamStayHeapMax()) { + r29 = sStayHeap[sStayHeapCount].getPointer(); + sStayHeap[sStayHeapCount].field_0x8 = param_2; + r30 = (void*)(u32(sStayHeap[sStayHeapCount].getPointer()) + ALIGN_PREV(param_1, 32)); + if (IS_NOT_ALIGNED(param_1, 32)) { + r30 = (void*)(u32(r30) + 32); + } + sStayHeapCount++; + if (sStayHeapCount < JAIGlobalParameter::getParamStayHeapMax()) { + sStayHeap[sStayHeapCount].setPointer(r30); + } + } else { + r29 = NULL; + } + return r29; } /* 80295658-8029566C .text setAutoHeapLoadedFlag__Q27JAInter7HeapMgrFUcUc */ -void JAInter::HeapMgr::setAutoHeapLoadedFlag(unsigned char, unsigned char) { - /* Nonmatching */ +void JAInter::HeapMgr::setAutoHeapLoadedFlag(u8 param_1, u8 param_2) { + sAutoHeap[param_1].setStatus(param_2); } /* 8029566C-80295684 .text __ct__Q27JAInter9HeapBlockFv */ JAInter::HeapBlock::HeapBlock() { - /* Nonmatching */ + field_0xc = 0; + field_0x8 = -1; + field_0x10 = -1; }