about summary refs log tree commit diff stats
path: root/src/include
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-10-06 14:27:19 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-10-06 14:27:19 +0200
commitad0c08c2de2dde9e60fd4537f3e4b53c89a468eb (patch)
tree87b05e60b1194d9b4752f09f46c2d0181129062d /src/include
parent7b93791c3f428c119e35480bbba1dcec7a413db4 (diff)
downloadbox64-ad0c08c2de2dde9e60fd4537f3e4b53c89a468eb.tar.gz
box64-ad0c08c2de2dde9e60fd4537f3e4b53c89a468eb.zip
[BOX32] Proper alignment for x86 structures
Diffstat (limited to 'src/include')
-rwxr-xr-xsrc/include/myalign32.h30
-rw-r--r--src/include/sdl1align32.h52
-rw-r--r--src/include/sdl2align32.h76
3 files changed, 79 insertions, 79 deletions
diff --git a/src/include/myalign32.h b/src/include/myalign32.h
index fae5b2cf..e77e37e8 100755
--- a/src/include/myalign32.h
+++ b/src/include/myalign32.h
@@ -131,11 +131,11 @@ struct i386_stat64 {
 	uint32_t	st_ctime;
 	uint32_t	st_ctime_nsec;
 	uint64_t	st_ino;
-} __attribute__((packed));
+} __attribute__((packed, aligned(4)));
 
 struct i386_fsid {
   int     val[2];
-} __attribute__((packed));
+} __attribute__((packed, aligned(4)));
 
 struct i386_statfs {
   uint32_t    f_type;
@@ -150,7 +150,7 @@ struct i386_statfs {
   uint32_t    f_frsize;
   uint32_t    f_flags;
   uint32_t    f_spare[4];
-} __attribute__((packed));
+} __attribute__((packed, aligned(4)));
 
 struct i386_statfs64 {
   uint32_t    f_type;
@@ -165,7 +165,7 @@ struct i386_statfs64 {
   uint32_t    f_frsize;
   uint32_t    f_flags;
   uint32_t    f_spare[4];
-} __attribute__((packed));
+} __attribute__((packed, aligned(4)));
 
 struct i386_statvfs64 {
   ulong_t f_bsize;
@@ -182,7 +182,7 @@ struct i386_statvfs64 {
   ulong_t f_namemax;
   unsigned int f_type;
   int __f_spare[5];
-} __attribute__((packed));
+} __attribute__((packed, aligned(4)));
 
 struct i386_statvfs {
   ulong_t f_bsize;
@@ -199,7 +199,7 @@ struct i386_statvfs {
   ulong_t f_namemax;
   unsigned int f_type;
   int __f_spare[5];
-} __attribute__((packed));
+} __attribute__((packed, aligned(4)));
 
 void UnalignStatVFS_32(const void* source, void* dest);
 void UnalignStatVFS64_32(const void* source, void* dest);
@@ -211,7 +211,7 @@ struct i386_dirent
   uint16_t d_reclen;
   uint8_t d_type;
   char d_name[256];
-};
+} __attribute__((packed, aligned(4)));
 void UnalignDirent_32(const void* source, void* dest);
 
 #if 0
@@ -425,7 +425,7 @@ typedef struct my_flock64_s {
 	int       l_pid;
 } my_flock64_t;
 
-typedef struct __attribute__((packed)) x86_flock64_s {
+typedef struct __attribute__((packed, aligned(4))) x86_flock64_s {
 	uint16_t  l_type;
 	uint16_t  l_whence;
 	int64_t   l_start;
@@ -470,7 +470,7 @@ struct i386_addrinfo
   ptr_t ai_addr;	    // struct sockaddr *
   ptr_t ai_canonname;   // char *
   ptr_t ai_next;        // struct addrinfo *
-} __attribute__((packed));
+} __attribute__((packed, aligned(4)));
 
 struct i386_hostent {
     ptr_t  h_name;     // char  *
@@ -478,13 +478,13 @@ struct i386_hostent {
     int    h_addrtype;
     int    h_length;
     ptr_t  h_addr_list;// char **
-} __attribute__((packed));
+} __attribute__((packed, aligned(4)));
 
 struct i386_iovec
 {
   ptr_t     iov_base; // void *
   ulong_t   iov_len;
-};
+} __attribute__((packed, aligned(4)));
 
 struct i386_msghdr
 {
@@ -495,14 +495,14 @@ struct i386_msghdr
   ptr_t     msg_control;  // void *
   ulong_t   msg_controllen;
   int msg_flags;
-};
+} __attribute__((packed, aligned(4)));
 
 struct i386_cmsghdr
 {
   ulong_t cmsg_len;
   int cmsg_level;
   int cmsg_type;
-};
+} __attribute__((packed, aligned(4)));
 
 void AlignIOV_32(void* dest, void* source);   // x86 -> Native
 void UnalignIOV_32(void* dest, void* source); // Native -> x86
@@ -519,7 +519,7 @@ struct i386_passwd
   ptr_t pw_gecos; // char*
   ptr_t pw_dir; // char*
   ptr_t pw_shell; // char*
-};
+} __attribute__((packed, aligned(4)));
 
 struct i386_group
 {
@@ -527,6 +527,6 @@ struct i386_group
   ptr_t gr_passwd; // char *
   __gid_t gr_gid;
   ptr_t gr_mem; // char **
-};
+} __attribute__((packed, aligned(4)));
 
 #endif//__MY_ALIGN32__H_
\ No newline at end of file
diff --git a/src/include/sdl1align32.h b/src/include/sdl1align32.h
index 66153621..6ac0cb07 100644
--- a/src/include/sdl1align32.h
+++ b/src/include/sdl1align32.h
@@ -66,7 +66,7 @@ typedef struct my_SDL_Surface_s
 
 // x86 version (packed, 32bits pointers and long)
 
-typedef struct __attribute__((packed)) my_SDL_Rect_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_Rect_32_s
 {
     int16_t  x;
     int16_t  y;
@@ -74,7 +74,7 @@ typedef struct __attribute__((packed)) my_SDL_Rect_32_s
     uint16_t h;
 } my_SDL_Rect_32_t;
 
-typedef struct __attribute__((packed)) my_SDL_Color_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_Color_32_s
 {
     uint8_t r;
     uint8_t g;
@@ -82,13 +82,13 @@ typedef struct __attribute__((packed)) my_SDL_Color_32_s
     uint8_t unused;
 } my_SDL_Color_32_t;
 
-typedef struct __attribute__((packed)) my_SDL_Palette_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_Palette_32_s
 {
     int ncolors;
     ptr_t colors;   // my_SDL_Color_t*
 } my_SDL_Palette_32_t;
 
-typedef struct __attribute__((packed)) my_SDL_PixelFormat_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_PixelFormat_32_s
 {
     ptr_t palette;  // my_SDL_Palette_t *
     uint8_t BitsPerPixel;
@@ -109,7 +109,7 @@ typedef struct __attribute__((packed)) my_SDL_PixelFormat_32_s
     uint8_t alpha;
 } my_SDL_PixelFormat_32_t;
 
-typedef struct __attribute__((packed)) my_SDL_Surface_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_Surface_32_s
 {
     uint32_t flags;
     ptr_t format;   // my_SDL_PixelFormat_t *
@@ -144,7 +144,7 @@ typedef struct my_SDL_keysym_s
     uint16_t unicode;
 } my_SDL_keysym_t;
 
-typedef struct my_SDL_keysym_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_keysym_32_s
 {
     uint8_t scancode;
     int sym;
@@ -338,14 +338,14 @@ typedef union my_SDL_Event_s
     my_SDL_SysWMEvent_t syswm;
 } my_SDL_Event_t;
 
-typedef struct my_SDL_ActiveEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_ActiveEvent_32_s
 {
     uint8_t type;
     uint8_t gain;
     uint8_t state;
 } my_SDL_ActiveEvent_32_t;
 
-typedef struct my_SDL_KeyboardEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_KeyboardEvent_32_s
 {
     uint8_t type;
     uint8_t which;
@@ -353,7 +353,7 @@ typedef struct my_SDL_KeyboardEvent_32_s
     my_SDL_keysym_32_t keysym;
 } my_SDL_KeyboardEvent_32_t;
 
-typedef struct my_SDL_MouseMotionEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_MouseMotionEvent_32_s
 {
     uint8_t type;
     uint8_t which;
@@ -364,7 +364,7 @@ typedef struct my_SDL_MouseMotionEvent_32_s
     int16_t yrel;
 } my_SDL_MouseMotionEvent_32_t;
 
-typedef struct my_SDL_MouseButtonEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_MouseButtonEvent_32_s
 {
     uint8_t type;
     uint8_t which;
@@ -374,7 +374,7 @@ typedef struct my_SDL_MouseButtonEvent_32_s
     uint16_t y;
 } my_SDL_MouseButtonEvent_32_t;
 
-typedef struct my_SDL_JoyAxisEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_JoyAxisEvent_32_s
 {
     uint8_t type;
     uint8_t which;
@@ -382,7 +382,7 @@ typedef struct my_SDL_JoyAxisEvent_32_s
     int16_t value;
 } my_SDL_JoyAxisEvent_32_t;
 
-typedef struct my_SDL_JoyBallEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_JoyBallEvent_32_s
 {
     uint8_t type;
     uint8_t which;
@@ -391,7 +391,7 @@ typedef struct my_SDL_JoyBallEvent_32_s
     int16_t yrel;
 } my_SDL_JoyBallEvent_32_t;
 
-typedef struct my_SDL_JoyHatEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_JoyHatEvent_32_s
 {
     uint8_t type;
     uint8_t which;
@@ -399,7 +399,7 @@ typedef struct my_SDL_JoyHatEvent_32_s
     uint8_t value;
 } my_SDL_JoyHatEvent_32_t;
 
-typedef struct my_SDL_JoyButtonEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_JoyButtonEvent_32_s
 {
     uint8_t type;
     uint8_t which;
@@ -407,24 +407,24 @@ typedef struct my_SDL_JoyButtonEvent_32_s
     uint8_t state;
 } my_SDL_JoyButtonEvent_32_t;
 
-typedef struct my_SDL_ResizeEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_ResizeEvent_32_s
 {
     uint8_t type;
     int w;
     int h;
 } my_SDL_ResizeEvent_32_t;
 
-typedef struct my_SDL_ExposeEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_ExposeEvent_32_s
 {
     uint8_t type;
 } my_SDL_ExposeEvent_32_t;
 
-typedef struct my_SDL_QuitEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_QuitEvent_32_s
 {
     uint8_t type;
 } my_SDL_QuitEvent_32_t;
 
-typedef struct my_SDL_UserEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_UserEvent_32_s
 {
     uint8_t type;
     int code;
@@ -432,13 +432,13 @@ typedef struct my_SDL_UserEvent_32_s
     ptr_t data2;    //void*
 } my_SDL_UserEvent_32_t;
 
-typedef struct my_SDL_version_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL_version_32_s {
     uint8_t major;
     uint8_t minor;
     uint8_t patch;
 } my_SDL_version_32_t;
 
-typedef struct my_SDL_SysWMinfo_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL_SysWMinfo_32_s {
   my_SDL_version_32_t version;
   int subsystem;
   union {
@@ -454,12 +454,12 @@ typedef struct my_SDL_SysWMinfo_32_s {
   } info;
 } my_SDL_SysWMinfo_32_t;
 
-typedef union my_XEvent_32_s {
+typedef union __attribute__((packed, aligned(4))) my_XEvent_32_s {
     int Type;
 	long_t pad[24];
 } my_XEvent_32_t;
 
-typedef struct my_SDL_SysWMmsg_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_SysWMmsg_32_s
 {
     my_SDL_version_32_t version;
     int subsystem;
@@ -469,7 +469,7 @@ typedef struct my_SDL_SysWMmsg_32_s
 } my_SDL_SysWMmsg_32_t;
 
 
-typedef struct my_SDL_SysWMEvent_32_s
+typedef struct __attribute__((packed, aligned(4))) my_SDL_SysWMEvent_32_s
 {
     uint8_t type;
     ptr_t msg; //my_SDL_SysWMmsg_t*
@@ -507,7 +507,7 @@ typedef struct my_SDL_RWops_s {
     void* hidden[3]; // not converting hidden, just moving it
 } my_SDL_RWops_t;
 
-typedef struct my_SDL_RWops_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL_RWops_32_s {
     ptr_t  seek;    //sdl1_seek
     ptr_t  read;    //sdl1_read
     ptr_t write;    //sdl1_write
@@ -538,7 +538,7 @@ typedef struct my_SDL_VideoInfo_s {
   int current_h;
 } my_SDL_VideoInfo_t;
 
-typedef struct my_SDL_VideoInfo_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL_VideoInfo_32_s {
   uint32_t hw_available:1;
   uint32_t wm_available:1;
   uint32_t UnusedBits1:6;
@@ -571,7 +571,7 @@ typedef struct my_SDL_AudioCVT_s {
   int filter_index;
 } my_SDL_AudioCVT_t;
 
-typedef struct my_SDL_AudioCVT_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL_AudioCVT_32_s {
   int needed;
   uint16_t src_format;
   uint16_t dest_format;
diff --git a/src/include/sdl2align32.h b/src/include/sdl2align32.h
index 5356df81..1e9de523 100644
--- a/src/include/sdl2align32.h
+++ b/src/include/sdl2align32.h
@@ -11,7 +11,7 @@ typedef struct my_SDL2_DisplayMode_s {
     void* driverdata;
 } my_SDL2_DisplayMode_t;
 
-typedef struct __attribute__((packed)) my_SDL2_DisplayMode_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL2_DisplayMode_32_s {
     uint32_t format;
     int w;
     int h;
@@ -358,12 +358,12 @@ typedef union my_SDL2_Event_s {
     my_SDL2_DropEvent_t drop;
 } my_SDL2_Event_t;
 
-typedef struct SDL2_CommonEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_CommonEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
 } my_SDL2_CommonEvent_32_t;
 
-typedef struct SDL2_DisplayEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_DisplayEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t display;
@@ -374,7 +374,7 @@ typedef struct SDL2_DisplayEvent_32_s {
     int32_t data1;
 } my_SDL2_DisplayEvent_32_t;
 
-typedef struct SDL2_WindowEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_WindowEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -386,14 +386,14 @@ typedef struct SDL2_WindowEvent_32_s {
     int32_t data2;
 } my_SDL2_WindowEvent_32_t;
 
-typedef struct SDL2_Keysym_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_Keysym_32_s {
     int32_t scancode;
     int32_t sym;
     uint16_t mod;
     uint32_t unused;
 } my_SDL2_Keysym_32_t;
 
-typedef struct SDL2_KeyboardEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_KeyboardEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -404,7 +404,7 @@ typedef struct SDL2_KeyboardEvent_32_s {
     my_SDL2_Keysym_32_t keysym;
 } my_SDL2_KeyboardEvent_32_t;
 
-typedef struct SDL2_TextEditingEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_TextEditingEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -414,7 +414,7 @@ typedef struct SDL2_TextEditingEvent_32_s {
 } my_SDL2_TextEditingEvent_32_t;
 
 
-typedef struct SDL2_TextEditingExtEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_TextEditingExtEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -423,14 +423,14 @@ typedef struct SDL2_TextEditingExtEvent_32_s {
     int32_t length;
 } my_SDL2_TextEditingExtEvent_32_t;
 
-typedef struct SDL2_TextInputEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_TextInputEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
     char text[32];
 } my_SDL2_TextInputEvent_32_t;
 
-typedef struct SDL2_MouseMotionEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_MouseMotionEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -442,7 +442,7 @@ typedef struct SDL2_MouseMotionEvent_32_s {
     int32_t yrel;
 } my_SDL2_MouseMotionEvent_32_t;
 
-typedef struct SDL2_MouseButtonEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_MouseButtonEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -455,7 +455,7 @@ typedef struct SDL2_MouseButtonEvent_32_s {
     int32_t y;
 } my_SDL2_MouseButtonEvent_32_t;
 
-typedef struct SDL2_MouseWheelEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_MouseWheelEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -469,7 +469,7 @@ typedef struct SDL2_MouseWheelEvent_32_s {
     int32_t mouseY;
 } my_SDL2_MouseWheelEvent_32_t;
 
-typedef struct SDL2_JoyAxisEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_JoyAxisEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -482,7 +482,7 @@ typedef struct SDL2_JoyAxisEvent_32_s {
 } my_SDL2_JoyAxisEvent_32_t;
 
 
-typedef struct SDL2_JoyBallEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_JoyBallEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -494,7 +494,7 @@ typedef struct SDL2_JoyBallEvent_32_s {
     int16_t yrel;
 } my_SDL2_JoyBallEvent_32_t;
 
-typedef struct SDL2_JoyHatEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_JoyHatEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -504,7 +504,7 @@ typedef struct SDL2_JoyHatEvent_32_s {
     uint8_t padding2;
 } my_SDL2_JoyHatEvent_32_t;
 
-typedef struct SDL2_JoyButtonEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_JoyButtonEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -514,21 +514,21 @@ typedef struct SDL2_JoyButtonEvent_32_s {
     uint8_t padding2;
 } my_SDL2_JoyButtonEvent_32_t;
 
-typedef struct SDL2_JoyDeviceEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_JoyDeviceEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
 } my_SDL2_JoyDeviceEvent_32_t;
 
 
-typedef struct SDL2_JoyBatteryEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_JoyBatteryEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
     int32_t level;
 } my_SDL2_JoyBatteryEvent_32_t;
 
-typedef struct SDL2_ControllerAxisEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_ControllerAxisEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -541,7 +541,7 @@ typedef struct SDL2_ControllerAxisEvent_32_s {
 } my_SDL2_ControllerAxisEvent_32_t;
 
 
-typedef struct SDL2_ControllerButtonEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_ControllerButtonEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -552,13 +552,13 @@ typedef struct SDL2_ControllerButtonEvent_32_s {
 } my_SDL2_ControllerButtonEvent_32_t;
 
 
-typedef struct SDL2_ControllerDeviceEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_ControllerDeviceEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
 } my_SDL2_ControllerDeviceEvent_32_t;
 
-typedef struct SDL2_ControllerTouchpadEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_ControllerTouchpadEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -569,7 +569,7 @@ typedef struct SDL2_ControllerTouchpadEvent_32_s {
     float pressure;
 } my_SDL2_ControllerTouchpadEvent_32_t;
 
-typedef struct SDL2_ControllerSensorEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_ControllerSensorEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -578,7 +578,7 @@ typedef struct SDL2_ControllerSensorEvent_32_s {
     uint64_t timestamp_us;
 } my_SDL2_ControllerSensorEvent_32_t;
 
-typedef struct SDL2_AudioDeviceEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_AudioDeviceEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t which;
@@ -588,7 +588,7 @@ typedef struct SDL2_AudioDeviceEvent_32_s {
     uint8_t padding3;
 } my_SDL2_AudioDeviceEvent_32_t;
 
-typedef struct SDL2_TouchFingerEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_TouchFingerEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int64_t touchId;
@@ -601,7 +601,7 @@ typedef struct SDL2_TouchFingerEvent_32_s {
     uint32_t windowID;
 } my_SDL2_TouchFingerEvent_32_t;
 
-typedef struct SDL2_MultiGestureEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_MultiGestureEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int64_t touchId;
@@ -614,7 +614,7 @@ typedef struct SDL2_MultiGestureEvent_32_s {
 } my_SDL2_MultiGestureEvent_32_t;
 
 
-typedef struct SDL2_DollarGestureEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_DollarGestureEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int64_t touchId;
@@ -625,14 +625,14 @@ typedef struct SDL2_DollarGestureEvent_32_s {
     float y;
 } my_SDL2_DollarGestureEvent_32_t;
 
-typedef struct SDL2_DropEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_DropEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     ptr_t file;
     uint32_t windowID;
 } my_SDL2_DropEvent_32_t;
 
-typedef struct SDL2_SensorEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_SensorEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -641,13 +641,13 @@ typedef struct SDL2_SensorEvent_32_s {
 } my_SDL2_SensorEvent_32_t;
 
 
-typedef struct SDL2_QuitEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_QuitEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
 } my_SDL2_QuitEvent_32_t;
 
 
-typedef struct SDL2_UserEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_UserEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -656,14 +656,14 @@ typedef struct SDL2_UserEvent_32_s {
     ptr_t data2;
 } my_SDL2_UserEvent_32_t;
 
-typedef struct SDL2_SysWMEvent_32_s {
+typedef struct __attribute__((packed, aligned(4))) SDL2_SysWMEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     ptr_t msg;
 } my_SDL2_SysWMEvent_32_t;
 
 
-typedef union my_SDL2_Event_32_s {
+typedef union __attribute__((packed, aligned(4))) my_SDL2_Event_32_s {
     uint32_t type;
     my_SDL2_CommonEvent_32_t common;
     my_SDL2_DisplayEvent_32_t display;
@@ -809,14 +809,14 @@ typedef struct my_SDL2_Surface_s {
     int refcount;
 } my_SDL2_Surface_t;
 
-typedef struct __attribute__((packed)) my_SDL2_Palette_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL2_Palette_32_s {
     int ncolors;
     ptr_t colors;
     uint32_t version;
     int refcount;
 } my_SDL2_Palette_32_t;
 
-typedef struct __attribute__((packed)) my_SDL2_PixelFormat_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL2_PixelFormat_32_s {
     uint32_t format;
     ptr_t palette;
     uint8_t BitsPerPixel;
@@ -838,12 +838,12 @@ typedef struct __attribute__((packed)) my_SDL2_PixelFormat_32_s {
     ptr_t next;
 } my_SDL2_PixelFormat_32_t;
 
-typedef struct __attribute__((packed)) my_SDL2_Rect_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL2_Rect_32_s {
     int x, y;
     int w, h;
 } my_SDL2_Rect_32_t;
 
-typedef struct __attribute__((packed)) my_SDL2_Surface_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL2_Surface_32_s {
     uint32_t flags;
     ptr_t format;
     int w, h;
@@ -868,7 +868,7 @@ typedef struct my_SDL2_RWops_s {
     void* hidden[3];
 } my_SDL2_RWops_t;
 
-typedef struct my_SDL2_RWops_32_s {
+typedef struct __attribute__((packed, aligned(4))) my_SDL2_RWops_32_s {
     ptr_t size;
     ptr_t seek;
     ptr_t read;