about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-09-30 15:37:11 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-09-30 15:37:11 +0200
commit0980c4438aa1688b6d356c49b6a09eef217d2924 (patch)
tree119fd42c1da638fc5b85ed557606f1f7e1b803db /src
parentf7c93b68d8fc62987b0c73e97cae5cc6ee31b269 (diff)
downloadbox64-0980c4438aa1688b6d356c49b6a09eef217d2924.tar.gz
box64-0980c4438aa1688b6d356c49b6a09eef217d2924.zip
[BOX32][WRAPPER] More work on SDL2 Wrapping(but TheStanleyParable still don't have mouse input working)
Diffstat (limited to 'src')
-rw-r--r--src/include/sdl2align32.h68
-rw-r--r--src/libtools/sdl2align32.c205
-rw-r--r--src/wrapped32/wrappedsdl2.c13
3 files changed, 173 insertions, 113 deletions
diff --git a/src/include/sdl2align32.h b/src/include/sdl2align32.h
index 6cca070b..c1abac08 100644
--- a/src/include/sdl2align32.h
+++ b/src/include/sdl2align32.h
@@ -358,12 +358,12 @@ typedef union my_SDL2_Event_s {
     my_SDL2_DropEvent_t drop;
 } my_SDL2_Event_t;
 
-typedef struct __attribute__((packed)) SDL2_CommonEvent_32_s {
+typedef struct SDL2_CommonEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
 } my_SDL2_CommonEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_DisplayEvent_32_s {
+typedef struct SDL2_DisplayEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t display;
@@ -374,7 +374,7 @@ typedef struct __attribute__((packed)) SDL2_DisplayEvent_32_s {
     int32_t data1;
 } my_SDL2_DisplayEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_WindowEvent_32_s {
+typedef struct SDL2_WindowEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -386,14 +386,14 @@ typedef struct __attribute__((packed)) SDL2_WindowEvent_32_s {
     int32_t data2;
 } my_SDL2_WindowEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_Keysym_32_s {
+typedef struct SDL2_Keysym_32_s {
     int32_t scancode;
     int32_t sym;
     uint16_t mod;
     uint32_t unused;
 } my_SDL2_Keysym_32_t;
 
-typedef struct __attribute__((packed)) SDL2_KeyboardEvent_32_s {
+typedef struct SDL2_KeyboardEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -404,7 +404,7 @@ typedef struct __attribute__((packed)) SDL2_KeyboardEvent_32_s {
     my_SDL2_Keysym_32_t keysym;
 } my_SDL2_KeyboardEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_TextEditingEvent_32_s {
+typedef struct SDL2_TextEditingEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -414,23 +414,23 @@ typedef struct __attribute__((packed)) SDL2_TextEditingEvent_32_s {
 } my_SDL2_TextEditingEvent_32_t;
 
 
-typedef struct __attribute__((packed)) SDL2_TextEditingExtEvent_32_s {
+typedef struct SDL2_TextEditingExtEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
-    char* text;
+    ptr_t text; //char*
     int32_t start;
     int32_t length;
 } my_SDL2_TextEditingExtEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_TextInputEvent_32_s {
+typedef struct SDL2_TextInputEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
     char text[32];
 } my_SDL2_TextInputEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_MouseMotionEvent_32_s {
+typedef struct SDL2_MouseMotionEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -442,7 +442,7 @@ typedef struct __attribute__((packed)) SDL2_MouseMotionEvent_32_s {
     int32_t yrel;
 } my_SDL2_MouseMotionEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_MouseButtonEvent_32_s {
+typedef struct SDL2_MouseButtonEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -455,7 +455,7 @@ typedef struct __attribute__((packed)) SDL2_MouseButtonEvent_32_s {
     int32_t y;
 } my_SDL2_MouseButtonEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_MouseWheelEvent_32_s {
+typedef struct SDL2_MouseWheelEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -469,7 +469,7 @@ typedef struct __attribute__((packed)) SDL2_MouseWheelEvent_32_s {
     int32_t mouseY;
 } my_SDL2_MouseWheelEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_JoyAxisEvent_32_s {
+typedef struct SDL2_JoyAxisEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -482,7 +482,7 @@ typedef struct __attribute__((packed)) SDL2_JoyAxisEvent_32_s {
 } my_SDL2_JoyAxisEvent_32_t;
 
 
-typedef struct __attribute__((packed)) SDL2_JoyBallEvent_32_s {
+typedef struct SDL2_JoyBallEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -494,7 +494,7 @@ typedef struct __attribute__((packed)) SDL2_JoyBallEvent_32_s {
     int16_t yrel;
 } my_SDL2_JoyBallEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_JoyHatEvent_32_s {
+typedef struct SDL2_JoyHatEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -504,7 +504,7 @@ typedef struct __attribute__((packed)) SDL2_JoyHatEvent_32_s {
     uint8_t padding2;
 } my_SDL2_JoyHatEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_JoyButtonEvent_32_s {
+typedef struct SDL2_JoyButtonEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -514,21 +514,21 @@ typedef struct __attribute__((packed)) SDL2_JoyButtonEvent_32_s {
     uint8_t padding2;
 } my_SDL2_JoyButtonEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_JoyDeviceEvent_32_s {
+typedef struct SDL2_JoyDeviceEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
 } my_SDL2_JoyDeviceEvent_32_t;
 
 
-typedef struct __attribute__((packed)) SDL2_JoyBatteryEvent_32_s {
+typedef struct SDL2_JoyBatteryEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
     int32_t level;
 } my_SDL2_JoyBatteryEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_ControllerAxisEvent_32_s {
+typedef struct SDL2_ControllerAxisEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -541,7 +541,7 @@ typedef struct __attribute__((packed)) SDL2_ControllerAxisEvent_32_s {
 } my_SDL2_ControllerAxisEvent_32_t;
 
 
-typedef struct __attribute__((packed)) SDL2_ControllerButtonEvent_32_s {
+typedef struct SDL2_ControllerButtonEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -552,13 +552,13 @@ typedef struct __attribute__((packed)) SDL2_ControllerButtonEvent_32_s {
 } my_SDL2_ControllerButtonEvent_32_t;
 
 
-typedef struct __attribute__((packed)) SDL2_ControllerDeviceEvent_32_s {
+typedef struct SDL2_ControllerDeviceEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
 } my_SDL2_ControllerDeviceEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_ControllerTouchpadEvent_32_s {
+typedef struct SDL2_ControllerTouchpadEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -569,7 +569,7 @@ typedef struct __attribute__((packed)) SDL2_ControllerTouchpadEvent_32_s {
     float pressure;
 } my_SDL2_ControllerTouchpadEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_ControllerSensorEvent_32_s {
+typedef struct SDL2_ControllerSensorEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -578,7 +578,7 @@ typedef struct __attribute__((packed)) SDL2_ControllerSensorEvent_32_s {
     uint64_t timestamp_us;
 } my_SDL2_ControllerSensorEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_AudioDeviceEvent_32_s {
+typedef struct SDL2_AudioDeviceEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t which;
@@ -588,7 +588,7 @@ typedef struct __attribute__((packed)) SDL2_AudioDeviceEvent_32_s {
     uint8_t padding3;
 } my_SDL2_AudioDeviceEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_TouchFingerEvent_32_s {
+typedef struct SDL2_TouchFingerEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int64_t touchId;
@@ -601,7 +601,7 @@ typedef struct __attribute__((packed)) SDL2_TouchFingerEvent_32_s {
     uint32_t windowID;
 } my_SDL2_TouchFingerEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_MultiGestureEvent_32_s {
+typedef struct SDL2_MultiGestureEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int64_t touchId;
@@ -614,7 +614,7 @@ typedef struct __attribute__((packed)) SDL2_MultiGestureEvent_32_s {
 } my_SDL2_MultiGestureEvent_32_t;
 
 
-typedef struct __attribute__((packed)) SDL2_DollarGestureEvent_32_s {
+typedef struct SDL2_DollarGestureEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int64_t touchId;
@@ -625,14 +625,14 @@ typedef struct __attribute__((packed)) SDL2_DollarGestureEvent_32_s {
     float y;
 } my_SDL2_DollarGestureEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_DropEvent_32_s {
+typedef struct SDL2_DropEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     ptr_t file;
     uint32_t windowID;
 } my_SDL2_DropEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_SensorEvent_32_s {
+typedef struct SDL2_SensorEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     int32_t which;
@@ -641,13 +641,13 @@ typedef struct __attribute__((packed)) SDL2_SensorEvent_32_s {
 } my_SDL2_SensorEvent_32_t;
 
 
-typedef struct __attribute__((packed)) SDL2_QuitEvent_32_s {
+typedef struct SDL2_QuitEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
 } my_SDL2_QuitEvent_32_t;
 
 
-typedef struct __attribute__((packed)) SDL2_UserEvent_32_s {
+typedef struct SDL2_UserEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     uint32_t windowID;
@@ -656,14 +656,14 @@ typedef struct __attribute__((packed)) SDL2_UserEvent_32_s {
     ptr_t data2;
 } my_SDL2_UserEvent_32_t;
 
-typedef struct __attribute__((packed)) SDL2_SysWMEvent_32_s {
+typedef struct SDL2_SysWMEvent_32_s {
     uint32_t type;
     uint32_t timestamp;
     ptr_t msg;
 } my_SDL2_SysWMEvent_32_t;
 
 
-typedef union __attribute__((packed)) my_SDL2_Event_32_s {
+typedef union my_SDL2_Event_32_s {
     uint32_t type;
     my_SDL2_CommonEvent_32_t common;
     my_SDL2_DisplayEvent_32_t display;
@@ -885,6 +885,8 @@ void convert_SDL2_DisplayMode_to_32(void* dst_, void* src_);
 
 void convert_SDL2_Event_to_64(void* dst_, const void* src_);
 void convert_SDL2_Event_to_32(void* dst_, const void* src_);
+void inplace_SDL2_Event_shrink(void* e);
+void inplace_SDL2_Event_enlarge(void* e);
 
 void inplace_SDL2_Palette_to_32(void* a);
 void inplace_SDL2_PixelFormat_to_32(void* a);
diff --git a/src/libtools/sdl2align32.c b/src/libtools/sdl2align32.c
index 7eac83fa..93da8c69 100644
--- a/src/libtools/sdl2align32.c
+++ b/src/libtools/sdl2align32.c
@@ -57,124 +57,147 @@ void convert_SDL2_DisplayMode_to_64(void* dst_, void* src_)
 
 void convert_SDL2_Event_to_64(void* dst_, const void* src_)
 {
+    // in reverse order so it can be done inplace...
     if (!src_ || !dst_) return;
     const my_SDL2_Event_32_t* src = src_;
     my_SDL2_Event_t* dst = dst_;
-    dst->type = src->type;
     switch (src->type) {
         case SDL2_WINDOWEVENT:
-            dst->window.type = src->window.type;
-            dst->window.timestamp = src->window.timestamp;
-            dst->window.windowID = src->window.windowID;
-            dst->window.event = src->window.event;
-            dst->window.padding1 = src->window.padding1;
-            dst->window.padding2 = src->window.padding2;
-            dst->window.padding3 = src->window.padding3;
-            dst->window.data1 = src->window.data1;
             dst->window.data2 = src->window.data2;
+            dst->window.data1 = src->window.data1;
+            dst->window.padding3 = src->window.padding3;
+            dst->window.padding2 = src->window.padding2;
+            dst->window.padding1 = src->window.padding1;
+            dst->window.event = src->window.event;
+            dst->window.windowID = src->window.windowID;
+            dst->window.timestamp = src->window.timestamp;
+            dst->window.type = src->window.type;
             break;
         case SDL2_MOUSEMOTION:
-            dst->motion.type = src->motion.type;
-            dst->motion.timestamp = src->motion.timestamp;
-            dst->motion.windowID = src->motion.windowID;
-            dst->motion.which = src->motion.which;
-            dst->motion.state = src->motion.state;
-            dst->motion.x = src->motion.x;
-            dst->motion.y = src->motion.y;
-            dst->motion.xrel = src->motion.xrel;
             dst->motion.yrel = src->motion.yrel;
+            dst->motion.xrel = src->motion.xrel;
+            dst->motion.y = src->motion.y;
+            dst->motion.x = src->motion.x;
+            dst->motion.state = src->motion.state;
+            dst->motion.which = src->motion.which;
+            dst->motion.windowID = src->motion.windowID;
+            dst->motion.timestamp = src->motion.timestamp;
+            dst->motion.type = src->motion.type;
             break;
         case SDL2_MOUSEBUTTONDOWN:
         case SDL2_MOUSEBUTTONUP:
-            dst->button.type = src->button.type;
-            dst->button.timestamp = src->button.timestamp;
-            dst->button.windowID = src->button.windowID;
-            dst->button.which = src->button.which;
-            dst->button.button = src->button.button;
-            dst->button.state = src->button.state;
-            dst->button.clicks = src->button.clicks;
-            dst->button.padding1 = src->button.padding1;
-            dst->button.x = src->button.x;
             dst->button.y = src->button.y;
+            dst->button.x = src->button.x;
+            dst->button.padding1 = src->button.padding1;
+            dst->button.clicks = src->button.clicks;
+            dst->button.state = src->button.state;
+            dst->button.button = src->button.button;
+            dst->button.which = src->button.which;
+            dst->button.windowID = src->button.windowID;
+            dst->button.timestamp = src->button.timestamp;
+            dst->button.type = src->button.type;
             break;
         case SDL2_AUDIODEVICEADDED:
         case SDL2_AUDIODEVICEREMOVED:
-            dst->adevice.type = src->adevice.type;
-            dst->adevice.timestamp = src->adevice.timestamp;
-            dst->adevice.which = src->adevice.which;
-            dst->adevice.iscapture = src->adevice.iscapture;
-            dst->adevice.padding1 = src->adevice.padding1;
-            dst->adevice.padding2 = src->adevice.padding2;
             dst->adevice.padding3 = src->adevice.padding3;
+            dst->adevice.padding2 = src->adevice.padding2;
+            dst->adevice.padding1 = src->adevice.padding1;
+            dst->adevice.iscapture = src->adevice.iscapture;
+            dst->adevice.which = src->adevice.which;
+            dst->adevice.timestamp = src->adevice.timestamp;
+            dst->adevice.type = src->adevice.type;
             break;
         case SDL2_KEYDOWN:
         case SDL2_KEYUP:
-            dst->key.type = src->key.type;
-            dst->key.timestamp = src->key.timestamp;
-            dst->key.windowID = src->key.windowID;
-            dst->key.state = src->key.state;
-            dst->key.repeat = src->key.repeat;
-            dst->key.padding2 = src->key.padding2;
-            dst->key.padding3 = src->key.padding3;
-            dst->key.keysym.scancode = src->key.keysym.scancode;
-            dst->key.keysym.sym = src->key.keysym.sym;
-            dst->key.keysym.mod = src->key.keysym.mod;
             dst->key.keysym.unused = src->key.keysym.unused;
+            dst->key.keysym.mod = src->key.keysym.mod;
+            dst->key.keysym.sym = src->key.keysym.sym;
+            dst->key.keysym.scancode = src->key.keysym.scancode;
+            dst->key.padding3 = src->key.padding3;
+            dst->key.padding2 = src->key.padding2;
+            dst->key.repeat = src->key.repeat;
+            dst->key.state = src->key.state;
+            dst->key.windowID = src->key.windowID;
+            dst->key.timestamp = src->key.timestamp;
+            dst->key.type = src->key.type;
             break;
         case SDL2_TEXTEDITING:
-            dst->edit.type = src->edit.type;
-            dst->edit.timestamp = src->edit.timestamp;
-            dst->edit.windowID = src->edit.windowID;
-            memcpy(dst->edit.text, src->edit.text, 32);
-            dst->edit.start = src->edit.start;
             dst->edit.length = src->edit.length;
+            dst->edit.start = src->edit.start;
+            memcpy(dst->edit.text, src->edit.text, 32);
+            dst->edit.windowID = src->edit.windowID;
+            dst->edit.timestamp = src->edit.timestamp;
+            dst->edit.type = src->edit.type;
             break;
         case SDL2_TEXTINPUT:
-            dst->text.type = src->text.type;
-            dst->text.timestamp = src->text.timestamp;
-            dst->text.windowID = src->text.windowID;
             memcpy(dst->text.text, src->text.text, 32);
+            dst->text.windowID = src->text.windowID;
+            dst->text.timestamp = src->text.timestamp;
+            dst->text.type = src->text.type;
             break;
         case SDL2_MOUSEWHEEL:
-            dst->wheel.type = src->wheel.type;
-            dst->wheel.timestamp = src->wheel.timestamp;
-            dst->wheel.windowID = src->wheel.windowID;
-            dst->wheel.which = src->wheel.which;
-            dst->wheel.x = src->wheel.x;
-            dst->wheel.y = src->wheel.y;
-            dst->wheel.direction = src->wheel.direction;
-            dst->wheel.preciseX = src->wheel.preciseX;
-            dst->wheel.preciseY = src->wheel.preciseY;
-            dst->wheel.mouseX = src->wheel.mouseX;
             dst->wheel.mouseY = src->wheel.mouseY;
+            dst->wheel.mouseX = src->wheel.mouseX;
+            dst->wheel.preciseY = src->wheel.preciseY;
+            dst->wheel.preciseX = src->wheel.preciseX;
+            dst->wheel.direction = src->wheel.direction;
+            dst->wheel.y = src->wheel.y;
+            dst->wheel.x = src->wheel.x;
+            dst->wheel.which = src->wheel.which;
+            dst->wheel.windowID = src->wheel.windowID;
+            dst->wheel.timestamp = src->wheel.timestamp;
+            dst->wheel.type = src->wheel.type;
             break;
         case SDL2_POLLSENTINEL:
-            dst->common.type = src->common.type;
             dst->common.timestamp = src->common.timestamp;
+            dst->common.type = src->common.type;
             break;
         case SDL2_DISPLAYEVENT:
-            dst->display.type = src->display.type;
-            dst->display.timestamp = src->display.timestamp;
-            dst->display.display = src->display.display;
-            dst->display.event = src->display.event;
-            dst->display.padding1 = src->display.padding1;
-            dst->display.padding2 = src->display.padding2;
-            dst->display.padding3 = src->display.padding3;
             dst->display.data1 = src->display.data1;
+            dst->display.padding3 = src->display.padding3;
+            dst->display.padding2 = src->display.padding2;
+            dst->display.padding1 = src->display.padding1;
+            dst->display.event = src->display.event;
+            dst->display.display = src->display.display;
+            dst->display.timestamp = src->display.timestamp;
+            dst->display.type = src->display.type;
             break;
         case SDL2_JOYDEVICEADDED:
-            dst->jdevice.type = src->jdevice.type;
-            dst->jdevice.timestamp = src->jdevice.timestamp;
             dst->jdevice.which = src->jdevice.which;
+            dst->jdevice.timestamp = src->jdevice.timestamp;
+            dst->jdevice.type = src->jdevice.type;
             break;
         case SDL2_CONTROLLERDEVICEADDED:
-            dst->cdevice.type = src->cdevice.type;
-            dst->cdevice.timestamp = src->cdevice.timestamp;
             dst->cdevice.which = src->cdevice.which;
+            dst->cdevice.timestamp = src->cdevice.timestamp;
+            dst->cdevice.type = src->cdevice.type;
+            break;
+        case SDL2_JOYAXISMOTION:
+            dst->jaxis.padding4 = src->jaxis.padding4;
+            dst->jaxis.value = src->jaxis.value;
+            dst->jaxis.padding3 = src->jaxis.padding3;
+            dst->jaxis.padding2 = src->jaxis.padding2;
+            dst->jaxis.padding1 = src->jaxis.padding1;
+            dst->jaxis.axis = src->jaxis.axis;
+            dst->jaxis.which = src->jaxis.which;
+            dst->jaxis.timestamp = src->jaxis.timestamp;
+            dst->jaxis.type = src->jaxis.type;
+            break;
+        case SDL2_CONTROLLERAXISMOTION:
+            dst->caxis.padding4 = src->caxis.padding4;
+            dst->caxis.value = src->caxis.value;
+            dst->caxis.padding3 = src->caxis.padding3;
+            dst->caxis.padding2 = src->caxis.padding2;
+            dst->caxis.padding1 = src->caxis.padding1;
+            dst->caxis.axis = src->caxis.axis;
+            dst->caxis.which = src->caxis.which;
+            dst->caxis.timestamp = src->caxis.timestamp;
+            dst->caxis.type = src->caxis.type;
             break;
         default:
             printf_log(LOG_INFO, "Warning, unsuported SDL2 event %d\n", src->type);
-            memcpy(dst, src, sizeof(my_SDL2_Event_32_t));
+            if(dst_!=src_)
+                memmove(dst, src, sizeof(my_SDL2_Event_32_t));
     }
 }
 void convert_SDL2_Event_to_32(void* dst_, const void* src_)
@@ -294,12 +317,46 @@ void convert_SDL2_Event_to_32(void* dst_, const void* src_)
             dst->cdevice.timestamp = src->cdevice.timestamp;
             dst->cdevice.which = src->cdevice.which;
             break;
+        case SDL2_JOYAXISMOTION:
+            dst->jaxis.type = src->jaxis.type;
+            dst->jaxis.timestamp = src->jaxis.timestamp;
+            dst->jaxis.which = src->jaxis.which;
+            dst->jaxis.axis = src->jaxis.axis;
+            dst->jaxis.padding1 = src->jaxis.padding1;
+            dst->jaxis.padding2 = src->jaxis.padding2;
+            dst->jaxis.padding3 = src->jaxis.padding3;
+            dst->jaxis.value = src->jaxis.value;
+            dst->jaxis.padding4 = src->jaxis.padding4;
+            break;
+        case SDL2_CONTROLLERAXISMOTION:
+            dst->caxis.type = src->caxis.type;
+            dst->caxis.timestamp = src->caxis.timestamp;
+            dst->caxis.which = src->caxis.which;
+            dst->caxis.axis = src->caxis.axis;
+            dst->caxis.padding1 = src->caxis.padding1;
+            dst->caxis.padding2 = src->caxis.padding2;
+            dst->caxis.padding3 = src->caxis.padding3;
+            dst->caxis.value = src->caxis.value;
+            dst->caxis.padding4 = src->caxis.padding4;
+            break;
         default:
             printf_log(LOG_INFO, "Warning, unsuported SDL2 event %d\n", src->type);
-            memcpy(dst, src, sizeof(my_SDL2_Event_32_t));
+            if(dst_!=src_)
+                memmove(dst, src, sizeof(my_SDL2_Event_32_t));
     }
 }
 
+void inplace_SDL2_Event_shrink(void* e)
+{
+    if(!e) return;
+    convert_SDL2_Event_to_32(e, e);
+}
+void inplace_SDL2_Event_enlarge(void* e)
+{
+    if(!e) return;
+    convert_SDL2_Event_to_64(e, e);
+}
+
 void inplace_SDL2_Palette_to_32(void* a)
 {
     if (!a) return;
diff --git a/src/wrapped32/wrappedsdl2.c b/src/wrapped32/wrappedsdl2.c
index 3e4b7b36..f34cf732 100644
--- a/src/wrapped32/wrappedsdl2.c
+++ b/src/wrapped32/wrappedsdl2.c
@@ -81,12 +81,13 @@ typedef void (*vFiupV_t)(int, uint32_t, void*, va_list);
 
 // eventfilter
 #define GO(A)   \
-static uintptr_t my_eventfilter_fct_##A = 0;                                    \
-static int my_eventfilter_##A(void* userdata, void* event)                      \
-{                                                                               \
-    static my_SDL2_Event_32_t evt = {0};                                        \
-    convert_SDL2_Event_to_32(&evt, event);                                      \
-    return (int)RunFunctionFmt(my_eventfilter_fct_##A, "pp", userdata, &evt);   \
+static uintptr_t my_eventfilter_fct_##A = 0;                                            \
+static my_SDL2_Event_32_t event_##A = {0};                                              \
+static int my_eventfilter_##A(void* userdata, void* event)                              \
+{                                                                                       \
+    convert_SDL2_Event_to_32(&event_##A, event);                                        \
+    int ret = (int)RunFunctionFmt(my_eventfilter_fct_##A, "pp", userdata, &event_##A);  \
+    return ret;                                                                         \
 }
 SUPER()
 #undef GO