[Scummvm-cvs-logs] SF.net SVN: scummvm: [30977] tools/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Feb 26 20:41:33 CET 2008
Revision: 30977
http://scummvm.svn.sourceforge.net/scummvm/?rev=30977&view=rev
Author: fingolfin
Date: 2008-02-26 11:41:33 -0800 (Tue, 26 Feb 2008)
Log Message:
-----------
Fix compress_saga to work on big endian systems
Modified Paths:
--------------
tools/trunk/compress_saga.cpp
tools/trunk/util.h
tools/trunk/utils/adpcm.cpp
tools/trunk/utils/voc.cpp
Modified: tools/trunk/compress_saga.cpp
===================================================================
--- tools/trunk/compress_saga.cpp 2008-02-26 19:10:21 UTC (rev 30976)
+++ tools/trunk/compress_saga.cpp 2008-02-26 19:41:33 UTC (rev 30977)
@@ -313,8 +313,6 @@
uint32 voxSize = voxStream->readBuffer((int16*)buffer, inputSize * 2);
if (voxSize != inputSize * 2)
error("Wrong VOX output size");
- for (uint32 i = 0; i < sampleSize; i++)
- buffer[i] = TO_LE_16(buffer[i]);
writeBufferToFile((uint8 *)buffer, sampleSize, TEMP_RAW);
free(buffer);
Modified: tools/trunk/util.h
===================================================================
--- tools/trunk/util.h 2008-02-26 19:10:21 UTC (rev 30976)
+++ tools/trunk/util.h 2008-02-26 19:41:33 UTC (rev 30977)
@@ -104,21 +104,6 @@
#define GCC_PRINTF(x,y)
#endif
-#define READ_UINT16(a) READ_LE_UINT16(a)
-#define READ_UINT32(a) READ_LE_UINT32(a)
-
-#define WRITE_UINT16(a, v) WRITE_LE_UINT16(a, v)
-#define WRITE_UINT32(a, v) WRITE_LE_UINT32(a, v)
-
-#define FROM_LE_32(a) ((uint32)(a))
-#define FROM_LE_16(a) ((uint16)(a))
-
-#define TO_LE_32(a) ((uint32)(a))
-#define TO_LE_16(a) ((uint16)(a))
-
-#define TO_BE_32(a) SWAP_BYTES_32(a)
-#define TO_BE_16(a) SWAP_BYTES_16(a)
-
#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
static inline uint32 SWAP_32(uint32 a) {
Modified: tools/trunk/utils/adpcm.cpp
===================================================================
--- tools/trunk/utils/adpcm.cpp 2008-02-26 19:10:21 UTC (rev 30976)
+++ tools/trunk/utils/adpcm.cpp 2008-02-26 19:41:33 UTC (rev 30977)
@@ -128,8 +128,8 @@
for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
data = _stream->readByte();
- buffer[samples] = TO_LE_16(decodeOKI((data >> 4) & 0x0f));
- buffer[samples + 1] = TO_LE_16(decodeOKI(data & 0x0f));
+ WRITE_LE_UINT16(buffer + samples, decodeOKI((data >> 4) & 0x0f));
+ WRITE_LE_UINT16(buffer + samples + 1, decodeOKI(data & 0x0f));
}
return samples;
}
@@ -154,8 +154,8 @@
for (; samples < numSamples && _blockPos < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
data = _stream->readByte();
_blockPos++;
- buffer[samples] = TO_LE_16(decodeMSIMA(data & 0x0f));
- buffer[samples + 1] = TO_LE_16(decodeMSIMA((data >> 4) & 0x0f));
+ WRITE_LE_UINT16(buffer + samples, decodeMSIMA(data & 0x0f));
+ WRITE_LE_UINT16(buffer + samples + 1, decodeMSIMA((data >> 4) & 0x0f));
}
}
return samples;
@@ -175,7 +175,7 @@
for (nibble = 0; nibble < 8; nibble++) {
byte k = ((data & 0xf0000000) >> 28);
- buffer[samples + channel + nibble * 2] = TO_LE_16(decodeMSIMA(k));
+ WRITE_LE_UINT16(buffer + samples + channel + nibble * 2, decodeMSIMA(k));
data <<= 4;
}
}
@@ -230,8 +230,8 @@
for (; samples < numSamples && _blockPos < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
data = _stream->readByte();
_blockPos++;
- buffer[samples] = TO_LE_16(decodeMS(&_status.ch[0], (data >> 4) & 0x0f));
- buffer[samples + 1] = TO_LE_16(decodeMS(&_status.ch[stereo], data & 0x0f));
+ WRITE_LE_UINT16(buffer + samples, decodeMS(&_status.ch[0], (data >> 4) & 0x0f));
+ WRITE_LE_UINT16(buffer + samples + 1, decodeMS(&_status.ch[stereo], data & 0x0f));
}
}
Modified: tools/trunk/utils/voc.cpp
===================================================================
--- tools/trunk/utils/voc.cpp 2008-02-26 19:10:21 UTC (rev 30976)
+++ tools/trunk/utils/voc.cpp 2008-02-26 19:41:33 UTC (rev 30977)
@@ -64,9 +64,9 @@
if (fileHeader.desc[19] != 0x1A)
debug(3, "loadVOCFromStream: Partially invalid header");
- int32 offset = FROM_LE_16(fileHeader.datablock_offset);
- int16 version = FROM_LE_16(fileHeader.version);
- int16 code = FROM_LE_16(fileHeader.id);
+ int32 offset = READ_LE_UINT16(&fileHeader.datablock_offset);
+ int16 version = READ_LE_UINT16(&fileHeader.version);
+ int16 code = READ_LE_UINT16(&fileHeader.id);
assert(offset == sizeof(VocFileHeader));
// 0x100 is an invalid VOC version used by German version of DOTT (Disk) and
// French version of Simon the Sorcerer 2 (CD)
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