about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-04-14 16:27:53 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-04-14 16:27:53 +0200
commit82755b5ef2a4409faf2e44cbc755950d087a627a (patch)
treebacab424a29cd8e25b7d2ac80fb25bd434a44443 /src
parent7b4cbee8e7b6ef6293e996e20f422c3095ef0361 (diff)
downloadbox64-82755b5ef2a4409faf2e44cbc755950d087a627a.tar.gz
box64-82755b5ef2a4409faf2e44cbc755950d087a627a.zip
Added wrapped libSDL_net and libSDL_sound
Diffstat (limited to 'src')
-rwxr-xr-xsrc/library_list.h4
-rw-r--r--src/wrapped/generated/functions_list.txt2
-rw-r--r--src/wrapped/generated/wrappedsdl1soundtypes.h19
-rw-r--r--src/wrapped/generated/wrapper.c4
-rw-r--r--src/wrapped/generated/wrapper.h2
-rwxr-xr-xsrc/wrapped/wrappedsdl1net.c46
-rwxr-xr-xsrc/wrapped/wrappedsdl1net_private.h45
-rwxr-xr-xsrc/wrapped/wrappedsdl1sound.c60
-rwxr-xr-xsrc/wrapped/wrappedsdl1sound_private.h20
9 files changed, 201 insertions, 1 deletions
diff --git a/src/library_list.h b/src/library_list.h
index 458cba0b..a9a8e81a 100755
--- a/src/library_list.h
+++ b/src/library_list.h
@@ -21,8 +21,10 @@ GO("libSDL2_image-2.0.so.0", sdl2image)
 GO("libSDL2_net-2.0.so.0", sdl2net)
 GO("libSDL2_ttf-2.0.so.0", sdl2ttf)
 GO("libSDL-1.2.so.0", sdl1)
-GO("libSDL_mixer-1.2.so.0", sdl1mixer)
 GO("libSDL_image-1.2.so.0", sdl1image)
+GO("libSDL_mixer-1.2.so.0", sdl1mixer)
+GO("libSDL_net-1.2.so.0", sdl1net)
+GO("libSDL_sound-1.0.so.1", sdl1sound)
 GO("libSDL_ttf-2.0.so.0", sdl1ttf)
 GO("libsmpeg-0.4.so.0", smpeg)
 GO("libsmpeg2-2.0.so.0", smpeg2)
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 620ed10d..8277d456 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -746,6 +746,7 @@
 #() pFEpupp
 #() pFEppii
 #() pFEppip
+#() pFEpppu
 #() pFEpppp
 #() pFipipL
 #() pFuiiiu
@@ -1050,6 +1051,7 @@
 #() iFiiupiupi
 #() iFuiifpppp
 #() iFpiiiiipi
+#() iFpWCuWCuu
 #() iFpuuiiiii
 #() iFpupppppp
 #() iFppIIIppp
diff --git a/src/wrapped/generated/wrappedsdl1soundtypes.h b/src/wrapped/generated/wrappedsdl1soundtypes.h
new file mode 100644
index 00000000..aa56c02b
--- /dev/null
+++ b/src/wrapped/generated/wrappedsdl1soundtypes.h
@@ -0,0 +1,19 @@
+/*******************************************************************
+ * File automatically generated by rebuild_wrappers.py (v1.3.0.11) *
+ *******************************************************************/
+#ifndef __wrappedsdl1soundTYPES_H_
+#define __wrappedsdl1soundTYPES_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* (*pFpppu_t)(void*, void*, void*, uint64_t);
+
+#define SUPER() ADDED_FUNCTIONS() \
+	GO(Sound_NewSample, pFpppu_t)
+
+#endif // __wrappedsdl1soundTYPES_H_
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index 0b90c863..2e511664 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -780,6 +780,7 @@ typedef void* (*pFEpipp_t)(x64emu_t*, void*, int64_t, void*, void*);
 typedef void* (*pFEpupp_t)(x64emu_t*, void*, uint64_t, void*, void*);
 typedef void* (*pFEppii_t)(x64emu_t*, void*, void*, int64_t, int64_t);
 typedef void* (*pFEppip_t)(x64emu_t*, void*, void*, int64_t, void*);
+typedef void* (*pFEpppu_t)(x64emu_t*, void*, void*, void*, uint64_t);
 typedef void* (*pFEpppp_t)(x64emu_t*, void*, void*, void*, void*);
 typedef void* (*pFipipL_t)(int64_t, void*, int64_t, void*, uintptr_t);
 typedef void* (*pFuiiiu_t)(uint64_t, int64_t, int64_t, int64_t, uint64_t);
@@ -1084,6 +1085,7 @@ typedef int64_t (*iFiiiiiiip_t)(int64_t, int64_t, int64_t, int64_t, int64_t, int
 typedef int64_t (*iFiiupiupi_t)(int64_t, int64_t, uint64_t, void*, int64_t, uint64_t, void*, int64_t);
 typedef int64_t (*iFuiifpppp_t)(uint64_t, int64_t, int64_t, float, void*, void*, void*, void*);
 typedef int64_t (*iFpiiiiipi_t)(void*, int64_t, int64_t, int64_t, int64_t, int64_t, void*, int64_t);
+typedef int64_t (*iFpWCuWCuu_t)(void*, uint16_t, uint8_t, uint64_t, uint16_t, uint8_t, uint64_t, uint64_t);
 typedef int64_t (*iFpuuiiiii_t)(void*, uint64_t, uint64_t, int64_t, int64_t, int64_t, int64_t, int64_t);
 typedef int64_t (*iFpupppppp_t)(void*, uint64_t, void*, void*, void*, void*, void*, void*);
 typedef int64_t (*iFppIIIppp_t)(void*, void*, int64_t, int64_t, int64_t, void*, void*, void*);
@@ -1983,6 +1985,7 @@ void pFEpipp(x64emu_t *emu, uintptr_t fcn) { pFEpipp_t fn = (pFEpipp_t)fcn; R_RA
 void pFEpupp(x64emu_t *emu, uintptr_t fcn) { pFEpupp_t fn = (pFEpupp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX, (void*)R_RCX); }
 void pFEppii(x64emu_t *emu, uintptr_t fcn) { pFEppii_t fn = (pFEppii_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX); }
 void pFEppip(x64emu_t *emu, uintptr_t fcn) { pFEppip_t fn = (pFEppip_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (void*)R_RCX); }
+void pFEpppu(x64emu_t *emu, uintptr_t fcn) { pFEpppu_t fn = (pFEpppu_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (uint64_t)R_RCX); }
 void pFEpppp(x64emu_t *emu, uintptr_t fcn) { pFEpppp_t fn = (pFEpppp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); }
 void pFipipL(x64emu_t *emu, uintptr_t fcn) { pFipipL_t fn = (pFipipL_t)fcn; R_RAX=(uintptr_t)fn((int64_t)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (uintptr_t)R_R8); }
 void pFuiiiu(x64emu_t *emu, uintptr_t fcn) { pFuiiiu_t fn = (pFuiiiu_t)fcn; R_RAX=(uintptr_t)fn((uint64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (uint64_t)R_R8); }
@@ -2287,6 +2290,7 @@ void iFiiiiiiip(x64emu_t *emu, uintptr_t fcn) { iFiiiiiiip_t fn = (iFiiiiiiip_t)
 void iFiiupiupi(x64emu_t *emu, uintptr_t fcn) { iFiiupiupi_t fn = (iFiiupiupi_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (void*)R_RCX, (int64_t)R_R8, (uint64_t)R_R9, *(void**)(R_RSP + 8), *(int64_t*)(R_RSP + 16)); }
 void iFuiifpppp(x64emu_t *emu, uintptr_t fcn) { iFuiifpppp_t fn = (iFuiifpppp_t)fcn; R_RAX=(int64_t)fn((uint64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, emu->xmm[0].f[0], (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); }
 void iFpiiiiipi(x64emu_t *emu, uintptr_t fcn) { iFpiiiiipi_t fn = (iFpiiiiipi_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(void**)(R_RSP + 8), *(int64_t*)(R_RSP + 16)); }
+void iFpWCuWCuu(x64emu_t *emu, uintptr_t fcn) { iFpWCuWCuu_t fn = (iFpWCuWCuu_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint16_t)R_RSI, (uint8_t)R_RDX, (uint64_t)R_RCX, (uint16_t)R_R8, (uint8_t)R_R9, *(uint64_t*)(R_RSP + 8), *(uint64_t*)(R_RSP + 16)); }
 void iFpuuiiiii(x64emu_t *emu, uintptr_t fcn) { iFpuuiiiii_t fn = (iFpuuiiiii_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(int64_t*)(R_RSP + 8), *(int64_t*)(R_RSP + 16)); }
 void iFpupppppp(x64emu_t *emu, uintptr_t fcn) { iFpupppppp_t fn = (iFpupppppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16)); }
 void iFppIIIppp(x64emu_t *emu, uintptr_t fcn) { iFppIIIppp_t fn = (iFppIIIppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16)); }
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index b15e3e17..ab91517f 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -776,6 +776,7 @@ void pFEpipp(x64emu_t *emu, uintptr_t fnc);
 void pFEpupp(x64emu_t *emu, uintptr_t fnc);
 void pFEppii(x64emu_t *emu, uintptr_t fnc);
 void pFEppip(x64emu_t *emu, uintptr_t fnc);
+void pFEpppu(x64emu_t *emu, uintptr_t fnc);
 void pFEpppp(x64emu_t *emu, uintptr_t fnc);
 void pFipipL(x64emu_t *emu, uintptr_t fnc);
 void pFuiiiu(x64emu_t *emu, uintptr_t fnc);
@@ -1080,6 +1081,7 @@ void iFiiiiiiip(x64emu_t *emu, uintptr_t fnc);
 void iFiiupiupi(x64emu_t *emu, uintptr_t fnc);
 void iFuiifpppp(x64emu_t *emu, uintptr_t fnc);
 void iFpiiiiipi(x64emu_t *emu, uintptr_t fnc);
+void iFpWCuWCuu(x64emu_t *emu, uintptr_t fnc);
 void iFpuuiiiii(x64emu_t *emu, uintptr_t fnc);
 void iFpupppppp(x64emu_t *emu, uintptr_t fnc);
 void iFppIIIppp(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped/wrappedsdl1net.c b/src/wrapped/wrappedsdl1net.c
new file mode 100755
index 00000000..f69cfaee
--- /dev/null
+++ b/src/wrapped/wrappedsdl1net.c
@@ -0,0 +1,46 @@
+#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 "wrapper.h"
+#include "bridge.h"
+#include "librarian/library_private.h"
+#include "x64emu.h"
+#include "emu/x64emu_private.h"
+#include "box64context.h"
+#include "sdl1rwops.h"
+
+
+typedef struct sdl1net_my_s {
+} sdl1net_my_t;
+
+static void* getSDL1NetMy(library_t* lib)
+{
+    sdl1net_my_t* my = (sdl1net_my_t*)calloc(1, sizeof(sdl1net_my_t));
+    #define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
+    #undef GO
+    return my;
+}
+
+static library_t* my_lib = NULL;
+
+
+const char* sdl1netName = "libSDL_net-1.2.so.0";
+#define LIBNAME sdl1net
+
+#define CUSTOM_INIT                     \
+    my_lib = lib;                       \
+    lib->altmy = strdup("my_");        \
+    lib->priv.w.p2 = getSDL1NetMy(lib);
+
+#define CUSTOM_FINI                     \
+    free(lib->priv.w.p2);               \
+    my_lib = NULL;
+
+#include "wrappedlib_init.h"
+
diff --git a/src/wrapped/wrappedsdl1net_private.h b/src/wrapped/wrappedsdl1net_private.h
new file mode 100755
index 00000000..6986d4da
--- /dev/null
+++ b/src/wrapped/wrappedsdl1net_private.h
@@ -0,0 +1,45 @@
+#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
+#error Meh!
+#endif
+
+GO(SDLNet_AddSocket, iFpp)
+GO(SDLNet_AllocPacket, pFi)
+GO(SDLNet_AllocPacketV, pFii)
+GO(SDLNet_AllocSocketSet, pFi)
+GO(SDLNet_CheckSockets, iFpu)
+GO(SDLNet_DelSocket, iFpp)
+GO(SDLNet_FreePacket, vFp)
+GO(SDLNet_FreePacketV, vFp)
+GO(SDLNet_FreeSocketSet, vFp)
+GO(SDLNet_GetError, pFv)
+//GO(SDLNet_GetLastError, 
+GO(SDLNet_GetLocalAddresses, iFpi)
+GO(SDLNet_Init, iFv)
+GO(SDLNet_Linked_Version, pFv)
+GO(SDLNet_Quit, vFv)
+GO(SDLNet_Read16, WFp)
+GO(SDLNet_Read32, uFp)
+GO(SDLNet_ResizePacket, iFpi)
+GO(SDLNet_ResolveHost, iFppW)
+GO(SDLNet_ResolveIP, pFp)
+//GOM(SDLNet_SetError, vFEpV)
+//GO(SDLNet_SetLastError, 
+GO(SDLNet_TCP_Accept, pFp)
+GO(SDLNet_TCP_Close, vFp)
+GO(SDLNet_TCP_GetPeerAddress, pFp)
+GO(SDLNet_TCP_Open, pFp)
+GO(SDLNet_TCP_Recv, iFppi)
+GO(SDLNet_TCP_Send, iFppi)
+GO(SDLNet_UDP_Bind, iFpip)
+GO(SDLNet_UDP_Close, vFp)
+GO(SDLNet_UDP_GetPeerAddress, pFpi)
+GO(SDLNet_UDP_Open, pFW)
+GO(SDLNet_UDP_Recv, iFpp)
+GO(SDLNet_UDP_RecvV, iFpp)
+GO(SDLNet_UDP_Send, iFpip)
+GO(SDLNet_UDP_SendV, iFppi)
+GO(SDLNet_UDP_SetPacketLoss, vFpi)
+GO(SDLNet_UDP_Unbind, vFpi)
+GO(SDLNet_Write16, vFWp)
+GO(SDLNet_Write32, vFup)
+GO(SDLNet_version, pFv)
\ No newline at end of file
diff --git a/src/wrapped/wrappedsdl1sound.c b/src/wrapped/wrappedsdl1sound.c
new file mode 100755
index 00000000..078938af
--- /dev/null
+++ b/src/wrapped/wrappedsdl1sound.c
@@ -0,0 +1,60 @@
+#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 "wrapper.h"
+#include "bridge.h"
+#include "librarian/library_private.h"
+#include "x64emu.h"
+#include "emu/x64emu_private.h"
+#include "box64context.h"
+#include "sdl1rwops.h"
+
+const char* sdl1soundName = "libSDL_sound-1.0.so.1";
+#define LIBNAME sdl1sound
+
+#include "generated/wrappedsdl1soundtypes.h"
+
+typedef struct sdl1sound_my_s {
+    #define GO(A, B)    B   A;
+    SUPER()
+    #undef GO
+} sdl1sound_my_t;
+
+static library_t* my_lib = NULL;
+
+static void* getSDL1SoundMy(library_t* lib)
+{
+    sdl1sound_my_t* my = (sdl1sound_my_t*)calloc(1, sizeof(sdl1sound_my_t));
+    #define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
+    #undef GO
+    return my;
+}
+
+EXPORT void* my_Sound_NewSample(x64emu_t* emu, void* a, void* ext, void* desired, uint32_t buffersize)
+{
+    sdl1sound_my_t *my = (sdl1sound_my_t *)my_lib->priv.w.p2;
+    SDL1_RWops_t* rw = RWNativeStart(emu, (SDL1_RWops_t*)a);
+    void* r = my->Sound_NewSample(rw, ext, desired, buffersize);
+    RWNativeEnd(rw);
+    return r;
+}
+
+#define CUSTOM_INIT \
+    my_lib = lib; \
+    lib->priv.w.p2 = getSDL1SoundMy(lib);   \
+    lib->priv.w.needed = 1; \
+    lib->priv.w.neededlibs = (char**)calloc(lib->priv.w.needed, sizeof(char*)); \
+    lib->priv.w.neededlibs[0] = strdup("libSDL-1.2.so.0");
+
+#define CUSTOM_FINI \
+    free(lib->priv.w.p2); \
+    my_lib = NULL;
+
+#include "wrappedlib_init.h"
+
diff --git a/src/wrapped/wrappedsdl1sound_private.h b/src/wrapped/wrappedsdl1sound_private.h
new file mode 100755
index 00000000..1efad54e
--- /dev/null
+++ b/src/wrapped/wrappedsdl1sound_private.h
@@ -0,0 +1,20 @@
+#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
+#error meh!
+#endif
+
+GO(Sound_AvailableDecoders, pFv)
+GO(Sound_BuildAudioCVT, iFpWCuWCuu)
+GO(Sound_ClearError, vFv)
+GO(Sound_ConvertAudio, iFp)
+GO(Sound_Decode, uFp)
+GO(Sound_DecodeAll, uFp)
+GO(Sound_FreeSample, vFp)
+GO(Sound_GetError, pFv)
+GO(Sound_GetLinkedVersion, vFp)
+GO(Sound_Init, iFv)
+GOM(Sound_NewSample, pFEpppu)
+GO(Sound_NewSampleFromFile, pFppu)
+GO(Sound_Quit, iFv)
+GO(Sound_Rewind, iFp)
+GO(Sound_Seek, iFpu)
+GO(Sound_SetBufferSize, iFpu)