[Scummvm-cvs-logs] scummvm master -> 2c9d30e7370dabf2132dba8631748d8841e61517

ScummVM git noreply at scummvm.org
Sun Feb 13 00:35:43 CET 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
15b3bffb7f SCI: Fix the console's hexgrep command
2c9d30e737 SCI: Don't limit the number of resources to 999 in hexgrep


Commit: 15b3bffb7ff8f0ee8091e62cddb1682f2bf8d2d2
    https://github.com/scummvm/scummvm/commit/15b3bffb7ff8f0ee8091e62cddb1682f2bf8d2d2
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-12T15:30:26-08:00

Commit Message:
SCI: Fix the console's hexgrep command

Changed paths:
    engines/sci/console.cpp



diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 562b770..9510ed0 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -773,17 +773,16 @@ bool Console::cmdResourceTypes(int argc, const char **argv) {
 
 bool Console::cmdHexgrep(int argc, const char **argv) {
 	if (argc < 4) {
-		DebugPrintf("Searches some resources for a particular sequence of bytes, represented as hexadecimal numbers.\n");
+		DebugPrintf("Searches some resources for a particular sequence of bytes, represented as decimal or hexadecimal numbers.\n");
 		DebugPrintf("Usage: %s <resource type> <resource number> <search string>\n", argv[0]);
 		DebugPrintf("<resource number> can be a specific resource number, or \"all\" for all of the resources of the specified type\n");
-		DebugPrintf("EXAMPLES:\n  hexgrep script all e8 03 c8 00\n  hexgrep pic 042 fe");
+		DebugPrintf("EXAMPLES:\n  hexgrep script all 0xe8 0x03 0xc8 0x00\n  hexgrep pic 0x42 0xfe\n");
 		cmdResourceTypes(argc, argv);
 		return true;
 	}
 
 	ResourceType restype = parseResourceType(argv[1]);
 	int resNumber = 0, resMax = 0;
-	char seekString[500];
 	Resource *script = NULL;
 
 	if (restype == kResourceTypeInvalid) {
@@ -798,12 +797,13 @@ bool Console::cmdHexgrep(int argc, const char **argv) {
 		resNumber = resMax = atoi(argv[2]);
 	}
 
-	strcpy(seekString, argv[3]);
+	// Convert the bytes
+	Common::Array<int> byteString;
+	byteString.resize(argc - 3);
 
-	// Construct the seek string
-	for (int i = 4; i < argc; i++) {
-		strcat(seekString, argv[i]);
-	}
+	for (uint i = 0; i < byteString.size(); i++)
+		if (!parseInteger(argv[i + 3], byteString[i]))
+			return true;
 
 	for (; resNumber <= resMax; resNumber++) {
 		script = _engine->getResMan()->findResource(ResourceId(restype, resNumber), 0);
@@ -813,13 +813,13 @@ bool Console::cmdHexgrep(int argc, const char **argv) {
 			int output_script_name = 0;
 
 			while (seeker < script->size) {
-				if (script->data[seeker] == seekString[comppos]) {
+				if (script->data[seeker] == byteString[comppos]) {
 					if (comppos == 0)
 						seekerold = seeker;
 
 					comppos++;
 
-					if (comppos == strlen(seekString)) {
+					if (comppos == byteString.size()) {
 						comppos = 0;
 						seeker = seekerold + 1;
 


Commit: 2c9d30e7370dabf2132dba8631748d8841e61517
    https://github.com/scummvm/scummvm/commit/2c9d30e7370dabf2132dba8631748d8841e61517
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-02-12T15:33:52-08:00

Commit Message:
SCI: Don't limit the number of resources to 999 in hexgrep

Changed paths:
    engines/sci/console.cpp



diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 9510ed0..d77ac85 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -792,7 +792,7 @@ bool Console::cmdHexgrep(int argc, const char **argv) {
 
 	if (!scumm_stricmp(argv[2], "all")) {
 		resNumber = 0;
-		resMax = 999;
+		resMax = 65535;
 	} else {
 		resNumber = resMax = atoi(argv[2]);
 	}






More information about the Scummvm-git-logs mailing list