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