[Scummvm-cvs-logs] SF.net SVN: scummvm:[40978] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri May 29 10:59:13 CEST 2009
Revision: 40978
http://scummvm.svn.sourceforge.net/scummvm/?rev=40978&view=rev
Author: thebluegr
Date: 2009-05-29 08:59:13 +0000 (Fri, 29 May 2009)
Log Message:
-----------
Moved the "size" console debugger command to console.cpp and silenced a warning
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/console.h
scummvm/trunk/engines/sci/engine/game.cpp
scummvm/trunk/engines/sci/engine/sciconsole.cpp
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2009-05-29 08:46:20 UTC (rev 40977)
+++ scummvm/trunk/engines/sci/console.cpp 2009-05-29 08:59:13 UTC (rev 40978)
@@ -89,6 +89,7 @@
DCmd_Register("hexdump", WRAP_METHOD(Console, cmdHexDump));
DCmd_Register("dissect_script", WRAP_METHOD(Console, cmdDissectScript));
DCmd_Register("room", WRAP_METHOD(Console, cmdRoomNumber));
+ DCmd_Register("size", WRAP_METHOD(Console, cmdResourceSize));
}
Console::~Console() {
@@ -330,4 +331,33 @@
return true;
}
+bool Console::cmdResourceSize(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("Shows the size of a resource\n");
+ DebugPrintf("Usage: %s <resource number>\n", argv[0]);
+ return true;
+ }
+
+ int resNum = atoi(argv[2]);
+ if (resNum == 0) {
+ DebugPrintf("The resource number specified is not a number");
+ return true;
+ }
+
+ ResourceType res = parseResourceType(argv[1]);
+
+ if (res == kResourceTypeInvalid)
+ DebugPrintf("Resource type '%s' is not valid\n", argv[1]);
+ else {
+ Resource *resource = _vm->getResMgr()->findResource(res, resNum, 0);
+ if (resource) {
+ DebugPrintf("Resource size: %d\n", resource->size);
+ } else {
+ DebugPrintf("Resource %s.%03d not found\n", argv[1], resNum);
+ }
+ }
+
+ return true;
+}
+
} // End of namespace Sci
Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h 2009-05-29 08:46:20 UTC (rev 40977)
+++ scummvm/trunk/engines/sci/console.h 2009-05-29 08:59:13 UTC (rev 40978)
@@ -54,6 +54,7 @@
bool cmdHexDump(int argc, const char **argv);
bool cmdDissectScript(int argc, const char **argv);
bool cmdRoomNumber(int argc, const char **argv);
+ bool cmdResourceSize(int argc, const char **argv);
private:
SciEngine *_vm;
Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp 2009-05-29 08:46:20 UTC (rev 40977)
+++ scummvm/trunk/engines/sci/engine/game.cpp 2009-05-29 08:59:13 UTC (rev 40978)
@@ -323,7 +323,7 @@
// Map the class ID to the script the corresponding class is contained in
// The script number is found in vocab.996, if it exists
- if (!vocab996 || classnr >= vocab996->size >> 2)
+ if (!vocab996 || (uint32)classnr >= vocab996->size >> 2)
sugg_script = -1;
else
sugg_script = (int16)READ_LE_UINT16(vocab996->data + 2 + (classnr << 2));
Modified: scummvm/trunk/engines/sci/engine/sciconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/sciconsole.cpp 2009-05-29 08:46:20 UTC (rev 40977)
+++ scummvm/trunk/engines/sci/engine/sciconsole.cpp 2009-05-29 08:59:13 UTC (rev 40978)
@@ -40,7 +40,6 @@
static int c_man(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // 'manual page'
static int c_set(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // sets an int variable
static int c_print(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // prints a variable
-static int c_size(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // displays the size of a resource
//static int c_objinfo(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // shows some info about one class
//static int c_objmethods(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Disassembles all methods of a class
static int c_hexgrep(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Searches a string in one resource or resource class
@@ -166,7 +165,6 @@
con_hook_command(&c_man, "man", "s", "Gives a short description of something");
con_hook_command(&c_print, "print", "s", "Prints an int variable");
con_hook_command(&c_set, "set", "si", "Sets an int variable");
- con_hook_command(&c_size, "size", "si", "Displays the size of a resource");
con_hook_command(&c_hexgrep, "hexgrep", "shh*", "Searches some resources for a\n"
" particular sequence of bytes, re-\n presented as hexadecimal numbers.\n\n"
"EXAMPLES:\n hexgrep script e8 03 c8 00\n hexgrep pic.042 fe");
@@ -829,21 +827,6 @@
return 0;
}
-static int c_size(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- ResourceType res = parseResourceType(cmdParams[0].str);
- if (res == kResourceTypeInvalid)
- sciprintf("Resource type '%s' is not valid\n", cmdParams[0].str);
- else {
- Resource *resource = s->resmgr->findResource(res, cmdParams[1].val, 0);
- if (resource) {
- sciprintf("Size: %d\n", resource->size);
- } else
- sciprintf("Resource %s.%03d not found\n", cmdParams[0].str, cmdParams[1].val);
- }
-
- return 0;
-}
-
static int c_hexgrep(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
int i, seeklen, resnr, resmax;
unsigned char *seekstr = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list