-
Notifications
You must be signed in to change notification settings - Fork 0
/
animExporter.h
116 lines (96 loc) · 2.74 KB
/
animExporter.h
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
108
109
110
111
112
113
114
115
116
#ifndef GUARD_ANIM_EXPORTER_H
#define GUARD_ANIM_EXPORTER_H
typedef enum {
UNKNOWN = 0,
SA1 = 1,
SA2 = 2,
SA3 = 3,
KATAM = 10, // Kirby & the Amazing Mirror
} eGame;
typedef struct {
RomPointer* data;
s32 entryCount;
} AnimationTable;
typedef struct {
u32 flags;
StringId label;
RomPointer address; // used for determining jump-destinations
RomPointer jmpTarget; // only used by Jump-Command
ACmd cmd;
} DynTableAnimCmd;
typedef struct {
s32 offsetVariants;
StringId name;
} DynTableAnim;
typedef struct {
DynTableAnim* animations;
u16* variantCounts;
} DynTable;
typedef struct {
u32* base; // Always(?) points backwards
s32* cursor;
s32 subCount; // There can be multiple "sub animations" in one entry.
} AnimationData;
typedef struct {
FILE* header;
FILE* animTable;
} OutFiles;
typedef struct {
char* strings;
s32* offsets;
u32 count;
} LabelStrings;
typedef struct {
/* 0x00 void* */ RomPointer animations;
/* 0x04 void* */ RomPointer dimensions;
/* 0x08 u16** */ RomPointer oamData;
/* 0x0C u16* */ RomPointer palettes;
/* 0x10 void* */ RomPointer tiles_4bpp;
/* 0x14 void* */ RomPointer tiles_8bpp;
} SpriteTablesROM;
typedef struct {
bool wasInitialized;
u16 tileCount;
s32 tileIndex;
s32 paletteId;
u16 numColors;
u16 animId;
u16 variantId;
u16 labelId;
} FrameData;
typedef struct {
FrameData* data;
u16 frameCount;
} FrameDataInput;
typedef struct {
/*0x00*/ u32 y : 8;
/*0x01*/ u32 affineMode : 2; // 0x1, 0x2 -> 0x4
u32 objMode : 2; // 0x4, 0x8 -> 0xC
u32 mosaic : 1; // 0x10
u32 bpp : 1; // 0x20
u32 shape : 2; // 0x40, 0x80 -> 0xC0
/*0x02*/ u32 x : 9;
u32 matrixNum : 5; // bits 3/4 are h-flip/v-flip if not in affine mode
u32 size : 2; // 0x4000, 0x8000 -> 0xC000
/*0x04*/ u16 tileNum : 10; // 0x3FF
u16 priority : 2; // 0x400, 0x800 -> 0xC00
u16 paletteNum : 4;
} OamSplit;
typedef struct {
u8 flip;
u8 oamIndex; // every animation has an oamData pointer, oamIndex starts at 0 for every new animation and ends at variantCount-1
u16 numSubframes; // some sprite frames consist of multiple images (of the same size as GBA's Object Attribute Memory, e.g. 8x8, 8x32, 32x64, ...)
u16 width;
u16 height;
s16 offsetX;
s16 offsetY;
} SpriteOffset;
typedef struct {
/* 0x00 */ RomPointer* animations;
/* 0x04 */ RomPointer* dimensions; // -> SpriteOffset[numFramesOfAnimation]
/* 0x08 */ RomPointer* oamData; // -> oamSplit
/* 0x0C */ u16* palettes;
/* 0x10 */ u8* tiles_4bpp;
/* 0x14 */ u8* tiles_8bpp;
} SpriteTables;
#endif // GUARD_ANIM_EXPORTER_H