From 42e60bc7c52d49805a74d19745574e28d76ab46f Mon Sep 17 00:00:00 2001 From: Yang Liu Date: Sat, 28 Sep 2024 01:00:08 +0800 Subject: [BOX32][WRAPPER] Wrapped more SDL2 functions (#1881) --- src/libtools/sdl1rwops.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'src/libtools/sdl1rwops.c') diff --git a/src/libtools/sdl1rwops.c b/src/libtools/sdl1rwops.c index edb900ce..baf6897b 100644 --- a/src/libtools/sdl1rwops.c +++ b/src/libtools/sdl1rwops.c @@ -55,6 +55,26 @@ typedef struct SDL1_RWops_s { } hidden; } SDL1_RWops_t; +#ifdef BOX32 +#define SUPER() \ + if (box64_is32bits) { \ + GO(seek, iFpii_32) \ + GO(read, iFppii_32) \ + GO(write, iFppii_32) \ + GO(close, iFp_32) \ + } else { \ + GO(seek, iFpii) \ + GO(read, iFppii) \ + GO(write, iFppii) \ + GO(close, iFp) \ + } +#else +#define SUPER() \ + GO(seek, iFpii) \ + GO(read, iFppii) \ + GO(write, iFppii) \ + GO(close, iFp) +#endif EXPORT int32_t my_native_seek(SDL1_RWops_t *context, int32_t offset, int32_t whence) { @@ -142,21 +162,7 @@ SDL1_RWops_t* AddNativeRW(x64emu_t* emu, SDL1_RWops_t* ops) fnc = AddCheckBridge(system, W, my_native_##A, 0, NULL); \ newrw->A = (sdl1_##A)fnc; - #ifdef BOX32 - if(box64_is32bits) - { - GO(seek, iFpii_32) - GO(read, iFppii_32) - GO(write, iFppii_32) - GO(close, iFp_32) - } else - #endif - { - GO(seek, iFpii) - GO(read, iFppii) - GO(write, iFppii) - GO(close, iFp) - } + SUPER() #undef GO @@ -181,10 +187,7 @@ SDL1_RWops_t* RWNativeStart(x64emu_t* emu, SDL1_RWops_t* ops) #define GO(A, W) \ newrw->A = my_emulated_##A; - GO(seek, iFpii) - GO(read, iFppii) - GO(write, iFppii) - GO(close, iFp) + SUPER() #undef GO -- cgit 1.4.1