From 160f9e77055c9ba80810ef22783158d7939291b0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 14 Sep 2009 18:41:21 +0000 Subject: Use struct packing for AdLib instruments like the SCUMM engine does. (And a comment about this change, which might be rather paranoia than having a real effect) svn-id: r44085 --- sound/softsynth/adlib.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'sound/softsynth/adlib.cpp') diff --git a/sound/softsynth/adlib.cpp b/sound/softsynth/adlib.cpp index c1c614cf56..8d7e8273de 100644 --- a/sound/softsynth/adlib.cpp +++ b/sound/softsynth/adlib.cpp @@ -35,9 +35,18 @@ static int tick; class MidiDriver_ADLIB; struct AdlibVoice; +// We use packing for the following two structs, because the code +// does simply copy them over from byte streams, without any +// serialization. Check AdlibPart::sysEx_customInstrument for an +// example of this. +// +// It might be very well possible, that none of the compilers we support +// add any padding bytes at all, since all used variables are only of the +// type 'byte'. But better safe than sorry. +#include "common/pack-start.h" struct InstrumentExtra { byte a, b, c, d, e, f, g, h; -}; +} PACKED_STRUCT; struct AdlibInstrument { byte mod_characteristic; @@ -58,7 +67,8 @@ struct AdlibInstrument { byte duration; AdlibInstrument() { memset(this, 0, sizeof(AdlibInstrument)); } -}; +} PACKED_STRUCT; +#include "common/pack-end.h" class AdlibPart : public MidiChannel { friend class MidiDriver_ADLIB; -- cgit v1.2.3