From 4799cbf1c3666bffc460786db4a9067163cdff5c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 21 May 2009 17:18:46 +0000 Subject: Removed the PREG, PSTK, IS_NULL_REG and REG_EQ defines svn-id: r40767 --- engines/sci/engine/game.cpp | 4 +- engines/sci/engine/gc.cpp | 6 +-- engines/sci/engine/kernel.cpp | 10 ++-- engines/sci/engine/kgraphics.cpp | 86 +++++++++++++++---------------- engines/sci/engine/klists.cpp | 100 ++++++++++++++++++------------------- engines/sci/engine/kmisc.cpp | 14 +++--- engines/sci/engine/kmovement.cpp | 26 +++++----- engines/sci/engine/kscripts.cpp | 16 +++--- engines/sci/engine/ksound.cpp | 28 +++++------ engines/sci/engine/kstring.cpp | 14 +++--- engines/sci/engine/savegame.cpp | 2 +- engines/sci/engine/sciconsole.cpp | 4 +- engines/sci/engine/scriptdebug.cpp | 82 +++++++++++++++--------------- engines/sci/engine/seg_manager.cpp | 36 ++++++------- engines/sci/engine/vm.cpp | 38 +++++++------- engines/sci/engine/vm_types.h | 4 -- 16 files changed, 233 insertions(+), 237 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index f19185e267..a8244df0ed 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -574,13 +574,13 @@ int game_init(EngineState *s) { const char *tmp = obj_get_name(s, game_obj); if (!tmp) { - sciprintf("Error: script.000, export 0 ("PREG") does not\n" + sciprintf("Error: script.000, export 0 (%04x:%04x) does not\n" " yield an object with a name -> sanity check failed\n", PRINT_REG(game_obj)); return 1; } s->_gameName = tmp; - sciprintf(" \"%s\" at "PREG"\n", s->_gameName.c_str(), PRINT_REG(game_obj)); + sciprintf(" \"%s\" at %04x:%04x\n", s->_gameName.c_str(), PRINT_REG(game_obj)); s->game_obj = game_obj; diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index cf556869ee..5bc8fc38d7 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -40,7 +40,7 @@ struct WorklistManager { return; #ifdef DEBUG_GC_VERBOSE - sciprintf("[GC] Adding "PREG"\n", PRINT_REG(reg)); + sciprintf("[GC] Adding %04x:%04x\n", PRINT_REG(reg)); #endif if (_map.contains(reg)) @@ -137,7 +137,7 @@ reg_t_hash_map *find_all_used_references(EngineState *s) { wm._worklist.pop_back(); if (reg.segment != s->stack_segment) { // No need to repeat this one #ifdef DEBUG_GC_VERBOSE - sciprintf("[GC] Checking "PREG"\n", PRINT_REG(reg)); + sciprintf("[GC] Checking %04x:%04x\n", PRINT_REG(reg)); #endif if (reg.segment < sm->_heap.size() && sm->_heap[reg.segment]) sm->_heap[reg.segment]->listAllOutgoingReferences(s, reg, &wm, add_outgoing_refs); @@ -168,7 +168,7 @@ void free_unless_used(void *refcon, reg_t addr) { // Not found -> we can free it deallocator->mobj->freeAtAddress(deallocator->segmgr, addr); #ifdef DEBUG_GC - sciprintf("[GC] Deallocating "PREG"\n", PRINT_REG(addr)); + sciprintf("[GC] Deallocating %04x:%04x\n", PRINT_REG(addr)); deallocator->segcount[deallocator->mobj->getType()]++; #endif } diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index d419ffc089..b84466e852 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -494,7 +494,7 @@ reg_t kalloc(EngineState *s, const char *type, int space) { reg_t reg; s->seg_manager->alloc_hunk_entry(type, space, ®); - SCIkdebug(SCIkMEM, "Allocated %d at hunk "PREG" (%s)\n", space, PRINT_REG(reg), type); + SCIkdebug(SCIkMEM, "Allocated %d at hunk %04x:%04x (%s)\n", space, PRINT_REG(reg), type); return reg; } @@ -889,12 +889,12 @@ int kernel_matches_signature(EngineState *s, const char *sig, int argc, reg_t *a int type = determine_reg_type(s, *argv, *sig & KSIG_ALLOW_INV); if (!type) { - sciprintf("[KERN] Could not determine type of ref "PREG"; failing signature check\n", PRINT_REG(*argv)); + sciprintf("[KERN] Could not determine type of ref %04x:%04x; failing signature check\n", PRINT_REG(*argv)); return 0; } if (type & KSIG_INVALID) { - sciprintf("[KERN] ref "PREG" was determined to be a %s, but the reference itself is invalid\n", + sciprintf("[KERN] ref %04x:%04x was determined to be a %s, but the reference itself is invalid\n", PRINT_REG(*argv), kernel_argtype_description(type)); return 0; } @@ -920,12 +920,12 @@ static void *_kernel_dereference_pointer(EngineState *s, reg_t pointer, int entr void *retval = s->seg_manager->dereference(pointer, &maxsize); if (pointer.offset & (align - 1)) { - warning("Unaligned pointer read: "PREG" expected with %d alignment", PRINT_REG(pointer), align); + warning("Unaligned pointer read: %04x:%04x expected with %d alignment", PRINT_REG(pointer), align); return NULL; } if (entries > maxsize) { - warning("Trying to dereference pointer "PREG" beyond end of segment", PRINT_REG(pointer)); + warning("Trying to dereference pointer %04x:%04x beyond end of segment", PRINT_REG(pointer)); return NULL; } return retval; diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index dddf1a01af..9180eaa91b 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -224,7 +224,7 @@ void graph_restore_box(EngineState *s, reg_t handle) { ptr = (gfxw_snapshot_t **)kmem(s, handle); if (!ptr) { - warning("Attempt to restore invalid handle "PREG, PRINT_REG(handle)); + warning("Attempt to restore invalid handle %04x:%04x", PRINT_REG(handle)); return; } @@ -254,7 +254,7 @@ void graph_restore_box(EngineState *s, reg_t handle) { if (!ptr) { - error("Attempt to restore invalid snaphot with handle "PREG, PRINT_REG(handle)); + error("Attempt to restore invalid snaphot with handle %04x:%04x", PRINT_REG(handle)); return; } @@ -744,7 +744,7 @@ static int collides_with(EngineState *s, Common::Rect area, reg_t other_obj, int if (other_area.left >= 320 || other_area.top >= 190 || area.right >= 320 || area.bottom >= 190) return 0; // Out of scope - SCIkdebug(SCIkBRESEN, "OtherSignal=%04x, z=%04x obj="PREG"\n", other_signal, (other_signal & view_mask), PRINT_REG(other_obj)); + SCIkdebug(SCIkBRESEN, "OtherSignal=%04x, z=%04x obj=%04x:%04x\n", other_signal, (other_signal & view_mask), PRINT_REG(other_obj)); if ((other_signal & (view_mask)) == 0) { // check whether the other object ignores actors @@ -782,7 +782,7 @@ reg_t kCanBeHere(EngineState *s, int funct_nr, int argc, reg_t * argv) { zone = gfx_rect(abs_zone.left + port->zone.x, abs_zone.top + port->zone.y, abs_zone.width(), abs_zone.height()); signal = GET_SEL32V(obj, signal); - SCIkdebug(SCIkBRESEN, "Checking collision: (%d,%d) to (%d,%d) ([%d..%d]x[%d..%d]), obj="PREG", sig=%04x, cliplist="PREG"\n", + SCIkdebug(SCIkBRESEN, "Checking collision: (%d,%d) to (%d,%d) ([%d..%d]x[%d..%d]), obj=%04x:%04x, sig=%04x, cliplist=%04x:%04x\n", GFX_PRINT_RECT(zone), abs_zone.left, abs_zone.right, abs_zone.top, abs_zone.bottom, PRINT_REG(obj), signal, PRINT_REG(cliplist_ref)); @@ -831,11 +831,11 @@ reg_t kCanBeHere(EngineState *s, int funct_nr, int argc, reg_t * argv) { while (node) { // Check each object in the list against our bounding rectangle reg_t other_obj = node->value; - SCIkdebug(SCIkBRESEN, " comparing against "PREG"\n", PRINT_REG(other_obj)); + SCIkdebug(SCIkBRESEN, " comparing against %04x:%04x\n", PRINT_REG(other_obj)); if (!is_object(s, other_obj)) { - warning("CanBeHere() cliplist contains non-object "PREG, PRINT_REG(other_obj)); - } else if (!REG_EQ(other_obj, obj)) { // Clipping against yourself is not recommended + warning("CanBeHere() cliplist contains non-object %04x:%04x", PRINT_REG(other_obj)); + } else if (other_obj != obj) { // Clipping against yourself is not recommended if (collides_with(s, abs_zone, other_obj, 0, GASEOUS_VIEW_MASK_PASSIVE, funct_nr, argc, argv)) { SCIkdebug(SCIkBRESEN, " -> %04x\n", retval); @@ -1102,7 +1102,7 @@ Common::Rect set_base(EngineState *s, reg_t object) { if (loop != oldloop) { loop = 0; PUT_SEL32V(object, loop, 0); - SCIkdebug(SCIkGRAPHICS, "Resetting loop for "PREG"!\n", PRINT_REG(object)); + SCIkdebug(SCIkGRAPHICS, "Resetting loop for %04x:%04x!\n", PRINT_REG(object)); } if (cel != oldcel) { @@ -1330,7 +1330,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse); static void _k_disable_delete_for_now(EngineState *s, reg_t obj) { reg_t text_pos = GET_SEL32(obj, text); - char *text = IS_NULL_REG(text_pos) ? NULL : (char *)s->seg_manager->dereference(text_pos, NULL); + char *text = text_pos.isNull() ? NULL : (char *)s->seg_manager->dereference(text_pos, NULL); int type = GET_SEL32V(obj, type); int state = GET_SEL32V(obj, state); @@ -1423,11 +1423,11 @@ reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv) { int textlen; if (!text) { - warning("Could not draw control: "PREG" does not reference text", PRINT_REG(text_pos)); + warning("Could not draw control: %04x:%04x does not reference text", PRINT_REG(text_pos)); return s->r_acc; } - if (REG_EQ(text_pos, s->save_dir_copy)) { + if (text_pos == s->save_dir_copy) { max = MAX_SAVE_DIR_SIZE - 1; display_offset = s->save_dir_edit_offset; } @@ -1544,7 +1544,7 @@ reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (max_displayed < max) update_cursor_limits(&display_offset, &cursor, max_displayed); - if (REG_EQ(text_pos, s->save_dir_copy)) + if (text_pos == s->save_dir_copy) s->save_dir_edit_offset = display_offset; cursor -= display_offset; @@ -1588,7 +1588,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { int font_nr = GET_SEL32V(obj, font); reg_t text_pos = GET_SEL32(obj, text); - char *text = IS_NULL_REG(text_pos) ? NULL : (char *)s->seg_manager->dereference(text_pos, NULL); + char *text = text_pos.isNull() ? NULL : (char *)s->seg_manager->dereference(text_pos, NULL); int view = GET_SEL32V(obj, view); int cel = sign_extend_byte(GET_SEL32V(obj, cel)); int loop = sign_extend_byte(GET_SEL32V(obj, loop)); @@ -1599,13 +1599,13 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { int cursor; int max; - if (REG_EQ(text_pos, s->save_dir_copy)) { + if (text_pos == s->save_dir_copy) { SCIkdebug(SCIkGRAPHICS, "Displaying the save_dir copy\n"); } switch (type) { case K_CONTROL_BUTTON: - SCIkdebug(SCIkGRAPHICS, "drawing button "PREG" to %d,%d\n", PRINT_REG(obj), x, y); + SCIkdebug(SCIkGRAPHICS, "drawing button %04x:%04x to %d,%d\n", PRINT_REG(obj), x, y); ADD_TO_CURRENT_PICTURE_PORT(sciw_new_button_control(s->port, obj, area, text, font_nr, (int8)(state & kControlStateFramed), (int8)inverse, (int8)(state & kControlStateDisabled))); break; @@ -1613,14 +1613,14 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { case K_CONTROL_TEXT: mode = (gfx_alignment_t) GET_SEL32V(obj, mode); - SCIkdebug(SCIkGRAPHICS, "drawing text "PREG" to %d,%d, mode=%d\n", PRINT_REG(obj), x, y, mode); + SCIkdebug(SCIkGRAPHICS, "drawing text %04x:%04x to %d,%d, mode=%d\n", PRINT_REG(obj), x, y, mode); ADD_TO_CURRENT_PICTURE_PORT(sciw_new_text_control(s->port, obj, area, text, font_nr, mode, (int8)(!!(state & kControlStateDitherFramed)), (int8)inverse)); break; case K_CONTROL_EDIT: - SCIkdebug(SCIkGRAPHICS, "drawing edit control "PREG" to %d,%d\n", PRINT_REG(obj), x, y); + SCIkdebug(SCIkGRAPHICS, "drawing edit control %04x:%04x to %d,%d\n", PRINT_REG(obj), x, y); max = GET_SEL32V(obj, max); cursor = GET_SEL32V(obj, cursor); @@ -1628,7 +1628,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { if (cursor > (signed)strlen(text)) cursor = strlen(text); - if (REG_EQ(text_pos, s->save_dir_copy)) + if (text_pos == s->save_dir_copy) update_cursor_limits(&s->save_dir_edit_offset, &cursor, max); update_cursor_limits(&s->save_dir_edit_offset, &cursor, max); @@ -1637,7 +1637,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { case K_CONTROL_ICON: - SCIkdebug(SCIkGRAPHICS, "drawing icon control "PREG" to %d,%d\n", PRINT_REG(obj), x, y - 1); + SCIkdebug(SCIkGRAPHICS, "drawing icon control %04x:%04x to %d,%d\n", PRINT_REG(obj), x, y - 1); ADD_TO_CURRENT_PICTURE_PORT(sciw_new_icon_control(s->port, obj, area, view, loop, cel, (int8)(state & kControlStateFramed), (int8)inverse)); @@ -1688,7 +1688,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { break; default: - warning("Unknown control type: %d at "PREG", at (%d, %d) size %d x %d", + warning("Unknown control type: %d at %04x:%04x, at (%d, %d) size %d x %d", type, PRINT_REG(obj), x, y, xl, yl); } @@ -1718,7 +1718,7 @@ static void draw_obj_to_control_map(EngineState *s, GfxDynView *view) { reg_t obj = make_reg(view->_ID, view->_subID); if (!is_object(s, obj)) - warning("View %d does not contain valid object reference "PREG"", view->_ID, PRINT_REG(obj)); + warning("View %d does not contain valid object reference %04x:%04x", view->_ID, PRINT_REG(obj)); if (!(view->signalp && (((reg_t *)view->signalp)->offset & _K_VIEW_SIG_FLAG_IGNORE_ACTOR))) { Common::Rect abs_zone = get_nsrect(s, make_reg(view->_ID, view->_subID), 1); @@ -1756,19 +1756,19 @@ static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) { temp = GET_SEL32V(obj, nsBottom); PUT_SEL32V(obj, lsBottom, temp); #ifdef DEBUG_LSRECT - fprintf(stderr, "lsRected "PREG"\n", PRINT_REG(obj)); + fprintf(stderr, "lsRected %04x:%04x\n", PRINT_REG(obj)); #endif } #ifdef DEBUG_LSRECT else - fprintf(stderr, "Not lsRecting "PREG" because %d\n", PRINT_REG(obj), lookup_selector(s, obj, s->selector_map.nsBottom, NULL, NULL)); + fprintf(stderr, "Not lsRecting %04x:%04x because %d\n", PRINT_REG(obj), lookup_selector(s, obj, s->selector_map.nsBottom, NULL, NULL)); #endif if (widget->signal & _K_VIEW_SIG_FLAG_HIDDEN) widget->signal |= _K_VIEW_SIG_FLAG_REMOVE; } #ifdef DEBUG_LSRECT - fprintf(stderr, "obj "PREG" has pflags %x\n", PRINT_REG(obj), (widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE))); + fprintf(stderr, "obj %04x:%04x has pflags %x\n", PRINT_REG(obj), (widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE))); #endif if (widget->signalp) { @@ -1820,7 +1820,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in reg_t under_bits = NULL_REG; if (!is_object(s, obj)) { - error("Non-object "PREG" present in view list during delete time\n", PRINT_REG(obj)); + error("Non-object %04x:%04x present in view list during delete time\n", PRINT_REG(obj)); obj = NULL_REG; } else if (widget->under_bitsp) { // Is there a bg picture left to clean? @@ -1830,7 +1830,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in if (!kfree(s, mem_handle)) { *((reg_t*)(widget->under_bitsp)) = make_reg(0, widget->under_bits = 0); } else { - warning("Treating viewobj "PREG" as no longer present", PRINT_REG(obj)); + warning("Treating viewobj %04x:%04x as no longer present", PRINT_REG(obj)); obj = NULL_REG; } } @@ -1838,9 +1838,9 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in if (is_object(s, obj)) { if (invoke_selector(INV_SEL(obj, delete_, 1), 0)) - warning("Object at "PREG" requested deletion, but does not have a delete funcselector", PRINT_REG(obj)); + warning("Object at %04x:%04x requested deletion, but does not have a delete funcselector", PRINT_REG(obj)); if (_k_animate_ran) { - warning("Object at "PREG" invoked kAnimate() during deletion", PRINT_REG(obj)); + warning("Object at %04x:%04x invoked kAnimate() during deletion", PRINT_REG(obj)); return dropped; } @@ -1852,10 +1852,10 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in graph_restore_box(s, under_bits); } - SCIkdebug(SCIkGRAPHICS, "Freeing "PREG" with signal=%04x\n", PRINT_REG(obj), signal); + SCIkdebug(SCIkGRAPHICS, "Freeing %04x:%04x with signal=%04x\n", PRINT_REG(obj), signal); if (!(signal & _K_VIEW_SIG_FLAG_HIDDEN)) { - SCIkdebug(SCIkGRAPHICS, "Adding view at "PREG" to background\n", PRINT_REG(obj)); + SCIkdebug(SCIkGRAPHICS, "Adding view at %04x:%04x to background\n", PRINT_REG(obj)); if (!(gfxw_remove_id(widget->_parent, widget->_ID, widget->_subID) == widget)) { error("Attempt to remove view with ID %x:%x from list failed!\n", widget->_ID, widget->_subID); BREAKPOINT(); @@ -1868,7 +1868,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in widget->draw_bounds.x += s->dyn_views->_bounds.x - widget->_parent->_bounds.x; dropped = 1; } else { - SCIkdebug(SCIkGRAPHICS, "Deleting view at "PREG"\n", PRINT_REG(obj)); + SCIkdebug(SCIkGRAPHICS, "Deleting view at %04x:%04x\n", PRINT_REG(obj)); widget->_flags |= GFXW_FLAG_VISIBLE; gfxw_annihilate(widget); return -1; // restart: Done in Animate() @@ -1898,7 +1898,7 @@ static GfxDynView *_k_make_dynview_obj(EngineState *s, reg_t obj, int options, i int z; GfxDynView *widget; - SCIkdebug(SCIkGRAPHICS, " - Adding "PREG"\n", PRINT_REG(obj)); + SCIkdebug(SCIkGRAPHICS, " - Adding %04x:%04x\n", PRINT_REG(obj)); obj = obj; @@ -1938,14 +1938,14 @@ static GfxDynView *_k_make_dynview_obj(EngineState *s, reg_t obj, int options, i if (lookup_selector(s, obj, s->selector_map.underBits, &(under_bitsp), NULL) != kSelectorVariable) { under_bitsp = NULL; under_bits = NULL_REG; - SCIkdebug(SCIkGRAPHICS, "Object at "PREG" has no underBits\n", PRINT_REG(obj)); + SCIkdebug(SCIkGRAPHICS, "Object at %04x:%04x has no underBits\n", PRINT_REG(obj)); } else under_bits = *((reg_t *)under_bitsp); if (lookup_selector(s, obj, s->selector_map.signal, &(signalp), NULL) != kSelectorVariable) { signalp = NULL; signal = 0; - SCIkdebug(SCIkGRAPHICS, "Object at "PREG" has no signal selector\n", PRINT_REG(obj)); + SCIkdebug(SCIkGRAPHICS, "Object at %04x:%04x has no signal selector\n", PRINT_REG(obj)); } else { signal = signalp->offset; SCIkdebug(SCIkGRAPHICS, " with signal = %04x\n", signal); @@ -1999,7 +1999,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list, if (!(signal & _K_VIEW_SIG_FLAG_FROZEN)) { - SCIkdebug(SCIkGRAPHICS, " invoking "PREG"::doit()\n", PRINT_REG(obj)); + SCIkdebug(SCIkGRAPHICS, " invoking %04x:%04x::doit()\n", PRINT_REG(obj)); invoke_selector(INV_SEL(obj, doit, 1), 0); // Call obj::doit() if neccessary } } @@ -2064,7 +2064,7 @@ static void _k_prepare_view_list(EngineState *s, GfxList *list, int options) { // their clipped nsRect drawn to the control map if (view->signal & _K_VIEW_SIG_FLAG_STOP_UPDATE) { view->signal |= _K_VIEW_SIG_FLAG_STOPUPD; - SCIkdebug(SCIkGRAPHICS, "Setting magic STOP_UPD for "PREG"\n", PRINT_REG(obj)); + SCIkdebug(SCIkGRAPHICS, "Setting magic STOP_UPD for %04x:%04x\n", PRINT_REG(obj)); } if ((options & _K_MAKE_VIEW_LIST_DRAW_TO_CONTROL_MAP)) @@ -2098,12 +2098,12 @@ static void _k_prepare_view_list(EngineState *s, GfxList *list, int options) { } } - SCIkdebug(SCIkGRAPHICS, " dv["PREG"]: signal %04x -> %04x\n", PRINT_REG(obj), oldsignal, view->signal); + SCIkdebug(SCIkGRAPHICS, " dv[%04x:%04x]: signal %04x -> %04x\n", PRINT_REG(obj), oldsignal, view->signal); // Never happens /* if (view->signal & 0) { view->signal &= ~_K_VIEW_SIG_FLAG_STOPUPD; - fprintf(stderr, "Unsetting magic StopUpd for view "PREG"\n", PRINT_REG(obj)); + fprintf(stderr, "Unsetting magic StopUpd for view %04x:%04x\n", PRINT_REG(obj)); } */ view = (GfxDynView *)view->_next; @@ -2162,7 +2162,7 @@ static void _k_raise_topmost_in_view_list(EngineState *s, GfxList *list, GfxDynV // step 11 if ((view->signal & (_K_VIEW_SIG_FLAG_NO_UPDATE | _K_VIEW_SIG_FLAG_HIDDEN | _K_VIEW_SIG_FLAG_ALWAYS_UPDATE)) == 0) { - SCIkdebug(SCIkGRAPHICS, "Forcing precedence 2 at ["PREG"] with %04x\n", PRINT_REG(make_reg(view->_ID, view->_subID)), view->signal); + SCIkdebug(SCIkGRAPHICS, "Forcing precedence 2 at [%04x:%04x] with %04x\n", PRINT_REG(make_reg(view->_ID, view->_subID)), view->signal); view->force_precedence = 2; if ((view->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_HIDDEN)) == _K_VIEW_SIG_FLAG_REMOVE) { @@ -2187,7 +2187,7 @@ static void _k_redraw_view_list(EngineState *s, GfxList *list) { GfxDynView *view = (GfxDynView *) list->_contents; while (view) { - SCIkdebug(SCIkGRAPHICS, " dv["PREG"]: signal %04x\n", make_reg(view->_ID, view->_subID), view->signal); + SCIkdebug(SCIkGRAPHICS, " dv[%04x:%04x]: signal %04x\n", make_reg(view->_ID, view->_subID), view->signal); // step 1 of subalgorithm if (view->signal & _K_VIEW_SIG_FLAG_NO_UPDATE) { @@ -2313,7 +2313,7 @@ reg_t kAddToPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { List *list; if (!list_ref.segment) { - warning("Attempt to AddToPic single non-list: "PREG"", PRINT_REG(list_ref)); + warning("Attempt to AddToPic single non-list: %04x:%04x", PRINT_REG(list_ref)); return s->r_acc; } @@ -3174,7 +3174,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { } if (!text) { - error("Display with invalid reference "PREG"!\n", PRINT_REG(textp)); + error("Display with invalid reference %04x:%04x!\n", PRINT_REG(textp)); return NULL_REG; } @@ -3310,7 +3310,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->r_acc = graph_save_box(s, save_area); text_handle->_serial++; // This is evil! - SCIkdebug(SCIkGRAPHICS, "Saving (%d, %d) size (%d, %d) as "PREG"\n", save_area.x, save_area.y, save_area.width, save_area.height, s->r_acc); + SCIkdebug(SCIkGRAPHICS, "Saving (%d, %d) size (%d, %d) as %04x:%04x\n", save_area.x, save_area.y, save_area.width, save_area.height, s->r_acc); } SCIkdebug(SCIkGRAPHICS, "Display: Commiting text '%s'\n", text); diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index af5bfb0d8a..0494e459a4 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -36,16 +36,16 @@ Node *lookup_node(EngineState *s, reg_t addr) { if (!mobj) { // FIXME: This occurs right at the beginning of SQ4, when walking north from the first screen. It doesn't // seem to have any apparent ill-effects, though, so it's been changed to non-fatal, for now - //sciprintf("%s, L%d: Attempt to use non-node "PREG" as list node\n", __FILE__, __LINE__, PRINT_REG(addr)); + //sciprintf("%s, L%d: Attempt to use non-node %04x:%04x as list node\n", __FILE__, __LINE__, PRINT_REG(addr)); //script_debug_flag = script_error_flag = 1; - warning("Attempt to use non-node "PREG" as list node", PRINT_REG(addr)); + warning("Attempt to use non-node %04x:%04x as list node", PRINT_REG(addr)); return NULL; } NodeTable *nt = (NodeTable *)mobj; if (!nt->isValidEntry(addr.offset)) { - sciprintf("Attempt to use non-node "PREG" as list node\n", PRINT_REG(addr)); + sciprintf("Attempt to use non-node %04x:%04x as list node\n", PRINT_REG(addr)); script_debug_flag = script_error_flag = 1; return NULL; } @@ -57,7 +57,7 @@ List *lookup_list(EngineState *s, reg_t addr) { MemObject *mobj = GET_SEGMENT(*s->seg_manager, addr.segment, MEM_OBJ_LISTS); if (!mobj) { - sciprintf("Attempt to use non-list "PREG" as list\n", PRINT_REG(addr)); + sciprintf("Attempt to use non-list %04x:%04x as list\n", PRINT_REG(addr)); script_debug_flag = script_error_flag = 1; return NULL; } @@ -65,7 +65,7 @@ List *lookup_list(EngineState *s, reg_t addr) { ListTable *lt = (ListTable *)mobj; if (!lt->isValidEntry(addr.offset)) { - sciprintf("Attempt to use non-list "PREG" as list\n", PRINT_REG(addr)); + sciprintf("Attempt to use non-list %04x:%04x as list\n", PRINT_REG(addr)); script_debug_flag = script_error_flag = 1; return NULL; } @@ -90,13 +90,13 @@ static int sane_nodep(EngineState *s, reg_t addr) { if (!node) return 0; - if ((have_prev) && !REG_EQ(node->pred, prev)) + if ((have_prev) && node->pred != prev) return 0; prev = addr; addr = node->succ; have_prev = 1; - } while (!IS_NULL_REG(addr)); + } while (!addr.isNull()); return 1; } @@ -105,9 +105,9 @@ int sane_listp(EngineState *s, reg_t addr) { List *l = lookup_list(s, addr); int empties = 0; - if (IS_NULL_REG(l->first)) + if (l->first.isNull()) ++empties; - if (IS_NULL_REG(l->last)) + if (l->last.isNull()) ++empties; // Either none or both must be set @@ -123,10 +123,10 @@ int sane_listp(EngineState *s, reg_t addr) { if (!node_a || !node_z) return 0; - if (!IS_NULL_REG(node_a->pred)) + if (!node_a->pred.isNull()) return 0; - if (!IS_NULL_REG(node_z->succ)) + if (!node_z->succ.isNull()) return 0; return sane_nodep(s, l->first); @@ -141,7 +141,7 @@ reg_t kNewList(EngineState *s, int funct_nr, int argc, reg_t *argv) { List *l; l = s->seg_manager->alloc_List(&listbase); l->first = l->last = NULL_REG; - SCIkdebug(SCIkNODES, "New listbase at "PREG"\n", PRINT_REG(listbase)); + SCIkdebug(SCIkNODES, "New listbase at %04x:%04x\n", PRINT_REG(listbase)); return listbase; // Return list base address } @@ -151,17 +151,17 @@ reg_t kDisposeList(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (!l) { // FIXME: This should be an error, but it's turned to a warning for now - warning("Attempt to dispose non-list at "PREG"!\n", PRINT_REG(argv[0])); + warning("Attempt to dispose non-list at %04x:%04x!\n", PRINT_REG(argv[0])); return NULL_REG; } if (!sane_listp(s, argv[0])) - error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List at %04x:%04x is not sane anymore!\n", PRINT_REG(argv[0])); -/* if (!IS_NULL_REG(l->first)) { +/* if (!l->first.isNull()) { reg_t n_addr = l->first; - while (!IS_NULL_REG(n_addr)) { // Free all nodes + while (!n_addr.isNull()) { // Free all nodes Node *n = lookup_node(s, n_addr); s->seg_manager->free_Node(n_addr); n_addr = n->succ; @@ -192,18 +192,18 @@ reg_t _k_new_node(EngineState *s, reg_t value, reg_t key) { reg_t kNewNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->r_acc = _k_new_node(s, argv[0], argv[1]); - SCIkdebug(SCIkNODES, "New nodebase at "PREG"\n", PRINT_REG(s->r_acc)); + SCIkdebug(SCIkNODES, "New nodebase at %04x:%04x\n", PRINT_REG(s->r_acc)); return s->r_acc; } reg_t kFirstNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { - if (IS_NULL_REG(argv[0])) + if (argv[0].isNull()) return NULL_REG; List *l = lookup_list(s, argv[0]); if (l && !sane_listp(s, argv[0])) - error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List at %04x:%04x is not sane anymore!\n", PRINT_REG(argv[0])); if (l) return l->first; @@ -215,7 +215,7 @@ reg_t kLastNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { List *l = lookup_list(s, argv[0]); if (l && !sane_listp(s, argv[0])) - error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List at %04x:%04x is not sane anymore!\n", PRINT_REG(argv[0])); if (l) return l->last; @@ -227,27 +227,27 @@ reg_t kEmptyList(EngineState *s, int funct_nr, int argc, reg_t *argv) { List *l = lookup_list(s, argv[0]); if (!l || !sane_listp(s, argv[0])) - error("List at "PREG" is invalid or not sane anymore!\n", PRINT_REG(argv[0])); + error("List at %04x:%04x is invalid or not sane anymore!\n", PRINT_REG(argv[0])); - return make_reg(0, ((l) ? IS_NULL_REG(l->first) : 0)); + return make_reg(0, ((l) ? l->first.isNull() : 0)); } void _k_add_to_front(EngineState *s, reg_t listbase, reg_t nodebase) { List *l = lookup_list(s, listbase); Node *new_n = lookup_node(s, nodebase); - SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); + SCIkdebug(SCIkNODES, "Adding node %04x:%04x to end of list %04x:%04x\n", PRINT_REG(nodebase), PRINT_REG(listbase)); // FIXME: This should be an error, but it's turned to a warning for now if (!new_n) - warning("Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); + warning("Attempt to add non-node (%04x:%04x) to list at %04x:%04x\n", PRINT_REG(nodebase), PRINT_REG(listbase)); if (!l || !sane_listp(s, listbase)) - error("List at "PREG" is not sane anymore!\n", PRINT_REG(listbase)); + error("List at %04x:%04x is not sane anymore!\n", PRINT_REG(listbase)); new_n->succ = l->first; new_n->pred = NULL_REG; // Set node to be the first and last node if it's the only node of the list - if (IS_NULL_REG(l->first)) + if (l->first.isNull()) l->last = nodebase; else { Node *old_n = lookup_node(s, l->first); @@ -260,18 +260,18 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) { List *l = lookup_list(s, listbase); Node *new_n = lookup_node(s, nodebase); - SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); + SCIkdebug(SCIkNODES, "Adding node %04x:%04x to end of list %04x:%04x\n", PRINT_REG(nodebase), PRINT_REG(listbase)); // FIXME: This should be an error, but it's turned to a warning for now if (!new_n) - warning("Attempt to add non-node ("PREG") to list at "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase)); + warning("Attempt to add non-node (%04x:%04x) to list at %04x:%04x\n", PRINT_REG(nodebase), PRINT_REG(listbase)); if (!l || !sane_listp(s, listbase)) - error("List at "PREG" is not sane anymore!\n", PRINT_REG(listbase)); + error("List at %04x:%04x is not sane anymore!\n", PRINT_REG(listbase)); new_n->succ = NULL_REG; new_n->pred = l->last; // Set node to be the first and last node if it's the only node of the list - if (IS_NULL_REG(l->last)) + if (l->last.isNull()) l->first = nodebase; else { Node *old_n = lookup_node(s, l->last); @@ -283,7 +283,7 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) { reg_t kNextNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { Node *n = lookup_node(s, argv[0]); if (!sane_nodep(s, argv[0])) { - error("List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List node at %04x:%04x is not sane anymore!\n", PRINT_REG(argv[0])); script_error_flag = script_debug_flag = 0; return NULL_REG; } @@ -294,7 +294,7 @@ reg_t kNextNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t kPrevNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { Node *n = lookup_node(s, argv[0]); if (!sane_nodep(s, argv[0])) - error("List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0])); + error("List node at %04x:%04x is not sane anymore!\n", PRINT_REG(argv[0])); return n->pred; } @@ -302,7 +302,7 @@ reg_t kPrevNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t kNodeValue(EngineState *s, int funct_nr, int argc, reg_t *argv) { Node *n = lookup_node(s, argv[0]); if (!sane_nodep(s, argv[0])) { - error("List node at "PREG" is not sane", PRINT_REG(argv[0])); + error("List node at %04x:%04x is not sane", PRINT_REG(argv[0])); script_debug_flag = script_error_flag = 0; return NULL_REG; } @@ -317,15 +317,15 @@ reg_t kAddToFront(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t kAddAfter(EngineState *s, int funct_nr, int argc, reg_t *argv) { List *l =lookup_list(s, argv[0]); - Node *firstnode = IS_NULL_REG(argv[1]) ? NULL : lookup_node(s, argv[1]); + Node *firstnode = argv[1].isNull() ? NULL : lookup_node(s, argv[1]); Node *newnode = lookup_node(s, argv[2]); if (!l || !sane_listp(s, argv[0])) - error("List at "PREG" is not sane anymore", PRINT_REG(argv[0])); + error("List at %04x:%04x is not sane anymore", PRINT_REG(argv[0])); // FIXME: This should be an error, but it's turned to a warning for now if (!newnode) { - warning("New 'node' "PREG" is not a node", PRINT_REG(argv[2])); + warning("New 'node' %04x:%04x is not a node", PRINT_REG(argv[2])); return NULL_REG; } @@ -341,7 +341,7 @@ reg_t kAddAfter(EngineState *s, int funct_nr, int argc, reg_t *argv) { firstnode->succ = argv[2]; newnode->succ = oldnext; - if (IS_NULL_REG(oldnext)) // Appended after last node? + if (oldnext.isNull()) // Appended after last node? // Set new node as last list node l->last = argv[2]; else @@ -365,24 +365,24 @@ reg_t kFindKey(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t key = argv[1]; reg_t list_pos = argv[0]; - SCIkdebug(SCIkNODES, "Looking for key "PREG" in list "PREG"\n", PRINT_REG(key), PRINT_REG(list_pos)); + SCIkdebug(SCIkNODES, "Looking for key %04x:%04x in list %04x:%04x\n", PRINT_REG(key), PRINT_REG(list_pos)); if (!sane_listp(s, list_pos)) - error("List at "PREG" is not sane anymore", PRINT_REG(list_pos)); + error("List at %04x:%04x is not sane anymore", PRINT_REG(list_pos)); node_pos = lookup_list(s, list_pos)->first; - SCIkdebug(SCIkNODES, "First node at "PREG"\n", PRINT_REG(node_pos)); + SCIkdebug(SCIkNODES, "First node at %04x:%04x\n", PRINT_REG(node_pos)); - while (!IS_NULL_REG(node_pos)) { + while (!node_pos.isNull()) { Node *n = lookup_node(s, node_pos); - if (REG_EQ(n->key, key)) { - SCIkdebug(SCIkNODES, " Found key at "PREG"\n", PRINT_REG(node_pos)); + if (n->key == key) { + SCIkdebug(SCIkNODES, " Found key at %04x:%04x\n", PRINT_REG(node_pos)); return node_pos; } node_pos = n->succ; - SCIkdebug(SCIkNODES, "NextNode at "PREG"\n", PRINT_REG(node_pos)); + SCIkdebug(SCIkNODES, "NextNode at %04x:%04x\n", PRINT_REG(node_pos)); } SCIkdebug(SCIkNODES, "Looking for key without success\n"); @@ -394,18 +394,18 @@ reg_t kDeleteKey(EngineState *s, int funct_nr, int argc, reg_t *argv) { Node *n; List *l = lookup_list(s, argv[0]); - if (IS_NULL_REG(node_pos)) + if (node_pos.isNull()) return NULL_REG; // Signal falure n = lookup_node(s, node_pos); - if (REG_EQ(l->first, node_pos)) + if (l->first == node_pos) l->first = n->succ; - if (REG_EQ(l->last, node_pos)) + if (l->last == node_pos) l->last = n->pred; - if (!IS_NULL_REG(n->pred)) + if (!n->pred.isNull()) lookup_node(s, n->pred)->succ = n->succ; - if (!IS_NULL_REG(n->succ)) + if (!n->succ.isNull()) lookup_node(s, n->succ)->pred = n->pred; //s->seg_manager->free_Node(node_pos); @@ -450,7 +450,7 @@ reg_t kSort(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (!input_size) return s->r_acc; - if (IS_NULL_REG(output_data)) { + if (output_data.isNull()) { list = s->seg_manager->alloc_List(&output_data); list->first = list->last = NULL_REG; PUT_SEL32(dest, elements, output_data); diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index 2d1180b827..864bb516dd 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -188,7 +188,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { break; case K_MEMORY_FREE : if (s->seg_manager->freeDynmem(argv[1])) { - error("Attempt to kMemory::free() non-dynmem pointer "PREG"!\n", PRINT_REG(argv[1])); + error("Attempt to kMemory::free() non-dynmem pointer %04x:%04x!\n", PRINT_REG(argv[1])); } break; case K_MEMORY_MEMCPY : { @@ -201,10 +201,10 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { else { warning("Could not execute kMemory:memcpy of %d bytes:", size); if (!dest) { - warning(" dest ptr ("PREG") invalid/memory region too small", PRINT_REG(argv[1])); + warning(" dest ptr (%04x:%04x) invalid/memory region too small", PRINT_REG(argv[1])); } if (!src) { - warning(" src ptr ("PREG") invalid/memory region too small", PRINT_REG(argv[2])); + warning(" src ptr (%04x:%04x) invalid/memory region too small", PRINT_REG(argv[2])); } } break; @@ -213,7 +213,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { byte *ref = kernel_dereference_bulk_pointer(s, argv[1], 2); if (!ref) { - error("Attempt to poke invalid memory at "PREG"!\n", PRINT_REG(argv[1])); + error("Attempt to poke invalid memory at %04x:%04x!\n", PRINT_REG(argv[1])); return s->r_acc; } if (s->seg_manager->_heap[argv[1].segment]->getType() == MEM_OBJ_LOCALS) @@ -226,7 +226,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { byte *ref = kernel_dereference_bulk_pointer(s, argv[1], 2); if (!ref) { - error("Attempt to poke invalid memory at "PREG"!\n", PRINT_REG(argv[1])); + error("Attempt to poke invalid memory at %04x:%04x!\n", PRINT_REG(argv[1])); return s->r_acc; } @@ -234,7 +234,7 @@ reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { *((reg_t *) ref) = argv[2]; else { if (argv[2].segment) { - error("Attempt to poke memory reference "PREG" to "PREG"!\n", PRINT_REG(argv[2]), PRINT_REG(argv[1])); + error("Attempt to poke memory reference %04x:%04x to %04x:%04x!\n", PRINT_REG(argv[2]), PRINT_REG(argv[1])); return s->r_acc; WRITE_LE_UINT16(ref, argv[2].offset); // ? } @@ -251,7 +251,7 @@ reg_t kstub(EngineState *s, int funct_nr, int argc, reg_t *argv) { sciprintf("Unimplemented syscall: %s[%x](", s->_kernelNames[funct_nr].c_str(), funct_nr); for (int i = 0; i < argc; i++) { - sciprintf(PREG, PRINT_REG(argv[i])); + sciprintf("%04x:%04x", PRINT_REG(argv[i])); if (i + 1 < argc) sciprintf(", "); } sciprintf(")\n"); diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 33e1faceec..32007e93b4 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -151,7 +151,7 @@ reg_t kSetJump(EngineState *s, int funct_nr, int argc, reg_t *argv) { // Always force vy to be upwards vy = -abs(vy); - SCIkdebug(SCIkBRESEN, "SetJump for object at "PREG"\n", PRINT_REG(object)); + SCIkdebug(SCIkBRESEN, "SetJump for object at %04x:%04x\n", PRINT_REG(object)); SCIkdebug(SCIkBRESEN, "xStep: %d, yStep: %d\n", vx, vy); PUT_SEL32V(object, xStep, vx); @@ -206,7 +206,7 @@ static void initialize_bresen(EngineState *s, int argc, reg_t *argv, reg_t mover PUT_SEL32V(mover, dx, deltax_step); PUT_SEL32V(mover, dy, deltay_step); - SCIkdebug(SCIkBRESEN, "Init bresen for mover "PREG": d=(%d,%d)\n", PRINT_REG(mover), deltax, deltay); + SCIkdebug(SCIkBRESEN, "Init bresen for mover %04x:%04x: d=(%d,%d)\n", PRINT_REG(mover), deltax, deltay); SCIkdebug(SCIkBRESEN, " steps=%d, mv=(%d, %d), i1= %d, i2=%d\n", numsteps, deltax_step, deltay_step, i1, bdi*2); @@ -352,7 +352,7 @@ reg_t kDoBresen(EngineState *s, int funct_nr, int argc, reg_t *argv) { y = desty; completed = 1; - SCIkdebug(SCIkBRESEN, "Finished mover "PREG"\n", PRINT_REG(mover)); + SCIkdebug(SCIkBRESEN, "Finished mover %04x:%04x\n", PRINT_REG(mover)); } PUT_SEL32V(client, x, x); @@ -374,7 +374,7 @@ reg_t kDoBresen(EngineState *s, int funct_nr, int argc, reg_t *argv) { PUT_SEL32V(client, y, oldy); PUT_SEL32V(client, signal, (signal | _K_VIEW_SIG_FLAG_HIT_OBSTACLE)); - SCIkdebug(SCIkBRESEN, "Finished mover "PREG" by collision\n", PRINT_REG(mover)); + SCIkdebug(SCIkBRESEN, "Finished mover %04x:%04x by collision\n", PRINT_REG(mover)); completed = 1; } @@ -399,14 +399,14 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->r_acc = make_reg(0, -1); if (!is_heap_object(s, avoider)) { - warning("DoAvoider() where avoider "PREG" is not an object", PRINT_REG(avoider)); + warning("DoAvoider() where avoider %04x:%04x is not an object", PRINT_REG(avoider)); return NULL_REG; } client = GET_SEL32(avoider, client); if (!is_heap_object(s, client)) { - warning("DoAvoider() where client "PREG" is not an object", PRINT_REG(client)); + warning("DoAvoider() where client %04x:%04x is not an object", PRINT_REG(client)); return NULL_REG; } @@ -415,7 +415,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (!is_heap_object(s, mover)) { if (mover.segment) { - warning("DoAvoider() where mover "PREG" is not an object", PRINT_REG(mover)); + warning("DoAvoider() where mover %04x:%04x is not an object", PRINT_REG(mover)); } return s->r_acc; } @@ -426,7 +426,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { SCIkdebug(SCIkBRESEN, "Doing avoider %04x (dest=%d,%d)\n", avoider, destx, desty); if (invoke_selector(INV_SEL(mover, doit, 1) , 0)) { - error("Mover "PREG" of avoider "PREG" doesn't have a doit() funcselector\n", PRINT_REG(mover), PRINT_REG(avoider)); + error("Mover %04x:%04x of avoider %04x:%04x doesn't have a doit() funcselector\n", PRINT_REG(mover), PRINT_REG(avoider)); return NULL_REG; } @@ -435,7 +435,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; // Return gracefully. if (invoke_selector(INV_SEL(client, isBlocked, 1) , 0)) { - error("Client "PREG" of avoider "PREG" doesn't" + error("Client %04x:%04x of avoider %04x:%04x doesn't" " have an isBlocked() funcselector", PRINT_REG(client), PRINT_REG(avoider)); return NULL_REG; } @@ -454,7 +454,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { int ystep = GET_SEL32V(client, yStep); int moves; - SCIkdebug(SCIkBRESEN, " avoider "PREG"\n", PRINT_REG(avoider)); + SCIkdebug(SCIkBRESEN, " avoider %04x:%04x\n", PRINT_REG(avoider)); for (moves = 0; moves < 8; moves++) { int move_x = (int)(sin(angle * PI / 180.0) * (xstep)); @@ -466,7 +466,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { SCIkdebug(SCIkBRESEN, "Pos (%d,%d): Trying angle %d; delta=(%d,%d)\n", oldx, oldy, angle, move_x, move_y); if (invoke_selector(INV_SEL(client, canBeHere, 1) , 0)) { - error("Client "PREG" of avoider "PREG" doesn't" + error("Client %04x:%04x of avoider %04x:%04x doesn't" " have a canBeHere() funcselector", PRINT_REG(client), PRINT_REG(avoider)); return NULL_REG; } @@ -487,7 +487,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { angle -= 360; } - warning("DoAvoider failed for avoider "PREG"", PRINT_REG(avoider)); + warning("DoAvoider failed for avoider %04x:%04x", PRINT_REG(avoider)); } else { int heading = GET_SEL32V(client, heading); @@ -500,7 +500,7 @@ reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (looper.segment) { if (invoke_selector(INV_SEL(looper, doit, 1), 2, angle, client)) { - error("Looper "PREG" of avoider "PREG" doesn't" + error("Looper %04x:%04x of avoider %04x:%04x doesn't" " have a doit() funcselector", PRINT_REG(looper), PRINT_REG(avoider)); } else return s->r_acc; diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 1c8e5ccdac..9f51b27ece 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -45,12 +45,12 @@ void write_selector(EngineState *s, reg_t object, Selector selector_id, reg_t va if ((selector_id < 0) || (selector_id > (int)s->_selectorNames.size())) { warning("Attempt to write to invalid selector %d of" - " object at "PREG" (%s L%d).", selector_id, PRINT_REG(object), fname, line); + " object at %04x:%04x (%s L%d).", selector_id, PRINT_REG(object), fname, line); return; } if (lookup_selector(s, object, selector_id, &address, NULL) != kSelectorVariable) - warning("Selector '%s' of object at "PREG" could not be" + warning("Selector '%s' of object at %04x:%04x could not be" " written to (%s L%d)", s->_selectorNames[selector_id].c_str(), PRINT_REG(object), fname, line); else *address = value; @@ -71,7 +71,7 @@ int invoke_selector(EngineState *s, reg_t object, int selector_id, int noinvalid slc_type = lookup_selector(s, object, selector_id, NULL, &address); if (slc_type == kSelectorNone) { - error("Selector '%s' of object at "PREG" could not be invoked (%s L%d)\n", + error("Selector '%s' of object at %04x:%04x could not be invoked (%s L%d)\n", s->_selectorNames[selector_id].c_str(), PRINT_REG(object), fname, line); if (noinvalid == 0) KERNEL_OOPS("Not recoverable: VM was halted\n"); @@ -184,16 +184,16 @@ reg_t kClone(EngineState *s, int funct_nr, int argc, reg_t *argv) { Clone *clone_obj; // same as Object* if (!parent_obj) { - error("Attempt to clone non-object/class at "PREG" failed", PRINT_REG(parent_addr)); + error("Attempt to clone non-object/class at %04x:%04x failed", PRINT_REG(parent_addr)); return NULL_REG; } - SCIkdebug(SCIkMEM, "Attempting to clone from "PREG"\n", PRINT_REG(parent_addr)); + SCIkdebug(SCIkMEM, "Attempting to clone from %04x:%04x\n", PRINT_REG(parent_addr)); clone_obj = s->seg_manager->alloc_Clone(&clone_addr); if (!clone_obj) { - error("Cloning "PREG" failed-- internal error!\n", PRINT_REG(parent_addr)); + error("Cloning %04x:%04x failed-- internal error!\n", PRINT_REG(parent_addr)); return NULL_REG; } @@ -219,7 +219,7 @@ reg_t kDisposeClone(EngineState *s, int funct_nr, int argc, reg_t *argv) { uint16 underBits; if (!victim_obj) { - error("Attempt to dispose non-class/object at "PREG"\n", + error("Attempt to dispose non-class/object at %04x:%04x\n", PRINT_REG(victim_addr)); return s->r_acc; } @@ -232,7 +232,7 @@ reg_t kDisposeClone(EngineState *s, int funct_nr, int argc, reg_t *argv) { underBits = GET_SEL32V(victim_addr, underBits); if (underBits) { - warning("Clone "PREG" was cleared with underBits set", PRINT_REG(victim_addr)); + warning("Clone %04x:%04x was cleared with underBits set", PRINT_REG(victim_addr)); } #if 0 if (s->dyn_views) { // Free any widget associated with the clone diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 9f279ff7d3..df7770c172 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -144,33 +144,33 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their while ((result = sfx_poll(&s->sound, &handle, &cue))) { reg_t obj = DEFROBNICATE_HANDLE(handle); if (!is_object(s, obj)) { - warning("Non-object "PREG" received sound signal (%d/%d)", PRINT_REG(obj), result, cue); + warning("Non-object %04x:%04x received sound signal (%d/%d)", PRINT_REG(obj), result, cue); return; } switch (result) { case SI_LOOP: - SCIkdebug(SCIkSOUND, "[process-sound] Song "PREG" looped (to %d)\n", + SCIkdebug(SCIkSOUND, "[process-sound] Song %04x:%04x looped (to %d)\n", PRINT_REG(obj), cue); /* PUT_SEL32V(obj, loops, GET_SEL32V(obj, loop) - 1);*/ PUT_SEL32V(obj, signal, -1); break; case SI_RELATIVE_CUE: - SCIkdebug(SCIkSOUND, "[process-sound] Song "PREG" received relative cue %d\n", + SCIkdebug(SCIkSOUND, "[process-sound] Song %04x:%04x received relative cue %d\n", PRINT_REG(obj), cue); PUT_SEL32V(obj, signal, cue + 0x7f); break; case SI_ABSOLUTE_CUE: - SCIkdebug(SCIkSOUND, "[process-sound] Song "PREG" received absolute cue %d\n", + SCIkdebug(SCIkSOUND, "[process-sound] Song %04x:%04x received absolute cue %d\n", PRINT_REG(obj), cue); PUT_SEL32V(obj, signal, cue); break; case SI_FINISHED: - SCIkdebug(SCIkSOUND, "[process-sound] Song "PREG" finished\n", + SCIkdebug(SCIkSOUND, "[process-sound] Song %04x:%04x finished\n", PRINT_REG(obj)); PUT_SEL32V(obj, signal, -1); PUT_SEL32V(obj, state, _K_SOUND_STATUS_STOPPED); @@ -243,7 +243,7 @@ reg_t kDoSound_SCI0(EngineState *s, int funct_nr, int argc, reg_t *argv) { sciprintf("("); for (i = 1; i < argc; i++) { - sciprintf(PREG, PRINT_REG(argv[i])); + sciprintf("%04x:%04x", PRINT_REG(argv[i])); if (i + 1 < argc) sciprintf(", "); } @@ -438,7 +438,7 @@ reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { sciprintf("("); for (i = 1; i < argc; i++) { - sciprintf(PREG, PRINT_REG(argv[i])); + sciprintf("%04x:%04x", PRINT_REG(argv[i])); if (i + 1 < argc) sciprintf(", "); } @@ -533,7 +533,7 @@ reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { handle, looping); sfx_song_renice(&s->sound, handle, pri); - SCIkdebug(SCIkSOUND, "[sound01-update-handle] -- CUE "PREG); + SCIkdebug(SCIkSOUND, "[sound01-update-handle] -- CUE %04x:%04x"); PUT_SEL32V(obj, signal, signal); PUT_SEL32V(obj, min, min); @@ -588,7 +588,7 @@ reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { case SI_ABSOLUTE_CUE: signal = cue; - SCIkdebug(SCIkSOUND, "--- [CUE] "PREG" Absolute Cue: %d\n", + SCIkdebug(SCIkSOUND, "--- [CUE] %04x:%04x Absolute Cue: %d\n", PRINT_REG(obj), signal); PUT_SEL32V(obj, signal, signal); @@ -596,7 +596,7 @@ reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { case SI_RELATIVE_CUE: signal = cue; - SCIkdebug(SCIkSOUND, "--- [CUE] "PREG" Relative Cue: %d\n", + SCIkdebug(SCIkSOUND, "--- [CUE] %04x:%04x Relative Cue: %d\n", PRINT_REG(obj), cue); /* FIXME to match commented-out semantics @@ -607,7 +607,7 @@ reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { break; case SI_FINISHED: - SCIkdebug(SCIkSOUND, "--- [FINISHED] "PREG"\n", PRINT_REG(obj)); + SCIkdebug(SCIkSOUND, "--- [FINISHED] %04x:%04x\n", PRINT_REG(obj)); PUT_SEL32V(obj, signal, 0xffff); break; @@ -758,7 +758,7 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { sciprintf("("); for (i = 1; i < argc; i++) { - sciprintf(PREG, PRINT_REG(argv[i])); + sciprintf("%04x:%04x", PRINT_REG(argv[i])); if (i + 1 < argc) sciprintf(", "); } @@ -944,14 +944,14 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { case SI_ABSOLUTE_CUE: signal = cue; - fprintf(stderr, "[CUE] "PREG" Absolute Cue: %d\n", + fprintf(stderr, "[CUE] %04x:%04x Absolute Cue: %d\n", PRINT_REG(obj), signal); PUT_SEL32V(obj, signal, signal); break; case SI_RELATIVE_CUE: - fprintf(stderr, "[CUE] "PREG" Relative Cue: %d\n", + fprintf(stderr, "[CUE] %04x:%04x Relative Cue: %d\n", PRINT_REG(obj), cue); PUT_SEL32V(obj, dataInc, cue); diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index a4fdbc4652..9cad1f118f 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -89,7 +89,7 @@ reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv) { said_block = (byte *) kernel_dereference_bulk_pointer(s, heap_said_block, 0); if (!said_block) { - warning("Said on non-string, pointer "PREG"", PRINT_REG(heap_said_block)); + warning("Said on non-string, pointer %04x:%04x", PRINT_REG(heap_said_block)); return NULL_REG; } @@ -98,7 +98,7 @@ reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv) { vocab_decypher_said_block(s, said_block); } - if (IS_NULL_REG(s->parser_event) || (GET_SEL32V(s->parser_event, claimed))) { + if (s->parser_event.isNull() || (GET_SEL32V(s->parser_event, claimed))) { return NULL_REG; } @@ -289,12 +289,12 @@ reg_t kStrCpy(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *src = (char *) kernel_dereference_bulk_pointer(s, argv[1], 0); if (!dest) { - warning("Attempt to strcpy TO invalid pointer "PREG"", + warning("Attempt to strcpy TO invalid pointer %04x:%04x", PRINT_REG(argv[0])); return NULL_REG; } if (!src) { - warning("Attempt to strcpy FROM invalid pointer "PREG"", + warning("Attempt to strcpy FROM invalid pointer %04x:%04x", PRINT_REG(argv[1])); return NULL_REG; } @@ -353,7 +353,7 @@ reg_t kStrAt(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t *dest2; if (!dest) { - warning("Attempt to StrAt at invalid pointer "PREG"", PRINT_REG(argv[0])); + warning("Attempt to StrAt at invalid pointer %04x:%04x", PRINT_REG(argv[0])); return NULL_REG; } @@ -739,7 +739,7 @@ reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (buffer) { strcpy(buffer, str); } else { - warning("Message: buffer "PREG" invalid or too small to hold the following text of %i bytes: '%s'", PRINT_REG(bufferReg), len, str); + warning("Message: buffer %04x:%04x invalid or too small to hold the following text of %i bytes: '%s'", PRINT_REG(bufferReg), len, str); // Set buffer to empty string if possible buffer = kernel_dereference_char_pointer(s, bufferReg, 1); @@ -791,7 +791,7 @@ reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) { WRITE_LE_UINT16(buffer + 6, msg.cond); WRITE_LE_UINT16(buffer + 8, msg.seq); } else { - warning("Message: buffer "PREG" invalid or too small to hold the tuple", PRINT_REG(argv[1])); + warning("Message: buffer %04x:%04x invalid or too small to hold the tuple", PRINT_REG(argv[1])); } return NULL_REG; diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 47d1f3e721..bc097acf42 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -616,7 +616,7 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) { base_obj = obj_get(s, scr->_objects[j]._variables[SCRIPT_SPECIES_SELECTOR]); if (!base_obj) { - sciprintf("Object without a base class: Script %d, index %d (reg address "PREG"\n", + sciprintf("Object without a base class: Script %d, index %d (reg address %04x:%04x\n", scr->nr, j, PRINT_REG(scr->_objects[j]._variables[SCRIPT_SPECIES_SELECTOR])); continue; } diff --git a/engines/sci/engine/sciconsole.cpp b/engines/sci/engine/sciconsole.cpp index ac2bb8c5e6..7f90eed87c 100644 --- a/engines/sci/engine/sciconsole.cpp +++ b/engines/sci/engine/sciconsole.cpp @@ -335,9 +335,9 @@ int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on if (times_found == 1) { // First time we realized the ambiguity sciprintf("Ambiguous:\n"); - sciprintf(" %3x: ["PREG"] %s\n", 0, PRINT_REG(*dest), str_objname); + sciprintf(" %3x: [%04x:%04x] %s\n", 0, PRINT_REG(*dest), str_objname); } - sciprintf(" %3x: ["PREG"] %s\n", times_found, PRINT_REG(objpos), str_objname); + sciprintf(" %3x: [%04x:%04x] %s\n", times_found, PRINT_REG(objpos), str_objname); } if (index < 0 || times_found == index) *dest = objpos; diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index e24c5b654f..9fde6a2326 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -346,7 +346,7 @@ static void print_obj_head(EngineState *s, reg_t pos) { if (!obj) return; - sciprintf("["PREG"] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s, pos), + sciprintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s, pos), obj->_variables.size(), obj->methods_nr); } @@ -356,30 +356,30 @@ static void print_list(EngineState *s, List *l) { sciprintf("\t<\n"); - while (!IS_NULL_REG(pos)) { + while (!pos.isNull()) { Node *node; NodeTable *nt = (NodeTable *)GET_SEGMENT(*s->seg_manager, pos.segment, MEM_OBJ_NODES); if (!nt || !nt->isValidEntry(pos.offset)) { - sciprintf(" WARNING: "PREG": Doesn't contain list node!\n", + sciprintf(" WARNING: %04x:%04x: Doesn't contain list node!\n", PRINT_REG(pos)); return; } node = &(nt->_table[pos.offset]); - sciprintf("\t"PREG" : "PREG" -> "PREG"\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value)); + sciprintf("\t%04x:%04x : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value)); - if (!REG_EQ(my_prev, node->pred)) - sciprintf(" WARNING: current node gives "PREG" as predecessor!\n", + if (my_prev != node->pred) + sciprintf(" WARNING: current node gives %04x:%04x as predecessor!\n", PRINT_REG(node->pred)); my_prev = pos; pos = node->succ; } - if (!REG_EQ(my_prev, l->last)) - sciprintf(" WARNING: Last node was expected to be "PREG", was "PREG"!\n", + if (my_prev != l->last) + sciprintf(" WARNING: Last node was expected to be %04x:%04x, was %04x:%04x!\n", PRINT_REG(l->last), PRINT_REG(my_prev)); sciprintf("\t>\n"); } @@ -523,7 +523,7 @@ static int show_node(EngineState *s, reg_t addr) { list = &(lt->_table[addr.offset]); - sciprintf(PREG" : first x last = ("PREG", "PREG")\n", PRINT_REG(addr), PRINT_REG(list->first), PRINT_REG(list->last)); + sciprintf("%04x:%04x : first x last = (%04x:%04x, %04x:%04x)\n", PRINT_REG(addr), PRINT_REG(list->first), PRINT_REG(list->last)); } else { NodeTable *nt; Node *node; @@ -542,7 +542,7 @@ static int show_node(EngineState *s, reg_t addr) { } node = &(nt->_table[addr.offset]); - sciprintf(PREG" : prev x next = ("PREG", "PREG"); maps "PREG" -> "PREG"\n", + sciprintf("%04x:%04x : prev x next = (%04x:%04x, %04x:%04x); maps %04x:%04x -> %04x:%04x\n", PRINT_REG(addr), PRINT_REG(node->pred), PRINT_REG(node->succ), PRINT_REG(node->key), PRINT_REG(node->value)); } @@ -566,7 +566,7 @@ static int c_vr(EngineState *s, const Common::Array &cmdParams) { int filter; int found = 0; - sciprintf(PREG" is of type 0x%x%s: ", PRINT_REG(reg), type_mask & ~KSIG_INVALID, type_mask & KSIG_INVALID ? " (invalid)" : ""); + sciprintf("%04x:%04x is of type 0x%x%s: ", PRINT_REG(reg), type_mask & ~KSIG_INVALID, type_mask & KSIG_INVALID ? " (invalid)" : ""); type_mask &= ~KSIG_INVALID; @@ -700,10 +700,10 @@ int c_debuginfo(EngineState *s) { return 1; } - sciprintf("acc="PREG" prev="PREG" &rest=%x\n", PRINT_REG(s->r_acc), PRINT_REG(s->r_prev), *p_restadjust); + sciprintf("acc=%04x:%04x prev=%04x:%04x &rest=%x\n", PRINT_REG(s->r_acc), PRINT_REG(s->r_prev), *p_restadjust); if (!s->_executionStack.empty()) { - sciprintf("pc="PREG" obj="PREG" fp="PSTK" sp="PSTK"\n", PRINT_REG(*p_pc), PRINT_REG(*p_objp), PRINT_STK(*p_pp), PRINT_STK(*p_sp)); + sciprintf("pc=%04x:%04x obj=%04x:%04x fp=ST:%04x sp=ST:%04x\n", PRINT_REG(*p_pc), PRINT_REG(*p_objp), PRINT_STK(*p_pp), PRINT_STK(*p_sp)); } else sciprintf("\n"); @@ -839,7 +839,7 @@ int c_classtable(EngineState *s, const Common::Array &cmdParams) { sciprintf("Available classes:\n"); for (uint i = 0; i < s->_classtable.size(); i++) if (s->_classtable[i].reg.segment) - sciprintf(" Class 0x%x at "PREG" (script 0x%x)\n", i, PRINT_REG(s->_classtable[i].reg), s->_classtable[i].script); + sciprintf(" Class 0x%x at %04x:%04x (script 0x%x)\n", i, PRINT_REG(s->_classtable[i].reg), s->_classtable[i].script); return 0; } @@ -1172,7 +1172,7 @@ int c_stack(EngineState *s, const Common::Array &cmdParams) { if ((xs.sp - xs.fp - i) == 0) sciprintf("-- temp variables --\n"); if (xs.sp - i >= s->stack_base) - sciprintf(PSTK" = "PREG"\n", PRINT_STK(xs.sp - i), PRINT_REG(xs.sp[-i])); + sciprintf("ST:%04x = %04x:%04x\n", PRINT_STK(xs.sp - i), PRINT_REG(xs.sp[-i])); } return 0; @@ -1191,7 +1191,7 @@ int prop_ofs_to_id(EngineState *s, int prop_ofs, reg_t objp) { int selectors; if (!obj) { - sciprintf("Applied prop_ofs_to_id on non-object at "PREG"\n", PRINT_REG(objp)); + sciprintf("Applied prop_ofs_to_id on non-object at %04x:%04x\n", PRINT_REG(objp)); return -1; } @@ -1208,7 +1208,7 @@ int prop_ofs_to_id(EngineState *s, int prop_ofs, reg_t objp) { } if (prop_ofs < 0 || (prop_ofs >> 1) >= selectors) { - sciprintf("Applied prop_ofs_to_id to invalid property offset %x (property #%d not in [0..%d]) on object at "PREG"\n", + sciprintf("Applied prop_ofs_to_id to invalid property offset %x (property #%d not in [0..%d]) on object at %04x:%04x\n", prop_ofs, prop_ofs >> 1, selectors - 1, PRINT_REG(objp)); return -1; } @@ -1253,7 +1253,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod opsize &= 1; // byte if true, word if false - sciprintf(PREG": ", PRINT_REG(pos)); + sciprintf("%04x:%04x: ", PRINT_REG(pos)); if (print_bytecode) { while (g_opcode_formats[opcode][i]) { @@ -1375,7 +1375,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod } } - if (REG_EQ(pos, *p_pc)) { // Extra information if debugging the current opcode + if (pos == *p_pc) { // Extra information if debugging the current opcode if ((opcode == op_pTos) || (opcode == op_sTop) || (opcode == op_pToa) || (opcode == op_aTop) || (opcode == op_dpToa) || (opcode == op_ipToa) || (opcode == op_dpTos) || (opcode == op_ipTos)) { int prop_ofs = scr[pos.offset + 1]; @@ -1387,7 +1387,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod sciprintf("\n"); - if (REG_EQ(pos, *p_pc)) { // Extra information if debugging the current opcode + if (pos == *p_pc) { // Extra information if debugging the current opcode if (opcode == op_callk) { int stackframe = (scr[pos.offset + 2] >> 1) + (*p_restadjust); int argc = ((*p_sp)[- stackframe - 1]).offset; @@ -1398,7 +1398,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod sciprintf(" Kernel params: ("); for (int j = 0; j < argc; j++) { - sciprintf(PREG, PRINT_REG((*p_sp)[j - stackframe])); + sciprintf("%04x:%04x", PRINT_REG((*p_sp)[j - stackframe])); if (j + 1 < argc) sciprintf(", "); } @@ -1447,7 +1447,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod sciprintf("]("); while (argc--) { - sciprintf(PREG, PRINT_REG(sb[- stackframe + 2])); + sciprintf("%04x:%04x", PRINT_REG(sb[- stackframe + 2])); if (argc) sciprintf(", "); stackframe--; @@ -1490,7 +1490,7 @@ int c_vmvarlist(EngineState *s, const Common::Array &cmdParams) { int i; for (i = 0;i < 4;i++) { - sciprintf("%s vars at "PREG" ", varnames[i], PRINT_REG(make_reg(p_var_segs[i], p_vars[i] - p_var_base[i]))); + sciprintf("%s vars at %04x:%04x ", varnames[i], PRINT_REG(make_reg(p_var_segs[i], p_vars[i] - p_var_base[i]))); if (p_var_max) sciprintf(" total %d", p_var_max[i]); sciprintf("\n"); @@ -1521,7 +1521,7 @@ int c_vmvars(EngineState *s, const Common::Array &cmdParams) { switch (cmdParams.size()) { case 2: - sciprintf("%s var %d == "PREG"\n", varnames[vartype], idx, PRINT_REG(p_vars[vartype][idx])); + sciprintf("%s var %d == %04x:%04x\n", varnames[vartype], idx, PRINT_REG(p_vars[vartype][idx])); break; case 3: @@ -1571,7 +1571,7 @@ static int c_backtrace(EngineState *s, const Common::Array &cmdPara totalparamc = 16; for (paramc = 1; paramc <= totalparamc; paramc++) { - sciprintf(PREG, PRINT_REG(call.variables_argp[paramc])); + sciprintf("%04x:%04x", PRINT_REG(call.variables_argp[paramc])); if (paramc < call.argc) sciprintf(", "); @@ -1580,19 +1580,19 @@ static int c_backtrace(EngineState *s, const Common::Array &cmdPara if (call.argc > 16) sciprintf("..."); - sciprintf(")\n obj@"PREG, PRINT_REG(call.objp)); + sciprintf(")\n obj@%04x:%04x", PRINT_REG(call.objp)); if (call.type == EXEC_STACK_TYPE_CALL) { - sciprintf(" pc="PREG, PRINT_REG(call.addr.pc)); + sciprintf(" pc=%04x:%04x", PRINT_REG(call.addr.pc)); if (call.sp == CALL_SP_CARRY) sciprintf(" sp,fp:carry"); else { - sciprintf(" sp="PSTK, PRINT_STK(call.sp)); - sciprintf(" fp="PSTK, PRINT_STK(call.fp)); + sciprintf(" sp=ST:%04x", PRINT_STK(call.sp)); + sciprintf(" fp=ST:%04x", PRINT_STK(call.fp)); } } else sciprintf(" pc:none"); - sciprintf(" argp:"PSTK, PRINT_STK(call.variables_argp)); + sciprintf(" argp:ST:%04x", PRINT_STK(call.variables_argp)); if (call.type == EXEC_STACK_TYPE_CALL) sciprintf(" script: %d", (*(Script *)s->seg_manager->_heap[call.addr.pc.segment]).nr); sciprintf("\n"); @@ -2166,7 +2166,7 @@ static int c_send(EngineState *s, const Common::Array &cmdParams) { o = obj_get(s, object); if (o == NULL) { - sciprintf("Address \""PREG"\" is not an object\n", PRINT_REG(object)); + sciprintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object)); return 1; } @@ -2537,7 +2537,7 @@ int objinfo(EngineState *s, reg_t pos) { int i; if (!obj) { - sciprintf("["PREG"]: Not an object.", PRINT_REG(pos)); + sciprintf("[%04x:%04x]: Not an object.", PRINT_REG(pos)); return 1; } @@ -2554,7 +2554,7 @@ int objinfo(EngineState *s, reg_t pos) { sciprintf("p#%x = ", i); reg_t val = obj->_variables[i]; - sciprintf(PREG, PRINT_REG(val)); + sciprintf("%04x:%04x", PRINT_REG(val)); Object *ref = obj_get(s, val); if (ref) @@ -2565,7 +2565,7 @@ int objinfo(EngineState *s, reg_t pos) { sciprintf(" -- methods:\n"); for (i = 0; i < obj->methods_nr; i++) { reg_t fptr = VM_OBJECT_READ_FUNCTION(obj, i); - sciprintf(" [%03x] %s = "PREG"\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr)); + sciprintf(" [%03x] %s = %04x:%04x\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr)); } if (s->seg_manager->_heap[pos.segment]->getType() == MEM_OBJ_SCRIPT) sciprintf("\nOwner script:\t%d\n", s->seg_manager->getScript(pos.segment)->nr); @@ -2798,7 +2798,7 @@ int c_sci_version(EngineState *s, const Common::Array &cmdParams) { static void _print_address(void * _, reg_t addr) { if (addr.segment) - sciprintf(" "PREG"\n", PRINT_REG(addr)); + sciprintf(" %04x:%04x\n", PRINT_REG(addr)); } static int c_gc_show_reachable(EngineState *s, const Common::Array &cmdParams) { @@ -2810,7 +2810,7 @@ static int c_gc_show_reachable(EngineState *s, const Common::Array return 1; } - sciprintf("Reachable from "PREG":\n", PRINT_REG(addr)); + sciprintf("Reachable from %04x:%04x:\n", PRINT_REG(addr)); mobj->listAllOutgoingReferences(s, addr, NULL, _print_address); return 0; @@ -2841,7 +2841,7 @@ static int c_gc_normalise(EngineState *s, const Common::Array &cmdP } addr = mobj->findCanonicAddress(s->seg_manager, addr); - sciprintf(" "PREG"\n", PRINT_REG(addr)); + sciprintf(" %04x:%04x\n", PRINT_REG(addr)); return 0; } @@ -2857,7 +2857,7 @@ static int c_gc_list_reachable(EngineState *s, const Common::Array sciprintf("Reachable references (normalised):\n"); for (reg_t_hash_map::iterator i = use_map->begin(); i != use_map->end(); ++i) { - sciprintf(" - "PREG"\n", PRINT_REG(i->_key)); + sciprintf(" - %04x:%04x\n", PRINT_REG(i->_key)); } delete use_map; @@ -2881,11 +2881,11 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * p_pp = pp; p_objp = objp; p_restadjust = restadjust; - sciprintf("%d: acc="PREG" ", script_step_counter, PRINT_REG(s->r_acc)); + sciprintf("%d: acc=%04x:%04x ", script_step_counter, PRINT_REG(s->r_acc)); _debugstate_valid = 1; disassemble(s, *pc, 0, 1); if (_debug_seeking == _DEBUG_SEEK_GLOBAL) - sciprintf("Global %d (0x%x) = "PREG"\n", _debug_seek_special, + sciprintf("Global %d (0x%x) = %04x:%04x\n", _debug_seek_special, _debug_seek_special, PRINT_REG(s->script_000->locals_block->_locals[_debug_seek_special])); _debugstate_valid = old_debugstate; @@ -2924,7 +2924,7 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * } case _DEBUG_SEEK_SO: - if (!REG_EQ(*pc, _debug_seek_reg) || (int)s->_executionStack.size()-1 != _debug_seek_level) + if ((*pc != _debug_seek_reg) || (int)s->_executionStack.size()-1 != _debug_seek_level) return; break; diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index 51459324e0..03baafd5ec 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -485,7 +485,7 @@ void SegManager::scriptRelocate(reg_t block) { } if (!done) { - sciprintf("While processing relocation block "PREG":\n", PRINT_REG(block)); + sciprintf("While processing relocation block %04x:%04x:\n", PRINT_REG(block)); sciprintf("Relocation failed for index %04x (%d/%d)\n", pos, i + 1, count); if (scr->locals_block) sciprintf("- locals: %d at %04x\n", scr->locals_block->_locals.size(), scr->locals_offset); @@ -526,7 +526,7 @@ void SegManager::heapRelocate(reg_t block) { } if (!done) { - sciprintf("While processing relocation block "PREG":\n", PRINT_REG(block)); + sciprintf("While processing relocation block %04x:%04x:\n", PRINT_REG(block)); sciprintf("Relocation failed for index %04x (%d/%d)\n", pos, i + 1, count); if (scr->locals_block) sciprintf("- locals: %d at %04x\n", scr->locals_block->_locals.size(), scr->locals_offset); @@ -849,7 +849,7 @@ void SegManager::free_hunk_entry(reg_t addr) { HunkTable *ht = (HunkTable *)GET_SEGMENT(*this, addr.segment, MEM_OBJ_HUNK); if (!ht) { - sciprintf("Attempt to free Hunk from address "PREG": Invalid segment type\n", PRINT_REG(addr)); + sciprintf("Attempt to free Hunk from address %04x:%04x: Invalid segment type\n", PRINT_REG(addr)); return; } @@ -927,14 +927,14 @@ Hunk *SegManager::alloc_Hunk(reg_t *addr) { } byte *MemObject::dereference(reg_t pointer, int *size) { - error("Error: Trying to dereference pointer "PREG" to inappropriate segment", + error("Error: Trying to dereference pointer %04x:%04x to inappropriate segment", PRINT_REG(pointer)); return NULL; } byte *Script::dereference(reg_t pointer, int *size) { if (pointer.offset > buf_size) { - sciprintf("Error: Attempt to dereference invalid pointer "PREG" into script segment (script size=%d)\n", + sciprintf("Error: Attempt to dereference invalid pointer %04x:%04x into script segment (script size=%d)\n", PRINT_REG(pointer), (uint)buf_size); return NULL; } @@ -982,13 +982,13 @@ byte *SystemStrings::dereference(reg_t pointer, int *size) { if (pointer.offset < SYS_STRINGS_MAX && strings[pointer.offset].name) return (byte *)(strings[pointer.offset].value); - error("Attempt to dereference invalid pointer "PREG"", PRINT_REG(pointer)); + error("Attempt to dereference invalid pointer %04x:%04x", PRINT_REG(pointer)); return NULL; } byte *SegManager::dereference(reg_t pointer, int *size) { if (!pointer.segment || (pointer.segment >= _heap.size()) || !_heap[pointer.segment]) { - error("Attempt to dereference invalid pointer "PREG"", PRINT_REG(pointer)); + error("Attempt to dereference invalid pointer %04x:%04x", PRINT_REG(pointer)); return NULL; /* Invalid */ } @@ -1055,7 +1055,7 @@ reg_t Script::findCanonicAddress(SegManager *segmgr, reg_t addr) { void Script::freeAtAddress(SegManager *segmgr, reg_t addr) { /* - sciprintf("[GC] Freeing script "PREG"\n", PRINT_REG(addr)); + sciprintf("[GC] Freeing script %04x:%04x\n", PRINT_REG(addr)); if (locals_segment) sciprintf("[GC] Freeing locals %04x:0000\n", locals_segment); */ @@ -1082,10 +1082,10 @@ void Script::listAllOutgoingReferences(EngineState *s, reg_t addr, void *param, for (uint i = 0; i < obj._variables.size(); i++) (*note)(param, obj._variables[i]); } else { - warning("Request for outgoing script-object reference at "PREG" yielded invalid index %d", PRINT_REG(addr), idx); + warning("Request for outgoing script-object reference at %04x:%04x yielded invalid index %d", PRINT_REG(addr), idx); } } else { - /* fprintf(stderr, "Unexpected request for outgoing script-object references at "PREG"\n", PRINT_REG(addr));*/ + /* fprintf(stderr, "Unexpected request for outgoing script-object references at %04x:%04x\n", PRINT_REG(addr));*/ /* Happens e.g. when we're looking into strings */ } } @@ -1107,7 +1107,7 @@ void CloneTable::listAllOutgoingReferences(EngineState *s, reg_t addr, void *par // assert(addr.segment == _segId); if (!clone_table->isValidEntry(addr.offset)) { - fprintf(stderr, "Unexpected request for outgoing references from clone at "PREG"\n", PRINT_REG(addr)); + fprintf(stderr, "Unexpected request for outgoing references from clone at %04x:%04x\n", PRINT_REG(addr)); // BREAKPOINT(); return; } @@ -1120,7 +1120,7 @@ void CloneTable::listAllOutgoingReferences(EngineState *s, reg_t addr, void *par // Note that this also includes the 'base' object, which is part of the script and therefore also emits the locals. (*note)(param, clone->pos); - //sciprintf("[GC] Reporting clone-pos "PREG"\n", PRINT_REG(clone->pos)); + //sciprintf("[GC] Reporting clone-pos %04x:%04x\n", PRINT_REG(clone->pos)); } void CloneTable::freeAtAddress(SegManager *segmgr, reg_t addr) { @@ -1133,15 +1133,15 @@ void CloneTable::freeAtAddress(SegManager *segmgr, reg_t addr) { #ifdef GC_DEBUG if (!(victim_obj->flags & OBJECT_FLAG_FREED)) - sciprintf("[GC] Warning: Clone "PREG" not reachable and not freed (freeing now)\n", PRINT_REG(addr)); + sciprintf("[GC] Warning: Clone %04x:%04x not reachable and not freed (freeing now)\n", PRINT_REG(addr)); #ifdef GC_DEBUG_VERBOSE else - sciprintf("[GC-DEBUG] Clone "PREG": Freeing\n", PRINT_REG(addr)); + sciprintf("[GC-DEBUG] Clone %04x:%04x: Freeing\n", PRINT_REG(addr)); #endif #endif /* - sciprintf("[GC] Clone "PREG": Freeing\n", PRINT_REG(addr)); - sciprintf("[GC] Clone had pos "PREG"\n", PRINT_REG(victim_obj->pos)); + sciprintf("[GC] Clone %04x:%04x: Freeing\n", PRINT_REG(addr)); + sciprintf("[GC] Clone had pos %04x:%04x\n", PRINT_REG(victim_obj->pos)); */ clone_table->freeEntry(addr.offset); } @@ -1186,7 +1186,7 @@ void ListTable::freeAtAddress(SegManager *segmgr, reg_t sub_addr) { void ListTable::listAllOutgoingReferences(EngineState *s, reg_t addr, void *param, NoteCallback note) { if (!isValidEntry(addr.offset)) { - warning("Invalid list referenced for outgoing references: "PREG"", PRINT_REG(addr)); + warning("Invalid list referenced for outgoing references: %04x:%04x", PRINT_REG(addr)); return; } @@ -1206,7 +1206,7 @@ void NodeTable::freeAtAddress(SegManager *segmgr, reg_t sub_addr) { void NodeTable::listAllOutgoingReferences(EngineState *s, reg_t addr, void *param, NoteCallback note) { if (!isValidEntry(addr.offset)) { - warning("Invalid node referenced for outgoing references: "PREG"", PRINT_REG(addr)); + warning("Invalid node referenced for outgoing references: %04x:%04x", PRINT_REG(addr)); return; } Node *node = &(_table[addr.offset]); diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 1c3917fc69..d28f96c523 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -337,7 +337,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt cmplen = 256; if (bp->type == BREAK_SELECTOR && !strncmp(bp->data.name, method_name, cmplen)) { - sciprintf("Break on %s (in ["PREG"])\n", method_name, PRINT_REG(send_obj)); + sciprintf("Break on %s (in [%04x:%04x])\n", method_name, PRINT_REG(send_obj)); script_debug_flag = print_send_action = 1; breakpointFlag = true; break; @@ -347,12 +347,12 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt } #ifdef VM_DEBUG_SEND - sciprintf("Send to "PREG", selector %04x (%s):", PRINT_REG(send_obj), selector, s->_selectorNames[selector].c_str()); + sciprintf("Send to %04x:%04x, selector %04x (%s):", PRINT_REG(send_obj), selector, s->_selectorNames[selector].c_str()); #endif // VM_DEBUG_SEND switch (lookup_selector(s, send_obj, selector, &varp, &funcp)) { case kSelectorNone: - sciprintf("Send to invalid selector 0x%x of object at "PREG"\n", 0xffff & selector, PRINT_REG(send_obj)); + sciprintf("Send to invalid selector 0x%x of object at %04x:%04x\n", 0xffff & selector, PRINT_REG(send_obj)); // WORKAROUND: LSL6 tries to access the invalid 'keep' selector of the game object. // FIXME: Find out if this is a game bug. @@ -370,7 +370,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt #ifdef VM_DEBUG_SEND sciprintf("Varselector: "); if (argc) - sciprintf("Write "PREG"\n", PRINT_REG(argp[1])); + sciprintf("Write %04x:%04x\n", PRINT_REG(argp[1])); else sciprintf("Read\n"); #endif // VM_DEBUG_SEND @@ -391,7 +391,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt reg_t oldReg = *varp; reg_t newReg = argp[1]; - sciprintf("[write to selector: change "PREG" to "PREG"]\n", PRINT_REG(oldReg), PRINT_REG(newReg)); + sciprintf("[write to selector: change %04x:%04x to %04x:%04x]\n", PRINT_REG(oldReg), PRINT_REG(newReg)); print_send_action = 0; } CallsStruct call; @@ -405,7 +405,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt break; #ifdef STRICT_SEND default: - sciprintf("Send error: Variable selector %04x in "PREG" called with %04x params\n", selector, PRINT_REG(send_obj), argc); + sciprintf("Send error: Variable selector %04x in %04x:%04x called with %04x params\n", selector, PRINT_REG(send_obj), argc); script_debug_flag = 1; // Enter debug mode _debug_seeking = _debug_step_running = 0; #endif @@ -421,7 +421,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt if (i + 1 < argc) sciprintf(", "); } - sciprintf(") at "PREG"\n", PRINT_REG(funcp)); + sciprintf(") at %04x:%04x\n", PRINT_REG(funcp)); #endif // VM_DEBUG_SEND if (print_send_action) { sciprintf("[invoke selector]\n"); @@ -531,7 +531,7 @@ static reg_t pointer_add(EngineState *s, reg_t base, int offset) { if (!mobj) { script_debug_flag = script_error_flag = 1; - sciprintf("[VM] Error: Attempt to add %d to invalid pointer "PREG"!", offset, PRINT_REG(base)); + sciprintf("[VM] Error: Attempt to add %d to invalid pointer %04x:%04x!", offset, PRINT_REG(base)); return NULL_REG; } @@ -549,7 +549,7 @@ static reg_t pointer_add(EngineState *s, reg_t base, int offset) { break; default: - sciprintf("[VM] Error: Attempt to add %d to pointer "PREG": Pointer arithmetics of this type unsupported!", offset, PRINT_REG(base)); + sciprintf("[VM] Error: Attempt to add %d to pointer %04x:%04x: Pointer arithmetics of this type unsupported!", offset, PRINT_REG(base)); return NULL_REG; } @@ -656,7 +656,7 @@ void run_vm(EngineState *s, int restoring) { code_buf_size = scr->buf_size; #endif /*if (!obj) { - SCIkdebug(SCIkWARNING, "Running with non-existant self= "PREG"\n", PRINT_REG(xs->objp)); + SCIkdebug(SCIkWARNING, "Running with non-existant self= %04x:%04x\n", PRINT_REG(xs->objp)); }*/ local_script = script_locate_by_segment(s, xs->local_segment); @@ -782,7 +782,7 @@ void run_vm(EngineState *s, int restoring) { // Pointer arithmetics! if (s->r_acc.segment) { if (r_temp.segment) { - sciprintf("Error: Attempt to add two pointers, stack="PREG" and acc="PREG"!\n", + sciprintf("Error: Attempt to add two pointers, stack=%04x:%04x and acc=%04x:%04x!\n", PRINT_REG(r_temp), PRINT_REG(s->r_acc)); script_debug_flag = script_error_flag = 1; offset = 0; @@ -809,7 +809,7 @@ void run_vm(EngineState *s, int restoring) { // Pointer arithmetics! if (s->r_acc.segment) { if (r_temp.segment) { - sciprintf("Error: Attempt to subtract two pointers, stack="PREG" and acc="PREG"!\n", + sciprintf("Error: Attempt to subtract two pointers, stack=%04x:%04x and acc=%04x:%04x!\n", PRINT_REG(r_temp), PRINT_REG(s->r_acc)); script_debug_flag = script_error_flag = 1; offset = 0; @@ -876,14 +876,14 @@ void run_vm(EngineState *s, int restoring) { case 0x0d: // eq? s->r_prev = s->r_acc; r_temp = POP32(); - s->r_acc = make_reg(0, REG_EQ(r_temp, s->r_acc)); + s->r_acc = make_reg(0, r_temp == s->r_acc); // Explicitly allow pointers to be compared break; case 0x0e: // ne? s->r_prev = s->r_acc; r_temp = POP32(); - s->r_acc = make_reg(0, !REG_EQ(r_temp, s->r_acc)); + s->r_acc = make_reg(0, r_temp != s->r_acc); // Explicitly allow pointers to be compared break; @@ -1238,7 +1238,7 @@ void run_vm(EngineState *s, int restoring) { #ifndef DISABLE_VALIDATIONS if (s->r_acc.offset >= code_buf_size) { - sciprintf("VM: lofsa operation overflowed: "PREG" beyond end" + sciprintf("VM: lofsa operation overflowed: %04x:%04x beyond end" " of script (at %04x)\n", PRINT_REG(s->r_acc), code_buf_size); script_error_flag = script_debug_flag = 1; } @@ -1254,7 +1254,7 @@ void run_vm(EngineState *s, int restoring) { r_temp.offset = xs->addr.pc.offset + opparams[0]; #ifndef DISABLE_VALIDATIONS if (r_temp.offset >= code_buf_size) { - sciprintf("VM: lofss operation overflowed: "PREG" beyond end" + sciprintf("VM: lofss operation overflowed: %04x:%04x beyond end" " of script (at %04x)\n", PRINT_REG(r_temp), code_buf_size); script_error_flag = script_debug_flag = 1; } @@ -1545,7 +1545,7 @@ SelectorType lookup_selector(EngineState *s, reg_t obj_location, Selector select if (!obj) { CORE_ERROR("SLC-LU", "Attempt to send to non-object or invalid script"); - sciprintf("Address was "PREG"\n", PRINT_REG(obj_location)); + sciprintf("Address was %04x:%04x\n", PRINT_REG(obj_location)); return kSelectorNone; } @@ -1557,8 +1557,8 @@ SelectorType lookup_selector(EngineState *s, reg_t obj_location, Selector select if (!obj) { CORE_ERROR("SLC-LU", "Error while looking up Species class"); - sciprintf("Original address was "PREG"\n", PRINT_REG(obj_location)); - sciprintf("Species address was "PREG"\n", PRINT_REG(obj->_variables[SCRIPT_SPECIES_SELECTOR])); + sciprintf("Original address was %04x:%04x\n", PRINT_REG(obj_location)); + sciprintf("Species address was %04x:%04x\n", PRINT_REG(obj->_variables[SCRIPT_SPECIES_SELECTOR])); return kSelectorNone; } diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h index 1dedf9cea5..40a5d464ac 100644 --- a/engines/sci/engine/vm_types.h +++ b/engines/sci/engine/vm_types.h @@ -50,7 +50,6 @@ struct reg_t { } }; -#define PREG "%04x:%04x" #define PRINT_REG(r) (0xffff) & (unsigned) (r).segment, (unsigned) (r).offset // Stack pointer type @@ -60,7 +59,6 @@ typedef reg_t *StackPtr; typedef int Selector; #define NULL_SELECTOR -1 -#define PSTK "ST:%04x" #define PRINT_STK(v) (unsigned) (v - s->stack_base) static inline reg_t make_reg(int segment, int offset) { @@ -70,8 +68,6 @@ static inline reg_t make_reg(int segment, int offset) { return r; } -#define IS_NULL_REG(r) ((r).isNull()) -#define REG_EQ(a, b) ((a) == (b)) extern reg_t NULL_REG; } // End of namespace Sci -- cgit v1.2.3