From 5b5c114bb65a426d63f14cc62ea49d9c41061b48 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 12 Oct 2024 19:29:07 -0700 Subject: [PATCH] Minor CSfxManager fixes and renames --- config/GM8E01_00/symbols.txt | 10 +++++----- config/GM8E01_01/symbols.txt | 10 +++++----- include/Kyoto/Audio/CAudioSys.hpp | 2 +- include/Kyoto/Audio/CSfxHandle.hpp | 2 +- include/Kyoto/Audio/CSfxManager.hpp | 4 ++-- include/Kyoto/Basics/CCast.hpp | 2 +- src/Kyoto/Audio/CSfxManager.cpp | 8 +++++--- 7 files changed, 20 insertions(+), 18 deletions(-) diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index 5541a7dd..07b1dfd0 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -12744,8 +12744,8 @@ __ct>__16CFactoryFnReturnFPQ24rstl __dt__71TObjOwnerDerivedFromIObj>Fv = .text:0x802E7ACC; // type:function size:0xDC scope:global GetIObjObjectFor__53TToken>FRCQ24rstl55auto_ptr> = .text:0x802E7BA8; // type:function size:0x2C scope:global GetNewDerivedObject__71TObjOwnerDerivedFromIObj>FRCQ24rstl55auto_ptr> = .text:0x802E7BD4; // type:function size:0x9C scope:global -DisableAuxCallback__11CSfxManagerFv = .text:0x802E7C70; // type:function size:0xB8 scope:global -EnableAuxCallback__11CSfxManagerFv = .text:0x802E7D28; // type:function size:0x33C scope:global +DisableAuxCallbacks__11CSfxManagerFv = .text:0x802E7C70; // type:function size:0xB8 scope:global +EnableAuxCallbacks__11CSfxManagerFv = .text:0x802E7D28; // type:function size:0x33C scope:global PrepareDelayCallback__11CSfxManagerFRC13SND_AUX_DELAY = .text:0x802E8064; // type:function size:0x110 scope:global PrepareReverbStdCallback__11CSfxManagerFRC17SND_AUX_REVERBSTD = .text:0x802E8174; // type:function size:0xB4 scope:global PrepareChorusCallback__11CSfxManagerFRC14SND_AUX_CHORUS = .text:0x802E8228; // type:function size:0x94 scope:global @@ -21852,11 +21852,11 @@ lbl_805A92B0 = .sbss:0x805A92B0; // type:object size:0x1 data:byte lbl_805A92B4 = .sbss:0x805A92B4; // type:object size:0x1 data:byte mRefCount__10CSfxHandle = .sbss:0x805A92B8; // type:object size:0x4 scope:global data:4byte mCurrentChannel__11CSfxManager = .sbss:0x805A92C0; // type:object size:0x4 data:4byte -lbl_805A92C4 = .sbss:0x805A92C4; // type:object size:0x1 data:byte +mDoUpdate__11CSfxManager = .sbss:0x805A92C4; // type:object size:0x1 data:byte mTranslationTable__11CSfxManager = .sbss:0x805A92C8; // type:object size:0x4 data:4byte -lbl_805A92CC = .sbss:0x805A92CC; // type:object size:0x1 data:byte +mMuted__11CSfxManager = .sbss:0x805A92CC; // type:object size:0x1 data:byte mTranslationTableTok__11CSfxManager = .sbss:0x805A92D0; // type:object size:0x8 data:byte -lbl_805A92D8 = .sbss:0x805A92D8; // type:object size:0x8 data:byte +mAuxProcessingEnabled__11CSfxManager = .sbss:0x805A92D8; // type:object size:0x8 data:byte lbl_805A92E0 = .sbss:0x805A92E0; // type:object size:0x1 data:byte lbl_805A92E4 = .sbss:0x805A92E4; // type:object size:0x1 data:byte lbl_805A92E8 = .sbss:0x805A92E8; // type:object size:0x1 data:byte diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index fe1a9d69..0aa7ee1e 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -12759,8 +12759,8 @@ __ct>__16CFactoryFnReturnFPQ24rstl __dt__71TObjOwnerDerivedFromIObj>Fv = .text:0x802E7BAC; // type:function size:0xDC scope:global GetIObjObjectFor__53TToken>FRCQ24rstl55auto_ptr> = .text:0x802E7C88; // type:function size:0x2C scope:global GetNewDerivedObject__71TObjOwnerDerivedFromIObj>FRCQ24rstl55auto_ptr> = .text:0x802E7CB4; // type:function size:0x9C scope:global -DisableAuxCallback__11CSfxManagerFv = .text:0x802E7D50; // type:function size:0xB8 scope:global -EnableAuxCallback__11CSfxManagerFv = .text:0x802E7E08; // type:function size:0x33C scope:global +DisableAuxCallbacks__11CSfxManagerFv = .text:0x802E7D50; // type:function size:0xB8 scope:global +EnableAuxCallbacks__11CSfxManagerFv = .text:0x802E7E08; // type:function size:0x33C scope:global PrepareDelayCallback__11CSfxManagerFRC13SND_AUX_DELAY = .text:0x802E8144; // type:function size:0x110 scope:global PrepareReverbStdCallback__11CSfxManagerFRC17SND_AUX_REVERBSTD = .text:0x802E8254; // type:function size:0xB4 scope:global PrepareChorusCallback__11CSfxManagerFRC14SND_AUX_CHORUS = .text:0x802E8308; // type:function size:0x94 scope:global @@ -21892,11 +21892,11 @@ lbl_805A92B0 = .sbss:0x805A9490; // type:object size:0x1 scope:global data:byte lbl_805A92B4 = .sbss:0x805A9494; // type:object size:0x1 scope:global data:byte mRefCount__10CSfxHandle = .sbss:0x805A9498; // type:object size:0x4 scope:global data:4byte mCurrentChannel__11CSfxManager = .sbss:0x805A94A0; // type:object size:0x4 scope:global data:4byte -lbl_805A92C4 = .sbss:0x805A94A4; // type:object size:0x1 scope:global data:byte +mDoUpdate__11CSfxManager = .sbss:0x805A94A4; // type:object size:0x1 scope:global data:byte mTranslationTable__11CSfxManager = .sbss:0x805A94A8; // type:object size:0x4 scope:global data:4byte -lbl_805A92CC = .sbss:0x805A94AC; // type:object size:0x1 scope:global data:byte +mMuted__11CSfxManager = .sbss:0x805A94AC; // type:object size:0x1 scope:global data:byte mTranslationTableTok__11CSfxManager = .sbss:0x805A94B0; // type:object size:0x8 scope:global data:byte -lbl_805A92D8 = .sbss:0x805A94B8; // type:object size:0x8 scope:global data:byte +mAuxProcessingEnabled__11CSfxManager = .sbss:0x805A94B8; // type:object size:0x8 scope:global data:byte lbl_805A92E0 = .sbss:0x805A94C0; // type:object size:0x1 scope:global data:byte lbl_805A92E4 = .sbss:0x805A94C4; // type:object size:0x1 scope:global data:byte lbl_805A92E8 = .sbss:0x805A94C8; // type:object size:0x1 scope:global data:byte diff --git a/include/Kyoto/Audio/CAudioSys.hpp b/include/Kyoto/Audio/CAudioSys.hpp index b2e2e00d..6d6d9667 100644 --- a/include/Kyoto/Audio/CAudioSys.hpp +++ b/include/Kyoto/Audio/CAudioSys.hpp @@ -84,7 +84,7 @@ public: static void SfxCtrl(SND_VOICEID handle, uchar ctrl, uchar val); static SND_VOICEID SfxCheck(SND_VOICEID handle); static void SfxVolume(SND_VOICEID handle, u8 vol); - static uint S3dAddEmitterParaEx(const C3DEmitterParmData& params, short handle, + static uint S3dAddEmitterParaEx(const C3DEmitterParmData& params, ushort handle, SND_PARAMETER_INFO* paraInfo); static void S3dUpdateEmitter(uint, const CVector3f&, const CVector3f&, uchar); static void S3dRemoveEmitter(uint handle); diff --git a/include/Kyoto/Audio/CSfxHandle.hpp b/include/Kyoto/Audio/CSfxHandle.hpp index b1b72f34..01d27a5a 100644 --- a/include/Kyoto/Audio/CSfxHandle.hpp +++ b/include/Kyoto/Audio/CSfxHandle.hpp @@ -8,7 +8,7 @@ public: CSfxHandle() : mID(0) {} CSfxHandle(uint value); - int GetIndex() const { return mID & 0xFFF; } + int GetIndex() const { return mID & 0xFF; } static CSfxHandle NullHandle() { return CSfxHandle(); } void operator=(const CSfxHandle& other) { mID = other.mID; } const bool operator==(const CSfxHandle& other) const { return mID == other.mID; } diff --git a/include/Kyoto/Audio/CSfxManager.hpp b/include/Kyoto/Audio/CSfxManager.hpp index ff4310ab..2ad9133c 100644 --- a/include/Kyoto/Audio/CSfxManager.hpp +++ b/include/Kyoto/Audio/CSfxManager.hpp @@ -226,8 +226,8 @@ public: static void TurnOffChannel(ESfxChannels); static const bool IsAuxProcessingEnabled(); - static void DisableAuxCallback(); - static void EnableAuxCallback(); + static void DisableAuxCallbacks(); + static void EnableAuxCallbacks(); static void PrepareDelayCallback(const SND_AUX_DELAY& info); static void PrepareReverbStdCallback(const SND_AUX_REVERBSTD& info); static void PrepareChorusCallback(const SND_AUX_CHORUS& info); diff --git a/include/Kyoto/Basics/CCast.hpp b/include/Kyoto/Basics/CCast.hpp index adc54d7f..a4e94cf4 100644 --- a/include/Kyoto/Basics/CCast.hpp +++ b/include/Kyoto/Basics/CCast.hpp @@ -68,7 +68,7 @@ inline int FtoL(float in) { return static_cast< int >(in); } inline float LtoF(int in) { return static_cast< float >(in); } inline float ToReal32(int in) { return static_cast< float >(in); } inline int ToInt32(float in) { return static_cast< int >(in); } -inline unsigned short ToUint16(unsigned short in) { return static_cast< short >(in); } +inline unsigned short ToUint16(short in) { return static_cast(in); } inline char ToChar(int c) { return ToUint8(c); } } // namespace CCast diff --git a/src/Kyoto/Audio/CSfxManager.cpp b/src/Kyoto/Audio/CSfxManager.cpp index 5920e028..458bdd22 100644 --- a/src/Kyoto/Audio/CSfxManager.cpp +++ b/src/Kyoto/Audio/CSfxManager.cpp @@ -1,6 +1,7 @@ #include "Kyoto/Alloc/CMemory.hpp" #include "Kyoto/Audio/CAudioSys.hpp" #include "Kyoto/Audio/CSfxHandle.hpp" +#include "Kyoto/Basics/CCast.hpp" #include "dolphin/types.h" #include "musyx/musyx.h" #include "rstl/vector.hpp" @@ -180,7 +181,8 @@ void CSfxManager::CSfxWrapper::Play() { x1c_voiceHandle = CAudioSys::SfxStart(x18_sfxId, x20_vol, x22_pan, 0); if (x1c_voiceHandle != SND_ID_ERROR) { if (CSfxManager::IsAuxProcessingEnabled() && UseAcoustics()) { - CAudioSys::SfxCtrl(x1c_voiceHandle, SND_MIDICTRL_REVERB, CSfxManager::GetReverbAmount()); + int reverb = CSfxManager::GetReverbAmount(); + CAudioSys::SfxCtrl(x1c_voiceHandle, SND_MIDICTRL_REVERB, reverb); } SetPlaying(true); @@ -223,7 +225,7 @@ void CSfxManager::Shutdown() { StopAndRemoveAllEmitters(); if (lbl_805A8770 != -1) { - DisableAuxCallback(); + DisableAuxCallbacks(); } } @@ -340,7 +342,7 @@ ushort CSfxManager::TranslateSFXID(ushort id) { if (ret < 0) { return -1; } - return ret; + return CCast::ToUint16(ret); } #pragma inline_max_size(250) CFactoryFnReturn FAudioTranslationTableFactory(const SObjectTag& obj, CInputStream& in,