-
Notifications
You must be signed in to change notification settings - Fork 1
/
mot.h
293 lines (250 loc) · 5.02 KB
/
mot.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#pragma once
#include <immintrin.h>
#include <vector> //tmp
#include <Fluorine\Memory.h>
#include "ReversedStructs.h"
#include "Vector4.h"
#define MOT_MAGIC FOURCC('m', 'o', 't', '\0')
typedef unsigned short uint16;
typedef unsigned short hfloat;
typedef unsigned int uint32;
typedef int int32;
// https://github.com/Kerilk/noesis_bayonetta_pc/blob/master/bayonetta_pc/MotionBayo.h
/*
Found: https://forum.xentax.com/viewtopic.php?f=10&t=16011&sid=110c6732b529049ca7dd0769afd12688&start=15
typedef struct BoneArray {
SHORT BoneID;
UBYTE Channel; // "0-POSX 1-POSY 2-POSZ 3-ROTX 4-ROTY 5-ROTZ
ULONG FrameThing; // "When this is filled Float changes and 8 bytes are added to the bottom of the file"
UBYTE Blank0;
float Float;
} BoneArray;
struct MOT
{
char fourCC[4]; // "MOT"
ULONG UNK0;
SHORT Blank;
SHORT UNK1;
ULONG Offset1; //"Bone List offset"
ULONG ListCount;
ULONG UNK1;
char Name[20];
BoneArray BoneStuff[ListCount];
};
*/
struct MotHeader
{
union {
char id[4]; // "mot\0"
int magic;
};
UINT uHash;
USHORT flag;
SHORT sFrameCount;
UINT uRecordOffset;
UINT uRecordCount;
BYTE bUnknown;
BYTE bFrameRate30;
WORD pad;
char szAnimName[12]; // found at most 12 bytes with terminating 0
};
// MotItem_t on https://github.com/Kerilk/noesis_bayonetta_pc/blob/master/bayonetta_pc/MotionBayo.h
struct MotRecord
{
SHORT sBoneIndex;
char index;
char flags;
SHORT elemNumber;
SHORT unknown; //always -1
union { // bayoMotField_t value;
float flt;
uint32 offset;
};
};
struct MotInterpolation
{
float flValues[ANYSIZE_ARRAY]; // MotRecord::elemNumber
};
struct MotInterpolationInternal
{
float* m_pflValues;
short m_sValuesCount;
};
struct MotInterpolation2Values
{
float p;
float dp;
};
struct MotInterpolation2
{
MotInterpolation2Values values;
uint16 cp[ANYSIZE_ARRAY]; // MotRecord::elemNumber
};
struct MotInterpolation2Internal
{
MotInterpolation2Values m_Values;
PUSHORT m_pcp;
short m_scpCount;
};
struct MotInterpolation3Values
{
hfloat p;
hfloat dp;
};
struct MotInterpolation3
{
MotInterpolation3Values values;
byte cp[ANYSIZE_ARRAY]; // MotRecord::elemNumber
};
struct MotInterpolation3Internal
{
MotInterpolation3Values m_Values;
PBYTE m_pcp;
short m_scpCount;
};
struct MotInterpolation4Key
{
uint16 index; // absolute frame index
uint16 dummy;
float p;
float m0;
float m1;
};
struct MotInterpolation4
{
MotInterpolation4Key keys[ANYSIZE_ARRAY]; // MotRecord::elemNumber
};
struct MotInterpolation4Internal
{
MotInterpolation4Key* m_pKeys;
short m_sKeyCount;
};
struct MotInterpolation5Values
{
float p;
float dp;
float m0;
float dm0;
float m1;
float dm1;
};
struct MotInterpolation5Key
{
uint16 index; // absolute frame index
uint16 cp;
uint16 cm0;
uint16 cm1;
};
struct MotInterpolation5
{
MotInterpolation5Values values;
MotInterpolation5Key keys[ANYSIZE_ARRAY]; // MotRecord::elemNumber
};
struct MotInterpolation5Internal
{
MotInterpolation5Values m_values;
MotInterpolation5Key* m_pKeys;
short m_sKeyCount;
};
struct MotInterpolation6Values
{
hfloat p;
hfloat dp;
hfloat m0;
hfloat dm0;
hfloat m1;
hfloat dm1;
};
typedef MotInterpolation6Values MotInterpolation7Values;
struct MotInterpolation6Key
{
byte index; // absolute frame index
byte cp;
byte cm0;
byte cm1;
};
struct MotInterpolation6
{
MotInterpolation6Values values;
MotInterpolation6Key keys[ANYSIZE_ARRAY]; // MotRecord::elemNumber
};
struct MotInterpolation6Internal
{
MotInterpolation6Values m_values;
MotInterpolation6Key* m_pKeys;
short m_sKeyCount;
};
struct MotInterpolation7Key
{
byte index; // frame index relative to previous key
byte cp;
byte cm0;
byte cm1;
};
struct MotInterpolation7
{
MotInterpolation6Values values;
MotInterpolation7Key keys[ANYSIZE_ARRAY]; // MotRecord::elemNumber
};
struct MotInterpolation7Internal
{
MotInterpolation6Values m_values;
MotInterpolation7Key* m_pKeys;
short m_sKeyCount;
};
struct MotInterpolation8Values
{
hfloat p;
hfloat dp;
hfloat m0;
hfloat dm0;
hfloat m1;
hfloat dm1;
};
struct MotInterpolation8Key
{
uint16 index; // absolute frame index (in big endian order!!!!) Big Endian
byte cp;
byte cm0;
byte cm1;
};
struct MotInterpolation8
{
MotInterpolation8Values values;
MotInterpolation8Key keys[ANYSIZE_ARRAY]; // MotRecord::elemNumber
};
struct MotInterpolation8Internal
{
MotInterpolation8Values m_values;
MotInterpolation8Key* m_pKeys;
short m_sKeyCount;
};
struct MotInterpListEntry
{
enum Type
{
NONE,
INTERP,
INTERP2,
INTERP3,
INTERP4,
INTERP5,
INTERP6,
INTERP7,
INTERP8
};
Type type;
union
{
MotInterpolationInternal* pInterp;
MotInterpolation2Internal* pInterp2;
MotInterpolation3Internal* pInterp3;
MotInterpolation4Internal* pInterp4;
MotInterpolation5Internal* pInterp5;
MotInterpolation6Internal* pInterp6;
MotInterpolation7Internal* pInterp7;
MotInterpolation8Internal* pInterp8;
};
};
EXTERN_C float __fastcall ConvertFP16ToFP32(hfloat value);
extern "C" void ProcessMot(std::vector<MotInterpListEntry>&Interps, CModelWork * pWork, short sFrameCount);