diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-13 10:51:15 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-13 10:51:15 +0100 |
| commit | 59bb9c2083a3c9781bf0e0446f7de67951f0aff8 (patch) | |
| tree | fba99c70b8963a9fff66958f4e29e24282418666 /src | |
| parent | 689d64b62a8f43d58afba6c3c7c1334fb613eb8b (diff) | |
| download | box64-59bb9c2083a3c9781bf0e0446f7de67951f0aff8.tar.gz box64-59bb9c2083a3c9781bf0e0446f7de67951f0aff8.zip | |
[BOX32][WRAPPER] Added more SDL2 32bts wrapped functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 22 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedsdl2types32.h | 19 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 6 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 3 | ||||
| -rw-r--r-- | src/wrapped32/wrappedsdl2.c | 126 | ||||
| -rw-r--r-- | src/wrapped32/wrappedsdl2_private.h | 28 |
6 files changed, 190 insertions, 14 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 211616d0..4865a6b3 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -255,6 +255,7 @@ #() uFpu -> uFpu #() uFpp -> uFpp #() uFXL -> uFXL +#() UFEp -> UFEp #() UEuu -> UEuu #() UFuu -> UFuu #() UEUU -> UEUU @@ -557,7 +558,9 @@ #() CFuUu -> CFuUu #() CFuff -> CFuff #() WFXip -> WFXip +#() uFEpW -> uFEpW #() uFEpu -> uFEpu +#() uFEpU -> uFEpU #() uFEpL -> uFEpL #() uFilp -> uFilp #() uFipu -> uFipu @@ -2627,6 +2630,15 @@ wrappedsdl2: - IFp: - SDL_RWsize - SDL_RWtell +- uFp: + - SDL_ReadBE16 + - SDL_ReadBE32 + - SDL_ReadLE16 + - SDL_ReadLE32 + - SDL_ReadU8 +- UFp: + - SDL_ReadBE64 + - SDL_ReadLE64 - pFv: - SDL_GetBasePath - pFp: @@ -2656,6 +2668,16 @@ wrappedsdl2: - SDL_OpenAudio - SDL_SetWindowDisplayMode - SDL_ShowMessageBox +- uFpW: + - SDL_WriteBE16 + - SDL_WriteLE16 +- uFpu: + - SDL_WriteBE32 + - SDL_WriteLE32 + - SDL_WriteU8 +- uFpU: + - SDL_WriteBE64 + - SDL_WriteLE64 - pFpi: - SDL_LoadBMP_RW - SDL_notreal diff --git a/src/wrapped32/generated/wrappedsdl2types32.h b/src/wrapped32/generated/wrappedsdl2types32.h index 627bb6c8..8eb57d36 100644 --- a/src/wrapped32/generated/wrappedsdl2types32.h +++ b/src/wrapped32/generated/wrappedsdl2types32.h @@ -14,6 +14,8 @@ typedef void (*vFp_t)(void*); typedef int32_t (*iFp_t)(void*); typedef int64_t (*IFp_t)(void*); +typedef uint32_t (*uFp_t)(void*); +typedef uint64_t (*UFp_t)(void*); typedef void* (*pFv_t)(void); typedef void* (*pFp_t)(void*); typedef uintptr_t (*hFp_t)(void*); @@ -24,6 +26,9 @@ typedef void (*vFpV_t)(void*, ...); typedef int32_t (*iFip_t)(int32_t, void*); typedef int32_t (*iFpi_t)(void*, int32_t); typedef int32_t (*iFpp_t)(void*, void*); +typedef uint32_t (*uFpW_t)(void*, uint16_t); +typedef uint32_t (*uFpu_t)(void*, uint32_t); +typedef uint32_t (*uFpU_t)(void*, uint64_t); typedef void* (*pFpi_t)(void*, int32_t); typedef void* (*pFpp_t)(void*, void*); typedef int32_t (*iFiip_t)(int32_t, int32_t, void*); @@ -52,6 +57,13 @@ typedef void* (*pFpiiiiuuuu_t)(void*, int32_t, int32_t, int32_t, int32_t, uint32 GO(SDL_RWclose, iFp_t) \ GO(SDL_RWsize, IFp_t) \ GO(SDL_RWtell, IFp_t) \ + GO(SDL_ReadBE16, uFp_t) \ + GO(SDL_ReadBE32, uFp_t) \ + GO(SDL_ReadLE16, uFp_t) \ + GO(SDL_ReadLE32, uFp_t) \ + GO(SDL_ReadU8, uFp_t) \ + GO(SDL_ReadBE64, UFp_t) \ + GO(SDL_ReadLE64, UFp_t) \ GO(SDL_GetBasePath, pFv_t) \ GO(SDL_GL_GetProcAddress, pFp_t) \ GO(SDL_GetThreadID, hFp_t) \ @@ -71,6 +83,13 @@ typedef void* (*pFpiiiiuuuu_t)(void*, int32_t, int32_t, int32_t, int32_t, uint32 GO(SDL_OpenAudio, iFpp_t) \ GO(SDL_SetWindowDisplayMode, iFpp_t) \ GO(SDL_ShowMessageBox, iFpp_t) \ + GO(SDL_WriteBE16, uFpW_t) \ + GO(SDL_WriteLE16, uFpW_t) \ + GO(SDL_WriteBE32, uFpu_t) \ + GO(SDL_WriteLE32, uFpu_t) \ + GO(SDL_WriteU8, uFpu_t) \ + GO(SDL_WriteBE64, uFpU_t) \ + GO(SDL_WriteLE64, uFpU_t) \ GO(SDL_LoadBMP_RW, pFpi_t) \ GO(SDL_notreal, pFpi_t) \ GO(SDL_CreateTextureFromSurface, pFpp_t) \ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index a7b5aed1..a0722de4 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -346,6 +346,7 @@ typedef uint32_t (*uFpi_t)(void*, int32_t); typedef uint32_t (*uFpu_t)(void*, uint32_t); typedef uint32_t (*uFpp_t)(void*, void*); typedef uint32_t (*uFXL_t)(void*, uintptr_t); +typedef uint64_t (*UFEp_t)(x64emu_t*, void*); typedef uint64_t (*UEuu_t)(uint32_t, uint32_t); typedef uint64_t (*UFuu_t)(uint32_t, uint32_t); typedef uint64_t (*UEUU_t)(uint64_t, uint64_t); @@ -648,7 +649,9 @@ typedef uint8_t (*CFipp_t)(int32_t, void*, void*); typedef uint8_t (*CFuUu_t)(uint32_t, uint64_t, uint32_t); typedef uint8_t (*CFuff_t)(uint32_t, float, float); typedef uint16_t (*WFXip_t)(void*, int32_t, void*); +typedef uint32_t (*uFEpW_t)(x64emu_t*, void*, uint16_t); typedef uint32_t (*uFEpu_t)(x64emu_t*, void*, uint32_t); +typedef uint32_t (*uFEpU_t)(x64emu_t*, void*, uint64_t); typedef uint32_t (*uFEpL_t)(x64emu_t*, void*, uintptr_t); typedef uint32_t (*uFilp_t)(int32_t, intptr_t, void*); typedef uint32_t (*uFipu_t)(int32_t, void*, uint32_t); @@ -2047,6 +2050,7 @@ void uFpi_32(x64emu_t *emu, uintptr_t fcn) { uFpi_t fn = (uFpi_t)fcn; R_EAX = (u void uFpu_32(x64emu_t *emu, uintptr_t fcn) { uFpu_t fn = (uFpu_t)fcn; R_EAX = (uint32_t)fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8)); } void uFpp_32(x64emu_t *emu, uintptr_t fcn) { uFpp_t fn = (uFpp_t)fcn; R_EAX = (uint32_t)fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8)); } void uFXL_32(x64emu_t *emu, uintptr_t fcn) { uFXL_t fn = (uFXL_t)fcn; R_EAX = (uint32_t)fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8))); } +void UFEp_32(x64emu_t *emu, uintptr_t fcn) { UFEp_t fn = (UFEp_t)fcn; ui64_t r; r.u = (uint64_t)fn(emu, from_ptriv(R_ESP + 4)); R_EAX = r.d[0]; R_EDX = r.d[1]; } void UEuu_32(x64emu_t *emu, uintptr_t fcn) { UEuu_t fn = (UEuu_t)fcn; errno = emu->libc_err; ui64_t r; r.u = (uint64_t)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8)); R_EAX = r.d[0]; R_EDX = r.d[1]; emu->libc_err = errno; } void UFuu_32(x64emu_t *emu, uintptr_t fcn) { UFuu_t fn = (UFuu_t)fcn; ui64_t r; r.u = (uint64_t)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8)); R_EAX = r.d[0]; R_EDX = r.d[1]; } void UEUU_32(x64emu_t *emu, uintptr_t fcn) { UEUU_t fn = (UEUU_t)fcn; errno = emu->libc_err; ui64_t r; r.u = (uint64_t)fn(from_ptri(uint64_t, R_ESP + 4), from_ptri(uint64_t, R_ESP + 12)); R_EAX = r.d[0]; R_EDX = r.d[1]; emu->libc_err = errno; } @@ -2349,7 +2353,9 @@ void CFipp_32(x64emu_t *emu, uintptr_t fcn) { CFipp_t fn = (CFipp_t)fcn; R_EAX = void CFuUu_32(x64emu_t *emu, uintptr_t fcn) { CFuUu_t fn = (CFuUu_t)fcn; R_EAX = (unsigned char)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(uint64_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 16)); } void CFuff_32(x64emu_t *emu, uintptr_t fcn) { CFuff_t fn = (CFuff_t)fcn; R_EAX = (unsigned char)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(float, R_ESP + 8), from_ptri(float, R_ESP + 12)); } void WFXip_32(x64emu_t *emu, uintptr_t fcn) { WFXip_t fn = (WFXip_t)fcn; R_EAX = (unsigned short)fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } +void uFEpW_32(x64emu_t *emu, uintptr_t fcn) { uFEpW_t fn = (uFEpW_t)fcn; R_EAX = (uint32_t)fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint16_t, R_ESP + 8)); } void uFEpu_32(x64emu_t *emu, uintptr_t fcn) { uFEpu_t fn = (uFEpu_t)fcn; R_EAX = (uint32_t)fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8)); } +void uFEpU_32(x64emu_t *emu, uintptr_t fcn) { uFEpU_t fn = (uFEpU_t)fcn; R_EAX = (uint32_t)fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint64_t, R_ESP + 8)); } void uFEpL_32(x64emu_t *emu, uintptr_t fcn) { uFEpL_t fn = (uFEpL_t)fcn; R_EAX = (uint32_t)fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8))); } void uFilp_32(x64emu_t *emu, uintptr_t fcn) { uFilp_t fn = (uFilp_t)fcn; R_EAX = (uint32_t)fn(from_ptri(int32_t, R_ESP + 4), from_long(from_ptri(long_t, R_ESP + 8)), from_ptriv(R_ESP + 12)); } void uFipu_32(x64emu_t *emu, uintptr_t fcn) { uFipu_t fn = (uFipu_t)fcn; R_EAX = (uint32_t)fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index f12a4471..6d60b9a3 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -296,6 +296,7 @@ void uFpi_32(x64emu_t *emu, uintptr_t fnc); void uFpu_32(x64emu_t *emu, uintptr_t fnc); void uFpp_32(x64emu_t *emu, uintptr_t fnc); void uFXL_32(x64emu_t *emu, uintptr_t fnc); +void UFEp_32(x64emu_t *emu, uintptr_t fnc); void UEuu_32(x64emu_t *emu, uintptr_t fnc); void UFuu_32(x64emu_t *emu, uintptr_t fnc); void UEUU_32(x64emu_t *emu, uintptr_t fnc); @@ -598,7 +599,9 @@ void CFipp_32(x64emu_t *emu, uintptr_t fnc); void CFuUu_32(x64emu_t *emu, uintptr_t fnc); void CFuff_32(x64emu_t *emu, uintptr_t fnc); void WFXip_32(x64emu_t *emu, uintptr_t fnc); +void uFEpW_32(x64emu_t *emu, uintptr_t fnc); void uFEpu_32(x64emu_t *emu, uintptr_t fnc); +void uFEpU_32(x64emu_t *emu, uintptr_t fnc); void uFEpL_32(x64emu_t *emu, uintptr_t fnc); void uFilp_32(x64emu_t *emu, uintptr_t fnc); void uFipu_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedsdl2.c b/src/wrapped32/wrappedsdl2.c index d9ab15d7..e1fdc438 100644 --- a/src/wrapped32/wrappedsdl2.c +++ b/src/wrapped32/wrappedsdl2.c @@ -529,6 +529,132 @@ EXPORT int my32_2_SDL_RWclose(x64emu_t* emu, void* a) return RWNativeClose2(rw); } +EXPORT uint64_t my32_2_SDL_ReadU8(x64emu_t* emu, void* a) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_ReadU8(rw); + RWNativeEnd2(rw); + return r; +} +EXPORT uint64_t my32_2_SDL_ReadBE16(x64emu_t* emu, void* a) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_ReadBE16(rw); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_ReadBE32(x64emu_t* emu, void* a) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_ReadBE32(rw); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_ReadBE64(x64emu_t* emu, void* a) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_ReadBE64(rw); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_ReadLE16(x64emu_t* emu, void* a) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_ReadLE16(rw); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_ReadLE32(x64emu_t* emu, void* a) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_ReadLE32(rw); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_ReadLE64(x64emu_t* emu, void* a) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_ReadLE64(rw); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_WriteU8(x64emu_t* emu, void* a, uint8_t v) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_WriteU8(rw, v); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_WriteBE16(x64emu_t* emu, void* a, uint16_t v) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_WriteBE16(rw, v); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_WriteBE32(x64emu_t* emu, void* a, uint64_t v) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_WriteBE32(rw, v); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_WriteBE64(x64emu_t* emu, void* a, uint64_t v) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_WriteBE64(rw, v); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_WriteLE16(x64emu_t* emu, void* a, uint16_t v) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_WriteLE16(rw, v); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_WriteLE32(x64emu_t* emu, void* a, uint64_t v) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_WriteLE32(rw, v); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} +EXPORT uint64_t my32_2_SDL_WriteLE64(x64emu_t* emu, void* a, uint64_t v) +{ + inplace_SDL2_RWops_to_64(a); + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t r = my->SDL_WriteLE64(rw, v); + RWNativeEnd2(rw); + inplace_SDL2_RWops_to_32(a); + return r; +} + typedef struct SDL_version_s { uint8_t major; diff --git a/src/wrapped32/wrappedsdl2_private.h b/src/wrapped32/wrappedsdl2_private.h index 05b090f3..c9f6fb12 100644 --- a/src/wrapped32/wrappedsdl2_private.h +++ b/src/wrapped32/wrappedsdl2_private.h @@ -500,13 +500,13 @@ GOM(SDL_PushEvent, iFp) //%noE GO(SDL_Quit, vFv) GO(SDL_QuitSubSystem, vFu) GO(SDL_RaiseWindow, vFp) -//GOM(SDL_ReadBE16, uFEp) -//GOM(SDL_ReadBE32, uFEp) -//GOM(SDL_ReadBE64, UFEp) -//GOM(SDL_ReadLE16, uFEp) -//GOM(SDL_ReadLE32, uFEp) -//GOM(SDL_ReadLE64, UFEp) -//GOM(SDL_ReadU8, uFEp) +GOM(SDL_ReadBE16, uFEp) +GOM(SDL_ReadBE32, uFEp) +GOM(SDL_ReadBE64, UFEp) +GOM(SDL_ReadLE16, uFEp) +GOM(SDL_ReadLE32, uFEp) +GOM(SDL_ReadLE64, UFEp) +GOM(SDL_ReadU8, uFEp) GO(SDL_realloc, pFpL) //GO(SDL_RecordGesture, iFl) //GO(SDL_RegisterEvents, uFi) @@ -722,13 +722,13 @@ GO(SDL_WasInit, uFu) // SDL_wcslcat // SDL_wcslcpy //GO(SDL_wcslen, LFp) -//GOM(SDL_WriteBE16, uFEpW) -//GOM(SDL_WriteBE32, uFEpu) -//GOM(SDL_WriteBE64, uFEpU) -//GOM(SDL_WriteLE16, uFEpW) -//GOM(SDL_WriteLE32, uFEpu) -//GOM(SDL_WriteLE64, uFEpU) -//GOM(SDL_WriteU8, uFEpu) +GOM(SDL_WriteBE16, uFEpW) +GOM(SDL_WriteBE32, uFEpu) +GOM(SDL_WriteBE64, uFEpU) +GOM(SDL_WriteLE16, uFEpW) +GOM(SDL_WriteLE32, uFEpu) +GOM(SDL_WriteLE64, uFEpU) +GOM(SDL_WriteU8, uFEpu) GOM(SDL_RWseek, IFEpIi) GOM(SDL_RWtell, IFEp) |