From 5d4f161d4338f754c6d00956ddf504caa9a5c226 Mon Sep 17 00:00:00 2001 From: Pheenoh Date: Thu, 29 Dec 2022 17:30:35 -0700 Subject: f_op_msg_mng 19/20 matched (#227) --- include/d/com/d_com_inf_game.h | 10 ++++++++++ include/d/msg/d_msg_object.h | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/d/com/d_com_inf_game.h b/include/d/com/d_com_inf_game.h index c38edee974..93c1363063 100644 --- a/include/d/com/d_com_inf_game.h +++ b/include/d/com/d_com_inf_game.h @@ -287,6 +287,8 @@ public: s16 getItemMaxLifeCount() { return mItemMaxLifeCount; } f32 getItemLifeCount() { return mItemLifeCount; } s16 getItemMaxArrowNumCount() { return mItemMaxArrowNumCount; } + void clearNowAnimeID() { mNowAnimeID = -1; } + void clearMesgCamInfoID() { mMesgCamInfo = (void*)-1; } void clearItemMaxLifeCount() { mItemMaxLifeCount = 0; } void clearItemLifeCount() { mItemLifeCount = 0.0f; @@ -2568,6 +2570,14 @@ inline int dComIfG_setTimerNowTimeMs(int time) { g_dComIfG_gameInfo.play.setTimerNowTimeMs(time); } +inline void dComIfGp_clearMesgAnimeTagInfo() { + g_dComIfG_gameInfo.play.clearNowAnimeID(); +} + +inline void dComIfGp_clearMesgCameraTagInfo() { + g_dComIfG_gameInfo.play.clearMesgCamInfoID(); +} + inline u32 dComIfGp_particle_set(u32 param_0, u16 param_1, const cXyz* param_2, const dKy_tevstr_c* param_3, const csXyz* param_4, const cXyz* param_5, u8 param_6, dPa_levelEcallBack* param_7, diff --git a/include/d/msg/d_msg_object.h b/include/d/msg/d_msg_object.h index fedaa1cef2..45fe778606 100644 --- a/include/d/msg/d_msg_object.h +++ b/include/d/msg/d_msg_object.h @@ -93,7 +93,7 @@ public: /* 80237994 */ static void onKillMessageFlag(); /* 802379AC */ static void setKillMessageFlag(); /* 802379D8 */ void setKillMessageFlagLocal(); - /* 80237A74 */ void setTalkPartner(fopAc_ac_c*); + /* 80237A74 */ static void setTalkPartner(fopAc_ac_c*); /* 80237A88 */ void setNowTalkFlowNo(s16); /* 80237A9C */ void getNowTalkFlowNo(); /* 80237AB0 */ void setDemoMessage(u32); @@ -460,7 +460,7 @@ public: /* 0x2EC */ f32 mPikariAnmSpeed; /* 0x2F0 */ u16 mPikariHaloDelay_spirit; /* 0x2F2 */ u8 mStageTitleDisplayType; - /* 0x2F4 */ u16 mMsgIndex; + /* 0x2F4 */ s16 mMsgIndex; /* 0x2F6 */ u16 mFlowIndex; /* 0x2F8 */ u16 mSaveSeqMsgIndex; /* 0x2FA */ u16 mSelWeightFrame; -- cgit v1.2.3 From 463348bfc7f2360d9bb0a6205b8aa4602c8c03d0 Mon Sep 17 00:00:00 2001 From: jdflyer Date: Fri, 30 Dec 2022 16:19:57 -0700 Subject: JAudio2 Work (#228) --- include/JSystem/JAudio2/JAIAudible.h | 3 +- include/JSystem/JAudio2/JAIAudience.h | 4 +- include/JSystem/JAudio2/JAISound.h | 126 ++++++++++++++++++++++++++---- include/JSystem/JAudio2/JAISoundHandles.h | 2 +- include/JSystem/JAudio2/JAISoundParams.h | 6 +- include/JSystem/JAudio2/JASAudioReseter.h | 9 ++- include/JSystem/JAudio2/JASAudioThread.h | 12 +++ include/JSystem/JAudio2/JASGadget.h | 14 +++- include/JSystem/JAudio2/JASReport.h | 2 + include/JSystem/JAudio2/dspproc.h | 1 + include/Z2AudioLib/Z2Audience.h | 4 +- include/Z2AudioLib/Z2WolfHowlMgr.h | 45 ++++------- include/dolphin/dsp/dsp.h | 6 ++ include/m_Do/m_Do_audio.h | 12 +-- 14 files changed, 177 insertions(+), 69 deletions(-) (limited to 'include') diff --git a/include/JSystem/JAudio2/JAIAudible.h b/include/JSystem/JAudio2/JAIAudible.h index d42029bec9..047b913295 100644 --- a/include/JSystem/JAudio2/JAIAudible.h +++ b/include/JSystem/JAudio2/JAIAudible.h @@ -2,10 +2,11 @@ #define JAIAUDIBLE_H #include "dolphin/types.h" +#include "JSystem/JAudio2/JASSoundParams.h" struct JAIAudible { virtual ~JAIAudible(); - virtual void getOuterParams(int) = 0; + virtual JASSoundParams* getOuterParams(int) = 0; virtual void calc() = 0; }; diff --git a/include/JSystem/JAudio2/JAIAudience.h b/include/JSystem/JAudio2/JAIAudience.h index 2f2586bf2d..1621386ad8 100644 --- a/include/JSystem/JAudio2/JAIAudience.h +++ b/include/JSystem/JAudio2/JAIAudience.h @@ -13,9 +13,9 @@ struct JAIAudience { virtual ~JAIAudience(); virtual JAIAudible* newAudible(JGeometry::TVec3 const&, JAISoundID, JGeometry::TVec3 const*, u32) = 0; - virtual void getMaxChannels() = 0; + virtual int getMaxChannels() = 0; virtual void deleteAudible(JAIAudible*) = 0; - virtual void calcPriority(JAIAudible*) = 0; + virtual u32 calcPriority(JAIAudible*) = 0; virtual void mixChannelOut(JASSoundParams const&, JAIAudible*, int) = 0; }; diff --git a/include/JSystem/JAudio2/JAISound.h b/include/JSystem/JAudio2/JAISound.h index 61bac44a42..f027ab22cd 100644 --- a/include/JSystem/JAudio2/JAISound.h +++ b/include/JSystem/JAudio2/JAISound.h @@ -11,11 +11,11 @@ class JAISoundID { public: operator u32() const { return this->mId; } - void operator=(JAISoundID const&); + void operator=(JAISoundID const& other) {mId = other.mId;}; JAISoundID(u32 pId) { mId = pId; }; - JAISoundID(JAISoundID const& other); + JAISoundID(JAISoundID const& other) {mId = other.mId;}; JAISoundID() {} @@ -29,6 +29,13 @@ struct JASTrack { /* 80291C30 */ void openChild(u32); /* 80292918 */ void writePort(u32, u16); /* 8029297C */ void readPort(u32); + + inline int getChannelMgrCount() { + return channelMgrCount; + } + + /* 0x0 */u8 field_0x0[0x1d0]; + /* 0x1d0 */ int channelMgrCount; }; struct JAISoundStatus_ { @@ -36,26 +43,92 @@ struct JAISoundStatus_ { /* 802A2244 */ s32 unlockIfLocked(); void init() { - field_0x0 = 0; - field_0x1 = 0; - *((u16*)(this) + 2) = 0; + field_0x0.value = 0; + field_0x1.value = 0; + *((u16*)&state) = 0; user_data = 0; } - /* 0x0 */ u8 field_0x0; - /* 0x1 */ u8 field_0x1; - /* 0x2 */ u8 state[2]; // debug accesses like "state.flags.calcedOnce" + bool isAlive(); //used in assert + + inline bool isPlaying() { + return state.unk==5; + } + + inline bool isPaused() { + return field_0x0.flags.paused; + } + + /* 0x0 */ union { + u8 value; + struct{ + u8 flag1:1; + u8 paused:1; + u8 flag3:1; + u8 flag4:1; + u8 flag5:1; + u8 flag6:1; + u8 flag7:1; + u8 flag8:1; + }flags; + }field_0x0; + /* 0x1 */ union { + u8 value; + struct{ + u8 flag1:1; + u8 flag2:1; + u8 flag3:1; + u8 flag4:1; + u8 flag5:1; + u8 flag6:1; + u8 flag7:1; + u8 flag8:1; + }flags; + }field_0x1; + /* 0x2 */ struct { + u8 unk; + struct { + u8 flag1:1; + u8 flag2:1; + u8 flag3:1; + u8 flag4:1; + u8 flag5:1; + u8 flag6:1; + u8 flag7:1; + u8 flag8:1; + }flags; + } state; /* 0x4 */ u32 user_data; }; // Size: 0x6 struct JAISoundFader { void forceIn() { mIntensity = 1.0f; - field_0x4.zero(); + mTransition.zero(); + } + void forceOut() { + mIntensity = 0.0f; + mTransition.zero(); + } + void fadeOut(u32 fadeCount) { + if (fadeCount!=0) { + mTransition.set(0.0f,mIntensity,fadeCount); + }else{ + forceOut(); + } + } + bool isOut() { + if(mTransition.mCount != 0 || mIntensity < 0.01f) { + return true; + } + return false; + } + inline void calc() { + mIntensity = mTransition.apply(mIntensity); } /* 0x00 */ f32 mIntensity; - /* 0x04 */ JAISoundParamsTransition::TTransition field_0x4; + /* 0x04 */ JAISoundParamsTransition::TTransition mTransition; }; // Size: 0x10 template @@ -88,29 +161,50 @@ public: JAIAudience*); /* 802A2598 */ void stop(); /* 802A24DC */ void stop(u32 fadeout); - /* 802A25D8 */ bool asSe(); - /* 802A25E0 */ bool asSeq(); - /* 802A25E8 */ bool asStream(); /* 802A25F0 */ void die_JAISound_(); /* 802A266C */ void increasePrepareCount_JAISound_(); - /* 802A26B8 */ void calc_JAISound_(); + /* 802A26B8 */ bool calc_JAISound_(); /* 802A29DC */ void initTrack_JAISound_(JASTrack*); virtual void getNumChild() = 0; + virtual void getChild() = 0; + virtual void releaseChild() = 0; + /* 802A25D8 */ virtual bool asSe(); + /* 802A25E0 */ virtual bool asSeq(); + /* 802A25E8 */ virtual bool asStream(); + virtual void getTrack() = 0; + virtual void getChildTrack() = 0; + virtual void getTempoMgr() = 0; + virtual bool JAISound_tryDie_() = 0; JAISoundID getID() const; u32 getUserData() const { return status_.user_data; } bool isHandleAttached() const { return handle_ != NULL; } + void removeLifeTime_() { + status_.field_0x1.flags.flag1 = false; + } + void stop_JAISound_() { + status_.state.flags.flag5 = 0; + status_.state.flags.flag1 = 1; + } + bool isStopping() { + bool isStopping = false; + if(status_.state.flags.flag1) { + isStopping = status_.state.flags.flag5 ? fader.isOut() : true; + } + return isStopping; + } + /* 0x04 */ JAISoundHandle* handle_; /* 0x08 */ JAIAudible* audible_; /* 0x0C */ JAIAudience* audience_; - /* 0x10 */ s32 lifeTime; + /* 0x10 */ u32 lifeTime; /* 0x14 */ s32 prepareCount; /* 0x18 */ JAISoundID soundID; /* 0x1C */ JAISoundStatus_ status_; /* 0x24 */ JAISoundFader fader; - /* 0x34 */ s32 field_0x34; + /* 0x34 */ s32 mPriority; /* 0x38 */ s32 mCount; /* 0x3C */ JAISoundParams params; }; // Size: 0x98 diff --git a/include/JSystem/JAudio2/JAISoundHandles.h b/include/JSystem/JAudio2/JAISoundHandles.h index 850358facd..d79baaa2dc 100644 --- a/include/JSystem/JAudio2/JAISoundHandles.h +++ b/include/JSystem/JAudio2/JAISoundHandles.h @@ -10,7 +10,7 @@ class JAISoundID; class JAISoundHandle { public: - JAISoundHandle(); + JAISoundHandle() {sound_ = NULL;}; ~JAISoundHandle() {} bool isSoundAttached() const { return sound_ != NULL; } diff --git a/include/JSystem/JAudio2/JAISoundParams.h b/include/JSystem/JAudio2/JAISoundParams.h index 6984c0a912..f9befe83e0 100644 --- a/include/JSystem/JAudio2/JAISoundParams.h +++ b/include/JSystem/JAudio2/JAISoundParams.h @@ -24,9 +24,9 @@ struct JAISoundParamsTransition { field_0x4 = 0.0f; } - void set(f32 newValue, f32 param_1, u32 param_2) { - mCount = param_2; - field_0x0 = (newValue - param_1) / mCount; + void set(f32 newValue, f32 intensity, u32 fadeCount) { + mCount = fadeCount; + field_0x0 = (newValue - intensity) / mCount; field_0x4 = newValue; } diff --git a/include/JSystem/JAudio2/JASAudioReseter.h b/include/JSystem/JAudio2/JASAudioReseter.h index 25e6af4a33..66d466f3f5 100644 --- a/include/JSystem/JAudio2/JASAudioReseter.h +++ b/include/JSystem/JAudio2/JASAudioReseter.h @@ -3,6 +3,13 @@ #include "JSystem/JAudio2/JASDriverIF.h" #include "dolphin/types.h" +#include "dolphin/os/OS.h" + +struct JASCriticalSection { + inline JASCriticalSection() {mInterruptState = OSDisableInterrupts();}; + inline ~JASCriticalSection() {OSRestoreInterrupts(mInterruptState);}; + u32 mInterruptState; +}; struct JASAudioReseter { /* 8029D0B4 */ JASAudioReseter(); @@ -10,7 +17,7 @@ struct JASAudioReseter { /* 8029D138 */ bool start(u32, bool); /* 8029D1D4 */ void resume(); /* 8029D1F8 */ s32 checkDone() const; - /* 8029D200 */ static s32 calc(); + /* 8029D200 */ s32 calc(); /* 8029D2D4 */ static s32 callback(void*); /* 0x0 */ u32 field_0x0; diff --git a/include/JSystem/JAudio2/JASAudioThread.h b/include/JSystem/JAudio2/JASAudioThread.h index 2ed9d02f54..e8da1c883b 100644 --- a/include/JSystem/JAudio2/JASAudioThread.h +++ b/include/JSystem/JAudio2/JASAudioThread.h @@ -3,4 +3,16 @@ #include "dolphin/types.h" +struct JASAudioThread { + /* 8029CCDC */ JASAudioThread(int, int, u32); + /* 8029CD4C */ void create(s32); + /* 8029CDC0 */ void stop(); + /* 8029CDEC */ void run(); + /* 8029CF68 */ void DMACallback(); + /* 8029CFBC */ void DSPCallback(void*); + /* 8029D028 */ ~JASAudioThread(); + + static u8 snIntCount[4 + 4 /* padding */]; +}; + #endif /* JASAUDIOTHREAD_H */ diff --git a/include/JSystem/JAudio2/JASGadget.h b/include/JSystem/JAudio2/JASGadget.h index 6edcf6961a..9af40931c4 100644 --- a/include/JSystem/JAudio2/JASGadget.h +++ b/include/JSystem/JAudio2/JASGadget.h @@ -6,9 +6,19 @@ template class JASGlobalInstance { public: - // T* getInstance() { return sInstance; } + inline T* getInstance() { return sInstance; } - // static T* sInstance; + inline JASGlobalInstance(bool param) { + if (param) { + ASSERT(sInstance == 0); + //if (this!=NULL) { + sInstance = (T*)this; + //We need a better way to compute the location of sInstance + //sInstance = (T*)((char*)this-(char*)&(((T*)NULL)->JASGlobalInstance)); + //} + } + } + static T* sInstance; }; #endif /* JASGADGET_H */ diff --git a/include/JSystem/JAudio2/JASReport.h b/include/JSystem/JAudio2/JASReport.h index 6f0c1a0fae..86b0944e83 100644 --- a/include/JSystem/JAudio2/JASReport.h +++ b/include/JSystem/JAudio2/JASReport.h @@ -3,4 +3,6 @@ #include "dolphin/types.h" +void JASReport(const char* message, ...); + #endif /* JASREPORT_H */ diff --git a/include/JSystem/JAudio2/dspproc.h b/include/JSystem/JAudio2/dspproc.h index e624638ec3..5f1c530495 100644 --- a/include/JSystem/JAudio2/dspproc.h +++ b/include/JSystem/JAudio2/dspproc.h @@ -2,5 +2,6 @@ #define DSPPROC_H #include "dolphin/types.h" +#include "dolphin/dsp/dsp.h" #endif /* DSPPROC_H */ diff --git a/include/Z2AudioLib/Z2Audience.h b/include/Z2AudioLib/Z2Audience.h index d3ea344af8..a3af8c114d 100644 --- a/include/Z2AudioLib/Z2Audience.h +++ b/include/Z2AudioLib/Z2Audience.h @@ -121,9 +121,9 @@ struct Z2Audience : public JAIAudience { /* 802BD1FC */ virtual ~Z2Audience(); /* 802BD338 */ virtual JAIAudible* newAudible(JGeometry::TVec3 const&, JAISoundID, JGeometry::TVec3 const*, u32); - /* 802BDED4 */ virtual void getMaxChannels(); + /* 802BDED4 */ virtual int getMaxChannels(); /* 802BD4D4 */ virtual void deleteAudible(JAIAudible*); - /* 802BD5B8 */ virtual void calcPriority(JAIAudible*); + /* 802BD5B8 */ virtual u32 calcPriority(JAIAudible*); /* 802BD71C */ virtual void mixChannelOut(JASSoundParams const&, JAIAudible*, int); /* 0x004 */ f32 field_0x4; diff --git a/include/Z2AudioLib/Z2WolfHowlMgr.h b/include/Z2AudioLib/Z2WolfHowlMgr.h index ba41b0539e..224aa60485 100644 --- a/include/Z2AudioLib/Z2WolfHowlMgr.h +++ b/include/Z2AudioLib/Z2WolfHowlMgr.h @@ -1,8 +1,9 @@ #ifndef Z2WOLFHOWLMGR_H #define Z2WOLFHOWLMGR_H -#include "Z2AudioLib/Z2SoundObject.h" #include "dolphin/types.h" +#include "Z2AudioLib/Z2SoundObject.h" +#include "JSystem/JAudio2/JASGadget.h" /* * Z2WolfHowlData @@ -17,7 +18,7 @@ struct Z2WolfHowlData { u16* mSongData; }; -class Z2WolfHowlMgr { +class Z2WolfHowlMgr : public JASGlobalInstance { public: Z2WolfHowlMgr(); @@ -36,10 +37,11 @@ public: void startGuideMelody(bool); void skipCorrectDemo(); + private: - /* 0x00 */ JAISoundHandle* field_0x00; - /* 0x04 */ JAISoundHandle* field_0x04; - /* 0x08 */ JAISoundHandle* field_0x08; + /* 0x00 */ JAISoundHandle field_0x00; + /* 0x04 */ JAISoundHandle field_0x04; + /* 0x08 */ JAISoundHandle field_0x08; /* 0x0C */ Z2WolfHowlData* mpCurSong; /* 0x10 */ Z2WolfHowlData** mpSongList; /* 0x14 */ f32 mNowInputValue; @@ -51,37 +53,18 @@ private: /* 0x2C */ u8 field_0x2c[4]; /* 0x30 */ f32 field_0x30; /* 0x34 */ f32 field_0x34; - /* 0x38 */ f32 field_0x38; - /* 0x3C */ f32 field_0x3c; - /* 0x40 */ f32 field_0x40; - /* 0x44 */ f32 field_0x44; - /* 0x48 */ f32 field_0x48; - /* 0x4C */ f32 field_0x4c; - /* 0x50 */ f32 field_0x50; - /* 0x54 */ f32 field_0x54; - /* 0x58 */ f32 field_0x58; - /* 0x5C */ f32 field_0x5c; - /* 0x60 */ f32 field_0x60; - /* 0x64 */ f32 field_0x64; - /* 0x68 */ f32 field_0x68; - /* 0x6C */ f32 field_0x6c; - /* 0x70 */ f32 field_0x70; - /* 0x74 */ f32 field_0x74; - /* 0x78 */ f32 field_0x78; - /* 0x7C */ f32 field_0x7c; - /* 0x80 */ f32 field_0x80; - /* 0x84 */ f32 field_0x84; + /* 0x38 */ f32 field_0x38[10]; + /* 0x60 */ f32 field_0x60[10]; /* 0x88 */ void* mTimer; /* 0x8C */ u8 mReleaseTimer; /* 0x8D */ u8 field_0x8d; - /* 0x8E */ u8 mCorrectCurveID; + /* 0x8E */ s8 mCorrectCurveID; /* 0x8F */ u8 field_0x8f; /* 0x90 */ s16 field_0x90; - /* 0x92 */ u8 field_0x92[20]; - /* 0xA6 */ u8 field_0xa6[0x14]; - /* 0xBA */ u8 field_0xba; - /* 0xBB */ u8 field_0xbb; - /* 0xBC */ u8 field_0xbc; + /* 0x92 */ u16 field_0x92[20]; + /* 0xBA */ s8 field_0xba; + /* 0xBB */ s8 field_0xbb; + /* 0xBC */ s8 field_0xbc; }; #endif /* Z2WOLFHOWLMGR_H */ diff --git a/include/dolphin/dsp/dsp.h b/include/dolphin/dsp/dsp.h index f7cb94b291..65c0061489 100644 --- a/include/dolphin/dsp/dsp.h +++ b/include/dolphin/dsp/dsp.h @@ -3,4 +3,10 @@ #include "dolphin/types.h" +void DSPReleaseHalt2(u32 msg); +u16 DSP_CreateMap2(u32 msg); +void DSPSendCommands2(u32* msgs, u32 param_1, void (*param_2)(u16)); +void DsetupTable(u32 param_0, u32 param_1, u32 param_2, u32 param_3, u32 param_4); +void DsetMixerLevel(f32 level); + #endif /* DSP_H */ diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h index 3cc4b62160..898f834489 100644 --- a/include/m_Do/m_Do_audio.h +++ b/include/m_Do/m_Do_audio.h @@ -1,18 +1,10 @@ #ifndef M_DO_M_DO_AUDIO_H #define M_DO_M_DO_AUDIO_H +#include "dolphin/types.h" +#include "JSystem/JAudio2/JASGadget.h" #include "Z2AudioLib/Z2AudioMgr.h" #include "Z2AudioLib/Z2EnvSeMgr.h" -#include "dolphin/types.h" - -// move/fix later -template -class JASGlobalInstance { -public: - T* getInstance() { return sInstance; }; - - static T* sInstance; -}; class mDoAud_zelAudio_c { public: -- cgit v1.2.3