dplayx: Add groups from SUPERENUMPLAYERSREPLY to the session.

This commit is contained in:
Anton Baskanov 2024-11-17 17:52:53 +07:00 committed by Alexandre Julliard
parent 0eb2f18166
commit 3f7c85f7a3
Notes: Alexandre Julliard 2024-11-18 23:18:20 +01:00
Approved-by: Alistair Leslie-Hughes (@alesliehughes)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6829
4 changed files with 36 additions and 7 deletions

View file

@ -1281,7 +1281,7 @@ static HRESULT WINAPI IDirectPlay4Impl_Close( IDirectPlay4 *iface )
return hr;
}
static HRESULT DP_CreateGroup( IDirectPlayImpl *This, void *msgHeader, const DPID *lpid,
HRESULT DP_CreateGroup( IDirectPlayImpl *This, void *msgHeader, const DPID *lpid,
const DPNAME *lpName, void *data, DWORD dataSize, DWORD dwFlags, DPID idParent,
BOOL bAnsi )
{

View file

@ -218,6 +218,9 @@ HRESULT DP_HandleGameMessage( IDirectPlayImpl *This, void *messageBody, DWORD me
HRESULT DP_CreatePlayer( IDirectPlayImpl *This, void *msgHeader, DPID *lpid, DPNAME *lpName,
void *data, DWORD dataSize, void *spData, DWORD spDataSize, DWORD dwFlags,
HANDLE hEvent, struct PlayerData **playerData, BOOL bAnsi );
HRESULT DP_CreateGroup( IDirectPlayImpl *This, void *msgHeader, const DPID *lpid,
const DPNAME *lpName, void *data, DWORD dataSize, DWORD dwFlags,
DPID idParent, BOOL bAnsi );
/* DP SP external interfaces into DirectPlay */
extern HRESULT DP_GetSPPlayerData( IDirectPlayImpl *lpDP, DPID idPlayer, void **lplpData );

View file

@ -676,6 +676,30 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlayImpl *This, DPID dpidServer, WC
return hr;
}
}
for( i = 0; i < enumPlayersReply->groupCount; ++i )
{
DPPLAYERINFO playerInfo;
hr = DP_MSG_ReadSuperPackedPlayer( (char *) enumPlayersReply, &offset, dwMsgSize,
&playerInfo );
if( FAILED( hr ) )
{
free( msgHeader );
free( lpMsg );
return hr;
}
hr = DP_CreateGroup( This, msgHeader, &playerInfo.id, &playerInfo.name,
playerInfo.playerData, playerInfo.playerDataLength,
playerInfo.flags & ~DPLAYI_PLAYER_PLAYERLOCAL, playerInfo.parentId,
FALSE );
if( FAILED( hr ) )
{
free( msgHeader );
free( lpMsg );
return hr;
}
}
}
else if( envelope->wCommandId == DPMSGCMD_GETNAMETABLEREPLY )
{

View file

@ -2830,7 +2830,7 @@ static BOOL CALLBACK checkPlayerListCallback( DPID dpid, DWORD playerType, const
HRESULT hr;
if ( player->actualCount )
ok_( __FILE__, data->line )( 0, "duplicate player dpid %#lx.\n", dpid );
todo_wine ok_( __FILE__, data->line )( 0, "duplicate player dpid %#lx.\n", dpid );
ok_( __FILE__, data->line )( playerType == player->expectedPlayerType, "got player type %lu.\n",
playerType );
if ( player->expectedShortName )
@ -2853,7 +2853,8 @@ static BOOL CALLBACK checkPlayerListCallback( DPID dpid, DWORD playerType, const
ok_( __FILE__, data->line )( !name->lpszLongNameA, "got long name %s.\n",
wine_dbgstr_a( name->lpszLongNameA ) );
}
ok_( __FILE__, data->line )( flags == player->expectedFlags, "got flags %#lx.\n", flags );
todo_wine_if( playerType == DPPLAYERTYPE_GROUP && flags == DPENUMPLAYERS_LOCAL )
ok_( __FILE__, data->line )( flags == player->expectedFlags, "got flags %#lx.\n", flags );
memset( &playerData, 0xcc, sizeof( playerData ) );
playerDataSize = sizeof( playerData );
@ -2862,8 +2863,9 @@ static BOOL CALLBACK checkPlayerListCallback( DPID dpid, DWORD playerType, const
else
hr = IDirectPlayX_GetGroupData( data->dp, dpid, playerData, &playerDataSize, DPGET_REMOTE );
ok_( __FILE__, data->line )( hr == DP_OK, "GetPlayerData() returned %#lx.\n", hr );
ok_( __FILE__, data->line )( playerDataSize == player->expectedPlayerDataSize,
"got player data size %lu.\n", playerDataSize );
todo_wine_if( playerType == DPPLAYERTYPE_GROUP )
ok_( __FILE__, data->line )( playerDataSize == player->expectedPlayerDataSize,
"got player data size %lu.\n", playerDataSize );
ok_( __FILE__, data->line )( !memcmp( playerData, player->expectedPlayerData, player->expectedPlayerDataSize ),
"player data doesn't match.\n" );
@ -2964,10 +2966,10 @@ static void checkGroupPlayerList_( int line, DPID group, IDirectPlay4 *dp, Expec
HRESULT hr;
hr = IDirectPlayX_EnumGroupPlayers( dp, group, NULL, checkPlayerListCallback, &data, DPENUMPLAYERS_LOCAL );
todo_wine ok_( __FILE__, line )( hr == DP_OK, "EnumGroupPlayers() returned %#lx.\n", hr );
ok_( __FILE__, line )( hr == DP_OK, "EnumGroupPlayers() returned %#lx.\n", hr );
hr = IDirectPlayX_EnumGroupPlayers( dp, group, NULL, checkPlayerListCallback, &data, DPENUMPLAYERS_REMOTE );
todo_wine ok_( __FILE__, line )( hr == DP_OK, "EnumGroupPlayers() returned %#lx.\n", hr );
ok_( __FILE__, line )( hr == DP_OK, "EnumGroupPlayers() returned %#lx.\n", hr );
todo_wine ok_( __FILE__, line )( data.actualPlayerCount == data.expectedPlayerCount, "got player count %d.\n",
data.actualPlayerCount );