diff --git a/include/JSystem/JAudio2/JAISoundHandles.h b/include/JSystem/JAudio2/JAISoundHandles.h index 850358facd2..d79baaa2dc6 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/JASGadget.h b/include/JSystem/JAudio2/JASGadget.h index 811aeacb3bd..578ad9a5be9 100644 --- a/include/JSystem/JAudio2/JASGadget.h +++ b/include/JSystem/JAudio2/JASGadget.h @@ -6,18 +6,35 @@ template class JASGlobalInstance { public: - T* getInstance() { return sInstance; } + inline T* getInstance() { return sInstance; } - JASGlobalInstance(bool param) { + inline JASGlobalInstance(bool param) { if (param) { ASSERT(sInstance == 0); - if (this!=NULL) { - sInstance = this - sizeof(T); - } + //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; }; +class Parent { + public: + int x; +}; + +class Parent2 { + public: + int y; +}; + +class Child : public Parent, public Parent2 { + public: + void func() { + Parent2::y = 5; // Access the member x of the Parent class + } +}; #endif /* JASGADGET_H */ diff --git a/include/Z2AudioLib/Z2WolfHowlMgr.h b/include/Z2AudioLib/Z2WolfHowlMgr.h index ba41b0539e4..224aa60485b 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/libs/Z2AudioLib/Z2WolfHowlMgr.cpp b/libs/Z2AudioLib/Z2WolfHowlMgr.cpp index e99da12893a..dcb579b215d 100644 --- a/libs/Z2AudioLib/Z2WolfHowlMgr.cpp +++ b/libs/Z2AudioLib/Z2WolfHowlMgr.cpp @@ -71,7 +71,7 @@ extern "C" void _savegpr_29(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); extern "C" extern u32 __float_nan; -extern "C" extern u8 data_80450B38[4]; +extern "C" extern Z2WolfHowlMgr* data_80450B38; extern "C" extern u8 data_80450B44[4]; extern "C" extern u8 data_80450B60[4]; extern "C" extern u8 data_80450B74[4]; @@ -194,6 +194,35 @@ SECTION_SDATA2 static u8 lit_3485[4] = { SECTION_SDATA2 static f32 lit_3486 = 1.0f; /* 802CAAC0-802CAB8C 2C5400 00CC+00 0/0 1/1 0/0 .text __ct__13Z2WolfHowlMgrFv */ +#ifdef NONMATCHING +Z2WolfHowlMgr* JASGlobalInstance::sInstance = reinterpret_cast(data_80450B38); +Z2WolfHowlMgr::Z2WolfHowlMgr() : JASGlobalInstance(true) { + mpCurSong = NULL; + mNowInputValue = 0.0f; + field_0x18 = 1.0f; + field_0x1c = 1.0f; + field_0x20 = cPitchCenter; + field_0x24 = cPitchCenter; + field_0x28 = 1.0f; + mTimer = NULL; + mReleaseTimer = 0; + mCorrectCurveID = -1; + field_0x90 = -1; + field_0xba = 0; + field_0xbb = 0; + field_0xbc = 0; + for (u8 i = 0; i<20; i++) { + field_0x92[i] = 0; + } + for (u8 i = 0; i<10; i++) { + field_0x38[i] = 0.0f; + field_0x60[i] = 0.0f; + } + field_0x34 = 0.0f; + field_0x30 = 0.0f; + mpSongList = (Z2WolfHowlData**)&sGuideData; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -202,8 +231,25 @@ asm Z2WolfHowlMgr::Z2WolfHowlMgr() { #include "asm/Z2AudioLib/Z2WolfHowlMgr/__ct__13Z2WolfHowlMgrFv.s" } #pragma pop +#endif /* 802CAB8C-802CABEC 2C54CC 0060+00 1/1 0/0 0/0 .text resetState__13Z2WolfHowlMgrFv */ +#ifdef NONMATCHING +void Z2WolfHowlMgr::resetState() { + field_0x18 = 1.0f; + field_0x24 = cPitchCenter; + field_0x28 = 1.0f; + mTimer = NULL; + mReleaseTimer = 0; + field_0xba = 0; + for (u8 i = 0; i<10; i++) { + field_0x38[i] = 0.0f; + field_0x60[i] = 0.0f; + } + field_0x34 = 0.0f; + field_0x30 = 0.0f; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -212,6 +258,7 @@ asm void Z2WolfHowlMgr::resetState() { #include "asm/Z2AudioLib/Z2WolfHowlMgr/resetState__13Z2WolfHowlMgrFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80455E68-80455E6C 004468 0004+00 2/2 0/0 0/0 .sdata2 @3527 */