From 5d90c6fb3efd4e5c6544a550ff603b96db23f331 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 22 Jan 2013 01:53:50 +0200 Subject: SCI: Use underscores as substitute characters for spaces in object names This helps in debugging objects with spaces in their names (e.g. the "Glass Jar" object in Pepper - bug #3601090). Now, this object can be examined like "vo Glass_Jar" --- engines/sci/console.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 5ae8245e5a..2019415ecc 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -3764,6 +3764,8 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV charsCountObject++; if ((*strLoop >= 'I') && (*strLoop <= 'Z')) charsCountObject++; + if (*strLoop == '_') // underscores are used as substitutes for spaces in object names + charsCountObject++; } strLoop++; } @@ -3836,10 +3838,16 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV index = strtol(tmp + 1, &endptr, 16); if (*endptr) return -1; - // Chop of the index + // Chop off the index str_objname = Common::String(str_objname.c_str(), tmp); } + // Replace all underscores in the name with spaces + for (int i = 0; i < str_objname.size(); i++) { + if (str_objname[i] == '_') + str_objname.setChar(' ', i); + } + // Now all values are available; iterate over all objects. *dest = s->_segMan->findObjectByName(str_objname, index); if (dest->isNull()) -- cgit v1.2.3 From cc1bb39956ce134474845eb5d0bb192db3059b55 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 22 Jan 2013 01:57:34 +0200 Subject: SCI: Add documentation for underscores in object names and fix a warning --- engines/sci/console.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 2019415ecc..1bf3323a7b 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -3633,6 +3633,8 @@ bool Console::cmdAddresses(int argc, const char **argv) { DebugPrintf(" - ?obj -- Looks up an object with the specified name, uses its address. This will abort if\n"); DebugPrintf(" the object name is ambiguous; in that case, a list of addresses and indices is provided.\n"); DebugPrintf(" ?obj.idx may be used to disambiguate 'obj' by the index 'idx'.\n"); + DebugPrintf(" Underscores are used as substitute characters for spaces in object names.\n"); + DebugPrintf(" For example, an object named \"Glass Jar\" can be accessed as \"Glass_Jar\".\n"); return true; } @@ -3843,7 +3845,7 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV } // Replace all underscores in the name with spaces - for (int i = 0; i < str_objname.size(); i++) { + for (uint i = 0; i < str_objname.size(); i++) { if (str_objname[i] == '_') str_objname.setChar(' ', i); } -- cgit v1.2.3 From fbc1aac6a94e371e6a071d90d2938cc9985d2288 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 15 Apr 2013 21:02:27 +0200 Subject: SCI: Fix uninitialized variables --- engines/sci/console.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 1bf3323a7b..cd5dea3ce2 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -284,6 +284,7 @@ void Console::postEnter() { #endif VideoState emptyState; + emptyState.reset(); emptyState.fileName = _videoFile; emptyState.flags = kDoubled; // always allow the videos to be double sized playVideo(videoDecoder, emptyState); -- cgit v1.2.3 From e34bfce2c26602550f3be579dd6c83fbed77b4e8 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 15 Apr 2013 21:05:44 +0200 Subject: SCI: Remove useless checks --- engines/sci/console.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index cd5dea3ce2..53b561f8c7 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2350,8 +2350,7 @@ bool Console::cmdVMVarlist(int argc, const char **argv) { for (int i = 0; i < 4; i++) { DebugPrintf("%s vars at %04x:%04x ", varnames[i], PRINT_REG(make_reg(s->variablesSegment[i], s->variables[i] - s->variablesBase[i]))); - if (s->variablesMax) - DebugPrintf(" total %d", s->variablesMax[i]); + DebugPrintf(" total %d", s->variablesMax[i]); DebugPrintf("\n"); } @@ -2408,7 +2407,7 @@ bool Console::cmdVMVars(int argc, const char **argv) { return true; } - if ((s->variablesMax) && (s->variablesMax[varType] <= varIndex)) { + if (s->variablesMax[varType] <= varIndex) { DebugPrintf("Maximum variable number for this type is %d (0x%x)\n", s->variablesMax[varType], s->variablesMax[varType]); return true; } -- cgit v1.2.3 From d17029dca2b7a1e74f1c0cffa82b1f28c52f20f7 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 15 Apr 2013 21:14:32 +0200 Subject: SCI: Add missing break --- engines/sci/console.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 53b561f8c7..c5ff6b454b 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2507,6 +2507,7 @@ bool Console::cmdValueType(int argc, const char **argv) { break; case SIG_TYPE_INTEGER: DebugPrintf("Integer"); + break; case SIG_TYPE_INTEGER | SIG_TYPE_NULL: DebugPrintf("Null"); break; -- cgit v1.2.3 From 23da164136271c5c1b79cef2c62d03d3b136ccbc Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 17 Apr 2013 23:33:51 +0200 Subject: SCI: Fix memory leak --- engines/sci/console.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index c5ff6b454b..50fae61de0 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2227,6 +2227,7 @@ bool Console::cmdIsSample(int argc, const char **argv) { DebugPrintf("Sample size: %d, sample rate: %d, channels: %d, digital channel number: %d\n", track->digitalSampleSize, track->digitalSampleRate, track->channelCount, track->digitalChannelNr); + delete soundRes; return true; } -- cgit v1.2.3