aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2009-06-03 09:45:16 +0000
committerFilippos Karapetis2009-06-03 09:45:16 +0000
commit3c7b434b04240be647d0d10f8e1dcecea95f7aac (patch)
tree04e1146d597f479e4662fafe1383a45f39316602 /engines/sci/engine
parent59cb31d0134ee936b76bd54722be2671a813f46e (diff)
downloadscummvm-rg350-3c7b434b04240be647d0d10f8e1dcecea95f7aac.tar.gz
scummvm-rg350-3c7b434b04240be647d0d10f8e1dcecea95f7aac.tar.bz2
scummvm-rg350-3c7b434b04240be647d0d10f8e1dcecea95f7aac.zip
- Sorted the console commands a bit more
- Removed the commands which manipulated variables and turned them into debug variables instead - Rewrote help so that it's more organized and easier to read - Unified the debug variable names svn-id: r41136
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kevent.cpp14
-rw-r--r--engines/sci/engine/vm.cpp39
2 files changed, 31 insertions, 22 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index d39685d8ef..7b1be0ae62 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -28,13 +28,13 @@
#include "sci/engine/kernel.h"
#include "sci/gfx/gfx_widgets.h"
#include "sci/gfx/gfx_state_internal.h" // required for GfxPort, GfxVisual
-#include "sci/console.h" // for _kdebug_cheap_event_hack
+#include "sci/console.h" // for debug_simulated_key
namespace Sci {
int stop_on_event = 0;
-extern int _kdebug_cheap_event_hack;
-extern bool _kdebug_track_mouse_clicks;
+extern int debug_simulated_key;
+extern bool debug_track_mouse_clicks;
#define SCI_VARIABLE_GAME_SPEED 3
@@ -53,13 +53,13 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) {
// If there's a simkey pending, and the game wants a keyboard event, use the
// simkey instead of a normal event
- if (_kdebug_cheap_event_hack && (mask & SCI_EVT_KEYBOARD)) {
+ if (debug_simulated_key && (mask & SCI_EVT_KEYBOARD)) {
PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event
- PUT_SEL32V(obj, message, _kdebug_cheap_event_hack);
+ PUT_SEL32V(obj, message, debug_simulated_key);
PUT_SEL32V(obj, modifiers, SCI_EVM_NUMLOCK); // Numlock on
PUT_SEL32V(obj, x, s->gfx_state->pointer_pos.x);
PUT_SEL32V(obj, y, s->gfx_state->pointer_pos.y);
- _kdebug_cheap_event_hack = 0;
+ debug_simulated_key = 0;
return make_reg(0, 1);
}
@@ -110,7 +110,7 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) {
int extra_bits = 0;
// track left buttton clicks, if requested
- if (e.type == SCI_EVT_MOUSE_PRESS && e.data == 1 && _kdebug_track_mouse_clicks) {
+ if (e.type == SCI_EVT_MOUSE_PRESS && e.data == 1 && debug_track_mouse_clicks) {
((SciEngine *)g_engine)->_console->DebugPrintf("Mouse clicked at %d, %d\n",
s->gfx_state->pointer_pos.x, s->gfx_state->pointer_pos.y);
}
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 4a4ba8126a..18e1ef7866 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -27,7 +27,7 @@
#include "common/stack.h"
#include "sci/sci.h"
-#include "sci/console.h" // for _weak_validations
+#include "sci/console.h" // for debug_weak_validations
#include "sci/resource.h"
#include "sci/engine/state.h"
#include "sci/engine/intmap.h"
@@ -52,7 +52,7 @@ int script_gc_interval = GC_INTERVAL; // Number of steps in between gcs
extern int _debug_step_running;
extern int _debug_seeking;
-extern int _weak_validations;
+extern bool debug_weak_validations;
static bool breakpointFlag = false;
@@ -90,7 +90,9 @@ static StackPtr validate_stack_addr(EngineState *s, StackPtr sp) {
static int validate_arithmetic(reg_t reg) {
if (reg.segment) {
- if (!_weak_validations)
+ if (debug_weak_validations)
+ warning("[VM] Attempt to read arithmetic value from non-zero segment [%04x]\n", reg.segment);
+ else
error("[VM] Attempt to read arithmetic value from non-zero segment [%04x]\n", reg.segment);
return 0;
}
@@ -100,10 +102,10 @@ static int validate_arithmetic(reg_t reg) {
static int signed_validate_arithmetic(reg_t reg) {
if (reg.segment) {
- debugC(2, kDebugLevelVM, "[VM] Attempt to read arithmetic value from non-zero segment [%04x]\n", reg.segment);
- if (!_weak_validations) {
- error("signed_validate_arithmetic failed");
- }
+ if (debug_weak_validations)
+ warning("[VM] Attempt to read arithmetic value from non-zero segment [%04x]\n", reg.segment);
+ else
+ error("[VM] Attempt to read arithmetic value from non-zero segment [%04x]\n", reg.segment);
return 0;
}
@@ -117,15 +119,22 @@ static int validate_variable(reg_t *r, reg_t *stack_base, int type, int max, int
const char *names[4] = {"global", "local", "temp", "param"};
if (index < 0 || index >= max) {
- sciprintf("[VM] Attempt to use invalid %s variable %04x ", names[type], index);
+ char txt[200];
+ char tmp[40];
+ sprintf(txt, "[VM] Attempt to use invalid %s variable %04x ", names[type], index);
if (max == 0)
- sciprintf("(variable type invalid)");
- else
- sciprintf("(out of range [%d..%d])", 0, max - 1);
- sciprintf(" in %s, line %d\n", __FILE__, line);
- if (!_weak_validations) {
- error("validate_variable failed");
+ strcat(txt, "(variable type invalid)");
+ else {
+ sprintf(tmp, "(out of range [%d..%d])", 0, max - 1);
+ strcat(txt, tmp);
}
+ sprintf(tmp, " in %s, line %d\n", __FILE__, line);
+ strcat(txt, tmp);
+
+ if (debug_weak_validations)
+ warning(txt);
+ else
+ error(txt);
#ifdef STRICT_READ
return 1;
@@ -139,7 +148,7 @@ static int validate_variable(reg_t *r, reg_t *stack_base, int type, int max, int
sciprintf("[VM] Access within stack boundaries; access granted.\n");
return 0;
}
- };
+ }
#endif
}