#include <Windows.H>#include <Assert.h>#include <dplay.h>#include <dplobby.h>#include <Stdio.h>#include "netplay.h"#include "ErrorLog.h"Go to the source code of this file.
Defines | |
| #define | IDIRECTPLAY2_OR_GREATER |
Functions | |
| HRESULT | DPlayCreateSession (LPTSTR lptszSessionName, DWORD MaxPlayers) |
| HRESULT | DPlayOpenSession (LPGUID lpSessionGuid) |
| BOOL WINAPI | EnumSession (LPCDPSESSIONDESC2 lpDPSessionDesc, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext) |
| HRESULT | DPlayEnumSessions (DWORD dwTimeout, LPDPENUMSESSIONSCALLBACK2 lpEnumCallback, LPVOID lpContext, DWORD dwFlags) |
| HRESULT | DPlayCreatePlayer (LPDPID lppidID, LPTSTR lptszPlayerName, HANDLE hEvent, LPVOID lpData, DWORD dwDataSize) |
| HRESULT | DPlayDestroyPlayer (DPID pid) |
| HRESULT | DPlayRelease (void) |
| HRESULT | DPlayCreate (void) |
| BOOL FAR PASCAL | DPEnumConnectionsCallback (LPCGUID lpguidSP, LPVOID lpConnection, DWORD dwSize, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext) |
| void | DoDPError (HRESULT Hr) |
| BOOL | InitNetPlay (LPGUID lpGuid) |
| BOOL | NetPlayEnumSession (LPSTR IPAdress, SESSION_DESC **SessionList, DWORD *SessionNum) |
| BOOL | NetPlayCreateSession (LPSTR SessionName, DWORD MaxPlayers) |
| BOOL | NetPlayJoinSession (SESSION_DESC *Session) |
| BOOL | NetPlayCreatePlayer (LPDPID lppidID, LPTSTR lptszPlayerName, HANDLE hEvent, LPVOID lpData, DWORD dwDataSize, geBoolean ServerPlayer) |
| BOOL | NetPlayDestroyPlayer (DPID pid) |
| HRESULT | NetPlayReceive (LPDPID lpidFrom, LPDPID lpidTo, DWORD dwFlags, LPVOID lpData, LPDWORD lpdwDataSize) |
| HRESULT | NetPlaySend (DPID idFrom, DPID idTo, DWORD dwFlags, LPVOID lpData, DWORD dwDataSize) |
| BOOL | DeInitNetPlay (void) |
| geBoolean | NetPlayGetNumMessages (int32 *NumMsgSend, int32 *NumBytesSend, int32 *NumMsgRec, int32 *NumBytesRec) |
Variables | |
| LPGUID | glpGuid |
| SP_DESC | GlobalSP |
| SESSION_DESC * | GlobalSession |
| DWORD | gSessionCnt |
| BOOL | FoundSP = FALSE |
| BOOL | FoundSession = FALSE |
| LPDIRECTPLAY4A | g_lpDP = NULL |
| BOOL | FoundConnection = FALSE |
| LPVOID | lpConnectionBuffer = NULL |
| FILE * | DebugF |
|
|
|
|
|
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 647 of file Netplay.c. References geErrorLog_AddString, and NULL.
00648 {
00649 switch (Hr)
00650 {
00651 case CLASS_E_NOAGGREGATION:
00652 geErrorLog_AddString(-1, "A non-NULL value was passed for the pUnkOuter parameter in DirectPlayCreate, DirectPlayLobbyCreate, or IDirectPlayLobby2::Connect.\n", NULL);
00653 break;
00654
00655 case DP_OK:
00656 geErrorLog_AddString(-1, "The request completed successfully.\n", NULL);
00657 break;
00658
00659 case DPERR_ACCESSDENIED:
00660 geErrorLog_AddString(-1, "The session is full or an incorrect password was supplied.\n", NULL);
00661 break;
00662
00663 case DPERR_ACTIVEPLAYERS:
00664 geErrorLog_AddString(-1, "The requested operation cannot be performed because there are existing active players.\n", NULL);
00665 break;
00666
00667 case DPERR_ALREADYINITIALIZED:
00668 geErrorLog_AddString(-1, "This object is already initialized. \n", NULL);
00669 break;
00670
00671 case DPERR_APPNOTSTARTED:
00672 geErrorLog_AddString(-1, "The application has not been started yet.\n", NULL);
00673 break;
00674
00675 case DPERR_AUTHENTICATIONFAILED:
00676 geErrorLog_AddString(-1, "The password or credentials supplied could not be authenticated. \n", NULL);
00677 break;
00678
00679 case DPERR_BUFFERTOOLARGE:
00680 geErrorLog_AddString(-1, "The data buffer is too large to store. \n", NULL);
00681 break;
00682
00683 case DPERR_BUSY:
00684 geErrorLog_AddString(-1, "A message cannot be sent because the transmission medium is busy. \n", NULL);
00685 break;
00686
00687 case DPERR_BUFFERTOOSMALL:
00688 geErrorLog_AddString(-1, "The supplied buffer is not large enough to contain the requested data. \n", NULL);
00689 break;
00690
00691 case DPERR_CANTADDPLAYER:
00692 geErrorLog_AddString(-1, "The player cannot be added to the session. \n", NULL);
00693 break;
00694
00695 case DPERR_CANTCREATEGROUP:
00696 geErrorLog_AddString(-1, "A new group cannot be created. \n", NULL);
00697 break;
00698
00699 case DPERR_CANTCREATEPLAYER:
00700 geErrorLog_AddString(-1, "A new player cannot be created. \n", NULL);
00701 break;
00702
00703 case DPERR_CANTCREATEPROCESS:
00704 geErrorLog_AddString(-1, "Cannot start the application. \n", NULL);
00705 break;
00706
00707 case DPERR_CANTCREATESESSION:
00708 geErrorLog_AddString(-1, "A new session cannot be created. \n", NULL);
00709 break;
00710
00711 case DPERR_CANTLOADCAPI:
00712 geErrorLog_AddString(-1, "No credentials were supplied and the CryptoAPI package (CAPI) to use for cryptography services cannot be loaded. \n", NULL);
00713 break;
00714
00715 case DPERR_CANTLOADSECURITYPACKAGE:
00716 geErrorLog_AddString(-1, "The software security package cannot be loaded. \n", NULL);
00717 break;
00718
00719 case DPERR_CANTLOADSSPI:
00720 geErrorLog_AddString(-1, "No credentials were supplied and the software security package (SSPI) that will prompt for credentials cannot be loaded. \n", NULL);
00721 break;
00722
00723 case DPERR_CAPSNOTAVAILABLEYET:
00724 geErrorLog_AddString(-1, "The capabilities of the DirectPlay object have not been determined yet. This error will occur if the DirectPlay object is implemented on a connectivity solution that requires polling to determine available bandwidth and latency. \n", NULL);
00725 break;
00726
00727 case DPERR_CONNECTING:
00728 geErrorLog_AddString(-1, "The method is in the process of connecting to the network. The application should keep calling the method until it returns DP_OK, indicating successful completion, or it returns a different error. \n", NULL);
00729 break;
00730
00731 case DPERR_ENCRYPTIONFAILED:
00732 geErrorLog_AddString(-1, "The requested information could not be digitally encrypted. Encryption is used for message privacy. This error is only relevant in a secure session. \n", NULL);
00733 break;
00734
00735 case DPERR_EXCEPTION:
00736 geErrorLog_AddString(-1, "An exception occurred when processing the request. \n", NULL);
00737 break;
00738
00739 case DPERR_GENERIC:
00740 geErrorLog_AddString(-1, "An undefined error condition occurred. \n", NULL);
00741 break;
00742
00743 case DPERR_INVALIDFLAGS:
00744 geErrorLog_AddString(-1, "The flags passed to this method are invalid. \n", NULL);
00745 break;
00746
00747 case DPERR_INVALIDGROUP:
00748 geErrorLog_AddString(-1, "The group ID is not recognized as a valid group ID for this game session. \n", NULL);
00749 break;
00750
00751 case DPERR_INVALIDINTERFACE:
00752 geErrorLog_AddString(-1, "The interface parameter is invalid. \n", NULL);
00753 break;
00754
00755 case DPERR_INVALIDOBJECT:
00756 geErrorLog_AddString(-1, "The DirectPlay object pointer is invalid. \n", NULL);
00757 break;
00758
00759 case DPERR_INVALIDPARAMS:
00760 geErrorLog_AddString(-1, "One or more of the parameters passed to the method are invalid. \n", NULL);
00761 break;
00762
00763 case DPERR_INVALIDPASSWORD:
00764 geErrorLog_AddString(-1, "An invalid password was supplied when attempting to join a session that requires a password. \n", NULL);
00765 break;
00766
00767 case DPERR_INVALIDPLAYER:
00768 geErrorLog_AddString(-1, "The player ID is not recognized as a valid player ID for this game session. \n", NULL);
00769 break;
00770
00771 case DPERR_LOGONDENIED:
00772 geErrorLog_AddString(-1, "The session could not be opened because credentials are required and either no credentials were supplied or the credentials were invalid. \n", NULL);
00773 break;
00774
00775 case DPERR_NOCAPS:
00776 geErrorLog_AddString(-1, "The communication link that DirectPlay is attempting to use is not capable of this function. \n", NULL);
00777 break;
00778
00779 case DPERR_NOCONNECTION:
00780 geErrorLog_AddString(-1, "No communication link was established. \n", NULL);
00781 break;
00782
00783 case DPERR_NOINTERFACE:
00784 geErrorLog_AddString(-1, "The interface is not supported. \n", NULL);
00785 break;
00786
00787 case DPERR_NOMESSAGES:
00788 geErrorLog_AddString(-1, "There are no messages in the receive queue. \n", NULL);
00789 break;
00790
00791 case DPERR_NONAMESERVERFOUND:
00792 geErrorLog_AddString(-1, "No name server (host) could be found or created. A host must exist to create a player. \n", NULL);
00793 break;
00794
00795 case DPERR_NONEWPLAYERS:
00796 geErrorLog_AddString(-1, "The session is not accepting any new players. \n", NULL);
00797 break;
00798
00799 case DPERR_NOPLAYERS:
00800 geErrorLog_AddString(-1, "There are no active players in the session. \n", NULL);
00801 break;
00802
00803 case DPERR_NOSESSIONS:
00804 geErrorLog_AddString(-1, "There are no existing sessions for this game. \n", NULL);
00805 break;
00806
00807 case DPERR_NOTLOBBIED:
00808 geErrorLog_AddString(-1, "Returned by the IDirectPlayLobby2::Connect method if the application was not started by using the IDirectPlayLobby2::RunApplication method or if there is no DPLCONNECTION structure currently initialized for this DirectPlayLobby object. \n", NULL);
00809 break;
00810
00811 case DPERR_NOTLOGGEDIN:
00812 geErrorLog_AddString(-1, "An action cannot be performed because a player or client application is not logged in. Returned by the IDirectPlay3::Send method when the client application tries to send a secure message without being logged in. \n", NULL);
00813 break;
00814
00815 case DPERR_OUTOFMEMORY:
00816 geErrorLog_AddString(-1, "There is insufficient memory to perform the requested operation. \n", NULL);
00817 break;
00818
00819 case DPERR_PLAYERLOST:
00820 geErrorLog_AddString(-1, "A player has lost the connection to the session. \n", NULL);
00821 break;
00822
00823 case DPERR_SENDTOOBIG:
00824 geErrorLog_AddString(-1, "The message being sent by the IDirectPlay3::Send method is too large. \n", NULL);
00825 break;
00826
00827 case DPERR_SESSIONLOST:
00828 geErrorLog_AddString(-1, "The connection to the session has been lost. \n", NULL);
00829 break;
00830
00831 case DPERR_SIGNFAILED:
00832 geErrorLog_AddString(-1, "The requested information could not be digitally signed. Digital signatures are used to establish the authenticity of messages. \n", NULL);
00833 break;
00834
00835 case DPERR_TIMEOUT:
00836 geErrorLog_AddString(-1, "The operation could not be completed in the specified time. \n", NULL);
00837 break;
00838
00839 case DPERR_UNAVAILABLE:
00840 geErrorLog_AddString(-1, "The requested function is not available at this time. \n", NULL);
00841 break;
00842
00843 case DPERR_UNINITIALIZED:
00844 geErrorLog_AddString(-1, "The requested object has not been initialized. \n", NULL);
00845 break;
00846
00847 case DPERR_UNKNOWNAPPLICATION:
00848 geErrorLog_AddString(-1, "An unknown application was specified. \n", NULL);
00849 break;
00850
00851 case DPERR_UNSUPPORTED:
00852 geErrorLog_AddString(-1, "The function is not available in this implementation. Returned from IDirectPlay3::GetGroupConnectionSettings and IDirectPlay3::SetGroupConnectionSettings if they are called from a session that is not a lobby session. \n", NULL);
00853 break;
00854
00855 case DPERR_USERCANCEL:
00856 geErrorLog_AddString(-1, "Can be returned in two ways. 1) The user canceled the connection process during a call to the IDirectPlay3::Open method. 2) The user clicked Cancel in one of the DirectPlay service provider dialog boxes during a call to IDirectPlay3::EnumSessions. \n", NULL);
00857 break;
00858
00859 default:
00860 geErrorLog_AddString(-1, "NetPlayError: Don't know this one...\n", NULL);
00861 break;
00862 }
00863 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 599 of file Netplay.c. References FoundConnection, lpConnectionBuffer, NULL, and TRUE. Referenced by InitNetPlay().
00606 {
00607 LPSTR Str;
00608
00609 if (FoundConnection)
00610 return TRUE;
00611
00612 Str = lpName->lpszShortNameA;
00613
00614 // Loop through and try to see if this is the service provider we want (TCP/IP for now...)
00615 while (strlen(Str) > 0)
00616 {
00617 if (!strnicmp(Str, "TCP", 3))
00618 //if (!strnicmp(Str, "Serial", 6))
00619 {
00620 // Make sure it's deleted
00621 if (lpConnectionBuffer)
00622 {
00623 free(lpConnectionBuffer);
00624 lpConnectionBuffer = NULL;
00625 }
00626
00627 // make space for Connection Shortcut
00628 lpConnectionBuffer = (char*)malloc(dwSize);
00629 if (lpConnectionBuffer == NULL)
00630 goto FAILURE;
00631
00632 memcpy(lpConnectionBuffer, lpConnection, dwSize);
00633 FoundConnection = TRUE;
00634 break;
00635 }
00636 Str++;
00637 }
00638
00639 FAILURE:
00640 return (TRUE);
00641 }
|
|
|
Definition at line 398 of file Netplay.c. Referenced by InitNetPlay().
00399 {
00400 HRESULT hr=E_FAIL;
00401 LPDIRECTPLAY lpDP=NULL;
00402
00403 CoInitialize( NULL );
00404
00405 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER,
00406 &IID_IDirectPlay4A, (LPVOID *) &g_lpDP );
00407 //hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER,
00408 // &IID_IDirectPlay3A, (LPVOID *) &g_lpDP );
00409
00410 return hr;
00411 }
|
|
||||||||||||||||||||||||
|
Definition at line 540 of file Netplay.c. References g_lpDP.
00542 {
00543 HRESULT hr = DPERR_GENERIC;
00544 DPNAME name;
00545
00546 assert(g_lpDP);
00547
00548 ZeroMemory(&name,sizeof(name));
00549 name.dwSize = sizeof(DPNAME);
00550
00551 #ifdef UNICODE
00552 name.lpszShortName = lptszPlayerName;
00553 #else
00554 name.lpszShortNameA = lptszPlayerName;
00555 #endif
00556
00557 hr = IDirectPlayX_CreatePlayer(g_lpDP, lppidID, &name, hEvent, lpData, dwDataSize, DPPLAYER_SERVERPLAYER);
00558
00559 return hr;
00560 }
|
|
||||||||||||
|
Definition at line 416 of file Netplay.c. References DoDPError(), g_lpDP, and glpGuid. Referenced by NetPlayCreateSession().
00417 {
00418 HRESULT hr = E_FAIL;
00419 DPSESSIONDESC2 dpDesc;
00420
00421 assert(g_lpDP);
00422
00423 ZeroMemory(&dpDesc, sizeof(dpDesc));
00424 dpDesc.dwSize = sizeof(dpDesc);
00425
00426 dpDesc.dwFlags = DPSESSION_KEEPALIVE;
00427
00428 #if 0 // Just keeping these here for reference...
00429 dpDesc.dwFlags |= DPSESSION_CLIENTSERVER;
00430 dpDesc.dwFlags |= DPSESSION_MIGRATEHOST;
00431 dpDesc.dwFlags |= DPSESSION_OPTIMIZELATENCY;
00432 dpDesc.dwFlags |= DPSESSION_DIRECTPLAYPROTOCOL;
00433 #endif
00434
00435 dpDesc.dwMaxPlayers = MaxPlayers;
00436
00437 #ifdef UNICODE
00438 dpDesc.lpszSessionName = lptszSessionName;
00439 #else
00440 dpDesc.lpszSessionNameA = lptszSessionName;
00441 #endif
00442
00443 // set the application guid
00444 if (glpGuid)
00445 dpDesc.guidApplication = *glpGuid;
00446
00447 hr = IDirectPlayX_Open(g_lpDP, &dpDesc, DPOPEN_CREATE);
00448
00449 if (hr != DP_OK)
00450 {
00451 DoDPError(hr);
00452 }
00453
00454 return hr;
00455 }
|
|
|
Definition at line 565 of file Netplay.c. References g_lpDP. Referenced by NetPlayDestroyPlayer().
00566 {
00567 HRESULT hr=E_FAIL;
00568
00569 assert(g_lpDP);
00570
00571 hr = IDirectPlayX_DestroyPlayer(g_lpDP, pid);
00572
00573 return hr;
00574 }
|
|
||||||||||||||||||||
|
Definition at line 489 of file Netplay.c. References g_lpDP, and glpGuid. Referenced by NetPlayEnumSession().
00491 {
00492 HRESULT hr = E_FAIL;
00493 DPSESSIONDESC2 dpDesc;
00494
00495 ZeroMemory(&dpDesc, sizeof(dpDesc));
00496 dpDesc.dwSize = sizeof(dpDesc);
00497
00498 if (glpGuid)
00499 dpDesc.guidApplication = *glpGuid;
00500
00501 if (g_lpDP)
00502 hr = IDirectPlayX_EnumSessions(g_lpDP, &dpDesc, dwTimeout, lpEnumCallback,
00503 lpContext, dwFlags);
00504 return hr;
00505 }
|
|
|
Definition at line 460 of file Netplay.c. References g_lpDP, and glpGuid. Referenced by NetPlayJoinSession().
00461 {
00462 HRESULT hr = E_FAIL;
00463 DPSESSIONDESC2 dpDesc;
00464
00465 assert(g_lpDP);
00466
00467 ZeroMemory(&dpDesc, sizeof(dpDesc));
00468 dpDesc.dwSize = sizeof(dpDesc);
00469
00470 //dpDesc.dwFlags = DPSESSION_DIRECTPLAYPROTOCOL;
00471
00472 // set the session guid
00473 if (lpSessionGuid)
00474 dpDesc.guidInstance = *lpSessionGuid;
00475
00476 // Set the application guid
00477 if (glpGuid)
00478 dpDesc.guidApplication = *glpGuid;
00479
00480 // open it
00481 hr = IDirectPlayX_Open(g_lpDP, &dpDesc, DPOPEN_JOIN);
00482
00483 return hr;
00484 }
|
|
|
Definition at line 579 of file Netplay.c. Referenced by DeInitNetPlay().
|
|
||||||||||||||||||||
|
Definition at line 510 of file Netplay.c. References FALSE, GlobalSession, gSessionCnt, HWND, NULL, and TRUE. Referenced by NetPlayEnumSession().
00512 {
00513 HWND hWnd = (HWND) lpContext;
00514 LPSTR Str = NULL;
00515
00516 if(dwFlags & DPESC_TIMEDOUT)
00517 return FALSE; // don't try again
00518
00519 gSessionCnt++;
00520
00521 if( GlobalSession )
00522 GlobalSession = realloc( GlobalSession, gSessionCnt * sizeof(SESSION_DESC));
00523 else
00524 GlobalSession = malloc( sizeof( SESSION_DESC ) );
00525
00526 GlobalSession[gSessionCnt-1].Guid = lpDPSessionDesc->guidInstance;
00527
00528 #ifdef UNICODE
00529 strcpy(GlobalSession[gSessionCnt-1].SessionName, lpDPSessionDesc->lpszSessionName);
00530 #else
00531 strcpy(GlobalSession[gSessionCnt-1].SessionName, lpDPSessionDesc->lpszSessionNameA);
00532 #endif
00533
00534 return(TRUE);
00535 }
|
|
|
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 364 of file Netplay.c. References DoDPError(), g_lpDP, GE_FALSE, GE_TRUE, geBoolean, geErrorLog_AddString, and NULL.
00365 {
00366 HRESULT Hr;
00367 DPID IdFrom, IdTo;
00368
00369 IdFrom = IdTo = 0;
00370
00371 Hr = IDirectPlayX_GetMessageQueue(g_lpDP, IdFrom, IdTo, DPMESSAGEQUEUE_SEND, NumMsgSend, NumBytesSend);
00372
00373 if (Hr != DP_OK)
00374 {
00375 geErrorLog_AddString(-1, "NetPlayGetNumMessages: IDirectPlayX_GetMessageQueue failed.\n", NULL);
00376 DoDPError(Hr);
00377 return GE_FALSE;
00378 }
00379
00380 Hr = IDirectPlayX_GetMessageQueue(g_lpDP, IdFrom, IdTo, DPMESSAGEQUEUE_RECEIVE, NumMsgRec, NumBytesRec);
00381
00382 if (Hr != DP_OK)
00383 {
00384 geErrorLog_AddString(-1, "NetPlayGetNumMessages: IDirectPlayX_GetMessageQueue failed.\n", NULL);
00385 DoDPError(Hr);
00386 return GE_FALSE;
00387 }
00388
00389 return GE_TRUE;
00390 }
|
|
|
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 54 of file Netplay.c. Referenced by DeInitNetPlay(), DPEnumConnectionsCallback(), and InitNetPlay(). |
|
|
|
|
|
Definition at line 48 of file Netplay.c. Referenced by DeInitNetPlay(), and InitNetPlay(). |
|
|
Definition at line 52 of file Netplay.c. Referenced by DPlayCreate(), DPlayCreatePlayer(), DPlayCreateSession(), DPlayDestroyPlayer(), DPlayEnumSessions(), DPlayOpenSession(), DPlayRelease(), InitNetPlay(), NetPlayCreatePlayer(), NetPlayCreateSession(), NetPlayEnumSession(), NetPlayGetNumMessages(), NetPlayReceive(), and NetPlaySend(). |
|
|
Definition at line 46 of file Netplay.c. Referenced by EnumSession(), and NetPlayEnumSession(). |
|
|
|
|
|
Definition at line 43 of file Netplay.c. Referenced by DPlayCreateSession(), DPlayEnumSessions(), DPlayOpenSession(), and InitNetPlay(). |
|
|
Definition at line 47 of file Netplay.c. Referenced by EnumSession(), and NetPlayEnumSession(). |
|
|
Definition at line 55 of file Netplay.c. Referenced by DeInitNetPlay(), DPEnumConnectionsCallback(), NetPlayCreateSession(), and NetPlayEnumSession(). |
1.3.2