make it build

This commit is contained in:
robojumper
2025-05-24 23:53:38 +02:00
parent 04d5527eba
commit a22eb87c36
146 changed files with 1256 additions and 981 deletions
+2 -2
View File
@@ -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
+17 -17
View File
@@ -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__Q44nw4r3snd6detail8SeqSoundFPQ44nw4r3snd6detail49SoundInstanceManager<Q44nw4r3snd6detail8SeqSound>ii = .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
+24
View File
@@ -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); \
+111
View File
@@ -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<int, 1>), func<long, int>(2, 3));
* DECOMP_FORCE_CLASS_METHOD(Class3, operator ,(4));
*/
#if defined(__cplusplus)
# define DECOMP_FORCE_CLASS_METHOD(class_, ...) \
DECOMP_FORCE(((void)(static_cast<DF_TYPEOF(class_) *>(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
+20 -14
View File
@@ -5,22 +5,20 @@
* headers
*/
#include <types.h>
#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 <revolution/AI/ai.h> // AIDMACallback
#include <revolution/AX/AX.h // AX_MAX_VOLUME
#include <revolution/AX/AXAux.h> // AXAuxCallback
#include <revolution/AX/AXOut.h> // AXFrameCallback
#else
#include <context_rvl.h>
#endif
#include "nw4r/ut/ut_LinkList.h"
#include <rvl/AI/ai.h> // AIDMACallback
#include <rvl/AX/AX.h>
#include <rvl/AX/AXCL.h> // AX_MAX_VOLUME
#include <rvl/AX/AXAux.h> // AXAuxCallback
#include <rvl/AX/AXOut.h> // 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<f32, int> mAuxFadeVolume[AUX_BUS_NUM]; // size 0x30, offset 0x54
MoveValue<f32, int> 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 */
+9 -12
View File
@@ -5,20 +5,17 @@
* headers
*/
#include <types.h>
#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 <revolution/AX/AX.h>
#include <revolution/AX/AXAlloc.h> // AXSetVoicePriority
#include <revolution/AX/AXVPB.h>
#else
#include <context_rvl.h>
#endif
#include <rvl/AX/AX.h>
#include <rvl/AX/AXCL.h>
#include <rvl/AX/AXAlloc.h> // AXSetVoicePriority
#include <rvl/AX/AXVPB.h>
/*******************************************************************************
* 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 */
+2 -2
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h> // u32
#include "common.h" // u32
#include "AxVoice.h"
#include "nw4r/snd/snd_AxVoice.h"
/*******************************************************************************
* classes and functions
+1 -1
View File
@@ -5,7 +5,7 @@
* headers
*/
#include "BankFile.h" // BankFileReader
#include "nw4r/snd/snd_BankFile.h" // BankFileReader
#include "nw4r/NW4RAssert.hpp"
+10 -11
View File
@@ -5,14 +5,13 @@
* headers
*/
#include <macros.h>
#include <types.h>
#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<void> lfoTableRef; // size 0x08, offset 0x14
Util::DataRef<void> graphEnvTablevRef; // size 0x08, offset 0x1c
Util::DataRef<void> 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<void, InstParam, RangeTable, IndexTable>
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<WaveFile::WaveInfo> 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
+2 -2
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h>
#include "common.h"
#include "global.h"
#include "nw4r/snd/snd_global.h"
/*******************************************************************************
* types
+5 -5
View File
@@ -5,13 +5,13 @@
* headers
*/
#include <types.h>
#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
+1 -1
View File
@@ -5,7 +5,7 @@
* headers
*/
#include <types.h>
#include "common.h"
/*******************************************************************************
* classes and functions
+2 -2
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h> // f32
#include "common.h" // f32
#include "BiquadFilterCallback.h"
#include "nw4r/snd/snd_BiquadFilterCallback.h"
/*******************************************************************************
* classes and functions
+12 -12
View File
@@ -7,16 +7,16 @@
#include <climits> // USHRT_MAX
#include <types.h>
#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<Channel, 0xc8> 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
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h> // u32
#include "common.h" // u32
#include "../ut/LinkList.h"
#include "nw4r/ut/ut_LinkList.h"
/*******************************************************************************
* classes and functions
+48 -3
View File
@@ -5,13 +5,15 @@
* headers
*/
#include <types.h>
#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
+1 -1
View File
@@ -5,7 +5,7 @@
* headers
*/
#include <types.h>
#include "common.h"
/*******************************************************************************
* classes and functions
+1 -1
View File
@@ -5,7 +5,7 @@
* headers
*/
#include "BasicSound.h"
#include "nw4r/snd/snd_BasicSound.h"
/*******************************************************************************
* classes and functions
+4 -4
View File
@@ -5,12 +5,12 @@
* headers
*/
#include <types.h>
#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
+1 -1
View File
@@ -7,7 +7,7 @@
#include <new>
#include <types.h>
#include "common.h"
/*******************************************************************************
* classes and functions
+2 -2
View File
@@ -5,7 +5,7 @@
* headers
*/
#include <types.h>
#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
+2 -2
View File
@@ -5,11 +5,11 @@
* headers
*/
#include <types.h>
#include "common.h"
#include "SoundArchive.h"
#include "../ut/FileStream.h"
#include "nw4r/ut/ut_FileStream.h"
/*******************************************************************************
* classes and functions
+4 -4
View File
@@ -5,16 +5,16 @@
* headers
*/
#include <types.h>
#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
+1 -1
View File
@@ -5,7 +5,7 @@
* headers
*/
#include "SeqPlayer.h"
#include "nw4r/snd/snd_SeqPlayer.h"
/*******************************************************************************
* classes and functions
+6 -6
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h>
#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;
+1 -1
View File
@@ -5,7 +5,7 @@
* headers
*/
#include "SeqTrack.h"
#include "nw4r/snd/snd_SeqTrack.h"
/*******************************************************************************
* classes and functions
+3 -3
View File
@@ -5,10 +5,10 @@
* headers
*/
#include <types.h> // 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
+3 -3
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h> // 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
+3 -3
View File
@@ -5,11 +5,11 @@
* headers
*/
#include <types.h> // 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
+1 -1
View File
@@ -21,7 +21,7 @@ public:
private:
static const int SPEAKER_ALARM_HZ = 150;
static const int SPEAKER_ALARM_PERIOD_NSEC = static_cast<int>(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();
+6 -7
View File
@@ -5,12 +5,11 @@
* headers
*/
#include <macros.h>
#include <types.h>
#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
+4 -5
View File
@@ -5,12 +5,11 @@
* headers
*/
#include <macros.h> // ATTR_UNUSED
#include <types.h>
#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
+6 -6
View File
@@ -5,14 +5,14 @@
* headers
*/
#include <types.h>
#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
+2 -2
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h> // nullptr
#include "common.h" // nullptr
#include "../ut/inlines.h" // ut::NonCopyable
#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable
/*******************************************************************************
* types
+6 -6
View File
@@ -5,12 +5,12 @@
* headers
*/
#include <types.h>
#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:
+3 -2
View File
@@ -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
+3 -3
View File
@@ -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();
+4 -4
View File
@@ -5,11 +5,11 @@
* headers
*/
#include <types.h> // 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
+3 -3
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h>
#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
+25 -26
View File
@@ -5,14 +5,13 @@
* headers
*/
#include <macros.h>
#include <types.h>
#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<void, SeqSoundInfo, StrmSoundInfo, WaveSoundInfo>
@@ -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<Util::DataRef<SoundCommonInfo> >
@@ -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<Util::DataRef<BankInfo> > 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<Util::DataRef<PlayerInfo> > 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<Util::DataRef<GroupItemInfo> > GroupItemInfoTable;
@@ -247,7 +246,7 @@ namespace nw4r { namespace snd { namespace detail
Util::DataRef<SoundArchivePlayerInfo> 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
+29 -18
View File
@@ -5,27 +5,28 @@
* headers
*/
#include <types.h>
#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 <nw4r/NW4RAssert.hpp>
@@ -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<u32>(id), pAllocatable, blockSize);
}
bool LoadGroup(unsigned int id, SoundMemoryAllocatable *pAllocatable, u32 blockSize) {
return LoadGroup(static_cast<u32>(id), pAllocatable, blockSize);
}
SoundArchive const &GetSoundArchive() const;
u32 GetSoundPlayerCount() const { return mSoundPlayerCount; }
SoundPlayer &GetSoundPlayer(u32 playerId);
+3 -3
View File
@@ -5,11 +5,11 @@
* headers
*/
#include <types.h>
#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
+5 -10
View File
@@ -7,19 +7,14 @@
#include <new>
#include <macros.h>
#include <types.h>
#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 <revolution/OS/OSMutex.h>
#else
#include <context_rvl.h>
#endif
#include <rvl/OS/OSMutex.h>
#include "nw4r/NW4RAssert.hpp"
@@ -5,7 +5,7 @@
* headers
*/
#include <types.h> // u32
#include "common.h" // u32
/*******************************************************************************
* classes and functions
+4 -4
View File
@@ -5,11 +5,11 @@
* headers
*/
#include <types.h> // 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
+54 -5
View File
@@ -5,7 +5,9 @@
* headers
*/
#include <types.h> // 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:
+36 -1
View File
@@ -5,7 +5,10 @@
* headers
*/
#include <types.h>
#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 &param,
void *workMem, u32 workMemSize);
static void ShutdownSoundSystem();
static void WaitForResetReady();
static bool IsInitializedSoundSystem();
static u32 GetRequiredMemSize(SoundSystemParam const &param);
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
+8 -12
View File
@@ -5,20 +5,16 @@
* headers
*/
#include <types.h>
#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 <revolution/OS/OSMessage.h>
#include <revolution/OS/OSMutex.h>
#include <revolution/OS/OSThread.h>
#else
#include <context_rvl.h>
#endif
#include <rvl/OS/OSMessage.h>
#include <rvl/OS/OSMutex.h>
#include <rvl/OS/OSThread.h>
/*******************************************************************************
* 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
+2 -3
View File
@@ -7,10 +7,9 @@
#include <climits> // CHAR_BIT
#include <macros.h> // ROUND_UP
#include <types.h>
#include "common.h"
#include "adpcm.h"
#include "nw4r/snd/snd_adpcm.h"
/*******************************************************************************
* types
+11 -12
View File
@@ -5,14 +5,13 @@
* headers
*/
#include <macros.h>
#include <types.h>
#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<TrackInfo, TrackInfoEx> 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<ChannelInfo> 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
+14 -18
View File
@@ -5,24 +5,20 @@
* headers
*/
#include <types.h>
#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 <revolution/OS/OSMutex.h>
#else
#include <context_rvl.h>
#endif
#include <rvl/OS/OSMutex.h>
/*******************************************************************************
* 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,
+7 -7
View File
@@ -5,14 +5,14 @@
* headers
*/
#include <types.h>
#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; }
+2 -2
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h> // nullptr
#include "common.h" // nullptr
#include "../ut/inlines.h" // ut::NonCopyable
#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable
/*******************************************************************************
* types
+2 -2
View File
@@ -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
+2 -6
View File
@@ -5,13 +5,9 @@
* headers
*/
#include "Task.h"
#include "nw4r/snd/snd_Task.h"
#if 0
#include <revolution/OS/OSThread.h> // OSThreadQueue
#else
#include <context_rvl.h>
#endif
#include <rvl/OS/OSThread.h> // OSThreadQueue
/*******************************************************************************
* classes and functions
+3 -7
View File
@@ -5,13 +5,9 @@
* headers
*/
#include <types.h>
#include "common.h"
#if 0
#include <revolution/OS/OSThread.h>
#else
#include <context_rvl.h>
#endif
#include <rvl/OS/OSThread.h>
/*******************************************************************************
* 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 */
+6 -7
View File
@@ -5,8 +5,7 @@
* headers
*/
#include <macros.h> // static_assert
#include <types.h>
#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<T ## index_ const *>(GetDataRefAddressImpl( \
static_cast<RefType>(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;
}
+7 -7
View File
@@ -5,14 +5,14 @@
* headers
*/
#include <types.h>
#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 */
+3 -3
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h> // 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();
+7 -8
View File
@@ -5,13 +5,12 @@
* headers
*/
#include <macros.h>
#include <types.h>
#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
+9 -10
View File
@@ -5,14 +5,13 @@
* headers
*/
#include <macros.h> // NW4R_FOUR_BYTE
#include <types.h>
#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
+6 -6
View File
@@ -5,13 +5,13 @@
* headers
*/
#include <types.h>
#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);
+2 -2
View File
@@ -5,9 +5,9 @@
* headers
*/
#include <types.h> // nullptr
#include "common.h" // nullptr
#include "nw4r/ut/inlines.h" // ut::NonCopyable
#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable
/*******************************************************************************
* types
+10 -11
View File
@@ -5,12 +5,11 @@
* headers
*/
#include <macros.h>
#include <types.h>
#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<void> graphEnvTablevRef; // size 0x08, offset 0x0c
Util::DataRef<void> 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<void> lfoTableRef; // size 0x08, offset 0x14
Util::DataRef<void> graphEnvTablevRef; // size 0x08, offset 0x1c
Util::DataRef<void> randomizerTableRef; // size 0x08, offset 0x24
byte4_t reserved;
u32 reserved;
}; // size 0x30
typedef Util::Table<Util::DataRef<NoteInfo> > NoteInfoTable;
@@ -92,7 +91,7 @@ namespace nw4r { namespace snd { namespace detail
Util::DataRef<NoteInfoTable> 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
+13 -13
View File
@@ -5,14 +5,14 @@
* headers
*/
#include <types.h>
#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
+8 -10
View File
@@ -5,20 +5,16 @@
* headers
*/
#include <types.h>
#include "common.h"
#if 0
#include <revolution/AX/AXVPB.h> // AXPBADPCM
#else
#include <context_rvl.h>
#endif
#include <rvl/AX/AXVPB.h> // 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
+16 -1
View File
@@ -5,12 +5,27 @@
* headers
*/
#include <types.h> // 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
+16
View File
@@ -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<unsigned char>(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 {
+6
View File
@@ -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) {}
+1
View File
@@ -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) {}
+2 -2
View File
@@ -317,8 +317,8 @@ public:
public:
// Shorthand names for reverse iterator types
typedef detail::ReverseIterator<Iterator> RevIterator;
typedef detail::ReverseIterator<ConstIterator> RevConstIterator;
typedef detail::ReverseIterator<Iterator> ReverseIterator;
typedef detail::ReverseIterator<ConstIterator> ReverseConstIterator;
public:
LinkList() {}
+1 -1
View File
@@ -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
+14
View File
@@ -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);
+7 -5
View File
@@ -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;
+3 -3
View File
@@ -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);
+30 -28
View File
@@ -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),
+35 -33
View File
@@ -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);
+25 -16
View File
@@ -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,
+7 -3
View File
@@ -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
+16 -3
View File
@@ -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);
+8 -6
View File
@@ -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);
+9 -7
View File
@@ -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);
@@ -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
+2 -2
View File
@@ -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);
}
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -1,9 +1,9 @@
/* Only implemented to the extent necessary to match data sections. */
#include <types.h> // nullptr
#include "common.h" // nullptr
#include <decomp.h>
#include "nw4r/snd/Util.h"
#include "nw4r/snd/snd_Util.h"
DECOMP_FORCE(nw4r::snd::detail::Util::GetDataRefAddress0(
*static_cast<nw4r::snd::detail::Util::DataRef<char> const *>(nullptr),
+15 -20
View File
@@ -1,4 +1,4 @@
#include "nw4r/snd/AxManager.h"
#include "nw4r/snd/snd_AxManager.h"
/* Original source:
* kiwi515/ogws
@@ -11,28 +11,23 @@
#include <cstring> // std::memset
#include <macros.h>
#include <types.h>
#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 <revolution/OS/OSCache.h> // DCFlushRange
#include <revolution/AI/ai.h> // AICheckInit
#include <revolution/AX/AXAux.h>
#include <revolution/AX/AXCL.h>
#include <revolution/AX/AXOut.h>
#else
#include <context_rvl.h>
#endif
#include <rvl/OS/OSCache.h> // DCFlushRange
#include <rvl/AI/ai.h> // AICheckInit
#include <rvl/AX/AXAux.h>
#include <rvl/AX/AXCL.h>
#include <rvl/AX/AXOut.h>
#include "nw4r/NW4RAssert.hpp"
+17 -21
View File
@@ -1,4 +1,4 @@
#include "nw4r/snd/AxVoice.h"
#include "nw4r/snd/snd_AxVoice.h"
/* Original source:
* kiwi515/ogws
@@ -12,26 +12,22 @@
#include <cstdarg>
#include <cstring>
#include <macros.h> // BOOLIFY_TERNARY
#include <types.h>
#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 <revolution/AX/AX.h>
#include <revolution/AX/AXVPB.h>
#include <revolution/OS/OSAddress.h>
#else
#include <context_rvl.h>
#endif
#include <rvl/AX/AX.h>
#include <rvl/AX/AXCL.h>
#include <rvl/AX/AXVPB.h>
#include <rvl/OS/OSAddress.h>
#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<byte_t *>(OSPhysicalToCached(
reinterpret_cast<void *>(currentPos / sizeof(u16))));
currentPos / sizeof(u16)));
adpcm.pred_scale = byte;
currentPos += sizeof(u16);
}
byte_t byte = *static_cast<byte_t *>(OSPhysicalToCached(
reinterpret_cast<void *>(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<u16 *>(reinterpret_cast<u16 const *>(&mix));
u16 *dst = reinterpret_cast<u16 *>(&mVpb->pb.mix);
byte4_t mixerCtrl = 0;
u32 mixerCtrl = 0;
if ((*dst++ = *src++)) // vL
mixerCtrl |= AX_MIXER_CTRL_L;
+7 -11
View File
@@ -1,4 +1,4 @@
#include "nw4r/snd/AxVoiceManager.h"
#include "nw4r/snd/snd_AxVoiceManager.h"
/* Original source:
* kiwi515/ogws
@@ -11,18 +11,14 @@
#include <new>
#include <types.h>
#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 <revolution/AX/AXAlloc.h>
#include <revolution/AX/AXVPB.h>
#else
#include <context_rvl.h>
#endif
#include <rvl/AX/AXAlloc.h>
#include <rvl/AX/AXVPB.h>
#include "nw4r/NW4RAssert.hpp"
@@ -179,7 +175,7 @@ AxVoice *AxVoiceManager::AcquireAxVoice(u32 priority,
return nullptr;
AXVPB *vpb = AXAcquireVoice(priority, &AxVoice::VoiceCallback,
reinterpret_cast<register_t>(voice));
reinterpret_cast<u32>(voice));
if (!vpb)
{
Free(voice);
+7 -7
View File
@@ -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 <types.h>
#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
+7 -8
View File
@@ -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 <macros.h> // NW4R_FILE_VERSION
#include <types.h>
#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"
+4 -5
View File
@@ -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 <macros.h> // ARRAY_LENGTH
#include <types.h> // 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"
+11 -12
View File
@@ -1,4 +1,4 @@
#include "nw4r/snd/BasicSound.h"
#include "nw4r/snd/snd_BasicSound.h"
/* Original source:
* kiwi515/ogws
@@ -12,19 +12,18 @@
#include <climits> // ULONG_MAX
#include <cstring>
#include <macros.h>
#include <types.h>
#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"
+4 -5
View File
@@ -1,15 +1,14 @@
#include "nw4r/snd/BiquadFilterPreset.h"
#include "nw4r/snd/snd_BiquadFilterPreset.h"
/*******************************************************************************
* headers
*/
#include <macros.h> // ATTR_UNUSED
#include <types.h> // 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
+14 -15
View File
@@ -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 <macros.h>
#include <types.h>
#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);
+4 -5
View File
@@ -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 <macros.h>
#include <types.h>
#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
+1 -1
View File
@@ -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() {}
+2 -2
View File
@@ -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 <types.h>
#include "common.h"
#include <nw4r/NW4RAssert.hpp>
+4 -5
View File
@@ -1,4 +1,4 @@
#include "nw4r/snd/ExternalSoundPlayer.h"
#include "nw4r/snd/snd_ExternalSoundPlayer.h"
/* Original source:
* kiwi515/ogws
@@ -10,11 +10,10 @@
*/
#include <decomp.h>
#include <macros.h> // NW4R_RANGE_FOR
#include <types.h> // 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"
+4 -4
View File
@@ -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 <types.h>
#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"

Some files were not shown because too many files have changed in this diff Show More