mirror of
https://github.com/ValveSoftware/Proton.git
synced 2024-12-27 23:25:50 +03:00
lsteamclient: Also convert callbacks during GetAPICallResult
This commit is contained in:
parent
0466c19484
commit
d4307363c9
@ -305,12 +305,16 @@ def handle_method(cfile, classname, winclassname, cppname, method, cpp, cpp_h, e
|
||||
else:
|
||||
cpp.write(" return ")
|
||||
|
||||
should_do_cb_wrap = "GetAPICallResult" in used_name
|
||||
should_gen_wrapper = method.result_type.spelling.startswith("ISteam") or \
|
||||
used_name.startswith("GetISteamGenericInterface")
|
||||
if should_gen_wrapper:
|
||||
cfile.write("create_win_interface(pchVersion,\n ")
|
||||
|
||||
cfile.write("%s_%s(_this->linux_side" % (cppname, used_name))
|
||||
if should_do_cb_wrap:
|
||||
cfile.write("do_cb_wrap(0, _this->linux_side, &%s_%s" % (cppname, used_name))
|
||||
else:
|
||||
if should_gen_wrapper:
|
||||
cfile.write("create_win_interface(pchVersion,\n ")
|
||||
cfile.write("%s_%s(_this->linux_side" % (cppname, used_name))
|
||||
cpp.write("((%s*)linux_side)->%s(" % (classname, method.spelling))
|
||||
unnamed = 'a'
|
||||
first = True
|
||||
|
@ -208,27 +208,34 @@ static int get_callback_len(int cb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CDECL Steam_GetAPICallResult(HSteamPipe pipe, SteamAPICall_t call,
|
||||
void *callback, int callback_len, int cb_expected, bool *failed)
|
||||
bool do_cb_wrap(HSteamPipe pipe, void *linux_side,
|
||||
bool (*cpp_func)(void *, SteamAPICall_t, void *, int, int, bool *),
|
||||
SteamAPICall_t call, void *callback, int callback_len, int cb_expected, bool *failed)
|
||||
{
|
||||
void *lin_callback = NULL;
|
||||
int lin_callback_len;
|
||||
bool ret;
|
||||
|
||||
TRACE("%u, x, %p, %u, %u, %p\n", pipe, callback, callback_len, cb_expected, failed);
|
||||
|
||||
if(!load_steamclient())
|
||||
return 0;
|
||||
|
||||
lin_callback_len = get_callback_len(cb_expected);
|
||||
if(!lin_callback_len)
|
||||
if(!lin_callback_len){
|
||||
/* structs are compatible, pass on through */
|
||||
return steamclient_GetAPICallResult(pipe, call, callback, callback_len, cb_expected, failed);
|
||||
if(!cpp_func){
|
||||
if(!load_steamclient())
|
||||
return 0;
|
||||
return steamclient_GetAPICallResult(pipe, call, callback, callback_len, cb_expected, failed);
|
||||
}
|
||||
return cpp_func(linux_side, call, callback, callback_len, cb_expected, failed);
|
||||
}
|
||||
|
||||
/* structs require conversion */
|
||||
lin_callback = HeapAlloc(GetProcessHeap(), 0, lin_callback_len);
|
||||
|
||||
ret = steamclient_GetAPICallResult(pipe, call, lin_callback, lin_callback_len, cb_expected, failed);
|
||||
if(!cpp_func){
|
||||
if(!load_steamclient())
|
||||
return 0;
|
||||
ret = steamclient_GetAPICallResult(pipe, call, lin_callback, lin_callback_len, cb_expected, failed);
|
||||
}else
|
||||
ret = cpp_func(linux_side, call, lin_callback, lin_callback_len, cb_expected, failed);
|
||||
|
||||
if(ret){
|
||||
switch(cb_expected){
|
||||
@ -241,6 +248,13 @@ bool CDECL Steam_GetAPICallResult(HSteamPipe pipe, SteamAPICall_t call,
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CDECL Steam_GetAPICallResult(HSteamPipe pipe, SteamAPICall_t call,
|
||||
void *callback, int callback_len, int cb_expected, bool *failed)
|
||||
{
|
||||
TRACE("%u, x, %p, %u, %u, %p\n", pipe, callback, callback_len, cb_expected, failed);
|
||||
return do_cb_wrap(pipe, NULL, NULL, call, callback, callback_len, cb_expected, failed);
|
||||
}
|
||||
|
||||
bool CDECL Steam_FreeLastCallback(HSteamPipe pipe)
|
||||
{
|
||||
TRACE("%u\n", pipe);
|
||||
|
@ -34,6 +34,7 @@ void *create_LinuxISteamMatchmakingServerListResponse(void *win);
|
||||
void *create_LinuxISteamMatchmakingPingResponse(void *win);
|
||||
void *create_LinuxISteamMatchmakingPlayersResponse(void *win);
|
||||
void *create_LinuxISteamMatchmakingRulesResponse(void *win);
|
||||
bool do_cb_wrap(HSteamPipe pipe, void *linux_side, bool (*cpp_func)(void *, SteamAPICall_t, void *, int, int, bool *), SteamAPICall_t call, void *callback, int callback_len, int cb_expected, bool *failed);
|
||||
|
||||
#define TRACE WINE_TRACE
|
||||
#define ERR WINE_ERR
|
||||
|
@ -115,7 +115,7 @@ DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils009_GetAPICallResult, 28)
|
||||
bool __thiscall winISteamUtils_SteamUtils009_GetAPICallResult(winISteamUtils_SteamUtils009 *_this, SteamAPICall_t hSteamAPICall, void * pCallback, int cubCallback, int iCallbackExpected, bool * pbFailed)
|
||||
{
|
||||
TRACE("%p\n", _this);
|
||||
return cppISteamUtils_SteamUtils009_GetAPICallResult(_this->linux_side, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
return do_cb_wrap(0, _this->linux_side, &cppISteamUtils_SteamUtils009_GetAPICallResult, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils009_RunFrame, 4)
|
||||
@ -382,7 +382,7 @@ DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils008_GetAPICallResult, 28)
|
||||
bool __thiscall winISteamUtils_SteamUtils008_GetAPICallResult(winISteamUtils_SteamUtils008 *_this, SteamAPICall_t hSteamAPICall, void * pCallback, int cubCallback, int iCallbackExpected, bool * pbFailed)
|
||||
{
|
||||
TRACE("%p\n", _this);
|
||||
return cppISteamUtils_SteamUtils008_GetAPICallResult(_this->linux_side, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
return do_cb_wrap(0, _this->linux_side, &cppISteamUtils_SteamUtils008_GetAPICallResult, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils008_RunFrame, 4)
|
||||
@ -633,7 +633,7 @@ DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils007_GetAPICallResult, 28)
|
||||
bool __thiscall winISteamUtils_SteamUtils007_GetAPICallResult(winISteamUtils_SteamUtils007 *_this, SteamAPICall_t hSteamAPICall, void * pCallback, int cubCallback, int iCallbackExpected, bool * pbFailed)
|
||||
{
|
||||
TRACE("%p\n", _this);
|
||||
return cppISteamUtils_SteamUtils007_GetAPICallResult(_this->linux_side, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
return do_cb_wrap(0, _this->linux_side, &cppISteamUtils_SteamUtils007_GetAPICallResult, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils007_RunFrame, 4)
|
||||
@ -868,7 +868,7 @@ DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils006_GetAPICallResult, 28)
|
||||
bool __thiscall winISteamUtils_SteamUtils006_GetAPICallResult(winISteamUtils_SteamUtils006 *_this, SteamAPICall_t hSteamAPICall, void * pCallback, int cubCallback, int iCallbackExpected, bool * pbFailed)
|
||||
{
|
||||
TRACE("%p\n", _this);
|
||||
return cppISteamUtils_SteamUtils006_GetAPICallResult(_this->linux_side, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
return do_cb_wrap(0, _this->linux_side, &cppISteamUtils_SteamUtils006_GetAPICallResult, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils006_RunFrame, 4)
|
||||
@ -1095,7 +1095,7 @@ DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils005_GetAPICallResult, 28)
|
||||
bool __thiscall winISteamUtils_SteamUtils005_GetAPICallResult(winISteamUtils_SteamUtils005 *_this, SteamAPICall_t hSteamAPICall, void * pCallback, int cubCallback, int iCallbackExpected, bool * pbFailed)
|
||||
{
|
||||
TRACE("%p\n", _this);
|
||||
return cppISteamUtils_SteamUtils005_GetAPICallResult(_this->linux_side, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
return do_cb_wrap(0, _this->linux_side, &cppISteamUtils_SteamUtils005_GetAPICallResult, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils005_RunFrame, 4)
|
||||
@ -1306,7 +1306,7 @@ DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils004_GetAPICallResult, 28)
|
||||
bool __thiscall winISteamUtils_SteamUtils004_GetAPICallResult(winISteamUtils_SteamUtils004 *_this, SteamAPICall_t hSteamAPICall, void * pCallback, int cubCallback, int iCallbackExpected, bool * pbFailed)
|
||||
{
|
||||
TRACE("%p\n", _this);
|
||||
return cppISteamUtils_SteamUtils004_GetAPICallResult(_this->linux_side, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
return do_cb_wrap(0, _this->linux_side, &cppISteamUtils_SteamUtils004_GetAPICallResult, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils004_RunFrame, 4)
|
||||
@ -1477,7 +1477,7 @@ DEFINE_THISCALL_WRAPPER(winISteamUtils_SteamUtils002_GetAPICallResult, 28)
|
||||
bool __thiscall winISteamUtils_SteamUtils002_GetAPICallResult(winISteamUtils_SteamUtils002 *_this, SteamAPICall_t hSteamAPICall, void * pCallback, int cubCallback, int iCallbackExpected, bool * pbFailed)
|
||||
{
|
||||
TRACE("%p\n", _this);
|
||||
return cppISteamUtils_SteamUtils002_GetAPICallResult(_this->linux_side, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
return do_cb_wrap(0, _this->linux_side, &cppISteamUtils_SteamUtils002_GetAPICallResult, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, pbFailed);
|
||||
}
|
||||
|
||||
extern vtable_ptr winISteamUtils_SteamUtils002_vtable;
|
||||
|
Loading…
Reference in New Issue
Block a user