about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/sdl2align32.h4
-rw-r--r--src/include/sdl2rwops.h6
-rw-r--r--src/library_list_32.h2
-rw-r--r--src/libtools/sdl2rwops.c20
-rw-r--r--src/wrapped32/generated/functions_list.txt27
-rw-r--r--src/wrapped32/generated/wrappedsdl2imagedefs32.h8
-rw-r--r--src/wrapped32/generated/wrappedsdl2imagetypes32.h41
-rw-r--r--src/wrapped32/generated/wrappedsdl2imageundefs32.h8
-rw-r--r--src/wrapped32/generated/wrapper32.c4
-rw-r--r--src/wrapped32/generated/wrapper32.h2
-rw-r--r--src/wrapped32/wrappedsdl2image.c127
-rw-r--r--src/wrapped32/wrappedsdl2image_private.h67
12 files changed, 314 insertions, 2 deletions
diff --git a/src/include/sdl2align32.h b/src/include/sdl2align32.h
index c1abac08..5356df81 100644
--- a/src/include/sdl2align32.h
+++ b/src/include/sdl2align32.h
@@ -868,14 +868,14 @@ typedef struct my_SDL2_RWops_s {
     void* hidden[3];
 } my_SDL2_RWops_t;
 
-typedef struct __attribute__((packed)) my_SDL2_RWops_32_s {
+typedef struct my_SDL2_RWops_32_s {
     ptr_t size;
     ptr_t seek;
     ptr_t read;
     ptr_t write;
     ptr_t close;
     uint32_t type;
-    void* hidden[3]; // not converting hidden, just moving it
+    ptr_t hidden[3]; // not converting hidden, just moving it
 } my_SDL2_RWops_32_t;
 
 void inplace_SDL2_DisplayMode_to_64(void* a);
diff --git a/src/include/sdl2rwops.h b/src/include/sdl2rwops.h
index 72ead1c3..bdc54a99 100644
--- a/src/include/sdl2rwops.h
+++ b/src/include/sdl2rwops.h
@@ -2,6 +2,9 @@
 #define __SDL2RWOPS_H__
 
 typedef struct SDL2_RWops_s SDL2_RWops_t;   // the actual SDL2 SDL_RWops
+#ifdef BOX32
+typedef struct my_SDL2_RWops_32_s my_SDL2_RWops_32_t;
+#endif
 typedef struct x64emu_s x64emu_t;
 
 typedef SDL2_RWops_t* (*sdl2_allocrw)(void);
@@ -23,6 +26,9 @@ SDL2_RWops_t* AddNativeRW2(x64emu_t* emu, SDL2_RWops_t* ops);
 SDL2_RWops_t* RWNativeStart2(x64emu_t* emu, SDL2_RWops_t* ops); // put native RW functions, wrapping the emulated (callback style) ones if needed
 void RWNativeEnd2(SDL2_RWops_t* ops);                           // put emulated function back in place
 int isRWops(SDL2_RWops_t* ops); // 1 if ops seems to be a valid RWops, 0 if not
+#ifdef BOX32
+int isRWops32(my_SDL2_RWops_32_t* ops);
+#endif
 
 int64_t RWNativeSeek2(SDL2_RWops_t *ops, int64_t offset, int32_t whence);
 int64_t RWNativeSize2(SDL2_RWops_t *ops);
diff --git a/src/library_list_32.h b/src/library_list_32.h
index b5f36acc..f7aa542f 100644
--- a/src/library_list_32.h
+++ b/src/library_list_32.h
@@ -22,6 +22,8 @@ GO("libGL.so.1", libgl)
 GO("libGLU.so.1", libglu)
 GO("libSDL-1.2.so.0", sdl1)
 GO("libSDL2-2.0.so.0", sdl2)
+GO("libSDL2_image-2.0.so.0", sdl2image)
+GO("libSDL2_image.so", sdl2image)
 GO("libasound.so.2", libasound)
 GO("libasound.so", libasound)
 GO("libfreetype.so.6", freetype)
diff --git a/src/libtools/sdl2rwops.c b/src/libtools/sdl2rwops.c
index 54d1ee1a..41d7b2e8 100644
--- a/src/libtools/sdl2rwops.c
+++ b/src/libtools/sdl2rwops.c
@@ -322,6 +322,26 @@ int isRWops(SDL2_RWops_t* ops)
         return 0;
     return 1;
 }
+#ifdef BOX32
+int isRWops32(my_SDL2_RWops_32_t* ops)
+{
+    if(!ops)
+        return 0;
+    #define GO(A, W)      \
+    if(!ops->A || (uintptr_t)ops->A < 0x1000) return 0;
+
+    SUPER()
+
+    #undef GO
+    // check if all then hidden content is just full of 0
+    if(ops->hidden[0]==0 && ops->hidden[1]==0 && ops->hidden[2]==0)
+        return 0;
+    // check the type (not sure it's a good check here)
+    if (ops->type>5 && ops->type!=BOX64RW)
+        return 0;
+    return 1;
+}
+#endif
 
 int64_t RWNativeSeek2(SDL2_RWops_t *ops, int64_t offset, int32_t whence)
 {
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index b9cd8580..09d29d0a 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -610,6 +610,7 @@
 #() LFXCii -> LFXCii
 #() LFXLpi -> LFXLpi
 #() pFEupp -> pFEupp
+#() pFEpip -> pFEpip
 #() pFEppi -> pFEppi
 #() pFEppp -> pFEppp
 #() pFEXpL -> pFEXpL
@@ -770,6 +771,7 @@
 #() LFpLppa -> LFpLppa
 #() LFXLuuu -> LFXLuuu
 #() LFXLpuu -> LFXLpuu
+#() pFEppip -> pFEppip
 #() pFEXipp -> pFEXipp
 #() pFuiupp -> pFuiupp
 #() pFpiiuu -> pFpiiuu
@@ -1756,6 +1758,31 @@ wrappedsdl2:
 - pFuiiiuuuu:
   - SDL_CreateRGBSurface
 % JFEi -> pFEpi
+wrappedsdl2image:
+- pFp:
+  - IMG_LoadBMP_RW
+  - IMG_LoadCUR_RW
+  - IMG_LoadGIF_RW
+  - IMG_LoadICO_RW
+  - IMG_LoadJPG_RW
+  - IMG_LoadLBM_RW
+  - IMG_LoadPCX_RW
+  - IMG_LoadPNG_RW
+  - IMG_LoadPNM_RW
+  - IMG_LoadTGA_RW
+  - IMG_LoadTIF_RW
+  - IMG_LoadWEBP_RW
+  - IMG_LoadXCF_RW
+  - IMG_LoadXPM_RW
+  - IMG_LoadXV_RW
+- pFpi:
+  - IMG_Load_RW
+- pFpip:
+  - IMG_LoadTyped_RW
+- pFppi:
+  - IMG_LoadTexture_RW
+- pFppip:
+  - IMG_LoadTextureTyped_RW
 wrappedtcmallocminimal:
 - pFp:
 - iFpL:
diff --git a/src/wrapped32/generated/wrappedsdl2imagedefs32.h b/src/wrapped32/generated/wrappedsdl2imagedefs32.h
new file mode 100644
index 00000000..c11135c4
--- /dev/null
+++ b/src/wrapped32/generated/wrappedsdl2imagedefs32.h
@@ -0,0 +1,8 @@
+/*********************************************************************
+ * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) *
+ *********************************************************************/
+#ifndef __wrappedsdl2imageDEFS32_H_
+#define __wrappedsdl2imageDEFS32_H_
+
+
+#endif // __wrappedsdl2imageDEFS32_H_
diff --git a/src/wrapped32/generated/wrappedsdl2imagetypes32.h b/src/wrapped32/generated/wrappedsdl2imagetypes32.h
new file mode 100644
index 00000000..630a8aee
--- /dev/null
+++ b/src/wrapped32/generated/wrappedsdl2imagetypes32.h
@@ -0,0 +1,41 @@
+/*********************************************************************
+ * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) *
+ *********************************************************************/
+#ifndef __wrappedsdl2imageTYPES32_H_
+#define __wrappedsdl2imageTYPES32_H_
+
+#ifndef LIBNAME
+#error You should only #include this file inside a wrapped*.c file
+#endif
+#ifndef ADDED_FUNCTIONS
+#define ADDED_FUNCTIONS() 
+#endif
+
+typedef void* (*pFp_t)(void*);
+typedef void* (*pFpi_t)(void*, int32_t);
+typedef void* (*pFpip_t)(void*, int32_t, void*);
+typedef void* (*pFppi_t)(void*, void*, int32_t);
+typedef void* (*pFppip_t)(void*, void*, int32_t, void*);
+
+#define SUPER() ADDED_FUNCTIONS() \
+	GO(IMG_LoadBMP_RW, pFp_t) \
+	GO(IMG_LoadCUR_RW, pFp_t) \
+	GO(IMG_LoadGIF_RW, pFp_t) \
+	GO(IMG_LoadICO_RW, pFp_t) \
+	GO(IMG_LoadJPG_RW, pFp_t) \
+	GO(IMG_LoadLBM_RW, pFp_t) \
+	GO(IMG_LoadPCX_RW, pFp_t) \
+	GO(IMG_LoadPNG_RW, pFp_t) \
+	GO(IMG_LoadPNM_RW, pFp_t) \
+	GO(IMG_LoadTGA_RW, pFp_t) \
+	GO(IMG_LoadTIF_RW, pFp_t) \
+	GO(IMG_LoadWEBP_RW, pFp_t) \
+	GO(IMG_LoadXCF_RW, pFp_t) \
+	GO(IMG_LoadXPM_RW, pFp_t) \
+	GO(IMG_LoadXV_RW, pFp_t) \
+	GO(IMG_Load_RW, pFpi_t) \
+	GO(IMG_LoadTyped_RW, pFpip_t) \
+	GO(IMG_LoadTexture_RW, pFppi_t) \
+	GO(IMG_LoadTextureTyped_RW, pFppip_t)
+
+#endif // __wrappedsdl2imageTYPES32_H_
diff --git a/src/wrapped32/generated/wrappedsdl2imageundefs32.h b/src/wrapped32/generated/wrappedsdl2imageundefs32.h
new file mode 100644
index 00000000..67b76871
--- /dev/null
+++ b/src/wrapped32/generated/wrappedsdl2imageundefs32.h
@@ -0,0 +1,8 @@
+/*********************************************************************
+ * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) *
+ *********************************************************************/
+#ifndef __wrappedsdl2imageUNDEFS32_H_
+#define __wrappedsdl2imageUNDEFS32_H_
+
+
+#endif // __wrappedsdl2imageUNDEFS32_H_
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index aa531484..33ed6591 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -700,6 +700,7 @@ typedef uintptr_t (*LFppLa_t)(void*, void*, uintptr_t, void*);
 typedef uintptr_t (*LFXCii_t)(void*, uint8_t, int32_t, int32_t);
 typedef uintptr_t (*LFXLpi_t)(void*, uintptr_t, void*, int32_t);
 typedef void* (*pFEupp_t)(x64emu_t*, uint32_t, void*, void*);
+typedef void* (*pFEpip_t)(x64emu_t*, void*, int32_t, void*);
 typedef void* (*pFEppi_t)(x64emu_t*, void*, void*, int32_t);
 typedef void* (*pFEppp_t)(x64emu_t*, void*, void*, void*);
 typedef void* (*pFEXpL_t)(x64emu_t*, void*, void*, uintptr_t);
@@ -860,6 +861,7 @@ typedef uintptr_t (*LFEppLL_t)(x64emu_t*, void*, void*, uintptr_t, uintptr_t);
 typedef uintptr_t (*LFpLppa_t)(void*, uintptr_t, void*, void*, void*);
 typedef uintptr_t (*LFXLuuu_t)(void*, uintptr_t, uint32_t, uint32_t, uint32_t);
 typedef uintptr_t (*LFXLpuu_t)(void*, uintptr_t, void*, uint32_t, uint32_t);
+typedef void* (*pFEppip_t)(x64emu_t*, void*, void*, int32_t, void*);
 typedef void* (*pFEXipp_t)(x64emu_t*, void*, int32_t, void*, void*);
 typedef void* (*pFuiupp_t)(uint32_t, int32_t, uint32_t, void*, void*);
 typedef void* (*pFpiiuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t);
@@ -1800,6 +1802,7 @@ void LFppLa_32(x64emu_t *emu, uintptr_t fcn) { LFppLa_t fn = (LFppLa_t)fcn; R_EA
 void LFXCii_32(x64emu_t *emu, uintptr_t fcn) { LFXCii_t fn = (LFXCii_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(uint8_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); }
 void LFXLpi_32(x64emu_t *emu, uintptr_t fcn) { LFXLpi_t fn = (LFXLpi_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); }
 void pFEupp_32(x64emu_t *emu, uintptr_t fcn) { pFEupp_t fn = (pFEupp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12))); }
+void pFEpip_32(x64emu_t *emu, uintptr_t fcn) { pFEpip_t fn = (pFEpip_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12))); }
 void pFEppi_32(x64emu_t *emu, uintptr_t fcn) { pFEppi_t fn = (pFEppi_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); }
 void pFEppp_32(x64emu_t *emu, uintptr_t fcn) { pFEppp_t fn = (pFEppp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12))); }
 void pFEXpL_32(x64emu_t *emu, uintptr_t fcn) { pFEXpL_t fn = (pFEXpL_t)fcn; R_EAX = to_ptrv(fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)))); }
@@ -1960,6 +1963,7 @@ void LFEppLL_32(x64emu_t *emu, uintptr_t fcn) { LFEppLL_t fn = (LFEppLL_t)fcn; R
 void LFpLppa_32(x64emu_t *emu, uintptr_t fcn) { LFpLppa_t fn = (LFpLppa_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_locale(from_ptri(ptr_t, R_ESP + 20)))); }
 void LFXLuuu_32(x64emu_t *emu, uintptr_t fcn) { LFXLuuu_t fn = (LFXLuuu_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20))); }
 void LFXLpuu_32(x64emu_t *emu, uintptr_t fcn) { LFXLpuu_t fn = (LFXLpuu_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20))); }
+void pFEppip_32(x64emu_t *emu, uintptr_t fcn) { pFEppip_t fn = (pFEppip_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16))); }
 void pFEXipp_32(x64emu_t *emu, uintptr_t fcn) { pFEXipp_t fn = (pFEXipp_t)fcn; R_EAX = to_ptrv(fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16))); }
 void pFuiupp_32(x64emu_t *emu, uintptr_t fcn) { pFuiupp_t fn = (pFuiupp_t)fcn; R_EAX = to_ptrv(fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20))); }
 void pFpiiuu_32(x64emu_t *emu, uintptr_t fcn) { pFpiiuu_t fn = (pFpiiuu_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20))); }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index bce62343..b516845a 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -651,6 +651,7 @@ void LFppLa_32(x64emu_t *emu, uintptr_t fnc);
 void LFXCii_32(x64emu_t *emu, uintptr_t fnc);
 void LFXLpi_32(x64emu_t *emu, uintptr_t fnc);
 void pFEupp_32(x64emu_t *emu, uintptr_t fnc);
+void pFEpip_32(x64emu_t *emu, uintptr_t fnc);
 void pFEppi_32(x64emu_t *emu, uintptr_t fnc);
 void pFEppp_32(x64emu_t *emu, uintptr_t fnc);
 void pFEXpL_32(x64emu_t *emu, uintptr_t fnc);
@@ -811,6 +812,7 @@ void LFEppLL_32(x64emu_t *emu, uintptr_t fnc);
 void LFpLppa_32(x64emu_t *emu, uintptr_t fnc);
 void LFXLuuu_32(x64emu_t *emu, uintptr_t fnc);
 void LFXLpuu_32(x64emu_t *emu, uintptr_t fnc);
+void pFEppip_32(x64emu_t *emu, uintptr_t fnc);
 void pFEXipp_32(x64emu_t *emu, uintptr_t fnc);
 void pFuiupp_32(x64emu_t *emu, uintptr_t fnc);
 void pFpiiuu_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedsdl2image.c b/src/wrapped32/wrappedsdl2image.c
new file mode 100644
index 00000000..29daec70
--- /dev/null
+++ b/src/wrapped32/wrappedsdl2image.c
@@ -0,0 +1,127 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define _GNU_SOURCE         /* See feature_test_macros(7) */
+#include <dlfcn.h>
+
+#include "wrappedlibs.h"
+
+#include "debug.h"
+#include "wrapper32.h"
+#include "bridge.h"
+#include "librarian/library_private.h"
+#include "x64emu.h"
+#include "emu/x64emu_private.h"
+#include "box32context.h"
+#include "sdl2rwops.h"
+#include "sdl2align32.h"
+
+static const char* sdl2imageName = "libSDL2_image-2.0.so.0";
+#define LIBNAME sdl2image
+
+#define ADDED_FUNCTIONS()           \
+
+#include "generated/wrappedsdl2imagetypes32.h"
+
+#include "wrappercallback32.h"
+
+#define GO(A)   \
+EXPORT void *my32_2_##A(x64emu_t* emu, void* a) \
+{ \
+    inplace_SDL2_RWops_to_64(a); \
+    SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); \
+    void* r = my->A(rw); \
+    RWNativeEnd2(rw); \
+    inplace_SDL2_RWops_to_32(a); \
+    inplace_SDL2_Surface_to_32(r); \
+    return r; \
+}
+GO(IMG_LoadBMP_RW)
+GO(IMG_LoadCUR_RW)
+GO(IMG_LoadGIF_RW)
+GO(IMG_LoadICO_RW)
+GO(IMG_LoadJPG_RW)
+GO(IMG_LoadLBM_RW)
+GO(IMG_LoadPCX_RW)
+GO(IMG_LoadPNG_RW)
+GO(IMG_LoadPNM_RW)
+GO(IMG_LoadTGA_RW)
+GO(IMG_LoadTIF_RW)
+GO(IMG_LoadWEBP_RW)
+GO(IMG_LoadXCF_RW)
+GO(IMG_LoadXPM_RW)
+GO(IMG_LoadXV_RW)
+#undef GO
+
+ EXPORT void *my32_2_IMG_LoadTyped_RW(x64emu_t* emu, void* a, int32_t b, void* c)
+{
+    inplace_SDL2_RWops_to_64(a);
+    SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a);
+    void* r = my->IMG_LoadTyped_RW(rw, b, c);
+    if(b==0) {
+        RWNativeEnd2(rw);
+        inplace_SDL2_RWops_to_32(a);
+    }
+    inplace_SDL2_Surface_to_32(r);
+    return r;
+}
+EXPORT void *my32_2_IMG_Load_RW(x64emu_t* emu, void* a, int32_t b)
+{
+    inplace_SDL2_RWops_to_64(a);
+    SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a);
+    void* r = my->IMG_Load_RW(rw, b);
+    if(b==0) {
+        RWNativeEnd2(rw);
+        inplace_SDL2_RWops_to_32(a);
+    }
+    inplace_SDL2_Surface_to_32(r);
+    return r;
+}
+//EXPORT int32_t my32_2_IMG_SavePNG_RW(x64emu_t* emu, void* s, void* a, int32_t b)
+//{
+//    // some old? fuction signature use IMG_SavePNG_RW(dst, surf, compression) instead of the IMG_SavePNG_RW(surf, dst, freedst)
+//    // need to try detect if s is in fact a RWops
+//    int32_t r;
+//    if(isRWops32((my_SDL2_RWops_32_t*)s) && !isRWops32((my_SDL2_RWops_32_t*)a)) {
+//        inplace_SDL2_RWops_to_64(s);
+//        SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)s);
+//        r = my->IMG_SavePNG_RW(a, rw, 0);
+//        RWNativeEnd2(rw);
+//    } else {
+//        SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a);
+//        r = my->IMG_SavePNG_RW(s, rw, b);
+//        if(b==0)
+//            RWNativeEnd2(rw);
+//    }
+//    return r;
+//}
+
+EXPORT void* my32_2_IMG_LoadTexture_RW(x64emu_t* emu, void* rend, void* a, int32_t b)
+{
+    inplace_SDL2_RWops_to_64(a);
+    SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a);
+    void* r = my->IMG_LoadTexture_RW(rend, rw, b);
+    if(b==0) {
+        RWNativeEnd2(rw);
+        inplace_SDL2_RWops_to_32(a);
+    }
+    return r;
+}
+
+EXPORT void* my32_2_IMG_LoadTextureTyped_RW(x64emu_t* emu, void* rend, void* a, int32_t b, void* type)
+{
+    inplace_SDL2_RWops_to_64(a);
+    SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a);
+    void* r = my->IMG_LoadTextureTyped_RW(rend, rw, b, type);
+    if(b==0) {
+        RWNativeEnd2(rw);
+        inplace_SDL2_RWops_to_32(a);
+    }
+    return r;
+}
+
+#define ALTMY my32_2_
+
+#define NEEDED_LIBS "libSDL2-2.0.so.0"
+
+#include "wrappedlib_init32.h"
diff --git a/src/wrapped32/wrappedsdl2image_private.h b/src/wrapped32/wrappedsdl2image_private.h
new file mode 100644
index 00000000..5e7dd7a2
--- /dev/null
+++ b/src/wrapped32/wrappedsdl2image_private.h
@@ -0,0 +1,67 @@
+#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
+#error Meh!
+#endif
+
+// _fini
+GO(IMG_Init,iFi)
+GO(IMG_InvertAlpha,iFi)
+GO(IMG_Linked_Version,pFv)
+//GO(IMG_Load,pFp)
+GOM(IMG_LoadBMP_RW,pFEp)
+GOM(IMG_LoadCUR_RW,pFEp)
+GOM(IMG_LoadGIF_RW,pFEp)
+GOM(IMG_LoadICO_RW,pFEp)
+GOM(IMG_LoadJPG_RW,pFEp)
+GOM(IMG_LoadLBM_RW,pFEp)
+GOM(IMG_LoadPCX_RW,pFEp)
+GOM(IMG_LoadPNG_RW,pFEp)
+GOM(IMG_LoadPNM_RW,pFEp)
+GOM(IMG_LoadTGA_RW,pFEp)
+GOM(IMG_LoadTIF_RW,pFEp)
+GOM(IMG_LoadTyped_RW,pFEpip)
+GOM(IMG_LoadWEBP_RW,pFEp)
+GOM(IMG_LoadXCF_RW,pFEp)
+GOM(IMG_LoadXPM_RW,pFEp)
+GOM(IMG_LoadXV_RW,pFEp)
+GOM(IMG_Load_RW,pFEpi)
+GO(IMG_Quit,vFv)
+//GO(IMG_ReadXPMFromArray,pFp)
+//GO(IMG_isBMP,iFp)
+//GO(IMG_isCUR,iFp)
+//GO(IMG_isGIF,iFp)
+//GO(IMG_isICO,iFp)
+//GO(IMG_isJPG,iFp)
+//GO(IMG_isLBM,iFp)
+//GO(IMG_isPCX,iFp)
+//GO(IMG_isPNG,iFp)
+//GO(IMG_isPNM,iFp)
+//GO(IMG_isTIF,iFp)
+//GO(IMG_isWEBP,iFp)
+//GO(IMG_isXCF,iFp)
+//GO(IMG_isXPM,iFp)
+//GO(IMG_isXV,iFp)
+// IMG_InitJPG
+// IMG_InitPNG
+// IMG_InitTIF
+// IMG_InitWEBP
+// IMG_isSVG
+// IMG_LoadSVG_RW
+//GO(IMG_LoadTexture, pFpp)
+GOM(IMG_LoadTexture_RW, pFEppi)
+GOM(IMG_LoadTextureTyped_RW, pFEppip)
+// IMG_QuitJPG
+// IMG_QuitPNG
+// IMG_QuitTIF
+// IMG_QuitWEBP
+// IMG_SaveJPG
+// IMG_SaveJPG_RW
+//GO(IMG_SavePNG, iFpp)
+//GOM(IMG_SavePNG_RW, iFEppi)
+// _init
+//DATA(nsvg__colors, 4)
+// nsvgCreateRasterizer
+// nsvgDelete
+// nsvgDeleteRasterizer
+// nsvgParse
+// nsvg__parseXML
+// nsvgRasterize