aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authormd52011-03-25 14:09:09 +0200
committermd52011-03-25 14:09:09 +0200
commit10d1a58cb295993ddf4dbe4ab0869a01a6cbfa3b (patch)
treee1a6d39ab1972bab4e96283fa55ac7a117b8c930 /engines
parentd86504ef887c5f10fedbc081476a050295241cb4 (diff)
downloadscummvm-rg350-10d1a58cb295993ddf4dbe4ab0869a01a6cbfa3b.tar.gz
scummvm-rg350-10d1a58cb295993ddf4dbe4ab0869a01a6cbfa3b.tar.bz2
scummvm-rg350-10d1a58cb295993ddf4dbe4ab0869a01a6cbfa3b.zip
SCI: Reordered some functions
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/vm.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 1eb22ef754..7e75dbf000 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -270,24 +270,6 @@ static void validate_write_var(reg_t *r, reg_t *stack_base, int type, int max, i
#define PUSH32(a) (*(validate_stack_addr(s, (s->xs->sp)++)) = (a))
#define POP32() (*(validate_stack_addr(s, --(s->xs->sp))))
-bool SciEngine::checkExportBreakpoint(uint16 script, uint16 pubfunct) {
- if (_debugState._activeBreakpointTypes & BREAK_EXPORT) {
- uint32 bpaddress = (script << 16 | pubfunct);
-
- Common::List<Breakpoint>::const_iterator bp;
- for (bp = _debugState._breakpoints.begin(); bp != _debugState._breakpoints.end(); ++bp) {
- if (bp->type == BREAK_EXPORT && bp->address == bpaddress) {
- _console->DebugPrintf("Break on script %d, export %d\n", script, pubfunct);
- _debugState.debugging = true;
- _debugState.breakpointWasHit = true;
- return true;
- }
- }
- }
-
- return false;
-}
-
ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackPtr sp, reg_t calling_obj, uint16 argc, StackPtr argp) {
int seg = s->_segMan->getScriptSegment(script);
Script *scr = s->_segMan->getScriptIfLoaded(seg);
@@ -320,41 +302,6 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP
return add_exec_stack_entry(s->_executionStack, make_reg(seg, temp), sp, calling_obj, argc, argp, -1, pubfunct, -1, calling_obj, s->_executionStack.size()-1, seg);
}
-
-static void _exec_varselectors(EngineState *s) {
- // Executes all varselector read/write ops on the TOS
- while (!s->_executionStack.empty() && s->_executionStack.back().type == EXEC_STACK_TYPE_VARSELECTOR) {
- ExecStack &xs = s->_executionStack.back();
- reg_t *var = xs.getVarPointer(s->_segMan);
- if (!var) {
- error("Invalid varselector exec stack entry");
- } else {
- // varselector access?
- if (xs.argc) { // write?
- *var = xs.variables_argp[1];
-
- } else // No, read
- s->r_acc = *var;
- }
- s->_executionStack.pop_back();
- }
-}
-
-/** This struct is used to buffer the list of send calls in send_selector() */
-struct CallsStruct {
- reg_t addr_func;
- reg_t varp_objp;
- union {
- reg_t func;
- ObjVarRef var;
- } address;
- StackPtr argp;
- int argc;
- Selector selector;
- StackPtr sp; /**< Stack pointer */
- int type; /**< Same as ExecStack.type */
-};
-
bool SciEngine::checkSelectorBreakpoint(BreakpointType breakpointType, reg_t send_obj, int selector) {
Common::String methodName = _gamestate->_segMan->getObjectName(send_obj);
methodName += ("::" + getKernel()->getSelectorName(selector));
@@ -371,6 +318,24 @@ bool SciEngine::checkSelectorBreakpoint(BreakpointType breakpointType, reg_t sen
return false;
}
+bool SciEngine::checkExportBreakpoint(uint16 script, uint16 pubfunct) {
+ if (_debugState._activeBreakpointTypes & BREAK_EXPORT) {
+ uint32 bpaddress = (script << 16 | pubfunct);
+
+ Common::List<Breakpoint>::const_iterator bp;
+ for (bp = _debugState._breakpoints.begin(); bp != _debugState._breakpoints.end(); ++bp) {
+ if (bp->type == BREAK_EXPORT && bp->address == bpaddress) {
+ _console->DebugPrintf("Break on script %d, export %d\n", script, pubfunct);
+ _debugState.debugging = true;
+ _debugState.breakpointWasHit = true;
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
void debugSelectorCall(reg_t send_obj, Selector selector, int argc, StackPtr argp, ObjVarRef &varp, reg_t funcp, SegManager *segMan, SelectorType selectorType) {
int activeBreakpointTypes = g_sci->_debugState._activeBreakpointTypes;
const char *objectName = segMan->getObjectName(send_obj);
@@ -442,6 +407,41 @@ void debugSelectorCall(reg_t send_obj, Selector selector, int argc, StackPtr arg
} // switch
}
+
+static void _exec_varselectors(EngineState *s) {
+ // Executes all varselector read/write ops on the TOS
+ while (!s->_executionStack.empty() && s->_executionStack.back().type == EXEC_STACK_TYPE_VARSELECTOR) {
+ ExecStack &xs = s->_executionStack.back();
+ reg_t *var = xs.getVarPointer(s->_segMan);
+ if (!var) {
+ error("Invalid varselector exec stack entry");
+ } else {
+ // varselector access?
+ if (xs.argc) { // write?
+ *var = xs.variables_argp[1];
+
+ } else // No, read
+ s->r_acc = *var;
+ }
+ s->_executionStack.pop_back();
+ }
+}
+
+/** This struct is used to buffer the list of send calls in send_selector() */
+struct CallsStruct {
+ reg_t addr_func;
+ reg_t varp_objp;
+ union {
+ reg_t func;
+ ObjVarRef var;
+ } address;
+ StackPtr argp;
+ int argc;
+ Selector selector;
+ StackPtr sp; /**< Stack pointer */
+ int type; /**< Same as ExecStack.type */
+};
+
ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPtr sp, int framesize, StackPtr argp) {
// send_obj and work_obj are equal for anything but 'super'
// Returns a pointer to the TOS exec_stack element