Initial commit: ROW Client source code

Game client codebase including:
- CharacterActionControl: Character and creature management
- GlobalScript: Network, items, skills, quests, utilities
- RYLClient: Main client application with GUI and event handlers
- Engine: 3D rendering engine (RYLGL)
- MemoryManager: Custom memory allocation
- Library: Third-party dependencies (DirectX, boost, etc.)
- Tools: Development utilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 16:24:34 +09:00
commit e067522598
5135 changed files with 1745744 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
//----------------------------------------------------------------------------
// File: SimpleClientServer.h
//
// Desc: see SimpleClient.cpp
//
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Defines, and constants
//-----------------------------------------------------------------------------
#define DPLAY_SAMPLE_KEY TEXT("Software\\Microsoft\\DirectX DirectPlay Samples")
#define MAX_PLAYER_NAME 14
#define WM_APP_UPDATE_STATS (WM_APP + 0)
#define WM_APP_DISPLAY_WAVE (WM_APP + 1)
// This GUID allows DirectPlay to find other instances of the same game on
// the network. So it must be unique for every game, and the same for
// every instance of that game. // {EDE9493E-6AC8-4f15-8D01-8B163200B966}
GUID g_guidApp = { 0xede9493e, 0x6ac8, 0x4f15, { 0x8d, 0x1, 0x8b, 0x16, 0x32, 0x0, 0xb9, 0x66 } };
//-----------------------------------------------------------------------------
// App specific DirectPlay messages and structures
//-----------------------------------------------------------------------------
#define GAME_MSGID_WAVE 1
#define GAME_MSGID_CREATE_PLAYER 2
#define GAME_MSGID_DESTROY_PLAYER 3
#define GAME_MSGID_SET_ID 4
// Change compiler pack alignment to be BYTE aligned, and pop the current value
#pragma pack( push, 1 )
struct GAMEMSG_GENERIC
{
DWORD dwType;
};
struct GAMEMSG_WAVE : public GAMEMSG_GENERIC
{
DWORD dpnidPlayer; // dpnid of the player created
};
struct GAMEMSG_SET_ID : public GAMEMSG_GENERIC
{
DWORD dpnidPlayer; // dpnid of the player
};
struct GAMEMSG_CREATE_PLAYER : public GAMEMSG_GENERIC
{
DWORD dpnidPlayer; // dpnid of the player created
TCHAR strPlayerName[MAX_PLAYER_NAME]; // name of the player created
};
struct GAMEMSG_DESTROY_PLAYER : public GAMEMSG_GENERIC
{
DWORD dpnidPlayer; // dpnid of the player destroyed
};
// Pop the old pack alignment
#pragma pack( pop )

View File

@@ -0,0 +1,156 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_CLIENT_CONNECT DIALOG DISCARDABLE 0, 0, 282, 167
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Multiplayer Games"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Select Game To Join:",IDC_STATIC,7,42,69,8
LISTBOX IDC_GAMES_LIST,7,51,268,89,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Join",IDC_JOIN,7,146,50,14
PUSHBUTTON "Cancel",IDCANCEL,225,146,50,14
LTEXT "Player Name:",IDC_STATIC,7,10,43,8
EDITTEXT IDC_PLAYER_NAME_EDIT,56,7,219,14,ES_AUTOHSCROLL
LTEXT "IP Address:",IDC_STATIC,7,27,37,8
EDITTEXT IDC_IP_ADDRESS,56,24,75,14,ES_AUTOHSCROLL
CONTROL "Start Search",IDC_SEARCH_CHECK,"Button",BS_AUTOCHECKBOX |
BS_PUSHLIKE | WS_TABSTOP,220,24,55,14
END
IDD_MAIN_GAME DIALOG DISCARDABLE 0, 0, 240, 183
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
CAPTION "The Greeting Game"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "Wave to other players!",IDC_WAVE,20,162,80,14
LTEXT "In this extremely simple non-violent game the only action you can",
IDC_STATIC,11,16,214,8
LTEXT "do is to wave to the other players, or they in turn can wave to you!",
IDC_STATIC,11,26,214,8
LTEXT "Number of players in game:",IDC_STATIC,11,59,86,8
LTEXT "0",IDC_NUM_PLAYERS,99,59,127,8
GROUPBOX "Rules",IDC_STATIC,7,7,226,30
GROUPBOX "Game Status",IDC_STATIC,7,39,226,118
LTEXT "Local Player Name:",IDC_STATIC,11,49,62,8
LTEXT "Static",IDC_PLAYER_NAME,76,49,150,8
PUSHBUTTON "Exit",IDCANCEL,155,162,50,14
EDITTEXT IDC_LOG_EDIT,13,71,213,80,ES_MULTILINE | ES_READONLY
END
IDD_LOBBY_WAIT_STATUS DIALOG DISCARDABLE 120, 110, 162, 52
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Lobby Connection Status"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "&Cancel",IDCANCEL,55,31,51,14
CTEXT "Finding Game...",IDC_WAIT_TEXT,7,14,141,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_CLIENT_CONNECT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 275
TOPMARGIN, 7
BOTTOMMARGIN, 160
END
IDD_MAIN_GAME, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 233
VERTGUIDE, 60
VERTGUIDE, 120
VERTGUIDE, 180
TOPMARGIN, 7
BOTTOMMARGIN, 176
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN ICON DISCARDABLE "directx.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,20 @@
//-----------------------------------------------------------------------------
//
// Sample Name: SimpleClientServer Sample
//
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
Description
===========
The SimpleClientServer sample is a simple client/server application.
Path
====
Source: DXSDK\Samples\Multimedia\DirectPlay\SimpleClientServer
Executable: DXSDK\Samples\Multimedia\DirectPlay\Bin

View File

@@ -0,0 +1,29 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by SimpleClient.rc
//
#define IDD_MAIN_GAME 101
#define IDD_LOBBY_WAIT_STATUS 105
#define IDC_WAVE 1001
#define IDC_NUM_PLAYERS 1002
#define IDC_PLAYER_NAME 1003
#define IDC_LOG_EDIT 1016
#define IDD_CLIENT_CONNECT 12001
#define IDC_PLAYER_NAME_EDIT 12100
#define IDC_GAMES_LIST 12101
#define IDC_JOIN 12102
#define IDC_IP_ADDRESS 12103
#define IDC_SEARCH_CHECK 12104
#define IDC_WAIT_TEXT 12105
#define IDI_MAIN 12200
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif

View File

@@ -0,0 +1,740 @@
//----------------------------------------------------------------------------
// File: SimpleClient.cpp
//
// Desc: The SimpleClientServer sample is a simple client/server application.
//
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
//-----------------------------------------------------------------------------
#define STRICT
#include <windows.h>
#include <basetsd.h>
#include <dplay8.h>
#include <dpaddr.h>
#include <dplobby8.h>
#include <dxerr8.h>
#include <tchar.h>
#include "DXUtil.h"
#include "SimpleClientServer.h"
#include "NetClient.h"
#include "resource.h"
//-----------------------------------------------------------------------------
// player struct locking defines
//-----------------------------------------------------------------------------
CRITICAL_SECTION g_csPlayerContext;
#define PLAYER_LOCK() EnterCriticalSection( &g_csPlayerContext );
#define PLAYER_ADDREF( pPlayerInfo ) if( pPlayerInfo ) pPlayerInfo->lRefCount++;
#define PLAYER_RELEASE( pPlayerInfo ) if( pPlayerInfo ) { pPlayerInfo->lRefCount--; if( pPlayerInfo->lRefCount <= 0 ) DestoryPlayerStruct( pPlayerInfo ); } pPlayerInfo = NULL;
#define PLAYER_UNLOCK() LeaveCriticalSection( &g_csPlayerContext );
//-----------------------------------------------------------------------------
// Defines, and constants
//-----------------------------------------------------------------------------
struct APP_PLAYER_INFO
{
LONG lRefCount; // Ref count so we can cleanup when all threads
// are done w/ this object
DPNID dpnidPlayer; // DPNID of player
TCHAR strPlayerName[MAX_PLAYER_NAME]; // Player name
APP_PLAYER_INFO* pNext;
APP_PLAYER_INFO* pPrev;
};
//-----------------------------------------------------------------------------
// Global variables
//-----------------------------------------------------------------------------
IDirectPlay8Client* g_pDPClient = NULL; // DirectPlay peer object
CNetClientWizard* g_pNetClientWizard = NULL; // Connection wizard
IDirectPlay8LobbiedApplication* g_pLobbiedApp = NULL; // DirectPlay lobbied app
BOOL g_bWasLobbyLaunched = FALSE; // TRUE if lobby launched
HINSTANCE g_hInst = NULL; // HINST of app
HWND g_hDlg = NULL; // HWND of main dialog
LONG g_lNumberOfActivePlayers = 0; // Number of players currently in game
DPNID g_dpnidLocalPlayer = 0;
APP_PLAYER_INFO g_playerHead;
TCHAR g_strAppName[256] = TEXT("SimpleClient");
HRESULT g_hrDialog; // Exit code for app
TCHAR g_strLocalPlayerName[MAX_PATH]; // Local player name
//-----------------------------------------------------------------------------
// Function-prototypes
//-----------------------------------------------------------------------------
HRESULT WINAPI DirectPlayMessageHandler( PVOID pvUserContext, DWORD dwMessageId, PVOID pMsgBuffer );
HRESULT WINAPI DirectPlayLobbyMessageHandler( PVOID pvUserContext, DWORD dwMessageId, PVOID pMsgBuffer );
INT_PTR CALLBACK GreetingDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
HRESULT InitDirectPlay();
HRESULT WaveToAllPlayers();
VOID AppendTextToEditControl( HWND hDlg, TCHAR* strNewLogLine );
HRESULT GetPlayerStruct( DPNID dpnidPlayer, APP_PLAYER_INFO** ppPlayerInfo );
VOID DestoryPlayerStruct( APP_PLAYER_INFO* pPlayerInfo );
VOID AddPlayerStruct( APP_PLAYER_INFO* pPlayerInfo );
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: Entry point for the application. Since we use a simple dialog for
// user interaction we don't need to pump messages.
//-----------------------------------------------------------------------------
INT APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInst,
LPSTR pCmdLine, INT nCmdShow )
{
HRESULT hr;
HKEY hDPlaySampleRegKey;
BOOL bConnectSuccess = FALSE;
ZeroMemory( &g_playerHead, sizeof(APP_PLAYER_INFO) );
g_playerHead.pNext = &g_playerHead;
g_playerHead.pPrev = &g_playerHead;
g_hInst = hInst;
InitializeCriticalSection( &g_csPlayerContext );
// Read persistent state information from registry
RegCreateKeyEx( HKEY_CURRENT_USER, DPLAY_SAMPLE_KEY, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
&hDPlaySampleRegKey, NULL );
DXUtil_ReadStringRegKey( hDPlaySampleRegKey, TEXT("Player Name"),
g_strLocalPlayerName, MAX_PATH, TEXT("TestPlayer") );
// Init COM so we can use CoCreateInstance
CoInitializeEx( NULL, COINIT_MULTITHREADED );
// Create helper class
g_pNetClientWizard = new CNetClientWizard( hInst, g_strAppName, &g_guidApp );
if( FAILED( hr = InitDirectPlay() ) )
{
DXTRACE_ERR( TEXT("InitDirectPlay"), hr );
MessageBox( NULL, TEXT("Failed initializing IDirectPlay8Peer. ")
TEXT("The sample will now quit."),
g_strAppName, MB_OK | MB_ICONERROR );
return FALSE;
}
// If we were launched from a lobby client, then we may have connection settings
// that we can use to connect to the host. If not, then we'll need to prompt
// the user to detrimine how to connect.
if( g_bWasLobbyLaunched && g_pNetClientWizard->HaveConnectionSettingsFromLobby() )
{
// If were lobby launched then the DPL_MSGID_CONNECT has already been
// handled, and since the lobby client also sent us connection settings
// we can use them to either host or join a DirectPlay session.
if( FAILED( hr = g_pNetClientWizard->ConnectUsingLobbySettings() ) )
{
DXTRACE_ERR( TEXT("ConnectUsingLobbySettings"), hr );
MessageBox( NULL, TEXT("Failed to connect using lobby settings. ")
TEXT("The sample will now quit."),
g_strAppName, MB_OK | MB_ICONERROR );
bConnectSuccess = FALSE;
}
else
{
// Read information from g_pNetClientWizard
_tcscpy( g_strLocalPlayerName, g_pNetClientWizard->GetPlayerName() );
bConnectSuccess = TRUE;
}
}
else
{
// If not lobby launched, prompt the user about the network
// connection and which session they would like to join or
// if they want to create a new one.
// Setup connection wizard
g_pNetClientWizard->SetPlayerName( g_strLocalPlayerName );
// Start a connection wizard. The wizard uses GDI dialog boxes.
// More complex games can use this as a starting point and add a
// fancier graphics layer such as Direct3D.
hr = g_pNetClientWizard->DoConnectWizard();
if( FAILED( hr ) )
{
DXTRACE_ERR( TEXT("DoConnectWizard"), hr );
MessageBox( NULL, TEXT("Multiplayer connect failed. ")
TEXT("The sample will now quit."),
g_strAppName, MB_OK | MB_ICONERROR );
bConnectSuccess = FALSE;
}
else if( hr == NCW_S_QUIT )
{
// The user canceled the Multiplayer connect, so quit
bConnectSuccess = FALSE;
}
else
{
bConnectSuccess = TRUE;
// Read information from g_pNetClientWizard
_tcscpy( g_strLocalPlayerName, g_pNetClientWizard->GetPlayerName() );
// Write information to the registry
DXUtil_WriteStringRegKey( hDPlaySampleRegKey, TEXT("Player Name"), g_strLocalPlayerName );
}
}
if( bConnectSuccess )
{
// App is now connected via DirectPlay, so start the game.
// For this sample, we just start a simple dialog box game.
g_hrDialog = S_OK;
DialogBox( hInst, MAKEINTRESOURCE(IDD_MAIN_GAME), NULL,
(DLGPROC) GreetingDlgProc );
if( FAILED( g_hrDialog ) )
{
if( g_hrDialog == DPNERR_CONNECTIONLOST )
{
MessageBox( NULL, TEXT("The DirectPlay session was lost. ")
TEXT("The sample will now quit."),
g_strAppName, MB_OK | MB_ICONERROR );
}
else
{
DXTRACE_ERR( TEXT("DialogBox"), g_hrDialog );
MessageBox( NULL, TEXT("An error occured during the game. ")
TEXT("The sample will now quit."),
g_strAppName, MB_OK | MB_ICONERROR );
}
}
}
// Cleanup DirectPlay and helper classes
if( g_pDPClient )
{
g_pDPClient->Close(0);
SAFE_RELEASE( g_pDPClient );
}
if( g_pLobbiedApp )
{
g_pLobbiedApp->Close( 0 );
SAFE_RELEASE( g_pLobbiedApp );
}
// Don't delete the wizard until we know that
// DirectPlay is out of its message handlers.
// This will be true after Close() has been called.
SAFE_DELETE( g_pNetClientWizard );
RegCloseKey( hDPlaySampleRegKey );
DeleteCriticalSection( &g_csPlayerContext );
CoUninitialize();
return TRUE;
}
//-----------------------------------------------------------------------------
// Name: InitDirectPlay()
// Desc:
//-----------------------------------------------------------------------------
HRESULT InitDirectPlay()
{
DPNHANDLE hLobbyLaunchedConnection = NULL;
HRESULT hr;
// Create IDirectPlay8Client
if( FAILED( hr = CoCreateInstance( CLSID_DirectPlay8Client, NULL,
CLSCTX_INPROC_SERVER,
IID_IDirectPlay8Client,
(LPVOID*) &g_pDPClient ) ) )
return DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
// Create IDirectPlay8LobbiedApplication
if( FAILED( hr = CoCreateInstance( CLSID_DirectPlay8LobbiedApplication, NULL,
CLSCTX_INPROC_SERVER,
IID_IDirectPlay8LobbiedApplication,
(LPVOID*) &g_pLobbiedApp ) ) )
return DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
// Init the helper class, now that g_pDP and g_pLobbiedApp are valid
g_pNetClientWizard->Init( g_pDPClient, g_pLobbiedApp );
// Init IDirectPlay8Client
if( FAILED( hr = g_pDPClient->Initialize( NULL, DirectPlayMessageHandler, 0 ) ) )
return DXTRACE_ERR( TEXT("Initialize"), hr );
// Init IDirectPlay8LobbiedApplication. Before this Initialize() returns
// a DPL_MSGID_CONNECT msg may come in to the DirectPlayLobbyMessageHandler
// so be prepared ahead of time.
if( FAILED( hr = g_pLobbiedApp->Initialize( NULL, DirectPlayLobbyMessageHandler,
&hLobbyLaunchedConnection, 0 ) ) )
return DXTRACE_ERR( TEXT("Initialize"), hr );
// IDirectPlay8LobbiedApplication::Initialize returns a handle to a connnection
// if we have been lobby launced. Initialize is guanteeded to return after
// the DPL_MSGID_CONNECT msg has been processed. So unless a we are expected
// multiple lobby connections, we do not need to remember the lobby connection
// handle since it will be recorded upon the DPL_MSGID_CONNECT msg.
g_bWasLobbyLaunched = ( hLobbyLaunchedConnection != NULL );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: GreetingDlgProc()
// Desc: Handles dialog messages
//-----------------------------------------------------------------------------
INT_PTR CALLBACK GreetingDlgProc( HWND hDlg, UINT msg,
WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_INITDIALOG:
{
g_hDlg = hDlg;
// Load and set the icon
HICON hIcon = LoadIcon( g_hInst, MAKEINTRESOURCE( IDI_MAIN ) );
SendMessage( hDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon ); // Set big icon
SendMessage( hDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIcon ); // Set small icon
SetWindowText( hDlg, g_strAppName );
// Display local player's name
SetDlgItemText( hDlg, IDC_PLAYER_NAME, g_strLocalPlayerName );
PostMessage( hDlg, WM_APP_UPDATE_STATS, 0, 0 );
break;
}
case WM_APP_UPDATE_STATS:
{
// Update the number of players in the game
TCHAR strNumberPlayers[32];
wsprintf( strNumberPlayers, TEXT("%d"), g_lNumberOfActivePlayers );
SetDlgItemText( hDlg, IDC_NUM_PLAYERS, strNumberPlayers );
break;
}
case WM_APP_DISPLAY_WAVE:
{
HRESULT hr;
DPNID dpnidPlayer = (DWORD)wParam;
APP_PLAYER_INFO* pPlayerInfo = NULL;
// Get the player struct accosicated with this DPNID
PLAYER_LOCK(); // enter player struct CS
hr = GetPlayerStruct( dpnidPlayer, &pPlayerInfo );
PLAYER_UNLOCK(); // leave player struct CS
if( FAILED(hr) || pPlayerInfo == NULL )
{
// The player who sent this may have gone away before this
// message was handled, so just ignore it
break;
}
// Make wave message and display it.
TCHAR szWaveMessage[MAX_PATH];
wsprintf( szWaveMessage, TEXT("%s just waved at you, %s!\r\n"),
pPlayerInfo->strPlayerName, g_strLocalPlayerName );
PLAYER_LOCK();
PLAYER_RELEASE( pPlayerInfo ); // Release player and cleanup if needed
PLAYER_UNLOCK();
AppendTextToEditControl( hDlg, szWaveMessage );
break;
}
case WM_COMMAND:
{
switch( LOWORD(wParam) )
{
case IDC_WAVE:
if( FAILED( g_hrDialog = WaveToAllPlayers() ) )
{
DXTRACE_ERR( TEXT("WaveToAllPlayers"), g_hrDialog );
EndDialog( hDlg, 0 );
}
return TRUE;
case IDCANCEL:
g_hrDialog = S_OK;
EndDialog( hDlg, 0 );
return TRUE;
}
break;
}
}
return FALSE; // Didn't handle message
}
//-----------------------------------------------------------------------------
// Name: DirectPlayMessageHandler
// Desc: Handler for DirectPlay messages. This function is called by
// the DirectPlay message handler pool of threads, so be careful of thread
// synchronization problems with shared memory
//-----------------------------------------------------------------------------
HRESULT WINAPI DirectPlayMessageHandler( PVOID pvUserContext,
DWORD dwMessageId,
PVOID pMsgBuffer )
{
// Try not to stay in this message handler for too long, otherwise
// there will be a backlog of data. The best solution is to
// queue data as it comes in, and then handle it on other threads.
// This function is called by the DirectPlay message handler pool of
// threads, so be careful of thread synchronization problems with shared memory
switch( dwMessageId )
{
case DPN_MSGID_TERMINATE_SESSION:
{
PDPNMSG_TERMINATE_SESSION pTerminateSessionMsg;
pTerminateSessionMsg = (PDPNMSG_TERMINATE_SESSION)pMsgBuffer;
g_hrDialog = DPNERR_CONNECTIONLOST;
EndDialog( g_hDlg, 0 );
break;
}
case DPN_MSGID_RECEIVE:
{
HRESULT hr;
PDPNMSG_RECEIVE pReceiveMsg;
pReceiveMsg = (PDPNMSG_RECEIVE)pMsgBuffer;
GAMEMSG_GENERIC* pMsg = (GAMEMSG_GENERIC*) pReceiveMsg->pReceiveData;
switch( pMsg->dwType )
{
case GAME_MSGID_SET_ID:
{
// The host is tell us the DPNID for this client
GAMEMSG_SET_ID* pSetIDMsg;
pSetIDMsg = (GAMEMSG_SET_ID*)pReceiveMsg->pReceiveData;
g_dpnidLocalPlayer = pSetIDMsg->dpnidPlayer;
break;
}
case GAME_MSGID_CREATE_PLAYER:
{
// The host is telling us about a new player
GAMEMSG_CREATE_PLAYER* pCreatePlayerMsg;
pCreatePlayerMsg = (GAMEMSG_CREATE_PLAYER*)pReceiveMsg->pReceiveData;
// Create a new and fill in a APP_PLAYER_INFO
APP_PLAYER_INFO* pPlayerInfo = new APP_PLAYER_INFO;
ZeroMemory( pPlayerInfo, sizeof(APP_PLAYER_INFO) );
pPlayerInfo->lRefCount = 1;
pPlayerInfo->dpnidPlayer = pCreatePlayerMsg->dpnidPlayer;
_tcscpy( pPlayerInfo->strPlayerName, pCreatePlayerMsg->strPlayerName );
PLAYER_LOCK(); // enter player struct CS
AddPlayerStruct( pPlayerInfo );
PLAYER_UNLOCK(); // leave player struct CS
// Update the number of active players, and
// post a message to the dialog thread to update the
// UI. This keeps the DirectPlay message handler
// from blocking
InterlockedIncrement( &g_lNumberOfActivePlayers );
if( g_hDlg != NULL )
PostMessage( g_hDlg, WM_APP_UPDATE_STATS, 0, 0 );
break;
};
case GAME_MSGID_DESTROY_PLAYER:
{
// The host is telling us about a player that's been destroyed
APP_PLAYER_INFO* pPlayerInfo = NULL;
GAMEMSG_DESTROY_PLAYER* pDestroyPlayerMsg;
pDestroyPlayerMsg = (GAMEMSG_DESTROY_PLAYER*)pReceiveMsg->pReceiveData;
// Get the player struct accosicated with this DPNID
PLAYER_LOCK(); // enter player struct CS
hr = GetPlayerStruct( pDestroyPlayerMsg->dpnidPlayer, &pPlayerInfo );
PLAYER_UNLOCK(); // leave player struct CS
if( FAILED(hr) || pPlayerInfo == NULL )
{
// The player who sent this may have gone away before this
// message was handled, so just ignore it
break;
}
// Release the player struct
PLAYER_LOCK(); // enter player struct CS
PLAYER_RELEASE( pPlayerInfo ); // Release player and cleanup if needed
PLAYER_UNLOCK(); // leave player struct CS
// Update the number of active players, and
// post a message to the dialog thread to update the
// UI. This keeps the DirectPlay message handler
// from blocking
InterlockedDecrement( &g_lNumberOfActivePlayers );
if( g_hDlg != NULL )
PostMessage( g_hDlg, WM_APP_UPDATE_STATS, 0, 0 );
break;
};
case GAME_MSGID_WAVE:
{
// The host is telling us that someone waved to this client
APP_PLAYER_INFO* pPlayerInfo = NULL;
GAMEMSG_WAVE* pWaveMsg;
pWaveMsg = (GAMEMSG_WAVE*)pReceiveMsg->pReceiveData;
// Ignore wave messages set by the local player
if( pWaveMsg->dpnidPlayer == g_dpnidLocalPlayer )
break;
// Get the player struct accosicated with this DPNID
PLAYER_LOCK(); // enter player struct CS
hr = GetPlayerStruct( pWaveMsg->dpnidPlayer, &pPlayerInfo );
PLAYER_ADDREF( pPlayerInfo ); // addref player, since we are using it now
PLAYER_UNLOCK(); // leave player struct CS
if( FAILED(hr) || pPlayerInfo == NULL )
{
// The player who sent this may have gone away before this
// message was handled, so just ignore it
break;
}
// This message is sent when a player has waved to us, so
// post a message to the dialog thread to update the UI.
// This keeps the DirectPlay threads from blocking, and also
// serializes the recieves since DirectPlayMessageHandler can
// be called simultaneously from a pool of DirectPlay threads.
PostMessage( g_hDlg, WM_APP_DISPLAY_WAVE, pPlayerInfo->dpnidPlayer, 0 );
break;
};
}
break;
}
}
// Make sure the DirectPlay MessageHandler calls the CNetConnectWizard handler,
// so it can be informed of messages such as DPN_MSGID_ENUM_HOSTS_RESPONSE.
if( g_pNetClientWizard )
g_pNetClientWizard->MessageHandler( pvUserContext, dwMessageId, pMsgBuffer );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: DirectPlayLobbyMessageHandler
// Desc: Handler for DirectPlay lobby messages. This function is called by
// the DirectPlay lobby message handler pool of threads, so be careful of
// thread synchronization problems with shared memory
//-----------------------------------------------------------------------------
HRESULT WINAPI DirectPlayLobbyMessageHandler( PVOID pvUserContext,
DWORD dwMessageId,
PVOID pMsgBuffer )
{
switch( dwMessageId )
{
case DPL_MSGID_CONNECT:
{
PDPL_MESSAGE_CONNECT pConnectMsg;
pConnectMsg = (PDPL_MESSAGE_CONNECT)pMsgBuffer;
// The CNetConnectWizard will handle this message for us,
// so there is nothing we need to do here for this simple
// sample.
break;
}
case DPL_MSGID_DISCONNECT:
{
PDPL_MESSAGE_DISCONNECT pDisconnectMsg;
pDisconnectMsg = (PDPL_MESSAGE_DISCONNECT)pMsgBuffer;
// We should free any data associated with the lobby
// client here, but there is none.
break;
}
case DPL_MSGID_RECEIVE:
{
PDPL_MESSAGE_RECEIVE pReceiveMsg;
pReceiveMsg = (PDPL_MESSAGE_RECEIVE)pMsgBuffer;
// The lobby client sent us data. This sample doesn't
// expected data from the client, but it is useful
// for more complex apps.
break;
}
case DPL_MSGID_CONNECTION_SETTINGS:
{
PDPL_MESSAGE_CONNECTION_SETTINGS pConnectionStatusMsg;
pConnectionStatusMsg = (PDPL_MESSAGE_CONNECTION_SETTINGS)pMsgBuffer;
// The lobby client has changed the connection settings.
// This simple sample doesn't handle this, but more complex apps may
// want to.
break;
}
}
// Make sure the DirectPlay MessageHandler calls the CNetConnectWizard handler,
// so the wizard can be informed of lobby messages such as DPL_MSGID_CONNECT
if( g_pNetClientWizard )
return g_pNetClientWizard->LobbyMessageHandler( pvUserContext, dwMessageId,
pMsgBuffer );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: WaveToAllPlayers()
// Desc: Send a app-defined "wave" DirectPlay message to all connected players
//-----------------------------------------------------------------------------
HRESULT WaveToAllPlayers()
{
// This is called by the dialog UI thread. This will send a message to all
// the players or inform the player that there is no one to wave at.
if( g_lNumberOfActivePlayers == 1 )
{
MessageBox( NULL, TEXT("No one is around to wave at! :("),
TEXT("SimpleClient"), MB_OK );
}
else
{
// Send a message to all of the players
GAMEMSG_GENERIC msgWave;
msgWave.dwType = GAME_MSGID_WAVE;
DPN_BUFFER_DESC bufferDesc;
bufferDesc.dwBufferSize = sizeof(GAMEMSG_GENERIC);
bufferDesc.pBufferData = (BYTE*) &msgWave;
DPNHANDLE hAsync;
// DirectPlay will tell via the message handler
// if there are any severe errors, so ignore any errors
g_pDPClient->Send( &bufferDesc, 1, 0, NULL, &hAsync, DPNSEND_GUARANTEED );
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: AppendTextToEditControl()
// Desc: Appends a string of text to the edit control
//-----------------------------------------------------------------------------
VOID AppendTextToEditControl( HWND hDlg, TCHAR* strNewLogLine )
{
static TCHAR strText[1024*10];
HWND hEdit = GetDlgItem( hDlg, IDC_LOG_EDIT );
SendMessage( hEdit, WM_SETREDRAW, FALSE, 0 );
GetWindowText( hEdit, strText, 1024*9 );
_tcscat( strText, strNewLogLine );
int nSecondLine = 0;
if( SendMessage( hEdit, EM_GETLINECOUNT, 0, 0 ) > 9 )
nSecondLine = (int)SendMessage( hEdit, EM_LINEINDEX, 1, 0 );
SetWindowText( hEdit, &strText[nSecondLine] );
SendMessage( hEdit, WM_SETREDRAW, TRUE, 0 );
InvalidateRect( hEdit, NULL, TRUE );
UpdateWindow( hEdit );
}
//-----------------------------------------------------------------------------
// Name: AddPlayerStruct()
// Desc: Add pPlayerInfo to the circular linked list, g_playerHead
//-----------------------------------------------------------------------------
VOID AddPlayerStruct( APP_PLAYER_INFO* pPlayerInfo )
{
pPlayerInfo->pNext = g_playerHead.pNext;
pPlayerInfo->pPrev = &g_playerHead;
g_playerHead.pNext->pPrev = pPlayerInfo;
g_playerHead.pNext = pPlayerInfo;
}
//-----------------------------------------------------------------------------
// Name: DestoryPlayerStruct()
// Desc: Remove pPlayerInfo from the circular linked list, g_playerHead
//-----------------------------------------------------------------------------
VOID DestoryPlayerStruct( APP_PLAYER_INFO* pPlayerInfo )
{
pPlayerInfo->pNext->pPrev = pPlayerInfo->pPrev;
pPlayerInfo->pPrev->pNext = pPlayerInfo->pNext;
SAFE_DELETE( pPlayerInfo );
}
//-----------------------------------------------------------------------------
// Name: GetPlayerStruct()
// Desc: Searchs the circular linked list, g_playerHead, for dpnidPlayer
//-----------------------------------------------------------------------------
HRESULT GetPlayerStruct( DPNID dpnidPlayer, APP_PLAYER_INFO** ppPlayerInfo )
{
if( ppPlayerInfo == NULL )
return E_FAIL;
APP_PLAYER_INFO* pCurPlayer = g_playerHead.pNext;
*ppPlayerInfo = NULL;
while ( pCurPlayer != &g_playerHead )
{
if( pCurPlayer->dpnidPlayer == dpnidPlayer )
{
*ppPlayerInfo = pCurPlayer;
return S_OK;
}
pCurPlayer = pCurPlayer->pNext;
}
// Not found.
return E_FAIL;
}

View File

@@ -0,0 +1,208 @@
# Microsoft Developer Studio Project File - Name="SimpleClient" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=SimpleClient - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "simpleclient.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "simpleclient.mak" CFG="SimpleClient - Win32 Debug Unicode"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "SimpleClient - Win32 Debug Unicode" (based on "Win32 (x86) Application")
!MESSAGE "SimpleClient - Win32 Release Unicode" (based on "Win32 (x86) Application")
!MESSAGE "SimpleClient - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "SimpleClient - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "SimpleClient - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /machine:I386 /stack:0x10000,0x10000
!ELSEIF "$(CFG)" == "SimpleClient - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBC" /pdbtype:sept /stack:0x10000,0x10000
# SUBTRACT LINK32 /incremental:no /nodefaultlib
!ELSEIF "$(CFG)" == "SimpleClient - Win32 Debug Unicode"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Win32_Debug_Unicode"
# PROP BASE Intermediate_Dir "Win32_Debug_Unicode"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Win32_Debug_Unicode"
# PROP Intermediate_Dir "Win32_Debug_Unicode"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBC" /pdbtype:sept
# SUBTRACT BASE LINK32 /incremental:no /nodefaultlib
# ADD LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBC" /pdbtype:sept /stack:0x10000,0x10000
# SUBTRACT LINK32 /incremental:no /nodefaultlib
!ELSEIF "$(CFG)" == "SimpleClient - Win32 Release Unicode"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Win32_Release_Unicode"
# PROP BASE Intermediate_Dir "Win32_Release_Unicode"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Win32_Release_Unicode"
# PROP Intermediate_Dir "Win32_Release_Unicode"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /machine:I386 /stack:0x10000,0x10000
!ENDIF
# Begin Target
# Name "SimpleClient - Win32 Release"
# Name "SimpleClient - Win32 Debug"
# Name "SimpleClient - Win32 Debug Unicode"
# Name "SimpleClient - Win32 Release Unicode"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\SimpleClient.cpp
# End Source File
# Begin Source File
SOURCE=..\common\simpleclientserver.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\directx.ico
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\SimpleClient.rc
# End Source File
# End Group
# Begin Group "Common"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\common\src\dxutil.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\common\include\dxutil.h
# End Source File
# Begin Source File
SOURCE=..\..\..\common\src\netclient.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\common\include\netclient.h
# End Source File
# Begin Source File
SOURCE=..\..\..\common\include\netclientres.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\readme.txt
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "SimpleClient"=.\SimpleClient.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,378 @@
# Microsoft Developer Studio Generated NMAKE File, Based on SimpleClient.dsp
!IF "$(CFG)" == ""
CFG=SimpleClient - Win32 Debug Unicode
!MESSAGE No configuration specified. Defaulting to SimpleClient - Win32 Debug Unicode.
!ENDIF
!IF "$(CFG)" != "SimpleClient - Win32 Release" && "$(CFG)" != "SimpleClient - Win32 Debug" && "$(CFG)" != "SimpleClient - Win32 Debug Unicode" && "$(CFG)" != "SimpleClient - Win32 Release Unicode"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "SimpleClient.mak" CFG="SimpleClient - Win32 Debug Unicode"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "SimpleClient - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "SimpleClient - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "SimpleClient - Win32 Debug Unicode" (based on "Win32 (x86) Application")
!MESSAGE "SimpleClient - Win32 Release Unicode" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "SimpleClient - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\SimpleClient.exe"
CLEAN :
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\netclient.obj"
-@erase "$(INTDIR)\SimpleClient.obj"
-@erase "$(INTDIR)\SimpleClient.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\SimpleClient.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\SimpleClient.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SimpleClient.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SimpleClient.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\SimpleClient.pdb" /machine:I386 /out:"$(OUTDIR)\SimpleClient.exe" /stack:0x10000,0x10000
LINK32_OBJS= \
"$(INTDIR)\SimpleClient.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\netclient.obj" \
"$(INTDIR)\SimpleClient.res"
"$(OUTDIR)\SimpleClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "SimpleClient - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\SimpleClient.exe"
CLEAN :
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\netclient.obj"
-@erase "$(INTDIR)\SimpleClient.obj"
-@erase "$(INTDIR)\SimpleClient.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\SimpleClient.exe"
-@erase "$(OUTDIR)\SimpleClient.ilk"
-@erase "$(OUTDIR)\SimpleClient.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\SimpleClient.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SimpleClient.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SimpleClient.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\SimpleClient.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\SimpleClient.exe" /pdbtype:sept /stack:0x10000,0x10000
LINK32_OBJS= \
"$(INTDIR)\SimpleClient.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\netclient.obj" \
"$(INTDIR)\SimpleClient.res"
"$(OUTDIR)\SimpleClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "SimpleClient - Win32 Debug Unicode"
OUTDIR=.\Win32_Debug_Unicode
INTDIR=.\Win32_Debug_Unicode
# Begin Custom Macros
OutDir=.\Win32_Debug_Unicode
# End Custom Macros
ALL : "$(OUTDIR)\SimpleClient.exe"
CLEAN :
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\netclient.obj"
-@erase "$(INTDIR)\SimpleClient.obj"
-@erase "$(INTDIR)\SimpleClient.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\SimpleClient.exe"
-@erase "$(OUTDIR)\SimpleClient.ilk"
-@erase "$(OUTDIR)\SimpleClient.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\SimpleClient.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SimpleClient.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SimpleClient.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\SimpleClient.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\SimpleClient.exe" /pdbtype:sept /stack:0x10000,0x10000
LINK32_OBJS= \
"$(INTDIR)\SimpleClient.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\netclient.obj" \
"$(INTDIR)\SimpleClient.res"
"$(OUTDIR)\SimpleClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "SimpleClient - Win32 Release Unicode"
OUTDIR=.\Win32_Release_Unicode
INTDIR=.\Win32_Release_Unicode
# Begin Custom Macros
OutDir=.\Win32_Release_Unicode
# End Custom Macros
ALL : "$(OUTDIR)\SimpleClient.exe"
CLEAN :
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\netclient.obj"
-@erase "$(INTDIR)\SimpleClient.obj"
-@erase "$(INTDIR)\SimpleClient.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\SimpleClient.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\SimpleClient.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SimpleClient.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SimpleClient.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\SimpleClient.pdb" /machine:I386 /out:"$(OUTDIR)\SimpleClient.exe" /stack:0x10000,0x10000
LINK32_OBJS= \
"$(INTDIR)\SimpleClient.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\netclient.obj" \
"$(INTDIR)\SimpleClient.res"
"$(OUTDIR)\SimpleClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("SimpleClient.dep")
!INCLUDE "SimpleClient.dep"
!ELSE
!MESSAGE Warning: cannot find "SimpleClient.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "SimpleClient - Win32 Release" || "$(CFG)" == "SimpleClient - Win32 Debug" || "$(CFG)" == "SimpleClient - Win32 Debug Unicode" || "$(CFG)" == "SimpleClient - Win32 Release Unicode"
SOURCE=.\SimpleClient.cpp
"$(INTDIR)\SimpleClient.obj" : $(SOURCE) "$(INTDIR)"
SOURCE=.\SimpleClient.rc
"$(INTDIR)\SimpleClient.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
SOURCE=..\..\..\common\src\dxutil.cpp
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\..\common\src\netclient.cpp
"$(INTDIR)\netclient.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

View File

@@ -0,0 +1,118 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_MAIN DIALOG DISCARDABLE 0, 0, 233, 156
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
CAPTION "SimpleServer"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Number of players in game:",IDC_STATIC,7,28,86,8
LTEXT "0",IDC_NUM_PLAYERS,97,28,60,8
LTEXT "Session Name:",IDC_STATIC,7,9,48,8
PUSHBUTTON "Exit",IDCANCEL,176,135,50,14
EDITTEXT IDC_SESSION_NAME,58,7,103,12,ES_AUTOHSCROLL
PUSHBUTTON "Start Server",IDC_START,170,25,56,14
LTEXT "Server Status:",IDC_STATIC,7,138,46,8
LTEXT "Static",IDC_STATUS,58,138,95,8
LISTBOX IDC_PLAYER_LIST,7,43,219,88,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
RTEXT "Port:",IDC_STATIC,166,9,23,8
EDITTEXT IDC_PORT,192,7,34,12,ES_AUTOHSCROLL | ES_NUMBER
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_MAIN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 226
TOPMARGIN, 7
BOTTOMMARGIN, 149
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAIN ICON DISCARDABLE "directx.ico"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,19 @@
//-----------------------------------------------------------------------------
//
// Sample Name: SimpleServerServer Sample
//
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
Description
===========
The SimpleClientServer sample is a simple client/server application.
Path
====
Source: DXSDK\Samples\Multimedia\DirectPlay\SimpleServerServer
Executable: DXSDK\Samples\Multimedia\DirectPlay\Bin

View File

@@ -0,0 +1,23 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by SimpleServer.rc
//
#define IDD_MAIN 101
#define IDC_NUM_PLAYERS 1002
#define IDC_SESSION_NAME 1004
#define IDC_START 1005
#define IDC_STATUS 1006
#define IDC_PORT 1007
#define IDC_PLAYER_LIST 1016
#define IDI_MAIN 11014
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1008
#define _APS_NEXT_SYMED_VALUE 103
#endif
#endif

View File

@@ -0,0 +1,693 @@
//----------------------------------------------------------------------------
// File: SimpleServer.cpp
//
// Desc: The SimpleClientServer sample is a simple client/server application.
//
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
//-----------------------------------------------------------------------------
#define STRICT
#include <windows.h>
#include <basetsd.h>
#include <dplay8.h>
#include <dpaddr.h>
#include <dxerr8.h>
#include <tchar.h>
#include "SimpleClientServer.h"
#include "DXUtil.h"
#include "resource.h"
//-----------------------------------------------------------------------------
// Player context locking defines
//-----------------------------------------------------------------------------
CRITICAL_SECTION g_csPlayerContext;
#define PLAYER_LOCK() EnterCriticalSection( &g_csPlayerContext );
#define PLAYER_ADDREF( pPlayerInfo ) if( pPlayerInfo ) pPlayerInfo->lRefCount++;
#define PLAYER_RELEASE( pPlayerInfo ) if( pPlayerInfo ) { pPlayerInfo->lRefCount--; if( pPlayerInfo->lRefCount <= 0 ) SAFE_DELETE( pPlayerInfo ); } pPlayerInfo = NULL;
#define PLAYER_UNLOCK() LeaveCriticalSection( &g_csPlayerContext );
//-----------------------------------------------------------------------------
// Defines, and constants
//-----------------------------------------------------------------------------
#define SIMPLESERVER_DEFAULT_PORT 0x6501 // arbitrary port number for this app
struct APP_PLAYER_INFO
{
LONG lRefCount; // Ref count so we can cleanup when all threads
// are done w/ this object
DPNID dpnidPlayer; // DPNID of player
TCHAR strPlayerName[MAX_PLAYER_NAME]; // Player name
};
//-----------------------------------------------------------------------------
// Global variables
//-----------------------------------------------------------------------------
IDirectPlay8Server* g_pDPServer = NULL; // DirectPlay server object
HINSTANCE g_hInst = NULL; // HINST of app
HWND g_hDlg = NULL; // HWND of main dialog
LONG g_lNumberOfActivePlayers = 0; // Number of players currently in game
TCHAR g_strAppName[256] = TEXT("SimpleServer");
TCHAR g_strSessionName[MAX_PATH]; // Session name
DWORD g_dwPort; // Port
HRESULT g_hrDialog; // Exit code for app
BOOL g_bServerStarted = FALSE; // TRUE if the server has started
//-----------------------------------------------------------------------------
// Function-prototypes
//-----------------------------------------------------------------------------
HRESULT WINAPI DirectPlayMessageHandler( PVOID pvUserContext, DWORD dwMessageId, PVOID pMsgBuffer );
INT_PTR CALLBACK ServerDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
HRESULT StartServer( HWND hDlg );
VOID StopServer( HWND hDlg );
VOID DisplayPlayers( HWND hDlg );
HRESULT SendCreatePlayerMsg( APP_PLAYER_INFO* pPlayerInfo, DPNID dpnidTarget );
HRESULT SendWorldStateToNewPlayer( DPNID dpnidPlayer );
HRESULT SendDestroyPlayerMsgToAll( APP_PLAYER_INFO* pPlayerInfo );
HRESULT SendWaveMessageToAll( DPNID dpnidFrom );
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: Entry point for the application. Since we use a simple dialog for
// user interaction we don't need to pump messages.
//-----------------------------------------------------------------------------
INT APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInst,
LPSTR pCmdLine, INT nCmdShow )
{
HKEY hDPlaySampleRegKey;
BOOL bConnectSuccess = FALSE;
g_hInst = hInst;
InitializeCriticalSection( &g_csPlayerContext );
// Read persistent state information from registry
RegCreateKeyEx( HKEY_CURRENT_USER, DPLAY_SAMPLE_KEY, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
&hDPlaySampleRegKey, NULL );
DXUtil_ReadStringRegKey( hDPlaySampleRegKey, TEXT("Session Name"),
g_strSessionName, MAX_PATH, TEXT("TestGame") );
DXUtil_ReadIntRegKey( hDPlaySampleRegKey, TEXT("SimpleServer Port"),
&g_dwPort, SIMPLESERVER_DEFAULT_PORT );
// Init COM so we can use CoCreateInstance
CoInitializeEx( NULL, COINIT_MULTITHREADED );
// For this sample, we just start a simple dialog box server
g_hrDialog = S_OK;
DialogBox( hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC) ServerDlgProc );
if( FAILED( g_hrDialog ) )
{
if( g_hrDialog == DPNERR_CONNECTIONLOST )
{
MessageBox( NULL, TEXT("The DirectPlay session was lost. ")
TEXT("The server will now quit."),
g_strAppName, MB_OK | MB_ICONERROR );
}
else
{
DXTRACE_ERR( TEXT("DialogBox"), g_hrDialog );
MessageBox( NULL, TEXT("An error occured. ")
TEXT("The server will now quit."),
g_strAppName, MB_OK | MB_ICONERROR );
}
}
DXUtil_WriteStringRegKey( hDPlaySampleRegKey, TEXT("Session Name"), g_strSessionName );
DXUtil_WriteIntRegKey( hDPlaySampleRegKey, TEXT("SimpleServer Port"), g_dwPort );
StopServer( NULL );
RegCloseKey( hDPlaySampleRegKey );
DeleteCriticalSection( &g_csPlayerContext );
CoUninitialize();
return TRUE;
}
//-----------------------------------------------------------------------------
// Name: ServerDlgProc()
// Desc: Handles dialog messages
//-----------------------------------------------------------------------------
INT_PTR CALLBACK ServerDlgProc( HWND hDlg, UINT msg,
WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_INITDIALOG:
{
g_hDlg = hDlg;
// Load and set the icon
HICON hIcon = LoadIcon( g_hInst, MAKEINTRESOURCE( IDI_MAIN ) );
SendMessage( hDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon ); // Set big icon
SendMessage( hDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIcon ); // Set small icon
SetWindowText( hDlg, TEXT("SimpleServer") );
SetDlgItemText( hDlg, IDC_SESSION_NAME, g_strSessionName );
// Set the port to either a number or blank
if( g_dwPort != 0 )
SetDlgItemInt( hDlg, IDC_PORT, g_dwPort, FALSE );
else
SetDlgItemText( hDlg, IDC_PORT, TEXT("") );
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Server stoped.") );
PostMessage( hDlg, WM_APP_UPDATE_STATS, 0, 0 );
break;
}
case WM_APP_UPDATE_STATS:
{
// Update the number of players in the game
TCHAR strNumberPlayers[32];
wsprintf( strNumberPlayers, TEXT("%d"), g_lNumberOfActivePlayers );
SetDlgItemText( hDlg, IDC_NUM_PLAYERS, strNumberPlayers );
DisplayPlayers( hDlg );
break;
}
case WM_COMMAND:
{
switch( LOWORD(wParam) )
{
case IDC_START:
if( !g_bServerStarted )
{
if( FAILED( g_hrDialog = StartServer( hDlg ) ) )
{
DXTRACE_ERR( TEXT("StartServer"), g_hrDialog );
EndDialog( hDlg, 0 );
}
}
else
{
StopServer( hDlg );
}
if( g_bServerStarted )
{
SetDlgItemText( hDlg, IDC_START, TEXT("Stop Server") );
EnableWindow( GetDlgItem( hDlg, IDC_SESSION_NAME ), FALSE );
EnableWindow( GetDlgItem( hDlg, IDC_PORT ), FALSE );
}
else
{
SetDlgItemText( hDlg, IDC_START, TEXT("Start Server") );
EnableWindow( GetDlgItem( hDlg, IDC_SESSION_NAME ), TRUE );
EnableWindow( GetDlgItem( hDlg, IDC_PORT ), TRUE );
}
break;
case IDCANCEL:
StopServer( hDlg );
EndDialog( hDlg, 0 );
return TRUE;
}
break;
}
}
return FALSE; // Didn't handle message
}
//-----------------------------------------------------------------------------
// Name: DirectPlayMessageHandler
// Desc: Handler for DirectPlay messages. This function is called by
// the DirectPlay message handler pool of threads, so be careful of thread
// synchronization problems with shared memory
//-----------------------------------------------------------------------------
HRESULT WINAPI DirectPlayMessageHandler( PVOID pvUserContext,
DWORD dwMessageId,
PVOID pMsgBuffer )
{
// Try not to stay in this message handler for too long, otherwise
// there will be a backlog of data. The best solution is to
// queue data as it comes in, and then handle it on other threads.
// This function is called by the DirectPlay message handler pool of
// threads, so be careful of thread synchronization problems with shared memory
switch( dwMessageId )
{
case DPN_MSGID_CREATE_PLAYER:
{
HRESULT hr;
PDPNMSG_CREATE_PLAYER pCreatePlayerMsg;
pCreatePlayerMsg = (PDPNMSG_CREATE_PLAYER)pMsgBuffer;
// Get the peer info and extract its name
DWORD dwSize = 0;
DPN_PLAYER_INFO* pdpPlayerInfo = NULL;
hr = g_pDPServer->GetClientInfo( pCreatePlayerMsg->dpnidPlayer,
pdpPlayerInfo, &dwSize, 0 );
if( FAILED(hr) && hr != DPNERR_BUFFERTOOSMALL )
{
if( hr == DPNERR_INVALIDPLAYER )
{
// Ignore this message if this is for the host
break;
}
return DXTRACE_ERR( TEXT("GetClientInfo"), hr );
}
pdpPlayerInfo = (DPN_PLAYER_INFO*) new BYTE[ dwSize ];
ZeroMemory( pdpPlayerInfo, dwSize );
pdpPlayerInfo->dwSize = sizeof(DPN_PLAYER_INFO);
hr = g_pDPServer->GetClientInfo( pCreatePlayerMsg->dpnidPlayer,
pdpPlayerInfo, &dwSize, 0 );
if( FAILED(hr) )
return DXTRACE_ERR( TEXT("GetClientInfo"), hr );
// Create a new and fill in a APP_PLAYER_INFO
APP_PLAYER_INFO* pPlayerInfo = new APP_PLAYER_INFO;
ZeroMemory( pPlayerInfo, sizeof(APP_PLAYER_INFO) );
pPlayerInfo->lRefCount = 1;
pPlayerInfo->dpnidPlayer = pCreatePlayerMsg->dpnidPlayer;
// This stores a extra TCHAR copy of the player name for
// easier access. This will be redundent copy since DPlay
// also keeps a copy of the player name in GetClientInfo()
DXUtil_ConvertWideStringToGeneric( pPlayerInfo->strPlayerName,
pdpPlayerInfo->pwszName, MAX_PLAYER_NAME );
SAFE_DELETE_ARRAY( pdpPlayerInfo );
// Tell DirectPlay to store this pPlayerInfo
// pointer in the pvPlayerContext.
pCreatePlayerMsg->pvPlayerContext = pPlayerInfo;
// Send all connected players a message telling about this new player
SendCreatePlayerMsg( pPlayerInfo, DPNID_ALL_PLAYERS_GROUP );
// Tell this new player about the world state
SendWorldStateToNewPlayer( pCreatePlayerMsg->dpnidPlayer );
// Update the number of active players, and
// post a message to the dialog thread to update the
// UI. This keeps the DirectPlay message handler
// from blocking
InterlockedIncrement( &g_lNumberOfActivePlayers );
if( g_hDlg != NULL )
PostMessage( g_hDlg, WM_APP_UPDATE_STATS, 0, 0 );
break;
}
case DPN_MSGID_DESTROY_PLAYER:
{
PDPNMSG_DESTROY_PLAYER pDestroyPlayerMsg;
pDestroyPlayerMsg = (PDPNMSG_DESTROY_PLAYER)pMsgBuffer;
APP_PLAYER_INFO* pPlayerInfo = (APP_PLAYER_INFO*) pDestroyPlayerMsg->pvPlayerContext;
// Ignore this message if this is the host player
if( pPlayerInfo == NULL )
break;
// Send all connected players a message telling about this destroyed player
SendDestroyPlayerMsgToAll( pPlayerInfo );
PLAYER_LOCK(); // enter player context CS
PLAYER_RELEASE( pPlayerInfo ); // Release player and cleanup if needed
PLAYER_UNLOCK(); // leave player context CS
// Update the number of active players, and
// post a message to the dialog thread to update the
// UI. This keeps the DirectPlay message handler
// from blocking
InterlockedDecrement( &g_lNumberOfActivePlayers );
if( g_hDlg != NULL )
PostMessage( g_hDlg, WM_APP_UPDATE_STATS, 0, 0 );
break;
}
case DPN_MSGID_TERMINATE_SESSION:
{
PDPNMSG_TERMINATE_SESSION pTerminateSessionMsg;
pTerminateSessionMsg = (PDPNMSG_TERMINATE_SESSION)pMsgBuffer;
g_hrDialog = DPNERR_CONNECTIONLOST;
EndDialog( g_hDlg, 0 );
break;
}
case DPN_MSGID_RECEIVE:
{
PDPNMSG_RECEIVE pReceiveMsg;
pReceiveMsg = (PDPNMSG_RECEIVE)pMsgBuffer;
APP_PLAYER_INFO* pPlayerInfo = (APP_PLAYER_INFO*) pReceiveMsg->pvPlayerContext;
GAMEMSG_GENERIC* pMsg = (GAMEMSG_GENERIC*) pReceiveMsg->pReceiveData;
if( pMsg->dwType == GAME_MSGID_WAVE )
SendWaveMessageToAll( pPlayerInfo->dpnidPlayer );
break;
}
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: StartServer
// Desc:
//-----------------------------------------------------------------------------
HRESULT StartServer( HWND hDlg )
{
HRESULT hr;
PDIRECTPLAY8ADDRESS pDP8AddrLocal = NULL;
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Starting server...") );
SetCursor( LoadCursor(NULL, IDC_WAIT) );
WCHAR wstrSessionName[MAX_PATH];
GetDlgItemText( hDlg, IDC_SESSION_NAME, g_strSessionName, MAX_PATH );
DXUtil_ConvertGenericStringToWide( wstrSessionName, g_strSessionName );
BOOL bPortTranslated;
g_dwPort = GetDlgItemInt( hDlg, IDC_PORT, &bPortTranslated, FALSE );
if( !bPortTranslated )
g_dwPort = 0;
// Create IDirectPlay8Server
if( FAILED( hr = CoCreateInstance( CLSID_DirectPlay8Server, NULL,
CLSCTX_INPROC_SERVER,
IID_IDirectPlay8Server,
(LPVOID*) &g_pDPServer ) ) )
return DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
// Init IDirectPlay8Server
if( FAILED( hr = g_pDPServer->Initialize( NULL, DirectPlayMessageHandler, 0 ) ) )
return DXTRACE_ERR( TEXT("Initialize"), hr );
hr = CoCreateInstance( CLSID_DirectPlay8Address, NULL,
CLSCTX_ALL, IID_IDirectPlay8Address,
(LPVOID*) &pDP8AddrLocal );
if( FAILED(hr) )
{
DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
goto LCleanup;
}
hr = pDP8AddrLocal->SetSP( &CLSID_DP8SP_TCPIP );
if( FAILED(hr) )
{
DXTRACE_ERR( TEXT("SetSP"), hr );
goto LCleanup;
}
// Add the port to pDP8AddrLocal, if the port is non-zero.
// If the port is 0, then DirectPlay will pick a port,
// Games will typically hard code the port so the
// user need not know it
if( g_dwPort != 0 )
{
if( FAILED( hr = pDP8AddrLocal->AddComponent( DPNA_KEY_PORT,
&g_dwPort, sizeof(g_dwPort),
DPNA_DATATYPE_DWORD ) ) )
return DXTRACE_ERR( TEXT("AddComponent"), hr );
}
DPN_APPLICATION_DESC dpnAppDesc;
ZeroMemory( &dpnAppDesc, sizeof(DPN_APPLICATION_DESC) );
dpnAppDesc.dwSize = sizeof( DPN_APPLICATION_DESC );
dpnAppDesc.dwFlags = DPNSESSION_CLIENT_SERVER;
dpnAppDesc.guidApplication = g_guidApp;
dpnAppDesc.pwszSessionName = wstrSessionName;
hr = g_pDPServer->Host( &dpnAppDesc, &pDP8AddrLocal, 1, NULL, NULL, NULL, 0 );
if( FAILED(hr) )
{
DXTRACE_ERR( TEXT("Host"), hr );
goto LCleanup;
}
SetCursor( LoadCursor(NULL, IDC_ARROW) );
g_bServerStarted = TRUE;
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Server started.") );
LCleanup:
SAFE_RELEASE( pDP8AddrLocal );
return hr;
}
//-----------------------------------------------------------------------------
// Name: StopServer
// Desc:
//-----------------------------------------------------------------------------
VOID StopServer( HWND hDlg )
{
if( hDlg )
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Stopping server...") );
SetCursor( LoadCursor(NULL, IDC_WAIT) );
if( g_pDPServer )
{
g_pDPServer->Close(0);
SAFE_RELEASE( g_pDPServer );
}
g_bServerStarted = FALSE;
SetCursor( LoadCursor(NULL, IDC_ARROW) );
if( hDlg )
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Server stoped.") );
}
//-----------------------------------------------------------------------------
// Name: DisplayPlayers
// Desc:
//-----------------------------------------------------------------------------
VOID DisplayPlayers( HWND hDlg )
{
HRESULT hr;
DWORD dwNumPlayers = 0;
DPNID* aPlayers = NULL;
SendMessage( GetDlgItem(hDlg, IDC_PLAYER_LIST), LB_RESETCONTENT, 0, 0 );
if( NULL == g_pDPServer )
return;
// Enumerate all the connected players
while( TRUE )
{
hr = g_pDPServer->EnumPlayersAndGroups( aPlayers, &dwNumPlayers, DPNENUM_PLAYERS );
if( SUCCEEDED(hr) )
break;
if( FAILED(hr) && hr != DPNERR_BUFFERTOOSMALL )
return;
SAFE_DELETE_ARRAY( aPlayers );
aPlayers = new DPNID[ dwNumPlayers ];
}
// For each player, send a "create player" message to the new player
for( DWORD i = 0; i<dwNumPlayers; i++ )
{
APP_PLAYER_INFO* pPlayerInfo = NULL;
do
{
// Get the player context accosicated with this DPNID
// Call GetPlayerContext() until it returns something other than DPNERR_NOTREADY
// DPNERR_NOTREADY will be returned if the callback thread has not
// yet returned from DPN_MSGID_CREATE_PLAYER, which sets the player's context
hr = g_pDPServer->GetPlayerContext( aPlayers[i], (LPVOID*) &pPlayerInfo, 0 );
}
while( hr == DPNERR_NOTREADY );
// Ignore this player if we can't get the context
if( pPlayerInfo == NULL || FAILED(hr) )
continue;
TCHAR strTemp[MAX_PATH];
wsprintf( strTemp, TEXT("DPNID: 0x%0.8x (%s)"), pPlayerInfo->dpnidPlayer, pPlayerInfo->strPlayerName );
int nIndex = (int)SendMessage( GetDlgItem(hDlg, IDC_PLAYER_LIST), LB_ADDSTRING,
0, (LPARAM)strTemp );
}
SAFE_DELETE_ARRAY( aPlayers );
}
//-----------------------------------------------------------------------------
// Name: SendCreatePlayerMsg
// Desc: Send the target player a creation message about the player identified
// in the APP_PLAYER_INFO struct.
//-----------------------------------------------------------------------------
HRESULT SendCreatePlayerMsg( APP_PLAYER_INFO* pPlayerAbout, DPNID dpnidTarget )
{
GAMEMSG_CREATE_PLAYER msgCreatePlayer;
msgCreatePlayer.dwType = GAME_MSGID_CREATE_PLAYER;
msgCreatePlayer.dpnidPlayer = pPlayerAbout->dpnidPlayer;
_tcscpy( msgCreatePlayer.strPlayerName, pPlayerAbout->strPlayerName );
DPN_BUFFER_DESC bufferDesc;
bufferDesc.dwBufferSize = sizeof(GAMEMSG_CREATE_PLAYER);
bufferDesc.pBufferData = (BYTE*) &msgCreatePlayer;
// DirectPlay will tell via the message handler
// if there are any severe errors, so ignore any errors
DPNHANDLE hAsync;
g_pDPServer->SendTo( dpnidTarget, &bufferDesc, 1,
0, NULL, &hAsync, DPNSEND_NOLOOPBACK | DPNSEND_GUARANTEED );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: SendWorldStateToNewPlayer
// Desc: Send the world state to the new player. For this sample, it is just
// "create player" message for every connected player
//-----------------------------------------------------------------------------
HRESULT SendWorldStateToNewPlayer( DPNID dpnidNewPlayer )
{
HRESULT hr;
DWORD dwNumPlayers = 0;
DPNID* aPlayers = NULL;
// Tell this player the dpnid of itself
GAMEMSG_SET_ID msgSetID;
msgSetID.dwType = GAME_MSGID_SET_ID;
msgSetID.dpnidPlayer = dpnidNewPlayer;
DPN_BUFFER_DESC bufferDesc;
bufferDesc.dwBufferSize = sizeof(GAMEMSG_SET_ID);
bufferDesc.pBufferData = (BYTE*) &msgSetID;
// DirectPlay will tell via the message handler
// if there are any severe errors, so ignore any errors
DPNHANDLE hAsync;
g_pDPServer->SendTo( dpnidNewPlayer, &bufferDesc, 1,
0, NULL, &hAsync, DPNSEND_NOLOOPBACK | DPNSEND_GUARANTEED );
// Enumerate all the connected players
while( TRUE )
{
hr = g_pDPServer->EnumPlayersAndGroups( aPlayers, &dwNumPlayers, DPNENUM_PLAYERS );
if( SUCCEEDED(hr) )
break;
if( FAILED(hr) && hr != DPNERR_BUFFERTOOSMALL )
return DXTRACE_ERR( TEXT("EnumPlayersAndGroups"), hr );
SAFE_DELETE_ARRAY( aPlayers );
aPlayers = new DPNID[ dwNumPlayers ];
}
// For each player, send a "create player" message to the new player
for( DWORD i = 0; i<dwNumPlayers; i++ )
{
APP_PLAYER_INFO* pPlayerInfo = NULL;
// Don't send a create msg to the new player about itself. This will
// be already done when we sent one to DPNID_ALL_PLAYERS_GROUP
if( aPlayers[i] == dpnidNewPlayer )
continue;
// Get the player context accosicated with this DPNID
hr = g_pDPServer->GetPlayerContext( aPlayers[i], (LPVOID*) &pPlayerInfo, 0 );
// Ignore this player if we can't get the context
if( pPlayerInfo == NULL || FAILED(hr) )
continue;
SendCreatePlayerMsg( pPlayerInfo, dpnidNewPlayer );
}
SAFE_DELETE_ARRAY( aPlayers );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: SendDestroyPlayerMsgToAll
// Desc:
//-----------------------------------------------------------------------------
HRESULT SendDestroyPlayerMsgToAll( APP_PLAYER_INFO* pPlayerInfo )
{
GAMEMSG_DESTROY_PLAYER msgDestroyPlayer;
msgDestroyPlayer.dwType = GAME_MSGID_DESTROY_PLAYER;
msgDestroyPlayer.dpnidPlayer = pPlayerInfo->dpnidPlayer;
DPN_BUFFER_DESC bufferDesc;
bufferDesc.dwBufferSize = sizeof(GAMEMSG_CREATE_PLAYER);
bufferDesc.pBufferData = (BYTE*) &msgDestroyPlayer;
// DirectPlay will tell via the message handler
// if there are any severe errors, so ignore any errors
DPNHANDLE hAsync;
g_pDPServer->SendTo( DPNID_ALL_PLAYERS_GROUP, &bufferDesc, 1,
0, NULL, &hAsync, DPNSEND_NOLOOPBACK | DPNSEND_GUARANTEED );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: SendWaveMessageToAll
// Desc:
//-----------------------------------------------------------------------------
HRESULT SendWaveMessageToAll( DPNID dpnidFrom )
{
GAMEMSG_WAVE msgWave;
msgWave.dwType = GAME_MSGID_WAVE;
msgWave.dpnidPlayer = dpnidFrom;
DPN_BUFFER_DESC bufferDesc;
bufferDesc.dwBufferSize = sizeof(GAMEMSG_WAVE);
bufferDesc.pBufferData = (BYTE*) &msgWave;
// DirectPlay will tell via the message handler
// if there are any severe errors, so ignore any errors
DPNHANDLE hAsync;
g_pDPServer->SendTo( DPNID_ALL_PLAYERS_GROUP, &bufferDesc, 1,
0, NULL, &hAsync, DPNSEND_NOLOOPBACK | DPNSEND_GUARANTEED );
return S_OK;
}

View File

@@ -0,0 +1,196 @@
# Microsoft Developer Studio Project File - Name="SimpleServer" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=SimpleServer - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "simpleserver.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "simpleserver.mak" CFG="SimpleServer - Win32 Debug Unicode"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "SimpleServer - Win32 Debug Unicode" (based on "Win32 (x86) Application")
!MESSAGE "SimpleServer - Win32 Release Unicode" (based on "Win32 (x86) Application")
!MESSAGE "SimpleServer - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "SimpleServer - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "SimpleServer - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /machine:I386 /stack:0x10000,0x10000
!ELSEIF "$(CFG)" == "SimpleServer - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBC" /pdbtype:sept /stack:0x10000,0x10000
# SUBTRACT LINK32 /incremental:no /nodefaultlib
!ELSEIF "$(CFG)" == "SimpleServer - Win32 Debug Unicode"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Win32_Debug_Unicode"
# PROP BASE Intermediate_Dir "Win32_Debug_Unicode"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Win32_Debug_Unicode"
# PROP Intermediate_Dir "Win32_Debug_Unicode"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBC" /pdbtype:sept
# SUBTRACT BASE LINK32 /incremental:no /nodefaultlib
# ADD LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBC" /pdbtype:sept /stack:0x10000,0x10000
# SUBTRACT LINK32 /incremental:no /nodefaultlib
!ELSEIF "$(CFG)" == "SimpleServer - Win32 Release Unicode"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Win32_Release_Unicode"
# PROP BASE Intermediate_Dir "Win32_Release_Unicode"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Win32_Release_Unicode"
# PROP Intermediate_Dir "Win32_Release_Unicode"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /machine:I386 /stack:0x10000,0x10000
!ENDIF
# Begin Target
# Name "SimpleServer - Win32 Release"
# Name "SimpleServer - Win32 Debug"
# Name "SimpleServer - Win32 Debug Unicode"
# Name "SimpleServer - Win32 Release Unicode"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\common\simpleclientserver.h
# End Source File
# Begin Source File
SOURCE=.\SimpleServer.cpp
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\directx.ico
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\SimpleServer.rc
# End Source File
# End Group
# Begin Group "Common"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\common\src\dxutil.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\common\include\dxutil.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\readme.txt
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "SimpleServer"=.\SimpleServer.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,364 @@
# Microsoft Developer Studio Generated NMAKE File, Based on SimpleServer.dsp
!IF "$(CFG)" == ""
CFG=SimpleServer - Win32 Debug Unicode
!MESSAGE No configuration specified. Defaulting to SimpleServer - Win32 Debug Unicode.
!ENDIF
!IF "$(CFG)" != "SimpleServer - Win32 Release" && "$(CFG)" != "SimpleServer - Win32 Debug" && "$(CFG)" != "SimpleServer - Win32 Debug Unicode" && "$(CFG)" != "SimpleServer - Win32 Release Unicode"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "SimpleServer.mak" CFG="SimpleServer - Win32 Debug Unicode"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "SimpleServer - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "SimpleServer - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "SimpleServer - Win32 Debug Unicode" (based on "Win32 (x86) Application")
!MESSAGE "SimpleServer - Win32 Release Unicode" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "SimpleServer - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\SimpleServer.exe"
CLEAN :
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\SimpleServer.obj"
-@erase "$(INTDIR)\SimpleServer.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\SimpleServer.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\SimpleServer.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SimpleServer.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SimpleServer.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\SimpleServer.pdb" /machine:I386 /out:"$(OUTDIR)\SimpleServer.exe" /stack:0x10000,0x10000
LINK32_OBJS= \
"$(INTDIR)\SimpleServer.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\SimpleServer.res"
"$(OUTDIR)\SimpleServer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "SimpleServer - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\SimpleServer.exe"
CLEAN :
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\SimpleServer.obj"
-@erase "$(INTDIR)\SimpleServer.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\SimpleServer.exe"
-@erase "$(OUTDIR)\SimpleServer.ilk"
-@erase "$(OUTDIR)\SimpleServer.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\SimpleServer.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SimpleServer.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SimpleServer.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\SimpleServer.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\SimpleServer.exe" /pdbtype:sept /stack:0x10000,0x10000
LINK32_OBJS= \
"$(INTDIR)\SimpleServer.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\SimpleServer.res"
"$(OUTDIR)\SimpleServer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "SimpleServer - Win32 Debug Unicode"
OUTDIR=.\Win32_Debug_Unicode
INTDIR=.\Win32_Debug_Unicode
# Begin Custom Macros
OutDir=.\Win32_Debug_Unicode
# End Custom Macros
ALL : "$(OUTDIR)\SimpleServer.exe"
CLEAN :
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\SimpleServer.obj"
-@erase "$(INTDIR)\SimpleServer.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\SimpleServer.exe"
-@erase "$(OUTDIR)\SimpleServer.ilk"
-@erase "$(OUTDIR)\SimpleServer.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\common\include" /I "..\common" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\SimpleServer.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SimpleServer.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SimpleServer.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\SimpleServer.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\SimpleServer.exe" /pdbtype:sept /stack:0x10000,0x10000
LINK32_OBJS= \
"$(INTDIR)\SimpleServer.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\SimpleServer.res"
"$(OUTDIR)\SimpleServer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "SimpleServer - Win32 Release Unicode"
OUTDIR=.\Win32_Release_Unicode
INTDIR=.\Win32_Release_Unicode
# Begin Custom Macros
OutDir=.\Win32_Release_Unicode
# End Custom Macros
ALL : "$(OUTDIR)\SimpleServer.exe"
CLEAN :
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\SimpleServer.obj"
-@erase "$(INTDIR)\SimpleServer.res"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\SimpleServer.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\common" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\SimpleServer.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\SimpleServer.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\SimpleServer.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=dplay.lib dxguid.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib oleaut32.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib kernel32.lib user32.lib ole32.lib uuid.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\SimpleServer.pdb" /machine:I386 /out:"$(OUTDIR)\SimpleServer.exe" /stack:0x10000,0x10000
LINK32_OBJS= \
"$(INTDIR)\SimpleServer.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\SimpleServer.res"
"$(OUTDIR)\SimpleServer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("SimpleServer.dep")
!INCLUDE "SimpleServer.dep"
!ELSE
!MESSAGE Warning: cannot find "SimpleServer.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "SimpleServer - Win32 Release" || "$(CFG)" == "SimpleServer - Win32 Debug" || "$(CFG)" == "SimpleServer - Win32 Debug Unicode" || "$(CFG)" == "SimpleServer - Win32 Release Unicode"
SOURCE=.\SimpleServer.cpp
"$(INTDIR)\SimpleServer.obj" : $(SOURCE) "$(INTDIR)"
SOURCE=.\SimpleServer.rc
"$(INTDIR)\SimpleServer.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
SOURCE=..\..\..\common\src\dxutil.cpp
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

View File

@@ -0,0 +1,34 @@
//-----------------------------------------------------------------------------
//
// Sample Name: SimpleClientServer Sample
//
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
Description
===========
The SimpleClientServer sample is a simple client/server application.
It is similar in form to SimplePeer, but using the client/server interfaces.
The game itself is very simple, passing a single DirectPlay message to all
connected players when the "Wave To other players" button is pressed.
Path
====
Source: DXSDK\Samples\Multimedia\DirectPlay\SimpleClientServer
Executable: DXSDK\Samples\Multimedia\DirectPlay\Bin
User's Guide
============
Start the SimpleServer. Change the port if desired, and click "Start Server".
Start the SimpleClient. Enter the player's name, and type in the IP address
or leave it blank to search the subnet. Then click "Start Search". Click
join when a session appears.
After game has been joined or created, the game begins immediately. Other players
may join the game at any time.