lsteamclient: Move ISteamNetworkingFakeUDPPort creation / destroy to the PE side.

CW-Bug-Id: #22729
This commit is contained in:
Rémi Bernon 2023-09-29 11:35:29 +02:00
parent 1cf15635ac
commit d12d18e87c
9 changed files with 37 additions and 40 deletions

View File

@ -6,6 +6,7 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES -DSTEAM_API_EXPORTS -Dprivate=public -Dprotecte
SOURCES = \
steam_client_manual.c \
steam_networking_manual.c \
steamclient_main.c \
steamclient_wrappers.c \
winISteamAppList.c \

View File

@ -12,6 +12,12 @@ struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001
#endif /* __cplusplus */
};
void cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort( struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort_params *params )
{
struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *iface = (struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *)params->linux_side;
iface->DestroyFakeUDPPort( );
}
void cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_SendMessageToFakeIP( struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_SendMessageToFakeIP_params *params )
{
struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *iface = (struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *)params->linux_side;

View File

@ -314,3 +314,9 @@ void cppISteamNetworkingSockets_SteamNetworkingSockets012_GetRemoteFakeIPForConn
params->_ret = iface->GetRemoteFakeIPForConnection( params->hConn, params->pOutAddr );
}
void cppISteamNetworkingSockets_SteamNetworkingSockets012_CreateFakeUDPPort( struct cppISteamNetworkingSockets_SteamNetworkingSockets012_CreateFakeUDPPort_params *params )
{
struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *)params->linux_side;
params->_ret = iface->CreateFakeUDPPort( params->idxFakeServerPort );
}

View File

@ -208,7 +208,6 @@ MANUAL_METHODS = {
"ISteamNetworkingSockets_ReceiveMessagesOnListenSocket": lambda ver, abi: abi == 'u',
"ISteamNetworkingSockets_ReceiveMessagesOnPollGroup": lambda ver, abi: abi == 'u',
"ISteamNetworkingSockets_SendMessages": lambda ver, abi: abi == 'u',
"ISteamNetworkingSockets_CreateFakeUDPPort": lambda ver, abi: abi == 'u',
"ISteamNetworkingUtils_AllocateMessage": lambda ver, abi: abi == 'u',
"ISteamNetworkingUtils_SetConfigValue": lambda ver, abi: abi == 'u' and ver >= 3,
@ -225,7 +224,7 @@ MANUAL_METHODS = {
"ISteamController_GetGlyphForActionOrigin": lambda ver, abi: abi == 'u',
"ISteamController_GetGlyphForXboxOrigin": lambda ver, abi: abi == 'u',
"ISteamNetworkingFakeUDPPort_DestroyFakeUDPPort": lambda ver, abi: abi == 'u',
"ISteamNetworkingFakeUDPPort_DestroyFakeUDPPort": lambda ver, abi: abi == 'w',
"ISteamNetworkingFakeUDPPort_ReceiveMessages": lambda ver, abi: abi == 'u',
"ISteamClient_BShutdownIfAllPipesClosed": lambda ver, abi: abi == 'w',
@ -1010,10 +1009,11 @@ def handle_method_c(klass, method, winclassname, cppname, out):
out(f' {cppname}_{method.name}( &params );\n')
should_gen_wrapper = not is_manual_method(klass, method, "u") and \
(method.result_type.spelling.startswith("ISteam") or \
method.name.startswith("GetISteamGenericInterface"))
if should_gen_wrapper:
if method.name.startswith('CreateFakeUDPPort'):
out(u' params._ret = create_winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001( params._ret );\n')
elif method.name.startswith("GetISteamGenericInterface"):
out(u' params._ret = create_win_interface( pchVersion, params._ret );\n')
elif method.result_type.spelling.startswith("ISteam"):
out(u' params._ret = create_win_interface( pchVersion, params._ret );\n')
for name, conv in filter(lambda x: x[0] in names, path_conv_utow.items()):

View File

@ -0,0 +1,15 @@
#include "steamclient_private.h"
#include "cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001.h"
WINE_DEFAULT_DEBUG_CHANNEL(steamclient);
/* ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 */
void __thiscall winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort( struct w_steam_iface *_this )
{
struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort_params params = {.linux_side = _this->u_iface};
TRACE( "%p\n", _this );
cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort( &params );
HeapFree( GetProcessHeap(), 0, _this );
}

View File

@ -73,20 +73,6 @@ void cppISteamNetworkingSockets_SteamNetworkingSockets012_SendMessages( struct c
}
}
/* from winISteamNetworkingFakeUDPPort.c */
typedef struct __winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 {
void *vtable;
void *linux_side;
} winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001;
void cppISteamNetworkingSockets_SteamNetworkingSockets012_CreateFakeUDPPort( struct cppISteamNetworkingSockets_SteamNetworkingSockets012_CreateFakeUDPPort_params *params )
{
struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *iface = (struct u_ISteamNetworkingSockets_SteamNetworkingSockets012 *)params->linux_side;
void *lin_iface = iface->CreateFakeUDPPort( params->idxFakeServerPort );
if (!lin_iface) params->_ret = NULL;
else params->_ret = create_winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001( lin_iface );
}
void cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages( struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages_params *params )
{
struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *iface = (struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *)params->linux_side;
@ -96,16 +82,6 @@ void cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessage
params->ppOutMessages, params->nMaxMessages );
}
void cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort( struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort_params *params )
{
struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *iface = (struct u_ISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *)params->linux_side;
winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001
*win_side = (winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001 *)( char *)params->linux_side -
offsetof( winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001, linux_side );
iface->DestroyFakeUDPPort();
HeapFree(GetProcessHeap(), 0, win_side);
}
typedef void (*CDECL win_FnSteamNetConnectionStatusChanged)( w_SteamNetConnectionStatusChangedCallback_t_153a * );
static win_FnSteamNetConnectionStatusChanged win_SteamNetConnectionStatusChanged;
static void lin_SteamNetConnectionStatusChanged( u_SteamNetConnectionStatusChangedCallback_t_153a *u_dat )

View File

@ -37,6 +37,8 @@ struct w_steam_iface
void *u_iface;
};
#include "win_constructors.h"
struct SteamInputActionEvent_t;
typedef void (*CDECL win_SteamInputActionEventCallbackPointer)( struct SteamInputActionEvent_t * );
void lin_SteamInputActionEventCallbackPointer( struct SteamInputActionEvent_t *dat );

View File

@ -10,16 +10,6 @@ DEFINE_THISCALL_WRAPPER(winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPor
DEFINE_THISCALL_WRAPPER(winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ReceiveMessages, 12)
DEFINE_THISCALL_WRAPPER(winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_ScheduleCleanup, 8)
void __thiscall winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort(struct w_steam_iface *_this)
{
struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort_params params =
{
.linux_side = _this->u_iface,
};
TRACE("%p\n", _this);
cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_DestroyFakeUDPPort( &params );
}
uint32_t __thiscall winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_SendMessageToFakeIP(struct w_steam_iface *_this, const SteamNetworkingIPAddr *remoteAddress, const void *pData, uint32_t cbData, int32_t nSendFlags)
{
struct cppISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001_SendMessageToFakeIP_params params =

View File

@ -3417,6 +3417,7 @@ void /*ISteamNetworkingFakeUDPPort*/ * __thiscall winISteamNetworkingSockets_Ste
};
TRACE("%p\n", _this);
cppISteamNetworkingSockets_SteamNetworkingSockets012_CreateFakeUDPPort( &params );
params._ret = create_winISteamNetworkingFakeUDPPort_SteamNetworkingFakeUDPPort001( params._ret );
return params._ret;
}