-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathResFlowchart.h
136 lines (113 loc) · 3.12 KB
/
ResFlowchart.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
#pragma once
#include <ore/BinaryFile.h>
#include <ore/EnumUtil.h>
#include <ore/ResDic.h>
#include <ore/ResMetaData.h>
#include <ore/StringView.h>
namespace ore {
struct ResEndian;
}
namespace evfl {
struct ResActor;
struct ResCase {
u32 value;
u16 event_idx;
};
struct ResEvent {
ORE_ENUM(EventType, kAction, kSwitch, kFork, kJoin, kSubFlow)
ore::BinTPtr<ore::BinString> name;
ore::SizedEnum<EventType::Type, u8> type;
union {
// Action, Join, Sub flow
u16 next_event_idx;
// Switch
u16 num_cases;
// Fork
u16 num_forks;
};
union {
// Action, Switch
u16 actor_idx;
// Fork
u16 join_event_idx;
};
union {
// Action
u16 actor_action_idx;
// Switch
u16 actor_query_idx;
};
union {
// Action, Switch, Sub flow
ore::BinTPtr<ore::ResMetaData> params;
// Fork
ore::BinTPtr<u16> fork_event_indices;
};
union {
// Switch
ore::BinTPtr<ResCase> cases;
// Sub flow
ore::BinTPtr<ore::BinString> sub_flow_flowchart;
};
union {
// Sub flow
ore::BinTPtr<ore::BinString> sub_flow_entry_point;
};
};
struct ResVariableDef {
union Value {
// Also used for booleans. Anything that is != 0 is treated as true.
int i;
float f;
ore::BinTPtr<int> int_array;
ore::BinTPtr<float> float_array;
};
Value value;
u16 num;
ore::SizedEnum<ore::ResMetaData::DataType::Type, u8> type;
};
struct ResEntryPoint {
ore::BinTPtr<u16> sub_flow_event_indices;
ore::BinTPtr<ore::ResDic> variable_defs_names;
ore::BinTPtr<ResVariableDef> variable_defs;
u16 num_sub_flow_event_indices;
u16 num_variable_defs;
u16 main_event_idx;
};
struct ResFlowchart {
int CountEvent(ResEvent::EventType::Type type) const;
const ResEntryPoint* GetEntryPoint(const ore::StringView& entry_point_name) const {
const int idx = entry_point_names.Get()->FindIndex(entry_point_name);
if (idx == -1)
return nullptr;
return entry_points.Get() + idx;
}
ore::StringView GetEntryPointName(int idx) const {
return entry_point_names.Get()->GetEntries()[1 + idx].GetKey();
}
/// 'EVFL'
u32 magic;
/// String pool offset (relative to this structure)
u32 string_pool_offset;
u32 reserved_8;
u32 reserved_c;
u16 num_actors;
u16 num_actions;
u16 num_queries;
u16 num_events;
u16 num_entry_points;
u16 reserved_1a;
u16 reserved_1c;
u16 reserved_1e;
ore::BinTPtr<ore::BinString> name;
ore::BinTPtr<ResActor> actors;
ore::BinTPtr<ResEvent> events;
ore::BinTPtr<ore::ResDic> entry_point_names;
ore::BinTPtr<ResEntryPoint> entry_points;
};
void SwapEndian(ore::ResEndian* endian, ResCase* case_);
void SwapEndian(ore::ResEndian* endian, ResEvent* event);
void SwapEndian(ore::ResEndian* endian, ResEntryPoint* entry);
void SwapEndian(ore::ResEndian* endian, ResVariableDef* def);
void SwapEndian(ore::ResEndian* endian, ResFlowchart* flowchart);
} // namespace evfl