[Scummvm-cvs-logs] CVS: tools compress_scumm_bun.cpp,1.6,1.7

Pawel Kolodziejski aquadran at users.sourceforge.net
Sun Jan 23 11:54:11 CET 2005


Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15438

Modified Files:
	compress_scumm_bun.cpp 
Log Message:
updated

Index: compress_scumm_bun.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/compress_scumm_bun.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- compress_scumm_bun.cpp	23 Jan 2005 19:18:34 -0000	1.6
+++ compress_scumm_bun.cpp	23 Jan 2005 19:53:42 -0000	1.7
@@ -836,18 +836,18 @@
 		byte *src = ptr;
 		for (int i = 0; i < inputSize; i++) {
 			uint16 val = (*src++ - 0x80) << 8;
-			*buf++ = (byte)val;
 			*buf++ = (byte)(val >> 8);
+			*buf++ = (byte)val;
 			if (freq == 11025) {
-				*buf++ = (byte)val;
 				*buf++ = (byte)(val >> 8);
+				*buf++ = (byte)val;
 			}
 			if (channels == 1) {
-				*buf++ = (byte)val;
 				*buf++ = (byte)(val >> 8);
+				*buf++ = (byte)val;
 				if (freq == 11025) {
-					*buf++ = (byte)val;
 					*buf++ = (byte)(val >> 8);
+					*buf++ = (byte)val;
 				}
 			}
 		}
@@ -863,37 +863,50 @@
 			byte v2 = *source++;
 			byte v3 = *source++;
 			value = ((((v2 & 0x0f) << 8) | v1) << 4) - 0x8000;
-			*decoded++ = (byte)(value & 0xff);
 			*decoded++ = (byte)((value >> 8) & 0xff);
+			*decoded++ = (byte)(value & 0xff);
 			if (freq == 11025) {
-				*decoded++ = (byte)(value & 0xff);
 				*decoded++ = (byte)((value >> 8) & 0xff);
+				*decoded++ = (byte)(value & 0xff);
 			}
 			if (channels == 1) {
-				*decoded++ = (byte)(value & 0xff);
 				*decoded++ = (byte)((value >> 8) & 0xff);
+				*decoded++ = (byte)(value & 0xff);
 				if (freq == 11025) {
-					*decoded++ = (byte)(value & 0xff);
 					*decoded++ = (byte)((value >> 8) & 0xff);
+					*decoded++ = (byte)(value & 0xff);
 				}
 			}
 			value = ((((v2 & 0xf0) << 4) | v3) << 4) - 0x8000;
-			*decoded++ = (byte)(value & 0xff);
 			*decoded++ = (byte)((value >> 8) & 0xff);
+			*decoded++ = (byte)(value & 0xff);
 			if (freq == 11025) {
-				*decoded++ = (byte)(value & 0xff);
 				*decoded++ = (byte)((value >> 8) & 0xff);
+				*decoded++ = (byte)(value & 0xff);
 			}
 			if (channels == 1) {
-				*decoded++ = (byte)(value & 0xff);
 				*decoded++ = (byte)((value >> 8) & 0xff);
+				*decoded++ = (byte)(value & 0xff);
 				if (freq == 11025) {
-					*decoded++ = (byte)(value & 0xff);
 					*decoded++ = (byte)((value >> 8) & 0xff);
+					*decoded++ = (byte)(value & 0xff);
 				}
 			}
 		}
 	}
+	if (bits == 16) {
+		int loop_size = inputSize / 2;
+		byte *buf = outputBuf;
+		byte *src = ptr;
+		while (loop_size--) {
+			*buf++ = *src++;
+			*buf++ = *src++;
+			if (channels == 1) {
+				*buf++ = *src++;
+				*buf++ = *src++;
+			}
+		}
+	}
 
 	return outputBuf;
 }
@@ -1115,13 +1128,12 @@
 		writeRegions(compFinal + offsetData);
 		byte *outputData = convertTo16bitStereo(compFinal + offsetData, size - offsetData, outputSize, bits, freq, channels);
 
+		free(compFinal);
 		char tmp2Path[200];
 		sprintf(tmp2Path, "%s/%s.wav", outputDir, bundleTable[h].filename);
-		_waveTmpFile = NULL;
 		writeToTempWave(tmp2Path, outputData, outputSize);
 		writeWaveHeader(_waveDataSize);
-		fclose(_waveTmpFile);
-		free(compFinal);
+		free(outputData);
 	}
 
 	free(bundleTable);





More information about the Scummvm-git-logs mailing list