NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_SeqFile.h
1#ifndef NW4R_SND_SEQ_FILE_H
2#define NW4R_SND_SEQ_FILE_H
3
4/*******************************************************************************
5 * headers
6 */
7
8#include <types.h>
9
10#include "nw4r/snd/snd_Util.h" // Util::Table
11
12#include "nw4r/ut/ut_binaryFileFormat.h"
13
14/*******************************************************************************
15 * types
16 */
17
18namespace nw4r { namespace snd { namespace detail
19{
20 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2d23df (yes, really!)
21 struct SeqFile
22 {
23 /* Header */
24
25 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2ce38c
26 struct Header
27 {
28 ut::BinaryFileHeader fileHeader; // size 0x10, offset 0x00
29 ulong dataBlockOffset; // size 0x04, offset 0x10
30 ulong dataBlockSize; // size 0x04, offset 0x14
31 ulong labelBlockOffset; // size 0x04, offset 0x18
32 ulong labelBlockSize; // size 0x04, offset 0x1c
33 }; // size 0x20
34
35 /* LabelBlock */
36
37 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2ce87c
38 struct LabelInfo
39 {
40 ulong offset; // size 0x04, offset 0x00
41 ulong nameLen; // size 0x04, offset 0x04
42 char name[1]; // size 0x01, offset 0x08
43 /* 3 bytes padding */
44 }; // size 0x0c
45
46 static ulong const SIGNATURE_LABEL_BLOCK;
47
48 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2ce7dc
50 {
51 ut::BinaryBlockHeader blockHeader; // size 0x08, offset 0x00
52 Util::Table<ulong> labelInfoTable; // size 0x08, offset 0x08
53 }; // size 0x10
54
55 /* DataBlock */
56
57 static ulong const SIGNATURE_DATA_BLOCK =
58 NW4R_FOUR_BYTE('D', 'A', 'T', 'A');
59
60 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2ce491
61 struct DataBlock
62 {
63 ut::BinaryBlockHeader blockHeader; // size 0x08, offset 0x00
64 ulong baseOffset; // size 0x04, offset 0x08
65 }; // size 0x0c
66
67 /* SeqFile */
68
69 static ulong const SIGNATURE_FILE =
70 NW4R_FOUR_BYTE('R', 'S', 'E', 'Q');
71 static int const FILE_VERSION = NW4R_FILE_VERSION(1, 2);
72 }; // "namespace" SeqFile
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::0x2ce50a
82 class SeqFileReader
83 {
84 // methods
85 public:
86 // cdtors
87 SeqFileReader(void const *seqData);
88
89 // methods
90 void const *GetBaseAddress() const;
91
92 bool IsValidFileHeader(void const *seqData);
93
94 bool ReadOffsetByLabel(char const *labelName, ulong *offsetPtr) const;
95
96 // static members
97 public:
98 static u16 const SUPPORTED_FILE_VERSION = NW4R_FILE_VERSION(1, 0);
99
100 // members
101 private:
102 SeqFile::Header const *mHeader; // size 0x04, offset 0x00
103 SeqFile::DataBlock const *mDataBlock; // size 0x04, offset 0x04
104 }; // size 0x08
105}}} // namespace nw4r::snd::detail
106
107#endif // NW4R_SND_SEQ_FILE_H