aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2007-12-16 08:14:14 +0000
committerPaul Gilbert2007-12-16 08:14:14 +0000
commit02beb045c5aa8b8b89cf40d2a2416e95b5d479fd (patch)
tree4a50db33a7f5c829358c785b3d5fba7702b414f4
parent258bd20a837c727744c57c1746b4d3da7bf4267a (diff)
downloadscummvm-rg350-02beb045c5aa8b8b89cf40d2a2416e95b5d479fd.tar.gz
scummvm-rg350-02beb045c5aa8b8b89cf40d2a2416e95b5d479fd.tar.bz2
scummvm-rg350-02beb045c5aa8b8b89cf40d2a2416e95b5d479fd.zip
Added a debugger method to show a specified entry in the string table
svn-id: r29872
-rw-r--r--engines/lure/debugger.cpp34
-rw-r--r--engines/lure/debugger.h1
2 files changed, 35 insertions, 0 deletions
diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp
index 70781e0f29..05d3767b9d 100644
--- a/engines/lure/debugger.cpp
+++ b/engines/lure/debugger.cpp
@@ -48,6 +48,7 @@ Debugger::Debugger(): GUI::Debugger() {
DCmd_Register("hotspot", WRAP_METHOD(Debugger, cmd_hotspot));
DCmd_Register("room", WRAP_METHOD(Debugger, cmd_room));
DCmd_Register("showanim", WRAP_METHOD(Debugger, cmd_showAnim));
+ DCmd_Register("strings", WRAP_METHOD(Debugger, cmd_saveStrings));
}
static int strToInt(const char *s) {
@@ -542,4 +543,37 @@ bool Debugger::cmd_showAnim(int argc, const char **argv) {
return true;
}
+bool Debugger::cmd_saveStrings(int argc, const char **argv) {
+ StringData &strings = StringData::getReference();
+ char buffer[32768];
+
+ if (argc != 2) {
+ DebugPrintf("strings <stringId>\n");
+ return true;
+ }
+
+ uint16 id = strToInt(argv[1]);
+ strings.getString(id, buffer, NULL, NULL);
+ DebugPrintf("%s\n", buffer);
+
+/* Commented out code for saving all text strings - note that 0x1000 is chosen
+ * arbitrarily, so there'll be a bunch of garbage at the end, or the game will crash
+
+ // Save all the strings to a text file - this
+
+ FILE *f = fopen("strings.txt", "w");
+
+ for (int index = 0; index < 0x1000; ++index) {
+ strings.getString(index, buffer);
+ fprintf(f, "%.4xh - %s\n", index, buffer);
+ }
+
+ fclose(f);
+
+ DebugPrintf("Done\n");
+*/
+ return true;
+}
+
+
} // End of namespace Lure
diff --git a/engines/lure/debugger.h b/engines/lure/debugger.h
index bced87debc..330dce7dad 100644
--- a/engines/lure/debugger.h
+++ b/engines/lure/debugger.h
@@ -46,6 +46,7 @@ protected:
bool cmd_hotspot(int argc, const char **argv);
bool cmd_room(int argc, const char **argv);
bool cmd_showAnim(int argc, const char **argv);
+ bool cmd_saveStrings(int argc, const char **argv);
};
} // End of namespace Lure