[BOX32] Added some more 32bits wrapped functions (Chicken Invaders 3 works, but need SDL12COMPAT_OPENGL_SCALING=0)

This commit is contained in:
ptitSeb 2024-09-21 12:20:26 +02:00
parent 15842f3464
commit fb4f580922
13 changed files with 138 additions and 58 deletions

View File

@ -99,8 +99,14 @@ void x86Int3(x64emu_t* emu, uintptr_t* addr)
snprintf(buff, 256, "%s", " ... ");
}
} else
if(strstr(s, "SDL_RWFromFile")==s || strstr(s, "SDL_RWFromFile")==s) {
if(strstr(s, "SDL_PollEvent")==s) {
snprintf(buff, 255, "%04d|%p: Calling %s(%p)", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), s, from_ptrv(*(ptr_t*)from_ptr(R_ESP+4)));
pu8 = from_ptrv(*(ptr_t*)from_ptr(R_ESP+4));
post = 10;
} else if(strstr(s, "SDL_RWFromFile")==s || strstr(s, "SDL_RWFromFile")==s) {
snprintf(buff, 255, "%04d|%p: Calling %s(%s, %s)", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), s, from_ptrv(*(ptr_t*)from_ptr(R_ESP+4)), from_ptrv(*(ptr_t*)from_ptr(R_ESP+8)));
} else if(strstr(s, "SDL_WarpMouse")==s) {
snprintf(buff, 255, "%04d|%p: Calling %s(%hd, %hd)", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), s, *(uint16_t*)from_ptr(R_ESP+4), *(uint16_t*)from_ptr(R_ESP+8));
} else if(strstr(s, "glColor4f")==s) {
snprintf(buff, 255, "%04d|%p: Calling %s(%f, %f, %f, %f)", tid, from_ptrv(*(ptr_t*)from_ptr(R_ESP)), s, *(float*)from_ptr(R_ESP+4), *(float*)from_ptr(R_ESP+8), *(float*)from_ptr(R_ESP+12), *(float*)from_ptr(R_ESP+16));
} else if(strstr(s, "glTexCoord2f")==s) {
@ -371,6 +377,15 @@ void x86Int3(x64emu_t* emu, uintptr_t* addr)
case 8: if(!R_EAX) snprintf(buff2, 63, " [%p]", from_ptrv(*pu32)); break;
case 9: if(errno) snprintf(buff2, 63, " (errno=%d/\"%s\")", errno, strerror(errno)); else snprintf(buff2, 63, " (errno=0)"); break;
break;
case 10: if(R_EAX)
switch(*pu8) {
case 4:
snprintf(buff2, 63, " [type=%hhd, x=%hd, y=%hd, relx=%+hd, rely=%+hd]", *pu8, *(uint16_t*)(pu8+4), *(uint16_t*)(pu8+6), *(int16_t*)(pu8+8), *(int16_t*)(pu8+10));
break;
default:
snprintf(buff2, 63, " [type=%hhd]", *pu8);
}
break;
}
if(perr==1 && ((int)R_EAX)<0)

View File

@ -481,7 +481,7 @@ struct i386_hostent {
struct i386_iovec
{
ptr_t iov_base; // void *
uint32_t iov_len;
ulong_t iov_len;
};
struct i386_msghdr

View File

@ -102,3 +102,14 @@ void to_struct_iiiiiiiiilt(ptr_t d, const struct_iiiiiiiiilt_t* src) {
*(long_t*)dest = to_long(src->l9); dest += 4;
*(ptr_t*)dest = to_cstring(src->p10); dest += 4;
}
void from_struct_up(struct_up_t *dest, ptr_t s) {
uint8_t* src = (uint8_t*)from_ptrv(s);
dest->u0 = *(uint32_t*)src; src += 4;
dest->p1 = *(void**)src; src += 4;
}
void to_struct_up(ptr_t d, const struct_up_t *src) {
if (!src) return;
uint8_t* dest = (uint8_t*)from_ptrv(d);
*(uint32_t*)dest = src->u0; dest += 4;
*(ptr_t*)dest = to_ptrv(src->p1); dest += 4;
}

View File

@ -54,5 +54,11 @@ typedef struct struct_iiiiiiiiilt_s {
} struct_iiiiiiiiilt_t;
void from_struct_iiiiiiiiilt(struct_iiiiiiiiilt_t* dest, ptr_t src);
void to_struct_iiiiiiiiilt(ptr_t dest, const struct_iiiiiiiiilt_t* src);
typedef struct struct_up_s {
uint32_t u0;
void* p1;
} struct_up_t;
void from_struct_up(struct_up_t *dest, ptr_t src);
void to_struct_up(ptr_t dest, const struct_up_t *src);
#endif // __CONVERTER_H_

View File

@ -152,6 +152,7 @@
#() dFdD -> dFdD
#() dFdp -> dFdp
#() dFLL -> dFLL
#() lFES -> lFES
#() lFui -> lFui
#() lFpl -> lFpl
#() LFpL -> LFpL
@ -180,6 +181,7 @@
#() pFrL_p -> pFBp
#() iFuBLL_ -> iFuB
#() iFprLL_ -> iFpB
#() iFpbup_ -> iFpB
#() iFBLL_p -> iFBp
#() iFrLL_BLL_ -> iFBB
#() pFriiiiiiiiilt_p -> pFBp
@ -886,6 +888,8 @@ wrappedlibc:
- uFp:
- uFV:
- UFp:
- lFS:
- ftell
- LFL:
- pFv:
- __ctype_b_loc
@ -960,6 +964,7 @@ wrappedlibc:
- lFipi:
- recvmsg
- sendmsg
- writev
- lFipL:
- lFppi:
- LFppi:
@ -1199,6 +1204,7 @@ wrappedsdl1:
- vFv:
- SDL_Quit
- vFp:
- SDL_FreeSurface
- SDL_KillThread
- SDL_UnlockSurface
- iFv:
@ -1226,6 +1232,7 @@ wrappedsdl1:
- SDL_OpenAudio
- pFpi:
- SDL_LoadBMP_RW
- SDL_RWFromMem
- pFpu:
- SDL_ListModes
- pFpp:

View File

@ -23,6 +23,7 @@ typedef uint32_t (*uFu_t)(uint32_t);
typedef uint32_t (*uFp_t)(void*);
typedef uint32_t (*uFV_t)(...);
typedef uint64_t (*UFp_t)(void*);
typedef intptr_t (*lFS_t)(void*);
typedef uintptr_t (*LFL_t)(uintptr_t);
typedef void* (*pFv_t)(void);
typedef void* (*pFu_t)(uint32_t);
@ -95,6 +96,7 @@ typedef void* (*pFiiiiiiiiilt_t)(int32_t, int32_t, int32_t, int32_t, int32_t, in
GO(__close_nocancel, iFi_t) \
GO(getifaddrs, iFp_t) \
GO(getwc, iFh_t) \
GO(ftell, lFS_t) \
GO(__ctype_b_loc, pFv_t) \
GO(__ctype_tolower_loc, pFv_t) \
GO(__ctype_toupper_loc, pFv_t) \
@ -131,6 +133,7 @@ typedef void* (*pFiiiiiiiiilt_t)(int32_t, int32_t, int32_t, int32_t, int32_t, in
GO(strtold_l, KFppa_t) \
GO(recvmsg, lFipi_t) \
GO(sendmsg, lFipi_t) \
GO(writev, lFipi_t) \
GO(__realpath_chk, pFppv_t) \
GO(__libc_init, vFpppp_t) \
GO(getaddrinfo, iFpppp_t) \

View File

@ -27,6 +27,7 @@ typedef void (*vFupppp_t)(uint32_t, void*, void*, void*, void*);
#define SUPER() ADDED_FUNCTIONS() \
GO(SDL_Quit, vFv_t) \
GO(SDL_FreeSurface, vFp_t) \
GO(SDL_KillThread, vFp_t) \
GO(SDL_UnlockSurface, vFp_t) \
GO(SDL_Has3DNow, iFv_t) \
@ -47,6 +48,7 @@ typedef void (*vFupppp_t)(uint32_t, void*, void*, void*, void*);
GO(SDL_WM_SetIcon, vFpp_t) \
GO(SDL_OpenAudio, iFpp_t) \
GO(SDL_LoadBMP_RW, pFpi_t) \
GO(SDL_RWFromMem, pFpi_t) \
GO(SDL_ListModes, pFpu_t) \
GO(SDL_CreateThread, pFpp_t) \
GO(SDL_LoadFunction, pFpp_t) \

View File

@ -239,6 +239,7 @@ typedef double (*dFdd_t)(double, double);
typedef double (*dFdD_t)(double, long double);
typedef double (*dFdp_t)(double, void*);
typedef double (*dFLL_t)(uintptr_t, uintptr_t);
typedef intptr_t (*lFES_t)(x64emu_t*, void*);
typedef intptr_t (*lFui_t)(uint32_t, int32_t);
typedef intptr_t (*lFpl_t)(void*, intptr_t);
typedef uintptr_t (*LFpL_t)(void*, uintptr_t);
@ -267,6 +268,7 @@ typedef double (*dFpBp__t)(void*, struct_p_t*);
typedef void* (*pFrL_p_t)(struct_L_t*, void*);
typedef int32_t (*iFuBLL__t)(uint32_t, struct_LL_t*);
typedef int32_t (*iFprLL__t)(void*, struct_LL_t*);
typedef int32_t (*iFpbup__t)(void*, struct_up_t*);
typedef int32_t (*iFBLL_p_t)(struct_LL_t*, void*);
typedef int32_t (*iFrLL_BLL__t)(struct_LL_t*, struct_LL_t*);
typedef void* (*pFriiiiiiiiilt_p_t)(struct_iiiiiiiiilt_t*, void*);
@ -1104,6 +1106,7 @@ void dFdd_32(x64emu_t *emu, uintptr_t fcn) { dFdd_t fn = (dFdd_t)fcn; double db
void dFdD_32(x64emu_t *emu, uintptr_t fcn) { dFdD_t fn = (dFdD_t)fcn; double db = fn(from_ptri(double, R_ESP + 4), LD2localLD(from_ptrv(R_ESP + 12))); fpu_do_push(emu); ST0val = db; }
void dFdp_32(x64emu_t *emu, uintptr_t fcn) { dFdp_t fn = (dFdp_t)fcn; double db = fn(from_ptri(double, R_ESP + 4), from_ptriv(R_ESP + 12)); fpu_do_push(emu); ST0val = db; }
void dFLL_32(x64emu_t *emu, uintptr_t fcn) { dFLL_t fn = (dFLL_t)fcn; double db = fn(to_ulong(from_ptri(ulong_t, R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8))); fpu_do_push(emu); ST0val = db; }
void lFES_32(x64emu_t *emu, uintptr_t fcn) { lFES_t fn = (lFES_t)fcn; R_EAX = to_long(fn(emu, io_convert32(from_ptriv(R_ESP + 4)))); }
void lFui_32(x64emu_t *emu, uintptr_t fcn) { lFui_t fn = (lFui_t)fcn; R_EAX = to_long(fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8))); }
void lFpl_32(x64emu_t *emu, uintptr_t fcn) { lFpl_t fn = (lFpl_t)fcn; R_EAX = to_long(fn(from_ptriv(R_ESP + 4), to_long(from_ptri(long_t, R_ESP + 8)))); }
void LFpL_32(x64emu_t *emu, uintptr_t fcn) { LFpL_t fn = (LFpL_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)))); }
@ -1132,6 +1135,7 @@ void dFpBp__32(x64emu_t *emu, uintptr_t fcn) { dFpBp__t fn = (dFpBp__t)fcn; stru
void pFrL_p_32(x64emu_t *emu, uintptr_t fcn) { pFrL_p_t fn = (pFrL_p_t)fcn; struct_L_t arg_4; from_struct_L(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); R_EAX = to_ptrv(fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8))); }
void iFuBLL__32(x64emu_t *emu, uintptr_t fcn) { iFuBLL__t fn = (iFuBLL__t)fcn; struct_LL_t arg_8; R_EAX = fn(from_ptri(uint32_t, R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_LL(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); }
void iFprLL__32(x64emu_t *emu, uintptr_t fcn) { iFprLL__t fn = (iFprLL__t)fcn; struct_LL_t arg_8; from_struct_LL(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); }
void iFpbup__32(x64emu_t *emu, uintptr_t fcn) { iFpbup__t fn = (iFpbup__t)fcn; struct_up_t arg_8; from_struct_up(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_up(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); }
void iFBLL_p_32(x64emu_t *emu, uintptr_t fcn) { iFBLL_p_t fn = (iFBLL_p_t)fcn; struct_LL_t arg_4; R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8)); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_LL(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); }
void iFrLL_BLL__32(x64emu_t *emu, uintptr_t fcn) { iFrLL_BLL__t fn = (iFrLL_BLL__t)fcn; struct_LL_t arg_4; from_struct_LL(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); struct_LL_t arg_8; R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_LL(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); }
void pFriiiiiiiiilt_p_32(x64emu_t *emu, uintptr_t fcn) { pFriiiiiiiiilt_p_t fn = (pFriiiiiiiiilt_p_t)fcn; struct_iiiiiiiiilt_t arg_4; from_struct_iiiiiiiiilt(&arg_4, *(ptr_t*)(from_ptr((R_ESP + 4)))); R_EAX = to_ptrv(fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8))); }

View File

@ -192,6 +192,7 @@ void dFdd_32(x64emu_t *emu, uintptr_t fnc);
void dFdD_32(x64emu_t *emu, uintptr_t fnc);
void dFdp_32(x64emu_t *emu, uintptr_t fnc);
void dFLL_32(x64emu_t *emu, uintptr_t fnc);
void lFES_32(x64emu_t *emu, uintptr_t fnc);
void lFui_32(x64emu_t *emu, uintptr_t fnc);
void lFpl_32(x64emu_t *emu, uintptr_t fnc);
void LFpL_32(x64emu_t *emu, uintptr_t fnc);
@ -220,6 +221,7 @@ void dFpBp__32(x64emu_t *emu, uintptr_t fnc);
void pFrL_p_32(x64emu_t *emu, uintptr_t fnc);
void iFuBLL__32(x64emu_t *emu, uintptr_t fnc);
void iFprLL__32(x64emu_t *emu, uintptr_t fnc);
void iFpbup__32(x64emu_t *emu, uintptr_t fnc);
void iFBLL_p_32(x64emu_t *emu, uintptr_t fnc);
void iFrLL_BLL__32(x64emu_t *emu, uintptr_t fnc);
void pFriiiiiiiiilt_p_32(x64emu_t *emu, uintptr_t fnc);

View File

@ -35,6 +35,7 @@
#include <sys/resource.h>
#include <sys/statvfs.h>
#include <mntent.h>
#include <sys/uio.h>
#include "wrappedlibs.h"
@ -833,36 +834,23 @@ EXPORT int my32_asprintf(x64emu_t* emu, void** buff, void * fmt, void * b) {
#endif
}
EXPORT int my32___asprintf(x64emu_t* emu, void** buff, void * fmt, void * b) __attribute__((alias("my32_asprintf")));
#endif
EXPORT int my32_vsprintf(x64emu_t* emu, void* buff, void * fmt, uint32_t * b) {
#ifndef NOALIGN
// need to align on arm
myStackAlign32((const char*)fmt, b, emu->scratch);
PREPARE_VALIST_32;
void* f = vsprintf;
int r = ((iFppp_t)f)(buff, fmt, VARARGS_32);
int r = vsprintf(buff, fmt, VARARGS_32);
return r;
#else
void* f = vsprintf;
int r = ((iFppp_t)f)(buff, fmt, b);
return r;
#endif
}
EXPORT int my32___vsprintf_chk(x64emu_t* emu, void* buff, int flags, size_t len, void * fmt, uint32_t * b) {
#ifndef NOALIGN
// need to align on arm
myStackAlign32((const char*)fmt, b, emu->scratch);
PREPARE_VALIST_32;
void* f = vsprintf;
int r = ((iFppp_t)f)(buff, fmt, VARARGS_32);
int r = vsprintf(buff, fmt, VARARGS_32);
return r;
#else
void* f = vsprintf;
int r = ((iFppp_t)f)(buff, fmt, b);
return r;
#endif
}
#endif
EXPORT int my32_vfscanf(x64emu_t* emu, void* stream, void* fmt, void* b) // probably uneeded to do a GOM, a simple wrap should enough
{
myStackAlignScanf32((const char*)fmt, (uint32_t*)b, emu->scratch);
@ -1820,6 +1808,17 @@ EXPORT int my32_scandir64(x64emu_t *emu, void* dir, void* namelist, void* sel, v
}
return ret;
}
EXPORT long my32_writev(x64emu_t* emu, int fd, struct i386_iovec* iov, int niov)
{
struct iovec vec[niov];
for(int i=0; i<niov; ++i) {
vec[i].iov_base = from_ptrv(iov[i].iov_base);
vec[i].iov_len = from_ulong(iov[i].iov_len);
}
return writev(fd, vec, niov);
}
#if 0
EXPORT int my32_ftw64(x64emu_t* emu, void* filename, void* func, int descriptors)
@ -2475,9 +2474,12 @@ void InitCpuModel()
| (1<<FEATURE_ADX);
}
EXPORT const unsigned short int *my32___ctype_b;
EXPORT const int32_t *my32___ctype_tolower;
EXPORT const int32_t *my32___ctype_toupper;
unsigned short int my32_ctype[384];
int my32_toupper[384];
int my32_tolower[384];
EXPORT ptr_t my32___ctype_b; //const unsigned short int *
EXPORT ptr_t my32___ctype_tolower; //int*
EXPORT ptr_t my32___ctype_toupper; //int*
#ifdef ANDROID
static void ctSetup()
@ -2486,9 +2488,12 @@ static void ctSetup()
#else
static void ctSetup()
{
my32___ctype_b = *(__ctype_b_loc());
my32___ctype_toupper = *(__ctype_toupper_loc());
my32___ctype_tolower = *(__ctype_tolower_loc());
memcpy(my32_toupper, *__ctype_b_loc()-128*sizeof(short), 384*sizeof(short));
my32___ctype_b = to_ptrv(&my32_ctype[128]);
memcpy(my32_toupper, *__ctype_toupper_loc()-128*sizeof(int), 384*sizeof(int));
my32___ctype_toupper = to_ptrv(&my32_toupper[128]);
memcpy(my32_tolower, *__ctype_tolower_loc()-128*sizeof(int), 384*sizeof(int));
my32___ctype_tolower = to_ptrv(&my32_tolower[128]);
}
#endif
@ -2955,6 +2960,20 @@ EXPORT unsigned long my32_wcstoul(const wchar_t* s, wchar_t** endp, int base)
return ret;
}
EXPORT long my32_ftell(x64emu_t* emu, FILE* f)
{
long ret = ftell(f);
if(ret==-1)
return ret;
if(ret==LONG_MAX)
return INT_MAX;
if(ret>INT_MAX) {
ret = -1;
errno = ERANGE;
}
return ret;
}
// wrapped malloc using calloc, it seems x86 malloc set alloc'd block to zero somehow
EXPORT void* my32_malloc(unsigned long size)
{
@ -3030,9 +3049,9 @@ EXPORT int my32_on_exit(x64emu_t* emu, void* f, void* args)
#endif
#endif
EXPORT char** my32_environ = NULL;
EXPORT char** my32__environ = NULL;
EXPORT char** my32___environ = NULL; // all aliases
EXPORT ptr_t my32_environ = 0; //char**
EXPORT ptr_t my32__environ = 0; //char**
EXPORT ptr_t my32___environ = 0; //char**
EXPORT char* my32___progname = NULL;
EXPORT char* my32___progname_full = NULL;
@ -3052,6 +3071,8 @@ EXPORT void my32_tzset()
EXPORT int my32___libc_single_threaded = 0;
EXPORT char my32__libc_intl_domainname[] = "libc";
EXPORT void* my32___errno_location(x64emu_t* emu)
{
// TODO: Find a better way to do this
@ -3083,7 +3104,7 @@ extern void* my__IO_2_1_stdout_;
InitCpuModel(); \
ctSetup(); \
/*obstackSetup();*/ \
my32_environ = my32__environ = my32___environ = box64->envv; \
my32_environ = my32__environ = my32___environ = box64->envv32; \
my32___progname_full = my32_program_invocation_name = box64->argv[0]; \
my32___progname = my32_program_invocation_short_name = \
strrchr(box64->argv[0], '/'); \

View File

@ -172,12 +172,12 @@ GOW(__connect, iFipu)
//GO(ctermid, pFp)
GO(ctime, pFrL_)
GO(ctime_r, pFrL_p)
//DATAM(__ctype_b, 4)
DATAM(__ctype_b, 4)
GOM(__ctype_b_loc, pFEv)
GOW(__ctype_get_mb_cur_max, LFv)
//DATAM(__ctype_tolower, 4)
DATAM(__ctype_tolower, 4)
GOM(__ctype_tolower_loc, pFEv)
//DATAM(__ctype_toupper, 4)
DATAM(__ctype_toupper, 4)
GOM(__ctype_toupper_loc, pFEv)
// __curbrk // type B
//GO(cuserid, pFp)
@ -250,7 +250,7 @@ GOW(endutent, vFv)
// endutxent
//DATAM(environ, 4)
//DATAM(_environ, 4)
//DATAM(__environ, 4) // type B
DATAM(__environ, 4) // type B
// envz_add
// envz_entry
// envz_get
@ -413,7 +413,7 @@ GOWM(fstatfs64, iFip) //%%,noE
//GO(fstatvfs, iFip)
//GOW(fstatvfs64, iFip) // alignment?
GOW(fsync, iFi)
GOW(ftell, lFS)
GOWM(ftell, lFES)
GO(ftello, lFS)
GO(ftello64, IFS)
//GO(ftime, iFp)
@ -1001,7 +1001,7 @@ GO(__libc_current_sigrtmin, iFv)
//GO(__libc_free, vFp)
// __libc_freeres
GOM(__libc_init_first, vFEipV) //%%
// _libc_intl_domainname // type R
DATAM(_libc_intl_domainname, 4) // type R
//GO2(__libc_open, iFEpOu, my_open)
// __libc_longjmp
// __libc_mallinfo
@ -1899,7 +1899,7 @@ GOM(__vfprintf_chk, iFESvpp) //%%
GOWM(vsnprintf, iFEpLpp) //%%
GOWM(__vsnprintf, iFEpLpp) //%%
GOM(__vsnprintf_chk, iFEpLvvpp) //%%
//GOWM(vsprintf, iFEppp) //%%
GOWM(vsprintf, iFEppp) //%%
//GOM(__vsprintf_chk, iFEpiLpp) //%%
//GOM(vsscanf, iFEppp) //%%
// __vsscanf // Weak
@ -2033,7 +2033,7 @@ GOM(wprintf, iFEpV) //%%
//GOM(__wprintf_chk, iFEipV) //%%
GOW(write, lFipL)
//GOW(__write, lFipL)
//GOW(writev, lFipi)
GOWM(writev, lFEipi)
// wscanf
// __wuflow
// __wunderflow
@ -2043,7 +2043,7 @@ GOW(write, lFipL)
// xdr_authdes_cred
// xdr_authdes_verf
// xdr_authunix_parms
// xdr_bool
GO(xdr_bool, iFpp)
// xdr_bytes
// xdr_callhdr
// xdr_callmsg
@ -2071,7 +2071,7 @@ GOW(write, lFipL)
// xdr_longlong_t
// xdrmem_create
// xdr_netnamestr
// xdr_netobj
GO(xdr_netobj, iFpbup_)
// xdr_opaque
// xdr_opaque_auth
// xdr_pmap
@ -2093,7 +2093,7 @@ GOW(write, lFipL)
// xdr_string
// xdr_u_char
// xdr_u_hyper
//GO(xdr_u_int, iFpp)
GO(xdr_u_int, iFpp)
// xdr_uint16_t
// xdr_uint32_t
// xdr_uint64_t
@ -2105,7 +2105,7 @@ GOW(write, lFipL)
// xdr_u_quad_t
// xdr_u_short
// xdr_vector
// xdr_void
GO(xdr_void, iFv)
// xdr_wrapstring
// xencrypt
GO(__xmknod, iFipup)

View File

@ -328,12 +328,14 @@ EXPORT void *my32_SDL_RWFromFile(x64emu_t* emu, void* a, void* b)
inplace_SDL_RWops_to_32(ret);
return ret;
}
//EXPORT void *my32_SDL_RWFromMem(x64emu_t* emu, void* a, int b)
//{
// SDL1_RWops_t* r = (SDL1_RWops_t*)my->SDL_RWFromMem(a, b);
// RWSetType(r, 4);
// return AddNativeRW(emu, r);
//}
EXPORT void *my32_SDL_RWFromMem(x64emu_t* emu, void* a, int b)
{
SDL1_RWops_t* r = (SDL1_RWops_t*)my->SDL_RWFromMem(a, b);
RWSetType(r, 4);
void* ret = AddNativeRW(emu, r);
inplace_SDL_RWops_to_32(ret);
return ret;
}
EXPORT void my32_SDL_WM_SetIcon(void* s, void* mask)
{
@ -560,6 +562,13 @@ EXPORT void* my32_SDL_GetVideoSurface()
return unwrapSurface(ret);
}
EXPORT void my32_SDL_FreeSurface(void* s)
{
my->SDL_FreeSurface(wrapSurface(s));
if(s==&sdl_vm_surface)
sdl1_videomode_org = NULL;
}
EXPORT int my32_SDL_PollEvent(my_SDL_Event_32_t* evt)
{
my_SDL_Event_t event;
@ -611,14 +620,14 @@ EXPORT void* my32_SDL_ListModes(my_SDL_PixelFormat_32_t* fmt, uint32_t flags)
// return ret;
//}
//#define CUSTOM_INIT \
// box64->sdl1allocrw = my->SDL_AllocRW; \
// box64->sdl1freerw = my->SDL_FreeRW;
#define CUSTOM_INIT \
box64->sdl1allocrw = my->SDL_AllocRW; \
box64->sdl1freerw = my->SDL_FreeRW;
#define NEEDED_LIBS "libm.so.6", "libdl.so.2", "librt.so.1"
//#define CUSTOM_FINI \
// my32_context->sdl1allocrw = NULL; \
// my32_context->sdl1freerw = NULL;
#define CUSTOM_FINI \
my_context->sdl1allocrw = NULL; \
my_context->sdl1freerw = NULL;
#include "wrappedlib_init32.h"

View File

@ -5,7 +5,7 @@
// _fini
// _init
//GOM(SDL_AddTimer, pFEupp)
//GO(SDL_AllocRW, pFv) // no need to use a my_ version here
GO(SDL_AllocRW, pFv) // no need to use a my_ version here
//GO(SDL_CDClose, vFp)
//GO(SDL_CDEject, iFp)
//GO(SDL_CDName, pFi)
@ -45,8 +45,8 @@ GO(SDL_EventState, CFCi)
//GO(SDL_FillRect, iFppu)
GOM(SDL_Flip, iFp) //%noE
GO(SDL_FreeCursor, vFp)
//GO(SDL_FreeRW, vFp)
//GO(SDL_FreeSurface, vFp)
GO(SDL_FreeRW, vFp)
GOM(SDL_FreeSurface, vFp) //%noE
//GO(SDL_FreeYUVOverlay, vFp)
GO(SDL_GL_GetAttribute, iFup)
GOM(SDL_GL_GetProcAddress, pFEp)
@ -102,7 +102,7 @@ GO(SDL_JoystickOpen, pFi)
GO(SDL_JoystickOpened, iFi)
GO(SDL_JoystickUpdate, vFv)
GOM(SDL_KillThread, vFEp)
//GO(SDL_Linked_Version, pFv)
GO(SDL_Linked_Version, pFv)
GOM(SDL_ListModes, pFpu) //%noE
GOM(SDL_LoadBMP_RW, pFEpi)
GOM(SDL_LoadFunction, pFEpp)
@ -122,7 +122,7 @@ GO(SDL_QuitSubSystem, vFu)
//GOM(SDL_RWFromConstMem, pFEpi)
//GOM(SDL_RWFromFP, pFEpi)
GOM(SDL_RWFromFile, pFEpp)
//GOM(SDL_RWFromMem, pFEpi)
GOM(SDL_RWFromMem, pFEpi)
//GOM(SDL_ReadBE16, uFEp)
//GOM(SDL_ReadBE32, uFEp)
//GOM(SDL_ReadBE64, UFEp)