aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-06-14 18:52:30 +0000
committerMax Horn2003-06-14 18:52:30 +0000
commitf7a8cbf7c73479ff086276ef04b0fea15085a13a (patch)
tree681f750d30d6e128bdeee471df0472a8d3cb6be3
parent9658dd6ea367ce71e1928003236c1801c5e3b1ee (diff)
downloadscummvm-rg350-f7a8cbf7c73479ff086276ef04b0fea15085a13a.tar.gz
scummvm-rg350-f7a8cbf7c73479ff086276ef04b0fea15085a13a.tar.bz2
scummvm-rg350-f7a8cbf7c73479ff086276ef04b0fea15085a13a.zip
Patch #754151: Removed READ_*_UNALIGNED and always read stuff bytewise; augmented by some more changes of mine
svn-id: r8482
-rw-r--r--common/scummsys.h128
-rw-r--r--scumm/akos.cpp2
-rw-r--r--scumm/gfx.cpp4
-rw-r--r--scumm/imuse.cpp2
-rw-r--r--scumm/imuse_digi.cpp30
-rw-r--r--scumm/object.cpp10
-rw-r--r--scumm/resource.cpp14
-rw-r--r--scumm/resource.h2
-rw-r--r--scumm/saveload.cpp2
-rw-r--r--scumm/script_v5.cpp6
-rw-r--r--scumm/scummvm.cpp2
-rw-r--r--scumm/smush/imuse_channel.cpp12
-rw-r--r--scumm/smush/saud_channel.cpp4
-rw-r--r--scumm/sound.cpp30
-rw-r--r--scumm/verbs.cpp2
-rw-r--r--simon/charset.cpp2
-rw-r--r--simon/debug.cpp34
-rw-r--r--simon/simon.cpp50
-rw-r--r--simon/vga.cpp44
19 files changed, 180 insertions, 200 deletions
diff --git a/common/scummsys.h b/common/scummsys.h
index 95cdd0d57b..5ab6c9f85a 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -301,12 +301,21 @@
#error No system type defined
#endif
-#define SWAP_BYTES(a) ((((a) >> 24) & 0xFF) | (((a) >> 8) & 0xFF00) | \
- (((a) << 8) & 0xFF0000) | (((a) << 24) & 0xFF000000))
+FORCEINLINE uint32 SWAP_BYTES_32(uint32 a) {
+ return ((a >> 24) & 0x000000FF) |
+ ((a >> 8) & 0x0000FF00) |
+ ((a << 8) & 0x00FF0000) |
+ ((a << 24) & 0xFF000000);
+}
+
+FORCEINLINE uint16 SWAP_BYTES_16(uint16 a) {
+ return ((a >> 8) & 0x00FF) + ((a << 8) & 0xFF00);
+}
+
#if defined(SCUMM_LITTLE_ENDIAN)
- #define PROTO_MKID(a) SWAP_BYTES(a)
+ #define PROTO_MKID(a) SWAP_BYTES_32(a)
#define PROTO_MKID_BE(a) (a & 0xffffffff)
#if defined(INVERSE_MKID)
@@ -317,107 +326,78 @@
# define MKID_BE(a) PROTO_MKID_BE(a)
#endif
- #if defined(SCUMM_NEED_ALIGNMENT)
- FORCEINLINE uint READ_LE_UINT16(const void *ptr) {
- return (((const byte *)ptr)[1] << 8)|((const byte *)ptr)[0];
- }
- #else
- FORCEINLINE uint READ_LE_UINT16(const void *ptr) {
- return *(const uint16 *)(ptr);
- }
- #endif
+ #define READ_UINT32(a) READ_LE_UINT32(a)
- FORCEINLINE uint READ_BE_UINT16(const void *ptr) {
- return (((const byte *)ptr)[0] << 8)|((const byte *)ptr)[1];
- }
+ #define FROM_LE_32(a) (a)
+ #define FROM_LE_16(a) (a)
- #if defined(SCUMM_NEED_ALIGNMENT)
- FORCEINLINE uint32 READ_LE_UINT32(const void *ptr) {
- const byte *b = (const byte *)ptr;
- return (b[3] << 24) + (b[2] <<16) + (b[1] << 8) + (b[0]);
- }
- #else
- FORCEINLINE uint32 READ_LE_UINT32(const void *ptr) {
- return *(const uint32 *)(ptr);
- }
- #endif
-
- FORCEINLINE uint32 READ_BE_UINT32(const void *ptr) {
- const byte *b = (const byte *)ptr;
- return (b[0] << 24) + (b[1] << 16) + (b[2] << 8) + (b[3]);
- }
+ #define TO_LE_32(a) (a)
+ #define TO_LE_16(a) (a)
- #define READ_BE_UINT32_UNALIGNED READ_BE_UINT32
- #define READ_BE_UINT16_UNALIGNED READ_BE_UINT16
+ #define TO_BE_32(a) SWAP_BYTES_32(a)
+ #define TO_BE_16(a) SWAP_BYTES_16(a)
- #define READ_UINT32_UNALIGNED(a) READ_LE_UINT32(a)
+#elif defined(SCUMM_BIG_ENDIAN)
- #define FROM_LE_32(__a__) __a__
- #define FROM_LE_16(__a__) __a__
+ #define MKID(a) (a)
+ #define MKID_BE(a) (a)
+ //#define MKID_BE(a) SWAP_BYTES_32(a)
- #define TO_LE_32(__a__) __a__
- #define TO_LE_16(__a__) __a__
+ #define READ_UINT32(a) READ_BE_UINT32(a)
- #define TO_BE_32(a) SWAP_BYTES(a)
+ #define FROM_LE_32(a) SWAP_BYTES_32(a)
+ #define FROM_LE_16(a) SWAP_BYTES_16(a)
- FORCEINLINE uint16 TO_BE_16(uint16 a) { return (a >> 8) | (a << 8); }
+ #define TO_LE_32(a) SWAP_BYTES_32(a)
+ #define TO_LE_16(a) SWAP_BYTES_16(a)
-#elif defined(SCUMM_BIG_ENDIAN)
+ #define TO_BE_32(a) (a)
+ #define TO_BE_16(a) (a)
- #define MKID(a) (a)
- #define MKID_BE(a) (a)
- //#define MKID_BE(a) SWAP_BYTES(a)
+#else
- FORCEINLINE uint32 FROM_LE_32(uint32 a) {
- return ((a >> 24) & 0xFF) + ((a >> 8) & 0xFF00) + (( a<< 8) & 0xFF0000) \
- + ((a<<24)&0xFF000000);
- }
+ #error No endianness defined
- FORCEINLINE uint16 FROM_LE_16(uint16 a) {
- return ((a >> 8) & 0xFF) + ((a << 8) & 0xFF00);
- }
+#endif
- #define TO_LE_32 FROM_LE_32
- #define TO_LE_16 FROM_LE_16
+#if defined(SCUMM_NEED_ALIGNMENT) || defined(SCUMM_BIG_ENDIAN)
+ FORCEINLINE uint16 READ_LE_UINT16(const void *ptr) {
+ const byte *b = (const byte *)ptr;
+ return (b[1] << 8) + b[0];
+ }
FORCEINLINE uint32 READ_LE_UINT32(const void *ptr) {
const byte *b = (const byte *)ptr;
return (b[3] << 24) + (b[2] << 16) + (b[1] << 8) + (b[0]);
}
-
- FORCEINLINE uint32 READ_BE_UINT32(const void *ptr) {
- return *(const uint32 *)(ptr);
+#else
+ FORCEINLINE uint16 READ_LE_UINT16(const void *ptr) {
+ return *(const uint16 *)(ptr);
}
-
- FORCEINLINE uint READ_LE_UINT16(const void *ptr) {
- const byte *b = (const byte *)ptr;
- return (b[1] << 8) + b[0];
+ FORCEINLINE uint32 READ_LE_UINT32(const void *ptr) {
+ return *(const uint32 *)(ptr);
}
+#endif
- FORCEINLINE uint READ_BE_UINT16(const void *ptr) {
- return *(const uint16 *)(ptr);
- }
- FORCEINLINE uint READ_BE_UINT16_UNALIGNED(const void *ptr) {
+#if defined(SCUMM_NEED_ALIGNMENT) || defined(SCUMM_LITTLE_ENDIAN)
+ FORCEINLINE uint16 READ_BE_UINT16(const void *ptr) {
return (((const byte *)ptr)[0] << 8)|((const byte *)ptr)[1];
}
-
- FORCEINLINE uint32 READ_BE_UINT32_UNALIGNED(const void *ptr) {
+ FORCEINLINE uint32 READ_BE_UINT32(const void *ptr) {
const byte *b = (const byte*)ptr;
return (b[0] << 24) + (b[1] << 16) + (b[2] << 8) + (b[3]);
}
-
- #define READ_UINT32_UNALIGNED READ_BE_UINT32_UNALIGNED
-
- #define TO_BE_32(a) (a)
- #define TO_BE_16(a) (a)
-
#else
-
- #error No endianness defined
-
+ FORCEINLINE uint16 READ_BE_UINT16(const void *ptr) {
+ return *(const uint16 *)(ptr);
+ }
+ FORCEINLINE uint32 READ_BE_UINT32(const void *ptr) {
+ return *(const uint32 *)(ptr);
+ }
#endif
+
#if defined(NEWGUI_256)
// 256 color only on PalmOS
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index cbc7761c0a..452330864c 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -255,7 +255,7 @@ byte AkosRenderer::drawLimb(const CostumeData &cost, int limb) {
if (code != AKC_ComplexChan) {
off = akof + (code & 0xFFF);
- assert((code & 0xFFF) * 6 < READ_BE_UINT32_UNALIGNED((const byte *)akof - 4) - 8);
+ assert((code & 0xFFF) * 6 < READ_BE_UINT32((const byte *)akof - 4) - 8);
assert((code & 0x7000) == 0);
_srcptr = akcd + READ_LE_UINT32(&off->akcd);
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index a499c148a6..50795e820e 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -2619,9 +2619,9 @@ void Scumm::initCycl(const byte *ptr) {
ptr += 2;
cycl->counter = 0;
- cycl->delay = 16384 / READ_BE_UINT16_UNALIGNED(ptr);
+ cycl->delay = 16384 / READ_BE_UINT16(ptr);
ptr += 2;
- cycl->flags = READ_BE_UINT16_UNALIGNED(ptr);
+ cycl->flags = READ_BE_UINT16(ptr);
ptr += 2;
cycl->start = *ptr++;
cycl->end = *ptr++;
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 7c75c51d11..d9598e0197 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -100,7 +100,7 @@ byte *IMuseInternal::findStartOfSound (int sound) {
}
ptr += 8;
- size = READ_BE_UINT32_UNALIGNED(ptr);
+ size = READ_BE_UINT32(ptr);
ptr += 4;
// Okay, we're looking for one of those things: either
diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp
index a31e800085..94ad5e58de 100644
--- a/scumm/imuse_digi.cpp
+++ b/scumm/imuse_digi.cpp
@@ -803,7 +803,7 @@ void IMuseDigital::startSound(int sound) {
uint32 tag, size = 0, r, t;
- if (READ_UINT32_UNALIGNED(ptr) == MKID('Crea')) {
+ if (READ_UINT32(ptr) == MKID('Crea')) {
_channel[l]._bits = 8;
_channel[l]._channels = 2;
_channel[l]._mixerSize = (22050 / 5) * 2;
@@ -827,19 +827,19 @@ void IMuseDigital::startSound(int sound) {
}
free(t_ptr);
_channel[l]._size = size;
- } else if (READ_UINT32_UNALIGNED(ptr) == MKID('iMUS')) {
+ } else if (READ_UINT32(ptr) == MKID('iMUS')) {
ptr += 16;
for (;;) {
- tag = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
+ tag = READ_BE_UINT32(ptr); ptr += 4;
switch(tag) {
case MKID_BE('FRMT'):
ptr += 12;
- _channel[l]._bits = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
- _channel[l]._freq = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
- _channel[l]._channels = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
+ _channel[l]._bits = READ_BE_UINT32(ptr); ptr += 4;
+ _channel[l]._freq = READ_BE_UINT32(ptr); ptr += 4;
+ _channel[l]._channels = READ_BE_UINT32(ptr); ptr += 4;
break;
case MKID_BE('TEXT'):
- size = READ_BE_UINT32_UNALIGNED(ptr); ptr += size + 4;
+ size = READ_BE_UINT32(ptr); ptr += size + 4;
break;
case MKID_BE('REGN'):
ptr += 4;
@@ -848,13 +848,13 @@ void IMuseDigital::startSound(int sound) {
ptr += 8;
break;
}
- _channel[l]._region[_channel[l]._numRegions]._offset = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
- _channel[l]._region[_channel[l]._numRegions]._length = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
+ _channel[l]._region[_channel[l]._numRegions]._offset = READ_BE_UINT32(ptr); ptr += 4;
+ _channel[l]._region[_channel[l]._numRegions]._length = READ_BE_UINT32(ptr); ptr += 4;
_channel[l]._numRegions++;
break;
case MKID_BE('STOP'):
ptr += 4;
- _channel[l]._offsetStop = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
+ _channel[l]._offsetStop = READ_BE_UINT32(ptr); ptr += 4;
break;
case MKID_BE('JUMP'):
ptr += 4;
@@ -863,15 +863,15 @@ void IMuseDigital::startSound(int sound) {
ptr += 16;
break;
}
- _channel[l]._jump[_channel[l]._numJumps]._offset = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
- _channel[l]._jump[_channel[l]._numJumps]._dest = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
- _channel[l]._jump[_channel[l]._numJumps]._id = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
- _channel[l]._jump[_channel[l]._numJumps]._numLoops = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
+ _channel[l]._jump[_channel[l]._numJumps]._offset = READ_BE_UINT32(ptr); ptr += 4;
+ _channel[l]._jump[_channel[l]._numJumps]._dest = READ_BE_UINT32(ptr); ptr += 4;
+ _channel[l]._jump[_channel[l]._numJumps]._id = READ_BE_UINT32(ptr); ptr += 4;
+ _channel[l]._jump[_channel[l]._numJumps]._numLoops = READ_BE_UINT32(ptr); ptr += 4;
_channel[l]._isJump = true;
_channel[l]._numJumps++;
break;
case MKID_BE('DATA'):
- size = READ_BE_UINT32_UNALIGNED(ptr); ptr += 4;
+ size = READ_BE_UINT32(ptr); ptr += 4;
break;
default:
error("IMuseDigital::startSound(%d) Unknown sfx header %c%c%c%c", sound, (byte)(tag >> 24), (byte)(tag >> 16), (byte)(tag >> 8), (byte)tag);
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 8b10881c22..6f60297f54 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -973,7 +973,7 @@ void Scumm::addObjectToInventory(uint obj, uint room) {
if (whereIsObject(obj) == WIO_FLOBJECT) {
i = getObjectIndex(obj);
ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 8;
- size = READ_BE_UINT32_UNALIGNED(ptr + 4);
+ size = READ_BE_UINT32(ptr + 4);
} else {
findObjectInRoom(&foir, foCodeHeader, obj, room);
if (_features & GF_OLD_BUNDLE)
@@ -981,7 +981,7 @@ void Scumm::addObjectToInventory(uint obj, uint room) {
else if (_features & GF_SMALL_HEADER)
size = READ_LE_UINT32(foir.obcd);
else
- size = READ_BE_UINT32_UNALIGNED(foir.obcd + 4);
+ size = READ_BE_UINT32(foir.obcd + 4);
ptr = foir.obcd;
}
@@ -1352,7 +1352,7 @@ void Scumm::setCursorImg(uint img, uint room, uint imgindex) {
if (dataptr == NULL)
error("setCursorImg: No such image");
- size = READ_BE_UINT32_UNALIGNED(dataptr + 4);
+ size = READ_BE_UINT32(dataptr + 4);
if (size > sizeof(_grabbedCursor))
error("setCursorImg: Cursor image too large");
@@ -1628,10 +1628,10 @@ void Scumm::loadFlObject(uint object, uint room) {
}
// Setup sizes
- obcd_size = READ_BE_UINT32_UNALIGNED(foir.obcd + 4);
+ obcd_size = READ_BE_UINT32(foir.obcd + 4);
od->OBCDoffset = 8;
od->OBIMoffset = obcd_size + 8;
- obim_size = READ_BE_UINT32_UNALIGNED(foir.obim + 4);
+ obim_size = READ_BE_UINT32(foir.obim + 4);
flob_size = obcd_size + obim_size + 8;
// Lock room/roomScripts for the given room. They contains the OBCD/OBIM
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index a4f53138bb..71e8e07678 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -1366,7 +1366,7 @@ int Scumm::getResourceDataSize(const byte *ptr) const {
else if (_features & GF_SMALL_HEADER)
return READ_LE_UINT32(ptr) - 6;
else
- return READ_BE_UINT32_UNALIGNED(ptr - 4) - 8;
+ return READ_BE_UINT32(ptr - 4) - 8;
}
struct FindResourceState {
@@ -1381,14 +1381,14 @@ const byte *findResource(uint32 tag, const byte *searchin) {
FindResourceState *f = &frs; /* easier to make it thread safe like this */
if (searchin) {
- f->size = READ_BE_UINT32_UNALIGNED(searchin + 4);
+ f->size = READ_BE_UINT32(searchin + 4);
f->pos = 8;
f->ptr = searchin + 8;
goto StartScan;
}
do {
- size = READ_BE_UINT32_UNALIGNED(f->ptr + 4);
+ size = READ_BE_UINT32(f->ptr + 4);
if ((int32)size <= 0)
return NULL;
@@ -1398,7 +1398,7 @@ const byte *findResource(uint32 tag, const byte *searchin) {
StartScan:
if (f->pos >= f->size)
return NULL;
- } while (READ_UINT32_UNALIGNED(f->ptr) != tag);
+ } while (READ_UINT32(f->ptr) != tag);
return f->ptr;
}
@@ -1440,15 +1440,15 @@ const byte *findResource(uint32 tag, const byte *searchin, int idx) {
assert(searchin);
searchin += 4;
- totalsize = READ_BE_UINT32_UNALIGNED(searchin);
+ totalsize = READ_BE_UINT32(searchin);
curpos = 8;
searchin += 4;
while (curpos < totalsize) {
- if (READ_UINT32_UNALIGNED(searchin) == tag && !idx--)
+ if (READ_UINT32(searchin) == tag && !idx--)
return searchin;
- size = READ_BE_UINT32_UNALIGNED(searchin + 4);
+ size = READ_BE_UINT32(searchin + 4);
if ((int32)size <= 0) {
error("(%c%c%c%c) Not found in %d... illegal block len %d",
tag & 0xFF, (tag >> 8) & 0xFF, (tag >> 16) & 0xFF, (tag >> 24) & 0xFF, 0, size);
diff --git a/scumm/resource.h b/scumm/resource.h
index 03453c7c06..a3be6a74a3 100644
--- a/scumm/resource.h
+++ b/scumm/resource.h
@@ -34,7 +34,7 @@ struct ResHdr {
#endif
#define RES_DATA(x) (((const byte*)x) + sizeof(ResHdr))
-#define RES_SIZE(x) (READ_BE_UINT32_UNALIGNED(&((const ResHdr* )x)->size))
+#define RES_SIZE(x) (READ_BE_UINT32(&((const ResHdr* )x)->size))
enum {
OF_OWNER_MASK = 0x0F,
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index 29a7cf9911..92d56a1ce5 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -99,7 +99,7 @@ bool Scumm::loadState(int slot, bool compat, SaveFileManager *mgr) {
// In older versions of ScummVM, the header version was not endian safe.
// We account for that by retrying once with swapped byte order.
if (hdr.ver > CURRENT_VER)
- hdr.ver = SWAP_BYTES(hdr.ver);
+ hdr.ver = SWAP_BYTES_32(hdr.ver);
if (hdr.ver < VER_V7 || hdr.ver > CURRENT_VER)
{
warning("Invalid version of '%s'", filename);
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 6e1c0775f6..9b87083f07 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -1951,17 +1951,17 @@ void Scumm_v5::o5_setObjectName() {
assert(searchin);
searchin += 4;
- totalsize = READ_BE_UINT32_UNALIGNED(searchin);
+ totalsize = READ_BE_UINT32(searchin);
curpos = 8;
searchin += 4;
while (curpos < totalsize) {
- if (READ_UINT32_UNALIGNED(searchin) == tag) {
+ if (READ_UINT32(searchin) == tag) {
name = searchin + _resourceHeaderSize;
break;
}
- size = READ_BE_UINT32_UNALIGNED(searchin + 4);
+ size = READ_BE_UINT32(searchin + 4);
if ((int32)size <= 0) {
error("(%c%c%c%c) Not found in %d... illegal block len %d",
tag & 0xFF, (tag >> 8) & 0xFF, (tag >> 16) & 0xFF, (tag >> 24) & 0xFF, 0, size);
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 9b2007797d..cdc30728cd 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -1780,7 +1780,7 @@ void Scumm::dumpResource(const char *tag, int idx, const byte *ptr, int length)
else if (_features & GF_SMALL_HEADER)
size = READ_LE_UINT32(ptr);
else
- size = READ_BE_UINT32_UNALIGNED(ptr + 4);
+ size = READ_BE_UINT32(ptr + 4);
#if defined(MACOS_CARBON)
sprintf(buf, ":dumps:%s%d.dmp", tag, idx);
diff --git a/scumm/smush/imuse_channel.cpp b/scumm/smush/imuse_channel.cpp
index 617932e75c..738dc01b64 100644
--- a/scumm/smush/imuse_channel.cpp
+++ b/scumm/smush/imuse_channel.cpp
@@ -72,8 +72,8 @@ bool ImuseChannel::checkParameters(int32 index, int32 nbframes, int32 size, int3
bool ImuseChannel::appendData(Chunk &b, int32 size) {
if (_dataSize == -1) {
assert(size > 8);
- Chunk::type imus_type = b.getDword(); imus_type = SWAP_BYTES(imus_type);
- uint32 imus_size = b.getDword(); imus_size = SWAP_BYTES(imus_size);
+ Chunk::type imus_type = b.getDword(); imus_type = SWAP_BYTES_32(imus_type);
+ uint32 imus_size = b.getDword(); imus_size = SWAP_BYTES_32(imus_size);
if (imus_type != TYPE_iMUS)
error("Invalid Chunk for imuse_channel");
size -= 8;
@@ -109,14 +109,14 @@ bool ImuseChannel::appendData(Chunk &b, int32 size) {
bool ImuseChannel::handleFormat(Chunk &src) {
if (src.getSize() != 20) error("invalid size for FRMT Chunk");
uint32 imuse_start = src.getDword();
- imuse_start = SWAP_BYTES(imuse_start);
+ imuse_start = SWAP_BYTES_32(imuse_start);
src.seek(4);
_bitsize = src.getDword();
- _bitsize = SWAP_BYTES(_bitsize);
+ _bitsize = SWAP_BYTES_32(_bitsize);
_rate = src.getDword();
- _rate = SWAP_BYTES(_rate);
+ _rate = SWAP_BYTES_32(_rate);
_channels = src.getDword();
- _channels = SWAP_BYTES(_channels);
+ _channels = SWAP_BYTES_32(_channels);
assert(_channels == 1 || _channels == 2);
return true;
}
diff --git a/scumm/smush/saud_channel.cpp b/scumm/smush/saud_channel.cpp
index b5d5b25ded..142ab9a17a 100644
--- a/scumm/smush/saud_channel.cpp
+++ b/scumm/smush/saud_channel.cpp
@@ -232,8 +232,8 @@ bool SaudChannel::checkParameters(int32 index, int32 nb, int32 flags, int32 volu
bool SaudChannel::appendData(Chunk &b, int32 size) {
if (_dataSize == -1) {
assert(size > 8);
- Chunk::type saud_type = b.getDword(); saud_type = SWAP_BYTES(saud_type);
- uint32 saud_size = b.getDword(); saud_size = SWAP_BYTES(saud_size);
+ Chunk::type saud_type = b.getDword(); saud_type = SWAP_BYTES_32(saud_type);
+ uint32 saud_size = b.getDword(); saud_size = SWAP_BYTES_32(saud_size);
if (saud_type != TYPE_SAUD) error("Invalid Chunk for SaudChannel : %X", saud_type);
size -= 8;
_dataSize = -2;
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 899e75204b..c2ce8eb996 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -180,17 +180,17 @@ void Sound::playSound(int soundID) {
debug(3,"playSound #%d (room %d)", soundID, _scumm->getResourceRoomNr(rtSound, soundID));
ptr = _scumm->getResourceAddress(rtSound, soundID);
if (ptr) {
- if (READ_UINT32_UNALIGNED(ptr) == MKID('iMUS')){
+ if (READ_UINT32(ptr) == MKID('iMUS')){
assert(_scumm->_imuseDigital);
_scumm->_imuseDigital->startSound(soundID);
return;
}
- else if (READ_UINT32_UNALIGNED(ptr) == MKID('Crea')) {
+ else if (READ_UINT32(ptr) == MKID('Crea')) {
assert(_scumm->_imuseDigital);
_scumm->_imuseDigital->startSound(soundID);
return;
}
- else if (READ_UINT32_UNALIGNED(ptr) == MKID('SOUN')) {
+ else if (READ_UINT32(ptr) == MKID('SOUN')) {
ptr += 8;
_scumm->VAR(_scumm->VAR_MUSIC_TIMER) = 0;
playCDTrack(ptr[16], ptr[17] == 0xff ? -1 : ptr[17],
@@ -202,11 +202,11 @@ void Sound::playSound(int soundID) {
// Support for SFX in Monkey Island 1, Mac version
// This is rather hackish right now, but works OK. SFX are not sounding
// 100% correct, though, not sure right now what is causing this.
- else if (READ_UINT32_UNALIGNED(ptr) == MKID('Mac1')) {
+ else if (READ_UINT32(ptr) == MKID('Mac1')) {
// Read info from the header
- size = READ_BE_UINT32_UNALIGNED(ptr+0x60);
- rate = READ_BE_UINT32_UNALIGNED(ptr+0x64) >> 16;
+ size = READ_BE_UINT32(ptr+0x60);
+ rate = READ_BE_UINT32(ptr+0x64) >> 16;
// Skip over the header (fixed size)
ptr += 0x72;
@@ -218,14 +218,14 @@ void Sound::playSound(int soundID) {
return;
}
// Support for Putt-Putt sounds - very hackish, too 8-)
- else if (READ_UINT32_UNALIGNED(ptr) == MKID('DIGI')) {
+ else if (READ_UINT32(ptr) == MKID('DIGI')) {
// TODO - discover what data the first chunk, HSHD, contains
// it might be useful here.
- ptr += 8 + READ_BE_UINT32_UNALIGNED(ptr+12);
- if (READ_UINT32_UNALIGNED(ptr) != MKID('SDAT'))
+ ptr += 8 + READ_BE_UINT32(ptr+12);
+ if (READ_UINT32(ptr) != MKID('SDAT'))
return; // abort
- size = READ_BE_UINT32_UNALIGNED(ptr+4) - 8;
+ size = READ_BE_UINT32(ptr+4) - 8;
// FIXME - what value here ?!? 11025 is just a guess based on strings in w32 bin, prev guess 8000
rate = 11025;
@@ -236,16 +236,16 @@ void Sound::playSound(int soundID) {
return;
}
// XMIDI
- else if ((READ_UINT32_UNALIGNED(ptr) == MKID('MIDI')) && (_scumm->_features & GF_HUMONGOUS)) {
+ else if ((READ_UINT32(ptr) == MKID('MIDI')) && (_scumm->_features & GF_HUMONGOUS)) {
// Pass XMIDI on to IMuse unprocessed.
// IMuse can handle XMIDI resources now.
}
- else if (READ_UINT32_UNALIGNED(ptr) == MKID('ADL ')) {
+ else if (READ_UINT32(ptr) == MKID('ADL ')) {
// played as MIDI, just to make perhaps the later use
// of WA possible (see "else if" with GF_OLD256 below)
}
// Support for sampled sound effects in Monkey1 and Monkey2
- else if (READ_UINT32_UNALIGNED(ptr) == MKID('SBL ')) {
+ else if (READ_UINT32(ptr) == MKID('SBL ')) {
debug(2, "Using SBL sound effect");
// TODO - Figuring out how the SBL chunk works. Here's
@@ -283,12 +283,12 @@ void Sound::playSound(int soundID) {
// I'm going to assume that the sample frequency is
// the only important difference between the two.
- if (READ_UINT32_UNALIGNED(ptr + 8) == MKID('WVhd'))
+ if (READ_UINT32(ptr + 8) == MKID('WVhd'))
rate = 11025;
else
rate = 8000;
- size = READ_BE_UINT32_UNALIGNED(ptr + 4) - 27;
+ size = READ_BE_UINT32(ptr + 4) - 27;
// Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size);
diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp
index 5fde04a80c..96e70637cf 100644
--- a/scumm/verbs.cpp
+++ b/scumm/verbs.cpp
@@ -558,7 +558,7 @@ void Scumm::setVerbObject(uint room, uint object, uint verb) {
}
} else {
findObjectInRoom(&foir, foImageHeader, object, room);
- size = READ_BE_UINT32_UNALIGNED(foir.obim + 4);
+ size = READ_BE_UINT32(foir.obim + 4);
createResource(rtVerb, verb, size);
obimptr = getResourceAddress(rtRoom, room) - foir.roomptr + foir.obim;
memcpy(getResourceAddress(rtVerb, verb), obimptr, size);
diff --git a/simon/charset.cpp b/simon/charset.cpp
index ab405fea13..48023dbbce 100644
--- a/simon/charset.cpp
+++ b/simon/charset.cpp
@@ -79,7 +79,7 @@ void SimonEngine::render_string(uint num_1, uint color, uint width, uint height,
*(uint16 *)(p + 4) = TO_BE_16(height);
*(uint16 *)(p + 6) = TO_BE_16(width);
- dst += READ_BE_UINT32_UNALIGNED(p);
+ dst += READ_BE_UINT32(p);
memset(dst, 0, count);
diff --git a/simon/debug.cpp b/simon/debug.cpp
index e0c189b90a..62b3b03431 100644
--- a/simon/debug.cpp
+++ b/simon/debug.cpp
@@ -175,7 +175,7 @@ void SimonEngine::dump_video_script(byte *src, bool one_opcode_only) {
do {
if (!(_game & GF_SIMON2)) {
- opcode = READ_BE_UINT16_UNALIGNED(src);
+ opcode = READ_BE_UINT16(src);
src += 2;
} else {
opcode = *src++;
@@ -205,21 +205,21 @@ void SimonEngine::dump_video_script(byte *src, bool one_opcode_only) {
fprintf(_dump_file, "%d ", *src++);
break;
case 'd':
- fprintf(_dump_file, "%d ", READ_BE_UINT16_UNALIGNED(src));
+ fprintf(_dump_file, "%d ", READ_BE_UINT16(src));
src += 2;
break;
case 'v':
- fprintf(_dump_file, "[%d] ", READ_BE_UINT16_UNALIGNED(src));
+ fprintf(_dump_file, "[%d] ", READ_BE_UINT16(src));
src += 2;
break;
case 'i':
- fprintf(_dump_file, "%d ", (int16)READ_BE_UINT16_UNALIGNED(src));
+ fprintf(_dump_file, "%d ", (int16)READ_BE_UINT16(src));
src += 2;
break;
case 'q':
- while (READ_BE_UINT16_UNALIGNED(src) != 999) {
- fprintf(_dump_file, "(%d,%d) ", READ_BE_UINT16_UNALIGNED(src),
- READ_BE_UINT16_UNALIGNED(src + 2));
+ while (READ_BE_UINT16(src) != 999) {
+ fprintf(_dump_file, "(%d,%d) ", READ_BE_UINT16(src),
+ READ_BE_UINT16(src + 2));
src += 4;
}
src++;
@@ -240,13 +240,13 @@ void SimonEngine::dump_vga_file(byte *vga) {
int count;
pp = vga;
- p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) pp)->hdr2_start);
- count = READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_count);
- p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_table);
+ p = pp + READ_BE_UINT16(&((VgaFile1Header *) pp)->hdr2_start);
+ count = READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_count);
+ p = pp + READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_table);
while (--count >= 0) {
- int id = READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->id);
+ int id = READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id);
- dump_vga_script_always(vga + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->script_offs), id / 100, id);
+ dump_vga_script_always(vga + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), id / 100, id);
p += sizeof(VgaFile1Struct0x6);
}
}
@@ -256,14 +256,14 @@ void SimonEngine::dump_vga_file(byte *vga) {
int c;
bb = vga;
- b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) bb)->hdr2_start);
- c = READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk1);
- b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk2_offs);
+ b = bb + READ_BE_UINT16(&((VgaFile1Header *) bb)->hdr2_start);
+ c = READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk1);
+ b = bb + READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk2_offs);
while (--c >= 0) {
- int id = READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->id);
+ int id = READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->id);
- dump_vga_script_always(vga + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->script_offs), id / 100, id);
+ dump_vga_script_always(vga + READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->script_offs), id / 100, id);
b += sizeof(VgaFile1Struct0x8);
}
}
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 592575af9c..046f41bf66 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -2248,11 +2248,11 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) {
// ensure flipping complete
bb = _cur_vga_file_1;
- b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) bb)->hdr2_start);
- c = READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk1);
- b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk2_offs);
+ b = bb + READ_BE_UINT16(&((VgaFile1Header *) bb)->hdr2_start);
+ c = READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk1);
+ b = bb + READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk2_offs);
- while (READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->id) != vga_res_id)
+ while (READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->id) != vga_res_id)
b += sizeof(VgaFile1Struct0x8);
if (!(_game & GF_SIMON2)) {
@@ -2272,7 +2272,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) {
vc_ptr_org = _vc_ptr;
- _vc_ptr = _cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->script_offs);
+ _vc_ptr = _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->script_offs);
//dump_vga_script(_vc_ptr, num, vga_res_id);
run_vga_script();
_vc_ptr = vc_ptr_org;
@@ -2795,15 +2795,15 @@ void SimonEngine::timer_vga_sprites() {
_video_palette_mode = vsp->unk6;
_vga_cur_sprite_id = vsp->id;
- params[0] = READ_BE_UINT16_UNALIGNED(&vsp->image);
- params[1] = READ_BE_UINT16_UNALIGNED(&vsp->base_color);
- params[2] = READ_BE_UINT16_UNALIGNED(&vsp->x);
- params[3] = READ_BE_UINT16_UNALIGNED(&vsp->y);
+ params[0] = READ_BE_UINT16(&vsp->image);
+ params[1] = READ_BE_UINT16(&vsp->base_color);
+ params[2] = READ_BE_UINT16(&vsp->x);
+ params[3] = READ_BE_UINT16(&vsp->y);
if (_game & GF_SIMON2) {
*(byte *)(&params[4]) = (byte)vsp->unk4;
} else {
- params[4] = READ_BE_UINT16_UNALIGNED(&vsp->unk4);
+ params[4] = READ_BE_UINT16(&vsp->unk4);
}
_vc_ptr = (byte *)params;
@@ -2837,7 +2837,7 @@ void SimonEngine::timer_vga_sprites_helper() {
}
src = _vga_var7 + x * 4;
- decodeStripA(dst, src + READ_BE_UINT32_UNALIGNED(&*((uint32 *)src)), _vga_var5);
+ decodeStripA(dst, src + READ_BE_UINT32(&*((uint32 *)src)), _vga_var5);
dx_unlock_2();
@@ -2875,11 +2875,11 @@ void SimonEngine::timer_vga_sprites_2() {
if (vsp->image)
fprintf(_dump_file, "id:%5d image:%3d base-color:%3d x:%3d y:%3d flags:%x\n",
vsp->id, vsp->image, vsp->base_color, vsp->x, vsp->y, vsp->unk4);
- params[0] = READ_BE_UINT16_UNALIGNED(&vsp->image);
- params[1] = READ_BE_UINT16_UNALIGNED(&vsp->base_color);
- params[2] = READ_BE_UINT16_UNALIGNED(&vsp->x);
- params[3] = READ_BE_UINT16_UNALIGNED(&vsp->y);
- params[4] = READ_BE_UINT16_UNALIGNED(&vsp->unk4);
+ params[0] = READ_BE_UINT16(&vsp->image);
+ params[1] = READ_BE_UINT16(&vsp->base_color);
+ params[2] = READ_BE_UINT16(&vsp->x);
+ params[3] = READ_BE_UINT16(&vsp->y);
+ params[4] = READ_BE_UINT16(&vsp->unk4);
_vc_ptr = (byte *)params;
vc_10_draw();
@@ -3108,9 +3108,9 @@ void SimonEngine::o_pathfind(int x, int y, uint var_1, uint var_2) {
p = (uint16 *)_pathfind_array[20 - i];
if (!p)
continue;
- for (j = 0; READ_BE_UINT16_UNALIGNED(&p[0]) != 999; j++, p += 2) { // 0xE703 = byteswapped 999
- x_diff = abs((int)(READ_BE_UINT16_UNALIGNED(&p[0]) - x));
- y_diff = abs((int)(READ_BE_UINT16_UNALIGNED(&p[1]) - 12 - y));
+ for (j = 0; READ_BE_UINT16(&p[0]) != 999; j++, p += 2) { // 0xE703 = byteswapped 999
+ x_diff = abs((int)(READ_BE_UINT16(&p[0]) - x));
+ y_diff = abs((int)(READ_BE_UINT16(&p[1]) - 12 - y));
if (x_diff < y_diff) {
x_diff >>= 2;
@@ -3714,17 +3714,17 @@ void SimonEngine::start_vga_code(uint b, uint vga_res, uint vga_struct_id, uint
}
pp = _cur_vga_file_1;
- p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) pp)->hdr2_start);
+ p = pp + READ_BE_UINT16(&((VgaFile1Header *) pp)->hdr2_start);
- count = READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_count);
- p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_table);
+ count = READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_count);
+ p = pp + READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_table);
for (;;) {
- if (READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->id) == vga_struct_id) {
+ if (READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id) == vga_struct_id) {
- //dump_vga_script(pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6*)p)->script_offs), vga_res, vga_struct_id);
+ //dump_vga_script(pp + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), vga_res, vga_struct_id);
- add_vga_timer(gss->VGA_DELAY_BASE, pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->script_offs), vga_struct_id, vga_res);
+ add_vga_timer(gss->VGA_DELAY_BASE, pp + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_struct_id, vga_res);
break;
}
p += sizeof(VgaFile1Struct0x6);
diff --git a/simon/vga.cpp b/simon/vga.cpp
index 6a0769d61e..528e87abef 100644
--- a/simon/vga.cpp
+++ b/simon/vga.cpp
@@ -120,7 +120,7 @@ void SimonEngine::run_vga_script() {
}
if (!(_game & GF_SIMON2)) {
- opcode = READ_BE_UINT16_UNALIGNED(_vc_ptr);
+ opcode = READ_BE_UINT16(_vc_ptr);
_vc_ptr += 2;
} else {
opcode = *_vc_ptr++;
@@ -144,7 +144,7 @@ int SimonEngine::vc_read_var_or_word() {
}
uint SimonEngine::vc_read_next_word() {
- uint a = READ_BE_UINT16_UNALIGNED(_vc_ptr);
+ uint a = READ_BE_UINT16(_vc_ptr);
_vc_ptr += 2;
return a;
}
@@ -245,15 +245,15 @@ void SimonEngine::vc_2_call() {
bb = _cur_vga_file_1;
- b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) bb)->hdr2_start);
- b = bb + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) b)->unk2_offs);
+ b = bb + READ_BE_UINT16(&((VgaFile1Header *) bb)->hdr2_start);
+ b = bb + READ_BE_UINT16(&((VgaFile1Header2 *) b)->unk2_offs);
- while (READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->id) != num)
+ while (READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->id) != num)
b += sizeof(VgaFile1Struct0x8);
vc_ptr_org = _vc_ptr;
- _vc_ptr = _cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x8 *) b)->script_offs);
+ _vc_ptr = _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x8 *) b)->script_offs);
//dump_vga_script(_vc_ptr, res, num);
run_vga_script();
@@ -317,10 +317,10 @@ void SimonEngine::vc_3_new_sprite() {
}
pp = _cur_vga_file_1;
- p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header *) pp)->hdr2_start);
- p = pp + READ_BE_UINT16_UNALIGNED(&((VgaFile1Header2 *) p)->id_table);
+ p = pp + READ_BE_UINT16(&((VgaFile1Header *) pp)->hdr2_start);
+ p = pp + READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_table);
- while (READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->id) != b)
+ while (READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id) != b)
p += sizeof(VgaFile1Struct0x6);
#ifdef DUMP_FILE_NR
@@ -343,9 +343,9 @@ void SimonEngine::vc_3_new_sprite() {
}
#endif
- //dump_vga_script(_cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6*)p)->script_offs), res, b);
+ //dump_vga_script(_cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), res, b);
- add_vga_timer(gss->VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->script_offs), b, res);
+ add_vga_timer(gss->VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), b, res);
}
void SimonEngine::vc_4_dummy_op() {
@@ -599,9 +599,9 @@ void SimonEngine::vc_10_draw() {
state.image = vc_read_var(-state.image);
p2 = _cur_vga_file_2 + state.image * 8;
- state.depack_src = _cur_vga_file_2 + READ_BE_UINT32_UNALIGNED(&*(uint32 *)p2);
+ state.depack_src = _cur_vga_file_2 + READ_BE_UINT32(p2);
- width = READ_BE_UINT16_UNALIGNED(p2 + 6) >> 4;
+ width = READ_BE_UINT16(p2 + 6) >> 4;
height = p2[5];
flags = p2[4];
@@ -640,7 +640,7 @@ void SimonEngine::vc_10_draw() {
src = state.depack_src + _x_scroll * 4;
for (w = 0; w < 40; w++) {
- decodeStripA(dst, src + READ_BE_UINT32_UNALIGNED(&*(uint32 *)src), height);
+ decodeStripA(dst, src + READ_BE_UINT32(src), height);
dst += 8;
src += 4;
}
@@ -1031,7 +1031,7 @@ void SimonEngine::vc_16_sleep_on_id() {
void SimonEngine::vc_17_set_pathfind_item() {
uint a = vc_read_next_word();
_pathfind_array[a - 1] = (uint16 *)_vc_ptr;
- while (READ_BE_UINT16_UNALIGNED(_vc_ptr) != 999)
+ while (READ_BE_UINT16(_vc_ptr) != 999)
_vc_ptr += 4;
_vc_ptr += 2;
}
@@ -1483,9 +1483,9 @@ void SimonEngine::vc_48() {
vp = &_variableArray[20];
do {
- y2 = READ_BE_UINT16_UNALIGNED(p);
+ y2 = READ_BE_UINT16(p);
p += step;
- y1 = READ_BE_UINT16_UNALIGNED(p) - y2;
+ y1 = READ_BE_UINT16(p) - y2;
vp[0] = y1 >> 1;
vp[1] = y1 - (y1 >> 1);
@@ -1738,11 +1738,11 @@ void SimonEngine::vc_62_palette_thing() {
_cur_vga_file_2 = vpe->vgaFile2;
_video_palette_mode = vsp->unk6;
- params[0] = READ_BE_UINT16_UNALIGNED(&vsp->image);
- params[1] = READ_BE_UINT16_UNALIGNED(&vsp->base_color);
- params[2] = READ_BE_UINT16_UNALIGNED(&vsp->x);
- params[3] = READ_BE_UINT16_UNALIGNED(&vsp->y);
- params[4] = READ_BE_UINT16_UNALIGNED(&vsp->unk4);
+ params[0] = READ_BE_UINT16(&vsp->image);
+ params[1] = READ_BE_UINT16(&vsp->base_color);
+ params[2] = READ_BE_UINT16(&vsp->x);
+ params[3] = READ_BE_UINT16(&vsp->y);
+ params[4] = READ_BE_UINT16(&vsp->unk4);
_vc_ptr = (byte *)params;
vc_10_draw();