NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_WaveArchive.h
1#ifndef NW4R_SND_WAVE_ARCHIVE_H
2#define NW4R_SND_WAVE_ARCHIVE_H
3
4/*******************************************************************************
5 * headers
6 */
7
8#include <types.h>
9
10#include "nw4r/snd/snd_Util.h"
11#include "nw4r/snd/snd_WaveFile.h"
12
13#include "nw4r/ut/ut_binaryFileFormat.h"
14
15/*******************************************************************************
16 * types
17 */
18
19namespace nw4r { namespace snd { namespace detail
20{
22 {
23 /* Header */
24
25 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x307f00
27 {
28 ut::BinaryFileHeader fileHeader; // size 0x10, offset 0x00
29 ulong tableChunkOffset; // size 0x04, offset 0x10
30 ulong tableChunkSize; // size 0x04, offset 0x14
31 ulong dataChunkOffset; // size 0x04, offset 0x18
32 ulong dataChunkSize; // size 0x04, offset 0x1c
33 }; // size 0x20
34
35 /* TableBlock */
36
37 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b289b
38 struct TableItem
39 {
40 Util::DataRef<WaveFile::FileHeader> waveFileRef; // size 0x08, offset 0x00
41 ulong waveFileSize; // size 0x04, offset 0x08
42 }; // size 0x0c
43
44 static ulong const SIGNATURE_TABLE_BLOCK =
45 NW4R_FOUR_BYTE('T', 'A', 'B', 'L');
46
47 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b29a1
49 {
50 ut::BinaryBlockHeader blockHeader; // size 0x08, offset 0x00
51 Util::Table<TableItem> fileTable; // size 0x10, offset 0x08
52 }; // size 0x18
53
54 /* DataBlock */
55
56 static ulong const SIGNATURE_DATA_BLOCK =
57 NW4R_FOUR_BYTE('D', 'A', 'T', 'A');
58
59 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b2a3c
60 struct DataBlock
61 {
62 ut::BinaryBlockHeader blockHeader; // size 0x08, offset 0x00
63 byte_t data[1]; // size 0x01, offset 0x08
64 /* 3 bytes padding */
65 }; // size 0x0c
66
67 /* WaveArchive */
68
69 static ulong const SIGNATURE_FILE =
70 NW4R_FOUR_BYTE('R', 'W', 'A', 'R');
71 static int const FILE_VERSION = NW4R_FILE_VERSION(1, 0);
72 }; // "namespace" WaveArchive
73}}} // namespace nw4r::snd::detail
74
75/*******************************************************************************
76 * classes and functions
77 */
78
79namespace nw4r { namespace snd { namespace detail
80{
81 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b2bb8
82 class WaveArchiveReader
83 {
84 // methods
85 public:
86 // cdtors
87 WaveArchiveReader(void const *waveArc);
88
89 // methods
90 WaveFile::FileHeader const *GetWaveFile(int index) const;
91
92 private:
93 bool VerifyFileHeader(void const *waveArc);
94
95 // static members
96 public:
97 static u16 const SUPPORTED_FILE_VERSION_MAX = NW4R_FILE_VERSION(1, 0);
98 static u16 const SUPPORTED_FILE_VERSION_MIN = NW4R_FILE_VERSION(1, 0);
99
100 // members
101 private:
102 WaveArchive::TableBlock const *mTableBlock; // size 0x04, offset 0x00
103 WaveArchive::DataBlock const *mDataBlock; // size 0x04, offset 0x04
104 }; // size 0x08
105}}} // namespace nw4r::snd::detail
106
107#endif // NW4R_SND_WAVE_ARCHIVE_H