[Scummvm-cvs-logs] CVS: tools descumm6.cpp,1.69,1.70

Max Horn fingolfin at users.sourceforge.net
Fri Dec 27 06:54:02 CET 2002


Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1:/tmp/cvs-serv24110

Modified Files:
	descumm6.cpp 
Log Message:
disassmble V8 roomobj/verb scripts

Index: descumm6.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/descumm6.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- descumm6.cpp	27 Dec 2002 14:12:29 -0000	1.69
+++ descumm6.cpp	27 Dec 2002 14:53:06 -0000	1.70
@@ -671,23 +671,42 @@
 
 byte *skipVerbHeader(byte *p)
 {
-	byte code;
-	byte *p2 = p;
-	int hdrlen;
-
-	while ((code = *p2++) != 0) {
-		p2 += sizeof(unsigned short);
-	}
-
-	printf("Events:\n");
-
-	hdrlen = p2 - p + 8;
+	if (scriptVersion == 8) {
+		uint32 *ptr;
+		uint32 code;
+		int hdrlen;
+		
+		ptr = (uint32 *)p;
+		while (TO_LE_32(*ptr++) != 0) {
+			ptr++;
+		}
+		hdrlen = (byte *)ptr - p;
+		
+		ptr = (uint32 *)p;
+		while ((code = TO_LE_32(*ptr++)) != 0) {
+			printf("  %2X - %.4X\n", code, TO_LE_32(*ptr++) - hdrlen);
+		}
 
-	while ((code = *p++) != 0) {
-		printf("  %2X - %.4X\n", code, *(unsigned short *)p - hdrlen);
-		p += sizeof(unsigned short);
+		return (byte *)ptr;
+	} else {
+		byte code;
+		byte *p2 = p;
+		int hdrlen;
+	
+		while (*p2++ != 0) {
+			p2 += 2;
+		}
+	
+		printf("Events:\n");
+	
+		hdrlen = p2 - p + 8;
+	
+		while ((code = *p++) != 0) {
+			printf("  %2X - %.4X\n", code, *(uint16 *)p - hdrlen);
+			p += 2;
+		}
+		return p;
 	}
-	return p;
 }
 
 StackEnt *se_new(int type)





More information about the Scummvm-git-logs mailing list