aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-09-14 18:41:21 +0000
committerJohannes Schickel2009-09-14 18:41:21 +0000
commit160f9e77055c9ba80810ef22783158d7939291b0 (patch)
tree0ff463c183927e8ad5deacc4182001c171e17ec6
parent5ed03fcd3ae9ec219f40736056c73f1a0bed5b4c (diff)
downloadscummvm-rg350-160f9e77055c9ba80810ef22783158d7939291b0.tar.gz
scummvm-rg350-160f9e77055c9ba80810ef22783158d7939291b0.tar.bz2
scummvm-rg350-160f9e77055c9ba80810ef22783158d7939291b0.zip
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
-rw-r--r--sound/softsynth/adlib.cpp14
1 files changed, 12 insertions, 2 deletions
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;