JAudio2 and Z2AudioLib work (#2223)

* JAudio2 and Z2AudioLib work

* check1stDynamicWave matched
This commit is contained in:
Caroline Madsen
2024-10-23 19:25:13 -04:00
committed by GitHub
parent 1289892a26
commit 9401af27b3
94 changed files with 3803 additions and 7254 deletions
+1 -1
View File
@@ -226,7 +226,7 @@ struct Z2Audience : public JAIAudience, public JASGlobalInstance<Z2Audience> {
/* 0x134 */ Z2AudioCamera mAudioCamera[1];
/* 0x1A8 */ Z2SpotMic mSpotMic[1];
/* 0x1D0 */ Z2SpotMic* mLinkMic;
/* 0x1D4 */ s32 mNumPlayers;
/* 0x1D4 */ s32 mMaxChannels;
/* 0x1D8 */ u8 field_0x1d8[4];
/* 0x1DC */ bool mUsingOffMicVol;
}; // Size: 0x1E0
+18 -3
View File
@@ -8,7 +8,22 @@ class JKRHeap;
struct Z2FxLineEditNode {};
struct Z2FxLineConfig {};
struct Z2FxLineConfig {
/* 0x00 */ u8 field_0x0;
/* 0x01 */ u8 field_0x1;
/* 0x02 */ u8 field_0x2;
/* 0x03 */ u8 field_0x3;
/* 0x04 */ s16 field_0x4;
/* 0x06 */ s16 field_0x6;
/* 0x08 */ s16 field_0x8[8];
/* 0x18 */ u8 field_0x18;
/* 0x19 */ u8 field_0x19;
/* 0x1A */ u8 field_0x1a;
/* 0x1B */ u8 field_0x1b;
/* 0x1C */ s16 field_0x1c;
/* 0x1E */ s16 field_0x1e;
/* 0x20 */ s16 field_0x20[8];
}; // Size: 0x30
struct Z2FxLineMgr : public JASGlobalInstance<Z2FxLineMgr> {
/* 802BA7DC */ Z2FxLineMgr();
@@ -19,10 +34,10 @@ struct Z2FxLineMgr : public JASGlobalInstance<Z2FxLineMgr> {
/* 802BAE48 */ void setUnderWaterFx(bool);
/* 802BAEB8 */ void setSceneFx(s32);
/* 0x00 */ int field_0x0;
/* 0x00 */ Z2FxLineConfig* mConfig;
/* 0x04 */ void* mFxLineBuffer[4];
/* 0x14 */ s8 mLineID;
/* 0x15 */ s8 mFxDataNum;
/* 0x15 */ u8 mFxDataNum;
/* 0x16 */ bool mSetUnderWaterFx;
/* 0x18 */ Z2FxLineEditNode* mHIOEdit;
}; // Size: 0x1C
+105 -19
View File
@@ -24,11 +24,11 @@ public:
void sceneBgmStart();
void loadStaticWaves();
BOOL checkFirstWaves();
void eraseSeWave(u32);
void eraseBgmWave(u32);
void getWaveLoadStatus(u32, u32);
void loadSeWave(u32);
void loadBgmWave(u32);
bool eraseSeWave(u32);
bool eraseBgmWave(u32);
s32 getWaveLoadStatus(u32, u32);
bool loadSeWave(u32);
bool loadBgmWave(u32);
bool isSceneExist() const { return sceneExist; }
int getCurrentSceneNum() const { return sceneNum; }
@@ -38,27 +38,29 @@ public:
bool isInDarkness() const { return inDarkness; }
s8 getRoomReverb() const { return dComIfGp_getReverb(roomNum); }
bool isMovieDemo() { return sceneNum == 2 || sceneNum == 8 || sceneNum == 9; }
s32 getSeLoadStatus(u32 wave) { return getWaveLoadStatus(wave, 0); }
s32 getBgmLoadStatus(u32 wave) { return getWaveLoadStatus(wave, 1); }
private:
/* 0x00 */ long BGM_ID;
/* 0x00 */ JAISoundID BGM_ID;
/* 0x04 */ int sceneNum;
/* 0x08 */ int timer;
/* 0x0C */ s8 roomNum;
/* 0x0D */ u8 SeWave_1;
/* 0x0E */ u8 SeWaveToErase_1;
/* 0x0F */ u8 SeWave_2;
/* 0x10 */ u8 SeWaveToErase_2;
/* 0x11 */ u8 BgmWave_1;
/* 0x12 */ u8 BgmWaveToErase_1;
/* 0x13 */ u8 BgmWave_2;
/* 0x14 */ u8 BgmWaveToErase_2;
/* 0x15 */ u8 SeWave_3;
/* 0x16 */ u8 SeWaveToErase_3;
/* 0x17 */ u8 field_0x17;
/* 0x0D */ u8 requestSeWave_1;
/* 0x0E */ u8 loadedSeWave_1;
/* 0x0F */ u8 requestSeWave_2;
/* 0x10 */ u8 loadedSeWave_2;
/* 0x11 */ u8 requestBgmWave_1;
/* 0x12 */ u8 loadedBgmWave_1;
/* 0x13 */ u8 requestBgmWave_2;
/* 0x14 */ u8 loadedBgmWave_2;
/* 0x15 */ u8 requestDemoWave;
/* 0x16 */ u8 loadedDemoWave;
/* 0x17 */ s8 load1stWait;
/* 0x18 */ u8 field_0x18;
/* 0x19 */ u8 field_0x19;
/* 0x1A */ u8 field_0x1a;
/* 0x1B */ u8 field_0x1b;
/* 0x1A */ bool field_0x1a;
/* 0x1B */ bool field_0x1b;
/* 0x1C */ bool inGame;
/* 0x1D */ bool sceneExist;
/* 0x1E */ bool inDarkness;
@@ -68,4 +70,88 @@ inline Z2SceneMgr* Z2GetSceneMgr() {
return JASGlobalInstance<Z2SceneMgr>::getInstance();
}
enum Spot { // aka scene
/* 0x00 */ SPOT_ORDON_RANCH,
/* 0x01 */ SPOT_ORDON_VILLAGE,
/* 0x02 */ SPOT_ORDON_INTERIOR,
/* 0x03 */ SPOT_ORDON_SPRING,
/* 0x04 */ SPOT_TWILIGHT_HYRULE_CASTLE,
/* 0x05 */ SPOT_FARON_WOODS,
/* 0x06 */ SPOT_CORO_SHOP,
/* 0x07 */ SPOT_SACRED_GROVE,
/* 0x08 */ SPOT_KAKARIKO_VILLAGE,
/* 0x09 */ SPOT_KAKARIKO_INTERIOR,
/* 0x0A */ SPOT_SANCTUARY_BASEMENT,
/* 0x0B */ SPOT_DEATH_MOUNTAIN,
/* 0x0C */ SPOT_SUMO_HALL,
/* 0x0D */ SPOT_KAKARIKO_GRAVEYARD,
/* 0x0E */ SPOT_HIDDEN_VILLAGE,
/* 0x0F */ SPOT_IMPAZ_HOUSE,
/* 0x10 */ SPOT_LAKE_HYLIA,
/* 0x11 */ SPOT_ZORAS_RIVER,
/* 0x12 */ SPOT_UPPER_ZORAS_RIVER,
/* 0x13 */ SPOT_FISHING_POND,
/* 0x14 */ SPOT_HENA_CABIN,
/* 0x15 */ SPOT_ZORAS_DOMAIN,
/* 0x16 */ SPOT_CASTLE_TOWN,
/* 0x17 */ SPOT_CASTLE_TOWN_INTERIOR,
/* 0x18 */ SPOT_CASTLE_TOWN_SHOPS,
/* 0x19 */ SPOT_STAR_TENT,
/* 0x1A */ SPOT_SNOWPEAK,
/* 0x1B */ SPOT_ARBITERS_GROUNDS_EXTERIOR,
/* 0x1C */ SPOT_GERUDO_DESERT,
/* 0x1D */ SPOT_MIRROR_CHAMBER,
/* 0x1E */ SPOT_HYRULE_FIELD,
/* 0x1F */ SPOT_CASTLE_TOWN_GATES,
/* 0x20 */ SPOT_HYLIA_BRIDGE_BATTLE,
/* 0x21 */ SPOT_SHADES_REALM,
/* 0x22 */ SPOT_ELDIN_BRIDGE_BATTLE,
/* 0x23 */ SPOT_NONE,
/* 0x24 */ SPOT_LIGHT_SPIRIT_CHAMBER,
/* 0x25 */ SPOT_CASTLE_THRONE_ROOM,
/* 0x26 */ SPOT_ENEMY_TEST,
/* 0x27 */ SPOT_FORTRESS,
/* 0x28 */ SPOT_FOREST_TEMPLE,
/* 0x29 */ SPOT_FOREST_TEMPLE_MINIBOSS,
/* 0x2A */ SPOT_FOREST_TEMPLE_BOSS,
/* 0x2B */ SPOT_GORON_MINES,
/* 0x2C */ SPOT_GORON_MINES_MINIBOSS,
/* 0x2D */ SPOT_GORON_MINES_BOSS,
/* 0x2E */ SPOT_LAKEBED_TEMPLE,
/* 0x2F */ SPOT_LAKEBED_TEMPLE_MINIBOSS,
/* 0x30 */ SPOT_LAKEBED_TEMPLE_BOSS,
/* 0x31 */ SPOT_ARBITERS_GROUNDS,
/* 0x32 */ SPOT_ARBITERS_GROUNDS_MINIBOSS,
/* 0x33 */ SPOT_ARBITERS_GROUNDS_BOSS,
/* 0x34 */ SPOT_SNOWPEAK_RUINS,
/* 0x35 */ SPOT_SNOWPEAK_RUINS_MINIBOSS,
/* 0x36 */ SPOT_SNOWPEAK_RUINS_BOSS,
/* 0x37 */ SPOT_TEMPLE_OF_TIME,
/* 0x38 */ SPOT_TEMPLE_OF_TIME_MINIBOSS,
/* 0x39 */ SPOT_TEMPLE_OF_TIME_BOSS,
/* 0x3A */ SPOT_CITY_IN_THE_SKY,
/* 0x3B */ SPOT_CITY_IN_THE_SKY_MINIBOSS,
/* 0x3C */ SPOT_CITY_IN_THE_SKY_BOSS,
/* 0x3D */ SPOT_PALACE_OF_TWILIGHT,
/* 0x3E */ SPOT_PALACE_OF_TWILIGHT_MINIBOSS_A,
/* 0x3F */ SPOT_PALACE_OF_TWILIGHT_MINIBOSS_B,
/* 0x40 */ SPOT_PALACE_OF_TWILIGHT_THRONE_ROOM,
/* 0x41 */ SPOT_PALACE_OF_TWILIGHT_BOSS,
/* 0x42 */ SPOT_HYRULE_CASTLE,
/* 0x43 */ SPOT_FINAL_BATTLE_THRONE_ROOM,
/* 0x44 */ SPOT_FINAL_BATTLE_FIELD,
/* 0x45 */ SPOT_FINAL_BATTLE_CUTSCENE,
/* 0x46 */ SPOT_ICE_BLOCK_PUZZLE,
/* 0x47 */ SPOT_CAVE_OF_ORDEALS,
/* 0x48 */ SPOT_GORGE_LANTERN_CAVE,
/* 0x49 */ SPOT_LAKE_LANTERN_CAVE,
/* 0x4A */ SPOT_ELDIN_MAGNET_CAVE,
/* 0x4B */ SPOT_GROTTO_GRASS_1,
/* 0x4C */ SPOT_GROTTO_GRASS_2,
/* 0x4D */ SPOT_GROTTO_ROCK_1,
/* 0x4E */ SPOT_GROTTO_ROCK_2,
/* 0x4F */ SPOT_GROTTO_POND,
/* 0x50 */ SPOT_FARON_WOODS_CAVE,
};
#endif /* Z2SCENEMGR_H */
+1 -1
View File
@@ -81,7 +81,7 @@ public:
/* 802AE184 */ void processSeFramework();
/* 802AE524 */ bool isLevelSe(JAISoundID);
/* 802AE5B0 */ bool isSoundCulling(JAISoundID);
/* 802B9AC4 */ void resetCrowdSize();
/* 802B9AC4 */ void resetCrowdSize() { mCrowdSize = 0; }
private:
/* 0x000 */ JAISoundHandle mSoundHandle[24];
+20 -22
View File
@@ -123,28 +123,18 @@ public:
void bgmNowBattle(float);
void taktModeMute();
void taktModeMuteOff();
void setFieldBgmPlay(bool);
/* 802B99AC */ void unMuteSceneBgm(u32);
/* 802B9A24 */ void muteSceneBgm(u32, f32);
/* 802B9AD0 */ void setTwilightGateVol(f32);
/* 802B9AFC */ void setWindStoneVol(f32, u32);
void onEnemyDamage() { setBattleSeqState(2); }
void i_setTwilightGateVol(f32 vol) { mTwilightGateVol = vol; }
void i_setWindStoneVol(f32 vol, u32 count) { mWindStone.move(vol, count); }
void i_bgmAllUnMute(u32 count) { mAllBgmMaster.move(1.0f, count); }
void i_muteSceneBgm(u32 count, f32 vol) {
mSceneBgm.move(vol, count);
}
void i_unMuteSceneBgm(u32 count) {
void setFieldBgmPlay(bool value) { mFlags.mFieldBgmPlay = value; }
/* 802B99AC */ void unMuteSceneBgm(u32 count) {
mBgmPause.move(1.0f, 0);
mSceneBgm.move(1.0f, count);
}
/* 802B9A24 */ void muteSceneBgm(u32 count, f32 vol) { mSceneBgm.move(vol, count); }
/* 802B9AD0 */ void setTwilightGateVol(f32 vol) {
mTwilightGateVol = vol < 0.0f ? 0.0f : vol > 1.0f ? 1.0f : vol;
}
/* 802B9AFC */ void setWindStoneVol(f32 vol, u32 count) { mWindStone.move(vol, count); };
void onEnemyDamage() { setBattleSeqState(2); }
void bgmAllMute(u32 count, f32 val) {
mAllBgmMaster.mTransition.set(val, mAllBgmMaster.mIntensity, count);
@@ -182,6 +172,14 @@ public:
return -1;
}
bool checkBgmPlaying() {
bool ret = false;
if (mMainBgmHandle || mStreamBgmHandle) {
ret = true;
}
return ret;
}
JAISoundHandle* getMainBgmHandle() { return &mMainBgmHandle; }
JAISoundHandle* getSubBgmHandle() { return &mSubBgmHandle; }
@@ -221,9 +219,9 @@ public:
bool mBattleSearched : 1;
bool mBattleBgmOff : 1;
bool mRiding : 1;
bool flag5 : 1;
bool flag6 : 1;
bool flag7 : 1;
bool mFieldBgmPlay : 1;
bool mHeightVolMod : 1;
bool mTimeProcVolMod : 1;
} mFlags;
}; // Size = 0xD4
+3 -1
View File
@@ -3,8 +3,10 @@
#include "JSystem/JAudio2/JAISoundHandles.h"
#include "JSystem/JAudio2/JASHeapCtrl.h"
#include "dolphin/types.h"
// This should inherit JASPoolAllocObject (without which some functions in Z2SoundHandles.cpp badly mismatch)
// but this inheritance causes the memPool_ to be generated in the first file that includes this header.
// Perhaps this class definition should belong to a different header.
class Z2SoundHandlePool : public JAISoundHandle, public JSULink<Z2SoundHandlePool> { // , public JASPoolAllocObject<Z2SoundHandlePool> {
public:
Z2SoundHandlePool() : JAISoundHandle(), JSULink<Z2SoundHandlePool>(this) {}
+2
View File
@@ -28,7 +28,9 @@ public:
JGeometry::TVec3<f32> const*);
JAISeMgr* getSeMgr() { return &mSeMgr; }
const JAISeMgr* getSeMgr() const { return &mSeMgr; }
JAISeqMgr* getSeqMgr() { return &mSeqMgr; }
const JAISeqMgr* getSeqMgr() const { return &mSeqMgr; }
JAIStreamMgr* getStreamMgr() { return &mStreamMgr; }
private:
+1 -1
View File
@@ -7,7 +7,7 @@
class Z2CreatureEnemy;
struct Z2EnemyArea {
/* 0x00 */ u8 field_0x0;
/* 0x00 */ bool field_0x0;
/* 0x02 */ u16 field_0x2;
/* 0x04 */ u16 field_0x4;
/* 0x06 */ u16 field_0x6;
+3 -2
View File
@@ -28,9 +28,10 @@ struct Z2StatusMgr : public JASGlobalInstance<Z2StatusMgr> {
f32 getCameraInWaterDepth() { return mUnderwaterDepth; }
f32 getCameraInWaterDepthRatio() const { return mCameraInWaterDepthRatio; }
u8 getHour() { return mHour; }
bool isPaused() { return mIsMenuIn; }
bool isPaused() { return mPauseFlag; }
bool isHeartGuageOn() { return mHeartGaugeOn; }
void getCameraMapInfo(u32 info) { mCameraMapInfo = info; }
void setPauseFlag(u8 flag) { mPauseFlag = flag; }
/* 0x00 */ u8 mHour;
/* 0x01 */ u8 mMinute;
@@ -38,7 +39,7 @@ struct Z2StatusMgr : public JASGlobalInstance<Z2StatusMgr> {
/* 0x03 */ u8 field_0x03;
/* 0x04 */ s16 mTime;
/* 0x08 */ void* mEventBit;
/* 0x0C */ bool mIsMenuIn;
/* 0x0C */ u8 mPauseFlag;
/* 0x10 */ u32 mCameraMapInfo;
/* 0x14 */ u32 field_0x14;
/* 0x18 */ f32 mUnderwaterDepth;