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:55:32 +0100
committerptitSeb <sebastien.chev@gmail.com>2025-01-09 16:56:07 +0100
commitd37743399729987bbe62669d92113fee421524e1 (patch)
tree7ec3b3d9b48363392e33a2636df86513219bd8ef /src
parent207073bf363c41431df0b44778c3e833ed755715 (diff)
downloadbox64-d37743399729987bbe62669d92113fee421524e1.tar.gz
box64-d37743399729987bbe62669d92113fee421524e1.zip
[WRAPPER] Added support of BOX64_MAXCPU in wrapped SDL2, plus some various other CPUInfo fixes
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/generated/wrappedsdl2types.h1
-rw-r--r--src/wrapped/wrappedsdl2.c21
-rwxr-xr-xsrc/wrapped/wrappedsdl2_private.h2
4 files changed, 22 insertions, 3 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index a6abddf8..6264ac12 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -5768,6 +5768,7 @@ wrappedsdl2:
 - vFp:
   - SDL_UnloadObject
 - iFv:
+  - SDL_GetCPUCount
   - SDL_Has3DNow
   - SDL_HasAVX
   - SDL_HasAVX2
diff --git a/src/wrapped/generated/wrappedsdl2types.h b/src/wrapped/generated/wrappedsdl2types.h
index 104f6bcd..75c9700a 100644
--- a/src/wrapped/generated/wrappedsdl2types.h
+++ b/src/wrapped/generated/wrappedsdl2types.h
@@ -51,6 +51,7 @@ typedef void* (*pFpippp_t)(void*, int32_t, void*, void*, void*);
 
 #define SUPER() ADDED_FUNCTIONS() \
 	GO(SDL_UnloadObject, vFp_t) \
+	GO(SDL_GetCPUCount, iFv_t) \
 	GO(SDL_Has3DNow, iFv_t) \
 	GO(SDL_HasAVX, iFv_t) \
 	GO(SDL_HasAVX2, iFv_t) \
diff --git a/src/wrapped/wrappedsdl2.c b/src/wrapped/wrappedsdl2.c
index 5c3a8056..199e2dba 100644
--- a/src/wrapped/wrappedsdl2.c
+++ b/src/wrapped/wrappedsdl2.c
@@ -42,8 +42,17 @@ int EXPORT my2_SDL_HasRDTSC(void) __attribute__((alias("sdl_Yes")));
 int EXPORT my2_SDL_HasSSE(void) __attribute__((alias("sdl_Yes")));
 int EXPORT my2_SDL_HasSSE2(void) __attribute__((alias("sdl_Yes")));
 int EXPORT my2_SDL_HasSSE3(void) __attribute__((alias("sdl_Yes")));
-int EXPORT my2_SDL_HasSSE41(void) __attribute__((alias("sdl_No")));
-int EXPORT my2_SDL_HasSSE42(void) __attribute__((alias("sdl_No")));
+int EXPORT my2_SDL_HasSSE41(void) __attribute__((alias("sdl_Yes")));
+int EXPORT my2_SDL_HasSSE42(void) {
+    return box64_sse42?1:0;
+}
+int EXPORT my2_SDL_HasAVX(void) {
+    return box64_avx?1:0;
+}
+int EXPORT my2_SDL_HasAVX2(void) {
+    return box64_avx2?1:0;
+}
+int EXPORT my2_SDL_HasAVX512F(void) __attribute__((alias("sdl_No")));
 
 typedef struct {
   int32_t freq;
@@ -825,6 +834,14 @@ EXPORT unsigned long my2_SDL_GetThreadID(x64emu_t* emu, void* thread)
     return ret;
 }
 
+EXPORT int my2_SDL_GetCPUCount(x64emu_t* emu)
+{
+    int ret = my->SDL_GetCPUCount();
+    if(box64_maxcpu && ret>box64_maxcpu)
+        ret = box64_maxcpu;
+    return ret;
+}
+
 #undef HAS_MY
 
 #define ALTMY my2_
diff --git a/src/wrapped/wrappedsdl2_private.h b/src/wrapped/wrappedsdl2_private.h
index a231efe2..9e541bb5 100755
--- a/src/wrapped/wrappedsdl2_private.h
+++ b/src/wrapped/wrappedsdl2_private.h
@@ -189,7 +189,7 @@ GO(SDL_GetClipRect, vFpp)
 GO(SDL_GetClosestDisplayMode, pFipp)
 GO(SDL_GetColorKey, iFpp)
 GO(SDL_GetCPUCacheLineSize, iFv)
-GO(SDL_GetCPUCount, iFv)
+GOM(SDL_GetCPUCount, iFEv)
 GO(SDL_GetCurrentAudioDriver, pFv)
 GO(SDL_GetCurrentDisplayMode, iFip)
 GO(SDL_GetCurrentVideoDriver, pFv)