about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-01-09 16:56:00 +0100
committerptitSeb <sebastien.chev@gmail.com>2025-01-09 16:56:07 +0100
commitd55e8798791521f4e5291834efb51d8f54287628 (patch)
tree9c55bb198b12da7cd8e492531275e53aeb781bf4 /src
parentd37743399729987bbe62669d92113fee421524e1 (diff)
downloadbox64-d55e8798791521f4e5291834efb51d8f54287628.tar.gz
box64-d55e8798791521f4e5291834efb51d8f54287628.zip
[BOX32][WRAPPER] Added support of BOX64_MAXCPU in 32bits wrapped SDL2
Diffstat (limited to 'src')
-rw-r--r--src/wrapped32/generated/functions_list.txt3
-rw-r--r--src/wrapped32/generated/wrappedsdl2types32.h2
-rw-r--r--src/wrapped32/generated/wrapper32.c2
-rw-r--r--src/wrapped32/generated/wrapper32.h1
-rw-r--r--src/wrapped32/wrappedsdl2.c10
-rw-r--r--src/wrapped32/wrappedsdl2_private.h2
6 files changed, 19 insertions, 1 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index e1b0e77b..3dab4f72 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -195,6 +195,7 @@
 #() cFpp -> cFpp
 #() wFpi -> wFpi
 #() iEEv -> iEEv
+#() iFEv -> iFEv
 #() iEEi -> iEEi
 #() iEEL -> iEEL
 #() iEEp -> iEEp
@@ -2871,6 +2872,8 @@ wrappedsdl2:
 % J SDL2_GUID_t uuuu
 - vFp:
   - SDL_FreeSurface
+- iFv:
+  - SDL_GetCPUCount
 - iFp:
   - SDL_PollEvent
   - SDL_PushEvent
diff --git a/src/wrapped32/generated/wrappedsdl2types32.h b/src/wrapped32/generated/wrappedsdl2types32.h
index 8eb57d36..083578ee 100644
--- a/src/wrapped32/generated/wrappedsdl2types32.h
+++ b/src/wrapped32/generated/wrappedsdl2types32.h
@@ -12,6 +12,7 @@
 #endif
 
 typedef void (*vFp_t)(void*);
+typedef int32_t (*iFv_t)(void);
 typedef int32_t (*iFp_t)(void*);
 typedef int64_t (*IFp_t)(void*);
 typedef uint32_t (*uFp_t)(void*);
@@ -52,6 +53,7 @@ typedef void* (*pFpiiiiuuuu_t)(void*, int32_t, int32_t, int32_t, int32_t, uint32
 
 #define SUPER() ADDED_FUNCTIONS() \
 	GO(SDL_FreeSurface, vFp_t) \
+	GO(SDL_GetCPUCount, iFv_t) \
 	GO(SDL_PollEvent, iFp_t) \
 	GO(SDL_PushEvent, iFp_t) \
 	GO(SDL_RWclose, iFp_t) \
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index 6434a371..a65b5cc4 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -289,6 +289,7 @@ typedef void (*vFnp_t)(void*, void*);
 typedef int8_t (*cFpp_t)(void*, void*);
 typedef int16_t (*wFpi_t)(void*, int32_t);
 typedef int32_t (*iEEv_t)(x64emu_t*);
+typedef int32_t (*iFEv_t)(x64emu_t*);
 typedef int32_t (*iEEi_t)(x64emu_t*, int32_t);
 typedef int32_t (*iEEL_t)(x64emu_t*, uintptr_t);
 typedef int32_t (*iEEp_t)(x64emu_t*, void*);
@@ -2096,6 +2097,7 @@ void vFnp_32(x64emu_t *emu, uintptr_t fcn) { vFnp_t fn = (vFnp_t)fcn; void *alig
 void cFpp_32(x64emu_t *emu, uintptr_t fcn) { cFpp_t fn = (cFpp_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8)); }
 void wFpi_32(x64emu_t *emu, uintptr_t fcn) { wFpi_t fn = (wFpi_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8)); }
 void iEEv_32(x64emu_t *emu, uintptr_t fcn) { iEEv_t fn = (iEEv_t)fcn; errno = emu->libc_err; R_EAX = fn(emu); emu->libc_err = errno; }
+void iFEv_32(x64emu_t *emu, uintptr_t fcn) { iFEv_t fn = (iFEv_t)fcn; R_EAX = fn(emu); }
 void iEEi_32(x64emu_t *emu, uintptr_t fcn) { iEEi_t fn = (iEEi_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4)); emu->libc_err = errno; }
 void iEEL_32(x64emu_t *emu, uintptr_t fcn) { iEEL_t fn = (iEEL_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ulong(from_ptri(ulong_t, R_ESP + 4))); emu->libc_err = errno; }
 void iEEp_32(x64emu_t *emu, uintptr_t fcn) { iEEp_t fn = (iEEp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4)); emu->libc_err = errno; }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index d6d068cd..926241f3 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -236,6 +236,7 @@ void vFnp_32(x64emu_t *emu, uintptr_t fnc);
 void cFpp_32(x64emu_t *emu, uintptr_t fnc);
 void wFpi_32(x64emu_t *emu, uintptr_t fnc);
 void iEEv_32(x64emu_t *emu, uintptr_t fnc);
+void iFEv_32(x64emu_t *emu, uintptr_t fnc);
 void iEEi_32(x64emu_t *emu, uintptr_t fnc);
 void iEEL_32(x64emu_t *emu, uintptr_t fnc);
 void iEEp_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedsdl2.c b/src/wrapped32/wrappedsdl2.c
index e1fdc438..3b043431 100644
--- a/src/wrapped32/wrappedsdl2.c
+++ b/src/wrapped32/wrappedsdl2.c
@@ -780,6 +780,16 @@ EXPORT unsigned long my32_2_SDL_GetThreadID(x64emu_t* emu, void* thread)
     return ret;
 }
 
+EXPORT int my32_2_SDL_GetCPUCount(x64emu_t* emu)
+{
+    int ret = my->SDL_GetCPUCount();
+    if(box64_maxcpu && ret>box64_maxcpu)
+        ret = box64_maxcpu;
+    return ret;
+}
+
+
+
 #define ALTMY my32_2_
 
 #define CUSTOM_INIT                       \
diff --git a/src/wrapped32/wrappedsdl2_private.h b/src/wrapped32/wrappedsdl2_private.h
index c9f6fb12..6ba5533f 100644
--- a/src/wrapped32/wrappedsdl2_private.h
+++ b/src/wrapped32/wrappedsdl2_private.h
@@ -189,7 +189,7 @@ GO(SDL_GetClipboardText, pFv)
 GOM(SDL_GetClosestDisplayMode, pFipp)   //%noE
 //GO(SDL_GetColorKey, iFpp)
 GO(SDL_GetCPUCacheLineSize, iFv)
-GO(SDL_GetCPUCount, iFv)
+GOM(SDL_GetCPUCount, iFEv)
 GO(SDL_GetCurrentAudioDriver, pFv)
 GOM(SDL_GetCurrentDisplayMode, iFip)    //%noE
 GO(SDL_GetCurrentVideoDriver, pFv)