[Scummvm-cvs-logs] SF.net SVN: scummvm:[40505] tools/trunk/extract_gob_stk.cpp

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Tue May 12 21:33:03 CEST 2009


Revision: 40505
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40505&view=rev
Author:   strangerke
Date:     2009-05-12 19:33:03 +0000 (Tue, 12 May 2009)

Log Message:
-----------
Add some comments on PreGob compression. Displays the TOT real size when known (meaning : when file size is less than 32K)

Modified Paths:
--------------
    tools/trunk/extract_gob_stk.cpp

Modified: tools/trunk/extract_gob_stk.cpp
===================================================================
--- tools/trunk/extract_gob_stk.cpp	2009-05-12 19:24:11 UTC (rev 40504)
+++ tools/trunk/extract_gob_stk.cpp	2009-05-12 19:33:03 UTC (rev 40505)
@@ -350,7 +350,6 @@
 
 // Some LZ77-variant
 byte *unpackPreGobData(byte *src, uint32 &size, uint32 &compSize) {
-//	uint32 counter;
 	uint16 cmd;
 	byte tmpBuf[4114];
 	int16 off;
@@ -362,19 +361,29 @@
 	newCounter = compSize;
 	size = 0;
 
-    dummy1 = READ_LE_UINT32(src);
-	READ_LE_UINT16(src);
+    dummy1 = READ_LE_UINT16(src);
+	src+=2;
+	newCounter -= 2;
 
-//	counter = size = 32768;//READ_LE_UINT32(src);
+//  The 6 first bytes are grouped by 2 :
+//  - bytes 0&1 : if set to 0xFFFF, the real size is in bytes 2&3. Else : not understand
+//  - bytes 2&3 : Either the real size or 0x007D. Directly related to the size of the file.
+//  - bytes 4&5 : 0x0000 (files are small) ;)
+	if (dummy1 == 0xFFFF)
+		printf("Real size %d\n",READ_LE_UINT32(src));
+	else
+		printf("Unknown real size %xX %xX\n",dummy1>>8, dummy1&0x00FF);
 
+//	counter = size = READ_LE_UINT32(src);
+
 	for (int i = 0; i < 4078; i++)
 		tmpBuf[i] = 0x20;
 	tmpIndex = 4078;
 
-	src += 6; 
-	newCounter -= 6;
+	src += 4; 
+	newCounter -= 4;
 
-	byte *unpacked = new byte[500000];//[size];
+	byte *unpacked = new byte[500000];//[size] Replaced by dummy as real size is not always known;
 	byte *dest = unpacked;
 
 	cmd = 0;


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