Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
processor.h
Go to the documentation of this file.
1#ifndef JMESSAGE_PROCESSOR_H
2#define JMESSAGE_PROCESSOR_H
3
5#include "algorithm.h"
6
7namespace JMessage {
8struct TResource;
9struct TResourceContainer;
10
15struct TReference {
17
18 /* 802A7AF8 */ virtual ~TReference();
19 /* 802A7B40 */ virtual const char* do_word(u32) const;
20
21 int on_parseCharacter(const char** string) const { return pcResource_->parseCharacter(string); }
22 const char* on_word(u32 param_0) const { return do_word(param_0); }
23
25 if (pcResource_ == NULL) {
26 return NULL;
27 }
28
30 }
31
34
36};
37
42struct TProcessor {
45
47
48 struct TStack_ {
49 TStack_() { clear(); }
50
51 bool empty() const { return upsz_ == 0; }
52 bool IsPushable() const { return size() < max_size(); }
53
54 void clear() { upsz_ = 0; }
55 u32 max_size() const { return 4; }
56 u32 size() const { return upsz_; }
57
58 const char* top() const { return stack[upsz_ - 1]; }
59
60 void push(const char* string) {
62 upsz_++;
63 }
64
65 void pop() { upsz_--; }
66
69 char** start = (char**)other.stack;
70 char** end = (char**)(other.stack + other.upsz_);
72 return *this;
73 }
74
75 /* 0x0 */ u32 upsz_; // stack size
76 /* 0x4 */ const char* stack[4];
77 }; // Size: 0x14
78
79 struct TProcess_ {
81
84
86 struct {
87 /* 0x0 */ const char* (*pfn)(TProcessor*);
88 /* 0x4 */ const char* pcBase;
89 /* 0x8 */ const void* pOffset;
90 /* 0xC */ u32 uRest;
91 }
92 /* 0x4 */ rData;
93 }; // Size: 0x14
94
95 /* 802A7B90 */ void reset();
96 /* 802A7BF8 */ void stack_pushCurrent(char const*);
97 /* 802A7C30 */ void stack_popCurrent();
98 /* 802A7C54 */ const TResource* getResource_groupID(u16) const;
99 /* 802A7CD4 */ u32 toMessageCode_messageID(u32, u32, bool*) const;
100 /* 802A7E38 */ void on_select_begin(char const* (*)(JMessage::TProcessor*), void const*,
101 char const*, u32);
102 /* 802A7EDC */ void on_select_end();
103 /* 802A7F34 */ void on_select_separate();
104 /* 802A7FE4 */ void on_tag_();
105 /* 802A8090 */ // void do_tag_(u32, void const*, u32);
106 /* 802A81EC */ bool process_character_();
107 /* 802A828C */ static bool process_onCharacterEnd_normal_(JMessage::TProcessor*);
108 /* 802A82F4 */ static bool process_onCharacterEnd_select_(JMessage::TProcessor*);
109 /* 802A833C */ static const char* process_onSelect_limited_(JMessage::TProcessor*);
110 /* 802A8358 */ static const char* process_onSelect_(JMessage::TProcessor*);
111 /* 802A8C24 */ const char* on_message(u32) const;
112 /* 802A8C44 */ const char* getMessageText_messageCode(u32) const;
113
114 /* 802A7B48 */ virtual ~TProcessor();
115 /* 802A7FC0 */ virtual void do_reset();
116 /* 802A7FC4 */ virtual void do_begin(void const*, char const*);
117 /* 802A7FC8 */ virtual void do_end();
118 /* 802A7FCC */ virtual void do_character(int);
119 /* 802A7FD0 */ virtual bool do_tag(u32, void const*, u32);
120 /* 802A7FD8 */ virtual void do_select_begin(u32);
121 /* 802A7FDC */ virtual void do_select_end();
122 /* 802A7FE0 */ virtual void do_select_separate();
123 /* 802A8084 */ virtual void do_resetStatus_(char const*);
124 /* 802A8088 */ virtual bool do_setBegin_isReady_() const;
125 virtual void do_begin_(void const*, char const*) = 0;
126 virtual void do_end_() = 0;
127 virtual void do_tag_(u32, void const*, u32) = 0;
128
135
136 void on_begin(const void* entry, const char* param_1) {
137 do_begin_(entry, param_1);
138 do_begin(entry, param_1);
139 }
140
141 void on_end() {
142 do_end_();
143 do_end();
144 }
145
146 void on_tag(u32 param_0, const void* param_1, u32 param_2) {
147 if (!do_tag(param_0, param_1, param_2)) {
149 }
150 }
151
152 const char* on_word(u32 param_0) const { return pReference_->on_word(param_0); }
153
154 int on_parseCharacter(const char** string) const {
155 return pReference_->on_parseCharacter(string);
156 }
158
162
163 int setBegin_messageEntryText(const TResource* resource, const void* entry,
164 const char* param_2) {
167 on_begin(entry, param_2);
168 return 1;
169 }
170
171 int setBegin_messageEntryText(const TProcessor* processor, const void* entry,
172 const char* param_2) {
173 setBegin_messageEntryText(processor->getResourceCache(), entry, param_2);
174 return 1;
175 }
176
179
180 if (pResource == NULL) {
181 return NULL;
182 }
183
184 return pResource->getMessageEntry_messageIndex(messageIndex);
185 }
186
196
197 void stack_pushCurrent_(const char* string) {
200 }
201
204 oStack_.pop();
205 }
206
207 bool stack_isPushable() const { return oStack_.IsPushable(); }
208
209 const TResource* getResourceCache() const { return pResourceCache_; }
210 const char* getCurrent() const { return pszCurrent_; }
211 const TReference* getReference() const { return pReference_; }
212
216
220
222 if (pReference_ == NULL) {
223 return NULL;
224 }
225
227 }
228
231
232 /* 0x04 */ const TReference* pReference_;
233 /* 0x08 */ const TResource* pResourceCache_;
234 /* 0x0C */ const char* pszCurrent_;
235 /* 0x10 */ TStack_ oStack_;
237};
238
239struct TControl;
240
246 typedef const void* (*branchPfn)(const TSequenceProcessor*, u32);
247 typedef const void* (*jumpPfn)(const TSequenceProcessor*);
248
249 struct TProcess_ {
251
252 void reset() {}
253
254 union {
255 struct {
257 /* 0x4 */ const void* pTarget;
258 /* 0x8 */ u32 uTarget;
260 struct {
261 /* 0x0 */ jumpPfn jumpFn;
262 /* 0x4 */ u32 u32Target;
264 }
265 /* 0x0 */ process;
266 };
267
275
277 /* 802A8418 */ const char* process(char const*);
278 /* 802A85A4 */ bool on_isReady();
279 /* 802A85D0 */ void on_jump_register(void const* (*)(JMessage::TSequenceProcessor const*), u32);
280 /* 802A85E4 */ bool on_jump_isReady();
281 /* 802A8610 */ void on_jump(void const*, char const*);
282 /* 802A8690 */ void
283 on_branch_register(void const* (*)(JMessage::TSequenceProcessor const*, u32), void const*, u32);
284 /* 802A86A0 */ void on_branch_query(u32);
285 /* 802A86D4 */ u32 on_branch_queryResult();
286 /* 802A8700 */ void on_branch(void const*, char const*);
287 /* 802A892C */ static void process_setMessageIndex_reserved_(u16);
288 /* 802A8944 */ static void* process_setMessageCode_(JMessage::TSequenceProcessor const*, u16,
289 u16);
290 /* 802A89B8 */ static const void* process_onJump_limited_(JMessage::TSequenceProcessor const*);
291 /* 802A89EC */ static const void* process_onJump_(JMessage::TSequenceProcessor const*);
292 /* 802A8A18 */ static const void* process_onBranch_limited_(JMessage::TSequenceProcessor const*,
293 u32);
294 /* 802A8A50 */ static const void* process_onBranch_(JMessage::TSequenceProcessor const*, u32);
295
296 /* 802A83B8 */ virtual ~TSequenceProcessor();
297 /* 802A87A4 */ virtual void do_resetStatus_(char const*);
298 /* 802A87C0 */ virtual bool do_setBegin_isReady_() const;
299 /* 802A87D0 */ virtual void do_begin_(void const*, char const*);
300 /* 802A87D4 */ virtual void do_end_();
301 /* 802A87E0 */ virtual void do_tag_(u32, void const*, u32);
302 /* 802A8780 */ virtual bool do_isReady();
303 /* 802A8788 */ virtual bool do_jump_isReady();
304 /* 802A8790 */ virtual void do_jump(void const*, char const*);
305 /* 802A8794 */ virtual void do_branch_query(u32);
306 /* 802A8798 */ virtual s32 do_branch_queryResult();
307 /* 802A87A0 */ virtual void do_branch(void const*, char const*);
308
309 TControl* getControl() const { return pControl_; }
310
312 return process_setMessageCode_(pProcessor, pProcessor->getResourceCache()->getGroupID(),
313 param_1);
314 }
315
317 return process_setMessageCode_(pProcessor, param_1 >> 0x10, param_1 & 0xFFFF);
318 }
319
320 /* 0x38 */ TControl* pControl_;
321 /* 0x3C */ SeqStatus eStatus_;
323};
324
330 /* 802A8A84 */ TRenderingProcessor(JMessage::TReference const*);
331 /* 802A8B20 */ int process(char const*);
332
333 /* 802A8AC0 */ virtual ~TRenderingProcessor();
334 /* 802A8BA4 */ virtual void do_begin_(void const*, char const*);
335 /* 802A8BA8 */ virtual void do_end_();
336 /* 802A8BAC */ virtual void do_tag_(u32, void const*, u32);
337
340 if (rv != 0) {
341 process(NULL);
342 }
343 return rv != 0;
344 }
345};
346}; // namespace JMessage
347
348#endif /* JMESSAGE_PROCESSOR_H */
T cLib_calcTimer(T *value)
Definition c_lib.h:74
static void end(b_oh_class *i_this)
Definition d_a_b_oh.cpp:527
static processFunc process[]
Definition d_menu_collect.cpp:55
Definition control.h:6
OutputIt copy(InputIt first, InputIt last, OutputIt d_first)
Definition algorithm.h:48
@ start
Definition strtoul.c:8
Definition control.h:12
Definition processor.h:79
const void * pOffset
Definition processor.h:89
void reset_normal()
Definition processor.h:82
void reset_select()
Definition processor.h:83
const char * pcBase
Definition processor.h:88
struct JMessage::TProcessor::TProcess_::@122 rData
TProcess_()
Definition processor.h:80
pfnProcess_func pfnProcess_CharacterEnd
Definition processor.h:85
u32 uRest
Definition processor.h:90
Definition processor.h:48
const char * top() const
Definition processor.h:58
void pop()
Definition processor.h:65
TStack_ & operator=(const TStack_ &other)
Definition processor.h:67
const char * stack[4]
Definition processor.h:76
u32 size() const
Definition processor.h:56
u32 max_size() const
Definition processor.h:55
bool empty() const
Definition processor.h:51
bool IsPushable() const
Definition processor.h:52
void push(const char *string)
Definition processor.h:60
void clear()
Definition processor.h:54
u32 upsz_
Definition processor.h:75
TStack_()
Definition processor.h:49
Definition processor.h:42
void on_character(int character)
Definition processor.h:157
virtual void do_end()
Definition processor.cpp:232
virtual bool do_tag(u32, void const *, u32)
Definition processor.cpp:238
void stack_popCurrent_()
Definition processor.h:202
const char * pszCurrent_
Definition processor.h:234
virtual void do_reset()
Definition processor.cpp:225
static const char * process_onSelect_limited_(JMessage::TProcessor *)
Definition processor.cpp:361
virtual void do_select_end()
Definition processor.cpp:247
bool isResourceCache_groupID(u16 groupID) const
Definition processor.h:217
const char * on_message(u32) const
Definition processor.cpp:745
int setBegin_messageEntryText(const TProcessor *processor, const void *entry, const char *param_2)
Definition processor.h:171
const char * on_word(u32 param_0) const
Definition processor.h:152
virtual void do_resetStatus_(char const *)
Definition processor.cpp:271
virtual void do_tag_(u32, void const *, u32)=0
Definition processor.cpp:280
u32 toMessageCode_messageID(u32, u32, bool *) const
Definition processor.cpp:156
int on_parseCharacter(const char **string) const
Definition processor.h:154
const char * getCurrent() const
Definition processor.h:210
const char * getMessageText_messageCode(u32) const
Definition processor.cpp:751
const TResource * getResource_groupID(u16) const
Definition processor.cpp:142
void reset()
Definition processor.cpp:117
bool stack_isPushable() const
Definition processor.h:207
virtual void do_character(int)
Definition processor.cpp:235
virtual bool do_setBegin_isReady_() const
Definition processor.cpp:275
virtual void do_select_begin(u32)
Definition processor.cpp:244
void setResourceCache(TResource *cache)
Definition processor.h:229
void on_tag_()
Definition processor.cpp:255
int setBegin_messageEntryText(const TResource *resource, const void *entry, const char *param_2)
Definition processor.h:163
const TReference * getReference() const
Definition processor.h:211
virtual void do_select_separate()
Definition processor.cpp:251
void resetResourceCache()
Definition processor.h:230
void on_select_begin(char const *(*)(JMessage::TProcessor *), void const *, char const *, u32)
Definition processor.cpp:189
static const char * process_onSelect_(JMessage::TProcessor *)
Definition processor.cpp:372
const char * getMessageText_messageCode(u16 messageCode, u16 messageIndex) const
Definition processor.h:187
TStack_ oStack_
Definition processor.h:235
const char * on_message_limited(u16 messageIndex) const
Definition processor.h:159
const TResource * getResourceCache() const
Definition processor.h:209
TResourceContainer * getResourceContainer() const
Definition processor.h:221
static bool process_onCharacterEnd_normal_(JMessage::TProcessor *)
Definition processor.cpp:335
const TReference * pReference_
Definition processor.h:232
void on_tag(u32 param_0, const void *param_1, u32 param_2)
Definition processor.h:146
void on_select_end()
Definition processor.cpp:206
virtual void do_begin(void const *, char const *)
Definition processor.cpp:228
virtual void do_begin_(void const *, char const *)=0
bool(* pfnProcess_func)(TProcessor *)
Definition processor.h:46
void on_select_separate()
Definition processor.cpp:215
static bool process_onCharacterEnd_select_(JMessage::TProcessor *)
Definition processor.cpp:347
virtual ~TProcessor()
Definition processor.cpp:114
void on_begin(const void *entry, const char *param_1)
Definition processor.h:136
void stack_popCurrent()
Definition processor.cpp:136
TProcess_ oProcess_
Definition processor.h:236
const TResource * pResourceCache_
Definition processor.h:233
void stack_pushCurrent_(const char *string)
Definition processor.h:197
void * getMessageEntry_messageCode(u16 messageCode, u16 messageIndex) const
Definition processor.h:177
void on_end()
Definition processor.h:141
const TResource * getResource_groupID_uncached(u16 groupID) const
Definition processor.h:213
bool process_character_()
Definition processor.cpp:314
virtual void do_end_()=0
void on_resetStatus_(const char *param_0)
Definition processor.h:129
TProcessor(const TReference *reference)
Definition processor.h:43
void stack_pushCurrent(char const *)
Definition processor.cpp:124
Definition processor.h:15
TReference()
Definition processor.h:16
int on_parseCharacter(const char **string) const
Definition processor.h:21
TResourceContainer * pcResource_
Definition processor.h:35
void setResourceContainer(TResourceContainer *container)
Definition processor.h:33
virtual const char * do_word(u32) const
Definition processor.cpp:109
TResource * getResource_groupID(u16 groupID) const
Definition processor.h:24
TResourceContainer * getResourceContainer() const
Definition processor.h:32
virtual ~TReference()
Definition processor.cpp:106
const char * on_word(u32 param_0) const
Definition processor.h:22
Definition processor.h:329
bool process_messageEntryText(TProcessor *param_0, void const *param_1, const char *param_2)
Definition processor.h:338
virtual void do_tag_(u32, void const *, u32)
Definition processor.cpp:710
virtual ~TRenderingProcessor()
Definition processor.cpp:685
virtual void do_end_()
Definition processor.cpp:706
virtual void do_begin_(void const *, char const *)
Definition processor.cpp:702
Definition resource.h:81
TResource * getResource_groupID(u16 groupID)
Definition resource.h:98
int parseCharacter(const char **string) const
Definition resource.h:97
Definition resource.h:15
char * getMessageText_messageEntry(const void *pEntry) const
Definition resource.h:38
u16 getGroupID() const
Definition resource.h:28
const char * getMessageText_messageIndex(u16 messageIndex) const
Definition resource.h:42
Definition processor.h:249
void reset()
Definition processor.h:252
struct JMessage::TSequenceProcessor::TProcess_::@123::@125 jump_process
const void * pTarget
Definition processor.h:257
TProcess_()
Definition processor.h:250
branchPfn branchFn
Definition processor.h:256
jumpPfn jumpFn
Definition processor.h:261
u32 uTarget
Definition processor.h:258
u32 u32Target
Definition processor.h:262
union JMessage::TSequenceProcessor::TProcess_::@123 process
struct JMessage::TSequenceProcessor::TProcess_::@123::@124 branch_process
Definition processor.h:245
void on_branch(void const *, char const *)
Definition processor.cpp:497
static const void * process_onBranch_limited_(JMessage::TSequenceProcessor const *, u32)
Definition processor.cpp:662
void on_jump_register(void const *(*)(JMessage::TSequenceProcessor const *), u32)
Definition processor.cpp:452
virtual s32 do_branch_queryResult()
Definition processor.cpp:524
void on_branch_query(u32)
Definition processor.cpp:484
static const void * process_onJump_(JMessage::TSequenceProcessor const *)
Definition processor.cpp:655
virtual void do_resetStatus_(char const *)
Definition processor.cpp:534
TControl * getControl() const
Definition processor.h:309
u32 on_branch_queryResult()
Definition processor.cpp:491
virtual void do_begin_(void const *, char const *)
Definition processor.cpp:550
void on_jump(void const *, char const *)
Definition processor.cpp:467
static void * process_setMessageCode_(JMessage::TSequenceProcessor const *, u16, u16)
Definition processor.cpp:629
static void process_setMessageIndex_reserved_(u16)
Definition processor.cpp:615
virtual bool do_jump_isReady()
Definition processor.cpp:510
virtual bool do_setBegin_isReady_() const
Definition processor.cpp:544
virtual void do_tag_(u32, void const *, u32)
Definition processor.cpp:560
virtual bool do_isReady()
Definition processor.cpp:504
SeqStatus
Definition processor.h:268
@ STATUS_BRANCH
Definition processor.h:273
@ STATUS_ONE
Definition processor.h:270
@ STATUS_NORMAL
Definition processor.h:271
@ STATUS_JUMP
Definition processor.h:272
@ STATUS_READY
Definition processor.h:269
SeqStatus eStatus_
Definition processor.h:321
virtual void do_branch(void const *, char const *)
Definition processor.cpp:530
bool on_isReady()
Definition processor.cpp:446
static const void * process_onBranch_(JMessage::TSequenceProcessor const *, u32)
Definition processor.cpp:672
const void *(* branchPfn)(const TSequenceProcessor *, u32)
Definition processor.h:246
TProcess_ oProcess2_
Definition processor.h:322
virtual ~TSequenceProcessor()
Definition processor.cpp:388
TControl * pControl_
Definition processor.h:320
bool on_jump_isReady()
Definition processor.cpp:461
static const void * process_setMessageIndex_(const TSequenceProcessor *pProcessor, u16 param_1)
Definition processor.h:311
virtual void do_jump(void const *, char const *)
Definition processor.cpp:516
const void *(* jumpPfn)(const TSequenceProcessor *)
Definition processor.h:247
void on_branch_register(void const *(*)(JMessage::TSequenceProcessor const *, u32), void const *, u32)
Definition processor.cpp:475
virtual void do_branch_query(u32)
Definition processor.cpp:520
virtual void do_end_()
Definition processor.cpp:554
static const void * process_setMessageCode_(const TSequenceProcessor *pProcessor, u32 param_1)
Definition processor.h:316
static const void * process_onJump_limited_(JMessage::TSequenceProcessor const *)
Definition processor.cpp:648
unsigned long u32
Definition types.h:10
unsigned short u16
Definition types.h:9
signed long s32
Definition types.h:6