DCDecomp
A decompilation of Dark Cloud for the PlayStation 2
Loading...
Searching...
No Matches
CRunScript Class Reference

#include <runscript.hpp>

Public Member Functions

int IsEnd ()
 
 CRunScript ()
 
void check_stack ()
 
void push (RS_STACKDATA value)
 
void push_int (int value)
 
void push_str (char *string)
 
void push_ptr (RS_STACKDATA *pointer)
 
void push_float (float value)
 
RS_STACKDATA pop ()
 
vmcode_t * call_func (funcdata *callee, vmcode_t *return_pc)
 
vmcode_t * ret_func ()
 
void ext (RS_STACKDATA *args, int argc)
 
void load (RS_PROG_HEADER *prog, RS_STACKDATA *stack, int stack_num, RS_CALLDATA *call, int call_num)
 
void reload (RS_PROG_HEADER *prog)
 
void ext_func (int(**table)(RS_STACKDATA *, int), int count)
 
void resume ()
 
int run (int no)
 
int check_program (int no)
 
void skip ()
 
void exe (vmcode_t *entry)
 

Public Attributes

int ext_func_num
 
int(** ext_func_table )(RS_STACKDATA *, int)
 
int stack_num
 
RS_STACKDATA * stack
 
RS_STACKDATA * sp
 
RS_STACKDATA * stack_end
 
int call_num
 
RS_CALLDATA * call
 
RS_CALLDATA * call_sp
 
RS_CALLDATA * call_end
 
RS_STACKDATA * frame
 
funcdata * func
 
vmcode_t * pc
 
int end
 
int skip_wait
 
RS_PROG_HEADER * prog
 
char * code
 
int result
 

Detailed Description

Runs one compiled script on a stack machine, suspending at its waits.

Definition at line 144 of file runscript.hpp.

Constructor & Destructor Documentation

◆ CRunScript()

CRunScript::CRunScript ( )

Makes an interpreter with no program, stack or external functions.

Mangled name:
__ct__10CRunScriptFv
Address:
0x23D940
Size:
0x40

Definition at line 59 of file runscript.cpp.

Member Function Documentation

◆ IsEnd()

int CRunScript::IsEnd ( )
inline

Nonzero once the script has run to its end.

Definition at line 168 of file runscript.hpp.

◆ check_stack()

void CRunScript::check_stack ( )

Stops the game when the operand stack is full.

Mangled name:
check_stack__10CRunScriptFv
Address:
0x23D980
Size:
0x34
Return type:
Not recovered.

Definition at line 71 of file runscript.cpp.

◆ push()

void CRunScript::push ( RS_STACKDATA  value)

Pushes one value onto the operand stack.

Mangled name:
push__10CRunScriptF12RS_STACKDATA
Address:
0x23D9C0
Size:
0x50
Return type:
Not recovered.

Definition at line 77 of file runscript.cpp.

◆ push_int()

void CRunScript::push_int ( int  value)

Pushes an integer onto the operand stack.

Mangled name:
push_int__10CRunScriptFi
Address:
0x23DA10
Size:
0x50
Return type:
Not recovered.

Definition at line 82 of file runscript.cpp.

◆ push_str()

void CRunScript::push_str ( char *  string)

Pushes a string onto the operand stack.

Mangled name:
push_str__10CRunScriptFPc
Address:
0x23DA60
Size:
0x54
Return type:
Not recovered.

Definition at line 88 of file runscript.cpp.

◆ push_ptr()

void CRunScript::push_ptr ( RS_STACKDATA *  pointer)

Pushes a reference to a stack slot onto the operand stack.

Mangled name:
push_ptr__10CRunScriptFP12RS_STACKDATA
Address:
0x23DAC0
Size:
0x54
Return type:
Not recovered.

Definition at line 94 of file runscript.cpp.

◆ push_float()

void CRunScript::push_float ( float  value)

Pushes a float onto the operand stack.

Mangled name:
push_float__10CRunScriptFf
Address:
0x23DB20
Size:
0x54
Return type:
Not recovered.

Definition at line 100 of file runscript.cpp.

◆ pop()

RS_STACKDATA CRunScript::pop ( )

Pops the top value off the operand stack.

Mangled name:
pop__10CRunScriptFv
Address:
0x23DB80
Size:
0x24
Return type:
Not recovered.

Definition at line 106 of file runscript.cpp.

◆ call_func()

vmcode_t * CRunScript::call_func ( funcdata *  callee,
vmcode_t *  return_pc 
)

Enters a script function, and gives back its first instruction.

Mangled name:
call_func__10CRunScriptFP8funcdataP8vmcode_t
Address:
0x23DBB0
Size:
0x108
Return type:
Not recovered.

Definition at line 112 of file runscript.cpp.

◆ ret_func()

vmcode_t * CRunScript::ret_func ( )

Leaves the current script function, and gives back the caller's instruction.

Mangled name:
ret_func__10CRunScriptFv
Address:
0x23DCC0
Size:
0x34
Return type:
Not recovered.

Definition at line 131 of file runscript.cpp.

◆ ext()

void CRunScript::ext ( RS_STACKDATA *  args,
int  argc 
)

Calls the external function the first argument names.

Mangled name:
ext__10CRunScriptFP12RS_STACKDATAi
Address:
0x23DD00
Size:
0xB4
Return type:
Not recovered.

Definition at line 138 of file runscript.cpp.

◆ load()

void CRunScript::load ( RS_PROG_HEADER *  prog,
RS_STACKDATA *  stack,
int  stack_num,
RS_CALLDATA *  call,
int  call_num 
)

Gives the interpreter a program and the stacks to run it on.

Mangled name:
load__10CRunScriptFP14RS_PROG_HEADERP12RS_STACKDATAiP11RS_CALLDATAi
Address:
0x23DDC0
Size:
0x50
Return type:
Not recovered.

Definition at line 148 of file runscript.cpp.

◆ reload()

void CRunScript::reload ( RS_PROG_HEADER *  prog)

Swaps in another program, keeping the stacks.

Mangled name:
reload__10CRunScriptFP14RS_PROG_HEADER
Address:
0x23DE10
Size:
0x18
Return type:
Not recovered.

Definition at line 159 of file runscript.cpp.

◆ ext_func()

void CRunScript::ext_func ( int(**)(RS_STACKDATA *, int)  table,
int  count 
)

Registers the table of external functions scripts can call.

Mangled name:
ext_func__10CRunScriptFPPFP12RS_STACKDATAi_ii
Address:
0x23DE30
Size:
0x10
Return type:
Not recovered.

Definition at line 164 of file runscript.cpp.

◆ resume()

void CRunScript::resume ( )

Continues a suspended script where it stopped.

Mangled name:
resume__10CRunScriptFv
Address:
0x23DE40
Size:
0x2C
Return type:
Not recovered.

Definition at line 169 of file runscript.cpp.

◆ run()

int CRunScript::run ( int  no)

Starts a numbered program, or the main function for a negative number.

Mangled name:
run__10CRunScriptFi
Address:
0x23DE70
Size:
0x180
Return type:
Not recovered.

Definition at line 175 of file runscript.cpp.

◆ check_program()

int CRunScript::check_program ( int  no)

Reports whether the program has a numbered entry.

Mangled name:
check_program__10CRunScriptFi
Address:
0x23DFF0
Size:
0x54
Return type:
Not recovered.

Definition at line 219 of file runscript.cpp.

◆ skip()

void CRunScript::skip ( )

Resumes the script, running through its waits.

Mangled name:
skip__10CRunScriptFv
Address:
0x23E050
Size:
0x28
Return type:
Not recovered.

Definition at line 236 of file runscript.cpp.

◆ exe()

void CRunScript::exe ( vmcode_t *  entry)

Runs instructions from one until the script ends or waits.

Mangled name:
exe__10CRunScriptFP8vmcode_t
Address:
0x23E080
Size:
0x1508
Return type:
Not recovered.

Definition at line 245 of file runscript.cpp.

Member Data Documentation

◆ ext_func_num

int CRunScript::ext_func_num

Gives the number of registered external functions.

Definition at line 146 of file runscript.hpp.

◆ ext_func_table

int(** CRunScript::ext_func_table) (RS_STACKDATA *, int)

Points to the external function table.

Definition at line 147 of file runscript.hpp.

◆ stack_num

int CRunScript::stack_num

Gives the operand stack capacity.

Definition at line 148 of file runscript.hpp.

◆ stack

RS_STACKDATA* CRunScript::stack

Points to the operand stack storage.

Definition at line 149 of file runscript.hpp.

◆ sp

RS_STACKDATA* CRunScript::sp

Points to the next operand stack slot.

Definition at line 150 of file runscript.hpp.

◆ stack_end

RS_STACKDATA* CRunScript::stack_end

Points one past the operand stack storage.

Definition at line 151 of file runscript.hpp.

◆ call_num

int CRunScript::call_num

Gives the call stack capacity.

Definition at line 152 of file runscript.hpp.

◆ call

RS_CALLDATA* CRunScript::call

Points to the call stack storage.

Definition at line 153 of file runscript.hpp.

◆ call_sp

RS_CALLDATA* CRunScript::call_sp

Points to the next call stack entry.

Definition at line 154 of file runscript.hpp.

◆ call_end

RS_CALLDATA* CRunScript::call_end

Points one past the call stack storage.

Definition at line 155 of file runscript.hpp.

◆ frame

RS_STACKDATA* CRunScript::frame

Points to the active operand frame.

Definition at line 156 of file runscript.hpp.

◆ func

funcdata* CRunScript::func

Describes the active script function.

Definition at line 157 of file runscript.hpp.

◆ pc

vmcode_t* CRunScript::pc

Points to the next instruction.

Definition at line 158 of file runscript.hpp.

◆ end

int CRunScript::end

Records whether execution has completed.

Definition at line 159 of file runscript.hpp.

◆ skip_wait

int CRunScript::skip_wait

Records whether wait operations should be skipped.

Definition at line 160 of file runscript.hpp.

◆ prog

RS_PROG_HEADER* CRunScript::prog

Points to the loaded program header.

Definition at line 161 of file runscript.hpp.

◆ code

char* CRunScript::code

Points to the loaded bytecode section.

Definition at line 162 of file runscript.hpp.

◆ result

int CRunScript::result

Stores the script's return value.

Definition at line 163 of file runscript.hpp.