CRYO: Use byteswap functions from common/endian.h
This commit is contained in:
parent
8ac0012fdd
commit
b2452d6ffd
3 changed files with 6 additions and 22 deletions
|
@ -32,22 +32,6 @@ namespace Cryo {
|
|||
|
||||
class CryoEngine;
|
||||
|
||||
#define SW16(n) ( (((n) & 0xFF) << 8) | (((n) >> 8) & 0xFF) )
|
||||
#define SW32(n) ( (((n) & 0xFF) << 24) | (((n) >> 24) & 0xFF) | (((n) & 0xFF00) << 8) | (((n) >> 8) & 0xFF00))
|
||||
#ifdef SCUMM_BIG_ENDIAN
|
||||
//big-endian host
|
||||
#define LE16(n) SW16(n)
|
||||
#define LE32(n) SW32(n)
|
||||
#define BE16(n) (n)
|
||||
#define BE32(n) (n)
|
||||
#else
|
||||
//little-endian host
|
||||
#define LE16(n) (n)
|
||||
#define LE32(n) (n)
|
||||
#define BE16(n) SW16(n)
|
||||
#define BE32(n) SW32(n)
|
||||
#endif
|
||||
|
||||
enum {
|
||||
fsFromStart = 1
|
||||
};
|
||||
|
|
|
@ -234,13 +234,13 @@ int EdenGame::loadSound(uint16 num) {
|
|||
|
||||
uint32 val = 0;
|
||||
_bigfile.read(&val, 3);
|
||||
unsigned int chunkLen = LE32(val);
|
||||
unsigned int chunkLen = FROM_LE_32(val);
|
||||
|
||||
if (chunkType == 5) {
|
||||
_bigfile.read(_gameLipsync + 7260, chunkLen);
|
||||
chunkType = _bigfile.readByte();
|
||||
_bigfile.read(&val, 3);
|
||||
chunkLen = LE32(val);
|
||||
chunkLen = FROM_LE_32(val);
|
||||
}
|
||||
|
||||
// 3. Normal sound data
|
||||
|
@ -259,7 +259,7 @@ void EdenGame::convertMacToPC() {
|
|||
// Array of longs
|
||||
int *p = (int *)_gameLipsync;
|
||||
for (int i = 0; i < 7240 / 4; i++)
|
||||
p[i] = BE32(p[i]);
|
||||
p[i] = FROM_BE_32(p[i]);
|
||||
}
|
||||
|
||||
void EdenGame::loadpermfiles() {
|
||||
|
@ -472,7 +472,7 @@ bool EdenGame::ReadDataSyncVOC(unsigned int num) {
|
|||
uint32 chunkLen = 0;
|
||||
loadpartoffile(resNum, &chunkLen, filePos, 3);
|
||||
filePos += 3;
|
||||
chunkLen = LE32(chunkLen);
|
||||
chunkLen = FROM_LE_32(chunkLen);
|
||||
loadpartoffile(resNum, _gameLipsync + 7260, filePos, chunkLen);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ void HnmPlayer::closeSound() {
|
|||
void HnmPlayer::loadDecompTable(int16 *buffer) {
|
||||
for (int16 i = 0; i < 256; i++) {
|
||||
int16 e = *buffer++;
|
||||
decompTable[i] = LE16(e);
|
||||
decompTable[i] = FROM_LE_16(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ void HnmPlayer::tryRead(int size) {
|
|||
bool HnmPlayer::loadFrame() {
|
||||
tryRead(4);
|
||||
int chunk = *(int *)_readBuffer;
|
||||
chunk = LE32(chunk);
|
||||
chunk = FROM_LE_32(chunk);
|
||||
chunk &= 0xFFFFFF; // upper bit - keyframe mark?
|
||||
if (!chunk)
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue