[Scummvm-cvs-logs] CVS: tools compress_san.cpp,1.9,1.10
Pawel Kolodziejski
aquadran at users.sourceforge.net
Fri Apr 23 14:06:06 CEST 2004
Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6831
Modified Files:
compress_san.cpp
Log Message:
fixed bugs: compress only first fobj in frame, fixes for flu stuff (seems to be not fully correct)
Index: compress_san.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/compress_san.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- compress_san.cpp 22 Apr 2004 12:21:00 -0000 1.9
+++ compress_san.cpp 23 Apr 2004 21:05:51 -0000 1.10
@@ -64,7 +64,7 @@
FILE *flu = NULL;
if (argc == 4) {
- flu = fopen(argv[3], "wb");
+ flu = fopen(argv[3], "rb+");
if (!flu) {
printf("Cannot open file: %s\n", argv[3]);
exit(-1);
@@ -93,6 +93,7 @@
for (l = 0; l < nbframes; l++) {
printf("frame: %d\n", l);
+ bool first_fobj = true;
tag = readUint32BE(input); // chunk tag
assert(tag == TO_LE_32('FRME'));
writeUint32BE(output, tag); // FRME
@@ -109,16 +110,8 @@
if (tag == TO_LE_32('FRME')) {
fseek(input, -4, SEEK_CUR);
break;
- } else if (tag != TO_LE_32('FOBJ')) {
- size = readUint32BE(input); // chunk size
- writeUint32BE(output, tag);
- writeUint32BE(output, size);
- if ((size & 1) != 0)
- size++;
- for (int k = 0; k < size; k++) {
- writeByte(output, readByte(input)); // chunk datas
- }
- } else if (tag == TO_LE_32('FOBJ')) {
+ } else if ((tag == TO_LE_32('FOBJ')) && (first_fobj)) {
+ first_fobj = false;
size = readUint32BE(input); // FOBJ size
if ((size & 1) != 0)
size++;
@@ -144,6 +137,16 @@
}
free(zlibInputBuffer);
free(zlibOutputBuffer);
+ continue;
+ } else {
+ size = readUint32BE(input); // chunk size
+ writeUint32BE(output, tag);
+ writeUint32BE(output, size);
+ if ((size & 1) != 0)
+ size++;
+ for (int k = 0; k < size; k++) {
+ writeByte(output, readByte(input)); // chunk datas
+ }
}
}
}
@@ -164,9 +167,9 @@
writeUint32BE(output, animChunkSize - sumDiff);
if (flu) {
- fseek(flu, 0x308, SEEK_SET);
+ fseek(flu, 0x310, SEEK_SET);
for (l = 0; l < nbframes; l++) {
- writeUint32BE(flu, frameInfo[l].offsetOutput - 4);
+ writeUint32LE(flu, frameInfo[l].offsetOutput - 4);
}
fclose(flu);
}
More information about the Scummvm-git-logs
mailing list