diff --git a/asm/Kyoto/Audio/DolphinCAudioGroupSet.s b/asm/Kyoto/Audio/DolphinCAudioGroupSet.s index 261a47b0..dabda852 100644 --- a/asm/Kyoto/Audio/DolphinCAudioGroupSet.s +++ b/asm/Kyoto/Audio/DolphinCAudioGroupSet.s @@ -3,18 +3,18 @@ .section .data .balign 8 -.global lbl_803EF670 -lbl_803EF670: +.global "__vt__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>" +"__vt__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>": # ROM: 0x3EC670 .4byte 0 .4byte 0 - .4byte sub_8034a1b0 + .4byte "__dt__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>Fv" .4byte 0 .section .text, "ax" -.global FAudioGroupSetLocDataFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer -FAudioGroupSetLocDataFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer: +.global "FAudioGroupSetLocDataFactory__FRC10SObjectTagRCQ24rstl12auto_ptriRC15CVParamTransfer" +"FAudioGroupSetLocDataFactory__FRC10SObjectTagRCQ24rstl12auto_ptriRC15CVParamTransfer": /* 8034A024 00346F84 94 21 FF E0 */ stwu r1, -0x20(r1) /* 8034A028 00346F88 7C 08 02 A6 */ mflr r0 /* 8034A02C 00346F8C 3C 80 80 3E */ lis r4, lbl_803D8108@ha @@ -33,11 +33,11 @@ FAudioGroupSetLocDataFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer: /* 8034A060 00346FC0 41 82 00 14 */ beq lbl_8034A074 /* 8034A064 00346FC4 7F C4 F3 78 */ mr r4, r30 /* 8034A068 00346FC8 7F E5 FB 78 */ mr r5, r31 -/* 8034A06C 00346FCC 48 00 03 89 */ bl __ct__15CAudioGrpSetLocFR12CInputStream +/* 8034A06C 00346FCC 48 00 03 89 */ bl "__ct__15CAudioGrpSetLocFRCQ24rstl12auto_ptri" /* 8034A070 00346FD0 7C 64 1B 78 */ mr r4, r3 lbl_8034A074: /* 8034A074 00346FD4 7F A3 EB 78 */ mr r3, r29 -/* 8034A078 00346FD8 48 00 00 21 */ bl sub_8034a098 +/* 8034A078 00346FD8 48 00 00 21 */ bl "__ct<15CAudioGrpSetLoc>__16CFactoryFnReturnFP15CAudioGrpSetLoc" /* 8034A07C 00346FDC 80 01 00 24 */ lwz r0, 0x24(r1) /* 8034A080 00346FE0 83 E1 00 1C */ lwz r31, 0x1c(r1) /* 8034A084 00346FE4 83 C1 00 18 */ lwz r30, 0x18(r1) @@ -46,8 +46,8 @@ lbl_8034A074: /* 8034A090 00346FF0 38 21 00 20 */ addi r1, r1, 0x20 /* 8034A094 00346FF4 4E 80 00 20 */ blr -.global sub_8034a098 -sub_8034a098: +.global "__ct<15CAudioGrpSetLoc>__16CFactoryFnReturnFP15CAudioGrpSetLoc" +"__ct<15CAudioGrpSetLoc>__16CFactoryFnReturnFP15CAudioGrpSetLoc": /* 8034A098 00346FF8 94 21 FF E0 */ stwu r1, -0x20(r1) /* 8034A09C 00346FFC 7C 08 02 A6 */ mflr r0 /* 8034A0A0 00347000 90 01 00 24 */ stw r0, 0x24(r1) @@ -61,7 +61,7 @@ sub_8034a098: /* 8034A0C0 00347020 90 81 00 14 */ stw r4, 0x14(r1) /* 8034A0C4 00347024 38 81 00 10 */ addi r4, r1, 0x10 /* 8034A0C8 00347028 98 01 00 10 */ stb r0, 0x10(r1) -/* 8034A0CC 0034702C 48 00 01 D9 */ bl sub_8034a2a4 +/* 8034A0CC 0034702C 48 00 01 D9 */ bl "GetIObjObjectFor__25TToken<15CAudioGrpSetLoc>FRCQ24rstl27auto_ptr<15CAudioGrpSetLoc>" /* 8034A0D0 00347030 80 61 00 0C */ lwz r3, 0xc(r1) /* 8034A0D4 00347034 38 00 00 00 */ li r0, 0 /* 8034A0D8 00347038 98 01 00 08 */ stb r0, 8(r1) @@ -125,8 +125,8 @@ lbl_8034A194: /* 8034A1A8 00347108 38 21 00 20 */ addi r1, r1, 0x20 /* 8034A1AC 0034710C 4E 80 00 20 */ blr -.global sub_8034a1b0 -sub_8034a1b0: +.global "__dt__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>Fv" +"__dt__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>Fv": /* 8034A1B0 00347110 94 21 FF E0 */ stwu r1, -0x20(r1) /* 8034A1B4 00347114 7C 08 02 A6 */ mflr r0 /* 8034A1B8 00347118 90 01 00 24 */ stw r0, 0x24(r1) @@ -136,8 +136,8 @@ sub_8034a1b0: /* 8034A1C8 00347128 93 A1 00 14 */ stw r29, 0x14(r1) /* 8034A1CC 0034712C 7C 7D 1B 79 */ or. r29, r3, r3 /* 8034A1D0 00347130 41 82 00 B4 */ beq lbl_8034A284 -/* 8034A1D4 00347134 3C 60 80 3F */ lis r3, lbl_803EF670@ha -/* 8034A1D8 00347138 38 03 F6 70 */ addi r0, r3, lbl_803EF670@l +/* 8034A1D4 00347134 3C 60 80 3F */ lis r3, "__vt__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>"@ha +/* 8034A1D8 00347138 38 03 F6 70 */ addi r0, r3, "__vt__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>"@l /* 8034A1DC 0034713C 90 1D 00 00 */ stw r0, 0(r29) /* 8034A1E0 00347140 83 FD 00 04 */ lwz r31, 4(r29) /* 8034A1E4 00347144 28 1F 00 00 */ cmplwi r31, 0 @@ -196,22 +196,22 @@ lbl_8034A284: /* 8034A29C 003471FC 38 21 00 20 */ addi r1, r1, 0x20 /* 8034A2A0 00347200 4E 80 00 20 */ blr -.global sub_8034a2a4 -sub_8034a2a4: +.global "GetIObjObjectFor__25TToken<15CAudioGrpSetLoc>FRCQ24rstl27auto_ptr<15CAudioGrpSetLoc>" +"GetIObjObjectFor__25TToken<15CAudioGrpSetLoc>FRCQ24rstl27auto_ptr<15CAudioGrpSetLoc>": /* 8034A2A4 00347204 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8034A2A8 00347208 7C 08 02 A6 */ mflr r0 /* 8034A2AC 0034720C 90 01 00 14 */ stw r0, 0x14(r1) /* 8034A2B0 00347210 93 E1 00 0C */ stw r31, 0xc(r1) /* 8034A2B4 00347214 7C 7F 1B 78 */ mr r31, r3 -/* 8034A2B8 00347218 48 00 00 19 */ bl sub_8034a2d0 +/* 8034A2B8 00347218 48 00 00 19 */ bl "GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>FRCQ24rstl27auto_ptr<15CAudioGrpSetLoc>" /* 8034A2BC 0034721C 80 01 00 14 */ lwz r0, 0x14(r1) /* 8034A2C0 00347220 83 E1 00 0C */ lwz r31, 0xc(r1) /* 8034A2C4 00347224 7C 08 03 A6 */ mtlr r0 /* 8034A2C8 00347228 38 21 00 10 */ addi r1, r1, 0x10 /* 8034A2CC 0034722C 4E 80 00 20 */ blr -.global sub_8034a2d0 -sub_8034a2d0: +.global "GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>FRCQ24rstl27auto_ptr<15CAudioGrpSetLoc>" +"GetNewDerivedObject__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>FRCQ24rstl27auto_ptr<15CAudioGrpSetLoc>": /* 8034A2D0 00347230 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8034A2D4 00347234 7C 08 02 A6 */ mflr r0 /* 8034A2D8 00347238 3C A0 80 3E */ lis r5, lbl_803D8108@ha @@ -230,11 +230,11 @@ sub_8034a2d0: /* 8034A30C 0034726C 3C 80 80 3E */ lis r4, __vt__4IObj@ha /* 8034A310 00347270 3C A0 80 3E */ lis r5, __vt__31CObjOwnerDerivedFromIObjUntyped@ha /* 8034A314 00347274 38 04 8D 6C */ addi r0, r4, __vt__4IObj@l -/* 8034A318 00347278 3C 80 80 3F */ lis r4, lbl_803EF670@ha +/* 8034A318 00347278 3C 80 80 3F */ lis r4, "__vt__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>"@ha /* 8034A31C 0034727C 90 03 00 00 */ stw r0, 0(r3) /* 8034A320 00347280 38 C5 8D 78 */ addi r6, r5, __vt__31CObjOwnerDerivedFromIObjUntyped@l /* 8034A324 00347284 38 A0 00 00 */ li r5, 0 -/* 8034A328 00347288 38 04 F6 70 */ addi r0, r4, lbl_803EF670@l +/* 8034A328 00347288 38 04 F6 70 */ addi r0, r4, "__vt__43TObjOwnerDerivedFromIObj<15CAudioGrpSetLoc>"@l /* 8034A32C 0034728C 90 C3 00 00 */ stw r6, 0(r3) /* 8034A330 00347290 98 BF 00 00 */ stb r5, 0(r31) /* 8034A334 00347294 80 9F 00 04 */ lwz r4, 4(r31) @@ -293,8 +293,8 @@ lbl_8034A3D8: /* 8034A3EC 0034734C 38 21 00 20 */ addi r1, r1, 0x20 /* 8034A3F0 00347350 4E 80 00 20 */ blr -.global __ct__15CAudioGrpSetLocFR12CInputStream -__ct__15CAudioGrpSetLocFR12CInputStream: +.global "__ct__15CAudioGrpSetLocFRCQ24rstl12auto_ptri" +"__ct__15CAudioGrpSetLocFRCQ24rstl12auto_ptri": /* 8034A3F4 00347354 94 21 FF 70 */ stwu r1, -0x90(r1) /* 8034A3F8 00347358 7C 08 02 A6 */ mflr r0 /* 8034A3FC 0034735C 38 C0 00 00 */ li r6, 0 @@ -354,22 +354,22 @@ __ct__15CAudioGrpSetLocFR12CInputStream: /* 8034A4D4 00347434 38 61 00 40 */ addi r3, r1, 0x40 /* 8034A4D8 00347438 38 80 00 00 */ li r4, 0 /* 8034A4DC 0034743C 4B FF 4B D1 */ bl __dt__12CInputStreamFv -/* 8034A4E0 00347440 48 00 03 35 */ bl sub_8034a814 +/* 8034A4E0 00347440 48 00 03 35 */ bl GetVerbose__9CAudioSysFv /* 8034A4E4 00347444 80 7A 00 04 */ lwz r3, 4(r26) /* 8034A4E8 00347448 7F 9E FA 14 */ add r28, r30, r31 /* 8034A4EC 0034744C 7F A3 E0 2E */ lwzx r29, r3, r28 -/* 8034A4F0 00347450 48 00 03 25 */ bl sub_8034a814 +/* 8034A4F0 00347450 48 00 03 25 */ bl GetVerbose__9CAudioSysFv /* 8034A4F4 00347454 7F 7C EA 14 */ add r27, r28, r29 /* 8034A4F8 00347458 80 7A 00 04 */ lwz r3, 4(r26) /* 8034A4FC 0034745C 3B 7B 00 04 */ addi r27, r27, 4 /* 8034A500 00347460 7E E3 D8 2E */ lwzx r23, r3, r27 -/* 8034A504 00347464 48 00 03 11 */ bl sub_8034a814 +/* 8034A504 00347464 48 00 03 11 */ bl GetVerbose__9CAudioSysFv /* 8034A508 00347468 92 F8 00 30 */ stw r23, 0x30(r24) /* 8034A50C 0034746C 7F 3B BA 14 */ add r25, r27, r23 /* 8034A510 00347470 3B 39 00 04 */ addi r25, r25, 4 /* 8034A514 00347474 80 7A 00 04 */ lwz r3, 4(r26) /* 8034A518 00347478 7F 43 C8 2E */ lwzx r26, r3, r25 -/* 8034A51C 0034747C 48 00 02 F9 */ bl sub_8034a814 +/* 8034A51C 0034747C 48 00 02 F9 */ bl GetVerbose__9CAudioSysFv /* 8034A520 00347480 3C 60 80 3E */ lis r3, lbl_803D8108@ha /* 8034A524 00347484 3C 80 80 3D */ lis r4, kUnknownType__10CCallStack@ha /* 8034A528 00347488 38 A3 81 08 */ addi r5, r3, lbl_803D8108@l diff --git a/asm/Kyoto/Audio/DolphinCAudioSys.s b/asm/Kyoto/Audio/DolphinCAudioSys.s index f1831790..b635d54f 100644 --- a/asm/Kyoto/Audio/DolphinCAudioSys.s +++ b/asm/Kyoto/Audio/DolphinCAudioSys.s @@ -176,8 +176,8 @@ SetVolumeScale__9CAudioSysFs: /* 8034A80C 0034776C B0 6D 9D DA */ sth r3, lbl_805A899A@sda21(r13) /* 8034A810 00347770 4E 80 00 20 */ blr -.global sub_8034a814 -sub_8034a814: +.global GetVerbose__9CAudioSysFv +GetVerbose__9CAudioSysFv: /* 8034A814 00347774 88 6D A9 D2 */ lbz r3, lbl_805A9592@sda21(r13) /* 8034A818 00347778 4E 80 00 20 */ blr diff --git a/asm/MetroidPrime/CWorld.s b/asm/MetroidPrime/CWorld.s index 77da3fb2..3b45935a 100644 --- a/asm/MetroidPrime/CWorld.s +++ b/asm/MetroidPrime/CWorld.s @@ -3406,7 +3406,7 @@ lbl_8005896C: lbl_80058970: /* 80058970 000558D0 7C 1A E0 00 */ cmpw r26, r28 /* 80058974 000558D4 41 80 FF 0C */ blt lbl_80058880 -/* 80058978 000558D8 48 2F 1E 9D */ bl sub_8034a814 +/* 80058978 000558D8 48 2F 1E 9D */ bl GetVerbose__9CAudioSysFv lbl_8005897C: /* 8005897C 000558DC 28 1E 00 0C */ cmplwi r30, 0xc /* 80058980 000558E0 40 81 00 C8 */ ble lbl_80058A48 diff --git a/asm/MetroidPrime/main.s b/asm/MetroidPrime/main.s index 438e0bf0..a883dd85 100644 --- a/asm/MetroidPrime/main.s +++ b/asm/MetroidPrime/main.s @@ -4578,9 +4578,9 @@ lbl_80006248: /* 800064DC 0000343C 38 7F 00 5C */ addi r3, r31, 0x5c /* 800064E0 00003440 38 84 53 4D */ addi r4, r4, 0x534d /* 800064E4 00003444 48 33 29 9D */ bl AddFactory__11CFactoryMgrFUiPFRC10SObjectTagR12CInputStreamRC15CVParamTransfer_C16CFactoryFnReturn -/* 800064E8 00003448 3C 60 80 35 */ lis r3, FAudioGroupSetLocDataFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer@ha +/* 800064E8 00003448 3C 60 80 35 */ lis r3, "FAudioGroupSetLocDataFactory__FRC10SObjectTagRCQ24rstl12auto_ptriRC15CVParamTransfer"@ha /* 800064EC 0000344C 3C 80 41 47 */ lis r4, 0x4147 -/* 800064F0 00003450 38 A3 A1 04 */ addi r5, r3, FAudioGroupSetLocDataFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer@l +/* 800064F0 00003450 38 A3 A1 04 */ addi r5, r3, "FAudioGroupSetLocDataFactory__FRC10SObjectTagRCQ24rstl12auto_ptriRC15CVParamTransfer"@l /* 800064F4 00003454 38 7F 00 5C */ addi r3, r31, 0x5c /* 800064F8 00003458 38 84 53 43 */ addi r4, r4, 0x5343 /* 800064FC 0000345C 48 33 28 C5 */ bl "AddFactory__11CFactoryMgrFUiPFRC10SObjectTagRCQ24rstl12auto_ptriRC15CVParamTransfer_C16CFactoryFnReturn" @@ -4925,9 +4925,9 @@ lbl_800061F8: /* 80006484 000033E4 38 7F 00 5C */ addi r3, r31, 0x5c /* 80006488 000033E8 38 84 53 4D */ addi r4, r4, 0x4146534D@l /* 8000648C 000033EC 48 33 29 15 */ bl AddFactory__11CFactoryMgrFUiPFRC10SObjectTagR12CInputStreamRC15CVParamTransfer_C16CFactoryFnReturn -/* 80006490 000033F0 3C 60 80 35 */ lis r3, FAudioGroupSetLocDataFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer@ha +/* 80006490 000033F0 3C 60 80 35 */ lis r3, "FAudioGroupSetLocDataFactory__FRC10SObjectTagRCQ24rstl12auto_ptriRC15CVParamTransfer"@ha /* 80006494 000033F4 3C 80 41 47 */ lis r4, 0x41475343@ha -/* 80006498 000033F8 38 A3 A0 24 */ addi r5, r3, FAudioGroupSetLocDataFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer@l +/* 80006498 000033F8 38 A3 A0 24 */ addi r5, r3, "FAudioGroupSetLocDataFactory__FRC10SObjectTagRCQ24rstl12auto_ptriRC15CVParamTransfer"@l /* 8000649C 000033FC 38 7F 00 5C */ addi r3, r31, 0x5c /* 800064A0 00003400 38 84 53 43 */ addi r4, r4, 0x41475343@l /* 800064A4 00003404 48 33 28 3D */ bl "AddFactory__11CFactoryMgrFUiPFRC10SObjectTagRCQ24rstl12auto_ptriRC15CVParamTransfer_C16CFactoryFnReturn" diff --git a/configure.py b/configure.py index da96cd4a..8b88c35d 100755 --- a/configure.py +++ b/configure.py @@ -649,7 +649,7 @@ LIBS = [ ["Kyoto/Animation/CSegIdList", False], ["Kyoto/Input/CFinalInput", True], ["Kyoto/Graphics/CColor", True], - "Kyoto/Audio/DolphinCAudioGroupSet", + ["Kyoto/Audio/DolphinCAudioGroupSet", False], ["Kyoto/Audio/DolphinCAudioSys", False], "Kyoto/DolphinCMemoryCardSys", ["Kyoto/Input/DolphinIController", True], diff --git a/include/Kyoto/Audio/CAudioGroupSet.hpp b/include/Kyoto/Audio/CAudioGroupSet.hpp new file mode 100644 index 00000000..027de82e --- /dev/null +++ b/include/Kyoto/Audio/CAudioGroupSet.hpp @@ -0,0 +1,51 @@ +#ifndef _CAUDIOGROUPSET +#define _CAUDIOGROUPSET + +#include "Kyoto/TToken.hpp" + +#include "rstl/auto_ptr.hpp" +#include "rstl/optional_object.hpp" +#include "rstl/single_ptr.hpp" +#include "rstl/string.hpp" + +#include "Kyoto/CResFactory.hpp" + +class CInputStream; +class CAudioGrpSetLoc { +public: + CAudioGrpSetLoc(const rstl::auto_ptr< uchar >& data, int length); + const rstl::string& GetBaseDirName() const { return x10_baseDirName; } + const rstl::string& GetGroupSetName() const { return x20_groupSetName; } + uint AramUsage() const; + const void* GetPool() const; + const void* GetProject() const; + const void* GetSample() const; + const void* GetSampleDir() const; + +private: + rstl::auto_ptr< uchar > x0_data; + rstl::auto_ptr< uchar > x8_; + rstl::string x10_baseDirName; + rstl::string x20_groupSetName; + uint x30_; + uint x34_; + uint x38_; + uint x3c_; + uint x40_; +}; + +class CAudioGroupSet { +public: + CAudioGroupSet(const TLockedToken< CAudioGrpSetLoc >& group); + ~CAudioGroupSet(); + void Reload(); + void FreeSampleBuffer(); + void FreeAllBuffers(); + +private: + rstl::string x0_baseDir; + rstl::string x10_groupSetName; + rstl::optional_object< TLockedToken< CAudioGrpSetLoc > > x10_groupSetTok; +}; + +#endif // _CAUDIOGROUPSET diff --git a/include/Kyoto/Audio/CAudioSys.hpp b/include/Kyoto/Audio/CAudioSys.hpp index 24500821..14193f45 100644 --- a/include/Kyoto/Audio/CAudioSys.hpp +++ b/include/Kyoto/Audio/CAudioSys.hpp @@ -28,7 +28,14 @@ class CAudioSys { public: enum ESurroundModes { kSM_Mono, kSM_Stereo, kSM_Surround }; class CEmitterData { + public: + CEmitterData() : _50(0), _51(0), _52(kEmitterMedPriority){}; + private: + char data[0x50]; + char _50; + char _51; + uchar _52; }; struct C3DEmitterParmData { @@ -72,24 +79,26 @@ public: static void TrkSetSampleRate(ETRKSampleRate); static short GetDefaultVolumeScale(); + static bool GetVerbose(); static bool mInitialized; - static bool mIsLIstenerActive; + static bool mIsListenerActive; static bool mVerbose; static uchar mMaxNumEmitters; static rstl::map< rstl::string, rstl::ncrc_ptr< CAudioGroupSet > >* mpGroupSetDB; static rstl::map< uint, rstl::string >* mpGroupSetResNameDB; static rstl::map< rstl::string, rstl::ncrc_ptr< CTrkData > >* mpDVDTrackDB; - static rstl::vector* mpEmitterDB; + static rstl::vector< CEmitterData >* mpEmitterDB; static unkptr mpListener; /* TODO: Remaining globals */ static ESurroundModes mSurroundMode; static uint mMaxAramUsage; - static uint mCurrentAramUsage; + static uint mCurrentAramUsage; static bool mProLogic2; static const uchar kMaxVolume; + static uchar kEmitterMedPriority; }; #endif // _CAUDIOSYS diff --git a/include/Kyoto/CFactoryMgr.hpp b/include/Kyoto/CFactoryMgr.hpp index e8afc207..1b450823 100644 --- a/include/Kyoto/CFactoryMgr.hpp +++ b/include/Kyoto/CFactoryMgr.hpp @@ -16,8 +16,7 @@ private: class CFactoryFnReturn { public: template < typename T > - CFactoryFnReturn(T* ptr) - : obj(TToken< T >::GetIObjObjectFor(ptr).release()) {} + CFactoryFnReturn(T* ptr) : obj(TToken< T >::GetIObjObjectFor(ptr).release()) {} private: rstl::auto_ptr< CObjOwnerDerivedFromIObjUntyped > obj; diff --git a/src/Kyoto/Audio/DolphinCAudioGroupSet.cpp b/src/Kyoto/Audio/DolphinCAudioGroupSet.cpp new file mode 100644 index 00000000..956d0634 --- /dev/null +++ b/src/Kyoto/Audio/DolphinCAudioGroupSet.cpp @@ -0,0 +1,40 @@ +#include "Kyoto/Audio/CAudioGroupSet.hpp" + +#include "Kyoto/Audio/CAudioSys.hpp" +#include "Kyoto/Streams/CMemoryInStream.hpp" + +#include "Kyoto/CFactoryMgr.hpp" + +CAudioGroupSet::CAudioGroupSet(const TLockedToken< CAudioGrpSetLoc >& group) +: x0_baseDir(group->GetBaseDirName()) +, x10_groupSetName(group->GetGroupSetName()) +, x10_groupSetTok(group) {} + +CAudioGroupSet::~CAudioGroupSet() {} + +void CAudioGroupSet::Reload() {} + +void CAudioGroupSet::FreeSampleBuffer() {} + +CAudioGrpSetLoc::CAudioGrpSetLoc(const rstl::auto_ptr< uchar >& data, int length) +: x0_data(data.get()), x30_(0), x34_(0), x38_(0), x3c_(0), x40_(0) { + int __n; + { + CMemoryInStream in(x0_data.get(), length); + x10_baseDirName = rstl::string(in); + x20_groupSetName = rstl::string(in); + __n = in.ReadLong(); + } + CAudioSys::GetVerbose(); +} + +template <> +CFactoryFnReturn::CFactoryFnReturn(CAudioGrpSetLoc* ptr) +: obj(TToken< CAudioGrpSetLoc >::GetIObjObjectFor(rstl::auto_ptr< CAudioGrpSetLoc >(ptr)) + .release()) {} + +CFactoryFnReturn FAudioGroupSetLocDataFactory(const SObjectTag& tag, + const rstl::auto_ptr< uchar >& data, int length, + const CVParamTransfer& xfer) { + return new CAudioGrpSetLoc(data, length); +} diff --git a/src/Kyoto/Audio/DolphinCAudioSys.cpp b/src/Kyoto/Audio/DolphinCAudioSys.cpp index 2258ae46..dfee1980 100644 --- a/src/Kyoto/Audio/DolphinCAudioSys.cpp +++ b/src/Kyoto/Audio/DolphinCAudioSys.cpp @@ -9,13 +9,14 @@ #include "musyx/musyx.h" bool CAudioSys::mInitialized = false; -bool CAudioSys::mIsLIstenerActive = false; +bool CAudioSys::mIsListenerActive = false; bool CAudioSys::mVerbose = false; uchar CAudioSys::mMaxNumEmitters = 0; rstl::map< rstl::string, rstl::ncrc_ptr< CAudioGroupSet > >* CAudioSys::mpGroupSetDB = nullptr; rstl::map< uint, rstl::string >* CAudioSys::mpGroupSetResNameDB = nullptr; rstl::map< rstl::string, rstl::ncrc_ptr< CAudioSys::CTrkData > >* CAudioSys::mpDVDTrackDB = nullptr; +uchar CAudioSys::kEmitterMedPriority = 0x7f; const uchar CAudioSys::kMaxVolume = 0x7f; bool CAudioSys::mProLogic2 = true; @@ -46,9 +47,10 @@ CAudioSys::CAudioSys(char numVoices, char numMusic, char numSfx, char maxNumEmit mpGroupSetDB = new rstl::map< rstl::string, rstl::ncrc_ptr< CAudioGroupSet > >(); mpGroupSetResNameDB = new rstl::map< uint, rstl::string >(); mpDVDTrackDB = new rstl::map< rstl::string, rstl::ncrc_ptr< CTrkData > >(); - mpEmitterDB = new rstl::vector< CEmitterData >(maxNumEmitters); - mpListener = nullptr; // TODO: Add listener allocation - mIsLIstenerActive = false; + mpEmitterDB = new rstl::vector< CEmitterData >(maxNumEmitters, CEmitterData()); + mpListener = new u8[0x90]; // TODO: Add actual listener allocation + mIsListenerActive = false; + mMaxNumEmitters = maxNumEmitters; if (OSGetSoundMode() == OS_SOUND_MODE_MONO) { sndOutputMode(SND_OUTPUTMODE_MONO);