From 537b4096a59b57d4424c5914eea11ba3943d2de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 29 Sep 2023 11:34:51 +0200 Subject: [PATCH] lsteamclient: Use manual methods instead of codegen for callbacks. CW-Bug-Id: #22729 --- lsteamclient/Makefile.in | 9 +- ...2.cpp => cppISteamUtils_SteamUtils002.hpp} | 6 - ...4.cpp => cppISteamUtils_SteamUtils004.hpp} | 6 - ...5.cpp => cppISteamUtils_SteamUtils005.hpp} | 6 - ...6.cpp => cppISteamUtils_SteamUtils006.hpp} | 6 - ...7.cpp => cppISteamUtils_SteamUtils007.hpp} | 6 - ...8.cpp => cppISteamUtils_SteamUtils008.hpp} | 6 - ...9.cpp => cppISteamUtils_SteamUtils009.hpp} | 6 - ...0.cpp => cppISteamUtils_SteamUtils010.hpp} | 6 - lsteamclient/gen_wrapper.py | 17 +- lsteamclient/steamclient_private.h | 3 - lsteamclient/unix_private.h | 3 + lsteamclient/unix_steam_utils_manual.cpp | 202 ++++++++++++++++++ lsteamclient/winISteamUtils.c | 72 ------- 14 files changed, 208 insertions(+), 146 deletions(-) rename lsteamclient/{cppISteamUtils_SteamUtils002.cpp => cppISteamUtils_SteamUtils002.hpp} (92%) rename lsteamclient/{cppISteamUtils_SteamUtils004.cpp => cppISteamUtils_SteamUtils004.hpp} (94%) rename lsteamclient/{cppISteamUtils_SteamUtils005.cpp => cppISteamUtils_SteamUtils005.hpp} (95%) rename lsteamclient/{cppISteamUtils_SteamUtils006.cpp => cppISteamUtils_SteamUtils006.hpp} (95%) rename lsteamclient/{cppISteamUtils_SteamUtils007.cpp => cppISteamUtils_SteamUtils007.hpp} (96%) rename lsteamclient/{cppISteamUtils_SteamUtils008.cpp => cppISteamUtils_SteamUtils008.hpp} (96%) rename lsteamclient/{cppISteamUtils_SteamUtils009.cpp => cppISteamUtils_SteamUtils009.hpp} (96%) rename lsteamclient/{cppISteamUtils_SteamUtils010.cpp => cppISteamUtils_SteamUtils010.hpp} (97%) create mode 100644 lsteamclient/unix_steam_utils_manual.cpp diff --git a/lsteamclient/Makefile.in b/lsteamclient/Makefile.in index d76d87b7..77efbdb8 100644 --- a/lsteamclient/Makefile.in +++ b/lsteamclient/Makefile.in @@ -211,14 +211,6 @@ SOURCES = \ cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION010.cpp \ cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION011.cpp \ cppISteamUserStats_STEAMUSERSTATS_INTERFACE_VERSION012.cpp \ - cppISteamUtils_SteamUtils002.cpp \ - cppISteamUtils_SteamUtils004.cpp \ - cppISteamUtils_SteamUtils005.cpp \ - cppISteamUtils_SteamUtils006.cpp \ - cppISteamUtils_SteamUtils007.cpp \ - cppISteamUtils_SteamUtils008.cpp \ - cppISteamUtils_SteamUtils009.cpp \ - cppISteamUtils_SteamUtils010.cpp \ cppISteamVideo_STEAMVIDEO_INTERFACE_V001.cpp \ cppISteamVideo_STEAMVIDEO_INTERFACE_V002.cpp \ steamclient_manual_141.cpp \ @@ -298,4 +290,5 @@ SOURCES = \ struct_converters_157.cpp \ struct_converters_158.cpp \ unix_steam_client_manual.cpp \ + unix_steam_utils_manual.cpp \ unixlib_generated.cpp \ diff --git a/lsteamclient/cppISteamUtils_SteamUtils002.cpp b/lsteamclient/cppISteamUtils_SteamUtils002.hpp similarity index 92% rename from lsteamclient/cppISteamUtils_SteamUtils002.cpp rename to lsteamclient/cppISteamUtils_SteamUtils002.hpp index 94669b5b..b6879d0e 100644 --- a/lsteamclient/cppISteamUtils_SteamUtils002.cpp +++ b/lsteamclient/cppISteamUtils_SteamUtils002.hpp @@ -100,9 +100,3 @@ void cppISteamUtils_SteamUtils002_GetAPICallFailureReason( struct cppISteamUtils params->_ret = iface->GetAPICallFailureReason( params->hSteamAPICall ); } -void cppISteamUtils_SteamUtils002_GetAPICallResult( struct cppISteamUtils_SteamUtils002_GetAPICallResult_params *params ) -{ - struct u_ISteamUtils_SteamUtils002 *iface = (struct u_ISteamUtils_SteamUtils002 *)params->linux_side; - params->_ret = iface->GetAPICallResult( params->hSteamAPICall, params->pCallback, params->cubCallback, params->iCallbackExpected, params->pbFailed ); -} - diff --git a/lsteamclient/cppISteamUtils_SteamUtils004.cpp b/lsteamclient/cppISteamUtils_SteamUtils004.hpp similarity index 94% rename from lsteamclient/cppISteamUtils_SteamUtils004.cpp rename to lsteamclient/cppISteamUtils_SteamUtils004.hpp index 2ff16640..a5112a93 100644 --- a/lsteamclient/cppISteamUtils_SteamUtils004.cpp +++ b/lsteamclient/cppISteamUtils_SteamUtils004.hpp @@ -104,12 +104,6 @@ void cppISteamUtils_SteamUtils004_GetAPICallFailureReason( struct cppISteamUtils params->_ret = iface->GetAPICallFailureReason( params->hSteamAPICall ); } -void cppISteamUtils_SteamUtils004_GetAPICallResult( struct cppISteamUtils_SteamUtils004_GetAPICallResult_params *params ) -{ - struct u_ISteamUtils_SteamUtils004 *iface = (struct u_ISteamUtils_SteamUtils004 *)params->linux_side; - params->_ret = iface->GetAPICallResult( params->hSteamAPICall, params->pCallback, params->cubCallback, params->iCallbackExpected, params->pbFailed ); -} - void cppISteamUtils_SteamUtils004_RunFrame( struct cppISteamUtils_SteamUtils004_RunFrame_params *params ) { struct u_ISteamUtils_SteamUtils004 *iface = (struct u_ISteamUtils_SteamUtils004 *)params->linux_side; diff --git a/lsteamclient/cppISteamUtils_SteamUtils005.cpp b/lsteamclient/cppISteamUtils_SteamUtils005.hpp similarity index 95% rename from lsteamclient/cppISteamUtils_SteamUtils005.cpp rename to lsteamclient/cppISteamUtils_SteamUtils005.hpp index 2b464d48..aa8b52e8 100644 --- a/lsteamclient/cppISteamUtils_SteamUtils005.cpp +++ b/lsteamclient/cppISteamUtils_SteamUtils005.hpp @@ -109,12 +109,6 @@ void cppISteamUtils_SteamUtils005_GetAPICallFailureReason( struct cppISteamUtils params->_ret = iface->GetAPICallFailureReason( params->hSteamAPICall ); } -void cppISteamUtils_SteamUtils005_GetAPICallResult( struct cppISteamUtils_SteamUtils005_GetAPICallResult_params *params ) -{ - struct u_ISteamUtils_SteamUtils005 *iface = (struct u_ISteamUtils_SteamUtils005 *)params->linux_side; - params->_ret = iface->GetAPICallResult( params->hSteamAPICall, params->pCallback, params->cubCallback, params->iCallbackExpected, params->pbFailed ); -} - void cppISteamUtils_SteamUtils005_RunFrame( struct cppISteamUtils_SteamUtils005_RunFrame_params *params ) { struct u_ISteamUtils_SteamUtils005 *iface = (struct u_ISteamUtils_SteamUtils005 *)params->linux_side; diff --git a/lsteamclient/cppISteamUtils_SteamUtils006.cpp b/lsteamclient/cppISteamUtils_SteamUtils006.hpp similarity index 95% rename from lsteamclient/cppISteamUtils_SteamUtils006.cpp rename to lsteamclient/cppISteamUtils_SteamUtils006.hpp index 12db38d0..fa728553 100644 --- a/lsteamclient/cppISteamUtils_SteamUtils006.cpp +++ b/lsteamclient/cppISteamUtils_SteamUtils006.hpp @@ -111,12 +111,6 @@ void cppISteamUtils_SteamUtils006_GetAPICallFailureReason( struct cppISteamUtils params->_ret = iface->GetAPICallFailureReason( params->hSteamAPICall ); } -void cppISteamUtils_SteamUtils006_GetAPICallResult( struct cppISteamUtils_SteamUtils006_GetAPICallResult_params *params ) -{ - struct u_ISteamUtils_SteamUtils006 *iface = (struct u_ISteamUtils_SteamUtils006 *)params->linux_side; - params->_ret = iface->GetAPICallResult( params->hSteamAPICall, params->pCallback, params->cubCallback, params->iCallbackExpected, params->pbFailed ); -} - void cppISteamUtils_SteamUtils006_RunFrame( struct cppISteamUtils_SteamUtils006_RunFrame_params *params ) { struct u_ISteamUtils_SteamUtils006 *iface = (struct u_ISteamUtils_SteamUtils006 *)params->linux_side; diff --git a/lsteamclient/cppISteamUtils_SteamUtils007.cpp b/lsteamclient/cppISteamUtils_SteamUtils007.hpp similarity index 96% rename from lsteamclient/cppISteamUtils_SteamUtils007.cpp rename to lsteamclient/cppISteamUtils_SteamUtils007.hpp index 73d6f58e..23e4451f 100644 --- a/lsteamclient/cppISteamUtils_SteamUtils007.cpp +++ b/lsteamclient/cppISteamUtils_SteamUtils007.hpp @@ -112,12 +112,6 @@ void cppISteamUtils_SteamUtils007_GetAPICallFailureReason( struct cppISteamUtils params->_ret = iface->GetAPICallFailureReason( params->hSteamAPICall ); } -void cppISteamUtils_SteamUtils007_GetAPICallResult( struct cppISteamUtils_SteamUtils007_GetAPICallResult_params *params ) -{ - struct u_ISteamUtils_SteamUtils007 *iface = (struct u_ISteamUtils_SteamUtils007 *)params->linux_side; - params->_ret = iface->GetAPICallResult( params->hSteamAPICall, params->pCallback, params->cubCallback, params->iCallbackExpected, params->pbFailed ); -} - void cppISteamUtils_SteamUtils007_RunFrame( struct cppISteamUtils_SteamUtils007_RunFrame_params *params ) { struct u_ISteamUtils_SteamUtils007 *iface = (struct u_ISteamUtils_SteamUtils007 *)params->linux_side; diff --git a/lsteamclient/cppISteamUtils_SteamUtils008.cpp b/lsteamclient/cppISteamUtils_SteamUtils008.hpp similarity index 96% rename from lsteamclient/cppISteamUtils_SteamUtils008.cpp rename to lsteamclient/cppISteamUtils_SteamUtils008.hpp index a4dd427d..37a58ff7 100644 --- a/lsteamclient/cppISteamUtils_SteamUtils008.cpp +++ b/lsteamclient/cppISteamUtils_SteamUtils008.hpp @@ -114,12 +114,6 @@ void cppISteamUtils_SteamUtils008_GetAPICallFailureReason( struct cppISteamUtils params->_ret = iface->GetAPICallFailureReason( params->hSteamAPICall ); } -void cppISteamUtils_SteamUtils008_GetAPICallResult( struct cppISteamUtils_SteamUtils008_GetAPICallResult_params *params ) -{ - struct u_ISteamUtils_SteamUtils008 *iface = (struct u_ISteamUtils_SteamUtils008 *)params->linux_side; - params->_ret = iface->GetAPICallResult( params->hSteamAPICall, params->pCallback, params->cubCallback, params->iCallbackExpected, params->pbFailed ); -} - void cppISteamUtils_SteamUtils008_RunFrame( struct cppISteamUtils_SteamUtils008_RunFrame_params *params ) { struct u_ISteamUtils_SteamUtils008 *iface = (struct u_ISteamUtils_SteamUtils008 *)params->linux_side; diff --git a/lsteamclient/cppISteamUtils_SteamUtils009.cpp b/lsteamclient/cppISteamUtils_SteamUtils009.hpp similarity index 96% rename from lsteamclient/cppISteamUtils_SteamUtils009.cpp rename to lsteamclient/cppISteamUtils_SteamUtils009.hpp index 6c19fc1f..a825a034 100644 --- a/lsteamclient/cppISteamUtils_SteamUtils009.cpp +++ b/lsteamclient/cppISteamUtils_SteamUtils009.hpp @@ -120,12 +120,6 @@ void cppISteamUtils_SteamUtils009_GetAPICallFailureReason( struct cppISteamUtils params->_ret = iface->GetAPICallFailureReason( params->hSteamAPICall ); } -void cppISteamUtils_SteamUtils009_GetAPICallResult( struct cppISteamUtils_SteamUtils009_GetAPICallResult_params *params ) -{ - struct u_ISteamUtils_SteamUtils009 *iface = (struct u_ISteamUtils_SteamUtils009 *)params->linux_side; - params->_ret = iface->GetAPICallResult( params->hSteamAPICall, params->pCallback, params->cubCallback, params->iCallbackExpected, params->pbFailed ); -} - void cppISteamUtils_SteamUtils009_RunFrame( struct cppISteamUtils_SteamUtils009_RunFrame_params *params ) { struct u_ISteamUtils_SteamUtils009 *iface = (struct u_ISteamUtils_SteamUtils009 *)params->linux_side; diff --git a/lsteamclient/cppISteamUtils_SteamUtils010.cpp b/lsteamclient/cppISteamUtils_SteamUtils010.hpp similarity index 97% rename from lsteamclient/cppISteamUtils_SteamUtils010.cpp rename to lsteamclient/cppISteamUtils_SteamUtils010.hpp index 34c18929..a5b462d4 100644 --- a/lsteamclient/cppISteamUtils_SteamUtils010.cpp +++ b/lsteamclient/cppISteamUtils_SteamUtils010.hpp @@ -124,12 +124,6 @@ void cppISteamUtils_SteamUtils010_GetAPICallFailureReason( struct cppISteamUtils params->_ret = iface->GetAPICallFailureReason( params->hSteamAPICall ); } -void cppISteamUtils_SteamUtils010_GetAPICallResult( struct cppISteamUtils_SteamUtils010_GetAPICallResult_params *params ) -{ - struct u_ISteamUtils_SteamUtils010 *iface = (struct u_ISteamUtils_SteamUtils010 *)params->linux_side; - params->_ret = iface->GetAPICallResult( params->hSteamAPICall, params->pCallback, params->cubCallback, params->iCallbackExpected, params->pbFailed ); -} - void cppISteamUtils_SteamUtils010_RunFrame( struct cppISteamUtils_SteamUtils010_RunFrame_params *params ) { struct u_ISteamUtils_SteamUtils010 *iface = (struct u_ISteamUtils_SteamUtils010 *)params->linux_side; diff --git a/lsteamclient/gen_wrapper.py b/lsteamclient/gen_wrapper.py index 44283200..6dfc84a6 100755 --- a/lsteamclient/gen_wrapper.py +++ b/lsteamclient/gen_wrapper.py @@ -231,6 +231,8 @@ MANUAL_METHODS = { "ISteamClient_BShutdownIfAllPipesClosed": lambda ver, abi: abi == 'w', "ISteamClient_CreateSteamPipe": lambda ver, abi: abi == 'w', "ISteamClient_Set_SteamAPI_CCheckCallbackRegisteredInProcess": lambda ver, abi: abi == 'u' and ver >= 20, + + "ISteamUtils_GetAPICallResult": lambda ver, abi: abi == 'u', } @@ -995,11 +997,6 @@ def handle_method_c(klass, method, winclassname, cppname, out): for name in names[1:]: out(f' .{name} = {name},\n') out(u' };\n') - should_gen_callback = "GetAPICallResult" in method.name - if should_gen_callback: - out(u' int w_callback_len = cubCallback;\n') - out(u' void *w_callback = pCallback;\n') - path_conv_utow = PATH_CONV_METHODS_UTOW.get(f'{klass.name}_{method.spelling}', {}) path_conv_wtou = PATH_CONV_METHODS_WTOU.get(f'{klass.name}_{method.spelling}', {}) @@ -1011,9 +1008,6 @@ def handle_method_c(klass, method, winclassname, cppname, out): out(u' TRACE("%p\\n", _this);\n') - if should_gen_callback: - out(u' if (!(params.pCallback = alloc_callback_wtou(iCallbackExpected, w_callback, ¶ms.cubCallback))) return FALSE;\n') - out(f' {cppname}_{method.name}( ¶ms );\n') should_gen_wrapper = not is_manual_method(klass, method, "u") and \ @@ -1022,13 +1016,6 @@ def handle_method_c(klass, method, winclassname, cppname, out): if should_gen_wrapper: out(u' params._ret = create_win_interface( pchVersion, params._ret );\n') - if should_gen_callback: - out(u' if (params._ret && params.pCallback != w_callback)\n') - out(u' {\n') - out(u' convert_callback_utow(iCallbackExpected, params.pCallback, params.cubCallback, w_callback, w_callback_len);\n') - out(u' HeapFree(GetProcessHeap(), 0, params.pCallback);\n') - out(u' }\n\n') - for name, conv in filter(lambda x: x[0] in names, path_conv_utow.items()): out(u' ') if "ret_size" in path_conv_utow: diff --git a/lsteamclient/steamclient_private.h b/lsteamclient/steamclient_private.h index 21d5871b..77524bb1 100644 --- a/lsteamclient/steamclient_private.h +++ b/lsteamclient/steamclient_private.h @@ -48,9 +48,6 @@ unsigned int steamclient_unix_path_to_dos_path( bool api_result, const char *src void *alloc_mem_for_iface(size_t size, const char *iface_version); void *alloc_vtable(void *vtable, unsigned int method_count, const char *iface_version); -void *alloc_callback_wtou( int id, void *callback, int *callback_len ); -void convert_callback_utow( int id, void *u_callback, int u_callback_len, void *w_callback, int w_callback_len ); - extern void start_callback_thread(void) DECLSPEC_HIDDEN; extern void stop_callback_thread(void) DECLSPEC_HIDDEN; diff --git a/lsteamclient/unix_private.h b/lsteamclient/unix_private.h index 18fddef5..e44a28d8 100644 --- a/lsteamclient/unix_private.h +++ b/lsteamclient/unix_private.h @@ -59,6 +59,9 @@ typedef void (W_STDCALL *w_void_SteamAPI_PostAPIResultInProcess_t)(void); u_void_SteamAPI_PostAPIResultInProcess_t manual_convert_DEPRECATED_Set_SteamAPI_CPostAPIResultInProcess__a( w_void_SteamAPI_PostAPIResultInProcess_t ); u_void_SteamAPI_PostAPIResultInProcess_t manual_convert_DEPRECATED_Remove_SteamAPI_CPostAPIResultInProcess__a( w_void_SteamAPI_PostAPIResultInProcess_t ); +void *alloc_callback_wtou( int id, void *callback, int *callback_len ); +void convert_callback_utow( int id, void *u_callback, int u_callback_len, void *w_callback, int w_callback_len ); + #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ diff --git a/lsteamclient/unix_steam_utils_manual.cpp b/lsteamclient/unix_steam_utils_manual.cpp new file mode 100644 index 00000000..bab63e12 --- /dev/null +++ b/lsteamclient/unix_steam_utils_manual.cpp @@ -0,0 +1,202 @@ +#include "unix_private.h" + +#include "cppISteamUtils_SteamUtils002.hpp" +#include "cppISteamUtils_SteamUtils004.hpp" +#include "cppISteamUtils_SteamUtils005.hpp" +#include "cppISteamUtils_SteamUtils006.hpp" +#include "cppISteamUtils_SteamUtils007.hpp" +#include "cppISteamUtils_SteamUtils008.hpp" +#include "cppISteamUtils_SteamUtils009.hpp" +#include "cppISteamUtils_SteamUtils010.hpp" + +/* ISteamUtils_SteamUtils002 */ + +void cppISteamUtils_SteamUtils002_GetAPICallResult( struct cppISteamUtils_SteamUtils002_GetAPICallResult_params *params ) +{ + struct u_ISteamUtils_SteamUtils002 *iface = (struct u_ISteamUtils_SteamUtils002 *)params->linux_side; + int u_callback_len = params->cubCallback; + void *u_callback; + + if (!(u_callback = alloc_callback_wtou( params->iCallbackExpected, params->pCallback, &u_callback_len ))) + { + params->_ret = FALSE; + return; + } + + params->_ret = iface->GetAPICallResult( params->hSteamAPICall, u_callback, u_callback_len, + params->iCallbackExpected, params->pbFailed ); + if (params->_ret && u_callback != params->pCallback) + { + convert_callback_utow( params->iCallbackExpected, u_callback, u_callback_len, + params->pCallback, params->cubCallback ); + HeapFree( GetProcessHeap(), 0, u_callback ); + } +} + +/* ISteamUtils_SteamUtils004 */ + +void cppISteamUtils_SteamUtils004_GetAPICallResult( struct cppISteamUtils_SteamUtils004_GetAPICallResult_params *params ) +{ + struct u_ISteamUtils_SteamUtils004 *iface = (struct u_ISteamUtils_SteamUtils004 *)params->linux_side; + int u_callback_len = params->cubCallback; + void *u_callback; + + if (!(u_callback = alloc_callback_wtou( params->iCallbackExpected, params->pCallback, &u_callback_len ))) + { + params->_ret = FALSE; + return; + } + + params->_ret = iface->GetAPICallResult( params->hSteamAPICall, u_callback, u_callback_len, + params->iCallbackExpected, params->pbFailed ); + if (params->_ret && u_callback != params->pCallback) + { + convert_callback_utow( params->iCallbackExpected, u_callback, u_callback_len, + params->pCallback, params->cubCallback ); + HeapFree( GetProcessHeap(), 0, u_callback ); + } +} + +/* ISteamUtils_SteamUtils005 */ + +void cppISteamUtils_SteamUtils005_GetAPICallResult( struct cppISteamUtils_SteamUtils005_GetAPICallResult_params *params ) +{ + struct u_ISteamUtils_SteamUtils005 *iface = (struct u_ISteamUtils_SteamUtils005 *)params->linux_side; + int u_callback_len = params->cubCallback; + void *u_callback; + + if (!(u_callback = alloc_callback_wtou( params->iCallbackExpected, params->pCallback, &u_callback_len ))) + { + params->_ret = FALSE; + return; + } + + params->_ret = iface->GetAPICallResult( params->hSteamAPICall, u_callback, u_callback_len, + params->iCallbackExpected, params->pbFailed ); + if (params->_ret && u_callback != params->pCallback) + { + convert_callback_utow( params->iCallbackExpected, u_callback, u_callback_len, + params->pCallback, params->cubCallback ); + HeapFree( GetProcessHeap(), 0, u_callback ); + } +} + +/* ISteamUtils_SteamUtils006 */ + +void cppISteamUtils_SteamUtils006_GetAPICallResult( struct cppISteamUtils_SteamUtils006_GetAPICallResult_params *params ) +{ + struct u_ISteamUtils_SteamUtils006 *iface = (struct u_ISteamUtils_SteamUtils006 *)params->linux_side; + int u_callback_len = params->cubCallback; + void *u_callback; + + if (!(u_callback = alloc_callback_wtou( params->iCallbackExpected, params->pCallback, &u_callback_len ))) + { + params->_ret = FALSE; + return; + } + + params->_ret = iface->GetAPICallResult( params->hSteamAPICall, u_callback, u_callback_len, + params->iCallbackExpected, params->pbFailed ); + if (params->_ret && u_callback != params->pCallback) + { + convert_callback_utow( params->iCallbackExpected, u_callback, u_callback_len, + params->pCallback, params->cubCallback ); + HeapFree( GetProcessHeap(), 0, u_callback ); + } +} + +/* ISteamUtils_SteamUtils007 */ + +void cppISteamUtils_SteamUtils007_GetAPICallResult( struct cppISteamUtils_SteamUtils007_GetAPICallResult_params *params ) +{ + struct u_ISteamUtils_SteamUtils007 *iface = (struct u_ISteamUtils_SteamUtils007 *)params->linux_side; + int u_callback_len = params->cubCallback; + void *u_callback; + + if (!(u_callback = alloc_callback_wtou( params->iCallbackExpected, params->pCallback, &u_callback_len ))) + { + params->_ret = FALSE; + return; + } + + params->_ret = iface->GetAPICallResult( params->hSteamAPICall, u_callback, u_callback_len, + params->iCallbackExpected, params->pbFailed ); + if (params->_ret && u_callback != params->pCallback) + { + convert_callback_utow( params->iCallbackExpected, u_callback, u_callback_len, + params->pCallback, params->cubCallback ); + HeapFree( GetProcessHeap(), 0, u_callback ); + } +} + +/* ISteamUtils_SteamUtils008 */ + +void cppISteamUtils_SteamUtils008_GetAPICallResult( struct cppISteamUtils_SteamUtils008_GetAPICallResult_params *params ) +{ + struct u_ISteamUtils_SteamUtils008 *iface = (struct u_ISteamUtils_SteamUtils008 *)params->linux_side; + int u_callback_len = params->cubCallback; + void *u_callback; + + if (!(u_callback = alloc_callback_wtou( params->iCallbackExpected, params->pCallback, &u_callback_len ))) + { + params->_ret = FALSE; + return; + } + + params->_ret = iface->GetAPICallResult( params->hSteamAPICall, u_callback, u_callback_len, + params->iCallbackExpected, params->pbFailed ); + if (params->_ret && u_callback != params->pCallback) + { + convert_callback_utow( params->iCallbackExpected, u_callback, u_callback_len, + params->pCallback, params->cubCallback ); + HeapFree( GetProcessHeap(), 0, u_callback ); + } +} + +/* ISteamUtils_SteamUtils009 */ + +void cppISteamUtils_SteamUtils009_GetAPICallResult( struct cppISteamUtils_SteamUtils009_GetAPICallResult_params *params ) +{ + struct u_ISteamUtils_SteamUtils009 *iface = (struct u_ISteamUtils_SteamUtils009 *)params->linux_side; + int u_callback_len = params->cubCallback; + void *u_callback; + + if (!(u_callback = alloc_callback_wtou( params->iCallbackExpected, params->pCallback, &u_callback_len ))) + { + params->_ret = FALSE; + return; + } + + params->_ret = iface->GetAPICallResult( params->hSteamAPICall, u_callback, u_callback_len, + params->iCallbackExpected, params->pbFailed ); + if (params->_ret && u_callback != params->pCallback) + { + convert_callback_utow( params->iCallbackExpected, u_callback, u_callback_len, + params->pCallback, params->cubCallback ); + HeapFree( GetProcessHeap(), 0, u_callback ); + } +} + +/* ISteamUtils_SteamUtils010 */ + +void cppISteamUtils_SteamUtils010_GetAPICallResult( struct cppISteamUtils_SteamUtils010_GetAPICallResult_params *params ) +{ + struct u_ISteamUtils_SteamUtils010 *iface = (struct u_ISteamUtils_SteamUtils010 *)params->linux_side; + int u_callback_len = params->cubCallback; + void *u_callback; + + if (!(u_callback = alloc_callback_wtou( params->iCallbackExpected, params->pCallback, &u_callback_len ))) + { + params->_ret = FALSE; + return; + } + + params->_ret = iface->GetAPICallResult( params->hSteamAPICall, u_callback, u_callback_len, + params->iCallbackExpected, params->pbFailed ); + if (params->_ret && u_callback != params->pCallback) + { + convert_callback_utow( params->iCallbackExpected, u_callback, u_callback_len, + params->pCallback, params->cubCallback ); + HeapFree( GetProcessHeap(), 0, u_callback ); + } +} diff --git a/lsteamclient/winISteamUtils.c b/lsteamclient/winISteamUtils.c index 784f0063..ece281ab 100644 --- a/lsteamclient/winISteamUtils.c +++ b/lsteamclient/winISteamUtils.c @@ -185,17 +185,8 @@ bool __thiscall winISteamUtils_SteamUtils002_GetAPICallResult(struct w_steam_ifa .iCallbackExpected = iCallbackExpected, .pbFailed = pbFailed, }; - int w_callback_len = cubCallback; - void *w_callback = pCallback; TRACE("%p\n", _this); - if (!(params.pCallback = alloc_callback_wtou(iCallbackExpected, w_callback, ¶ms.cubCallback))) return FALSE; cppISteamUtils_SteamUtils002_GetAPICallResult( ¶ms ); - if (params._ret && params.pCallback != w_callback) - { - convert_callback_utow(iCallbackExpected, params.pCallback, params.cubCallback, w_callback, w_callback_len); - HeapFree(GetProcessHeap(), 0, params.pCallback); - } - return params._ret; } @@ -419,17 +410,8 @@ bool __thiscall winISteamUtils_SteamUtils004_GetAPICallResult(struct w_steam_ifa .iCallbackExpected = iCallbackExpected, .pbFailed = pbFailed, }; - int w_callback_len = cubCallback; - void *w_callback = pCallback; TRACE("%p\n", _this); - if (!(params.pCallback = alloc_callback_wtou(iCallbackExpected, w_callback, ¶ms.cubCallback))) return FALSE; cppISteamUtils_SteamUtils004_GetAPICallResult( ¶ms ); - if (params._ret && params.pCallback != w_callback) - { - convert_callback_utow(iCallbackExpected, params.pCallback, params.cubCallback, w_callback, w_callback_len); - HeapFree(GetProcessHeap(), 0, params.pCallback); - } - return params._ret; } @@ -705,17 +687,8 @@ bool __thiscall winISteamUtils_SteamUtils005_GetAPICallResult(struct w_steam_ifa .iCallbackExpected = iCallbackExpected, .pbFailed = pbFailed, }; - int w_callback_len = cubCallback; - void *w_callback = pCallback; TRACE("%p\n", _this); - if (!(params.pCallback = alloc_callback_wtou(iCallbackExpected, w_callback, ¶ms.cubCallback))) return FALSE; cppISteamUtils_SteamUtils005_GetAPICallResult( ¶ms ); - if (params._ret && params.pCallback != w_callback) - { - convert_callback_utow(iCallbackExpected, params.pCallback, params.cubCallback, w_callback, w_callback_len); - HeapFree(GetProcessHeap(), 0, params.pCallback); - } - return params._ret; } @@ -1062,17 +1035,8 @@ bool __thiscall winISteamUtils_SteamUtils006_GetAPICallResult(struct w_steam_ifa .iCallbackExpected = iCallbackExpected, .pbFailed = pbFailed, }; - int w_callback_len = cubCallback; - void *w_callback = pCallback; TRACE("%p\n", _this); - if (!(params.pCallback = alloc_callback_wtou(iCallbackExpected, w_callback, ¶ms.cubCallback))) return FALSE; cppISteamUtils_SteamUtils006_GetAPICallResult( ¶ms ); - if (params._ret && params.pCallback != w_callback) - { - convert_callback_utow(iCallbackExpected, params.pCallback, params.cubCallback, w_callback, w_callback_len); - HeapFree(GetProcessHeap(), 0, params.pCallback); - } - return params._ret; } @@ -1444,17 +1408,8 @@ bool __thiscall winISteamUtils_SteamUtils007_GetAPICallResult(struct w_steam_ifa .iCallbackExpected = iCallbackExpected, .pbFailed = pbFailed, }; - int w_callback_len = cubCallback; - void *w_callback = pCallback; TRACE("%p\n", _this); - if (!(params.pCallback = alloc_callback_wtou(iCallbackExpected, w_callback, ¶ms.cubCallback))) return FALSE; cppISteamUtils_SteamUtils007_GetAPICallResult( ¶ms ); - if (params._ret && params.pCallback != w_callback) - { - convert_callback_utow(iCallbackExpected, params.pCallback, params.cubCallback, w_callback, w_callback_len); - HeapFree(GetProcessHeap(), 0, params.pCallback); - } - return params._ret; } @@ -1842,17 +1797,8 @@ bool __thiscall winISteamUtils_SteamUtils008_GetAPICallResult(struct w_steam_ifa .iCallbackExpected = iCallbackExpected, .pbFailed = pbFailed, }; - int w_callback_len = cubCallback; - void *w_callback = pCallback; TRACE("%p\n", _this); - if (!(params.pCallback = alloc_callback_wtou(iCallbackExpected, w_callback, ¶ms.cubCallback))) return FALSE; cppISteamUtils_SteamUtils008_GetAPICallResult( ¶ms ); - if (params._ret && params.pCallback != w_callback) - { - convert_callback_utow(iCallbackExpected, params.pCallback, params.cubCallback, w_callback, w_callback_len); - HeapFree(GetProcessHeap(), 0, params.pCallback); - } - return params._ret; } @@ -2269,17 +2215,8 @@ bool __thiscall winISteamUtils_SteamUtils009_GetAPICallResult(struct w_steam_ifa .iCallbackExpected = iCallbackExpected, .pbFailed = pbFailed, }; - int w_callback_len = cubCallback; - void *w_callback = pCallback; TRACE("%p\n", _this); - if (!(params.pCallback = alloc_callback_wtou(iCallbackExpected, w_callback, ¶ms.cubCallback))) return FALSE; cppISteamUtils_SteamUtils009_GetAPICallResult( ¶ms ); - if (params._ret && params.pCallback != w_callback) - { - convert_callback_utow(iCallbackExpected, params.pCallback, params.cubCallback, w_callback, w_callback_len); - HeapFree(GetProcessHeap(), 0, params.pCallback); - } - return params._ret; } @@ -2777,17 +2714,8 @@ bool __thiscall winISteamUtils_SteamUtils010_GetAPICallResult(struct w_steam_ifa .iCallbackExpected = iCallbackExpected, .pbFailed = pbFailed, }; - int w_callback_len = cubCallback; - void *w_callback = pCallback; TRACE("%p\n", _this); - if (!(params.pCallback = alloc_callback_wtou(iCallbackExpected, w_callback, ¶ms.cubCallback))) return FALSE; cppISteamUtils_SteamUtils010_GetAPICallResult( ¶ms ); - if (params._ret && params.pCallback != w_callback) - { - convert_callback_utow(iCallbackExpected, params.pCallback, params.cubCallback, w_callback, w_callback_len); - HeapFree(GetProcessHeap(), 0, params.pCallback); - } - return params._ret; }