[Scummvm-cvs-logs] SF.net SVN: scummvm: [30496] tools/trunk/compress_scumm_bun.cpp
aquadran at users.sourceforge.net
aquadran at users.sourceforge.net
Tue Jan 15 20:44:38 CET 2008
Revision: 30496
http://scummvm.svn.sourceforge.net/scummvm/?rev=30496&view=rev
Author: aquadran
Date: 2008-01-15 11:44:38 -0800 (Tue, 15 Jan 2008)
Log Message:
-----------
added support for latest changes in dimuse, not test yet
Modified Paths:
--------------
tools/trunk/compress_scumm_bun.cpp
Modified: tools/trunk/compress_scumm_bun.cpp
===================================================================
--- tools/trunk/compress_scumm_bun.cpp 2008-01-15 19:34:35 UTC (rev 30495)
+++ tools/trunk/compress_scumm_bun.cpp 2008-01-15 19:44:38 UTC (rev 30496)
@@ -854,7 +854,7 @@
return outputBuf;
}
-void countMapElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs) {
+void countMapElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs, int &numMarkers) {
uint32 tag;
int32 size = 0;
@@ -862,6 +862,9 @@
tag = READ_BE_UINT32(ptr); ptr += 4;
switch(tag) {
case 'TEXT':
+ numMarkers++;
+ size = READ_BE_UINT32(ptr); ptr += size + 4;
+ break;
case 'STOP':
case 'FRMT':
case 'DATA':
@@ -902,6 +905,12 @@
byte *ptr;
};
+struct Marker {
+ int32 pos;
+ int32 length;
+ char *ptr;
+};
+
static Region *_region;
static int _numRegions;
@@ -992,14 +1001,16 @@
int curIndexRegion = 0;
int curIndexJump = 0;
int curIndexSync = 0;
+ int curIndexMarker = 0;
- int numRegions = 0, numJumps = 0, numSyncs = 0;
- countMapElements(ptr, numRegions, numJumps, numSyncs);
+ int numRegions = 0, numJumps = 0, numSyncs = 0, numMarkers = 0;
+ countMapElements(ptr, numRegions, numJumps, numSyncs, numMarkers);
Region *region = (Region *)malloc(sizeof(Region) * numRegions);
_region = (Region *)malloc(sizeof(Region) * numRegions);
_numRegions = numRegions;
Jump *jump = (Jump *)malloc(sizeof(Jump) * numJumps);
Sync *sync = (Sync *)malloc(sizeof(Sync) * numSyncs);
+ Marker *marker = (Marker *)malloc(sizeof(Marker) * numMarkers);
do {
tag = READ_BE_UINT32(ptr); ptr += 4;
@@ -1011,6 +1022,15 @@
channels = READ_BE_UINT32(ptr); ptr += 4;
break;
case 'TEXT':
+ if (!scumm_stricmp((const char *)(ptr + 8), "exit")) {
+ marker[curIndexRegion].pos = READ_BE_UINT32(ptr + 4);
+ marker[curIndexRegion].length = strlen((const char *)(ptr + 8)) + 1;
+ marker[curIndexRegion].ptr = new char[marker[curIndexRegion].length];
+ strcpy(marker[curIndexRegion].ptr, (const char *)(ptr + 8));
+ curIndexMarker++;
+ }
+ size = READ_BE_UINT32(ptr); ptr += size + 4;
+ break;
case 'STOP':
size = READ_BE_UINT32(ptr); ptr += size + 4;
break;
@@ -1050,13 +1070,14 @@
cbundleTable[cbundleCurIndex].offset = startPos;
writeUint32BE(output, 'RMAP');
- writeUint32BE(output, 2); // version
+ writeUint32BE(output, 3); // version
writeUint32BE(output, 16); // bits
writeUint32BE(output, freq);
writeUint32BE(output, channels);
writeUint32BE(output, numRegions);
writeUint32BE(output, numJumps);
writeUint32BE(output, numSyncs);
+ writeUint32BE(output, numMarkers);
memcpy(_region, region, sizeof(Region) * numRegions);
for (l = 0; l < numRegions; l++) {
_region[l].offset -= offsetData;
@@ -1081,9 +1102,16 @@
fwrite(sync[l].ptr, sync[l].size, 1, output);
free(sync[l].ptr);
}
+ for (l = 0; l < numMarkers; l++) {
+ writeUint32BE(output, marker[l].pos);
+ writeUint32BE(output, marker[l].length);
+ fwrite(marker[l].ptr, marker[l].length, 1, output);
+ delete[] marker[l].ptr;
+ }
free(region);
free(jump);
free(sync);
+ free(marker);
cbundleTable[cbundleCurIndex].size = ftell(output) - startPos;
cbundleCurIndex++;
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