blob: f6eec142c4c4486e7998cba5d4c800f55f526c42 (
plain)
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
|
#ifndef _SCRIPT_H_
#define _SCRIPT_H_
#include "global.h"
#include "msgdata.h"
#include "save_block_2.h"
#include "bg_window.h"
struct ScriptContext;
typedef u8 (*ScrCmdFunc)(struct ScriptContext *);
typedef u8 Script[];
struct UnkStruct_020464D4
{
u16 unk0[4];
u8 padding[0x108];
};
struct UnkStruct_02046444
{
u8 padding[0x90];
struct UnkStruct_020464D4 unk90[1]; //todo find size
};
struct UnkSavStruct80
{
u8 padding[0x8];
struct BgConfig *unk08;
struct SaveBlock2 *saveBlock2; //0xC
struct UnkStruct_0204639C *unk10;
u8 padding2[0x8];
u32 *mapId; //0x1C
u8 padding3[0x14];
u32 unk34;
u32 unk38;
u8 padding4[0x24];
u32 unk60;
u8 padding5[0x14];
u32 unk78;
u8 padding6[0x1C];
void *unk98;
u8 padding7[0xC];
struct UnkStruct_02046444 * unkA8;
};
struct ScriptContext
{
u8 stackDepth;
u8 mode;
u8 comparisonResult;
BOOL (*nativePtr)(struct ScriptContext *);
const u8 *scriptPtr;
const u8 *stack[20];
ScrCmdFunc *cmdTable;
u32 cmdCount;
u32 data[4];
struct UnkStruct_0204639C *unk74;
struct MsgData *msgData;
u8 *unk7C;
struct UnkSavStruct80 *unk80;
};
#define ScriptReadByte(ctx) (*(ctx->scriptPtr++))
void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, u32 cmdCount);
u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr);
void SetupNativeScript(struct ScriptContext *ctx, BOOL (*ptr)(struct ScriptContext *));
void StopScript(struct ScriptContext *ctx);
void FUN_02038B6C(struct ScriptContext *ctx, struct UnkStruct_0204639C *r1);
u8 RunScriptCommand(struct ScriptContext *ctx);
u8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr);
const u8 *ScriptPop(struct ScriptContext *ctx);
void ScriptJump(struct ScriptContext *ctx, const u8 *ptr);
u8 ScriptCall(struct ScriptContext *ctx, const u8 *ptr);
void ScriptReturn(struct ScriptContext *ctx);
u16 ScriptReadHalfword(struct ScriptContext *ctx);
u32 ScriptReadWord(struct ScriptContext *ctx);
#endif // _SCRIPT_H_
|