libnedit
Lightweight C++ library for Nintendo DS(i) formats
Loading...
Searching...
No Matches
libnedit
include
ntr
fmt
fmt_Common.hpp
1
2
#pragma once
3
#include <ntr/fs/fs_BinaryFile.hpp>
4
5
namespace
ntr::fmt {
6
7
template
<
typename
T, T BaseMagic>
8
struct
MagicStartBase
{
9
T magic;
10
11
inline
constexpr
bool
IsValid() {
12
return
this->magic == Magic;
13
}
14
15
inline
void
EnsureMagic() {
16
this->magic = Magic;
17
}
18
19
static
constexpr
T Magic = BaseMagic;
20
};
21
22
template
<
typename
T, T BaseMagic1, T BaseMagic2>
23
struct
MultiMagicStartBase
{
24
T magic;
25
26
inline
constexpr
bool
IsValid() {
27
return
(this->magic == Magic1) || (this->magic == Magic2);
28
}
29
30
static
constexpr
T Magic1 = BaseMagic1;
31
static
constexpr
T Magic2 = BaseMagic2;
32
};
33
34
template
<u32 Magic>
35
struct
CommonHeader
:
public
MagicStartBase
<u32, Magic> {
36
u16 byte_order;
37
u16 version;
38
u32 file_size;
39
u16 header_size;
40
u16 block_count;
41
};
42
43
template
<u32 Magic1, u32 Magic2>
44
struct
CommonMultiMagicHeader
:
public
MultiMagicStartBase
<u32, Magic1, Magic2> {
45
u16 byte_order;
46
u16 version;
47
u32 file_size;
48
u16 header_size;
49
u16 block_count;
50
};
51
52
template
<u32 Magic>
53
struct
CommonBlock
:
public
MagicStartBase
<u32, Magic> {
54
u32 block_size;
55
};
56
57
enum class
WaveType : u8 {
58
PCM8,
59
PCM16,
60
ADPCM
61
};
62
63
}
ntr::fmt::CommonBlock
Definition
fmt_Common.hpp:53
ntr::fmt::CommonHeader
Definition
fmt_Common.hpp:35
ntr::fmt::CommonMultiMagicHeader
Definition
fmt_Common.hpp:44
ntr::fmt::MagicStartBase
Definition
fmt_Common.hpp:8
ntr::fmt::MultiMagicStartBase
Definition
fmt_Common.hpp:23
Generated by
1.10.0