diff options
author | Colin Snover | 2016-09-15 16:23:27 -0500 |
---|---|---|
committer | Colin Snover | 2016-09-29 19:39:16 -0500 |
commit | 25c874b9cd370cab26ebef6e8e30786e39823c21 (patch) | |
tree | af6b035c2179db3692d482239d5e65a81e27653f | |
parent | 4072714143a3b532ac22c73022b931e17af4d5d9 (diff) | |
download | scummvm-rg350-25c874b9cd370cab26ebef6e8e30786e39823c21.tar.gz scummvm-rg350-25c874b9cd370cab26ebef6e8e30786e39823c21.tar.bz2 scummvm-rg350-25c874b9cd370cab26ebef6e8e30786e39823c21.zip |
SCI32: Add more debugger support for dumping SCI32 arrays
-rw-r--r-- | engines/sci/console.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 6d04b82dc6..32db2e9d69 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2802,10 +2802,49 @@ bool Console::cmdViewReference(int argc, const char **argv) { switch (_engine->_gamestate->_segMan->getSegmentType(reg.getSegment())) { #ifdef ENABLE_SCI32 case SEG_TYPE_ARRAY: { - debugPrintf("SCI32 array:\n"); - // TODO: Different prints for different types const SciArray *array = _engine->_gamestate->_segMan->lookupArray(reg); - hexDumpReg((reg_t *)array->getRawData(), array->size(), 4, 0, true); + const char *arrayType; + switch (array->getType()) { + case kArrayTypeID: + arrayType = "reg_t"; + break; + case kArrayTypeByte: + arrayType = "byte"; + break; + case kArrayTypeInt16: + arrayType = "int16"; + break; + case kArrayTypeString: + arrayType = "string"; + break; + default: + arrayType = "invalid"; + break; + } + debugPrintf("SCI32 %s array (%u entries):\n", arrayType, array->size()); + switch (array->getType()) { + case kArrayTypeID: + hexDumpReg((reg_t *)array->getRawData(), array->size(), 4, 0, true); + break; + case kArrayTypeByte: + case kArrayTypeString: { + Common::hexdump((byte *)array->getRawData(), array->size(), 16, 0); + break; + } + case kArrayTypeInt16: { + const int16 *data = (const int16 *)array->getRawData(); + for (int i = 0; i < array->size(); ++i) { + debugN("% 6d ", *data++); + if ((i % 8) == 0) { + debugN("\n"); + } + } + break; + } + default: + break; + } + break; } case SEG_TYPE_BITMAP: { |