diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 43c75774..8f6c5011 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -2928,10 +2928,10 @@ nw4r/snd/snd_DvdSoundArchive.cpp: .text start:0x8046BB60 end:0x8046C1C8 align:16 nw4r/snd/snd_EnvGenerator.cpp: - .text start:0x8046C1D0 end:0x8046C5C0 align:16 + .text start:0x8046C1D0 end:0x8046C5A0 align:16 nw4r/snd/snd_ExternalSoundPlayer.cpp: - .text start:0x8046C5C0 end:0x8046CB18 align:16 + .text start:0x8046C5A0 end:0x8046CB18 align:16 nw4r/snd/snd_FrameHeap.cpp: .text start:0x8046CB20 end:0x8046D2E0 align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 68878fa5..c9c124ae 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -25131,16 +25131,16 @@ Update__Q44nw4r3snd6detail10BasicSoundFv = .text:0x80469350; // type:function si UpdateMoveValue__Q44nw4r3snd6detail10BasicSoundFv = .text:0x804698E0; // type:function size:0x34 UpdateParam__Q44nw4r3snd6detail10BasicSoundFv = .text:0x80469920; // type:function size:0x3C8 Shutdown__Q44nw4r3snd6detail10BasicSoundFv = .text:0x80469CF0; // type:function size:0x16C -FUN_80469e60 = .text:0x80469E60; // type:function size:0x8 -FUN_80469e70 = .text:0x80469E70; // type:function size:0xC -FUN_80469e80 = .text:0x80469E80; // type:function size:0x8 -FUN_80469e90 = .text:0x80469E90; // type:function size:0xC -FUN_80469ea0 = .text:0x80469EA0; // type:function size:0x8 -FUN_80469eb0 = .text:0x80469EB0; // type:function size:0xC -FUN_80469ec0 = .text:0x80469EC0; // type:function size:0x8 -FUN_80469ed0 = .text:0x80469ED0; // type:function size:0xC +AttachPlayerHeap__Q44nw4r3snd6detail10BasicSoundFPQ44nw4r3snd6detail10PlayerHeap = .text:0x80469E60; // type:function size:0x8 +DetachPlayerHeap__Q44nw4r3snd6detail10BasicSoundFPQ44nw4r3snd6detail10PlayerHeap = .text:0x80469E70; // type:function size:0xC +AttachSoundPlayer__Q44nw4r3snd6detail10BasicSoundFPQ34nw4r3snd11SoundPlayer = .text:0x80469E80; // type:function size:0x8 +DetachSoundPlayer__Q44nw4r3snd6detail10BasicSoundFPQ34nw4r3snd11SoundPlayer = .text:0x80469E90; // type:function size:0xC +AttachSoundActor__Q44nw4r3snd6detail10BasicSoundFPQ34nw4r3snd10SoundActor = .text:0x80469EA0; // type:function size:0x8 +DetachSoundActor__Q44nw4r3snd6detail10BasicSoundFPQ34nw4r3snd10SoundActor = .text:0x80469EB0; // type:function size:0xC +AttachExternalSoundPlayer__Q44nw4r3snd6detail10BasicSoundFPQ44nw4r3snd6detail19ExternalSoundPlayer = .text:0x80469EC0; // type:function size:0x8 +DetachExternalSoundPlayer__Q44nw4r3snd6detail10BasicSoundFPQ44nw4r3snd6detail19ExternalSoundPlayer = .text:0x80469ED0; // type:function size:0xC FUN_80469ee0 = .text:0x80469EE0; // type:function size:0x24 -nw4r__snd__detail__BasicSound__GetVoiceOutCount = .text:0x80469F10; // type:function size:0x8 +GetVoiceOutCount__Q44nw4r3snd6detail10BasicSoundCFv = .text:0x80469F10; // type:function size:0x8 SetPlayerPriority__Q44nw4r3snd6detail10BasicSoundFi = .text:0x80469F20; // type:function size:0x58 OnUpdatePlayerPriority__Q44nw4r3snd6detail10BasicSoundFv = .text:0x80469F80; // type:function size:0x4 SetInitialVolume__Q44nw4r3snd6detail10BasicSoundFf = .text:0x80469F90; // type:function size:0x18 @@ -25384,7 +25384,7 @@ ChannelCallback__Q44nw4r3snd6detail9SeqPlayerFPQ44nw4r3snd6detail7Channel = .tex @192@__dt__Q44nw4r3snd6detail9SeqPlayerFv = .text:0x804727F0; // type:function size:0x8 __ct__Q44nw4r3snd6detail8SeqSoundFPQ44nw4r3snd6detail49SoundInstanceManagerii = .text:0x80472800; // type:function size:0x9C __dt__Q54nw4r3snd6detail8SeqSound11SeqLoadTaskFv = .text:0x804728A0; // type:function size:0x58 -nw4r__snd__detail__SeqSound__InitParam = .text:0x80472900; // type:function size:0x34 +InitParam__Q44nw4r3snd6detail8SeqSoundFv = .text:0x80472900; // type:function size:0x34 Setup__Q44nw4r3snd6detail8SeqSoundFPQ44nw4r3snd6detail17SeqTrackAllocatorUlPQ44nw4r3snd6detail14NoteOnCallback = .text:0x80472940; // type:function size:0x7C Prepare__Q44nw4r3snd6detail8SeqSoundFPCvlQ54nw4r3snd6detail9SeqPlayer10OffsetTypei = .text:0x804729C0; // type:function size:0x68 Prepare__Q44nw4r3snd6detail8SeqSoundFPQ34nw4r2ut10FileStreamlQ54nw4r3snd6detail9SeqPlayer10OffsetTypei = .text:0x80472A30; // type:function size:0xF4 @@ -25413,7 +25413,7 @@ GetBasicPlayer__Q44nw4r3snd6detail8SeqSoundFv = .text:0x80473120; // type:functi GetBasicPlayer__Q44nw4r3snd6detail8SeqSoundCFv = .text:0x80473130; // type:function size:0x8 IsPrepared__Q44nw4r3snd6detail8SeqSoundCFv = .text:0x80473140; // type:function size:0x8 GetRuntimeTypeInfo__Q44nw4r3snd6detail8SeqSoundCFv = .text:0x80473150; // type:function size:0x8 scope:weak -__sinit_snd_SeqSound_cpp = .text:0x80473160; // type:function size:0xC scope:local +__sinit_\snd_SeqSound_cpp = .text:0x80473160; // type:function size:0xC scope:local __ct__Q34nw4r3snd14SeqSoundHandleFPQ34nw4r3snd11SoundHandle = .text:0x80473170; // type:function size:0xF4 DetachSound__Q34nw4r3snd14SeqSoundHandleFv = .text:0x80473270; // type:function size:0x38 SetPlayerTrackNo__Q44nw4r3snd6detail8SeqTrackFi = .text:0x804732B0; // type:function size:0x8 @@ -25608,14 +25608,14 @@ GetRemoteOutVolume__Q34nw4r3snd11SoundPlayerCFi = .text:0x8047B7D0; // type:func SetFxSend__Q34nw4r3snd11SoundPlayerFQ34nw4r3snd6AuxBusf = .text:0x8047B7E0; // type:function size:0x10 detail_SortPriorityList__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10BasicSound = .text:0x8047B7F0; // type:function size:0xF8 detail_SortPriorityList__Q34nw4r3snd11SoundPlayerFv = .text:0x8047B8F0; // type:function size:0x184 -__arraydtor,226 = .text:0x8047BA80; // type:function size:0x1C +__arraydtor$1018 = .text:0x8047BA80; // type:function size:0x1C detail_AppendSound__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10BasicSound = .text:0x8047BAA0; // type:function size:0x1DC detail_RemoveSound__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10BasicSound = .text:0x8047BC80; // type:function size:0x88 SetPlayableSoundCount__Q34nw4r3snd11SoundPlayerFi = .text:0x8047BD10; // type:function size:0x90 detail_SetPlayableSoundLimit__Q34nw4r3snd11SoundPlayerFi = .text:0x8047BDA0; // type:function size:0x8 detail_CanPlaySound__Q34nw4r3snd11SoundPlayerFi = .text:0x8047BDB0; // type:function size:0xDC detail_AppendPlayerHeap__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10PlayerHeap = .text:0x8047BE90; // type:function size:0x68 -detail_RemovePlayerHeap__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10PlayerHeap = .text:0x8047BF00; // type:function size:0xA8 +detail_AllocPlayerHeap__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10BasicSound = .text:0x8047BF00; // type:function size:0xA8 detail_FreePlayerHeap__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10BasicSound = .text:0x8047BFB0; // type:function size:0xA0 detail_StartSound__Q34nw4r3snd14SoundStartableFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14SoundStartable9StartInfo = .text:0x8047C050; // type:function size:0x60 detail_StartSound__Q34nw4r3snd14SoundStartableFPQ34nw4r3snd11SoundHandlePCcPCQ44nw4r3snd14SoundStartable9StartInfo = .text:0x8047C0B0; // type:function size:0xAC @@ -25628,7 +25628,7 @@ GetRequiredMemSize__Q34nw4r3snd11SoundSystemFRCQ44nw4r3snd11SoundSystem16SoundSy InitSoundSystem__Q34nw4r3snd11SoundSystemFRCQ44nw4r3snd11SoundSystem16SoundSystemParamPvUl = .text:0x8047C480; // type:function size:0x1AC IsInitializedSoundSystem__Q34nw4r3snd11SoundSystemFv = .text:0x8047C630; // type:function size:0x8 WaitForResetReady__Q34nw4r3snd11SoundSystemFv = .text:0x8047C640; // type:function size:0x74 -__sinit_snd_SoundSystem_cpp = .text:0x8047C6C0; // type:function size:0x48 scope:local +__sinit_\snd_SoundSystem_cpp = .text:0x8047C6C0; // type:function size:0x48 scope:local GetInstance__Q44nw4r3snd6detail11SoundThreadFv = .text:0x8047C710; // type:function size:0xB8 __dt__Q44nw4r3snd6detail11SoundThreadFv = .text:0x8047C7D0; // type:function size:0x70 Create__Q44nw4r3snd6detail11SoundThreadFlPvUl = .text:0x8047C840; // type:function size:0x12C @@ -25713,7 +25713,7 @@ GetBasicPlayer__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480D40; // type:funct GetBasicPlayer__Q44nw4r3snd6detail9StrmSoundCFv = .text:0x80480D50; // type:function size:0x8 IsPrepared__Q44nw4r3snd6detail9StrmSoundCFv = .text:0x80480D60; // type:function size:0x8 GetRuntimeTypeInfo__Q44nw4r3snd6detail9StrmSoundCFv = .text:0x80480D70; // type:function size:0x8 scope:weak -__sinit_snd_StrmSound_cpp = .text:0x80480D80; // type:function size:0xC scope:local +__sinit_\snd_StrmSound_cpp = .text:0x80480D80; // type:function size:0xC scope:local __ct__Q34nw4r3snd15StrmSoundHandleFPQ34nw4r3snd11SoundHandle = .text:0x80480D90; // type:function size:0xF4 DetachSound__Q34nw4r3snd15StrmSoundHandleFv = .text:0x80480E90; // type:function size:0x38 __dt__Q44nw4r3snd6detail4TaskFv = .text:0x80480ED0; // type:function size:0x40 @@ -25816,8 +25816,8 @@ GetBasicPlayer__Q44nw4r3snd6detail9WaveSoundFv = .text:0x804852D0; // type:funct GetBasicPlayer__Q44nw4r3snd6detail9WaveSoundCFv = .text:0x804852E0; // type:function size:0x8 IsPrepared__Q44nw4r3snd6detail9WaveSoundCFv = .text:0x804852F0; // type:function size:0x8 GetRuntimeTypeInfo__Q44nw4r3snd6detail9WaveSoundCFv = .text:0x80485300; // type:function size:0x8 scope:weak -__sinit_snd_WaveSound_cpp = .text:0x80485310; // type:function size:0xC scope:local -detail_AttachSoundAsTempHandle__Q34nw4r3snd15WaveSoundHandleFPQ44nw4r3snd6detail9WaveSound = .text:0x80485320; // type:function size:0xF4 +__sinit_\snd_WaveSound_cpp = .text:0x80485310; // type:function size:0xC scope:local +__ct__Q34nw4r3snd15WaveSoundHandleFPQ34nw4r3snd11SoundHandle = .text:0x80485320; // type:function size:0xF4 DetachSound__Q34nw4r3snd15WaveSoundHandleFv = .text:0x80485420; // type:function size:0x38 __ct__Q44nw4r3snd6detail13WsdFileReaderFPCv = .text:0x80485460; // type:function size:0x90 ReadWaveSoundInfo__Q44nw4r3snd6detail13WsdFileReaderCFPQ44nw4r3snd6detail13WaveSoundInfoi = .text:0x804854F0; // type:function size:0x120 diff --git a/include/common.h b/include/common.h index 97a31a58..3dbf5b4d 100644 --- a/include/common.h +++ b/include/common.h @@ -13,6 +13,7 @@ #define ROUND_DOWN_PTR(x, align) ((void *)(((u32)(x)) & (~((align) - 1)))) #define ARRAY_LENGTH(x) (sizeof((x)) / sizeof((x)[0])) +#define BOOLIFY_TERNARY(expr_) ((expr_) ? 1 : 0) #define CLEAR_PATH(x) __memclr((x), sizeof((x))) @@ -49,6 +50,10 @@ #define __alloca(x) ((void *)x) #endif +#define ATTR_FALLTHROUGH +#define ATTR_UNUSED +#define ATTR_MAYBE_UNUSED + #ifdef NON_MATCHING #define DECOMP_FORCEACTIVE(module, ...) #define DECOMP_FORCELITERAL(module, x) @@ -60,6 +65,25 @@ #define __CONCAT(x, y) x##y #define CONCAT(x, y) __CONCAT(x, y) +#define STR_(x) #x +#define STR(x) STR_(x) + +#ifndef alignas +# define alignas ATTR_ALIGN +#endif + +#ifndef decltype +# define decltype __decltype__ +#endif + +#ifndef static_assert +# define static_assert __static_assert +#endif + +#ifndef typeof +# define typeof __typeof__ +#endif + #define DECOMP_FORCEACTIVE(module, ...) \ void fake_function(...); \ void CONCAT(FORCEACTIVE##module, __LINE__)(void); \ diff --git a/include/decomp.h b/include/decomp.h new file mode 100644 index 00000000..f678e0d8 --- /dev/null +++ b/include/decomp.h @@ -0,0 +1,111 @@ +#ifndef DECOMP_H +#define DECOMP_H + +/******************************************************************************* + * headers + */ + +/******************************************************************************* + * Macro helpers + */ + +#define DF_CONCAT3_(a, b, c) a ## b ## c +#define DF_CONCAT3(a, b, c) DF_CONCAT3_(a, b, c) + +#define DF_UNIQUE_IDENT(ident_) DF_CONCAT3(ident_, _, __LINE__) + +#define DF_TYPEOF typeof + +#define DF_SWALLOW_SEMICOLON() static_assert(1, "") + +#if defined(__clang__) + +# define DF_SUPPRESS_WARNINGS() \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wnull-dereference\"") +# define DF_UNSUPPRESS_WARNINGS() \ + _Pragma("clang diagnostic pop") + +#elif defined(__MWERKS__) + +# pragma section RX ".decomp" + +# define DF_SUPPRESS_WARNINGS() __attribute__((section(".decomp"))) +# define DF_UNSUPPRESS_WARNINGS() + +#else + +# define DF_SUPPRESS_WARNINGS() +# define DF_UNSUPPRESS_WARNINGS() + +#endif + +/******************************************************************************* + * DECOMP_FORCE macro internals + */ + +#define DF_FUNCTION_DECLARATOR_WITH_PROTO(ident_) \ + extern void (ident_)(void); \ + extern void (ident_)(void) + +// this is done to prevent default promotion of arguments to variadic functions +#define DF_FUNCTION_CALL(ident_, arg_) \ + extern void (ident_)(DF_TYPEOF(arg_)); \ + (ident_)(arg_) + +/******************************************************************************* + * DECOMP_FORCE macros + */ + +/* Forcefully generate orphaned data, early references, or other shenanigans. + * Only works at file or namespace scope. + * + * Examples: + * DECOMP_FORCE(1.0f); + * DECOMP_FORCE("I am a string"); + * DECOMP_FORCE(UI2D_CONSTANT); + */ + +#define DECOMP_FORCE(arg_) \ + DF_SUPPRESS_WARNINGS() \ + DF_FUNCTION_DECLARATOR_WITH_PROTO(DF_UNIQUE_IDENT(DECOMP_FORCE)) \ + { \ + DF_FUNCTION_CALL(DF_UNIQUE_IDENT(DECOMP_FORCE_CALL), arg_); \ + } \ + DF_UNSUPPRESS_WARNINGS() \ + DF_SWALLOW_SEMICOLON() + +/* Forcefully instantiate a class's method. For method_, write it as you would + * an actual function call. + * Only works at file or namespace scope. + * + * If class_ uses commas outside of nested parentheses, you must enclose the + * entire argument in DF_TYPEOF(). If method_ uses commas outside of nested + * parentheses, they are handled via __VA_ARGS__. + * + * Examples: + * DECOMP_FORCE_CLASS_METHOD(Class1, ~Class1()); + * DECOMP_FORCE_CLASS_METHOD(DF_TYPEOF(Class2), func(2, 3)); + * DECOMP_FORCE_CLASS_METHOD(Class3, operator ,(4)); + */ + +#if defined(__cplusplus) +# define DECOMP_FORCE_CLASS_METHOD(class_, ...) \ + DECOMP_FORCE(((void)(static_cast(0)->__VA_ARGS__), 0)) +#endif + +/******************************************************************************* + * DECOMP_FORCE helpers + */ + +// Conversion constants from integer to floating-point + +extern signed int DECOMP_SI; +extern unsigned int DECOMP_UI; + +#define SI2D_CONSTANT ((float)(DECOMP_SI)) +#define UI2D_CONSTANT ((float)(DECOMP_UI)) + +// clang-format on + +#endif // DECOMP_H diff --git a/include/nw4r/snd/snd_AxManager.h b/include/nw4r/snd/snd_AxManager.h index c4a248fb..fe7d02d5 100644 --- a/include/nw4r/snd/snd_AxManager.h +++ b/include/nw4r/snd/snd_AxManager.h @@ -5,22 +5,20 @@ * headers */ -#include +#include "common.h" -#include "global.h" -#include "FxBase.h" -#include "MoveValue.h" +#include "nw4r/snd/snd_global.h" -#include "../ut/LinkList.h" +#include "nw4r/snd/snd_FxBase.h" +#include "nw4r/snd/snd_MoveValue.h" -#if 0 -#include // AIDMACallback -#include // AXAuxCallback -#include // AXFrameCallback -#else -#include -#endif +#include "nw4r/ut/ut_LinkList.h" + +#include // AIDMACallback +#include +#include // AX_MAX_VOLUME +#include // AXAuxCallback +#include // AXFrameCallback #include "nw4r/NW4RAssert.hpp" @@ -94,8 +92,16 @@ namespace nw4r { namespace snd { namespace detail AXFrameCallback *callback); void UnregisterCallback(CallbackListNode *node); + bool AppendEffect(AuxBus bus, FxBase *pFx); + void ClearEffect(AuxBus bus, int frame); void ShutdownEffect(AuxBus bus); + f32 GetMasterVolume() const { + return mMasterVolume.GetValue(); + } + void SetMasterVolume(f32 volume, int frame); + void PrepareReset(); + private: // cdtors AxManager(); @@ -139,7 +145,7 @@ namespace nw4r { namespace snd { namespace detail MoveValue mAuxFadeVolume[AUX_BUS_NUM]; // size 0x30, offset 0x54 MoveValue mAuxUserVolume[AUX_BUS_NUM]; // size 0x30, offset 0x84 FxBase::LinkList mFxList[AUX_BUS_NUM]; // size 0x24, offset 0xb4 - AXAuxCallback *mAuxCallback[AUX_BUS_NUM]; // size 0x0c, offset 0xd8 + AXAuxCallback mAuxCallback[AUX_BUS_NUM]; // size 0x0c, offset 0xd8 void *mAuxCallbackContext[AUX_BUS_NUM]; // size 0x0c, offset 0xe4 u8 mAuxCallbackWaitCounter[AUX_BUS_NUM]; // size 0x03, offset 0xf0 /* 1 byte padding */ diff --git a/include/nw4r/snd/snd_AxVoice.h b/include/nw4r/snd/snd_AxVoice.h index 1a9bf7d3..45bd9575 100644 --- a/include/nw4r/snd/snd_AxVoice.h +++ b/include/nw4r/snd/snd_AxVoice.h @@ -5,20 +5,17 @@ * headers */ -#include +#include "common.h" -#include "adpcm.h" -#include "global.h" // SampleFormat +#include "nw4r/snd/snd_adpcm.h" +#include "nw4r/snd/snd_global.h" // SampleFormat -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_LinkList.h" -#if 0 -#include -#include // AXSetVoicePriority -#include -#else -#include -#endif +#include +#include +#include // AXSetVoicePriority +#include /******************************************************************************* * classes and functions @@ -139,7 +136,7 @@ namespace nw4r { namespace snd { namespace detail // members private: AXVPB *mVpb; // size 0x04, offset 0x00 - byte4_t mSync; // size 0x04, offset 0x04 + u32 mSync; // size 0x04, offset 0x04 AXPBVE volatile mPrevVeSetting; // size 0x04, offset 0x08 bool mFirstVeUpdateFlag; // size 0x01, offset 0x0c /* 1 byte padding */ diff --git a/include/nw4r/snd/snd_AxVoiceManager.h b/include/nw4r/snd/snd_AxVoiceManager.h index d0cba1de..370a4281 100644 --- a/include/nw4r/snd/snd_AxVoiceManager.h +++ b/include/nw4r/snd/snd_AxVoiceManager.h @@ -5,9 +5,9 @@ * headers */ -#include // u32 +#include "common.h" // u32 -#include "AxVoice.h" +#include "nw4r/snd/snd_AxVoice.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_Bank.h b/include/nw4r/snd/snd_Bank.h index 1099134a..3bc99094 100644 --- a/include/nw4r/snd/snd_Bank.h +++ b/include/nw4r/snd/snd_Bank.h @@ -5,7 +5,7 @@ * headers */ -#include "BankFile.h" // BankFileReader +#include "nw4r/snd/snd_BankFile.h" // BankFileReader #include "nw4r/NW4RAssert.hpp" diff --git a/include/nw4r/snd/snd_BankFile.h b/include/nw4r/snd/snd_BankFile.h index af565729..f9f83dda 100644 --- a/include/nw4r/snd/snd_BankFile.h +++ b/include/nw4r/snd/snd_BankFile.h @@ -5,14 +5,13 @@ * headers */ -#include -#include +#include "common.h" -#include "WaveFile.h" +#include "nw4r/snd/snd_WaveFile.h" -#include "Util.h" +#include "nw4r/snd/snd_Util.h" -#include "../ut/binaryFileFormat.h" +#include "nw4r/ut/ut_binaryFileFormat.h" /******************************************************************************* * types @@ -57,13 +56,13 @@ namespace nw4r { namespace snd { namespace detail u8 originalKey; // size 0x01, offset 0x0c u8 volume; // size 0x01, offset 0x0d u8 pan; // size 0x01, offset 0x0e - byte1_t padding2; // 2? + u8 padding2; // 2? f32 tune; // size 0x04, offset 0x10 // TODO: template parameters Util::DataRef lfoTableRef; // size 0x08, offset 0x14 Util::DataRef graphEnvTablevRef; // size 0x08, offset 0x1c Util::DataRef randomizerTableRef; // size 0x08, offset 0x24 - byte4_t reserved; + u32 reserved; }; // size 0x30 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b2114 @@ -78,14 +77,14 @@ namespace nw4r { namespace snd { namespace detail { u8 min; // size 0x01, offset 0x00 u8 max; // size 0x01, offset 0x01 - byte2_t reserved; + u16 reserved; byte_t ref[]; // flexible, offset 0x04 (unit size 0x01) }; // size 0x04 typedef Util::DataRef DataRegion; - static byte4_t const SIGNATURE_DATA_BLOCK = + static u32 const SIGNATURE_DATA_BLOCK = NW4R_FOUR_BYTE('D', 'A', 'T', 'A'); // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b006b @@ -97,7 +96,7 @@ namespace nw4r { namespace snd { namespace detail /* WaveBlock */ - static byte4_t const SIGNATURE_WAVE_BLOCK = + static u32 const SIGNATURE_WAVE_BLOCK = NW4R_FOUR_BYTE('W', 'A', 'V', 'E'); typedef Util::DataRef WaveRegion; @@ -110,7 +109,7 @@ namespace nw4r { namespace snd { namespace detail /* BankFile */ - static byte4_t const SIGNATURE_FILE = + static u32 const SIGNATURE_FILE = NW4R_FOUR_BYTE('R', 'B', 'N', 'K'); static int const FILE_VERSION = NW4R_FILE_VERSION(1, 2); }; // "namespace" BankFile diff --git a/include/nw4r/snd/snd_BasicPlayer.h b/include/nw4r/snd/snd_BasicPlayer.h index e22fbe30..ccd5d31e 100644 --- a/include/nw4r/snd/snd_BasicPlayer.h +++ b/include/nw4r/snd/snd_BasicPlayer.h @@ -5,9 +5,9 @@ * headers */ -#include +#include "common.h" -#include "global.h" +#include "nw4r/snd/snd_global.h" /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_BasicSound.h b/include/nw4r/snd/snd_BasicSound.h index 7a043893..bf09bcbe 100644 --- a/include/nw4r/snd/snd_BasicSound.h +++ b/include/nw4r/snd/snd_BasicSound.h @@ -5,13 +5,13 @@ * headers */ -#include +#include "common.h" -#include "global.h" -#include "MoveValue.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_MoveValue.h" -#include "../ut/inlines.h" // ut::Clamp -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_algorithm.h" // ut::Clamp +#include "nw4r/ut/ut_LinkList.h" /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_BiquadFilterCallback.h b/include/nw4r/snd/snd_BiquadFilterCallback.h index 4c8d341c..7a9e4ae9 100644 --- a/include/nw4r/snd/snd_BiquadFilterCallback.h +++ b/include/nw4r/snd/snd_BiquadFilterCallback.h @@ -5,7 +5,7 @@ * headers */ -#include +#include "common.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_BiquadFilterPreset.h b/include/nw4r/snd/snd_BiquadFilterPreset.h index 85c15a33..5331fd16 100644 --- a/include/nw4r/snd/snd_BiquadFilterPreset.h +++ b/include/nw4r/snd/snd_BiquadFilterPreset.h @@ -5,9 +5,9 @@ * headers */ -#include // f32 +#include "common.h" // f32 -#include "BiquadFilterCallback.h" +#include "nw4r/snd/snd_BiquadFilterCallback.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_Channel.h b/include/nw4r/snd/snd_Channel.h index 2f2014ac..553517c3 100644 --- a/include/nw4r/snd/snd_Channel.h +++ b/include/nw4r/snd/snd_Channel.h @@ -7,16 +7,16 @@ #include // USHRT_MAX -#include +#include "common.h" -#include "EnvGenerator.h" -#include "InstancePool.h" -#include "global.h" -#include "Lfo.h" -#include "MoveValue.h" -#include "Voice.h" +#include "nw4r/snd/snd_EnvGenerator.h" +#include "nw4r/snd/snd_InstancePool.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_Lfo.h" +#include "nw4r/snd/snd_MoveValue.h" +#include "nw4r/snd/snd_Voice.h" -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_LinkList.h" #include "nw4r/NW4RAssert.hpp" @@ -61,7 +61,7 @@ namespace nw4r { namespace snd { namespace detail public: typedef void Callback(Channel *dropChannel, ChannelCallbackStatus status, - register_t userData); + u32 userData); typedef ut::LinkList LinkList; @@ -70,12 +70,12 @@ namespace nw4r { namespace snd { namespace detail // instance managers static Channel *AllocChannel(int voiceChannelCount, int voiceOutCount, int priority, Callback *callback, - register_t callbackData); + u32 callbackData); static void FreeChannel(Channel *channel); // methods - void InitParam(Callback *callback, register_t callbackData); + void InitParam(Callback *callback, u32 callbackData); void Start(WaveInfo const &waveParam, int length, u32 startOffset); void Pause(bool flag) { @@ -225,7 +225,7 @@ namespace nw4r { namespace snd { namespace detail PanCurve mPanCurve; // size 0x04, offset 0xa8 int mAlternateAssign; // size 0x04, offset 0xac Callback *mCallback; // size 0x04, offset 0xb0 - register_t mCallbackData; // size 0x04, offset 0xb4 + u32 mCallbackData; // size 0x04, offset 0xb4 WaveDataLocationCallback *mWaveDataLocationCallback; // size 0x04, offset 0xb8 WaveInfo const *mWaveInfo; // size 0x04, offset 0xbc Voice *mVoice; // size 0x04, offset 0xc0 diff --git a/include/nw4r/snd/snd_DisposeCallbackManager.h b/include/nw4r/snd/snd_DisposeCallbackManager.h index 329a7ed0..d107c354 100644 --- a/include/nw4r/snd/snd_DisposeCallbackManager.h +++ b/include/nw4r/snd/snd_DisposeCallbackManager.h @@ -5,9 +5,9 @@ * headers */ -#include // u32 +#include "common.h" // u32 -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_LinkList.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_DvdSoundArchive.h b/include/nw4r/snd/snd_DvdSoundArchive.h index 5f05da48..e6a6eeb7 100644 --- a/include/nw4r/snd/snd_DvdSoundArchive.h +++ b/include/nw4r/snd/snd_DvdSoundArchive.h @@ -5,13 +5,15 @@ * headers */ -#include +#include "common.h" // WARNING: DO NOT REORDER these #include directives, data pooling depends on it // clang-format off -#include "../ut/FileStream.h" // This needs to be -#include "SoundArchive.h" // before this +#include "nw4r/ut/ut_FileStream.h" // This needs to be +#include "nw4r/snd/snd_SoundArchive.h" // before this +#include "nw4r/snd/snd_SoundArchiveFile.h" // before this +#include "rvl/DVD/dvd.h" // clang-format on /******************************************************************************* @@ -22,8 +24,51 @@ namespace nw4r { namespace snd { class DvdSoundArchive : public SoundArchive { + public: class DvdFileStream; DvdSoundArchive(); + virtual ~DvdSoundArchive(); // at 0x8 + + virtual const void *detail_GetFileAddress(u32 /* id */) const { + return NULL; + } // at 0xC + + virtual const void *detail_GetWaveDataFileAddress(u32 /* id */) const { + return NULL; + } // at 0x10 + + virtual int detail_GetRequiredStreamBufferSize() const; // at 0x14 + + virtual ut::FileStream *OpenStream(void *pBuffer, int size, u32 offset, + u32 length) const; // at 0x18 + + virtual ut::FileStream *OpenExtStream( + void *pBuffer, int size, const char *pExtPath, u32 offset, + u32 length + ) const; // at 0x1C + + bool Open(s32 entrynum); + bool Open(const char *pPath); + + void Close(); + + bool LoadHeader(void *pBuffer, u32 size); + bool LoadLabelStringData(void *pBuffer, u32 size); + + u32 GetHeaderSize() const { + return mFileReader.GetInfoChunkSize(); + } + u32 GetLabelStringDataSize() const { + return mFileReader.GetLabelStringChunkSize(); + } + + private: + bool LoadFileHeader(); + + private: + detail::SoundArchiveFileReader mFileReader; // at 0x108 + DVDFileInfo mFileInfo; // at 0x14C + bool mOpen; // at 0x188 }; class DvdSoundArchive::DvdFileStream : public ut::FileStream diff --git a/include/nw4r/snd/snd_EnvGenerator.h b/include/nw4r/snd/snd_EnvGenerator.h index 1081431c..3d34abc9 100644 --- a/include/nw4r/snd/snd_EnvGenerator.h +++ b/include/nw4r/snd/snd_EnvGenerator.h @@ -5,7 +5,7 @@ * headers */ -#include +#include "common.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_ExternalSoundPlayer.h b/include/nw4r/snd/snd_ExternalSoundPlayer.h index 9def7269..870caa40 100644 --- a/include/nw4r/snd/snd_ExternalSoundPlayer.h +++ b/include/nw4r/snd/snd_ExternalSoundPlayer.h @@ -5,7 +5,7 @@ * headers */ -#include "BasicSound.h" +#include "nw4r/snd/snd_BasicSound.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_FxBase.h b/include/nw4r/snd/snd_FxBase.h index 97b0ff0d..187b105e 100644 --- a/include/nw4r/snd/snd_FxBase.h +++ b/include/nw4r/snd/snd_FxBase.h @@ -5,12 +5,12 @@ * headers */ -#include +#include "common.h" -#include "global.h" +#include "nw4r/snd/snd_global.h" -#include "../ut/inlines.h" // NonCopyable -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_NonCopyable.h" // NonCopyable +#include "nw4r/ut/ut_LinkList.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_InstancePool.h b/include/nw4r/snd/snd_InstancePool.h index 6a3d0f8b..90cdd0d9 100644 --- a/include/nw4r/snd/snd_InstancePool.h +++ b/include/nw4r/snd/snd_InstancePool.h @@ -7,7 +7,7 @@ #include -#include +#include "common.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_Lfo.h b/include/nw4r/snd/snd_Lfo.h index 8fe8544b..780c813f 100644 --- a/include/nw4r/snd/snd_Lfo.h +++ b/include/nw4r/snd/snd_Lfo.h @@ -5,7 +5,7 @@ * headers */ -#include +#include "common.h" /******************************************************************************* * classes and functions @@ -30,7 +30,7 @@ namespace nw4r { namespace snd { namespace detail f32 speed; // size 0x04, offset 0x04 u32 delay; // size 0x04, offset 0x08 u8 range; // size 0x01, offset 0x0c - byte1_t padding[3]; + u8 padding[3]; }; // size 0x10 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x28ea0 diff --git a/include/nw4r/snd/snd_McsSoundArchive.h b/include/nw4r/snd/snd_McsSoundArchive.h index 1990634a..4a323fad 100644 --- a/include/nw4r/snd/snd_McsSoundArchive.h +++ b/include/nw4r/snd/snd_McsSoundArchive.h @@ -5,11 +5,11 @@ * headers */ -#include +#include "common.h" #include "SoundArchive.h" -#include "../ut/FileStream.h" +#include "nw4r/ut/ut_FileStream.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_MemorySoundArchive.h b/include/nw4r/snd/snd_MemorySoundArchive.h index 48a86ec5..90f389fa 100644 --- a/include/nw4r/snd/snd_MemorySoundArchive.h +++ b/include/nw4r/snd/snd_MemorySoundArchive.h @@ -5,16 +5,16 @@ * headers */ -#include +#include "common.h" // WARNING: DO NOT REORDER these #include directives, data pooling depends on it // clang-format off -#include "../ut/FileStream.h" // This needs to be -#include "SoundArchive.h" // before this +#include "nw4r/ut/ut_FileStream.h" // This needs to be +#include "nw4r/snd/snd_SoundArchive.h" // before this // clang-format on -#include "SoundArchiveFile.h" +#include "nw4r/snd/snd_SoundArchiveFile.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_MidiSeqPlayer.h b/include/nw4r/snd/snd_MidiSeqPlayer.h index 744537b0..76f36e2a 100644 --- a/include/nw4r/snd/snd_MidiSeqPlayer.h +++ b/include/nw4r/snd/snd_MidiSeqPlayer.h @@ -5,7 +5,7 @@ * headers */ -#include "SeqPlayer.h" +#include "nw4r/snd/snd_SeqPlayer.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_MmlParser.h b/include/nw4r/snd/snd_MmlParser.h index b4884a21..2eb9690c 100644 --- a/include/nw4r/snd/snd_MmlParser.h +++ b/include/nw4r/snd/snd_MmlParser.h @@ -5,9 +5,9 @@ * headers */ -#include +#include "common.h" -#include "MmlSeqTrack.h" +#include "nw4r/snd/snd_MmlSeqTrack.h" /******************************************************************************* * classes and functions @@ -165,12 +165,12 @@ namespace nw4r { namespace snd { namespace detail } static u32 ParseAllocTrack(void const *baseAddress, u32 seqOffset, - byte4_t *allocTrack); + u32 *allocTrack); private: - byte1_t ReadByte(byte_t const **ptr) const { return *(*ptr)++; } - byte2_t Read16(byte_t const **ptr) const; - byte4_t Read24(byte_t const **ptr) const; + u8 ReadByte(byte_t const **ptr) const { return *(*ptr)++; } + u16 Read16(byte_t const **ptr) const; + u32 Read24(byte_t const **ptr) const; s32 ReadVar(byte_t const **ptr) const; s32 ReadArg(byte_t const **ptr, SeqPlayer *player, SeqTrack *track, SeqArgType argType) const; diff --git a/include/nw4r/snd/snd_MmlSeqTrack.h b/include/nw4r/snd/snd_MmlSeqTrack.h index 3011d1fb..c45b5fd2 100644 --- a/include/nw4r/snd/snd_MmlSeqTrack.h +++ b/include/nw4r/snd/snd_MmlSeqTrack.h @@ -5,7 +5,7 @@ * headers */ -#include "SeqTrack.h" +#include "nw4r/snd/snd_SeqTrack.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_MmlSeqTrackAllocator.h b/include/nw4r/snd/snd_MmlSeqTrackAllocator.h index d9fa8fb6..ef0094ea 100644 --- a/include/nw4r/snd/snd_MmlSeqTrackAllocator.h +++ b/include/nw4r/snd/snd_MmlSeqTrackAllocator.h @@ -5,10 +5,10 @@ * headers */ -#include // u32 +#include "common.h" // u32 -#include "InstancePool.h" -#include "SeqTrackAllocator.h" +#include "nw4r/snd/snd_InstancePool.h" +#include "nw4r/snd/snd_SeqTrackAllocator.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_NoteOnCallback.h b/include/nw4r/snd/snd_NoteOnCallback.h index 5d22ab65..68143e26 100644 --- a/include/nw4r/snd/snd_NoteOnCallback.h +++ b/include/nw4r/snd/snd_NoteOnCallback.h @@ -5,9 +5,9 @@ * headers */ -#include // register_t +#include "common.h" // u32 -#include "Channel.h" +#include "nw4r/snd/snd_Channel.h" /******************************************************************************* * types @@ -29,7 +29,7 @@ namespace nw4r { namespace snd { namespace detail int priority; // size 0x04, offset 0x14 int voiceOutCount; // size 0x04, offset 0x18 Channel::Callback *channelCallback; // size 0x04, offset 0x1c - register_t channelCallbackData; // size 0x04, offset 0x20 + u32 channelCallbackData; // size 0x04, offset 0x20 }; // size 0x24 }}} // namespace nw4r::snd::detail diff --git a/include/nw4r/snd/snd_PlayerHeap.h b/include/nw4r/snd/snd_PlayerHeap.h index 3fa0e766..ae67e8b2 100644 --- a/include/nw4r/snd/snd_PlayerHeap.h +++ b/include/nw4r/snd/snd_PlayerHeap.h @@ -5,11 +5,11 @@ * headers */ -#include // u32 +#include "common.h" // u32 -#include "SoundMemoryAllocatable.h" +#include "nw4r/snd/snd_SoundMemoryAllocatable.h" -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_LinkList.h" /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_RemoteSpeakerManager.h b/include/nw4r/snd/snd_RemoteSpeakerManager.h index 79ebd56d..a00eb327 100644 --- a/include/nw4r/snd/snd_RemoteSpeakerManager.h +++ b/include/nw4r/snd/snd_RemoteSpeakerManager.h @@ -21,7 +21,7 @@ public: private: static const int SPEAKER_ALARM_HZ = 150; - static const int SPEAKER_ALARM_PERIOD_NSEC = static_cast(1.0f / SPEAKER_ALARM_HZ * 1000 * 1000 * 1000); + // static const int SPEAKER_ALARM_PERIOD_NSEC = 1.0f / SPEAKER_ALARM_HZ * 1000 * 1000 * 1000; private: RemoteSpeakerManager(); diff --git a/include/nw4r/snd/snd_SeqFile.h b/include/nw4r/snd/snd_SeqFile.h index 51801403..53aaac42 100644 --- a/include/nw4r/snd/snd_SeqFile.h +++ b/include/nw4r/snd/snd_SeqFile.h @@ -5,12 +5,11 @@ * headers */ -#include -#include +#include "common.h" -#include "Util.h" // Util::Table +#include "nw4r/snd/snd_Util.h" // Util::Table -#include "../ut/binaryFileFormat.h" +#include "nw4r/ut/ut_binaryFileFormat.h" /******************************************************************************* * types @@ -44,7 +43,7 @@ namespace nw4r { namespace snd { namespace detail /* 3 bytes padding */ }; // size 0x0c - static byte4_t const SIGNATURE_LABEL_BLOCK; + static u32 const SIGNATURE_LABEL_BLOCK; // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2ce7dc struct LabelBlock @@ -55,7 +54,7 @@ namespace nw4r { namespace snd { namespace detail /* DataBlock */ - static byte4_t const SIGNATURE_DATA_BLOCK = + static u32 const SIGNATURE_DATA_BLOCK = NW4R_FOUR_BYTE('D', 'A', 'T', 'A'); // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2ce491 @@ -67,7 +66,7 @@ namespace nw4r { namespace snd { namespace detail /* SeqFile */ - static byte4_t const SIGNATURE_FILE = + static u32 const SIGNATURE_FILE = NW4R_FOUR_BYTE('R', 'S', 'E', 'Q'); static int const FILE_VERSION = NW4R_FILE_VERSION(1, 2); }; // "namespace" SeqFile diff --git a/include/nw4r/snd/snd_SeqPlayer.h b/include/nw4r/snd/snd_SeqPlayer.h index 45d1411d..037df652 100644 --- a/include/nw4r/snd/snd_SeqPlayer.h +++ b/include/nw4r/snd/snd_SeqPlayer.h @@ -5,12 +5,11 @@ * headers */ -#include // ATTR_UNUSED -#include +#include "common.h" -#include "BasicPlayer.h" -#include "DisposeCallbackManager.h" // DisposeCallback -#include "SoundThread.h" +#include "nw4r/snd/snd_BasicPlayer.h" +#include "nw4r/snd/snd_DisposeCallbackManager.h" // DisposeCallback +#include "nw4r/snd/snd_SoundThread.h" /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_SeqSound.h b/include/nw4r/snd/snd_SeqSound.h index 4a258ca1..9bc43214 100644 --- a/include/nw4r/snd/snd_SeqSound.h +++ b/include/nw4r/snd/snd_SeqSound.h @@ -5,14 +5,14 @@ * headers */ -#include +#include "common.h" -#include "BasicSound.h" -#include "debug.h" -#include "SeqPlayer.h" -#include "Task.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_debug.h" +#include "nw4r/snd/snd_SeqPlayer.h" +#include "nw4r/snd/snd_Task.h" -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_LinkList.h" /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_SeqSoundHandle.h b/include/nw4r/snd/snd_SeqSoundHandle.h index c4054a31..745132ad 100644 --- a/include/nw4r/snd/snd_SeqSoundHandle.h +++ b/include/nw4r/snd/snd_SeqSoundHandle.h @@ -5,9 +5,9 @@ * headers */ -#include // nullptr +#include "common.h" // nullptr -#include "../ut/inlines.h" // ut::NonCopyable +#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_SeqTrack.h b/include/nw4r/snd/snd_SeqTrack.h index 32b5fa87..dd013b77 100644 --- a/include/nw4r/snd/snd_SeqTrack.h +++ b/include/nw4r/snd/snd_SeqTrack.h @@ -5,12 +5,12 @@ * headers */ -#include +#include "common.h" -#include "Channel.h" -#include "global.h" // AUX_BUS_NUM -#include "Lfo.h" // LfoParam -#include "MoveValue.h" +#include "nw4r/snd/snd_Channel.h" +#include "nw4r/snd/snd_global.h" // AUX_BUS_NUM +#include "nw4r/snd/snd_Lfo.h" // LfoParam +#include "nw4r/snd/snd_MoveValue.h" /******************************************************************************* * types @@ -170,7 +170,7 @@ namespace nw4r { namespace snd { namespace detail static void ChannelCallbackFunc(Channel *dropChannel, Channel::ChannelCallbackStatus status, - register_t userData); + u32 userData); // static members public: diff --git a/include/nw4r/snd/snd_Sound3DActor.h b/include/nw4r/snd/snd_Sound3DActor.h index 935cc272..339377ac 100644 --- a/include/nw4r/snd/snd_Sound3DActor.h +++ b/include/nw4r/snd/snd_Sound3DActor.h @@ -1,6 +1,7 @@ #ifndef NW4R_SND_SOUND_3D_ACTOR_H #define NW4R_SND_SOUND_3D_ACTOR_H + #include "nw4r/math.h" #include "nw4r/snd/snd_BasicSound.h" #include "nw4r/snd/snd_SoundActor.h" @@ -10,13 +11,13 @@ namespace nw4r { namespace snd { -class Sound3DActor : public detail::SoundActor, public detail::BasicSound::AmbientArgUpdateCallback { +class Sound3DActor : public SoundActor, public detail::BasicSound::AmbientInfo::AmbientArgUpdateCallback { public: Sound3DActor(SoundArchivePlayer &rPlayer, Sound3DManager &rManager); virtual ~Sound3DActor(); // at 0x8 virtual StartResult detail_SetupSound( - SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientArgInfo *pArgInfo, + SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo, detail::ExternalSoundPlayer *pPlayer, bool hold, const StartInfo *pStartInfo ); // at 0xC diff --git a/include/nw4r/snd/snd_Sound3DManager.h b/include/nw4r/snd/snd_Sound3DManager.h index b2d8b076..465e5ea3 100644 --- a/include/nw4r/snd/snd_Sound3DManager.h +++ b/include/nw4r/snd/snd_Sound3DManager.h @@ -10,12 +10,12 @@ namespace nw4r { namespace snd { -class Sound3DManager : public detail::BasicSound::AmbientParamUpdateCallback, - public detail::BasicSound::AmbientArgAllocaterCallback { +class Sound3DManager : public detail::BasicSound::AmbientInfo::AmbientParamUpdateCallback, + public detail::BasicSound::AmbientInfo::AmbientArgAllocaterCallback { public: struct Sound3DActorParam { u32 userParam; // at 0x0 - SoundArchive::Sound3DParam soundParam; // at 0x4 + SoundParam soundParam; // at 0x4 math::VEC3 position; // at 0xC Sound3DActorParam(); diff --git a/include/nw4r/snd/snd_SoundActor.h b/include/nw4r/snd/snd_SoundActor.h index 96754904..eeb1941d 100644 --- a/include/nw4r/snd/snd_SoundActor.h +++ b/include/nw4r/snd/snd_SoundActor.h @@ -5,11 +5,11 @@ * headers */ -#include // nullptr +#include "common.h" // nullptr -#include "BasicSound.h" -#include "ExternalSoundPlayer.h" -#include "SoundStartable.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_ExternalSoundPlayer.h" +#include "nw4r/snd/snd_SoundStartable.h" /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_SoundArchive.h b/include/nw4r/snd/snd_SoundArchive.h index 2da9939c..ed586295 100644 --- a/include/nw4r/snd/snd_SoundArchive.h +++ b/include/nw4r/snd/snd_SoundArchive.h @@ -5,9 +5,9 @@ * headers */ -#include +#include "common.h" -#include "global.h" +#include "nw4r/snd/snd_global.h" /******************************************************************************* * types @@ -107,7 +107,7 @@ namespace nw4r { namespace snd { u32 startPosition; // size 0x04, offset 0x00 u16 allocChannelCount; // size 0x02, offset 0x04 - byte2_t allocTrackFlag; // size 0x02, offset 0x06 + u16 allocTrackFlag; // size 0x02, offset 0x06 }; // size 0x08 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x25c5f diff --git a/include/nw4r/snd/snd_SoundArchiveFile.h b/include/nw4r/snd/snd_SoundArchiveFile.h index 478c80f0..9ef9e60c 100644 --- a/include/nw4r/snd/snd_SoundArchiveFile.h +++ b/include/nw4r/snd/snd_SoundArchiveFile.h @@ -5,14 +5,13 @@ * headers */ -#include -#include +#include "common.h" -#include "SoundArchive.h" -#include "Util.h" +#include "nw4r/snd/snd_SoundArchive.h" +#include "nw4r/snd/snd_Util.h" -#include "../ut/binaryFileFormat.h" -#include "../ut/inlines.h" +#include "nw4r/ut/ut_binaryFileFormat.h" +#include "nw4r/ut/ut_algorithm.h" /******************************************************************************* * types @@ -41,8 +40,8 @@ namespace nw4r { namespace snd { namespace detail // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x24881 struct StringTreeNode { - byte2_t flags; // size 0x02, offset 0x00 - byte2_t bit; // size 0x02, offset 0x02 + u16 flags; // size 0x02, offset 0x00 + u16 bit; // size 0x02, offset 0x02 u32 leftIdx; // size 0x04, offset 0x04 u32 rightIdx; // size 0x04, offset 0x08 u32 strIdx; // size 0x04, offset 0x0c @@ -77,7 +76,7 @@ namespace nw4r { namespace snd { namespace detail StringChunk stringChunk; // size 0x14 }; // size 0x14 - static byte4_t const SIGNATURE_SYMB_BLOCK = + static u32 const SIGNATURE_SYMB_BLOCK = NW4R_FOUR_BYTE('S', 'Y', 'M', 'B'); struct SymbolBlock @@ -108,8 +107,8 @@ namespace nw4r { namespace snd { namespace detail u32 allocTrack; // size 0x04, offset 0x08 u8 channelPriority; // size 0x01, offset 0x0c u8 releasePriorityFix; // size 0x01, offset 0x0d - byte1_t padding[2]; - byte4_t reserved; + u8 padding[2]; + u32 reserved; }; // size 0x14 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x25089 @@ -117,8 +116,8 @@ namespace nw4r { namespace snd { namespace detail { u32 startPosition; // size 0x04, offset 0x00 u16 allocChannelCount; // size 0x02, offset 0x04 - byte2_t allocTrackFlag; // size 0x02, offset 0x06 - byte4_t reserved; + u16 allocTrackFlag; // size 0x02, offset 0x06 + u32 reserved; }; // size 0x0c // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x24f62 @@ -128,8 +127,8 @@ namespace nw4r { namespace snd { namespace detail u32 allocTrack; // size 0x04, offset 0x04 u8 channelPriority; // size 0x01, offset 0x08 u8 releasePriorityFix; // size 0x01, offset 0x09 - byte1_t padding[2]; - byte4_t reserved; + u8 padding[2]; + u32 reserved; }; // size 0x10 typedef Util::DataRef @@ -147,11 +146,11 @@ namespace nw4r { namespace snd { namespace detail u8 soundType; // size 0x01, offset 0x16 u8 remoteFilter; // size 0x01, offset 0x17 SoundInfoRef soundInfoRef; // size 0x08, offset 0x18 - register_t userParam[2]; // size 0x08, offset 0x20 + u32 userParam[2]; // size 0x08, offset 0x20 u8 panMode; // size 0x01, offset 0x28 u8 panCurve; // size 0x01, offset 0x29 u8 actorPlayerId; // size 0x01, offset 0x2a - byte1_t reserved; + u8 reserved; }; // size 0x2c typedef Util::Table > @@ -167,8 +166,8 @@ namespace nw4r { namespace snd { namespace detail u16 strmChannelCount; // size 0x02, offset 0x08 u16 waveSoundCount; // size 0x02, offset 0x0a u16 waveTrackCount; // size 0x02, offset 0x0c - byte2_t padding; - byte4_t reserved; + u16 padding; + u32 reserved; }; // size 0x14 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x24eab @@ -176,7 +175,7 @@ namespace nw4r { namespace snd { namespace detail { u32 stringId; // size 0x04, offset 0x00 u32 fileId; // size 0x04, offset 0x04 - byte4_t reserved; + u32 reserved; }; // size 0x0c typedef Util::Table > BankInfoTable; @@ -186,10 +185,10 @@ namespace nw4r { namespace snd { namespace detail { u32 stringId; // size 0x04, offset 0x00 u8 playableSoundCount; // size 0x01, offset 0x04 - byte1_t padding; - byte2_t padding2; + u8 padding; + u16 padding2; u32 heapSize; // size 0x04, offset 0x08 - byte4_t reserved; + u32 reserved; }; // size 0x10 typedef Util::Table > PlayerInfoTable; @@ -202,7 +201,7 @@ namespace nw4r { namespace snd { namespace detail u32 size; // size 0x04, offset 0x08 u32 waveDataOffset; // size 0x04, offset 0x0c u32 waveDataSize; // size 0x04, offset 0x10 - byte4_t reserved; + u32 reserved; }; // size 0x18 typedef Util::Table > GroupItemInfoTable; @@ -247,7 +246,7 @@ namespace nw4r { namespace snd { namespace detail Util::DataRef soundArchivePlayerInfoRef; // size 0x08, offset 0x28 }; // size 0x30 - static byte4_t const SIGNATURE_INFO_BLOCK = + static u32 const SIGNATURE_INFO_BLOCK = NW4R_FOUR_BYTE('I', 'N', 'F', 'O'); // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2da76d @@ -259,7 +258,7 @@ namespace nw4r { namespace snd { namespace detail /* SoundArchiveFile */ - static byte4_t const SIGNATURE_FILE = + static u32 const SIGNATURE_FILE = NW4R_FOUR_BYTE('R', 'S', 'A', 'R'); static int const FILE_VERSION = NW4R_FILE_VERSION(1, 4); }; // "namespace" SoundArchiveFile diff --git a/include/nw4r/snd/snd_SoundArchivePlayer.h b/include/nw4r/snd/snd_SoundArchivePlayer.h index 8ef77365..3fba7118 100644 --- a/include/nw4r/snd/snd_SoundArchivePlayer.h +++ b/include/nw4r/snd/snd_SoundArchivePlayer.h @@ -5,27 +5,28 @@ * headers */ -#include +#include "common.h" // WARNING: DO NOT REORDER these #include directives, data pooling depends on it // clang-format off -#include "BasicSound.h" -#include "DisposeCallbackManager.h" // detail::DisposeCallback -#include "MmlParser.h" -#include "NoteOnCallback.h" // This needs to be -#include "MmlSeqTrackAllocator.h" // before this -#include "SeqPlayer.h" -#include "SeqSound.h" -#include "SoundArchive.h" -#include "SoundInstanceManager.h" -#include "WsdPlayer.h" // and this needs to be -#include "SoundStartable.h" // before this -#include "StrmChannel.h" // detail::StrmBufferPool -#include "StrmSound.h" -#include "Util.h" // Util::Table -#include "WaveFile.h" -#include "WaveSound.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_DisposeCallbackManager.h" // detail::DisposeCallback +#include "nw4r/snd/snd_MmlParser.h" +#include "nw4r/snd/snd_NoteOnCallback.h" // This needs to be +#include "nw4r/snd/snd_MmlSeqTrackAllocator.h" // before this +#include "nw4r/snd/snd_SeqPlayer.h" +#include "nw4r/snd/snd_SeqSound.h" +#include "nw4r/snd/snd_SoundArchive.h" +#include "nw4r/snd/snd_SoundInstanceManager.h" +#include "nw4r/snd/snd_SoundMemoryAllocatable.h" +#include "nw4r/snd/snd_WsdPlayer.h" // and this needs to be +#include "nw4r/snd/snd_SoundStartable.h" // before this +#include "nw4r/snd/snd_StrmChannel.h" // detail::StrmBufferPool +#include "nw4r/snd/snd_StrmSound.h" +#include "nw4r/snd/snd_Util.h" // Util::Table +#include "nw4r/snd/snd_WaveFile.h" +#include "nw4r/snd/snd_WaveSound.h" // clang-format on #include @@ -128,7 +129,7 @@ namespace nw4r { namespace snd detail::WaveInfo *waveData, void const *waveSoundData, int index, int noteIndex, - register_t userData) const; + u32 userData) const; // members private: @@ -165,6 +166,16 @@ namespace nw4r { namespace snd void *strmBuffer, u32 strmBufferSize); void Shutdown(); + bool LoadGroup(u32 id, SoundMemoryAllocatable *pAllocatable, u32 blockSize); + bool LoadGroup(const char *pLabel, SoundMemoryAllocatable *pAllocatable, u32 blockSize); + + bool LoadGroup(int id, SoundMemoryAllocatable *pAllocatable, u32 blockSize) { + return LoadGroup(static_cast(id), pAllocatable, blockSize); + } + bool LoadGroup(unsigned int id, SoundMemoryAllocatable *pAllocatable, u32 blockSize) { + return LoadGroup(static_cast(id), pAllocatable, blockSize); + } + SoundArchive const &GetSoundArchive() const; u32 GetSoundPlayerCount() const { return mSoundPlayerCount; } SoundPlayer &GetSoundPlayer(u32 playerId); diff --git a/include/nw4r/snd/snd_SoundHandle.h b/include/nw4r/snd/snd_SoundHandle.h index 9a219f3d..e9673ca7 100644 --- a/include/nw4r/snd/snd_SoundHandle.h +++ b/include/nw4r/snd/snd_SoundHandle.h @@ -5,11 +5,11 @@ * headers */ -#include +#include "common.h" -#include "BasicSound.h" +#include "nw4r/snd/snd_BasicSound.h" -#include "../ut/inlines.h" // ut::NonCopyable +#include "nw4r/ut/ut_algorithm.h" // ut::NonCopyable /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_SoundInstanceManager.h b/include/nw4r/snd/snd_SoundInstanceManager.h index d7984f26..c43d546e 100644 --- a/include/nw4r/snd/snd_SoundInstanceManager.h +++ b/include/nw4r/snd/snd_SoundInstanceManager.h @@ -7,19 +7,14 @@ #include -#include -#include +#include "common.h" -#include "InstancePool.h" +#include "nw4r/snd/snd_InstancePool.h" -#include "../ut/Lock.h" -#include "../ut/inlines.h" +#include "nw4r/ut/ut_Lock.h" +#include "nw4r/ut/ut_algorithm.h" -#if 0 -#include -#else -#include -#endif +#include #include "nw4r/NW4RAssert.hpp" diff --git a/include/nw4r/snd/snd_SoundMemoryAllocatable.h b/include/nw4r/snd/snd_SoundMemoryAllocatable.h index 68a568d1..90fb8df3 100644 --- a/include/nw4r/snd/snd_SoundMemoryAllocatable.h +++ b/include/nw4r/snd/snd_SoundMemoryAllocatable.h @@ -5,7 +5,7 @@ * headers */ -#include // u32 +#include "common.h" // u32 /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_SoundPlayer.h b/include/nw4r/snd/snd_SoundPlayer.h index fc10bc5d..33dd9fa3 100644 --- a/include/nw4r/snd/snd_SoundPlayer.h +++ b/include/nw4r/snd/snd_SoundPlayer.h @@ -5,11 +5,11 @@ * headers */ -#include // f32 +#include "common.h" // f32 -#include "BasicSound.h" -#include "global.h" // AUX_BUS_NUM -#include "PlayerHeap.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_global.h" // AUX_BUS_NUM +#include "nw4r/snd/snd_PlayerHeap.h" /******************************************************************************* * classes diff --git a/include/nw4r/snd/snd_SoundStartable.h b/include/nw4r/snd/snd_SoundStartable.h index 5c2f3a8f..c438be45 100644 --- a/include/nw4r/snd/snd_SoundStartable.h +++ b/include/nw4r/snd/snd_SoundStartable.h @@ -5,7 +5,9 @@ * headers */ -#include // u32 +#include "common.h" // u32 +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_ExternalSoundPlayer.h" /******************************************************************************* * types @@ -102,10 +104,57 @@ namespace nw4r { namespace snd virtual u32 detail_ConvertLabelStringToSoundId(char const *label) = 0; // methods - StartResult detail_StartSound(SoundHandle *handle, u32 soundId, - StartInfo const *startInfo); - StartResult detail_HoldSound(SoundHandle *handle, u32 soundId, - StartInfo const *startInfo); + StartResult detail_StartSound( + SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo + ); + StartResult detail_StartSound( + SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo, + detail::ExternalSoundPlayer *pPlayer, const StartInfo *pStartInfo + ); + + StartResult detail_HoldSound( + SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo + ); + + StartResult detail_HoldSound( + SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo, + detail::ExternalSoundPlayer *pPlayer, const StartInfo *pStartInfo + ); + + StartResult detail_PrepareSound( + SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo, + detail::ExternalSoundPlayer *pPlayer, const StartInfo *pStartInfo + ); + + bool StartSound(SoundHandle *pHandle, u32 id) { + return detail_StartSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool StartSound(SoundHandle *pHandle, unsigned int id) { + return detail_StartSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool StartSound(SoundHandle *pHandle, int id) { + return detail_StartSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + + bool HoldSound(SoundHandle *pHandle, u32 id) { + return detail_HoldSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool HoldSound(SoundHandle *pHandle, unsigned int id) { + return detail_HoldSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool HoldSound(SoundHandle *pHandle, int id) { + return detail_HoldSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + + bool PrepareSound(SoundHandle *pHandle, u32 id) { + return detail_PrepareSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool PrepareSound(SoundHandle *pHandle, unsigned int id) { + return detail_PrepareSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool PrepareSound(SoundHandle *pHandle, int id) { + return detail_PrepareSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } // members private: diff --git a/include/nw4r/snd/snd_SoundSystem.h b/include/nw4r/snd/snd_SoundSystem.h index 9c3b7306..fb0f594c 100644 --- a/include/nw4r/snd/snd_SoundSystem.h +++ b/include/nw4r/snd/snd_SoundSystem.h @@ -5,7 +5,10 @@ * headers */ -#include +#include "common.h" +#include "nw4r/snd/snd_AxManager.h" +#include "nw4r/snd/snd_RemoteSpeaker.h" +#include "nw4r/snd/snd_RemoteSpeakerManager.h" /******************************************************************************* * classes and functions @@ -55,13 +58,45 @@ namespace nw4r { namespace snd // methods public: + static void InitSoundSystem(s32 sndThreadPriority, s32 dvdThreadPriority); static void InitSoundSystem(SoundSystemParam const ¶m, void *workMem, u32 workMemSize); static void ShutdownSoundSystem(); + static void WaitForResetReady(); static bool IsInitializedSoundSystem(); static u32 GetRequiredMemSize(SoundSystemParam const ¶m); + + static void PrepareReset() { + detail::AxManager::GetInstance().PrepareReset(); + } + + + static void SetOutputMode(OutputMode mode) { + detail::AxManager::GetInstance().SetOutputMode(mode); + } + + + static f32 GetMasterVolume() { + return detail::AxManager::GetInstance().GetMasterVolume(); + } + static void SetMasterVolume(f32 volume, int frame) { + detail::AxManager::GetInstance().SetMasterVolume(volume, frame); + } + + + static RemoteSpeaker &GetRemoteSpeaker(int i) { + return detail::RemoteSpeakerManager::GetInstance().GetRemoteSpeaker(i); + } + + + static void AppendEffect(AuxBus bus, FxBase *pFx) { + detail::AxManager::GetInstance().AppendEffect(bus, pFx); + } + static void ClearEffect(AuxBus bus, int frame) { + detail::AxManager::GetInstance().ClearEffect(bus, frame); + } }; // size 0x01 (0x00 for inheritance) }} // namespace nw4r::snd diff --git a/include/nw4r/snd/snd_SoundThread.h b/include/nw4r/snd/snd_SoundThread.h index 0f853603..42d4a10f 100644 --- a/include/nw4r/snd/snd_SoundThread.h +++ b/include/nw4r/snd/snd_SoundThread.h @@ -5,20 +5,16 @@ * headers */ -#include +#include "common.h" -#include "AxManager.h" +#include "nw4r/snd/snd_AxManager.h" -#include "../ut/inlines.h" // ut::NonCopyable -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_algorithm.h" // ut::NonCopyable +#include "nw4r/ut/ut_LinkList.h" -#if 0 -#include -#include -#include -#else -#include -#endif +#include +#include +#include /******************************************************************************* * classes @@ -118,7 +114,7 @@ namespace nw4r { namespace snd { namespace detail OSThreadQueue mThreadQueue; // size 0x008, offset 0x318 OSMessageQueue mMsgQueue; // size 0x020, offset 0x320 OSMessage mMsgBuffer[THREAD_MESSAGE_BUFSIZE]; // size 0x010, offset 0x340 - byte4_t *mStackEnd; // size 0x004, offset 0x350 + u32 *mStackEnd; // size 0x004, offset 0x350 OSMutex mMutex; // size 0x018, offset 0x354 AxManager::CallbackListNode mAxCallbackNode; // size 0x00c, offset 0x36c SoundFrameCallback::LinkList mSoundFrameCallbackList; // size 0x00c, offset 0x378 diff --git a/include/nw4r/snd/snd_StrmChannel.h b/include/nw4r/snd/snd_StrmChannel.h index 056f8f0a..65fa2622 100644 --- a/include/nw4r/snd/snd_StrmChannel.h +++ b/include/nw4r/snd/snd_StrmChannel.h @@ -7,10 +7,9 @@ #include // CHAR_BIT -#include // ROUND_UP -#include +#include "common.h" -#include "adpcm.h" +#include "nw4r/snd/snd_adpcm.h" /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_StrmFile.h b/include/nw4r/snd/snd_StrmFile.h index b70e521c..2bfdcbf7 100644 --- a/include/nw4r/snd/snd_StrmFile.h +++ b/include/nw4r/snd/snd_StrmFile.h @@ -5,14 +5,13 @@ * headers */ -#include -#include +#include "common.h" -#include "adpcm.h" -#include "global.h" // SampleFormat -#include "Util.h" // Util::DataRef +#include "nw4r/snd/snd_adpcm.h" +#include "nw4r/snd/snd_global.h" // SampleFormat +#include "nw4r/snd/snd_Util.h" // Util::DataRef -#include "../ut/binaryFileFormat.h" +#include "nw4r/ut/ut_binaryFileFormat.h" /******************************************************************************* * types @@ -75,8 +74,8 @@ namespace nw4r { namespace snd { namespace detail { u8 volume; // size 0x01, offset 0x00 u8 pan; // size 0x01, offset 0x01 - byte1_t padding[2]; - byte4_t reserved; + u8 padding[2]; + u32 reserved; u8 channelCount; // size 0x01, offset 0x08 u8 channelIndexTable[]; // flexible, offset 0x09 (unit size 0x01) /* 3 bytes padding */ @@ -87,7 +86,7 @@ namespace nw4r { namespace snd { namespace detail { u8 trackCount; // size 0x01, offset 0x00 u8 trackDataType; // size 0x01, offset 0x01 - byte1_t padding[2]; + u8 padding[2]; Util::DataRef refTrackHeader[]; // flexible, offset 0x04 (unit size 0x08) }; // size 0x04 @@ -108,11 +107,11 @@ namespace nw4r { namespace snd { namespace detail struct ChannelTable { u8 channelCount; // size 0x01, offset 0x00 - byte1_t padding[3]; + u8 padding[3]; Util::DataRef refChannelHeader[]; // flexible, offset 0x04 (unit size 0x08) }; // size 0x04 - static byte4_t const SIGNATURE_HEAD_BLOCK = + static u32 const SIGNATURE_HEAD_BLOCK = NW4R_FOUR_BYTE('H', 'E', 'A', 'D'); // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2f2ab0 @@ -126,7 +125,7 @@ namespace nw4r { namespace snd { namespace detail /* StrmFile */ - static byte4_t const SIGNATURE_FILE = + static u32 const SIGNATURE_FILE = NW4R_FOUR_BYTE('R', 'S', 'T', 'M'); static int const FILE_VERSION = NW4R_FILE_VERSION(1, 0); }; // "namespace" StrmFile diff --git a/include/nw4r/snd/snd_StrmPlayer.h b/include/nw4r/snd/snd_StrmPlayer.h index bc9ab661..96742e28 100644 --- a/include/nw4r/snd/snd_StrmPlayer.h +++ b/include/nw4r/snd/snd_StrmPlayer.h @@ -5,24 +5,20 @@ * headers */ -#include +#include "common.h" -#include "BasicPlayer.h" -#include "global.h" -#include "InstancePool.h" -#include "Task.h" -#include "SoundThread.h" -#include "StrmChannel.h" -#include "StrmFile.h" -#include "Voice.h" +#include "nw4r/snd/snd_BasicPlayer.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_InstancePool.h" +#include "nw4r/snd/snd_Task.h" +#include "nw4r/snd/snd_SoundThread.h" +#include "nw4r/snd/snd_StrmChannel.h" +#include "nw4r/snd/snd_StrmFile.h" +#include "nw4r/snd/snd_Voice.h" -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_LinkList.h" -#if 0 -#include -#else -#include -#endif +#include /******************************************************************************* * types @@ -147,7 +143,7 @@ namespace nw4r { namespace snd { namespace detail // methods SetupResult Setup(StrmBufferPool *bufferPool, int allocChannelCount, - byte2_t allocTrackFlag, int voiceOutCount); + u16 allocTrackFlag, int voiceOutCount); void Update(); void Shutdown(); @@ -165,7 +161,7 @@ namespace nw4r { namespace snd { namespace detail bool CheckDiskDriveError() const; void SetAdpcmLoopContext(int channelNum, u16 *predScale); - void SetTrackVolume(byte4_t trackBitFlag, f32 volume); + void SetTrackVolume(u32 trackBitFlag, f32 volume); void InitParam(); bool SetupPlayer(); @@ -198,7 +194,7 @@ namespace nw4r { namespace snd { namespace detail void UpdateDataLoopAddress(s32 endBlockBufferIndex); void UpdateVoiceParams(StrmTrack *track); - static u32 GetSampleByByte(byte4_t byte, SampleFormat format); + static u32 GetSampleByByte(u32 byte, SampleFormat format); private: static void VoiceCallbackFunc(Voice *voice, diff --git a/include/nw4r/snd/snd_StrmSound.h b/include/nw4r/snd/snd_StrmSound.h index ac28216d..45175c92 100644 --- a/include/nw4r/snd/snd_StrmSound.h +++ b/include/nw4r/snd/snd_StrmSound.h @@ -5,14 +5,14 @@ * headers */ -#include +#include "common.h" -#include "BasicSound.h" -#include "debug.h" -#include "MoveValue.h" -#include "StrmPlayer.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_debug.h" +#include "nw4r/snd/snd_MoveValue.h" +#include "nw4r/snd/snd_StrmPlayer.h" -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_LinkList.h" /******************************************************************************* * types @@ -73,7 +73,7 @@ namespace nw4r { namespace snd { namespace detail // methods StrmPlayer::SetupResult Setup(StrmBufferPool *bufferPool, int allocChannelCount, - byte2_t allocTrackFlag); + u16 allocTrackFlag); void *GetFileStreamBuffer() { return mFileStreamBuffer; } s32 GetFileStreamBufferSize() { return sizeof mFileStreamBuffer; } diff --git a/include/nw4r/snd/snd_StrmSoundHandle.h b/include/nw4r/snd/snd_StrmSoundHandle.h index dda83156..bebb9e40 100644 --- a/include/nw4r/snd/snd_StrmSoundHandle.h +++ b/include/nw4r/snd/snd_StrmSoundHandle.h @@ -5,9 +5,9 @@ * headers */ -#include // nullptr +#include "common.h" // nullptr -#include "../ut/inlines.h" // ut::NonCopyable +#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_Task.h b/include/nw4r/snd/snd_Task.h index ccc35765..ecab7ca4 100644 --- a/include/nw4r/snd/snd_Task.h +++ b/include/nw4r/snd/snd_Task.h @@ -5,8 +5,8 @@ * headers */ -#include "../ut/inlines.h" // ut::NonCopyable -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_algorithm.h" // ut::NonCopyable +#include "nw4r/ut/ut_LinkList.h" /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_TaskManager.h b/include/nw4r/snd/snd_TaskManager.h index 16dabe97..9524ba70 100644 --- a/include/nw4r/snd/snd_TaskManager.h +++ b/include/nw4r/snd/snd_TaskManager.h @@ -5,13 +5,9 @@ * headers */ -#include "Task.h" +#include "nw4r/snd/snd_Task.h" -#if 0 -#include // OSThreadQueue -#else -#include -#endif +#include // OSThreadQueue /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_TaskThread.h b/include/nw4r/snd/snd_TaskThread.h index 40ce1d96..7a9a5a0a 100644 --- a/include/nw4r/snd/snd_TaskThread.h +++ b/include/nw4r/snd/snd_TaskThread.h @@ -5,13 +5,9 @@ * headers */ -#include +#include "common.h" -#if 0 -#include -#else -#include -#endif +#include /******************************************************************************* * classes and functions @@ -40,7 +36,7 @@ namespace nw4r { namespace snd { namespace detail // members private: OSThread mThread; // size 0x318, offset 0x000 - byte4_t *mStackEnd; // size 0x004, offset 0x318 + u32 *mStackEnd; // size 0x004, offset 0x318 bool mFinishFlag; // size 0x001, offset 0x31c // TODO: volatile? (see ThreadProc) bool mCreateFlag; // size 0x001, offset 0x31d /* 2 bytes padding */ diff --git a/include/nw4r/snd/snd_Util.h b/include/nw4r/snd/snd_Util.h index dbf4fefe..a8db8f7d 100644 --- a/include/nw4r/snd/snd_Util.h +++ b/include/nw4r/snd/snd_Util.h @@ -5,8 +5,7 @@ * headers */ -#include // static_assert -#include +#include "common.h" #include "nw4r/NW4RAssert.hpp" @@ -41,7 +40,7 @@ namespace nw4r { namespace snd { namespace detail { u8 refType; // size 0x01, offset 0x00 u8 dataType; // size 0x01, offset 0x01 - byte2_t reserved; + u16 reserved; u32 value; // size 0x04, offset 0x04 }; // size 0x08 @@ -74,7 +73,7 @@ namespace nw4r { namespace snd { namespace detail static u16 CalcRandom(); - static void const *GetDataRefAddressImpl(RefType refType, byte4_t value, + static void const *GetDataRefAddressImpl(RefType refType, u32 value, void const *baseAddress); // The only way these asserts happen one line after the other is with macros @@ -89,7 +88,7 @@ namespace nw4r { namespace snd { namespace detail return static_cast(GetDataRefAddressImpl( \ static_cast(ref.refType), ref.value, baseAddress)); \ } \ - static_assert(true, "") // swallow semicolon + STATIC_ASSERT(true) // swallow semicolon DEF_GET_DATA_REF_ADDRESS_(141, 0); DEF_GET_DATA_REF_ADDRESS_(142, 1); @@ -98,12 +97,12 @@ namespace nw4r { namespace snd { namespace detail #undef DEF_GET_DATA_REF_ADDRESS_ - static inline byte2_t ReadBigEndian(byte2_t x) + static inline u16 ReadBigEndian(u16 x) { return x; } - static inline byte4_t ReadBigEndian(byte4_t x) + static inline u32 ReadBigEndian(u32 x) { return x; } diff --git a/include/nw4r/snd/snd_Voice.h b/include/nw4r/snd/snd_Voice.h index 207ad86c..260acbdd 100644 --- a/include/nw4r/snd/snd_Voice.h +++ b/include/nw4r/snd/snd_Voice.h @@ -5,14 +5,14 @@ * headers */ -#include +#include "common.h" -#include "adpcm.h" // AdpcmLoopParam -#include "AxVoice.h" -#include "global.h" -#include "DisposeCallbackManager.h" // DisposeCallback +#include "nw4r/snd/snd_adpcm.h" // AdpcmLoopParam +#include "nw4r/snd/snd_AxVoice.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_DisposeCallbackManager.h" // DisposeCallback -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_LinkList.h" /******************************************************************************* * types @@ -204,7 +204,7 @@ namespace nw4r { namespace snd { namespace detail bool mPauseFlag; // size 0x01, offset 0x9f bool mPausingFlag; // size 0x01, offset 0xa0 bool mVoiceOutParamPitchDisableFlag; // size 0x01, offset 0xa1 - byte2_t mSyncFlag; // size 0x02, offset 0xa2 + u16 mSyncFlag; // size 0x02, offset 0xa2 u8 mRemoteFilter; // size 0x01, offset 0xa4 u8 mBiquadType; // size 0x01, offset 0xa5 /* 2 bytes padding */ diff --git a/include/nw4r/snd/snd_VoiceManager.h b/include/nw4r/snd/snd_VoiceManager.h index f6cb56f1..3a691772 100644 --- a/include/nw4r/snd/snd_VoiceManager.h +++ b/include/nw4r/snd/snd_VoiceManager.h @@ -5,9 +5,9 @@ * headers */ -#include // u32 +#include "common.h" // u32 -#include "Voice.h" +#include "nw4r/snd/snd_Voice.h" /******************************************************************************* * classes and functions @@ -40,7 +40,7 @@ namespace nw4r { namespace snd { namespace detail void ChangeVoicePriority(Voice *voice); void UpdateAllVoices(); - void UpdateAllVoicesSync(byte4_t syncFlag); + void UpdateAllVoicesSync(u32 syncFlag); void NotifyVoiceUpdate(); diff --git a/include/nw4r/snd/snd_WaveArchive.h b/include/nw4r/snd/snd_WaveArchive.h index 5bd2d5c7..ec0ed13f 100644 --- a/include/nw4r/snd/snd_WaveArchive.h +++ b/include/nw4r/snd/snd_WaveArchive.h @@ -5,13 +5,12 @@ * headers */ -#include -#include +#include "common.h" -#include "Util.h" -#include "WaveFile.h" +#include "nw4r/snd/snd_Util.h" +#include "nw4r/snd/snd_WaveFile.h" -#include "../ut/binaryFileFormat.h" +#include "nw4r/ut/ut_binaryFileFormat.h" /******************************************************************************* * types @@ -42,7 +41,7 @@ namespace nw4r { namespace snd { namespace detail u32 waveFileSize; // size 0x04, offset 0x08 }; // size 0x0c - static byte4_t const SIGNATURE_TABLE_BLOCK = + static u32 const SIGNATURE_TABLE_BLOCK = NW4R_FOUR_BYTE('T', 'A', 'B', 'L'); // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b29a1 @@ -54,7 +53,7 @@ namespace nw4r { namespace snd { namespace detail /* DataBlock */ - static byte4_t const SIGNATURE_DATA_BLOCK = + static u32 const SIGNATURE_DATA_BLOCK = NW4R_FOUR_BYTE('D', 'A', 'T', 'A'); // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b2a3c @@ -67,7 +66,7 @@ namespace nw4r { namespace snd { namespace detail /* WaveArchive */ - static byte4_t const SIGNATURE_FILE = + static u32 const SIGNATURE_FILE = NW4R_FOUR_BYTE('R', 'W', 'A', 'R'); static int const FILE_VERSION = NW4R_FILE_VERSION(1, 0); }; // "namespace" WaveArchive diff --git a/include/nw4r/snd/snd_WaveFile.h b/include/nw4r/snd/snd_WaveFile.h index 00ac032c..6b3d31ae 100644 --- a/include/nw4r/snd/snd_WaveFile.h +++ b/include/nw4r/snd/snd_WaveFile.h @@ -5,14 +5,13 @@ * headers */ -#include // NW4R_FOUR_BYTE -#include +#include "common.h" -#include "Channel.h" -#include "global.h" // SampleFormat -#include "adpcm.h" +#include "nw4r/snd/snd_Channel.h" +#include "nw4r/snd/snd_global.h" // SampleFormat +#include "nw4r/snd/snd_adpcm.h" -#include "../ut/binaryFileFormat.h" +#include "nw4r/ut/ut_binaryFileFormat.h" /******************************************************************************* * types @@ -45,12 +44,12 @@ namespace nw4r { namespace snd { namespace detail u8 sampleRate24; // size 0x01, offset 0x03 u16 sampleRate; // size 0x02, offset 0x04 u8 dataLocationType; // size 0x01, offset 0x06 - byte1_t padding; + u8 padding; u32 loopStart; // size 0x04, offset 0x08 u32 loopEnd; // size 0x04, offset 0x0c u32 channelInfoTableOffset; // size 0x04, offset 0x10 u32 dataLocation; // size 0x04, offset 0x14 - byte4_t reserved; + u32 reserved; }; // size 0x1c // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b2c9d @@ -65,7 +64,7 @@ namespace nw4r { namespace snd { namespace detail u32 reserved; }; // size 0x1c - static byte4_t const SIGNATURE_INFO_BLOCK = + static u32 const SIGNATURE_INFO_BLOCK = NW4R_FOUR_BYTE('I', 'N', 'F', 'O'); // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x3087c5 @@ -86,7 +85,7 @@ namespace nw4r { namespace snd { namespace detail /* WaveFile */ - static byte4_t const SIGNATURE_FILE = + static u32 const SIGNATURE_FILE = NW4R_FOUR_BYTE('R', 'W', 'A', 'V'); static int const FILE_VERSION; // does it even have one? }; // "namespace" WaveFile diff --git a/include/nw4r/snd/snd_WaveSound.h b/include/nw4r/snd/snd_WaveSound.h index b5e2d2b8..ebac599c 100644 --- a/include/nw4r/snd/snd_WaveSound.h +++ b/include/nw4r/snd/snd_WaveSound.h @@ -5,13 +5,13 @@ * headers */ -#include +#include "common.h" -#include "BasicSound.h" -#include "debug.h" -#include "WsdPlayer.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_debug.h" +#include "nw4r/snd/snd_WsdPlayer.h" -#include "../ut/LinkList.h" +#include "nw4r/ut/ut_LinkList.h" /******************************************************************************* * types @@ -64,7 +64,7 @@ namespace nw4r { namespace snd { namespace detail bool Prepare(void const *waveSoundBase, s32 waveSoundOffset, WsdPlayer::StartOffsetType startOffsetType, s32 offset, WsdPlayer::WsdCallback const *callback, - register_t callbackData); + u32 callbackData); void SetChannelPriority(int priority); void SetReleasePriorityFix(bool flag); diff --git a/include/nw4r/snd/snd_WaveSoundHandle.h b/include/nw4r/snd/snd_WaveSoundHandle.h index 8ae3d06f..af7de2b1 100644 --- a/include/nw4r/snd/snd_WaveSoundHandle.h +++ b/include/nw4r/snd/snd_WaveSoundHandle.h @@ -5,9 +5,9 @@ * headers */ -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/ut/inlines.h" // ut::NonCopyable +#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable /******************************************************************************* * types diff --git a/include/nw4r/snd/snd_WsdFile.h b/include/nw4r/snd/snd_WsdFile.h index a47970cb..2b0931fc 100644 --- a/include/nw4r/snd/snd_WsdFile.h +++ b/include/nw4r/snd/snd_WsdFile.h @@ -5,12 +5,11 @@ * headers */ -#include -#include +#include "common.h" -#include "Util.h" +#include "nw4r/snd/snd_Util.h" -#include "../ut/binaryFileFormat.h" +#include "nw4r/ut/ut_binaryFileFormat.h" /******************************************************************************* * types @@ -49,11 +48,11 @@ namespace nw4r { namespace snd { namespace detail u8 fxSendB; // size 0x01, offset 0x07 u8 fxSendC; // size 0x01, offset 0x08 u8 mainSend; // size 0x01, offset 0x09 - byte1_t padding[2]; + u8 padding[2]; // TODO: template parameters Util::DataRef graphEnvTablevRef; // size 0x08, offset 0x0c Util::DataRef randomizerTableRef; // size 0x08, offset 0x14 - byte4_t reserved; + u32 reserved; }; // size 0x20 struct TrackInfo; @@ -69,7 +68,7 @@ namespace nw4r { namespace snd { namespace detail u8 sustain; // size 0x01, offset 0x06 u8 release; // size 0x01, offset 0x07 u8 hold; // size 0x01, offset 0x08 - byte1_t padding[3]; + u8 padding[3]; u8 originalKey; // size 0x01, offset 0x0c u8 volume; // size 0x01, offset 0x0d u8 pan; // size 0x01, offset 0x0e @@ -79,7 +78,7 @@ namespace nw4r { namespace snd { namespace detail Util::DataRef lfoTableRef; // size 0x08, offset 0x14 Util::DataRef graphEnvTablevRef; // size 0x08, offset 0x1c Util::DataRef randomizerTableRef; // size 0x08, offset 0x24 - byte4_t reserved; + u32 reserved; }; // size 0x30 typedef Util::Table > NoteInfoTable; @@ -92,7 +91,7 @@ namespace nw4r { namespace snd { namespace detail Util::DataRef refNoteTable; // size 0x08, offset 0x10 }; // size 0x18 - static byte4_t const SIGNATURE_DATA_BLOCK = + static u32 const SIGNATURE_DATA_BLOCK = NW4R_FOUR_BYTE('D', 'A', 'T', 'A'); // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2e4ec8 @@ -105,7 +104,7 @@ namespace nw4r { namespace snd { namespace detail /* WaveBlock */ - static byte4_t const SIGNATURE_WAVE_BLOCK = + static u32 const SIGNATURE_WAVE_BLOCK = NW4R_FOUR_BYTE('W', 'A', 'V', 'E'); // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2e4f87 @@ -128,7 +127,7 @@ namespace nw4r { namespace snd { namespace detail /* WsdFile */ - static byte4_t const SIGNATURE_FILE = + static u32 const SIGNATURE_FILE = NW4R_FOUR_BYTE('R', 'W', 'S', 'D'); static int const FILE_VERSION = NW4R_FILE_VERSION(1, 3); }; // "namespace" WsdFile diff --git a/include/nw4r/snd/snd_WsdPlayer.h b/include/nw4r/snd/snd_WsdPlayer.h index 5ceec546..6116cf0e 100644 --- a/include/nw4r/snd/snd_WsdPlayer.h +++ b/include/nw4r/snd/snd_WsdPlayer.h @@ -5,14 +5,14 @@ * headers */ -#include +#include "common.h" -#include "BasicPlayer.h" -#include "Channel.h" -#include "DisposeCallbackManager.h" // DisposeCallback -#include "Lfo.h" // LfoParam -#include "SoundThread.h" -#include "WaveFile.h" +#include "nw4r/snd/snd_BasicPlayer.h" +#include "nw4r/snd/snd_Channel.h" +#include "nw4r/snd/snd_DisposeCallbackManager.h" // DisposeCallback +#include "nw4r/snd/snd_Lfo.h" // LfoParam +#include "nw4r/snd/snd_SoundThread.h" +#include "nw4r/snd/snd_WaveFile.h" /******************************************************************************* * classes and functions @@ -51,7 +51,7 @@ namespace nw4r { namespace snd { namespace detail WaveInfo *waveData, void const *waveSoundData, int index, int noteIndex, - register_t userData) const = 0; + u32 userData) const = 0; // members private: @@ -84,7 +84,7 @@ namespace nw4r { namespace snd { namespace detail bool Prepare(void const *waveSoundBase, int index, StartOffsetType startOffsetType, int startOffset, int voiceOutCount, WsdCallback const *callback, - register_t callbackData); + u32 callbackData); f32 GetPanRange() const { return mPanRange; } int GetVoiceOutCount() const { return mVoiceOutCount; } @@ -103,14 +103,14 @@ namespace nw4r { namespace snd { namespace detail private: static void ChannelCallbackFunc(Channel *dropChannel, Channel::ChannelCallbackStatus status, - register_t userData); + u32 userData); void InitParam(int voiceOutCount, WsdCallback const *callback, - register_t callbackData); + u32 callbackData); void Update(); - bool StartChannel(WsdCallback const *callback, register_t callbackData); + bool StartChannel(WsdCallback const *callback, u32 callbackData); void UpdateChannel(); void CloseChannel(); @@ -138,7 +138,7 @@ namespace nw4r { namespace snd { namespace detail u8 mPriority; // size 0x001, offset 0x0cc /* 3 bytes padding */ WsdCallback const *mCallback; // size 0x004, offset 0x0d0 - register_t mCallbackData; // size 0x004, offset 0x0d4 + u32 mCallbackData; // size 0x004, offset 0x0d4 void const *mWsdData; // size 0x004, offset 0x0d8 int mWsdIndex; // size 0x004, offset 0x0dc StartOffsetType mStartOffsetType; // size 0x004, offset 0x0e0 diff --git a/include/nw4r/snd/snd_adpcm.h b/include/nw4r/snd/snd_adpcm.h index f35a1b5b..bea2b737 100644 --- a/include/nw4r/snd/snd_adpcm.h +++ b/include/nw4r/snd/snd_adpcm.h @@ -5,20 +5,16 @@ * headers */ -#include +#include "common.h" -#if 0 -#include // AXPBADPCM -#else -#include -#endif +#include // AXPBADPCM /******************************************************************************* * types */ -namespace nw4r { namespace snd { namespace detail -{ +namespace nw4r { namespace snd { // namespace detail +// { // Why are these just the AX types // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x291b3 @@ -30,7 +26,8 @@ namespace nw4r { namespace snd { namespace detail u16 yn1; // size 0x02, offset 0x24 u16 yn2; // size 0x02, offset 0x26 }; // size 0x28 - +namespace detail +{ // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x29290 struct AdpcmLoopParam // AXPBADPCMLOOP { @@ -38,7 +35,8 @@ namespace nw4r { namespace snd { namespace detail u16 loop_yn1; // size 0x02, offset 0x02 u16 loop_yn2; // size 0x02, offset 0x04 }; // size 0x06 -}}} // namespace nw4r::snd::detail +} +}} // namespace nw4r::snd // ::detail /******************************************************************************* * classes and functions diff --git a/include/nw4r/snd/snd_global.h b/include/nw4r/snd/snd_global.h index 57c73b77..f80ab974 100644 --- a/include/nw4r/snd/snd_global.h +++ b/include/nw4r/snd/snd_global.h @@ -5,12 +5,27 @@ * headers */ -#include // f32 +#include "common.h" // f32 /******************************************************************************* * types */ +#if defined(__cplusplus) + +// Macro for for loops using NW4R iterators +# define NW4R_RANGE_FOR(it_, list_) \ + for (decltype((list_).GetBeginIter()) (it_) = (list_).GetBeginIter(); (it_) != (list_).GetEndIter(); ++(it_)) + +/* This macro specifically is for the for loops which declare an + * Iterator currIt = it++; in the body, so that it does not get incremented + * twice. + */ +# define NW4R_RANGE_FOR_NO_AUTO_INC(it_, list_) \ + for (decltype((list_).GetBeginIter()) (it_) = (list_).GetBeginIter(); (it_) != (list_).GetEndIter();) + +#endif // defined(__cplusplus) + namespace nw4r { namespace snd { // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x26bd0 diff --git a/include/nw4r/types_nw4r.h b/include/nw4r/types_nw4r.h index 7a6ff652..6ccabea5 100644 --- a/include/nw4r/types_nw4r.h +++ b/include/nw4r/types_nw4r.h @@ -17,6 +17,22 @@ const char *NW4R_##NAME##_Version_ = \ "<< NW4R - " #NAME " \tfinal build: " ORIGINAL_DATE " " ORIGINAL_TIME " (" ORIGINAL_CWCC ") >>" +#if defined(CHAR_BIT) +# define CHAR_BIT_ CHAR_BIT +#else +# define CHAR_BIT_ 8 // most common; default +#endif + +// offset in bytes +#define NW4R_BYTE_(byte_, offset_) \ + (static_cast(byte_) << CHAR_BIT_ * (offset_)) + +#define NW4R_FILE_VERSION(MAJOR, MINOR) \ + (NW4R_BYTE_(MAJOR, 1) | NW4R_BYTE_(MINOR, 0)) + +#define NW4R_FOUR_BYTE(A, B, C, D) \ + (NW4R_BYTE_(A, 3) | NW4R_BYTE_(B, 2) | NW4R_BYTE_(C, 1) | NW4R_BYTE_(D, 0)) + namespace nw4r { namespace ut { namespace detail { diff --git a/include/nw4r/ut/ut_FileStream.h b/include/nw4r/ut/ut_FileStream.h index 283bff8a..0252762d 100644 --- a/include/nw4r/ut/ut_FileStream.h +++ b/include/nw4r/ut/ut_FileStream.h @@ -16,6 +16,12 @@ public: SEEKORG_END }; + enum SeekOrigin_ { + SEEK_ORIGIN_SET, + SEEK_ORIGIN_CUR, + SEEK_ORIGIN_END + }; + class FilePosition { public: FilePosition() : mFileSize(0), mFileOffset(0) {} diff --git a/include/nw4r/ut/ut_IOStream.h b/include/nw4r/ut/ut_IOStream.h index 00a3a1a9..835b4155 100644 --- a/include/nw4r/ut/ut_IOStream.h +++ b/include/nw4r/ut/ut_IOStream.h @@ -10,6 +10,7 @@ class IOStream { public: NW4R_UT_RTTI_DECL(IOStream); + typedef void StreamCallback(s32 result, IOStream *stream, void *arg); typedef void (*AsyncCallback)(s32 result, IOStream *stream, void *arg); IOStream() : mIsOpen(false), mCallback(NULL), mCallbackArg(NULL) {} diff --git a/include/nw4r/ut/ut_LinkList.h b/include/nw4r/ut/ut_LinkList.h index 92a8f1a0..e96cfa3d 100644 --- a/include/nw4r/ut/ut_LinkList.h +++ b/include/nw4r/ut/ut_LinkList.h @@ -317,8 +317,8 @@ public: public: // Shorthand names for reverse iterator types - typedef detail::ReverseIterator RevIterator; - typedef detail::ReverseIterator RevConstIterator; + typedef detail::ReverseIterator ReverseIterator; + typedef detail::ReverseIterator ReverseConstIterator; public: LinkList() {} diff --git a/include/nw4r/ut/ut_binaryFileFormat.h b/include/nw4r/ut/ut_binaryFileFormat.h index e01fb155..5ccd5ed9 100644 --- a/include/nw4r/ut/ut_binaryFileFormat.h +++ b/include/nw4r/ut/ut_binaryFileFormat.h @@ -11,7 +11,7 @@ struct BinaryBlockHeader { }; struct BinaryFileHeader { - u32 magic; // at 0x0 + u32 signature; // at 0x0 u16 byteOrder; // at 0x4 u16 version; // at 0x6 u32 fileSize; // at 0x8 diff --git a/include/rvl/AX/AX.h b/include/rvl/AX/AX.h index 79cf14ee..603c23c4 100644 --- a/include/rvl/AX/AX.h +++ b/include/rvl/AX/AX.h @@ -5,6 +5,20 @@ extern "C" { #endif +#define AX_MAX_VOICES 0x60 /* name known from asserts */ +#define AX_SAMPLE_RATE 32000 +#define AX_ADPCM_FRAME_SIZE 8 +#define AX_ADPCM_SAMPLE_BYTES_PER_FRAME (AX_ADPCM_FRAME_SIZE - 1) +#define AX_ADPCM_SAMPLES_PER_BYTE 2 +#define AX_ADPCM_SAMPLES_PER_FRAME (AX_ADPCM_SAMPLE_BYTES_PER_FRAME * AX_ADPCM_SAMPLES_PER_BYTE) +#define AX_ADPCM_NIBBLES_PER_FRAME (AX_ADPCM_FRAME_SIZE * 2) +#define AX_FRAME_SIZE (AX_SAMPLES_PER_FRAME * AX_SAMPLE_DEPTH_BYTES) + +#define AX_PRIORITY_STACKS 32 + +#define AX_PRIORITY_FREE 0 +#define AX_PRIORITY_MIN 1 + void AXInit(void); void AXInitEx(u32 mode); diff --git a/include/rvl/AX/AXCL.h b/include/rvl/AX/AXCL.h index 4a68a090..5176fe7e 100644 --- a/include/rvl/AX/AXCL.h +++ b/include/rvl/AX/AXCL.h @@ -11,11 +11,13 @@ extern "C" { // Each command takes up two bytes #define AX_CL_SIZE (AX_CL_MAX_CMD * sizeof(u16)) -typedef enum { - AX_OUTPUT_STEREO, - AX_OUTPUT_SURROUND, - AX_OUTPUT_DPL2 -} AXOutputMode; +typedef u32 AXCLMode; +enum AXCLMode_et +{ + AX_CL_MODE_STEREO, + AX_CL_MODE_SURROUND, + AX_CL_MODE_DPL2, +}; extern u32 __AXClMode; diff --git a/include/rvl/AX/AXOut.h b/include/rvl/AX/AXOut.h index 47c84070..e205b9a4 100644 --- a/include/rvl/AX/AXOut.h +++ b/include/rvl/AX/AXOut.h @@ -8,14 +8,14 @@ extern "C" { #define AX_STREAM_SIZE_RMT 40 #define AX_RMT_MAX 4 -typedef void (*AXOutCallback)(void); -typedef void (*AXExceedCallback)(u32 cycles); +typedef void AXFrameCallback(void); +typedef void AXExceedCallback(u32 cycles); u32 __AXOutNewFrame(void); void __AXOutAiCallback(void); void __AXOutInitDSP(void); void __AXOutInit(u32 mode); -AXOutCallback AXRegisterCallback(AXOutCallback callback); +AXFrameCallback *AXRegisterCallback(AXFrameCallback *callback); s32 AXRmtGetSamplesLeft(void); s32 AXRmtGetSamples(s32 chan, s16 *out, s32 num); s32 AXRmtAdvancePtr(s32 num); diff --git a/include/rvl/AX/AXPB.h b/include/rvl/AX/AXPB.h index b6de4b99..139bf5d3 100644 --- a/include/rvl/AX/AXPB.h +++ b/include/rvl/AX/AXPB.h @@ -32,18 +32,19 @@ typedef enum { AX_VOICE_RUN } AXVOICESTATE; +enum +{ + AX_PB_OFF = 0, + AX_PB_LPF_ON = 1 << 0, + AX_PB_BIQUAD_ON = 1 << 1, +}; + typedef enum { AX_SAMPLE_FORMAT_DSP_ADPCM = 0, AX_SAMPLE_FORMAT_PCM_S16 = 10, AX_SAMPLE_FORMAT_PCM_S8 = 25, } AXSAMPLETYPE; -// For rmtIIR union I think? From NW4R asserts, but fits well in __AXSyncPBs -typedef enum { - AX_PB_LPF_ON = 1, - AX_PB_BIQUAD_ON, -}; - typedef enum { AX_SRC_TYPE_NONE, AX_SRC_TYPE_LINEAR, @@ -53,31 +54,32 @@ typedef enum { AX_SRC_TYPE_4TAP_AUTO } AXPBSRCTYPE; -typedef enum { - AX_MIXER_CTRL_L = (1 << 0), - AX_MIXER_CTRL_R = (1 << 1), - AX_MIXER_CTRL_DELTA = (1 << 2), - AX_MIXER_CTRL_S = (1 << 3), - AX_MIXER_CTRL_DELTA_S = (1 << 4), +typedef enum AXMixerCtrlFlags +{ + AX_MIXER_CTRL_L = 1 << 0, + AX_MIXER_CTRL_R = 1 << 1, + AX_MIXER_CTRL_DELTA = 1 << 2, + AX_MIXER_CTRL_S = 1 << 3, + AX_MIXER_CTRL_DELTA_S = 1 << 4, - AX_MIXER_CTRL_AL = (1 << 16), - AX_MIXER_CTRL_AR = (1 << 17), - AX_MIXER_CTRL_DELTA_A = (1 << 18), - AX_MIXER_CTRL_AS = (1 << 19), - AX_MIXER_CTRL_DELTA_AS = (1 << 20), + AX_MIXER_CTRL_A_L = 1 << 16, + AX_MIXER_CTRL_A_R = 1 << 17, + AX_MIXER_CTRL_A_DELTA = 1 << 18, + AX_MIXER_CTRL_A_S = 1 << 19, + AX_MIXER_CTRL_A_DELTA_S = 1 << 20, - AX_MIXER_CTRL_BL = (1 << 21), - AX_MIXER_CTRL_BR = (1 << 22), - AX_MIXER_CTRL_DELTA_B = (1 << 23), - AX_MIXER_CTRL_BS = (1 << 24), - AX_MIXER_CTRL_DELTA_BS = (1 << 25), + AX_MIXER_CTRL_B_L = 1 << 21, + AX_MIXER_CTRL_B_R = 1 << 22, + AX_MIXER_CTRL_B_DELTA = 1 << 23, + AX_MIXER_CTRL_B_S = 1 << 24, + AX_MIXER_CTRL_B_DELTA_S = 1 << 25, - AX_MIXER_CTRL_CL = (1 << 26), - AX_MIXER_CTRL_CR = (1 << 27), - AX_MIXER_CTRL_DELTA_C = (1 << 28), - AX_MIXER_CTRL_CS = (1 << 29), - AX_MIXER_CTRL_DELTA_CS = (1 << 30) -}; + AX_MIXER_CTRL_C_L = 1 << 26, + AX_MIXER_CTRL_C_R = 1 << 27, + AX_MIXER_CTRL_C_DELTA = 1 << 28, + AX_MIXER_CTRL_C_S = 1 << 29, + AX_MIXER_CTRL_C_DELTA_S = 1 << 30, +} AXMixerCtrlFlags; typedef enum { AX_MIXER_CTRL_RMT_M0 = (1 << 0), diff --git a/include/rvl/AX/AXVPB.h b/include/rvl/AX/AXVPB.h index f9593261..b3230102 100644 --- a/include/rvl/AX/AXVPB.h +++ b/include/rvl/AX/AXVPB.h @@ -11,39 +11,41 @@ extern "C" { #define AX_SAMPLE_RATE 32000 #define AX_VOICE_MAX 96 -enum { - AX_PBSYNC_SELECT = (1 << 0), - AX_PBSYNC_MIXER_CTRL = (1 << 1), - AX_PBSYNC_STATE = (1 << 2), - AX_PBSYNC_TYPE = (1 << 3), - AX_PBSYNC_MIX = (1 << 4), - AX_PBSYNC_ITD = (1 << 5), - AX_PBSYNC_ITD_SHIFT = (1 << 6), - AX_PBSYNC_DPOP = (1 << 7), - AX_PBSYNC_VE = (1 << 8), - AX_PBSYNC_VE_DELTA = (1 << 9), - AX_PBSYNC_ADDR = (1 << 10), - AX_PBSYNC_LOOP_FLAG = (1 << 11), - AX_PBSYNC_LOOP_ADDR = (1 << 12), - AX_PBSYNC_END_ADDR = (1 << 13), - AX_PBSYNC_CURR_ADDR = (1 << 14), - AX_PBSYNC_ADPCM = (1 << 15), - AX_PBSYNC_SRC = (1 << 16), - AX_PBSYNC_SRC_RATIO = (1 << 17), - AX_PBSYNC_ADPCM_LOOP = (1 << 18), - AX_PBSYNC_LPF = (1 << 19), - AX_PBSYNC_LPF_COEFS = (1 << 20), - AX_PBSYNC_BIQUAD = (1 << 21), - AX_PBSYNC_BIQUAD_COEFS = (1 << 22), - AX_PBSYNC_REMOTE = (1 << 23), - AX_PBSYNC_RMT_MIXER_CTRL = (1 << 24), - AX_PBSYNC_RMTMIX = (1 << 25), - AX_PBSYNC_RMTDPOP = (1 << 26), - AX_PBSYNC_RMTSRC = (1 << 27), - AX_PBSYNC_RMTIIR = (1 << 28), - AX_PBSYNC_RMTIIR_LPF_COEFS = (1 << 29), - AX_PBSYNC_RMTIIR_BIQUAD_COEFS = (1 << 30), - AX_PBSYNC_ALL = (1 << 31), +typedef u32 AXVPBSyncFlags; +enum AXVPBSyncFlags_et +{ + AX_VPB_SYNC_FLAG_SRC_TYPE = (1 << 0), + AX_VPB_SYNC_FLAG_MIXER_CTRL = (1 << 1), + AX_VPB_SYNC_FLAG_STATE = (1 << 2), + AX_VPB_SYNC_FLAG_TYPE = (1 << 3), + AX_VPB_SYNC_FLAG_MIX = (1 << 4), + AX_VPB_SYNC_FLAG_ITD = (1 << 5), + AX_VPB_SYNC_FLAG_ITD_TARGET = (1 << 6), + AX_VPB_SYNC_FLAG_DPOP = (1 << 7), + AX_VPB_SYNC_FLAG_VE = (1 << 8), + AX_VPB_SYNC_FLAG_VE_DELTA = (1 << 9), + AX_VPB_SYNC_FLAG_ADDR = 1 << 10, + AX_VPB_SYNC_FLAG_ADDR_LOOP_FLAG = 1 << 11, + AX_VPB_SYNC_FLAG_ADDR_LOOP_ADDR = 1 << 12, + AX_VPB_SYNC_FLAG_ADDR_END_ADDR = 1 << 13, + AX_VPB_SYNC_FLAG_ADDR_CURRENT_ADDR = 1 << 14, + AX_VPB_SYNC_FLAG_ADPCM = 1 << 15, + AX_VPB_SYNC_FLAG_SRC = 1 << 16, + AX_VPB_SYNC_FLAG_SRC_RATIO = 1 << 17, + AX_VPB_SYNC_FLAG_ADPCM_LOOP = 1 << 18, + AX_VPB_SYNC_FLAG_LPF = 1 << 19, + AX_VPB_SYNC_FLAG_LPF_COEFS = 1 << 20, + AX_VPB_SYNC_FLAG_BIQUAD = 1 << 21, + AX_VPB_SYNC_FLAG_BIQUAD_COEFS = 1 << 22, + AX_VPB_SYNC_FLAG_RMT_ON = 1 << 23, + AX_VPB_SYNC_FLAG_RMT_MIXER_CTRL = 1 << 24, + AX_VPB_SYNC_FLAG_RMT_MIX = 1 << 25, + AX_VPB_SYNC_FLAG_RMT_DPOP = 1 << 26, + AX_VPB_SYNC_FLAG_RMT_SRC = 1 << 27, + AX_VPB_SYNC_FLAG_RMT_IIR = 1 << 28, + AX_VPB_SYNC_FLAG_RMT_IIR_LPF_COEFS = 1 << 29, + AX_VPB_SYNC_FLAG_RMT_IIR_BIQUAD_COEFS = 1 << 30, + AX_VPB_SYNC_FLAG_FULL_PB = 1 << 31 }; typedef void (*AXVoiceCallback)(void *voice); diff --git a/include/rvl/DVD/dvd.h b/include/rvl/DVD/dvd.h index aa63696a..9c7a27b2 100644 --- a/include/rvl/DVD/dvd.h +++ b/include/rvl/DVD/dvd.h @@ -22,22 +22,31 @@ typedef enum { DVD_RESULT_OK, } DVDResult; -typedef enum { - DVD_STATE_FATAL = -1, - DVD_STATE_IDLE, - DVD_STATE_BUSY, - DVD_STATE_WAITING, - DVD_STATE_COVER_CLOSED, - DVD_STATE_NO_DISK, - DVD_STATE_COVER_OPENED, - DVD_STATE_WRONG_DISK_ID, - DVD_STATE_7, - DVD_STATE_PAUSED, - DVD_STATE_9, - DVD_STATE_CANCELED, - DVD_STATE_DISK_ERROR, - DVD_STATE_MOTOR_STOPPED, -} DVDAsyncState; +#define DVD_ESUCCESS DVD_RESULT_OK +#define DVD_EFATAL DVD_RESULT_FATAL +#define DVD_ECANCELED DVD_RESULT_CANCELED +#define DVD_ECOVER DVD_RESULT_COVER_CLOSED + +typedef long DVDState; +enum DVDState_et +{ + DVD_STATE_IDLE = 0, + + DVD_STATE_BUSY = 1, + DVD_STATE_WAITING = 2, + DVD_STATE_COVER_CLOSED = 3, + DVD_STATE_NO_DISK = 4, + DVD_STATE_COVER_OPENED = 5, + DVD_STATE_WRONG_DISK_ID = 6, + DVD_STATE_7 = 7, + DVD_STATE_PAUSED = 8, + DVD_STATE_9 = 9, + DVD_STATE_CANCELED = 10, + DVD_STATE_DISK_ERROR = 11, + DVD_STATE_MOTOR_STOPPED = 12, + + DVD_STATE_FATAL = -1, +}; typedef enum { DVD_COVER_BUSY, diff --git a/include/rvl/OS/OSMessage.h b/include/rvl/OS/OSMessage.h index 7761bddc..09f7e063 100644 --- a/include/rvl/OS/OSMessage.h +++ b/include/rvl/OS/OSMessage.h @@ -11,9 +11,13 @@ extern "C" { // General-purpose typedef typedef void *OSMessage; -typedef enum { - OS_MSG_PERSISTENT = (1 << 0) -} OSMessageFlags; +typedef u32 OSMessageFlags; +enum OSMessageFlags_et +{ + OS_MESSAGE_NO_FLAGS = 0, + + OS_MESSAGE_FLAG_PERSISTENT = 1 << 0, +}; typedef struct OSMessageQueue { OSThreadQueue sendQueue; // at 0x0 diff --git a/include/rvl/OS/OSThread.h b/include/rvl/OS/OSThread.h index 148b099d..871ce0a7 100644 --- a/include/rvl/OS/OSThread.h +++ b/include/rvl/OS/OSThread.h @@ -20,9 +20,13 @@ typedef enum { OS_THREAD_STATE_MORIBUND = 8 } OSThreadState; -typedef enum { - OS_THREAD_DETACHED = (1 << 0) -} OSThreadFlag; +typedef u16 OSThreadFlags; +enum OSThreadFlags_et +{ + OS_THREAD_NO_FLAGS = 0, + + OS_THREAD_DETACHED = 1 << 0, +}; typedef struct OSThreadQueue { struct OSThread *head; // at 0x0 @@ -59,6 +63,15 @@ typedef struct OSThread { typedef void (*OSSwitchThreadCallback)(OSThread *currThread, OSThread *newThread); typedef void *(*OSThreadFunc)(void *arg); +#define OSSendMessageAny(msgQueue_, msg_, flags_) \ + OSSendMessage(msgQueue_, (OSMessage)(msg_), flags_) + +#define OSReceiveMessageAny(msgQueue_, msgOut_, flags_) \ + OSReceiveMessage(msgQueue_, (OSMessage *)(msgOut_), flags_) + +#define OSJamMessageAny(msgQueue_, msg_, flags_) \ + OSJamMessage(msgQueue_, (OSMessage)(msg_), flags_) + OSSwitchThreadCallback OSSetSwitchThreadCallback(OSSwitchThreadCallback callback); void __OSThreadInit(void); void OSSetCurrentThread(OSThread *thread); diff --git a/include/rvl/SC/scapi.h b/include/rvl/SC/scapi.h index b9a120a7..b63389f3 100644 --- a/include/rvl/SC/scapi.h +++ b/include/rvl/SC/scapi.h @@ -33,11 +33,13 @@ typedef enum { SC_LANG_KR, } SCLanguage; -typedef enum { - SC_SND_MONO, - SC_SND_STEREO, - SC_SND_SURROUND -} SCSoundMode; +typedef u8 SCSoundMode; +enum SCSoundMode_et +{ + SC_SND_MONO, + SC_SND_STEREO, + SC_SND_SURROUND +}; typedef enum { SC_SENSOR_BAR_BOTTOM, @@ -67,7 +69,7 @@ void SCGetIdleMode(SCIdleMode *mode); u8 SCGetLanguage(void); u8 SCGetProgressiveMode(void); u8 SCGetScreenSaverMode(void); -u8 SCGetSoundMode(void); +SCSoundMode SCGetSoundMode(void); u32 SCGetCounterBias(void); void SCGetBtDeviceInfoArray(SCBtDeviceInfoArray *info); void SCSetBtDeviceInfoArray(const SCBtDeviceInfoArray *info); diff --git a/include/rvl/SC/scsystem.h b/include/rvl/SC/scsystem.h index 26fcea2b..b50d64fb 100644 --- a/include/rvl/SC/scsystem.h +++ b/include/rvl/SC/scsystem.h @@ -15,12 +15,14 @@ extern "C" { * https://wiibrew.org/wiki//shared2/sys/SYSCONF */ -typedef enum { - SC_STATUS_0, - SC_STATUS_1, - SC_STATUS_2, - SC_STATUS_3, -} SCStatus; +typedef u32 SCStatus; +enum SCStatus_et +{ + SC_STATUS_OK, /* name known from asserts */ + SC_STATUS_BUSY, + SC_STATUS_FATAL, + SC_STATUS_PARSE, +}; typedef enum { SC_CONF_FILE_SYSTEM, //!< SYSCONF @@ -112,7 +114,7 @@ typedef struct SCControl { } SCControl; void SCInit(void); -u32 SCCheckStatus(void); +SCStatus SCCheckStatus(void); BOOL SCFindByteArrayItem(void *dst, u32 len, SCItemID id); BOOL SCReplaceByteArrayItem(const void *src, u32 len, SCItemID id); diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cstdarg b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cstdarg new file mode 100644 index 00000000..b596d426 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cstdarg @@ -0,0 +1,11 @@ +#ifndef MSL_CPP_CSTDARG_H +#define MSL_CPP_CSTDARG_H +#include <__va_arg.h> +#ifdef __cplusplus + +namespace std { +using ::va_list; +} // namespace std + +#endif +#endif diff --git a/src/d/d_cursor_hit_check.cpp b/src/d/d_cursor_hit_check.cpp index 9446db18..160c6c28 100644 --- a/src/d/d_cursor_hit_check.cpp +++ b/src/d/d_cursor_hit_check.cpp @@ -234,7 +234,7 @@ void dCursorHitCheckLyt_c::countBoundings(nw4r::lyt::Pane *pane) { mNumBoundings++; } - for (nw4r::lyt::Pane::ChildList::RevIterator it = pane->GetChildList()->GetEndReverseIter(); + for (nw4r::lyt::Pane::ChildList::ReverseIterator it = pane->GetChildList()->GetEndReverseIter(); it != pane->GetChildList()->GetBeginIter(); ++it) { countBoundings(&*it); } @@ -247,7 +247,7 @@ void dCursorHitCheckLyt_c::gatherBoundings(dCsCheckLyt_BoundingData **pEnd, nw4r (*pEnd)->mpPane = pane; } - for (nw4r::lyt::Pane::ChildList::RevIterator it = pane->GetChildList()->GetEndReverseIter(); + for (nw4r::lyt::Pane::ChildList::ReverseIterator it = pane->GetChildList()->GetEndReverseIter(); it != pane->GetChildList()->GetBeginIter(); ++it) { gatherBoundings(pEnd, &*it); } diff --git a/src/egg/core/eggDvdFile.cpp b/src/egg/core/eggDvdFile.cpp index 2f92ab08..b4b2d2dd 100644 --- a/src/egg/core/eggDvdFile.cpp +++ b/src/egg/core/eggDvdFile.cpp @@ -84,7 +84,7 @@ s32 DvdFile::writeData(const void *buffer, s32 length, s32 offset) { s32 DvdFile::sync() { OSMessage msg; OSLockMutex(&mMutex); - OSReceiveMessage(&mMsgQueue, &msg, OS_MSG_PERSISTENT); + OSReceiveMessage(&mMsgQueue, &msg, OS_MESSAGE_FLAG_PERSISTENT); mThread = nullptr; OSUnlockMutex(&mMutex); return (s32)(msg); diff --git a/src/nw4r/snd/snd_AnimSound.cpp b/src/nw4r/snd/snd_AnimSound.cpp index 524da018..de514c8b 100644 --- a/src/nw4r/snd/snd_AnimSound.cpp +++ b/src/nw4r/snd/snd_AnimSound.cpp @@ -1,9 +1,9 @@ /* Only implemented to the extent necessary to match data sections. */ -#include // nullptr +#include "common.h" // nullptr #include -#include "nw4r/snd/Util.h" +#include "nw4r/snd/snd_Util.h" DECOMP_FORCE(nw4r::snd::detail::Util::GetDataRefAddress0( *static_cast const *>(nullptr), diff --git a/src/nw4r/snd/snd_AxManager.cpp b/src/nw4r/snd/snd_AxManager.cpp index 5d87fb3b..1acaeb7c 100644 --- a/src/nw4r/snd/snd_AxManager.cpp +++ b/src/nw4r/snd/snd_AxManager.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/AxManager.h" +#include "nw4r/snd/snd_AxManager.h" /* Original source: * kiwi515/ogws @@ -11,28 +11,23 @@ #include // std::memset -#include -#include +#include "common.h" -#include "nw4r/snd/BiquadFilterPreset.h" -#include "nw4r/snd/FxBase.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/MoveValue.h" -#include "nw4r/snd/Voice.h" -#include "nw4r/snd/VoiceManager.h" +#include "nw4r/snd/snd_BiquadFilterPreset.h" +#include "nw4r/snd/snd_FxBase.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_MoveValue.h" +#include "nw4r/snd/snd_Voice.h" +#include "nw4r/snd/snd_VoiceManager.h" -#include "nw4r/ut/inlines.h" // ut::Clamp -#include "nw4r/ut/Lock.h" // ut::AutoInterruptLock +#include "nw4r/ut/ut_algorithm.h" // ut::Clamp +#include "nw4r/ut/ut_Lock.h" // ut::AutoInterruptLock -#if 0 -#include // DCFlushRange -#include // AICheckInit -#include -#include -#include -#else -#include -#endif +#include // DCFlushRange +#include // AICheckInit +#include +#include +#include #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_AxVoice.cpp b/src/nw4r/snd/snd_AxVoice.cpp index e87e1562..be050bd3 100644 --- a/src/nw4r/snd/snd_AxVoice.cpp +++ b/src/nw4r/snd/snd_AxVoice.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/AxVoice.h" +#include "nw4r/snd/snd_AxVoice.h" /* Original source: * kiwi515/ogws @@ -12,26 +12,22 @@ #include #include -#include // BOOLIFY_TERNARY -#include +#include "common.h" -#include "nw4r/snd/adpcm.h" // DecodeDspAdpcm -#include "nw4r/snd/AxManager.h" -#include "nw4r/snd/AxVoiceManager.h" -#include "nw4r/snd/BiquadFilterCallback.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/Util.h" // Util::GetRemoteFilterCoefs +#include "nw4r/snd/snd_adpcm.h" // DecodeDspAdpcm +#include "nw4r/snd/snd_AxManager.h" +#include "nw4r/snd/snd_AxVoiceManager.h" +#include "nw4r/snd/snd_BiquadFilterCallback.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_Util.h" // Util::GetRemoteFilterCoefs -#include "nw4r/ut/inlines.h" -#include "nw4r/ut/Lock.h" // ut::AutoInterruptLock +#include "nw4r/ut/ut_algorithm.h" +#include "nw4r/ut/ut_Lock.h" // ut::AutoInterruptLock -#if 0 -#include -#include -#include -#else -#include -#endif +#include +#include +#include +#include #include "nw4r/NW4RAssert.hpp" @@ -871,14 +867,14 @@ void AxVoice::CalcOffsetAdpcmParam(u16 *outPredScale, u16 *outYn1, u16 *outYn2, if (currentPos % AX_ADPCM_NIBBLES_PER_FRAME == 0) { byte_t byte = *static_cast(OSPhysicalToCached( - reinterpret_cast(currentPos / sizeof(u16)))); + currentPos / sizeof(u16))); adpcm.pred_scale = byte; currentPos += sizeof(u16); } byte_t byte = *static_cast(OSPhysicalToCached( - reinterpret_cast(currentPos / sizeof(u16)))); + currentPos / sizeof(u16))); u8 nibble; if (currentPos % sizeof(u16) != 0) @@ -1016,7 +1012,7 @@ void AxVoiceParamBlock::SetVoiceMix(AXPBMIX const &mix, bool immediatelySync) u16 *src = const_cast(reinterpret_cast(&mix)); u16 *dst = reinterpret_cast(&mVpb->pb.mix); - byte4_t mixerCtrl = 0; + u32 mixerCtrl = 0; if ((*dst++ = *src++)) // vL mixerCtrl |= AX_MIXER_CTRL_L; diff --git a/src/nw4r/snd/snd_AxVoiceManager.cpp b/src/nw4r/snd/snd_AxVoiceManager.cpp index f617a11c..b28623ca 100644 --- a/src/nw4r/snd/snd_AxVoiceManager.cpp +++ b/src/nw4r/snd/snd_AxVoiceManager.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/AxVoiceManager.h" +#include "nw4r/snd/snd_AxVoiceManager.h" /* Original source: * kiwi515/ogws @@ -11,18 +11,14 @@ #include -#include +#include "common.h" -#include "nw4r/snd/AxVoice.h" +#include "nw4r/snd/snd_AxVoice.h" -#include "nw4r/ut/Lock.h" // ut::AutoInterruptLock +#include "nw4r/ut/ut_Lock.h" // ut::AutoInterruptLock -#if 0 -#include -#include -#else -#include -#endif +#include +#include #include "nw4r/NW4RAssert.hpp" @@ -179,7 +175,7 @@ AxVoice *AxVoiceManager::AcquireAxVoice(u32 priority, return nullptr; AXVPB *vpb = AXAcquireVoice(priority, &AxVoice::VoiceCallback, - reinterpret_cast(voice)); + reinterpret_cast(voice)); if (!vpb) { Free(voice); diff --git a/src/nw4r/snd/snd_Bank.cpp b/src/nw4r/snd/snd_Bank.cpp index 02e25094..937616c2 100644 --- a/src/nw4r/snd/snd_Bank.cpp +++ b/src/nw4r/snd/snd_Bank.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/Bank.h" +#include "nw4r/snd/snd_Bank.h" /* Original source: * kiwi515/ogws @@ -9,14 +9,14 @@ * headers */ -#include +#include "common.h" -#include "nw4r/snd/BankFile.h" // InstInfo -#include "nw4r/snd/Channel.h" -#include "nw4r/snd/NoteOnCallback.h" // NoteOnInfo -#include "nw4r/snd/WaveFile.h" // WaveInfo +#include "nw4r/snd/snd_BankFile.h" // InstInfo +#include "nw4r/snd/snd_Channel.h" +#include "nw4r/snd/snd_NoteOnCallback.h" // NoteOnInfo +#include "nw4r/snd/snd_WaveFile.h" // WaveInfo -#include "nw4r/ut/inlines.h" // ut::Min +#include "nw4r/ut/ut_algorithm.h" // ut::Min /******************************************************************************* * functions diff --git a/src/nw4r/snd/snd_BankFile.cpp b/src/nw4r/snd/snd_BankFile.cpp index 971efb1e..349c5e37 100644 --- a/src/nw4r/snd/snd_BankFile.cpp +++ b/src/nw4r/snd/snd_BankFile.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/BankFile.h" +#include "nw4r/snd/snd_BankFile.h" /* Original source: * kiwi515/ogws @@ -9,15 +9,14 @@ * headers */ -#include // NW4R_FILE_VERSION -#include +#include "common.h" -#include "nw4r/snd/Util.h" -#include "nw4r/snd/WaveArchive.h" // WaveArchiveReader -#include "nw4r/snd/WaveFile.h" +#include "nw4r/snd/snd_Util.h" +#include "nw4r/snd/snd_WaveArchive.h" // WaveArchiveReader +#include "nw4r/snd/snd_WaveFile.h" -#include "nw4r/ut/binaryFileFormat.h" // ut::BinaryFileHeader -#include "nw4r/ut/inlines.h" +#include "nw4r/ut/ut_binaryFileFormat.h" // ut::BinaryFileHeader +#include "nw4r/ut/ut_algorithm.h" #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_BasicPlayer.cpp b/src/nw4r/snd/snd_BasicPlayer.cpp index bcac6152..e5695e31 100644 --- a/src/nw4r/snd/snd_BasicPlayer.cpp +++ b/src/nw4r/snd/snd_BasicPlayer.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/BasicPlayer.h" +#include "nw4r/snd/snd_BasicPlayer.h" /* Original source: * kiwi515/ogws @@ -9,11 +9,10 @@ * headers */ -#include // ARRAY_LENGTH -#include // f32 +#include "common.h" // f32 -#include "nw4r/snd/BasicSound.h" -#include "nw4r/snd/global.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_global.h" #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_BasicSound.cpp b/src/nw4r/snd/snd_BasicSound.cpp index 69bb2e1f..0aacd888 100644 --- a/src/nw4r/snd/snd_BasicSound.cpp +++ b/src/nw4r/snd/snd_BasicSound.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/BasicSound.h" +#include "nw4r/snd/snd_BasicSound.h" /* Original source: * kiwi515/ogws @@ -12,19 +12,18 @@ #include // ULONG_MAX #include -#include -#include +#include "common.h" -#include "nw4r/snd/BasicPlayer.h" -#include "nw4r/snd/ExternalSoundPlayer.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/MoveValue.h" -#include "nw4r/snd/SoundActor.h" -#include "nw4r/snd/SoundHandle.h" -#include "nw4r/snd/SoundPlayer.h" +#include "nw4r/snd/snd_BasicPlayer.h" +#include "nw4r/snd/snd_ExternalSoundPlayer.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_MoveValue.h" +#include "nw4r/snd/snd_SoundActor.h" +#include "nw4r/snd/snd_SoundHandle.h" +#include "nw4r/snd/snd_SoundPlayer.h" -#include "nw4r/ut/inlines.h" // ut::Clamp -#include "nw4r/ut/RuntimeTypeInfo.h" +#include "nw4r/ut/ut_algorithm.h" // ut::Clamp +#include "nw4r/ut/ut_RuntimeTypeInfo.h" #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_BiquadFilterPreset.cpp b/src/nw4r/snd/snd_BiquadFilterPreset.cpp index 4f1d8374..7d00bfb3 100644 --- a/src/nw4r/snd/snd_BiquadFilterPreset.cpp +++ b/src/nw4r/snd/snd_BiquadFilterPreset.cpp @@ -1,15 +1,14 @@ -#include "nw4r/snd/BiquadFilterPreset.h" +#include "nw4r/snd/snd_BiquadFilterPreset.h" /******************************************************************************* * headers */ -#include // ATTR_UNUSED -#include // f32 +#include "common.h" // f32 -#include "nw4r/snd/BiquadFilterCallback.h" +#include "nw4r/snd/snd_BiquadFilterCallback.h" -#include "nw4r/ut/inlines.h" // ut::Clamp +#include "nw4r/ut/ut_algorithm.h" // ut::Clamp /******************************************************************************* * variables diff --git a/src/nw4r/snd/snd_Channel.cpp b/src/nw4r/snd/snd_Channel.cpp index 07622a08..c55d4321 100644 --- a/src/nw4r/snd/snd_Channel.cpp +++ b/src/nw4r/snd/snd_Channel.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/Channel.h" +#include "nw4r/snd/snd_Channel.h" /* Original source: * kiwi515/ogws @@ -9,20 +9,19 @@ * headers */ -#include -#include +#include "common.h" -#include "nw4r/snd/EnvGenerator.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/InstancePool.h" -#include "nw4r/snd/Lfo.h" -#include "nw4r/snd/MoveValue.h" -#include "nw4r/snd/Util.h" -#include "nw4r/snd/Voice.h" -#include "nw4r/snd/VoiceManager.h" -#include "nw4r/snd/WaveFile.h" +#include "nw4r/snd/snd_EnvGenerator.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_InstancePool.h" +#include "nw4r/snd/snd_Lfo.h" +#include "nw4r/snd/snd_MoveValue.h" +#include "nw4r/snd/snd_Util.h" +#include "nw4r/snd/snd_Voice.h" +#include "nw4r/snd/snd_VoiceManager.h" +#include "nw4r/snd/snd_WaveFile.h" -#include "nw4r/ut/Lock.h" +#include "nw4r/ut/ut_Lock.h" #include "nw4r/NW4RAssert.hpp" @@ -117,7 +116,7 @@ Channel::Channel() : Channel::~Channel() {} -void Channel::InitParam(Callback *callback, register_t callbackData) +void Channel::InitParam(Callback *callback, u32 callbackData) { mNextLink = nullptr; mCallback = callback; @@ -433,7 +432,7 @@ void Channel::VoiceCallbackFunc(Voice *voice, Voice::VoiceCallbackStatus status, Channel *Channel::AllocChannel(int voiceChannelCount, int voiceOutCount, int priority, Callback *callback, - register_t callbackData) + u32 callbackData) { NW4RAssertHeaderClampedLRValue_Line(606, priority, 0, 255); diff --git a/src/nw4r/snd/snd_DisposeCallbackManager.cpp b/src/nw4r/snd/snd_DisposeCallbackManager.cpp index be384d69..060bc6fc 100644 --- a/src/nw4r/snd/snd_DisposeCallbackManager.cpp +++ b/src/nw4r/snd/snd_DisposeCallbackManager.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/DisposeCallbackManager.h" +#include "nw4r/snd/snd_DisposeCallbackManager.h" /* Original source: * kiwi515/ogws @@ -9,12 +9,11 @@ * headers */ -#include -#include +#include "common.h" -#include "nw4r/snd/SoundThread.h" +#include "nw4r/snd/snd_SoundThread.h" -#include "nw4r/ut/Lock.h" // ut::AutoInterruptLock +#include "nw4r/ut/ut_Lock.h" // ut::AutoInterruptLock /******************************************************************************* * functions diff --git a/src/nw4r/snd/snd_DvdSoundArchive.cpp b/src/nw4r/snd/snd_DvdSoundArchive.cpp index 7b9adf2a..17187007 100644 --- a/src/nw4r/snd/snd_DvdSoundArchive.cpp +++ b/src/nw4r/snd/snd_DvdSoundArchive.cpp @@ -1,6 +1,6 @@ /* Only implemented to the extent necessary to match data sections. */ -#include "nw4r/snd/DvdSoundArchive.h" +#include "nw4r/snd/snd_DvdSoundArchive.h" nw4r::snd::DvdSoundArchive::DvdSoundArchive() {} nw4r::snd::DvdSoundArchive::DvdFileStream::DvdFileStream() {} diff --git a/src/nw4r/snd/snd_EnvGenerator.cpp b/src/nw4r/snd/snd_EnvGenerator.cpp index fe40431b..07f7809e 100644 --- a/src/nw4r/snd/snd_EnvGenerator.cpp +++ b/src/nw4r/snd/snd_EnvGenerator.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/EnvGenerator.h" +#include "nw4r/snd/snd_EnvGenerator.h" /* Original source: * kiwi515/ogws @@ -9,7 +9,7 @@ * headers */ -#include +#include "common.h" #include diff --git a/src/nw4r/snd/snd_ExternalSoundPlayer.cpp b/src/nw4r/snd/snd_ExternalSoundPlayer.cpp index afb6f117..af7c95f3 100644 --- a/src/nw4r/snd/snd_ExternalSoundPlayer.cpp +++ b/src/nw4r/snd/snd_ExternalSoundPlayer.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/ExternalSoundPlayer.h" +#include "nw4r/snd/snd_ExternalSoundPlayer.h" /* Original source: * kiwi515/ogws @@ -10,11 +10,10 @@ */ #include -#include // NW4R_RANGE_FOR -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/snd/BasicSound.h" -#include "nw4r/snd/SoundThread.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_SoundThread.h" #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_InstancePool.cpp b/src/nw4r/snd/snd_InstancePool.cpp index e81c5f4c..50b4fecd 100644 --- a/src/nw4r/snd/snd_InstancePool.cpp +++ b/src/nw4r/snd/snd_InstancePool.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/InstancePool.h" +#include "nw4r/snd/snd_InstancePool.h" /* Original source: * kiwi515/ogws @@ -9,10 +9,10 @@ * headers */ -#include +#include "common.h" -#include "nw4r/ut/Lock.h" // ut::AutoInterruptLock -#include "nw4r/ut/inlines.h" // ut::RoundUp +#include "nw4r/ut/ut_Lock.h" // ut::AutoInterruptLock +#include "nw4r/ut/ut_algorithm.h" // ut::RoundUp #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_Lfo.cpp b/src/nw4r/snd/snd_Lfo.cpp index a02b717d..1c848667 100644 --- a/src/nw4r/snd/snd_Lfo.cpp +++ b/src/nw4r/snd/snd_Lfo.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/Lfo.h" +#include "nw4r/snd/snd_Lfo.h" /* Original source: * kiwi515/ogws @@ -9,7 +9,7 @@ * headers */ -#include +#include "common.h" #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_McsSoundArchive.cpp b/src/nw4r/snd/snd_McsSoundArchive.cpp index b2e0d36e..9d2c4d3a 100644 --- a/src/nw4r/snd/snd_McsSoundArchive.cpp +++ b/src/nw4r/snd/snd_McsSoundArchive.cpp @@ -2,7 +2,7 @@ * inline functions and data sections. */ -#include "nw4r/snd/McsSoundArchive.h" +#include "nw4r/snd/snd_McsSoundArchive.h" nw4r::snd::McsSoundArchive::McsSoundArchive() {} nw4r::snd::McsSoundArchive::McsFileStream::McsFileStream() {} diff --git a/src/nw4r/snd/snd_MemorySoundArchive.cpp b/src/nw4r/snd/snd_MemorySoundArchive.cpp index a1cf5406..5faa944c 100644 --- a/src/nw4r/snd/snd_MemorySoundArchive.cpp +++ b/src/nw4r/snd/snd_MemorySoundArchive.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/MemorySoundArchive.h" +#include "nw4r/snd/snd_MemorySoundArchive.h" /* Original source: * kiwi515/ogws @@ -12,14 +12,14 @@ #include // std::memcpy #include -#include +#include "common.h" -#include "nw4r/snd/SoundArchive.h" -#include "nw4r/snd/SoundArchiveFile.h" // SoundArchiveFileReader +#include "nw4r/snd/snd_SoundArchive.h" +#include "nw4r/snd/snd_SoundArchiveFile.h" // SoundArchiveFileReader -#include "nw4r/ut/FileStream.h" -#include "nw4r/ut/inlines.h" -#include "nw4r/ut/RuntimeTypeInfo.h" // IWYU pragma: keep (need the complete type) +#include "nw4r/ut/ut_FileStream.h" +#include "nw4r/ut/ut_algorithm.h" +#include "nw4r/ut/ut_RuntimeTypeInfo.h" // IWYU pragma: keep (need the complete type) #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_MidiSeqPlayer.cpp b/src/nw4r/snd/snd_MidiSeqPlayer.cpp index 29f85f4f..6da97c92 100644 --- a/src/nw4r/snd/snd_MidiSeqPlayer.cpp +++ b/src/nw4r/snd/snd_MidiSeqPlayer.cpp @@ -1,6 +1,6 @@ /* Only implemented to the extent necessary to match early instantiations of * inline functions and data sections. */ -#include "nw4r/snd/MidiSeqPlayer.h" +#include "nw4r/snd/snd_MidiSeqPlayer.h" nw4r::snd::detail::MidiSeqPlayer::MidiSeqPlayer() {} diff --git a/src/nw4r/snd/snd_MidiSeqTrack.cpp b/src/nw4r/snd/snd_MidiSeqTrack.cpp index fa4c1c11..b4f970bd 100644 --- a/src/nw4r/snd/snd_MidiSeqTrack.cpp +++ b/src/nw4r/snd/snd_MidiSeqTrack.cpp @@ -1,6 +1,6 @@ /* Only implemented to the extent necessary to match early instantiations of * inline functions and data sections. */ -#include "nw4r/snd/MidiSeqTrack.h" +#include "nw4r/snd/snd_MidiSeqTrack.h" nw4r::snd::detail::MidiSeqTrack::MidiSeqTrack() {} diff --git a/src/nw4r/snd/snd_MidiSeqTrackAllocator.cpp b/src/nw4r/snd/snd_MidiSeqTrackAllocator.cpp index c21af6d6..72ed61c3 100644 --- a/src/nw4r/snd/snd_MidiSeqTrackAllocator.cpp +++ b/src/nw4r/snd/snd_MidiSeqTrackAllocator.cpp @@ -1,6 +1,6 @@ /* Only implemented to the extent necessary to match early instantiations of * inline functions and data sections. */ -#include "nw4r/snd/MidiSeqTrackAllocator.h" +#include "nw4r/snd/snd_MidiSeqTrackAllocator.h" nw4r::snd::detail::MidiSeqTrackAllocator::MidiSeqTrackAllocator() {} diff --git a/src/nw4r/snd/snd_MmlParser.cpp b/src/nw4r/snd/snd_MmlParser.cpp index ab336e35..d481920f 100644 --- a/src/nw4r/snd/snd_MmlParser.cpp +++ b/src/nw4r/snd/snd_MmlParser.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/MmlParser.h" +#include "nw4r/snd/snd_MmlParser.h" /* Original source: * kiwi515/ogws @@ -9,24 +9,19 @@ * headers */ -#include -#include +#include "common.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/Lfo.h" // LfoParam -#include "nw4r/snd/MmlSeqTrack.h" -#include "nw4r/snd/MoveValue.h" -#include "nw4r/snd/SeqPlayer.h" -#include "nw4r/snd/SeqTrack.h" -#include "nw4r/snd/Util.h" // Util::CalcRandom +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_Lfo.h" // LfoParam +#include "nw4r/snd/snd_MmlSeqTrack.h" +#include "nw4r/snd/snd_MoveValue.h" +#include "nw4r/snd/snd_SeqPlayer.h" +#include "nw4r/snd/snd_SeqTrack.h" +#include "nw4r/snd/snd_Util.h" // Util::CalcRandom -#include "nw4r/ut/inlines.h" +#include "nw4r/ut/ut_algorithm.h" -#if 0 -#include -#else -#include -#endif +#include #include "nw4r/NW4RAssert.hpp" @@ -846,9 +841,9 @@ Channel *MmlParser::NoteOnCommandProc(MmlSeqTrack *track, int key, int velocity, return track->NoteOn(key, velocity, length, tieFlag); } -byte2_t MmlParser::Read16(byte_t const **ptr) const +u16 MmlParser::Read16(byte_t const **ptr) const { - byte2_t ret = ReadByte(ptr); + u16 ret = ReadByte(ptr); ret <<= 8; ret |= ReadByte(ptr); @@ -856,9 +851,9 @@ byte2_t MmlParser::Read16(byte_t const **ptr) const return ret; } -byte4_t MmlParser::Read24(byte_t const **ptr) const +u32 MmlParser::Read24(byte_t const **ptr) const { - byte4_t ret = ReadByte(ptr); + u32 ret = ReadByte(ptr); ret <<= 8; ret |= ReadByte(ptr); @@ -955,7 +950,7 @@ s16 volatile *MmlParser::GetVariablePtr(SeqPlayer *player, SeqTrack *track, } u32 MmlParser::ParseAllocTrack(void const *baseAddress, u32 seqOffset, - byte4_t *allocTrack) + u32 *allocTrack) { NW4RAssertPointerNonnull_Line(1051, baseAddress); NW4RAssertPointerNonnull_Line(1052, allocTrack); diff --git a/src/nw4r/snd/snd_MmlSeqTrack.cpp b/src/nw4r/snd/snd_MmlSeqTrack.cpp index e2eee4ce..569a2302 100644 --- a/src/nw4r/snd/snd_MmlSeqTrack.cpp +++ b/src/nw4r/snd/snd_MmlSeqTrack.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/MmlSeqTrack.h" +#include "nw4r/snd/snd_MmlSeqTrack.h" /* Original source: * kiwi515/ogws @@ -9,7 +9,7 @@ * headers */ -#include "nw4r/snd/MmlParser.h" +#include "nw4r/snd/snd_MmlParser.h" /******************************************************************************* * functions diff --git a/src/nw4r/snd/snd_MmlSeqTrackAllocator.cpp b/src/nw4r/snd/snd_MmlSeqTrackAllocator.cpp index 3363143a..db3cffbe 100644 --- a/src/nw4r/snd/snd_MmlSeqTrackAllocator.cpp +++ b/src/nw4r/snd/snd_MmlSeqTrackAllocator.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/MmlSeqTrackAllocator.h" +#include "nw4r/snd/snd_MmlSeqTrackAllocator.h" /* Original source: * kiwi515/ogws @@ -9,11 +9,11 @@ * headers */ -#include +#include "common.h" -#include "nw4r/snd/InstancePool.h" -#include "nw4r/snd/MmlSeqTrack.h" -#include "nw4r/snd/SeqTrack.h" +#include "nw4r/snd/snd_InstancePool.h" +#include "nw4r/snd/snd_MmlSeqTrack.h" +#include "nw4r/snd/snd_SeqTrack.h" #include diff --git a/src/nw4r/snd/snd_PlayerHeap.cpp b/src/nw4r/snd/snd_PlayerHeap.cpp index 677b4f37..2d397baf 100644 --- a/src/nw4r/snd/snd_PlayerHeap.cpp +++ b/src/nw4r/snd/snd_PlayerHeap.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/PlayerHeap.h" +#include "nw4r/snd/snd_PlayerHeap.h" /******************************************************************************* * headers @@ -6,12 +6,12 @@ #include // NULL -#include +#include "common.h" -#include "nw4r/snd/DisposeCallbackManager.h" -#include "nw4r/snd/SoundThread.h" // SoundThread::AutoLock +#include "nw4r/snd/snd_DisposeCallbackManager.h" +#include "nw4r/snd/snd_SoundThread.h" // SoundThread::AutoLock -#include "nw4r/ut/inlines.h" +#include "nw4r/ut/ut_algorithm.h" #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_SeqFile.cpp b/src/nw4r/snd/snd_SeqFile.cpp index 027a3343..6dd78c3d 100644 --- a/src/nw4r/snd/snd_SeqFile.cpp +++ b/src/nw4r/snd/snd_SeqFile.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SeqFile.h" +#include "nw4r/snd/snd_SeqFile.h" /* Original source: * kiwi515/ogws @@ -11,13 +11,12 @@ #include -#include // NW4R_FILE_VERSION -#include +#include "common.h" -#include "nw4r/snd/Util.h" +#include "nw4r/snd/snd_Util.h" -#include "nw4r/ut/binaryFileFormat.h" -#include "nw4r/ut/inlines.h" // ut::AddOffsetToPtr +#include "nw4r/ut/ut_binaryFileFormat.h" +#include "nw4r/ut/ut_algorithm.h" // ut::AddOffsetToPtr #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_SeqPlayer.cpp b/src/nw4r/snd/snd_SeqPlayer.cpp index 8ed60033..d9195d5c 100644 --- a/src/nw4r/snd/snd_SeqPlayer.cpp +++ b/src/nw4r/snd/snd_SeqPlayer.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SeqPlayer.h" +#include "nw4r/snd/snd_SeqPlayer.h" /* Original source: * kiwi515/ogws @@ -10,16 +10,16 @@ */ #include -#include +#include "common.h" -#include "nw4r/snd/BasicPlayer.h" -#include "nw4r/snd/DisposeCallbackManager.h" -#include "nw4r/snd/NoteOnCallback.h" -#include "nw4r/snd/SeqTrack.h" -#include "nw4r/snd/SeqTrackAllocator.h" -#include "nw4r/snd/SoundThread.h" +#include "nw4r/snd/snd_BasicPlayer.h" +#include "nw4r/snd/snd_DisposeCallbackManager.h" +#include "nw4r/snd/snd_NoteOnCallback.h" +#include "nw4r/snd/snd_SeqTrack.h" +#include "nw4r/snd/snd_SeqTrackAllocator.h" +#include "nw4r/snd/snd_SoundThread.h" -#include "nw4r/ut/Lock.h" // ut::AutoInterruptLock +#include "nw4r/ut/ut_Lock.h" // ut::AutoInterruptLock #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_SeqSound.cpp b/src/nw4r/snd/snd_SeqSound.cpp index 15152a92..c398e9ee 100644 --- a/src/nw4r/snd/snd_SeqSound.cpp +++ b/src/nw4r/snd/snd_SeqSound.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SeqSound.h" +#include "nw4r/snd/snd_SeqSound.h" /* Original source: * kiwi515/ogws @@ -10,24 +10,20 @@ */ #include -#include +#include "common.h" -#include "nw4r/snd/BasicSound.h" -#include "nw4r/snd/PlayerHeap.h" -#include "nw4r/snd/SeqFile.h" -#include "nw4r/snd/SeqPlayer.h" -#include "nw4r/snd/SeqSoundHandle.h" -#include "nw4r/snd/SoundInstanceManager.h" -#include "nw4r/snd/TaskManager.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_PlayerHeap.h" +#include "nw4r/snd/snd_SeqFile.h" +#include "nw4r/snd/snd_SeqPlayer.h" +#include "nw4r/snd/snd_SeqSoundHandle.h" +#include "nw4r/snd/snd_SoundInstanceManager.h" +#include "nw4r/snd/snd_TaskManager.h" -#include "nw4r/ut/FileStream.h" -#include "nw4r/ut/RuntimeTypeInfo.h" +#include "nw4r/ut/ut_FileStream.h" +#include "nw4r/ut/ut_RuntimeTypeInfo.h" -#if 0 -#include // DVD_ECANCELED -#else -#include -#endif +#include // DVD_ECANCELED #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_SeqSoundHandle.cpp b/src/nw4r/snd/snd_SeqSoundHandle.cpp index d8b8d8f3..b5562bd7 100644 --- a/src/nw4r/snd/snd_SeqSoundHandle.cpp +++ b/src/nw4r/snd/snd_SeqSoundHandle.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SeqSoundHandle.h" +#include "nw4r/snd/snd_SeqSoundHandle.h" /* Original source: * kiwi515/ogws @@ -9,9 +9,9 @@ * headers */ -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/snd/SeqSound.h" +#include "nw4r/snd/snd_SeqSound.h" /******************************************************************************* * functions diff --git a/src/nw4r/snd/snd_SeqTrack.cpp b/src/nw4r/snd/snd_SeqTrack.cpp index 09904026..81b2cb69 100644 --- a/src/nw4r/snd/snd_SeqTrack.cpp +++ b/src/nw4r/snd/snd_SeqTrack.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SeqTrack.h" +#include "nw4r/snd/snd_SeqTrack.h" /* Original source: * kiwi515/ogws @@ -10,17 +10,17 @@ */ #include -#include +#include "common.h" -#include "nw4r/snd/Channel.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/Lfo.h" -#include "nw4r/snd/MoveValue.h" -#include "nw4r/snd/NoteOnCallback.h" -#include "nw4r/snd/SeqPlayer.h" -#include "nw4r/snd/SoundThread.h" +#include "nw4r/snd/snd_Channel.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_Lfo.h" +#include "nw4r/snd/snd_MoveValue.h" +#include "nw4r/snd/snd_NoteOnCallback.h" +#include "nw4r/snd/snd_SeqPlayer.h" +#include "nw4r/snd/snd_SoundThread.h" -#include "nw4r/ut/inlines.h" +#include "nw4r/ut/ut_algorithm.h" #include "nw4r/NW4RAssert.hpp" @@ -370,7 +370,7 @@ void SeqTrack::FreeAllChannel() void SeqTrack::ChannelCallbackFunc(Channel *dropChannel, Channel::ChannelCallbackStatus status, - register_t userData) + u32 userData) { SoundThread::AutoLock lock; @@ -571,7 +571,7 @@ Channel *SeqTrack::NoteOn(int key, int velocity, s32 length, bool tieFlag) playerParam.priority + GetParserTrackParam().priority, mSeqPlayer->GetVoiceOutCount(), &ChannelCallbackFunc, - reinterpret_cast(this) + reinterpret_cast(this) }; channel = mSeqPlayer->NoteOn(mParserTrackParam.bankNo, info); diff --git a/src/nw4r/snd/snd_SoundActor.cpp b/src/nw4r/snd/snd_SoundActor.cpp index 04bbfb04..c390dc15 100644 --- a/src/nw4r/snd/snd_SoundActor.cpp +++ b/src/nw4r/snd/snd_SoundActor.cpp @@ -2,11 +2,11 @@ * inline functions and data sections. */ -#include "nw4r/snd/SoundActor.h" +#include "nw4r/snd/snd_SoundActor.h" -#include +#include "common.h" -#include "nw4r/snd/SoundArchivePlayer.h" +#include "nw4r/snd/snd_SoundArchivePlayer.h" nw4r::snd::SoundActor::SoundActor() : mSoundArchivePlayer (*new SoundArchivePlayer) diff --git a/src/nw4r/snd/snd_SoundArchive.cpp b/src/nw4r/snd/snd_SoundArchive.cpp index 8d3b5cc3..d8f98a2c 100644 --- a/src/nw4r/snd/snd_SoundArchive.cpp +++ b/src/nw4r/snd/snd_SoundArchive.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SoundArchive.h" +#include "nw4r/snd/snd_SoundArchive.h" /* Original source: * kiwi515/ogws @@ -11,9 +11,9 @@ #include -#include +#include "common.h" -#include "nw4r/snd/SoundArchiveFile.h" // detail::SoundArchiveFileReader +#include "nw4r/snd/snd_SoundArchiveFile.h" // detail::SoundArchiveFileReader #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_SoundArchiveFile.cpp b/src/nw4r/snd/snd_SoundArchiveFile.cpp index 8c244dd0..802422aa 100644 --- a/src/nw4r/snd/snd_SoundArchiveFile.cpp +++ b/src/nw4r/snd/snd_SoundArchiveFile.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SoundArchiveFile.h" +#include "nw4r/snd/snd_SoundArchiveFile.h" /* Original source: * kiwi515/ogws @@ -12,15 +12,14 @@ #include #include -#include -#include +#include "common.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/SoundArchive.h" -#include "nw4r/snd/Util.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_SoundArchive.h" +#include "nw4r/snd/snd_Util.h" -#include "nw4r/ut/binaryFileFormat.h" // ut::BinaryFileHeader -#include "nw4r/ut/inlines.h" // ut::AddOffsetToPtr +#include "nw4r/ut/ut_binaryFileFormat.h" // ut::BinaryFileHeader +#include "nw4r/ut/ut_algorithm.h" // ut::AddOffsetToPtr #include @@ -247,7 +246,7 @@ bool SoundArchiveFileReader::ReadStrmSoundInfo( info->allocChannelCount = 0; // is this meant to be src->allocTrackFlag? - for (byte2_t bitflag = src->allocChannelCount; bitflag; bitflag >>= 1) + for (u16 bitflag = src->allocChannelCount; bitflag; bitflag >>= 1) { if (bitflag & 1) info->allocChannelCount++; diff --git a/src/nw4r/snd/snd_SoundArchivePlayer.cpp b/src/nw4r/snd/snd_SoundArchivePlayer.cpp index 6d0e8eae..44eeed9e 100644 --- a/src/nw4r/snd/snd_SoundArchivePlayer.cpp +++ b/src/nw4r/snd/snd_SoundArchivePlayer.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SoundArchivePlayer.h" +#include "nw4r/snd/snd_SoundArchivePlayer.h" /* Original source: * kiwi515/ogws @@ -12,39 +12,38 @@ #include #include -#include -#include +#include "common.h" -#include "nw4r/snd/Bank.h" -#include "nw4r/snd/BasicSound.h" -#include "nw4r/snd/debug.h" -#include "nw4r/snd/DisposeCallbackManager.h" -#include "nw4r/snd/ExternalSoundPlayer.h" -#include "nw4r/snd/MmlParser.h" -#include "nw4r/snd/MmlSeqTrack.h" -#include "nw4r/snd/MmlSeqTrackAllocator.h" -#include "nw4r/snd/PlayerHeap.h" -#include "nw4r/snd/SeqFile.h" -#include "nw4r/snd/SeqPlayer.h" -#include "nw4r/snd/SeqSound.h" -#include "nw4r/snd/SoundActor.h" -#include "nw4r/snd/SoundArchive.h" -#include "nw4r/snd/SoundHandle.h" -#include "nw4r/snd/SoundInstanceManager.h" -#include "nw4r/snd/SoundPlayer.h" -#include "nw4r/snd/SoundStartable.h" -#include "nw4r/snd/SoundSystem.h" -#include "nw4r/snd/SoundThread.h" -#include "nw4r/snd/StrmChannel.h" -#include "nw4r/snd/StrmPlayer.h" -#include "nw4r/snd/StrmSound.h" -#include "nw4r/snd/WaveFile.h" -#include "nw4r/snd/WaveSound.h" -#include "nw4r/snd/WsdFile.h" -#include "nw4r/snd/WsdPlayer.h" +#include "nw4r/snd/snd_Bank.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_debug.h" +#include "nw4r/snd/snd_DisposeCallbackManager.h" +#include "nw4r/snd/snd_ExternalSoundPlayer.h" +#include "nw4r/snd/snd_MmlParser.h" +#include "nw4r/snd/snd_MmlSeqTrack.h" +#include "nw4r/snd/snd_MmlSeqTrackAllocator.h" +#include "nw4r/snd/snd_PlayerHeap.h" +#include "nw4r/snd/snd_SeqFile.h" +#include "nw4r/snd/snd_SeqPlayer.h" +#include "nw4r/snd/snd_SeqSound.h" +#include "nw4r/snd/snd_SoundActor.h" +#include "nw4r/snd/snd_SoundArchive.h" +#include "nw4r/snd/snd_SoundHandle.h" +#include "nw4r/snd/snd_SoundInstanceManager.h" +#include "nw4r/snd/snd_SoundPlayer.h" +#include "nw4r/snd/snd_SoundStartable.h" +#include "nw4r/snd/snd_SoundSystem.h" +#include "nw4r/snd/snd_SoundThread.h" +#include "nw4r/snd/snd_StrmChannel.h" +#include "nw4r/snd/snd_StrmPlayer.h" +#include "nw4r/snd/snd_StrmSound.h" +#include "nw4r/snd/snd_WaveFile.h" +#include "nw4r/snd/snd_WaveSound.h" +#include "nw4r/snd/snd_WsdFile.h" +#include "nw4r/snd/snd_WsdPlayer.h" -#include "nw4r/ut/FileStream.h" -#include "nw4r/ut/inlines.h" +#include "nw4r/ut/ut_FileStream.h" +#include "nw4r/ut/ut_algorithm.h" #include "nw4r/NW4RAssert.hpp" @@ -1417,7 +1416,7 @@ detail::Channel *SoundArchivePlayer::SeqNoteOnCallback::NoteOn( bool SoundArchivePlayer::WsdCallback::GetWaveSoundData( detail::WaveSoundInfo *info, detail::WaveSoundNoteInfo *noteInfo, detail::WaveInfo *waveData, void const *waveSoundData, int index, - int noteIndex, register_t userData) const + int noteIndex, u32 userData) const { u32 fileID = userData; diff --git a/src/nw4r/snd/snd_SoundHandle.cpp b/src/nw4r/snd/snd_SoundHandle.cpp index 4483355d..249815da 100644 --- a/src/nw4r/snd/snd_SoundHandle.cpp +++ b/src/nw4r/snd/snd_SoundHandle.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SoundHandle.h" +#include "nw4r/snd/snd_SoundHandle.h" /* Original source: * kiwi515/ogws @@ -9,9 +9,9 @@ * headers */ -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/snd/BasicSound.h" +#include "nw4r/snd/snd_BasicSound.h" #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_SoundPlayer.cpp b/src/nw4r/snd/snd_SoundPlayer.cpp index 6f195226..81e1f800 100644 --- a/src/nw4r/snd/snd_SoundPlayer.cpp +++ b/src/nw4r/snd/snd_SoundPlayer.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SoundPlayer.h" +#include "nw4r/snd/snd_SoundPlayer.h" /* Original source: * kiwi515/ogws @@ -12,15 +12,14 @@ #include // INT_MAX #include -#include -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/snd/BasicSound.h" -#include "nw4r/snd/global.h" // AUX_BUS_NUM -#include "nw4r/snd/PlayerHeap.h" -#include "nw4r/snd/SoundThread.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_global.h" // AUX_BUS_NUM +#include "nw4r/snd/snd_PlayerHeap.h" +#include "nw4r/snd/snd_SoundThread.h" -#include "nw4r/ut/inlines.h" // ut::Clamp +#include "nw4r/ut/ut_algorithm.h" // ut::Clamp #include diff --git a/src/nw4r/snd/snd_SoundStartable.cpp b/src/nw4r/snd/snd_SoundStartable.cpp index 236a1220..4488ef60 100644 --- a/src/nw4r/snd/snd_SoundStartable.cpp +++ b/src/nw4r/snd/snd_SoundStartable.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SoundStartable.h" +#include "nw4r/snd/snd_SoundStartable.h" /* Original source: * kiwi515/ogws @@ -9,10 +9,10 @@ * headers */ -#include // u32 +#include "common.h" // u32 -#include "nw4r/snd/BasicSound.h" -#include "nw4r/snd/SoundHandle.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_SoundHandle.h" /******************************************************************************* * functions @@ -21,7 +21,7 @@ namespace nw4r { namespace snd { SoundStartable::StartResult SoundStartable::detail_StartSound( - SoundHandle *handle, u32 soundId, StartInfo const *startInfo) + SoundHandle *handle, u32 soundId, const StartInfo *startInfo) { StartResult result = detail_SetupSound(handle, soundId, false, startInfo); if (result != START_SUCCESS) diff --git a/src/nw4r/snd/snd_SoundSystem.cpp b/src/nw4r/snd/snd_SoundSystem.cpp index 9a6d592a..01afc6d4 100644 --- a/src/nw4r/snd/snd_SoundSystem.cpp +++ b/src/nw4r/snd/snd_SoundSystem.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SoundSystem.h" +#include "nw4r/snd/snd_SoundSystem.h" /* Original source: * kiwi515/ogws @@ -10,27 +10,22 @@ */ #include -#include // STR -#include +#include "common.h" -#include "nw4r/snd/AxVoiceManager.h" -#include "nw4r/snd/AxManager.h" -#include "nw4r/snd/Channel.h" // ChannelManager -#include "nw4r/snd/global.h" -#include "nw4r/snd/SeqPlayer.h" -#include "nw4r/snd/SoundThread.h" -#include "nw4r/snd/TaskManager.h" -#include "nw4r/snd/TaskThread.h" -#include "nw4r/snd/VoiceManager.h" +#include "nw4r/snd/snd_AxVoiceManager.h" +#include "nw4r/snd/snd_AxManager.h" +#include "nw4r/snd/snd_Channel.h" // ChannelManager +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_SeqPlayer.h" +#include "nw4r/snd/snd_SoundThread.h" +#include "nw4r/snd/snd_TaskManager.h" +#include "nw4r/snd/snd_TaskThread.h" +#include "nw4r/snd/snd_VoiceManager.h" -#if 0 -#include // OSRegisterVersion -#include // AXGetMaxVoices -#include -#include -#else -#include -#endif +#include // OSRegisterVersion +#include // AXGetMaxVoices +#include +#include #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_SoundThread.cpp b/src/nw4r/snd/snd_SoundThread.cpp index 7477deb2..2a8ca309 100644 --- a/src/nw4r/snd/snd_SoundThread.cpp +++ b/src/nw4r/snd/snd_SoundThread.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/SoundThread.h" +#include "nw4r/snd/snd_SoundThread.h" /* Original source: * kiwi515/ogws @@ -10,25 +10,20 @@ */ #include -#include -#include +#include "common.h" -#include "nw4r/snd/AxManager.h" -#include "nw4r/snd/AxVoiceManager.h" -#include "nw4r/snd/Channel.h" // ChannelManager -#include "nw4r/snd/Util.h" // Util::CalcRandom -#include "nw4r/snd/VoiceManager.h" +#include "nw4r/snd/snd_AxManager.h" +#include "nw4r/snd/snd_AxVoiceManager.h" +#include "nw4r/snd/snd_Channel.h" // ChannelManager +#include "nw4r/snd/snd_Util.h" // Util::CalcRandom +#include "nw4r/snd/snd_VoiceManager.h" -#include "nw4r/ut/Lock.h" // ut::detail::AutoLock +#include "nw4r/ut/ut_Lock.h" // ut::detail::AutoLock -#if 0 -#include -#include -#include -#include -#else -#include -#endif +#include +#include +#include +#include #include "nw4r/NW4RAssert.hpp" @@ -65,7 +60,7 @@ bool SoundThread::Create(s32 priority, void *stack, u32 stackSize) return true; mCreateFlag = true; - mStackEnd = static_cast(stack); + mStackEnd = static_cast(stack); BOOL result = OSCreateThread(&mThread, &SoundThreadFunc, &GetInstance(), static_cast(stack) + stackSize, @@ -162,7 +157,7 @@ void SoundThread::SoundThreadProc() { OSReceiveMessage(&mMsgQueue, &message, OS_MESSAGE_FLAG_PERSISTENT); - if (reinterpret_cast(message) == MESSAGE_AX_CALLBACK) + if (reinterpret_cast(message) == MESSAGE_AX_CALLBACK) { ut::detail::AutoLock lock(mMutex); @@ -201,7 +196,7 @@ void SoundThread::SoundThreadProc() curItr->at_0x10(); } } - else if (reinterpret_cast(message) == MESSAGE_SHUTDOWN) + else if (reinterpret_cast(message) == MESSAGE_SHUTDOWN) { break; } diff --git a/src/nw4r/snd/snd_StrmChannel.cpp b/src/nw4r/snd/snd_StrmChannel.cpp index 6aa4db99..dbd47c31 100644 --- a/src/nw4r/snd/snd_StrmChannel.cpp +++ b/src/nw4r/snd/snd_StrmChannel.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/StrmChannel.h" +#include "nw4r/snd/snd_StrmChannel.h" /* Original source: * kiwi515/ogws @@ -11,10 +11,10 @@ #include // std::memset -#include +#include "common.h" -#include "nw4r/ut/inlines.h" -#include "nw4r/ut/Lock.h" // ut::AutoInterruptLock +#include "nw4r/ut/ut_algorithm.h" +#include "nw4r/ut/ut_Lock.h" // ut::AutoInterruptLock #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_StrmFile.cpp b/src/nw4r/snd/snd_StrmFile.cpp index 8283cf45..b5766358 100644 --- a/src/nw4r/snd/snd_StrmFile.cpp +++ b/src/nw4r/snd/snd_StrmFile.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/StrmFile.h" +#include "nw4r/snd/snd_StrmFile.h" /* Original source: * kiwi515/ogws @@ -9,17 +9,16 @@ * headers */ -#include -#include +#include "common.h" -#include "nw4r/snd/adpcm.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/Util.h" -#include "nw4r/snd/WaveFile.h" +#include "nw4r/snd/snd_adpcm.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_Util.h" +#include "nw4r/snd/snd_WaveFile.h" -#include "nw4r/ut/binaryFileFormat.h" -#include "nw4r/ut/FileStream.h" -#include "nw4r/ut/inlines.h" +#include "nw4r/ut/ut_binaryFileFormat.h" +#include "nw4r/ut/ut_FileStream.h" +#include "nw4r/ut/ut_algorithm.h" #include "nw4r/NW4RAssert.hpp" @@ -342,7 +341,7 @@ bool StrmFileLoader::ReadAdpcBlockData(u16 *yn1, u16 *yn2, int blockIndex, u32 readDataSize = channelCount * (sizeof(u16) * 2); NW4RAssert_Line(499, readDataSize <= 32); - alignas(32) u16 buffer[2 * 8]; + ALIGN_DECL(32) u16 buffer[2 * 8]; int readSize = mStream.Read(buffer, sizeof buffer); if (readSize != 32u) diff --git a/src/nw4r/snd/snd_StrmPlayer.cpp b/src/nw4r/snd/snd_StrmPlayer.cpp index 51b04a81..0a6f74d1 100644 --- a/src/nw4r/snd/snd_StrmPlayer.cpp +++ b/src/nw4r/snd/snd_StrmPlayer.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/StrmPlayer.h" +#include "nw4r/snd/snd_StrmPlayer.h" /* Original source: * kiwi515/ogws @@ -13,36 +13,31 @@ #include // std::memcpy #include -#include // ATTR_UNUSED -#include +#include "common.h" -#include "nw4r/snd/StrmSound.h" -#include "nw4r/snd/adpcm.h" -#include "nw4r/snd/AxVoice.h" -#include "nw4r/snd/BasicPlayer.h" -#include "nw4r/snd/Channel.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/InstancePool.h" -#include "nw4r/snd/SoundThread.h" -#include "nw4r/snd/StrmChannel.h" -#include "nw4r/snd/StrmFile.h" -#include "nw4r/snd/TaskManager.h" -#include "nw4r/snd/Voice.h" -#include "nw4r/snd/VoiceManager.h" -#include "nw4r/snd/WaveFile.h" +#include "nw4r/snd/snd_StrmSound.h" +#include "nw4r/snd/snd_adpcm.h" +#include "nw4r/snd/snd_AxVoice.h" +#include "nw4r/snd/snd_BasicPlayer.h" +#include "nw4r/snd/snd_Channel.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_InstancePool.h" +#include "nw4r/snd/snd_SoundThread.h" +#include "nw4r/snd/snd_StrmChannel.h" +#include "nw4r/snd/snd_StrmFile.h" +#include "nw4r/snd/snd_TaskManager.h" +#include "nw4r/snd/snd_Voice.h" +#include "nw4r/snd/snd_VoiceManager.h" +#include "nw4r/snd/snd_WaveFile.h" -#include "nw4r/ut/DvdFileStream.h" -#include "nw4r/ut/FileStream.h" -#include "nw4r/ut/inlines.h" -#include "nw4r/ut/Lock.h" -#include "nw4r/ut/RuntimeTypeInfo.h" +#include "nw4r/ut/ut_DvdFileStream.h" +#include "nw4r/ut/ut_FileStream.h" +#include "nw4r/ut/ut_algorithm.h" +#include "nw4r/ut/ut_Lock.h" +#include "nw4r/ut/ut_RuntimeTypeInfo.h" -#if 0 -#include -#include -#else -#include -#endif +#include +#include #include "nw4r/NW4RAssert.hpp" @@ -90,7 +85,7 @@ StrmPlayer::~StrmPlayer() StrmPlayer::SetupResult StrmPlayer::Setup(StrmBufferPool *bufferPool, int allocChannelCount, - byte2_t allocTrackFlag, + u16 allocTrackFlag, int voiceOutCount) { SoundThread::AutoLock lock; @@ -103,7 +98,7 @@ StrmPlayer::SetupResult StrmPlayer::Setup(StrmBufferPool *bufferPool, InitParam(); mChannelCount = ut::Min(allocChannelCount, STRM_CHANNEL_NUM); - byte4_t bitMask = allocTrackFlag; + u32 bitMask = allocTrackFlag; int trackIndex; for (trackIndex = 0; bitMask; bitMask >>= 1, trackIndex++) @@ -285,7 +280,7 @@ bool StrmPlayer::Start() return true; } -u32 StrmPlayer::GetSampleByByte(byte4_t byte, SampleFormat format) +u32 StrmPlayer::GetSampleByByte(u32 byte, SampleFormat format) { u32 samples = 0; @@ -1344,7 +1339,7 @@ StrmChannel *StrmPlayer::GetTrackChannel(StrmTrack const &track, return &mChannels[index]; } -void StrmPlayer::SetTrackVolume(byte4_t trackBitFlag, f32 volume) +void StrmPlayer::SetTrackVolume(u32 trackBitFlag, f32 volume) { ut::AutoInterruptLock lock; diff --git a/src/nw4r/snd/snd_StrmSound.cpp b/src/nw4r/snd/snd_StrmSound.cpp index 8c5675ed..480e0957 100644 --- a/src/nw4r/snd/snd_StrmSound.cpp +++ b/src/nw4r/snd/snd_StrmSound.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/StrmSound.h" +#include "nw4r/snd/snd_StrmSound.h" /* Original source: * kiwi515/ogws @@ -9,16 +9,15 @@ * headers */ -#include // ARRAY_LENGTH -#include +#include "common.h" -#include "nw4r/snd/BasicSound.h" -#include "nw4r/snd/SoundInstanceManager.h" -#include "nw4r/snd/StrmPlayer.h" -#include "nw4r/snd/StrmSoundHandle.h" -#include "nw4r/snd/MoveValue.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_SoundInstanceManager.h" +#include "nw4r/snd/snd_StrmPlayer.h" +#include "nw4r/snd/snd_StrmSoundHandle.h" +#include "nw4r/snd/snd_MoveValue.h" -#include "nw4r/ut/RuntimeTypeInfo.h" +#include "nw4r/ut/ut_RuntimeTypeInfo.h" #include "nw4r/NW4RAssert.hpp" @@ -69,7 +68,7 @@ void StrmSound::InitParam() StrmPlayer::SetupResult StrmSound::Setup(StrmBufferPool *bufferPool, int allocChannelCount, - byte2_t allocTrackFlag) + u16 allocTrackFlag) { NW4RAssertPointerNonnull_Line(90, bufferPool); diff --git a/src/nw4r/snd/snd_StrmSoundHandle.cpp b/src/nw4r/snd/snd_StrmSoundHandle.cpp index ff419896..09c687d8 100644 --- a/src/nw4r/snd/snd_StrmSoundHandle.cpp +++ b/src/nw4r/snd/snd_StrmSoundHandle.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/StrmSoundHandle.h" +#include "nw4r/snd/snd_StrmSoundHandle.h" /* Original source: * kiwi515/ogws @@ -9,9 +9,9 @@ * headers */ -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/snd/StrmSound.h" +#include "nw4r/snd/snd_StrmSound.h" /******************************************************************************* * functions diff --git a/src/nw4r/snd/snd_Task.cpp b/src/nw4r/snd/snd_Task.cpp index 2e54241e..7f60a639 100644 --- a/src/nw4r/snd/snd_Task.cpp +++ b/src/nw4r/snd/snd_Task.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/Task.h" +#include "nw4r/snd/snd_Task.h" /* Original source: * kiwi515/ogws diff --git a/src/nw4r/snd/snd_TaskManager.cpp b/src/nw4r/snd/snd_TaskManager.cpp index 6b324c25..cebd4dfb 100644 --- a/src/nw4r/snd/snd_TaskManager.cpp +++ b/src/nw4r/snd/snd_TaskManager.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/TaskManager.h" +#include "nw4r/snd/snd_TaskManager.h" /* Original source: * kiwi515/ogws @@ -10,18 +10,14 @@ */ #include -#include // NW4R_RANGE_FOR_NO_AUTO_INC -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/snd/Task.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_Task.h" -#include "nw4r/ut/Lock.h" // ut::AutoInterruptLock +#include "nw4r/ut/ut_Lock.h" // ut::AutoInterruptLock -#if 0 -#include -#else -#include -#endif +#include #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_TaskThread.cpp b/src/nw4r/snd/snd_TaskThread.cpp index 1cb40c79..05543d1f 100644 --- a/src/nw4r/snd/snd_TaskThread.cpp +++ b/src/nw4r/snd/snd_TaskThread.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/TaskThread.h" +#include "nw4r/snd/snd_TaskThread.h" /* Original source: * kiwi515/ogws @@ -9,15 +9,11 @@ * headers */ -#include +#include "common.h" -#include "nw4r/snd/TaskManager.h" +#include "nw4r/snd/snd_TaskManager.h" -#if 0 -#include -#else -#include -#endif +#include #include "nw4r/NW4RAssert.hpp" @@ -54,7 +50,7 @@ bool TaskThread::Create(s32 priority, void *stack, u32 stackSize) if (!result) return false; - mStackEnd = static_cast(stack); + mStackEnd = static_cast(stack); mFinishFlag = false; mCreateFlag = true; diff --git a/src/nw4r/snd/snd_Util.cpp b/src/nw4r/snd/snd_Util.cpp index a697c541..1571ee1a 100644 --- a/src/nw4r/snd/snd_Util.cpp +++ b/src/nw4r/snd/snd_Util.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/Util.h" +#include "nw4r/snd/snd_Util.h" /* Original source: * kiwi515/ogws @@ -9,10 +9,9 @@ * headers */ -#include // ARRAY_LENGTH -#include +#include "common.h" -#include "nw4r/ut/inlines.h" +#include "nw4r/ut/ut_algorithm.h" #include "nw4r/NW4RAssert.hpp" @@ -607,9 +606,9 @@ namespace nw4r { namespace snd { namespace detail // clang-format off f32 const *Util::PanTableTable[PAN_CURVE_NUM] = { - [PAN_CURVE_SQRT] = Pan2RatioTableSqrt, - [PAN_CURVE_SINCOS] = Pan2RatioTableSinCos, - [PAN_CURVE_LINEAR] = Pan2RatioTableLinear, + /*[PAN_CURVE_SQRT] = */Pan2RatioTableSqrt, + /*[PAN_CURVE_SINCOS] =*/ Pan2RatioTableSinCos, + /*[PAN_CURVE_LINEAR] =*/ Pan2RatioTableLinear, }; // clang-format on }}} // namespace nw4r::snd::detail @@ -745,7 +744,7 @@ u16 Util::CalcRandom() return u >> 16; } -void const *Util::GetDataRefAddressImpl(RefType refType, byte4_t value, +void const *Util::GetDataRefAddressImpl(RefType refType, u32 value, void const *baseAddress) { if (refType == REFTYPE_OFFSET) diff --git a/src/nw4r/snd/snd_Voice.cpp b/src/nw4r/snd/snd_Voice.cpp index 498cf8b3..dde56c19 100644 --- a/src/nw4r/snd/snd_Voice.cpp +++ b/src/nw4r/snd/snd_Voice.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/Voice.h" +#include "nw4r/snd/snd_Voice.h" /* Original source: * kiwi515/ogws @@ -10,26 +10,21 @@ */ #include -#include -#include +#include "common.h" -#include "nw4r/snd/AxManager.h" -#include "nw4r/snd/AxVoiceManager.h" -#include "nw4r/snd/AxVoice.h" -#include "nw4r/snd/adpcm.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/Util.h" -#include "nw4r/snd/VoiceManager.h" -#include "nw4r/snd/WaveFile.h" +#include "nw4r/snd/snd_AxManager.h" +#include "nw4r/snd/snd_AxVoiceManager.h" +#include "nw4r/snd/snd_AxVoice.h" +#include "nw4r/snd/snd_adpcm.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_Util.h" +#include "nw4r/snd/snd_VoiceManager.h" +#include "nw4r/snd/snd_WaveFile.h" -#include "nw4r/ut/inlines.h" -#include "nw4r/ut/Lock.h" +#include "nw4r/ut/ut_algorithm.h" +#include "nw4r/ut/ut_Lock.h" -#if 0 -#include // AX_MAX_VOLUME -#else -#include -#endif +#include // AX_MAX_VOLUME #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_VoiceManager.cpp b/src/nw4r/snd/snd_VoiceManager.cpp index 720c5c03..5e9cae1e 100644 --- a/src/nw4r/snd/snd_VoiceManager.cpp +++ b/src/nw4r/snd/snd_VoiceManager.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/VoiceManager.h" +#include "nw4r/snd/snd_VoiceManager.h" /* Original source: * kiwi515/ogws @@ -11,13 +11,12 @@ #include -#include // NW4R_RANGE_FOR_NO_AUTO_INC -#include +#include "common.h" -#include "nw4r/snd/DisposeCallbackManager.h" -#include "nw4r/snd/Voice.h" +#include "nw4r/snd/snd_DisposeCallbackManager.h" +#include "nw4r/snd/snd_Voice.h" -#include "nw4r/ut/Lock.h" // ut::AutoInterruptLock +#include "nw4r/ut/ut_Lock.h" // ut::AutoInterruptLock #include "nw4r/NW4RAssert.hpp" @@ -225,7 +224,7 @@ void VoiceManager::UpdateEachVoicePriority( } } -void VoiceManager::UpdateAllVoicesSync(byte4_t syncFlag) +void VoiceManager::UpdateAllVoicesSync(u32 syncFlag) { ut::AutoInterruptLock lock; diff --git a/src/nw4r/snd/snd_WaveArchive.cpp b/src/nw4r/snd/snd_WaveArchive.cpp index 9d351503..e3255fe6 100644 --- a/src/nw4r/snd/snd_WaveArchive.cpp +++ b/src/nw4r/snd/snd_WaveArchive.cpp @@ -1,16 +1,16 @@ -#include "nw4r/snd/WaveArchive.h" +#include "nw4r/snd/snd_WaveArchive.h" /******************************************************************************* * headers */ -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/snd/Util.h" -#include "nw4r/snd/WaveFile.h" +#include "nw4r/snd/snd_Util.h" +#include "nw4r/snd/snd_WaveFile.h" #include "nw4r/ut/binaryFileFormat.h" // ut::BinaryFileHeader -#include "nw4r/ut/inlines.h" // ut::AddOffsetToPtr +#include "nw4r/ut/ut_algorithm.h" // ut::AddOffsetToPtr #include diff --git a/src/nw4r/snd/snd_WaveFile.cpp b/src/nw4r/snd/snd_WaveFile.cpp index 0501d052..0cf73612 100644 --- a/src/nw4r/snd/snd_WaveFile.cpp +++ b/src/nw4r/snd/snd_WaveFile.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/WaveFile.h" +#include "nw4r/snd/snd_WaveFile.h" /* Original source: * kiwi515/ogws @@ -9,14 +9,14 @@ * headers */ -#include +#include "common.h" -#include "nw4r/snd/AxVoice.h" -#include "nw4r/snd/Channel.h" -#include "nw4r/snd/global.h" +#include "nw4r/snd/snd_AxVoice.h" +#include "nw4r/snd/snd_Channel.h" +#include "nw4r/snd/snd_global.h" -#include "nw4r/ut/inlines.h" // ut::AddOffsetToPtr -#include "nw4r/ut/binaryFileFormat.h" +#include "nw4r/ut/ut_algorithm.h" // ut::AddOffsetToPtr +#include "nw4r/ut/ut_binaryFileFormat.h" #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_WaveSound.cpp b/src/nw4r/snd/snd_WaveSound.cpp index 5ac7eb7f..345500a2 100644 --- a/src/nw4r/snd/snd_WaveSound.cpp +++ b/src/nw4r/snd/snd_WaveSound.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/WaveSound.h" +#include "nw4r/snd/snd_WaveSound.h" /* Original source: * kiwi515/ogws @@ -9,14 +9,14 @@ * headers */ -#include +#include "common.h" -#include "nw4r/snd/BasicSound.h" -#include "nw4r/snd/SoundInstanceManager.h" -#include "nw4r/snd/WaveSoundHandle.h" -#include "nw4r/snd/WsdPlayer.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_SoundInstanceManager.h" +#include "nw4r/snd/snd_WaveSoundHandle.h" +#include "nw4r/snd/snd_WsdPlayer.h" -#include "nw4r/ut/RuntimeTypeInfo.h" +#include "nw4r/ut/ut_RuntimeTypeInfo.h" #include "nw4r/NW4RAssert.hpp" @@ -49,7 +49,7 @@ WaveSound::WaveSound(SoundInstanceManager *manager, int priority, bool WaveSound::Prepare(void const *waveSoundBase, s32 waveSoundOffset, WsdPlayer::StartOffsetType startOffsetType, s32 offset, WsdPlayer::WsdCallback const *callback, - register_t callbackData) + u32 callbackData) { NW4RAssertPointerNonnull_Line(74, waveSoundBase); NW4RAssertPointerNonnull_Line(75, callback); diff --git a/src/nw4r/snd/snd_WaveSoundHandle.cpp b/src/nw4r/snd/snd_WaveSoundHandle.cpp index cb032182..4d1774f1 100644 --- a/src/nw4r/snd/snd_WaveSoundHandle.cpp +++ b/src/nw4r/snd/snd_WaveSoundHandle.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/WaveSoundHandle.h" +#include "nw4r/snd/snd_WaveSoundHandle.h" /* Original source: * kiwi515/ogws @@ -9,13 +9,13 @@ * headers */ -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/snd/BasicSound.h" -#include "nw4r/snd/SoundHandle.h" -#include "nw4r/snd/WaveSound.h" +#include "nw4r/snd/snd_BasicSound.h" +#include "nw4r/snd/snd_SoundHandle.h" +#include "nw4r/snd/snd_WaveSound.h" -#include "nw4r/ut/RuntimeTypeInfo.h" // ut::DynamicCast +#include "nw4r/ut/ut_RuntimeTypeInfo.h" // ut::DynamicCast #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_WsdFile.cpp b/src/nw4r/snd/snd_WsdFile.cpp index b8f22d37..a33421f8 100644 --- a/src/nw4r/snd/snd_WsdFile.cpp +++ b/src/nw4r/snd/snd_WsdFile.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/WsdFile.h" +#include "nw4r/snd/snd_WsdFile.h" /* Original source: * kiwi515/ogws @@ -9,15 +9,14 @@ * headers */ -#include // NW4R_FILE_VERSION -#include // nullptr +#include "common.h" // nullptr -#include "nw4r/snd/Util.h" // Util::GetDataRefAddress0 -#include "nw4r/snd/WaveFile.h" -#include "nw4r/snd/WaveArchive.h" // WaveArchiveReader +#include "nw4r/snd/snd_Util.h" // Util::GetDataRefAddress0 +#include "nw4r/snd/snd_WaveFile.h" +#include "nw4r/snd/snd_WaveArchive.h" // WaveArchiveReader -#include "nw4r/ut/binaryFileFormat.h" // ut::BinaryFileHeader -#include "nw4r/ut/inlines.h" // ut::AddOffsetToPtr +#include "nw4r/ut/ut_binaryFileFormat.h" // ut::BinaryFileHeader +#include "nw4r/ut/ut_algorithm.h" // ut::AddOffsetToPtr #include "nw4r/NW4RAssert.hpp" diff --git a/src/nw4r/snd/snd_WsdPlayer.cpp b/src/nw4r/snd/snd_WsdPlayer.cpp index d6b9fea7..c7f60adc 100644 --- a/src/nw4r/snd/snd_WsdPlayer.cpp +++ b/src/nw4r/snd/snd_WsdPlayer.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/WsdPlayer.h" +#include "nw4r/snd/snd_WsdPlayer.h" /* Original source: * kiwi515/ogws @@ -9,17 +9,17 @@ * headers */ -#include +#include "common.h" -#include "nw4r/snd/BasicPlayer.h" -#include "nw4r/snd/Channel.h" -#include "nw4r/snd/DisposeCallbackManager.h" -#include "nw4r/snd/global.h" -#include "nw4r/snd/Voice.h" -#include "nw4r/snd/SoundThread.h" -#include "nw4r/snd/WaveFile.h" +#include "nw4r/snd/snd_BasicPlayer.h" +#include "nw4r/snd/snd_Channel.h" +#include "nw4r/snd/snd_DisposeCallbackManager.h" +#include "nw4r/snd/snd_global.h" +#include "nw4r/snd/snd_Voice.h" +#include "nw4r/snd/snd_SoundThread.h" +#include "nw4r/snd/snd_WaveFile.h" -#include "nw4r/ut/inlines.h" // ut::Min +#include "nw4r/ut/ut_algorithm.h" // ut::Min #include "nw4r/NW4RAssert.hpp" @@ -35,7 +35,7 @@ WsdPlayer::WsdPlayer() : } void WsdPlayer::InitParam(int voiceOutCount, WsdCallback const *callback, - register_t callbackData) + u32 callbackData) { BasicPlayer::InitParam(); @@ -66,7 +66,7 @@ void WsdPlayer::InitParam(int voiceOutCount, WsdCallback const *callback, bool WsdPlayer::Prepare(void const *waveSoundBase, int index, StartOffsetType startOffsetType, int startOffset, int voiceOutCount, WsdCallback const *callback, - register_t callbackData) + u32 callbackData) { SoundThread::AutoLock lock; @@ -202,7 +202,7 @@ void WsdPlayer::Update() } bool WsdPlayer::StartChannel(WsdCallback const *callback, - register_t callbackData) + u32 callbackData) { SoundThread::AutoLock lock; @@ -234,7 +234,7 @@ bool WsdPlayer::StartChannel(WsdCallback const *callback, Channel *channel = Channel::AllocChannel( ut::Min(waveData.numChannels, Channel::CHANNEL_MAX), GetVoiceOutCount(), - priority, ChannelCallbackFunc, reinterpret_cast(this)); + priority, ChannelCallbackFunc, reinterpret_cast(this)); if (!channel) return false; @@ -357,7 +357,7 @@ void WsdPlayer::UpdateChannel() void WsdPlayer::ChannelCallbackFunc(Channel *dropChannel, Channel::ChannelCallbackStatus status, - register_t userData) + u32 userData) { SoundThread::AutoLock lock; diff --git a/src/nw4r/snd/snd_adpcm.cpp b/src/nw4r/snd/snd_adpcm.cpp index 433e8467..04f7d55a 100644 --- a/src/nw4r/snd/snd_adpcm.cpp +++ b/src/nw4r/snd/snd_adpcm.cpp @@ -1,4 +1,4 @@ -#include "nw4r/snd/adpcm.h" +#include "nw4r/snd/snd_adpcm.h" /* Original source: * kiwi515/ogws @@ -11,13 +11,9 @@ #include -#include +#include "common.h" -#if 0 -#include // AXPBADPCM -#else -#include -#endif +#include // AXPBADPCM /******************************************************************************* * functions diff --git a/src/nw4r/snd/snd_debug.cpp b/src/nw4r/snd/snd_debug.cpp index fbd4d3f9..d87a1556 100644 --- a/src/nw4r/snd/snd_debug.cpp +++ b/src/nw4r/snd/snd_debug.cpp @@ -1,10 +1,10 @@ -#include "nw4r/snd/debug.h" +#include "nw4r/snd/snd_debug.h" /******************************************************************************* * headers */ -#include // byte4_t +#include "common.h" // u32 #include @@ -40,7 +40,7 @@ namespace nw4r { namespace snd { namespace namespace nw4r { namespace snd { namespace { - byte4_t GetWarningBitFlag(DebugWarningFlag warning); + u32 GetWarningBitFlag(DebugWarningFlag warning); }}} // namespace nw4r::snd::(unnamed) /******************************************************************************* @@ -49,7 +49,7 @@ namespace nw4r { namespace snd { namespace namespace nw4r { namespace snd { namespace { - byte4_t gWarningFlag = DEBUG_WARNING_BIT_FLAG_NOT_ENOUGH_INSTANCE; + u32 gWarningFlag = DEBUG_WARNING_BIT_FLAG_NOT_ENOUGH_INSTANCE; }}} // namespace nw4r::snd::(unnamed) /******************************************************************************* @@ -62,7 +62,7 @@ namespace detail { bool Debug_GetWarningFlag(DebugWarningFlag warning) { - byte4_t bitFlag = GetWarningBitFlag(warning); + u32 bitFlag = GetWarningBitFlag(warning); return (gWarningFlag & bitFlag) == bitFlag; } @@ -109,9 +109,9 @@ char const *Debug_GetSoundTypeString(DebugSoundType type) namespace { -byte4_t GetWarningBitFlag(DebugWarningFlag warning) +u32 GetWarningBitFlag(DebugWarningFlag warning) { - byte4_t bitFlag = 0; + u32 bitFlag = 0; switch (warning) { diff --git a/src/nw4r/ut/ut_ResFont.cpp b/src/nw4r/ut/ut_ResFont.cpp index 3323afb5..589ec9ec 100644 --- a/src/nw4r/ut/ut_ResFont.cpp +++ b/src/nw4r/ut/ut_ResFont.cpp @@ -34,7 +34,7 @@ bool ResFont::SetResource(void *buffer) { return false; } - if (header->magic == MAGIC_UNPACKED) { + if (header->signature == MAGIC_UNPACKED) { BinaryBlockHeader *block = reinterpret_cast(reinterpret_cast(header) + header->headerSize); @@ -115,7 +115,7 @@ FontInformation *ResFont::Rebuild(BinaryFileHeader *header) { block = reinterpret_cast(reinterpret_cast(block) + block->length); } - header->magic = MAGIC_UNPACKED; + header->signature = MAGIC_UNPACKED; return info; } diff --git a/src/nw4r/ut/ut_binaryFileFormat.cpp b/src/nw4r/ut/ut_binaryFileFormat.cpp index 30e6a89d..9b5f9181 100644 --- a/src/nw4r/ut/ut_binaryFileFormat.cpp +++ b/src/nw4r/ut/ut_binaryFileFormat.cpp @@ -5,7 +5,7 @@ namespace ut { /* 8042a9e0 */ bool IsValidBinaryFile(const BinaryFileHeader *header, u32 magic, u16 version, u16 numBlocks) { - if (header->magic != magic) { + if (header->signature != magic) { return false; } if (header->byteOrder != 0xFEFF) { diff --git a/src/toBeSorted/nand_request_thread.cpp b/src/toBeSorted/nand_request_thread.cpp index ac506a09..286a522f 100644 --- a/src/toBeSorted/nand_request_thread.cpp +++ b/src/toBeSorted/nand_request_thread.cpp @@ -74,7 +74,7 @@ NandRequestWrite *NandRequestThread::writeRequest(const char *filePath, void *da } bool NandRequestThread::waitForMessage() { - return OSReceiveMessage(&mMessageQueue, nullptr, OS_MSG_PERSISTENT); + return OSReceiveMessage(&mMessageQueue, nullptr, OS_MESSAGE_FLAG_PERSISTENT); } void NandRequestThread::sendMessage() {