changeset 865:fc5bd0ccc260

Use struct packing and specific types for JSSMOD data.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Jan 2015 23:10:49 +0200
parents b111cccf45fc
children 49fc8d8a0b9c
files minijss/jssmod.h
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/minijss/jssmod.h	Mon Jan 05 23:03:11 2015 +0200
+++ b/minijss/jssmod.h	Mon Jan 05 23:10:49 2015 +0200
@@ -190,7 +190,7 @@
 
 /* JSSMOD typedefs
  */
-typedef struct
+typedef struct __attribute__((__packed__))
 {
     char  idMagic[2];     // "JM"
     Uint8 idVersion;      // 0x10 for 1.0, etc.
@@ -225,15 +225,16 @@
 } JSSMODHeader;
 
 
-typedef struct
+typedef struct __attribute__((__packed__))
 {
     Uint16 frame, value;
 } JSSMODEnvelopePoint;
 
 
-typedef struct
+typedef struct __attribute__((__packed__))
 {
-    int flags,
+    Sint32
+        flags,
         npoints,
         sustain,
         loopS,
@@ -242,7 +243,7 @@
 } JSSMODEnvelope;
 
 
-typedef struct
+typedef struct __attribute__((__packed__))
 {
     Sint16 nsamples;
     Uint8 sNumForNotes[jsetNNotes];
@@ -251,13 +252,13 @@
             vibratoSweep,
             vibratoDepth,
             vibratoRate;
-    int     fadeOut;
+    Sint32  fadeOut;
 } JSSMODExtInstrument;
 
 
-typedef struct
+typedef struct __attribute__((__packed__))
 {
-    int     size,           // Length in units
+    Sint32  size,           // Length in units
             loopS,          // Loop start position in units
             loopE;          // Loop end position in units
     Sint16 volume,         // Volume [jsetMinVol...jsetMaxVol]
@@ -279,9 +280,9 @@
 #define COMP_ALL (COMP_NOTE | COMP_INSTRUMENT | COMP_VOLUME | COMP_EFFECT | COMP_PARAM)
 
 
-typedef struct
+typedef struct __attribute__((__packed__))
 {
-    size_t nrows, size;
+    Uint32 nrows, size;
 } JSSMODPattern;
 
 #endif