diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-10-06 14:27:19 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-10-06 14:27:19 +0200 |
| commit | ad0c08c2de2dde9e60fd4537f3e4b53c89a468eb (patch) | |
| tree | 87b05e60b1194d9b4752f09f46c2d0181129062d /src | |
| parent | 7b93791c3f428c119e35480bbba1dcec7a413db4 (diff) | |
| download | box64-ad0c08c2de2dde9e60fd4537f3e4b53c89a468eb.tar.gz box64-ad0c08c2de2dde9e60fd4537f3e4b53c89a468eb.zip | |
[BOX32] Proper alignment for x86 structures
Diffstat (limited to 'src')
| -rwxr-xr-x | src/include/myalign32.h | 30 | ||||
| -rw-r--r-- | src/include/sdl1align32.h | 52 | ||||
| -rw-r--r-- | src/include/sdl2align32.h | 76 | ||||
| -rw-r--r-- | src/libtools/my_x11_defs_32.h | 118 | ||||
| -rwxr-xr-x | src/libtools/myalign32.c | 16 | ||||
| -rw-r--r-- | src/wrapped32/wrappedfontconfig.c | 12 | ||||
| -rw-r--r-- | src/wrapped32/wrappedfreetype.c | 46 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedldlinux.c | 2 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibasound.c | 2 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 6 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibdl.c | 4 | ||||
| -rw-r--r-- | src/wrapped32/wrappedsdl1.c | 2 | ||||
| -rw-r--r-- | src/wrapped32/wrappedsdl2.c | 14 |
13 files changed, 194 insertions, 186 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; diff --git a/src/libtools/my_x11_defs_32.h b/src/libtools/my_x11_defs_32.h index e480de36..115648ce 100644 --- a/src/libtools/my_x11_defs_32.h +++ b/src/libtools/my_x11_defs_32.h @@ -5,7 +5,7 @@ typedef ulong_t XID_32; -typedef struct ximage_32_s { +typedef struct __attribute__((packed, aligned(4))) ximage_32_s { ptr_t create_image; ptr_t destroy_image; ptr_t get_pixel; @@ -14,7 +14,7 @@ typedef struct ximage_32_s { ptr_t add_pixel; } ximage_32_t; -typedef struct _XImage_32 { +typedef struct __attribute__((packed, aligned(4))) _XImage_32 { int32_t width, height; int32_t xoffset; int32_t format; @@ -43,7 +43,7 @@ struct my_XFreeFuncs_32 { ptr_t intensityMaps; // void* ptr_t im_filters; // void* ptr_t xkb; // void* -}; +} __attribute__((packed, aligned(4))); struct my_XExten_32 { ptr_t next; //struct my_XExten * @@ -61,18 +61,18 @@ struct my_XExten_32 { ptr_t error_values; // PrintErrorType ptr_t before_flush; // BeforeFlushType ptr_t next_flush; //struct my_XExten * -}; +} __attribute__((packed, aligned(4))); struct my_XInternalAsync_32 { ptr_t next; //struct my_XInternalAsync_32 * ptr_t handler; //int (*handler)(void*, void*, char*, int, void*); ptr_t data; //void* -}; +} __attribute__((packed, aligned(4))); struct my_XLockPtrs_32 { ptr_t lock_display;// void (*lock_display)(void* dpy); ptr_t unlock_display;// void (*unlock_display)(void *dpy); -}; +} __attribute__((packed, aligned(4))); struct my_XConnectionInfo_32 { int fd; @@ -80,15 +80,15 @@ struct my_XConnectionInfo_32 { ptr_t call_data; ptr_t watch_data; // void** struct my_XConnectionInfo *next; -}; +} __attribute__((packed, aligned(4))); struct my_XConnWatchInfo_32 { ptr_t fn; // XConnectionWatchProc ptr_t client_data; ptr_t next; //struct _XConnWatchInfo * -}; +} __attribute__((packed, aligned(4))); -typedef struct my_Screen_32_s { +typedef struct __attribute__((packed, aligned(4))) my_Screen_32_s { ptr_t ext_data; //XExtData * ptr_t display; //struct my_XDisplay_s * XID_32 root; @@ -108,7 +108,7 @@ typedef struct my_Screen_32_s { long_t root_input_mask; } my_Screen_32_t; -typedef struct my_XDisplay_32_s +typedef struct __attribute__((packed, aligned(4))) my_XDisplay_32_s { ptr_t ext_data; //void * //offset = 0x00 ptr_t free_funcs; //struct my_XFreeFuncs_32 * @@ -201,7 +201,7 @@ typedef struct my_XDisplay_32_s ptr_t exit_handler_data; //void * } my_XDisplay_32_t; -typedef struct my_XSetWindowAttributes_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XSetWindowAttributes_32_s { XID_32 background_pixmap; ulong_t background_pixel; XID_32 border_pixmap; @@ -221,7 +221,7 @@ typedef struct my_XSetWindowAttributes_32_s { // Events -typedef struct my_XKeyEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XKeyEvent_32_s { int type; ulong_t serial; @@ -240,7 +240,7 @@ typedef struct my_XKeyEvent_32_s typedef my_XKeyEvent_32_t my_XKeyPressedEvent_32_t; typedef my_XKeyEvent_32_t my_XKeyReleasedEvent_32_t; -typedef struct my_XButtonEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XButtonEvent_32_s { int type; ulong_t serial; @@ -259,7 +259,7 @@ typedef struct my_XButtonEvent_32_s typedef my_XButtonEvent_32_t my_XButtonPressedEvent_32_t; typedef my_XButtonEvent_32_t my_XButtonReleasedEvent_32_t; -typedef struct my_XMotionEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XMotionEvent_32_s { int type; ulong_t serial; @@ -277,7 +277,7 @@ typedef struct my_XMotionEvent_32_s } my_XMotionEvent_32_t; typedef my_XMotionEvent_32_t my_XPointerMovedEvent_32_t; -typedef struct my_XCrossingEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XCrossingEvent_32_s { int type; ulong_t serial; @@ -299,7 +299,7 @@ typedef struct my_XCrossingEvent_32_s typedef my_XCrossingEvent_32_t my_XEnterWindowEvent_32_t; typedef my_XCrossingEvent_32_t my_XLeaveWindowEvent_32_t; -typedef struct my_XFocusChangeEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XFocusChangeEvent_32_s { int type; ulong_t serial; @@ -312,7 +312,7 @@ typedef struct my_XFocusChangeEvent_32_s typedef my_XFocusChangeEvent_32_t my_XFocusInEvent_32_t; typedef my_XFocusChangeEvent_32_t my_XFocusOutEvent_32_t; -typedef struct my_XKeymapEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XKeymapEvent_32_s { int type; ulong_t serial; @@ -322,7 +322,7 @@ typedef struct my_XKeymapEvent_32_s char key_vector[32]; } my_XKeymapEvent_32_t; -typedef struct my_XExposeEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XExposeEvent_32_s { int type; ulong_t serial; @@ -334,7 +334,7 @@ typedef struct my_XExposeEvent_32_s int count; } my_XExposeEvent_32_t; -typedef struct my_XGraphicsExposeEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XGraphicsExposeEvent_32_s { int type; ulong_t serial; @@ -348,7 +348,7 @@ typedef struct my_XGraphicsExposeEvent_32_s int minor_code; } my_XGraphicsExposeEvent_32_t; -typedef struct my_XNoExposeEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XNoExposeEvent_32_s { int type; ulong_t serial; @@ -359,7 +359,7 @@ typedef struct my_XNoExposeEvent_32_s int minor_code; } my_XNoExposeEvent_32_t; -typedef struct my_XVisibilityEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XVisibilityEvent_32_s { int type; ulong_t serial; @@ -369,7 +369,7 @@ typedef struct my_XVisibilityEvent_32_s int state; } my_XVisibilityEvent_32_t; -typedef struct my_XCreateWindowEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XCreateWindowEvent_32_s { int type; ulong_t serial; @@ -383,7 +383,7 @@ typedef struct my_XCreateWindowEvent_32_s int override_redirect; } my_XCreateWindowEvent_32_t; -typedef struct my_XDestroyWindowEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XDestroyWindowEvent_32_s { int type; ulong_t serial; @@ -393,7 +393,7 @@ typedef struct my_XDestroyWindowEvent_32_s XID_32 window; } my_XDestroyWindowEvent_32_t; -typedef struct my_XUnmapEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XUnmapEvent_32_s { int type; ulong_t serial; @@ -404,7 +404,7 @@ typedef struct my_XUnmapEvent_32_s int from_configure; } my_XUnmapEvent_32_t; -typedef struct my_XMapEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XMapEvent_32_s { int type; ulong_t serial; @@ -415,7 +415,7 @@ typedef struct my_XMapEvent_32_s int override_redirect; } my_XMapEvent_32_t; -typedef struct my_XMapRequestEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XMapRequestEvent_32_s { int type; ulong_t serial; @@ -425,7 +425,7 @@ typedef struct my_XMapRequestEvent_32_s XID_32 window; } my_XMapRequestEvent_32_t; -typedef struct my_XReparentEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XReparentEvent_32_s { int type; ulong_t serial; @@ -438,7 +438,7 @@ typedef struct my_XReparentEvent_32_s int override_redirect; } my_XReparentEvent_32_t; -typedef struct my_XConfigureEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XConfigureEvent_32_s { int type; ulong_t serial; @@ -453,7 +453,7 @@ typedef struct my_XConfigureEvent_32_s int override_redirect; } my_XConfigureEvent_32_t; -typedef struct my_XGravityEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XGravityEvent_32_s { int type; ulong_t serial; @@ -464,7 +464,7 @@ typedef struct my_XGravityEvent_32_s int x, y; } my_XGravityEvent_32_t; -typedef struct my_XResizeRequestEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XResizeRequestEvent_32_s { int type; ulong_t serial; @@ -474,7 +474,7 @@ typedef struct my_XResizeRequestEvent_32_s int width, height; } my_XResizeRequestEvent_32_t; -typedef struct my_XConfigureRequestEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XConfigureRequestEvent_32_s { int type; ulong_t serial; @@ -490,7 +490,7 @@ typedef struct my_XConfigureRequestEvent_32_s ulong_t value_mask; } my_XConfigureRequestEvent_32_t; -typedef struct my_XCirculateEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XCirculateEvent_32_s { int type; ulong_t serial; @@ -501,7 +501,7 @@ typedef struct my_XCirculateEvent_32_s int place; } my_XCirculateEvent_32_t; -typedef struct my_XCirculateRequestEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XCirculateRequestEvent_32_s { int type; ulong_t serial; @@ -512,7 +512,7 @@ typedef struct my_XCirculateRequestEvent_32_s int place; } my_XCirculateRequestEvent_32_t; -typedef struct my_XPropertyEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XPropertyEvent_32_s { int type; ulong_t serial; @@ -524,7 +524,7 @@ typedef struct my_XPropertyEvent_32_s int state; } my_XPropertyEvent_32_t; -typedef struct my_XSelectionClearEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XSelectionClearEvent_32_s { int type; ulong_t serial; @@ -535,7 +535,7 @@ typedef struct my_XSelectionClearEvent_32_s ulong_t time; } my_XSelectionClearEvent_32_t; -typedef struct my_XSelectionRequestEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XSelectionRequestEvent_32_s { int type; ulong_t serial; @@ -549,7 +549,7 @@ typedef struct my_XSelectionRequestEvent_32_s ulong_t time; } my_XSelectionRequestEvent_32_t; -typedef struct my_XSelectionEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XSelectionEvent_32_s { int type; ulong_t serial; @@ -562,7 +562,7 @@ typedef struct my_XSelectionEvent_32_s ulong_t time; } my_XSelectionEvent_32_t; -typedef struct my_XColormapEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XColormapEvent_32_s { int type; ulong_t serial; @@ -574,7 +574,7 @@ typedef struct my_XColormapEvent_32_s int state; } my_XColormapEvent_32_t; -typedef struct my_XClientMessageEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XClientMessageEvent_32_s { int type; ulong_t serial; @@ -590,7 +590,7 @@ typedef struct my_XClientMessageEvent_32_s } data; } my_XClientMessageEvent_32_t; -typedef struct my_XMappingEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XMappingEvent_32_s { int type; ulong_t serial; @@ -602,7 +602,7 @@ typedef struct my_XMappingEvent_32_s int count; } my_XMappingEvent_32_t; -typedef struct my_XErrorEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XErrorEvent_32_s { int type; ptr_t display; //Display* @@ -613,7 +613,7 @@ typedef struct my_XErrorEvent_32_s unsigned char minor_code; } my_XErrorEvent_32_t; -typedef struct my_XAnyEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XAnyEvent_32_s { int type; ulong_t serial; @@ -622,7 +622,7 @@ typedef struct my_XAnyEvent_32_s XID_32 window; } my_XAnyEvent_32_t; -typedef struct my_XGenericEvent_32_s +typedef struct __attribute__((packed, aligned(4))) my_XGenericEvent_32_s { int type; ulong_t serial; @@ -632,7 +632,7 @@ typedef struct my_XGenericEvent_32_s int evtype; } my_XGenericEvent_32_t; -typedef struct my_XGenericEventCookie_32_s +typedef struct __attribute__((packed, aligned(4))) my_XGenericEventCookie_32_s { int type; ulong_t serial; @@ -644,7 +644,7 @@ typedef struct my_XGenericEventCookie_32_s void *data; } my_XGenericEventCookie_32_t; -typedef union my_XEvent_32_s { +typedef union __attribute__((packed, aligned(4))) my_XEvent_32_s { int type; my_XAnyEvent_32_t xany; my_XKeyEvent_32_t xkey; @@ -683,7 +683,7 @@ typedef union my_XEvent_32_s { } my_XEvent_32_t; // WMHints -typedef struct my_XWMHints_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XWMHints_32_s { long_t flags; int input; int initial_state; @@ -695,7 +695,7 @@ typedef struct my_XWMHints_32_s { XID_32 window_group; } my_XWMHints_32_t; -typedef struct my_XRRModeInfo_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XRRModeInfo_32_s { XID_32 id; unsigned int width; unsigned int height; @@ -713,7 +713,7 @@ typedef struct my_XRRModeInfo_32_s { } my_XRRModeInfo_32_t; -typedef struct my_XRRScreenResources_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XRRScreenResources_32_s { ulong_t timestamp; ulong_t configTimestamp; int ncrtc; @@ -724,7 +724,7 @@ typedef struct my_XRRScreenResources_32_s { ptr_t modes; //my_XRRModeInfo_32_t * } my_XRRScreenResources_32_t; -typedef struct my_XRRCrtcInfo_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XRRCrtcInfo_32_s { ulong_t timestamp; int x, y; unsigned int width, height; @@ -737,7 +737,7 @@ typedef struct my_XRRCrtcInfo_32_s { ptr_t possible; //XID_32* } my_XRRCrtcInfo_32_t; -typedef struct my_XRROutputInfo_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XRROutputInfo_32_s { ulong_t timestamp; XID_32 crtc; ptr_t name; //char* @@ -755,7 +755,7 @@ typedef struct my_XRROutputInfo_32_s { ptr_t modes; //XID_32* } my_XRROutputInfo_32_t; -typedef struct my_XWindowAttributes_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XWindowAttributes_32_s { int x, y; int width, height; int border_width; @@ -779,7 +779,7 @@ typedef struct my_XWindowAttributes_32_s { ptr_t screen; //Screen* } my_XWindowAttributes_32_t; -typedef struct my_XVisualInfo_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XVisualInfo_32_s { ptr_t visual; //Visual* ulong_t visualid; int screen; @@ -792,25 +792,25 @@ typedef struct my_XVisualInfo_32_s { int bits_per_rgb; } my_XVisualInfo_32_t; -typedef struct my_XModifierKeymap_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XModifierKeymap_32_s { int max_keypermod; ptr_t modifiermap; //uint8_t* } my_XModifierKeymap_32_t; -typedef struct my_XdbeVisualInfo_32_s +typedef struct __attribute__((packed, aligned(4))) my_XdbeVisualInfo_32_s { XID_32 visual; int depth; int perflevel; } my_XdbeVisualInfo_32_t; -typedef struct my_XdbeScreenVisualInfo_32_s +typedef struct __attribute__((packed, aligned(4))) my_XdbeScreenVisualInfo_32_s { int count; ptr_t visinfo; //my_XdbeVisualInfo_t* } my_XdbeScreenVisualInfo_32_t; -typedef struct my_XF86VidModeModeInfo_32_s +typedef struct __attribute__((packed, aligned(4))) my_XF86VidModeModeInfo_32_s { unsigned int dotclock; unsigned short hdisplay; @@ -827,14 +827,14 @@ typedef struct my_XF86VidModeModeInfo_32_s ptr_t tc_private; } my_XF86VidModeModeInfo_32_t; -typedef struct my_XColor_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XColor_32_s { ulong_t pixel; unsigned short red, green, blue; char flags; char pad; } my_XColor_32_t; -typedef struct my_XRRProviderInfo_32_s { +typedef struct __attribute__((packed, aligned(4))) my_XRRProviderInfo_32_s { unsigned int capabilities; int ncrtcs; ptr_t crtcs; //XID* @@ -847,7 +847,7 @@ typedef struct my_XRRProviderInfo_32_s { int nameLen; } my_XRRProviderInfo_32_t; -typedef struct my_XRRProviderResources_32_t { +typedef struct __attribute__((packed, aligned(4))) my_XRRProviderResources_32_t { ulong_t timestamp; int nproviders; ptr_t providers; //XID* diff --git a/src/libtools/myalign32.c b/src/libtools/myalign32.c index 42ff785a..63ae2951 100755 --- a/src/libtools/myalign32.c +++ b/src/libtools/myalign32.c @@ -944,7 +944,7 @@ void myStackAlignW32(const char* fmt, uint32_t* st, uint64_t* mystack) #if 0 -typedef struct __attribute__((packed)) { +typedef struct __attribute__((packed, aligned(4))) { unsigned char *body_data; long body_storage; long body_fill; @@ -970,7 +970,7 @@ typedef struct __attribute__((packed)) { } ogg_stream_state_x64; -typedef struct __attribute__((packed)) vorbis_dsp_state_x64 { +typedef struct __attribute__((packed, aligned(4))) vorbis_dsp_state_x64 { int analysisp; void *vi; //vorbis_info @@ -999,7 +999,7 @@ typedef struct __attribute__((packed)) vorbis_dsp_state_x64 { void *backend_state; } vorbis_dsp_state_x64; -typedef struct __attribute__((packed)) { +typedef struct __attribute__((packed, aligned(4))) { long endbyte; int endbit; @@ -1008,7 +1008,7 @@ typedef struct __attribute__((packed)) { long storage; } oggpack_buffer_x64; -typedef struct __attribute__((packed)) vorbis_block_x64 { +typedef struct __attribute__((packed, aligned(4))) vorbis_block_x64 { float **pcm; oggpack_buffer_x64 opb; @@ -1039,7 +1039,7 @@ typedef struct __attribute__((packed)) vorbis_block_x64 { } vorbis_block_x64; -typedef struct __attribute__((packed)) OggVorbis_x64 { +typedef struct __attribute__((packed, aligned(4))) OggVorbis_x64 { void *datasource; /* Pointer to a FILE *, etc. */ int seekable; int64_t offset; @@ -1276,14 +1276,14 @@ void AlignVorbisBlock(void* dest, void* source) #undef TRANSFERT #endif -typedef union __attribute__((packed)) i386_epoll_data { +typedef union __attribute__((packed, aligned(4))) i386_epoll_data { ptr_t ptr; //void* int fd; uint32_t u32; uint64_t u64; } i386_epoll_data_t; -struct __attribute__((packed)) i386_epoll_event { +struct __attribute__((packed, aligned(4))) i386_epoll_event { uint32_t events; i386_epoll_data_t data; }; @@ -1315,7 +1315,7 @@ void AlignEpollEvent32(void* dest, void* source, int nbr) } } #if 0 -typedef struct __attribute__((packed)) x64_SMPEG_Info_s { +typedef struct __attribute__((packed, aligned(4))) x64_SMPEG_Info_s { int has_audio; int has_video; int width; diff --git a/src/wrapped32/wrappedfontconfig.c b/src/wrapped32/wrappedfontconfig.c index 69e5c28d..9533b2e5 100644 --- a/src/wrapped32/wrappedfontconfig.c +++ b/src/wrapped32/wrappedfontconfig.c @@ -81,7 +81,7 @@ typedef struct FcConfig_s { // 32bits structures -typedef struct FcValue_32_s { +typedef struct __attribute__((packed, aligned(4))) FcValue_32_s { int type; union { ptr_t s;//const char * @@ -95,33 +95,33 @@ typedef struct FcValue_32_s { } u; } FcValue_32_t; -typedef struct FcPattern_32_s { +typedef struct __attribute__((packed, aligned(4))) FcPattern_32_s { int num; int size; long_t elts_offset; int ref; } FcPattern_32_t; -typedef struct FcFontSet_32_s { +typedef struct __attribute__((packed, aligned(4))) FcFontSet_32_s { int nfont; int sfont; ptr_t fonts;//FcPattern_t ** } FcFontSet_32_t; -typedef struct FcStrSet_32_s { +typedef struct __attribute__((packed, aligned(4))) FcStrSet_32_s { int ref; int num; int size; ptr_t strs; //void ** } FcStrSet_32_t; -typedef struct FcBlanks_32_s { +typedef struct __attribute__((packed, aligned(4))) FcBlanks_32_s { int nblank; int sblank; ptr_t blanks; //void * } FcBlanks_32_t; -typedef struct FcConfig_32_s { +typedef struct __attribute__((packed, aligned(4))) FcConfig_32_s { ptr_t configDirs; //FcStrSet_t* ptr_t blanks; //FcBlanks_t* ptr_t fontDirs; //FcStrSet_t* diff --git a/src/wrapped32/wrappedfreetype.c b/src/wrapped32/wrappedfreetype.c index a1e61b46..ca71c3f7 100644 --- a/src/wrapped32/wrappedfreetype.c +++ b/src/wrapped32/wrappedfreetype.c @@ -331,13 +331,13 @@ typedef struct FT_Matrix_s // 32bits FreeType structures // =============================================== -typedef union FT_StreamDesc_32_s +typedef union __attribute__((packed, aligned(4))) FT_StreamDesc_32_s { long_t value; ptr_t pointer; //void* } FT_StreamDesc_32_t; -typedef struct FT_StreamRec_32_s +typedef struct __attribute__((packed, aligned(4))) FT_StreamRec_32_s { ptr_t base; //unsigned char* ulong_t size; @@ -354,29 +354,29 @@ typedef struct FT_StreamRec_32_s } FT_StreamRec_32_t; -typedef struct FT_BBox_32_s +typedef struct __attribute__((packed, aligned(4))) FT_BBox_32_s { long_t xMin, yMin; long_t xMax, yMax; } FT_BBox_32_t; -typedef struct FT_Generic_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Generic_32_s { ptr_t data; //void* ptr_t finalizer; //vFp_t } FT_Generic_32_t; -typedef struct FT_ListRec_32_s +typedef struct __attribute__((packed, aligned(4))) FT_ListRec_32_s { ptr_t head; //void* ptr_t tail; //void* } FT_ListRec_32_t; -typedef struct FT_Vector_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Vector_32_s { long_t x; long_t y; } FT_Vector_32_t; -typedef struct FT_Bitmap_Size_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Bitmap_Size_32_s { short height; short width; @@ -385,7 +385,7 @@ typedef struct FT_Bitmap_Size_32_s long_t y_ppem; } FT_Bitmap_Size_32_t; -typedef struct FT_Glyph_Metrics_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Glyph_Metrics_32_s { long_t width; long_t height; @@ -397,7 +397,7 @@ typedef struct FT_Glyph_Metrics_32_s long_t vertAdvance; } FT_Glyph_Metrics_32_t; -typedef struct FT_Outline_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Outline_32_s { unsigned short n_contours; unsigned short n_points; @@ -407,7 +407,7 @@ typedef struct FT_Outline_32_s int flags; } FT_Outline_32_t; -typedef struct FT_Bitmap_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Bitmap_32_s { unsigned int rows; unsigned int width; @@ -419,7 +419,7 @@ typedef struct FT_Bitmap_32_s ptr_t palette; //void* } FT_Bitmap_32_t; -typedef struct FT_GlyphSlotRec_32_s +typedef struct __attribute__((packed, aligned(4))) FT_GlyphSlotRec_32_s { ptr_t library; //FT_Library ptr_t face; //FT_Face @@ -445,7 +445,7 @@ typedef struct FT_GlyphSlotRec_32_s ptr_t internal; } FT_GlyphSlotRec_32_t; -typedef struct FT_CharMapRec_32_s +typedef struct __attribute__((packed, aligned(4))) FT_CharMapRec_32_s { ptr_t face; //FT_FaceRec_t* int encoding; @@ -453,7 +453,7 @@ typedef struct FT_CharMapRec_32_s uint16_t encoding_id; } FT_CharMapRec_32_t; -typedef struct FT_Size_Metrics_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Size_Metrics_32_s { uint16_t x_ppem; uint16_t y_ppem; @@ -465,7 +465,7 @@ typedef struct FT_Size_Metrics_32_s long_t max_advance; } FT_Size_Metrics_32_t; -typedef struct FT_SizeRec_32_s +typedef struct __attribute__((packed, aligned(4))) FT_SizeRec_32_s { ptr_t face; //FT_FaceRec_t* FT_Generic_32_t generic; @@ -473,7 +473,7 @@ typedef struct FT_SizeRec_32_s ptr_t internal; //FT_Size_Internal } FT_SizeRec_32_t; -typedef struct FT_FaceRec_32_s +typedef struct __attribute__((packed, aligned(4))) FT_FaceRec_32_s { long_t num_faces; long_t face_index; @@ -509,7 +509,7 @@ typedef struct FT_FaceRec_32_s ptr_t internal; //void* } FT_FaceRec_32_t; -typedef struct FT_MemoryRec_32_s +typedef struct __attribute__((packed, aligned(4))) FT_MemoryRec_32_s { ptr_t user; //void* ptr_t alloc; //void* @@ -517,7 +517,7 @@ typedef struct FT_MemoryRec_32_s ptr_t realloc;//void* } FT_MemoryRec_32_t; -typedef struct PS_PrivateRec_32_s +typedef struct __attribute__((packed, aligned(4))) PS_PrivateRec_32_s { int unique_id; int lenIV; @@ -546,7 +546,7 @@ typedef struct PS_PrivateRec_32_s int16_t min_feature[2]; } PS_PrivateRec_32_t; -typedef struct BDF_PropertyRec_32_s +typedef struct __attribute__((packed, aligned(4))) BDF_PropertyRec_32_s { int type; union { @@ -557,7 +557,7 @@ typedef struct BDF_PropertyRec_32_s } u; } BDF_PropertyRec_32_t; -typedef struct FT_Size_RequestRec_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Size_RequestRec_32_s { int type; long_t width; @@ -566,13 +566,13 @@ typedef struct FT_Size_RequestRec_32_s uint32_t vertResolution; } FT_Size_RequestRec_32_t; -typedef struct FT_Parameter_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Parameter_32_s { ulong_t tag; ptr_t data; //void* } FT_Parameter_32_t; -typedef struct FT_Open_Args_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Open_Args_32_s { uint32_t flags; ptr_t memory_base; //uint8_t* @@ -584,7 +584,7 @@ typedef struct FT_Open_Args_32_s ptr_t params; //FT_Parameter_t* } FT_Open_Args_32_t; -typedef struct FT_WinFNT_HeaderRec_32_s +typedef struct __attribute__((packed, aligned(4))) FT_WinFNT_HeaderRec_32_s { uint16_t version; ulong_t file_size; @@ -624,7 +624,7 @@ typedef struct FT_WinFNT_HeaderRec_32_s ulong_t reserved1[4]; } FT_WinFNT_HeaderRec_32_t; -typedef struct FT_Matrix_32_s +typedef struct __attribute__((packed, aligned(4))) FT_Matrix_32_s { long_t xx, xy; long_t yx, yy; diff --git a/src/wrapped32/wrappedldlinux.c b/src/wrapped32/wrappedldlinux.c index f0c8bf89..b9773d99 100755 --- a/src/wrapped32/wrappedldlinux.c +++ b/src/wrapped32/wrappedldlinux.c @@ -15,7 +15,7 @@ #include "elfloader.h" #include "box32context.h" -typedef struct my32_tls_s { +typedef struct __attribute__((packed, aligned(4))) my32_tls_s { int i; uint32_t o; } my32_tls_t; diff --git a/src/wrapped32/wrappedlibasound.c b/src/wrapped32/wrappedlibasound.c index 02d1bebc..c572ae85 100644 --- a/src/wrapped32/wrappedlibasound.c +++ b/src/wrapped32/wrappedlibasound.c @@ -288,7 +288,7 @@ typedef struct _my_snd_pcm_channel_area_s { unsigned int first; unsigned int step; } my_snd_pcm_channel_area_t; -typedef struct _my_snd_pcm_channel_area_32_s { +typedef struct __attribute__((packed, aligned(4))) _my_snd_pcm_channel_area_32_s { ptr_t addr; unsigned int first; unsigned int step; diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index 779fb225..ad3478fb 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -1964,7 +1964,7 @@ EXPORT int32_t my32_execvp(x64emu_t* emu, const char* path, ptr_t argv[]) return execv(fullpath, (void*)newargv); } // execvp should use PATH to search for the program first -typedef struct +typedef struct __attribute__((packed, aligned(4))) { int __allocated; int __used; @@ -2662,7 +2662,7 @@ EXPORT void* my32___deregister_frame_info(void* a) EXPORT void* my32____brk_addr = NULL; #endif // longjmp / setjmp -typedef struct jump_buff_i386_s { +typedef struct __attribute__((packed, aligned(4))) jump_buff_i386_s { uint32_t save_ebx; uint32_t save_esi; uint32_t save_edi; @@ -2671,7 +2671,7 @@ typedef struct jump_buff_i386_s { uint32_t save_eip; } jump_buff_i386_t; -typedef struct __jmp_buf_tag_s { +typedef struct __attribute__((packed, aligned(4))) __jmp_buf_tag_s { jump_buff_i386_t __jmpbuf; int __mask_was_saved; sigset_t __saved_mask; diff --git a/src/wrapped32/wrappedlibdl.c b/src/wrapped32/wrappedlibdl.c index c3a79feb..05e7b058 100755 --- a/src/wrapped32/wrappedlibdl.c +++ b/src/wrapped32/wrappedlibdl.c @@ -51,7 +51,7 @@ void dl_set_error(const char*); char* dl_last_error(); library_t* dl_get_library(void* handle); -typedef struct my_dl_info_32_s +typedef struct __attribute__((packed, aligned(4))) my_dl_info_32_s { ptr_t dli_fname; // const char* ptr_t dli_fbase; // void* @@ -120,7 +120,7 @@ int my32_dlinfo(x64emu_t* emu, void* handle, int request, void* info) return -1; } -typedef struct my_dl_find_object_s { +typedef struct __attribute__((packed, aligned(4))) my_dl_find_object_s { uint64_t dlfo_flags; ptr_t dlfo_map_start; ptr_t dlfo_map_end; diff --git a/src/wrapped32/wrappedsdl1.c b/src/wrapped32/wrappedsdl1.c index a3a727c8..7186fc47 100644 --- a/src/wrapped32/wrappedsdl1.c +++ b/src/wrapped32/wrappedsdl1.c @@ -48,7 +48,7 @@ typedef struct { void *userdata; } SDL_AudioSpec; -typedef struct { +typedef struct __attribute__((packed, aligned(4))) { int32_t freq; uint16_t format; uint8_t channels; diff --git a/src/wrapped32/wrappedsdl2.c b/src/wrapped32/wrappedsdl2.c index 13fe4652..64cbaa9d 100644 --- a/src/wrapped32/wrappedsdl2.c +++ b/src/wrapped32/wrappedsdl2.c @@ -48,7 +48,7 @@ typedef struct { void* userdata; } SDL2_AudioSpec; -typedef struct __attribute__((packed)) { +typedef struct __attribute__((packed, aligned(4))) { int32_t freq; uint16_t format; uint8_t channels; @@ -508,6 +508,13 @@ typedef struct SDL_version_s uint8_t patch; } SDL_version_t; +typedef struct __attribute__((packed, aligned(4))) SDL_version_32_s +{ + uint8_t major; + uint8_t minor; + uint8_t patch; +} SDL_version_32_t; + typedef struct SDL_SysWMinfo_s { SDL_version_t version; @@ -523,9 +530,9 @@ typedef struct SDL_SysWMinfo_s } info; } SDL_SysWMinfo_t; -typedef struct SDL_SysWMinfo_32_s +typedef struct __attribute__((packed, aligned(4))) SDL_SysWMinfo_32_s { - SDL_version_t version; + SDL_version_32_t version; int subsystem; // 1=Windows, 2 =X11, 6=Wayland union { @@ -541,6 +548,7 @@ void* FindDisplay(void* d); EXPORT int my32_2_SDL_GetWindowWMInfo(void* w, SDL_SysWMinfo_32_t* i) { // 32bits and 64bits have the same size... + // TODO: Check if it's true int ret = my->SDL_GetWindowWMInfo(w, i); if(i->subsystem==2) { // inplace conversion |