Skip to content

Commit

Permalink
[BOX32][WRAPPER] Added support of BOX64_MAXCPU in 32bits wrapped SDL2
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Jan 9, 2025
1 parent d377433 commit d55e879
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/wrapped32/generated/functions_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
#() cFpp -> cFpp
#() wFpi -> wFpi
#() iEEv -> iEEv
#() iFEv -> iFEv
#() iEEi -> iEEi
#() iEEL -> iEEL
#() iEEp -> iEEp
Expand Down Expand Up @@ -2871,6 +2872,8 @@ wrappedsdl2:
% J SDL2_GUID_t uuuu
- vFp:
- SDL_FreeSurface
- iFv:
- SDL_GetCPUCount
- iFp:
- SDL_PollEvent
- SDL_PushEvent
Expand Down
2 changes: 2 additions & 0 deletions src/wrapped32/generated/wrappedsdl2types32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down Expand Up @@ -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) \
Expand Down
2 changes: 2 additions & 0 deletions src/wrapped32/generated/wrapper32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down Expand Up @@ -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; }
Expand Down
1 change: 1 addition & 0 deletions src/wrapped32/generated/wrapper32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions src/wrapped32/wrappedsdl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion src/wrapped32/wrappedsdl2_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d55e879

Please sign in to comment.