LURE: Allocate debug strings buffer on the heap

This commit is contained in:
Julien 2011-06-05 06:03:54 +08:00 committed by Julien
parent 8a5bda72cc
commit 9ff993382e

View File

@ -549,14 +549,19 @@ bool Debugger::cmd_showAnim(int argc, const char **argv) {
}
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;
}
StringData &strings = StringData::getReference();
char *buffer = (char *)malloc(32768);
if (!buffer) {
DebugPrintf("Cannot allocate strings buffer\n");
return true;
}
uint16 id = strToInt(argv[1]);
strings.getString(id, buffer, NULL, NULL);
DebugPrintf("%s\n", buffer);
@ -577,6 +582,9 @@ bool Debugger::cmd_saveStrings(int argc, const char **argv) {
DebugPrintf("Done\n");
*/
free(buffer);
return true;
}