aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/script.cpp44
-rw-r--r--engines/sci/engine/scriptconsole.cpp2
-rw-r--r--engines/sci/engine/scriptdebug.cpp6
-rw-r--r--engines/sci/scicore/sciconsole.h3
4 files changed, 13 insertions, 42 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 4166594590..269fd0ff47 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -212,32 +212,6 @@ void script_map_selectors(EngineState *s, selector_map_t *map) {
FIND_SELECTOR(syncTime);
}
-int sci_hexdump(byte *data, int length, int offsetplus) {
- char tempstr[40];
- int i;
-
- for (i = 0; i < length; i += 8) {
- int j;
-
- sprintf(tempstr, "%04x: ", i + offsetplus);
- for (j = 0; j < MIN(8, length - i); j++)
- sprintf(tempstr + 6 + (j*3) + (j > 3), "%02x ", data[i+j]);
- for (j = 0; j < MIN(8, length - i); j++) {
- int thechar;
- thechar = data[i+j];
- sprintf(tempstr + 31 + j, "%c", ((thechar < ' ') || (thechar > 127)) ? '.' : thechar);
- }
-
- for (j = 0; j < 38; j++)
- if (!tempstr[j])
- tempstr[j] = ' '; // get rid of sprintf's \0s
-
- sciprintf("%s\n", tempstr);
- }
-
- return 0;
-}
-
static void script_dump_object(char *data, int seeker, int objsize, const Common::StringList &selectorNames) {
int selectors, overloads, selectorsize;
int species = (int16)READ_LE_UINT16((unsigned char *) data + 8 + seeker);
@@ -247,7 +221,7 @@ static void script_dump_object(char *data, int seeker, int objsize, const Common
sciprintf("Object\n");
- sci_hexdump((unsigned char *) data + seeker, objsize - 4, seeker);
+ Common::hexdump((unsigned char *) data + seeker, objsize - 4, 16, seeker);
//-4 because the size includes the two-word header
sciprintf("Name: %s\n", namepos ? ((char *)(data + namepos)) : "<unknown>");
@@ -289,7 +263,7 @@ static void script_dump_class(char *data, int seeker, int objsize, const Common:
sciprintf("Class\n");
- sci_hexdump((unsigned char *) data + seeker, objsize - 4, seeker);
+ Common::hexdump((unsigned char *) data + seeker, objsize - 4, 16, seeker);
sciprintf("Name: %s\n", namepos ? ((char *)data + namepos) : "<unknown>");
sciprintf("Superclass: %x\n", superclass);
@@ -370,19 +344,19 @@ void script_dissect(ResourceManager *resmgr, int res_no, const Common::StringLis
case sci_obj_code: {
sciprintf("Code\n");
- sci_hexdump(script->data + seeker, objsize - 4, seeker);
+ Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
};
break;
case 3: {
sciprintf("<unknown>\n");
- sci_hexdump(script->data + seeker, objsize - 4, seeker);
+ Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
};
break;
case sci_obj_said: {
sciprintf("Said\n");
- sci_hexdump(script->data + seeker, objsize - 4, seeker);
+ Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
sciprintf("%04x: ", seeker);
while (seeker < _seeker) {
@@ -447,25 +421,25 @@ void script_dissect(ResourceManager *resmgr, int res_no, const Common::StringLis
case sci_obj_exports: {
sciprintf("Exports\n");
- sci_hexdump((unsigned char *)script->data + seeker, objsize - 4, seeker);
+ Common::hexdump((unsigned char *)script->data + seeker, objsize - 4, 16, seeker);
};
break;
case sci_obj_pointers: {
sciprintf("Pointers\n");
- sci_hexdump(script->data + seeker, objsize - 4, seeker);
+ Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
};
break;
case 9: {
sciprintf("<unknown>\n");
- sci_hexdump(script->data + seeker, objsize - 4, seeker);
+ Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
};
break;
case sci_obj_localvars: {
sciprintf("Local vars\n");
- sci_hexdump(script->data + seeker, objsize - 4, seeker);
+ Common::hexdump(script->data + seeker, objsize - 4, 16, seeker);
};
break;
diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp
index c127d2454b..1894c0e8aa 100644
--- a/engines/sci/engine/scriptconsole.cpp
+++ b/engines/sci/engine/scriptconsole.cpp
@@ -912,7 +912,7 @@ static int c_dump(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
else {
Resource *resource = s->resmgr->findResource(res, cmdParams[1].val, 0);
if (resource)
- sci_hexdump(resource->data, resource->size, 0);
+ Common::hexdump(resource->data, resource->size, 16, 0);
else
sciprintf("Resource %s.%03d not found\n", cmdParams[0].str, cmdParams[1].val);
}
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 3463ff794c..1584d2b2ac 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -145,7 +145,7 @@ static void midi_hexdump(byte *data, int size, int notational_offset) { // Speci
fprintf(stderr, "Track broken at %x after"
" offset mod of %d\n",
offset + notational_offset, offset_mod);
- sci_hexdump(data, size, notational_offset);
+ Common::hexdump(data, size, 16, notational_offset);
return;
}
fprintf(stderr, "(rs %02x) ", cmd);
@@ -481,7 +481,7 @@ static void _c_single_seg_info(EngineState *s, MemObject *mobj) {
sciprintf("dynmem (%s): %d bytes\n",
(*(DynMem *)mobj)._description ? (*(DynMem *)mobj)._description : "no description", (*(DynMem *)mobj)._size);
- sci_hexdump((*(DynMem *)mobj)._buf, (*(DynMem *)mobj)._size, 0);
+ Common::hexdump((*(DynMem *)mobj)._buf, (*(DynMem *)mobj)._size, 16, 0);
}
break;
@@ -618,7 +618,7 @@ static int c_vr(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
if (reg_end.segment != 0)
sciprintf("Block size less than or equal to %d\n", size);
- sci_hexdump(block, size, 0);
+ Common::hexdump(block, size, 16, 0);
}
break;
diff --git a/engines/sci/scicore/sciconsole.h b/engines/sci/scicore/sciconsole.h
index e4fc867e10..1f3a4d2d5a 100644
--- a/engines/sci/scicore/sciconsole.h
+++ b/engines/sci/scicore/sciconsole.h
@@ -148,9 +148,6 @@ int con_hook_int(int *pointer, const char *name, const char *description);
** The internal list of int references is used by some of the basic commands.
*/
-
-int sci_hexdump(byte *data, int length, int offsetplus);
-
} // End of namespace Sci
#endif // SCI_SCICORE_SCICONSOLE_H