From 80e9cb2a0e29125134a99c1856a0df422a12ac82 Mon Sep 17 00:00:00 2001 From: HeartPiece Date: Sun, 19 May 2024 17:05:39 +1000 Subject: [PATCH] JAISequenceMgr progress + fix intellisense issue --- .vscode/warnings.h | 2 +- docs/recommended_todo.md | 16 +- include/JSystem/JAudio/JAI/JAInter.h | 16 +- include/JSystem/JAudio/JAI/JAInter/BankWave.h | 3 + include/JSystem/JKernel/JKRHeap.h | 4 +- include/PikiAI.h | 2 +- include/Vector3.h | 4 +- include/types.h | 6 + src/JSystem/JAudio/JAI/JAISequenceMgr.cpp | 545 +++--------------- src/plugProjectKonoU/khWorldMap.cpp | 2 +- 10 files changed, 116 insertions(+), 484 deletions(-) diff --git a/.vscode/warnings.h b/.vscode/warnings.h index 3ba4ddc1d..6ad0105a7 100644 --- a/.vscode/warnings.h +++ b/.vscode/warnings.h @@ -3,4 +3,4 @@ // disables the "invalid multibyte character sequence" error since we have to escape shift-jis misreads a lot #pragma diag_suppress 870 // disables the "invalid arguments for operator new" error -#pragma diag_suppress 1767 +#pragma diag_suppress 1767 \ No newline at end of file diff --git a/docs/recommended_todo.md b/docs/recommended_todo.md index ab8d8e9d7..5bba7bb54 100644 --- a/docs/recommended_todo.md +++ b/docs/recommended_todo.md @@ -51,7 +51,7 @@ | J2D/J2DWindowEx.cpp | 47225 | JAudio//JAS/JASSeqParser.cpp | 48617 | | JStudio/functionvalue.cpp | 50054 | JAudio//JAI/JAIStreamMgr.cpp | 52981 | | JAudio//JAI/JAISound.cpp | 56856 | JParticle/JPAFieldBlock.cpp | 58986 | -| JAudio//JAI/JAISeMgr.cpp | 64934 | JAudio//JAI/JAISequenceMgr.cpp | 73371 | +| JAudio//JAI/JAISequenceMgr.cpp | 64846 | JAudio//JAI/JAISeMgr.cpp | 64934 | | J3D/J3DMaterialFactory.cpp | 75581 | JAudio//JAS/JASTrack.cpp | 84855 | | J2D/J2DPictureEx.cpp | 90416 | JParticle/JPAResource.cpp | 95965 | | JParticle/JPABaseShape.cpp | 96579 | JStudio/jstudio-object.cpp | 123297 | @@ -83,16 +83,16 @@ | singleGS_CaveResult.cpp | 19794 | itemCave.cpp | 20301 | | pathfinder.cpp | 20409 | itemPikihead.cpp | 23992 | | gameCPlate.cpp | 24190 | dynCreature.cpp | 25766 | -| gameDynamics.cpp | 27114 | vsCardMgr.cpp | 30814 | +| gameDynamics.cpp | 27112 | vsCardMgr.cpp | 30814 | | singleGS_MainGame.cpp | 31937 | itemBridge.cpp | 32179 | | itemGate.cpp | 32834 | gamePlayDataMemCard.cpp | 36029 | | gameGeneratorCache.cpp | 36353 | piki.cpp | 36583 | | gamePlayData.cpp | 36955 | routeMgr.cpp | 39142 | | collinfo.cpp | 43044 | fakePiki.cpp | 50426 | | cellPyramid.cpp | 52719 | singleGS_CaveGame.cpp | 52995 | -| aiFormation.cpp | 53253 | navi_demoCheck.cpp | 57727 | +| aiFormation.cpp | 53253 | navi_demoCheck.cpp | 58040 | | pelletState.cpp | 63200 | itemUjamushi.cpp | 63554 | -| itemPlant.cpp | 73149 | baseGameSection.cpp | 92608 | +| itemPlant.cpp | 73149 | baseGameSection.cpp | 86599 | | aiPrimitives.cpp | 117085 | pelletMgr.cpp | 141213 | | navi.cpp | 152216 | pikiState.cpp | 155487 | | singleGS_Zukan.cpp | 163799 | gameMapParts.cpp | 164131 | @@ -102,7 +102,7 @@ | File | Size (bytes) | File | Size (bytes) | | ---- | ---- | ---- | ---- | | khCaveResult.cpp | 42333 | khFinalResult.cpp | 59527 | -| khDayEndResult.cpp | 81837 | khWorldMap.cpp | 158173 | +| khDayEndResult.cpp | 81837 | khWorldMap.cpp | 158519 | ###
plugProjectMorimuraU
| File | Size (bytes) | File | Size (bytes) | @@ -119,8 +119,8 @@ ###
plugProjectNishimuraU
| File | Size (bytes) | File | Size (bytes) | | ---- | ---- | ---- | ---- | -| ContRumble.cpp | 6767 | nslibmath.cpp | 7010 | -| TyreShadow.cpp | 7271 | UmimushiShadow.cpp | 7675 | +| ContRumble.cpp | 6767 | TyreShadow.cpp | 7271 | +| nslibmath.cpp | 7422 | UmimushiShadow.cpp | 7675 | | SnakeJointMgr.cpp | 7850 | KumaChappy.cpp | 10300 | | SnakeWholeShadow.cpp | 11927 | SnakeCrowShadow.cpp | 12091 | | Kabuto.cpp | 12215 | BabyState.cpp | 12807 | @@ -189,7 +189,7 @@ | system.cpp | 32972 | windowMessage.cpp | 37900 | | bootSection.cpp | 38565 | movieMessage.cpp | 44324 | | pikmin2MemoryCardMgr.cpp | 50866 | graphics.cpp | 76184 | -| messageRendering.cpp | 100250 | | | +| messageRendering.cpp | 100248 | | | ###
utilityU
| File | Size (bytes) | File | Size (bytes) | diff --git a/include/JSystem/JAudio/JAI/JAInter.h b/include/JSystem/JAudio/JAI/JAInter.h index b04658108..eec39f2e1 100644 --- a/include/JSystem/JAudio/JAI/JAInter.h +++ b/include/JSystem/JAudio/JAI/JAInter.h @@ -9,6 +9,7 @@ #include "JSystem/JKernel/JKRArchive.h" #include "JSystem/JSupport/JSUList.h" #include "JSystem/JAudio/JAI/JAIGlobalParameter.h" +#include "JSystem/JAudio/JAI/JAInter/BankWave.h" #include "types.h" #include "Dolphin/mtx.h" @@ -331,11 +332,11 @@ struct SeqUpdateData { f32 _18; // _18, pan? f32 _1C; // _1C, dolby? f32 _20; // _20 - f32* _24; // _24 - f32* _28; // _28 - f32* _2C; // _2C - f32* _30; // _30 - f32* _34; // _34 + f32* _24; // _24, volume? + f32* _28; // _28, pitch? + f32* _2C; // _2C, fxmix? + f32* _30; // _30, ?? + f32* _34; // _34, dolby? u8 _38[8]; // _38 - unknown u8* mFilePtr; // _40, pointer to a data file loaded in by getSeqData u32* _44; // _44 @@ -350,6 +351,9 @@ struct SeqParameter { inline JASTrack* getTrack() { return &mTrack; } + // this name is made up, don't rely on it to name the member + inline u32 getSceneFlag() const { return _27C; } + MoveParaSet _00; // _00 MoveParaSet _10[16]; // _10 MoveParaSet mVolumes[20]; // _110 @@ -366,7 +370,7 @@ struct SeqParameter { u8 _278; // _278 - auto heap index? u8 mPauseMode; // _279 s16 _27A; // _27A - u32 _27C; // _27C + int _27C; // _27C u32 _280; // _280 u32 mVolumeFlags; // _284 u32 mPanFlags; // _288 diff --git a/include/JSystem/JAudio/JAI/JAInter/BankWave.h b/include/JSystem/JAudio/JAI/JAInter/BankWave.h index 2524f02c1..32ecd3d2a 100644 --- a/include/JSystem/JAudio/JAI/JAInter/BankWave.h +++ b/include/JSystem/JAudio/JAI/JAInter/BankWave.h @@ -77,6 +77,9 @@ extern LoadCallback secondLoadCallback; extern s32* wsGroupNumber; extern s32* wsLoadStatus; extern int wsMax; + +inline int getSceneSetFlag() { return SceneSetFlag; } + } // namespace BankWave } // namespace JAInter diff --git a/include/JSystem/JKernel/JKRHeap.h b/include/JSystem/JKernel/JKRHeap.h index bbb5d452d..bf12b2bc8 100644 --- a/include/JSystem/JKernel/JKRHeap.h +++ b/include/JSystem/JKernel/JKRHeap.h @@ -364,9 +364,9 @@ struct JKRSolidHeap : public JKRHeap { inline void* operator new(size_t size, void* mem) { return mem; } // fabricated? void* operator new(size_t, JKRHeap*, int); -void* operator new(u32 byteCount, int p2); +void* operator new(size_t byteCount, int p2); void* operator new[](size_t, JKRHeap*, int); -void* operator new[](u32 byteCount, int p2); +void* operator new[](size_t byteCount, int p2); static void JKRDefaultMemoryErrorRoutine(void* heap, u32 size, int alignment); diff --git a/include/PikiAI.h b/include/PikiAI.h index 9d3ef40e5..2879ad53e 100644 --- a/include/PikiAI.h +++ b/include/PikiAI.h @@ -747,7 +747,7 @@ struct ActFormationInitArg : public CreatureActionArg { inline ActFormationInitArg(Game::Creature* navi, bool b1) : CreatureActionArg(navi) , mIsDemoFollow(b1) - , mDoUseTouchCooldown(false) + , mDoUseTouchCooldown(false) { } diff --git a/include/Vector3.h b/include/Vector3.h index a550203df..8b079eaa4 100644 --- a/include/Vector3.h +++ b/include/Vector3.h @@ -29,8 +29,8 @@ struct Vector3 { // Assignment Operators inline Vector3& operator=(const Vector3& other); - inline void operator=(Vector3& other); - inline void operator=(const Vec& other); + inline void operator =(Vector3& other); + inline void operator =(const Vec& other); // Conversion Operators inline operator Vector2() const; diff --git a/include/types.h b/include/types.h index aba2cb015..d680a6f41 100644 --- a/include/types.h +++ b/include/types.h @@ -1,6 +1,12 @@ #ifndef _TYPES_H #define _TYPES_H +// this is just here until a new cpptools version comes out +// since they broke forceIncludes in vscode configs :') +#ifdef __INTELLISENSE__ +#include "../.vscode/warnings.h" +#endif + #include "BuildSettings.h" // r2 is 8051E360 diff --git a/src/JSystem/JAudio/JAI/JAISequenceMgr.cpp b/src/JSystem/JAudio/JAI/JAISequenceMgr.cpp index ee5681a28..ff0c528de 100644 --- a/src/JSystem/JAudio/JAI/JAISequenceMgr.cpp +++ b/src/JSystem/JAudio/JAI/JAISequenceMgr.cpp @@ -4,9 +4,12 @@ #include "JSystem/JAudio/JAI/JAISequence.h" #include "JSystem/JAudio/JAI/JAInter.h" #include "JSystem/JAudio/JAI/JAInter/MoveParaSet.h" +#include "JSystem/JAudio/JAI/JAInter/BankWave.h" +#include "JSystem/JAudio/JAI/JAInter/HeapMgr.h" #include "JSystem/JAudio/JAS/JASPortCmd.h" #include "JSystem/JAudio/JAS/JASResArcLoader.h" #include "JSystem/JKernel/JKRArchive.h" +#include "JSystem/JKernel/JKRHeap.h" #include "types.h" namespace JAInter { @@ -31,322 +34,38 @@ void init() JAISequence* sequence = JAIBasic::getInterface()->makeSequence(); seqControl.mFreeList->append(sequence); } - + JAISequence* obj; for (JSULink* link = seqControl.mFreeList->getFirst(); link; link = link->getNext()) { - JAISound* obj = link->getObject(); + obj = static_cast(link->getObject()); + + obj->mSeqParameter.mPans = new (JAIGetCurrentHeap(), 0x20) MoveParaSet[JAIGlobalParameter::getParamSeqParameterLines()]; + obj->mSeqParameter.mPitches = new (JAIGetCurrentHeap(), 0x20) MoveParaSet[JAIGlobalParameter::getParamSeqParameterLines()]; + obj->mSeqParameter.mFxmixes = new (JAIGetCurrentHeap(), 0x20) MoveParaSet[JAIGlobalParameter::getParamSeqParameterLines()]; + obj->mSeqParameter.mDolbys = new (JAIGetCurrentHeap(), 0x20) MoveParaSet[JAIGlobalParameter::getParamSeqParameterLines()]; + + obj->mSeqParameter.mTrackVolumes = new (JAIGetCurrentHeap(), 0x20) MoveParaSet[JAIGlobalParameter::getParamSeqTrackMax()]; + obj->mSeqParameter.mTrackPans = new (JAIGetCurrentHeap(), 0x20) MoveParaSetInitHalf[JAIGlobalParameter::getParamSeqTrackMax()]; + obj->mSeqParameter.mTrackPitches = new (JAIGetCurrentHeap(), 0x20) MoveParaSet[JAIGlobalParameter::getParamSeqTrackMax()]; + obj->mSeqParameter.mTrackFxmixes = new (JAIGetCurrentHeap(), 0x20) MoveParaSetInitZero[JAIGlobalParameter::getParamSeqTrackMax()]; + obj->mSeqParameter.mTrackDolbys = new (JAIGetCurrentHeap(), 0x20) MoveParaSetInitZero[JAIGlobalParameter::getParamSeqTrackMax()]; + + obj->mSeqParameter._274 = new (JAIGetCurrentHeap(), 0x20) u16*[JAIGlobalParameter::getParamSeqTrackMax()]; + + for (u32 i = 0; i < JAIGlobalParameter::getParamSeqTrackMax(); i++) { + obj->mSeqParameter._274[i] = new (JAIGetCurrentHeap(), 0x20) u16[16]; + } + + obj->mSeqParameter._2B4 = new (JAIGetCurrentHeap(), 0x20) u32[JAIGlobalParameter::getParamSeqTrackMax()]; + obj->mSeqParameter.mInterruptSwitches = new (JAIGetCurrentHeap(), 0x20) u8[JAIGlobalParameter::getParamSeqTrackMax()]; + obj->mSeqParameter._2BC = (MuteBit*)new (JAIGetCurrentHeap(), 0x20) MuteBit[JAIGlobalParameter::getParamSeqTrackMax()]; } - /* - stwu r1, -0x80(r1) - mflr r0 - stw r0, 0x84(r1) - stfd f31, 0x70(r1) - psq_st f31, 120(r1), 0, qr0 - stfd f30, 0x60(r1) - psq_st f30, 104(r1), 0, qr0 - stfd f29, 0x50(r1) - psq_st f29, 88(r1), 0, qr0 - stfd f28, 0x40(r1) - psq_st f28, 72(r1), 0, qr0 - stmw r20, 0x10(r1) - addi r3, r13, seqControl__Q27JAInter11SequenceMgr@sda21 - bl init__Q27JAInter9LinkSoundFv - lwz r21, msCurrentHeap__8JAIBasic@sda21(r13) - bl getParamSeqPlayTrackMax__18JAIGlobalParameterFv - slwi r3, r3, 2 - mr r4, r21 - li r5, 0x20 - bl __nwa__FUlP7JKRHeapi - stw r3, FixSeqBufPointer__Q27JAInter11SequenceMgr@sda21(r13) - li r21, 0 - b lbl_800B09C8 -lbl_800B09A0: - lwz r3, msBasic__8JAIBasic@sda21(r13) - lwz r12, 0(r3) - lwz r12, 8(r12) - mtctr r12 - bctrl - mr r0, r3 - lwz r3, seqControl__Q27JAInter11SequenceMgr@sda21(r13) - mr r4, r0 - bl append__10JSUPtrListFP10JSUPtrLink - addi r21, r21, 1 + seqTrackInfo = new (JAIGetCurrentHeap(), 0x20) SeqUpdateData[JAIGlobalParameter::getParamSeqPlayTrackMax()]; -lbl_800B09C8: - bl getParamSeqControlBufferMax__18JAIGlobalParameterFv - cmplw r21, r3 - blt lbl_800B09A0 - lwz r6, seqControl__Q27JAInter11SequenceMgr@sda21(r13) - lis r3, __defctor__Q27JAInter11MoveParaSetFv@ha - addi r23, r3, __defctor__Q27JAInter11MoveParaSetFv@l - lis r4, __ct__Q27JAInter19MoveParaSetInitZeroFv@ha - lis r5, __ct__Q27JAInter19MoveParaSetInitHalfFv@ha - lis r3, __ct__Q27JAInter7MuteBitFv@ha - lwz r30, 0(r6) - addi r29, r4, __ct__Q27JAInter19MoveParaSetInitZeroFv@l - mr r24, r23 - mr r25, r23 - mr r26, r23 - mr r28, r23 - addi r27, r5, __ct__Q27JAInter19MoveParaSetInitHalfFv@l - addi r22, r3, __ct__Q27JAInter7MuteBitFv@l - b lbl_800B0CA4 - -lbl_800B0A10: - lwz r31, 0(r30) - bl getParamSeqParameterLines__18JAIGlobalParameterFv - rlwinm r6, r3, 4, 0x14, 0x1b - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - clrlwi r21, r3, 0x18 - li r5, 0x20 - addi r3, r6, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r23 - mr r7, r21 - li r5, 0 - li r6, 0x10 - bl __construct_new_array - stw r3, 0x298(r31) - bl getParamSeqParameterLines__18JAIGlobalParameterFv - rlwinm r6, r3, 4, 0x14, 0x1b - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - clrlwi r21, r3, 0x18 - li r5, 0x20 - addi r3, r6, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r23 - mr r7, r21 - li r5, 0 - li r6, 0x10 - bl __construct_new_array - stw r3, 0x29c(r31) - bl getParamSeqParameterLines__18JAIGlobalParameterFv - rlwinm r6, r3, 4, 0x14, 0x1b - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - clrlwi r21, r3, 0x18 - li r5, 0x20 - addi r3, r6, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r24 - mr r7, r21 - li r5, 0 - li r6, 0x10 - bl __construct_new_array - stw r3, 0x2a0(r31) - bl getParamSeqParameterLines__18JAIGlobalParameterFv - rlwinm r6, r3, 4, 0x14, 0x1b - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - clrlwi r21, r3, 0x18 - li r5, 0x20 - addi r3, r6, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r25 - mr r7, r21 - li r5, 0 - li r6, 0x10 - bl __construct_new_array - stw r3, 0x2a4(r31) - bl getParamSeqTrackMax__18JAIGlobalParameterFv - mr r21, r3 - slwi r3, r3, 4 - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - li r5, 0x20 - addi r3, r3, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r26 - mr r7, r21 - li r5, 0 - li r6, 0x10 - bl __construct_new_array - stw r3, 0x2a8(r31) - bl getParamSeqTrackMax__18JAIGlobalParameterFv - mr r21, r3 - slwi r3, r3, 4 - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - li r5, 0x20 - addi r3, r3, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r27 - mr r7, r21 - li r5, 0 - li r6, 0x10 - bl __construct_new_array - stw r3, 0x2ac(r31) - bl getParamSeqTrackMax__18JAIGlobalParameterFv - mr r21, r3 - slwi r3, r3, 4 - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - li r5, 0x20 - addi r3, r3, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r28 - mr r7, r21 - li r5, 0 - li r6, 0x10 - bl __construct_new_array - stw r3, 0x2b0(r31) - bl getParamSeqTrackMax__18JAIGlobalParameterFv - mr r21, r3 - slwi r3, r3, 4 - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - li r5, 0x20 - addi r3, r3, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r29 - mr r7, r21 - li r5, 0 - li r6, 0x10 - bl __construct_new_array - stw r3, 0x2b4(r31) - bl getParamSeqTrackMax__18JAIGlobalParameterFv - mr r21, r3 - slwi r3, r3, 4 - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - li r5, 0x20 - addi r3, r3, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r29 - mr r7, r21 - li r5, 0 - li r6, 0x10 - bl __construct_new_array - stw r3, 0x2b8(r31) - lwz r21, msCurrentHeap__8JAIBasic@sda21(r13) - bl getParamSeqTrackMax__18JAIGlobalParameterFv - slwi r3, r3, 2 - mr r4, r21 - li r5, 0x20 - bl __nwa__FUlP7JKRHeapi - stw r3, 0x2bc(r31) - li r20, 0 - li r21, 0 - b lbl_800B0C30 - -lbl_800B0C10: - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - li r3, 0x20 - li r5, 0x20 - bl __nwa__FUlP7JKRHeapi - lwz r4, 0x2bc(r31) - addi r20, r20, 1 - stwx r3, r4, r21 - addi r21, r21, 4 - -lbl_800B0C30: - bl getParamSeqTrackMax__18JAIGlobalParameterFv - cmplw r20, r3 - blt lbl_800B0C10 - lwz r21, msCurrentHeap__8JAIBasic@sda21(r13) - bl getParamSeqTrackMax__18JAIGlobalParameterFv - slwi r3, r3, 2 - mr r4, r21 - li r5, 0x20 - bl __nwa__FUlP7JKRHeapi - stw r3, 0x2fc(r31) - lwz r21, msCurrentHeap__8JAIBasic@sda21(r13) - bl getParamSeqTrackMax__18JAIGlobalParameterFv - mr r4, r21 - li r5, 0x20 - bl __nwa__FUlP7JKRHeapi - stw r3, 0x300(r31) - bl getParamSeqTrackMax__18JAIGlobalParameterFv - mr r21, r3 - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - li r5, 0x20 - addi r3, r21, 0x10 - bl __nwa__FUlP7JKRHeapi - mr r4, r22 - mr r7, r21 - li r5, 0 - li r6, 1 - bl __construct_new_array - stw r3, 0x304(r31) - lwz r30, 0xc(r30) - -lbl_800B0CA4: - cmplwi r30, 0 - bne lbl_800B0A10 - bl getParamSeqPlayTrackMax__18JAIGlobalParameterFv - mr r21, r3 - lwz r4, msCurrentHeap__8JAIBasic@sda21(r13) - mulli r3, r21, 0x50 - li r5, 0x20 - addi r3, r3, 0x10 - bl __nwa__FUlP7JKRHeapi - lis r4, __ct__Q27JAInter13SeqUpdateDataFv@ha - mr r7, r21 - addi r4, r4, __ct__Q27JAInter13SeqUpdateDataFv@l - li r5, 0 - li r6, 0x50 - bl __construct_new_array - li r25, 0 - stw r3, seqTrackInfo__Q27JAInter11SequenceMgr@sda21(r13) - lfs f29, lbl_80516FA0@sda21(r2) - mr r26, r25 - lfs f30, lbl_80516FAC@sda21(r2) - li r20, 0 - lfs f31, lbl_80516FA8@sda21(r2) - lfs f28, lbl_80516FA4@sda21(r2) - b lbl_800B0D8C - -lbl_800B0D04: - lwz r3, FixSeqBufPointer__Q27JAInter11SequenceMgr@sda21(r13) - li r22, 0 - mr r21, r22 - stwx r22, r3, r25 - mr r24, r22 - lwz r0, seqTrackInfo__Q27JAInter11SequenceMgr@sda21(r13) - add r23, r0, r26 - stfs f29, 0xc(r23) - stfs f28, 0x18(r23) - stfs f29, 0x10(r23) - stfs f31, 0x14(r23) - stfs f31, 0x1c(r23) - stfs f29, 0x20(r23) - b lbl_800B0D74 - -lbl_800B0D3C: - lwz r3, 0x24(r23) - addi r21, r21, 1 - stfsx f29, r3, r24 - lwz r3, 0x30(r23) - stfsx f30, r3, r24 - lwz r3, 0x28(r23) - stfsx f29, r3, r24 - lwz r3, 0x2c(r23) - stfsx f31, r3, r24 - lwz r3, 0x34(r23) - stfsx f31, r3, r24 - lwz r3, 0x44(r23) - stwx r22, r3, r24 - addi r24, r24, 4 - -lbl_800B0D74: - bl getParamSeqTrackMax__18JAIGlobalParameterFv - cmplw r21, r3 - blt lbl_800B0D3C - addi r25, r25, 4 - addi r26, r26, 0x50 - addi r20, r20, 1 - -lbl_800B0D8C: - bl getParamSeqPlayTrackMax__18JAIGlobalParameterFv - cmplw r20, r3 - blt lbl_800B0D04 - psq_l f31, 120(r1), 0, qr0 - lfd f31, 0x70(r1) - psq_l f30, 104(r1), 0, qr0 - lfd f30, 0x60(r1) - psq_l f29, 88(r1), 0, qr0 - lfd f29, 0x50(r1) - psq_l f28, 72(r1), 0, qr0 - lfd f28, 0x40(r1) - lmw r20, 0x10(r1) - lwz r0, 0x84(r1) - mtlr r0 - addi r1, r1, 0x80 - blr - */ + for (u32 i = 0; i < JAIGlobalParameter::getParamSeqPlayTrackMax(); i++) { + FixSeqBufPointer[i] = nullptr; + seqTrackInfo[i].init(); + } } /** @@ -894,72 +613,40 @@ void checkReadSeq() */ void checkSeqWave() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - li r31, 0 - stw r30, 8(r1) - li r30, 0 - b lbl_800B1AF4 + for (u32 i = 0; i < JAIGlobalParameter::getParamSeqPlayTrackMax(); i++) { + JAISequence* seq = seqTrackInfo[i].getSequence(); + if (!seq) { + continue; + } -lbl_800B1A60: - lwz r3, seqTrackInfo__Q27JAInter11SequenceMgr@sda21(r13) - addi r0, r31, 0x48 - lwzx r3, r3, r0 - cmplwi r3, 0 - beq lbl_800B1AEC - addic. r5, r3, 0x48 - beq lbl_800B1AEC - lwz r4, 0x27c(r5) - addis r0, r4, 1 - cmplwi r0, 0xffff - beq lbl_800B1AEC - lwz r6, SceneSetFlag__Q27JAInter8BankWave@sda21(r13) - addis r0, r6, 1 - cmplwi r0, 0xffff - beq lbl_800B1AEC - cmplw r4, r6 - beq lbl_800B1AE4 - addis r0, r4, 0x100 - cmplwi r0, 0xff00 - beq lbl_800B1AE4 - rlwinm r3, r4, 0, 0, 0xf - rlwinm r0, r6, 0, 0, 0xf - cmplw r3, r0 - bne lbl_800B1AC8 - cmplwi r4, 0xffff - beq lbl_800B1AE4 + SeqParameter* param = &seq->mSeqParameter; + if (!param) { + continue; + } -lbl_800B1AC8: - clrlwi r3, r4, 0x10 - clrlwi r0, r6, 0x10 - cmplw r3, r0 - bne lbl_800B1AEC - addis r0, r4, 1 - cmplwi r0, 0 - bne lbl_800B1AEC + u32 flag = param->getSceneFlag(); + if (flag == 0xFFFFFFFF) { + continue; + } -lbl_800B1AE4: - li r0, -1 - stw r0, 0x27c(r5) + u32 sceneFlag = BankWave::SceneSetFlag; + if (sceneFlag == 0xFFFFFFFF) { + continue; + } -lbl_800B1AEC: - addi r31, r31, 0x50 - addi r30, r30, 1 + if (flag != sceneFlag && flag != 0xFF00FF00) { + if ((flag & 0xFFFF0000) != (sceneFlag & 0xFFFF0000) || flag != 0xFFFF) { + if ((flag & 0xFFFF) != (sceneFlag & 0xFFFF)) { + continue; + } + if (flag != 0xFFFF0000) { + continue; + } + } + } -lbl_800B1AF4: - bl getParamSeqPlayTrackMax__18JAIGlobalParameterFv - cmplw r30, r3 - blt lbl_800B1A60 - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + param->_27C = -1; + } } /** @@ -2281,105 +1968,37 @@ void JAISequence::setPan(f32 value, u32 moveTime, u8 type) { setSeqInterPan(type * @note Address: 0x800B2BE8 * @note Size: 0x130 */ -void stopSeq(JAISequence*) +void stopSeq(JAISequence* seq) { - /* - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - stw r31, 0x1c(r1) - stw r30, 0x18(r1) - stw r29, 0x14(r1) - stw r28, 0x10(r1) - mr r28, r3 - bl getSwBit__8JAISoundFv - clrlwi. r0, r3, 0x1f - beq lbl_800B2C80 - li r30, 0 - li r31, 0 - b lbl_800B2C74 + if (seq->getSwBit() & 0x1) { + for (u32 i = 0; i < JAIGlobalParameter::getParamSeqPlayTrackMax(); i++) { + JAISequence* playingSeq = seqTrackInfo[i].mSequence; + if (seq != playingSeq && playingSeq && !(playingSeq->getSwBit() & 0x2)) { + playingSeq->setVolume(1.0f, 10, SOUNDPARAM_Unk10); + } + } + } -lbl_800B2C20: - lwz r3, seqTrackInfo__Q27JAInter11SequenceMgr@sda21(r13) - addi r0, r31, 0x48 - lwzx r29, r3, r0 - cmplw r28, r29 - beq lbl_800B2C6C - cmplwi r29, 0 - beq lbl_800B2C6C - mr r3, r29 - bl getSwBit__8JAISoundFv - rlwinm. r0, r3, 0, 0x1e, 0x1e - bne lbl_800B2C6C - mr r3, r29 - lfs f1, lbl_80516FA0@sda21(r2) - lwz r12, 0x10(r29) - li r4, 0xa - li r5, 0xa - lwz r12, 0x1c(r12) - mtctr r12 - bctrl + seq->mMainSoundPPointer = nullptr; + seq->mSeqParameter.mUpdateData = nullptr; + if (seq->mState >= SOUNDSTATE_Ready) { + if (customHeapCallback) { + customHeapCallback(2, seq->mSoundInfo->mOffsetNo, seq); + } else { + HeapMgr::releaseAutoHeapPointer(seq->mSeqParameter._278); + } + } -lbl_800B2C6C: - addi r31, r31, 0x50 - addi r30, r30, 1 - -lbl_800B2C74: - bl getParamSeqPlayTrackMax__18JAIGlobalParameterFv - cmplw r30, r3 - blt lbl_800B2C20 - -lbl_800B2C80: - li r0, 0 - stw r0, 0x40(r28) - stw r0, 0x308(r28) - lbz r0, 0x15(r28) - cmplwi r0, 3 - blt lbl_800B2CCC - lwz r12, customHeapCallback__Q27JAInter11SequenceMgr@sda21(r13) - cmplwi r12, 0 - beq lbl_800B2CC4 - lwz r4, 0x44(r28) - mr r6, r28 - addi r3, r1, 8 - lhz r5, 6(r4) - li r4, 2 - mtctr r12 - bctrl - b lbl_800B2CCC - -lbl_800B2CC4: - lbz r3, 0x2c0(r28) - bl releaseAutoHeapPointer__Q27JAInter7HeapMgrFUc - -lbl_800B2CCC: - li r0, 0 - mr r4, r28 - stb r0, 0x15(r28) - addi r3, r13, seqControl__Q27JAInter11SequenceMgr@sda21 - bl releaseSound__Q27JAInter9LinkSoundFP8JAISound - lbz r0, 0x14(r28) - li r4, 0 - lwz r3, seqTrackInfo__Q27JAInter11SequenceMgr@sda21(r13) - mulli r0, r0, 0x50 - add r3, r3, r0 - stw r4, 0x48(r3) - lwz r31, 0x1c(r1) - lwz r30, 0x18(r1) - lwz r29, 0x14(r1) - lwz r28, 0x10(r1) - lwz r0, 0x24(r1) - mtlr r0 - addi r1, r1, 0x20 - blr - */ + seq->mState = SOUNDSTATE_Inactive; + seqControl.releaseSound(seq); + seqTrackInfo[seq->_14].mSequence = nullptr; } /** * @note Address: 0x800B2D18 * @note Size: 0xE4 */ -void checkDvdLoadArc(u32, u32) +void checkDvdLoadArc(u32 p1, u32 p2) { /* stwu r1, -0x20(r1) diff --git a/src/plugProjectKonoU/khWorldMap.cpp b/src/plugProjectKonoU/khWorldMap.cpp index 02c0a41b8..e6105d104 100644 --- a/src/plugProjectKonoU/khWorldMap.cpp +++ b/src/plugProjectKonoU/khWorldMap.cpp @@ -4193,7 +4193,7 @@ void WorldMap::changeInfo() u64 tags2[4] = { '8396_01', '8398_01', '8401_01', '8410_01' }; // "Hole of Beasts" "White Flower Garden" "Bulblax Kingdom" "Snagret Hole" u64 tags3[4] = { '8397_01', '8402_01', '8403_01', - '8411_01' }; // "Citadel of Spiders" "Glutton's Kitchen" "Shower Room" "Submerged Castle" + '8411_01' }; // "Citadel of Spiders" "Glutton's Kitchen" "Shower Room" "Submerged Castle" u64 tags4[4] = { '8412_01', '8413_01', '8414_01', 'no_data' }; // "Cavern of Chaos" "Hole of Heroes" "Dream Den" u64* caveTags[4] = { tags1, tags2, tags3, tags4 };