#include <windows.h>#include <dplay.h>#include "BaseType.h"Go to the source code of this file.
Compounds | |
| struct | SESSION_DESC |
| struct | SP_DESC |
Defines | |
| #define | NETPLAY_OPEN_CREATE 1 |
| #define | NETPLAY_OPEN_JOIN 2 |
Functions | |
| void | DoDPError (HRESULT Hr) |
| BOOL | InitNetPlay (LPGUID lpGuid) |
| BOOL | NetPlayEnumSession (LPSTR IPAdress, SESSION_DESC **SessionList, DWORD *SessionNum) |
| BOOL | NetPlayJoinSession (SESSION_DESC *SessionList) |
| BOOL | NetPlayCreateSession (LPSTR SessionName, DWORD MaxPlayers) |
| BOOL | NetPlayCreatePlayer (LPDPID lppidID, LPTSTR lptszPlayerName, HANDLE hEvent, LPVOID lpData, DWORD dwDataSize, geBoolean ServerPlayer) |
| BOOL | NetPlayDestroyPlayer (DPID pid) |
| HRESULT | NetPlaySend (DPID idFrom, DPID idTo, DWORD dwFlags, LPVOID lpData, DWORD dwDataSize) |
| HRESULT | NetPlayReceive (LPDPID lpidFrom, LPDPID lpidTo, DWORD dwFlags, LPVOID lpData, LPDWORD lpdwDataSize) |
| BOOL | DeInitNetPlay (void) |
| BOOL | AFX_CPrintfC (char *String) |
Variables | |
| SP_DESC | GlobalSP |
| SESSION_DESC * | GlobalSession |
| LPGUID | glpGuid |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 337 of file Netplay.c. References DoDPError(), DPlayRelease(), FALSE, FoundConnection, FoundSP, lpConnectionBuffer, NULL, and TRUE. Referenced by geCSNetMgr_StopSession().
00338 {
00339 HRESULT Hr;
00340
00341 if (lpConnectionBuffer)
00342 {
00343 free(lpConnectionBuffer);
00344 lpConnectionBuffer = NULL;
00345 }
00346
00347 FoundConnection = FALSE;
00348 FoundSP = FALSE;
00349
00350 Hr = DPlayRelease();
00351
00352 if (Hr != DP_OK)
00353 {
00354 DoDPError(Hr);
00355 return FALSE;
00356 }
00357
00358 return TRUE;
00359 }
|
|
|
|
Definition at line 90 of file Netplay.c. References DoDPError(), DPEnumConnectionsCallback(), DPlayCreate(), FALSE, FoundConnection, FoundSP, g_lpDP, geErrorLog_AddString, glpGuid, NULL, and TRUE. Referenced by geCSNetMgr_FindSession(), and geCSNetMgr_StartSession().
00091 {
00092 HRESULT Hr;
00093
00094 glpGuid = lpGuid;
00095
00096 FoundSP = FALSE;
00097
00098 Hr = DPlayCreate();
00099
00100 if (Hr != DP_OK)
00101 {
00102 DoDPError(Hr);
00103 return FALSE;
00104 }
00105
00106 IDirectPlayX_EnumConnections( g_lpDP, glpGuid, DPEnumConnectionsCallback, NULL, 0);
00107
00108 if (!FoundConnection)
00109 {
00110 geErrorLog_AddString(-1, "InitNetPlay: No connections available.\n", NULL);
00111 return FALSE;
00112 }
00113
00114 return TRUE;
00115 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 239 of file Netplay.c. References DoDPError(), DWORD, FALSE, g_lpDP, and TRUE. Referenced by geCSNetMgr_JoinSession(), and geCSNetMgr_StartSession().
00240 {
00241 HRESULT hr = DPERR_GENERIC;
00242 DPNAME name;
00243 DWORD Flags;
00244
00245 assert(g_lpDP);
00246
00247 ZeroMemory(&name,sizeof(name));
00248 name.dwSize = sizeof(DPNAME);
00249
00250 #ifdef UNICODE
00251 name.lpszShortName = lptszPlayerName;
00252 #else
00253 name.lpszShortNameA = lptszPlayerName;
00254 #endif
00255
00256 Flags = 0;
00257
00258 //if (ServerPlayer)
00259 // Flags |= DPPLAYER_SERVERPLAYER;
00260
00261 hr = IDirectPlayX_CreatePlayer(g_lpDP, lppidID, &name, hEvent, lpData, dwDataSize, Flags);
00262
00263 if (hr != DP_OK)
00264 {
00265 DoDPError(hr);
00266 return FALSE;
00267 }
00268
00269 return TRUE;
00270 }
|
|
||||||||||||
|
Definition at line 191 of file Netplay.c. References DoDPError(), DPlayCreateSession(), FALSE, g_lpDP, lpConnectionBuffer, and TRUE. Referenced by geCSNetMgr_StartSession().
00192 {
00193 HRESULT Hr;
00194
00195 assert(g_lpDP);
00196 assert(lpConnectionBuffer);
00197
00198 Hr = IDirectPlayX_InitializeConnection(g_lpDP, lpConnectionBuffer, 0);
00199
00200 if (Hr != DP_OK)
00201 {
00202 DoDPError(Hr);
00203 return FALSE;
00204 }
00205
00206 Hr = DPlayCreateSession(SessionName, MaxPlayers);
00207
00208 if (Hr != DP_OK)
00209 {
00210 DoDPError(Hr);
00211 return FALSE;
00212 }
00213
00214 return TRUE;
00215 }
|
|
|
Definition at line 275 of file Netplay.c. References DoDPError(), DPlayDestroyPlayer(), FALSE, and TRUE. Referenced by geCSNetMgr_StopSession().
00276 {
00277 HRESULT Hr = DPlayDestroyPlayer(pid);
00278
00279 if (Hr != DP_OK)
00280 {
00281 DoDPError(Hr);
00282 return FALSE;
00283 }
00284
00285 return TRUE;
00286 }
|
|
||||||||||||||||
|
Definition at line 120 of file Netplay.c. References DoDPError(), DPlayEnumSessions(), DWORD, EnumSession(), FALSE, g_lpDP, GlobalSession, gSessionCnt, lpConnectionBuffer, NULL, and TRUE. Referenced by geCSNetMgr_FindSession().
00121 {
00122 HRESULT hr;
00123
00124 #if 1
00125 char tempBuf[1024];
00126 DWORD tempLng = 1024;
00127 LPDIRECTPLAYLOBBY2A lpDPL = NULL;
00128
00129 // Free the old connection buffer
00130 if(lpConnectionBuffer )
00131 {
00132 free( lpConnectionBuffer );
00133 lpConnectionBuffer = NULL;
00134 }
00135
00136 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_INPROC_SERVER,
00137 &IID_IDirectPlayLobby3A, (LPVOID *) &lpDPL );
00138
00139 if (hr != DP_OK)
00140 {
00141 DoDPError(hr);
00142 return( FALSE );
00143 }
00144
00145 hr = IDirectPlayLobby_CreateAddress(lpDPL, &DPSPGUID_TCPIP, &DPAID_INet, (LPVOID)IPAdress, strlen(IPAdress), tempBuf, &tempLng);
00146
00147 if (hr != DP_OK)
00148 {
00149 DoDPError(hr);
00150 return( FALSE );
00151 }
00152
00153 if (lpDPL)
00154 {
00155 hr = IDirectPlayLobby_Release(lpDPL);
00156
00157 if (hr != DP_OK)
00158 {
00159 DoDPError(hr);
00160 return( FALSE );
00161 }
00162 lpDPL = NULL;
00163 }
00164
00165 hr = IDirectPlayX_InitializeConnection( g_lpDP, tempBuf, 0);
00166 #else
00167 hr = IDirectPlayX_InitializeConnection( g_lpDP, lpConnectionBuffer, 0);
00168 #endif
00169
00170 if (hr != DP_OK)
00171 {
00172 DoDPError(hr);
00173 return( FALSE );
00174 }
00175
00176 GlobalSession = NULL;
00177 gSessionCnt = 0;
00178
00179 hr = DPlayEnumSessions(0, EnumSession, NULL, 0);
00180
00181 *SessionList = GlobalSession;
00182 *SessionNum = gSessionCnt;
00183
00184 return( TRUE );
00185
00186 }
|
|
|
Definition at line 220 of file Netplay.c. References DoDPError(), DPlayOpenSession(), FALSE, SESSION_DESC::Guid, and TRUE. Referenced by geCSNetMgr_JoinSession().
00221 {
00222 HRESULT Hr;
00223
00224 Hr = DPlayOpenSession(&Session->Guid);
00225
00226 if (Hr != DP_OK)
00227 {
00228 DoDPError(Hr);
00229 return FALSE;
00230 }
00231
00232 return TRUE;
00233 }
|
|
||||||||||||||||||||||||
|
Definition at line 291 of file Netplay.c. References DoDPError(), and g_lpDP. Referenced by geCSNetMgr_JoinSession(), geCSNetMgr_ReceiveAllMessages(), geCSNetMgr_ReceiveFromClient(), geCSNetMgr_ReceiveFromServer(), and geCSNetMgr_ReceiveSystemMessage().
00292 {
00293 HRESULT Hr;
00294 assert(g_lpDP);
00295
00296 Hr = IDirectPlayX_Receive(g_lpDP, lpidFrom, lpidTo, dwFlags, lpData, lpdwDataSize);
00297
00298 if (Hr != DP_OK)
00299 {
00300 if (Hr != DPERR_NOMESSAGES)
00301 DoDPError(Hr);
00302 }
00303
00304 return Hr;
00305 }
|
|
||||||||||||||||||||||||
|
Definition at line 310 of file Netplay.c. References DoDPError(), g_lpDP, and NULL. Referenced by geCSNetMgr_ProcessSystemMessage(), geCSNetMgr_SendToClient(), and geCSNetMgr_SendToServer().
00311 {
00312 HRESULT Hr;
00313
00314 assert(g_lpDP);
00315
00316 #if 0
00317 dwFlags |= DPSEND_ASYNC;
00318 Hr = IDirectPlayX_SendEx(g_lpDP, idFrom, idTo, dwFlags, lpData, dwDataSize, 0, 0, NULL, NULL);
00319 #else
00320 Hr = IDirectPlayX_Send(g_lpDP, idFrom, idTo, dwFlags, lpData, dwDataSize);
00321 #endif
00322
00323 if (Hr != DP_OK)
00324 {
00325 if (Hr == DPERR_PENDING)
00326 return DP_OK;
00327
00328 DoDPError(Hr);
00329 }
00330
00331 return Hr;
00332 }
|
|
|
Definition at line 55 of file Netplay.h. Referenced by EnumSession(), and NetPlayEnumSession(). |
|
|
|
|
|
Definition at line 56 of file Netplay.h. Referenced by DPlayCreateSession(), DPlayEnumSessions(), DPlayOpenSession(), and InitNetPlay(). |
1.3.2