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>
@@ -0,0 +1,192 @@
|
||||
# Microsoft Developer Studio Project File - Name="AddressOverride" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=AddressOverride - 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 "AddressOverride.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 "AddressOverride.mak" CFG="AddressOverride - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AddressOverride - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AddressOverride - Win32 Release Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AddressOverride - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AddressOverride - 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)" == "AddressOverride - 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 "." /I "..\..\common\include" /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 wsock32.lib 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)" == "AddressOverride - 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" /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 wsock32.lib 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)" == "AddressOverride - 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" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /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 wsock32.lib 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 wsock32.lib 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)" == "AddressOverride - 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 "." /I "..\..\common\include" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /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 wsock32.lib 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 wsock32.lib 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 "AddressOverride - Win32 Release"
|
||||
# Name "AddressOverride - Win32 Debug"
|
||||
# Name "AddressOverride - Win32 Debug Unicode"
|
||||
# Name "AddressOverride - Win32 Release Unicode"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\AddressOverride.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=.\AddressOverride.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\directx.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# 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
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "AddressOverride"=.\AddressOverride.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,364 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on AddressOverride.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=AddressOverride - Win32 Debug Unicode
|
||||
!MESSAGE No configuration specified. Defaulting to AddressOverride - Win32 Debug Unicode.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "AddressOverride - Win32 Release" && "$(CFG)" != "AddressOverride - Win32 Debug" && "$(CFG)" != "AddressOverride - Win32 Debug Unicode" && "$(CFG)" != "AddressOverride - 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 "AddressOverride.mak" CFG="AddressOverride - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AddressOverride - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AddressOverride - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AddressOverride - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AddressOverride - 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)" == "AddressOverride - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\AddressOverride.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\AddressOverride.obj"
|
||||
-@erase "$(INTDIR)\AddressOverride.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\AddressOverride.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\AddressOverride.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)\AddressOverride.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\AddressOverride.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=wsock32.lib 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)\AddressOverride.pdb" /machine:I386 /out:"$(OUTDIR)\AddressOverride.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\AddressOverride.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\AddressOverride.res"
|
||||
|
||||
"$(OUTDIR)\AddressOverride.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "AddressOverride - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\AddressOverride.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\AddressOverride.obj"
|
||||
-@erase "$(INTDIR)\AddressOverride.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\AddressOverride.exe"
|
||||
-@erase "$(OUTDIR)\AddressOverride.ilk"
|
||||
-@erase "$(OUTDIR)\AddressOverride.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\AddressOverride.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)\AddressOverride.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\AddressOverride.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=wsock32.lib 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)\AddressOverride.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\AddressOverride.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\AddressOverride.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\AddressOverride.res"
|
||||
|
||||
"$(OUTDIR)\AddressOverride.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "AddressOverride - Win32 Debug Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Debug_Unicode
|
||||
INTDIR=.\Win32_Debug_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Debug_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\AddressOverride.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\AddressOverride.obj"
|
||||
-@erase "$(INTDIR)\AddressOverride.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\AddressOverride.exe"
|
||||
-@erase "$(OUTDIR)\AddressOverride.ilk"
|
||||
-@erase "$(OUTDIR)\AddressOverride.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\AddressOverride.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)\AddressOverride.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\AddressOverride.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=wsock32.lib 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)\AddressOverride.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\AddressOverride.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\AddressOverride.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\AddressOverride.res"
|
||||
|
||||
"$(OUTDIR)\AddressOverride.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "AddressOverride - Win32 Release Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Release_Unicode
|
||||
INTDIR=.\Win32_Release_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Release_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\AddressOverride.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\AddressOverride.obj"
|
||||
-@erase "$(INTDIR)\AddressOverride.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\AddressOverride.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\AddressOverride.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)\AddressOverride.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\AddressOverride.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=wsock32.lib 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)\AddressOverride.pdb" /machine:I386 /out:"$(OUTDIR)\AddressOverride.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\AddressOverride.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\AddressOverride.res"
|
||||
|
||||
"$(OUTDIR)\AddressOverride.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("AddressOverride.dep")
|
||||
!INCLUDE "AddressOverride.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "AddressOverride.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "AddressOverride - Win32 Release" || "$(CFG)" == "AddressOverride - Win32 Debug" || "$(CFG)" == "AddressOverride - Win32 Debug Unicode" || "$(CFG)" == "AddressOverride - Win32 Release Unicode"
|
||||
SOURCE=.\AddressOverride.cpp
|
||||
|
||||
"$(INTDIR)\AddressOverride.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\AddressOverride.rc
|
||||
|
||||
"$(INTDIR)\AddressOverride.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
//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_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_ADDRESS_OVERRIDE DIALOG DISCARDABLE 0, 0, 215, 130
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "DirectPlay Address Override"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
RTEXT "Player Name:",IDC_STATIC,7,25,55,8
|
||||
EDITTEXT IDC_PLAYER_NAME,68,23,140,12,ES_AUTOHSCROLL
|
||||
RTEXT "Session Name:",IDC_STATIC,7,43,55,8
|
||||
EDITTEXT IDC_SESSION_NAME,68,41,140,12,ES_AUTOHSCROLL
|
||||
RTEXT "Serivce Provider:",IDC_STATIC,7,60,55,8
|
||||
COMBOBOX IDC_SP_COMBO,68,58,140,65,CBS_DROPDOWNLIST | CBS_SORT |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "IP Address:",IDC_ADDRESS_LINE1_TEXT,7,77,55,8
|
||||
EDITTEXT IDC_ADDRESS_LINE1,68,75,68,12,ES_AUTOHSCROLL
|
||||
RTEXT "Port:",IDC_ADDRESS_LINE2_TEXT,139,77,24,8
|
||||
EDITTEXT IDC_ADDRESS_LINE2,165,75,43,12,ES_AUTOHSCROLL
|
||||
RTEXT "Adapter:",IDC_STATIC,7,94,55,8
|
||||
COMBOBOX IDC_ADAPTER_COMBO,68,92,140,65,CBS_DROPDOWNLIST |
|
||||
CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Host session",IDC_HOST_SESSION,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,21,111,56,10
|
||||
PUSHBUTTON "&OK",IDOK,103,109,50,14
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,158,109,50,14
|
||||
LTEXT "Local IP Address:",IDC_STATIC,53,9,56,8
|
||||
LTEXT "Static",IDC_LOCAL_IP,114,9,94,8
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_MAIN_GAME, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 233
|
||||
VERTGUIDE, 60
|
||||
VERTGUIDE, 120
|
||||
VERTGUIDE, 180
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 176
|
||||
END
|
||||
|
||||
IDD_ADDRESS_OVERRIDE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 208
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 123
|
||||
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
|
||||
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,92 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Sample Name: AddressOverride Sample
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
AddressOverride shows how to programmatically tell DirectPlay the addressing
|
||||
in order to host or connect to another session on the network, instead of just
|
||||
letting DirectPlay popup a dialog box to ask the user the connection settings.
|
||||
Most games will typically follow this method so they can customize the UI.
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\DirectPlay\AddressOverride
|
||||
|
||||
Executable: DXSDK\Samples\Multimedia\DirectPlay\Bin
|
||||
|
||||
User's Guide
|
||||
============
|
||||
Enter the player's name, session, and check or uncheck the 'host sesion'
|
||||
checkbox.
|
||||
|
||||
Choose a service provider, and adapter. If the TCP/IP SP is chosen, and
|
||||
hosting then enter port or it leave blank to have DirectPlay automatically
|
||||
pick a port. If joining, then enter the port and the IP address of the host,
|
||||
or leave blank to search the subnet. If the modem SP is chosen, then enter
|
||||
the phone number. If the IPX SP is chosen, then enter the port. If the
|
||||
serial SP is chosen, then the simple dialog will use the default DirectPlay
|
||||
dialog to query the user for the serial settings.
|
||||
|
||||
Click OK to start or join a game. Once in a session, it presents a
|
||||
simple game similiar to SimplePeer.
|
||||
|
||||
Programming Notes
|
||||
=================
|
||||
The AddressOverride sample is very similar in form to the SimplePeer sample. For
|
||||
detailed programming notes on the basics this sample, refer to Programming
|
||||
Notes section of the SimplePeer sample.
|
||||
|
||||
The AddressOverride differs by letting programmatically telling DirectPlay
|
||||
the address instead of just letting DirectPlay popup a dialog box.
|
||||
|
||||
* The "OK" button is pressed. See LaunchMultiplayerGame().
|
||||
1. It gathers if the user wants to host or join.
|
||||
2. It gathers the SP guid from the UI
|
||||
3. If hosting it creates a IDirectPlay8Address* called pHostAddress and
|
||||
calls IDirectPlay8Address::SetSP() on it.
|
||||
4. If joining or hosting it creates a IDirectPlay8Address* called
|
||||
pDeviceAddress and calls IDirectPlay8Address::SetSP() on it.
|
||||
5. If gathers from the UI if an adapter was selected. If it was it calls
|
||||
IDirectPlay8Address::SetDevice() on the pDeviceAddress.
|
||||
6. It then fills in the pDeviceAddress and the pHostAddress depending
|
||||
on the SP selected, and if joining or hosting by calling
|
||||
IDirectPlay8Address::AddComponent. Here's how that works:
|
||||
|
||||
- If the TCP/IP SP was selected and hosting, then:
|
||||
- If a port was entered it calls
|
||||
IDirectPlay8Address::AddComponent( DPNA_KEY_PORT, ... )
|
||||
on the pDeviceAddress to add the port.
|
||||
- If the TCP/IP SP was selected and joining, then:
|
||||
- If a IP address was entered it calls
|
||||
IDirectPlay8Address::AddComponent( DPNA_KEY_HOSTNAME, ... )
|
||||
on the pHostAddress to add the IP address.
|
||||
- If a port was entered it calls
|
||||
IDirectPlay8Address::AddComponent( DPNA_KEY_PORT, ... )
|
||||
on the pHostAddress to add the port.
|
||||
|
||||
- If the IPX SP was selected and hosting, then:
|
||||
- If a port was entered it calls
|
||||
IDirectPlay8Address::AddComponent( DPNA_KEY_PORT, ... )
|
||||
on the pDeviceAddress to add the port.
|
||||
- If the IPX SP was selected and joining, then:
|
||||
- If a port was entered it calls
|
||||
IDirectPlay8Address::AddComponent( DPNA_KEY_PORT, ... )
|
||||
on the pHostAddress to add the port.
|
||||
|
||||
- If the modem SP was selected and joining, then:
|
||||
- If a phone number was entered it calls
|
||||
IDirectPlay8Address::AddComponent( DPNA_KEY_PHONENUMBER, ... )
|
||||
on the pHostAddress to add the phone number.
|
||||
|
||||
7. It then connects in a similar manner as SimplePeer, but using
|
||||
the pDeviceAddress and pHostAddress it filled to connect or join
|
||||
to the session.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by AddressOverride.rc
|
||||
//
|
||||
#define IDD_MAIN_GAME 101
|
||||
#define IDD_ADDRESS_OVERRIDE 102
|
||||
#define IDC_WAVE 1001
|
||||
#define IDC_NUM_PLAYERS 1002
|
||||
#define IDC_PLAYER_NAME 1003
|
||||
#define IDC_SP_COMBO 1005
|
||||
#define IDC_SESSION_NAME 1006
|
||||
#define IDC_LOCAL_IP 1007
|
||||
#define IDC_ADAPTER_COMBO 1008
|
||||
#define IDC_ADDRESS_LINE1 1011
|
||||
#define IDC_LOG_EDIT 1016
|
||||
#define IDC_HOST_SESSION 1021
|
||||
#define IDC_ADDRESS_LINE2 1024
|
||||
#define IDC_ADDRESS_LINE1_TEXT 1025
|
||||
#define IDC_ADDRESS_LINE2_TEXT 1026
|
||||
#define IDD_MULTIPLAYER_CONNECT 10001
|
||||
#define IDD_MULTIPLAYER_GAMES 10002
|
||||
#define IDD_MULTIPLAYER_CREATE 10003
|
||||
#define IDD_LOBBY_WAIT_STATUS 10004
|
||||
#define IDC_RETURN 11001
|
||||
#define IDC_PLAYER_NAME_EDIT 11002
|
||||
#define IDC_GAMES_LIST 11003
|
||||
#define IDC_JOIN 11004
|
||||
#define IDC_CREATE 11005
|
||||
#define IDC_CONNECTION_LIST 11006
|
||||
#define IDC_BACK 11007
|
||||
#define IDC_CHECK_DPLAY_PROTOCOL 11008
|
||||
#define IDC_EDIT_SESSION_NAME 11009
|
||||
#define IDC_SEARCH_CHECK 11010
|
||||
#define IDC_WAIT_TEXT 11012
|
||||
#define IDC_MIGRATE_HOST 11013
|
||||
#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
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "ChatPeer"=.\ChatPeer.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
378
Library/dxx8/samples/Multimedia/DirectPlay/ChatPeer/ChatPeer.mak
Normal file
@@ -0,0 +1,378 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on ChatPeer.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=ChatPeer - Win32 Debug Unicode
|
||||
!MESSAGE No configuration specified. Defaulting to ChatPeer - Win32 Debug Unicode.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "ChatPeer - Win32 Release" && "$(CFG)" != "ChatPeer - Win32 Debug" && "$(CFG)" != "ChatPeer - Win32 Debug Unicode" && "$(CFG)" != "ChatPeer - 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 "ChatPeer.mak" CFG="ChatPeer - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "ChatPeer - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "ChatPeer - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "ChatPeer - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "ChatPeer - 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)" == "ChatPeer - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\ChatPeer.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\ChatPeer.obj"
|
||||
-@erase "$(INTDIR)\ChatPeer.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\NetConnect.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\ChatPeer.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\ChatPeer.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)\ChatPeer.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ChatPeer.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)\ChatPeer.pdb" /machine:I386 /out:"$(OUTDIR)\ChatPeer.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\ChatPeer.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\NetConnect.obj" \
|
||||
"$(INTDIR)\ChatPeer.res"
|
||||
|
||||
"$(OUTDIR)\ChatPeer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "ChatPeer - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\ChatPeer.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\ChatPeer.obj"
|
||||
-@erase "$(INTDIR)\ChatPeer.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\NetConnect.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\ChatPeer.exe"
|
||||
-@erase "$(OUTDIR)\ChatPeer.ilk"
|
||||
-@erase "$(OUTDIR)\ChatPeer.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\ChatPeer.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)\ChatPeer.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ChatPeer.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)\ChatPeer.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\ChatPeer.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\ChatPeer.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\NetConnect.obj" \
|
||||
"$(INTDIR)\ChatPeer.res"
|
||||
|
||||
"$(OUTDIR)\ChatPeer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "ChatPeer - Win32 Debug Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Debug_Unicode
|
||||
INTDIR=.\Win32_Debug_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Debug_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\ChatPeer.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\ChatPeer.obj"
|
||||
-@erase "$(INTDIR)\ChatPeer.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\NetConnect.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\ChatPeer.exe"
|
||||
-@erase "$(OUTDIR)\ChatPeer.ilk"
|
||||
-@erase "$(OUTDIR)\ChatPeer.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\ChatPeer.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)\ChatPeer.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ChatPeer.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)\ChatPeer.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\ChatPeer.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\ChatPeer.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\NetConnect.obj" \
|
||||
"$(INTDIR)\ChatPeer.res"
|
||||
|
||||
"$(OUTDIR)\ChatPeer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "ChatPeer - Win32 Release Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Release_Unicode
|
||||
INTDIR=.\Win32_Release_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Release_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\ChatPeer.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\ChatPeer.obj"
|
||||
-@erase "$(INTDIR)\ChatPeer.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\NetConnect.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\ChatPeer.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\ChatPeer.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)\ChatPeer.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\ChatPeer.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)\ChatPeer.pdb" /machine:I386 /out:"$(OUTDIR)\ChatPeer.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\ChatPeer.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\NetConnect.obj" \
|
||||
"$(INTDIR)\ChatPeer.res"
|
||||
|
||||
"$(OUTDIR)\ChatPeer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("ChatPeer.dep")
|
||||
!INCLUDE "ChatPeer.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "ChatPeer.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "ChatPeer - Win32 Release" || "$(CFG)" == "ChatPeer - Win32 Debug" || "$(CFG)" == "ChatPeer - Win32 Debug Unicode" || "$(CFG)" == "ChatPeer - Win32 Release Unicode"
|
||||
SOURCE=.\ChatPeer.cpp
|
||||
|
||||
"$(INTDIR)\ChatPeer.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\ChatPeer.rc
|
||||
|
||||
"$(INTDIR)\ChatPeer.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\NetConnect.cpp
|
||||
|
||||
"$(INTDIR)\NetConnect.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
772
Library/dxx8/samples/Multimedia/DirectPlay/ChatPeer/chatpeer.cpp
Normal file
@@ -0,0 +1,772 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: ChatPeer.cpp
|
||||
//
|
||||
// Desc: The main game file for the ChatPeer sample. It connects
|
||||
// players together with two dialog boxes to prompt users on the
|
||||
// connection settings to join or create a session. After the user
|
||||
// connects to a sesssion, the sample displays a multiplayer stage.
|
||||
//
|
||||
// After a new game has started the sample begins a very simplistic
|
||||
// chat session where users can send text to each other.
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#include <basetsd.h>
|
||||
#include <richedit.h>
|
||||
#include <dplay8.h>
|
||||
#include <dplobby8.h>
|
||||
#include <dxerr8.h>
|
||||
#include "NetConnect.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 DPLAY_SAMPLE_KEY TEXT("Software\\Microsoft\\DirectX DirectPlay Samples")
|
||||
#define MAX_PLAYER_NAME 14
|
||||
#define MAX_CHAT_STRINGS 50
|
||||
#define MAX_CHAT_STRING_LENGTH 508
|
||||
#define WM_APP_UPDATE_STATS (WM_APP + 0)
|
||||
#define WM_APP_CHAT (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. // {876A3036-FFD7-46bc-9209-B42F617B9BE7}
|
||||
GUID g_guidApp = { 0x876a3036, 0xffd7, 0x46bc, { 0x92, 0x9, 0xb4, 0x2f, 0x61, 0x7b, 0x9b, 0xe7 } };
|
||||
|
||||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
IDirectPlay8Peer* g_pDP = NULL; // DirectPlay peer object
|
||||
CNetConnectWizard* g_pNetConnectWizard = 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
|
||||
DPNID g_dpnidLocalPlayer = 0; // DPNID of local player
|
||||
LONG g_lNumberOfActivePlayers = 0; // Number of players currently in game
|
||||
TCHAR g_strAppName[256] = TEXT("ChatPeer");
|
||||
HRESULT g_hrDialog; // Exit code for app
|
||||
TCHAR g_strLocalPlayerName[MAX_PATH]; // Local player name
|
||||
TCHAR g_strSessionName[MAX_PATH]; // Session name
|
||||
TCHAR g_strPreferredProvider[MAX_PATH]; // Provider string
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// App specific DirectPlay messages and structures
|
||||
//-----------------------------------------------------------------------------
|
||||
#define GAME_MSGID_CHAT 1
|
||||
|
||||
// Change compiler pack alignment to be BYTE aligned, and pop the current value
|
||||
#pragma pack( push, 1 )
|
||||
|
||||
struct GAMEMSG_GENERIC
|
||||
{
|
||||
BYTE nType;
|
||||
};
|
||||
|
||||
struct GAMEMSG_CHAT : public GAMEMSG_GENERIC
|
||||
{
|
||||
TCHAR strChatString[MAX_CHAT_STRING_LENGTH];
|
||||
};
|
||||
|
||||
// Pop the old pack alignment
|
||||
#pragma pack( pop )
|
||||
|
||||
|
||||
struct APP_QUEUED_DATA
|
||||
{
|
||||
GAMEMSG_CHAT* pChatMsg;
|
||||
DPNHANDLE hBufferHandle;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Function-prototypes
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT WINAPI DirectPlayMessageHandler( PVOID pvUserContext, DWORD dwMessageId, PVOID pMsgBuffer );
|
||||
HRESULT WINAPI DirectPlayLobbyMessageHandler( PVOID pvUserContext, DWORD dwMessageId, PVOID pMsgBuffer );
|
||||
INT_PTR CALLBACK ChatDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
HRESULT InitDirectPlay();
|
||||
HRESULT OnInitDialog( HWND hDlg );
|
||||
HRESULT SendChatMessage( HWND hDlg );
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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;
|
||||
|
||||
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") );
|
||||
DXUtil_ReadStringRegKey( hDPlaySampleRegKey, TEXT("Session Name"),
|
||||
g_strSessionName, MAX_PATH, TEXT("TestGame") );
|
||||
DXUtil_ReadStringRegKey( hDPlaySampleRegKey, TEXT("Preferred Provider"),
|
||||
g_strPreferredProvider, MAX_PATH, TEXT("DirectPlay8 TCP/IP Service Provider") );
|
||||
|
||||
// Init COM so we can use CoCreateInstance
|
||||
CoInitializeEx( NULL, COINIT_MULTITHREADED );
|
||||
|
||||
// Create helper class
|
||||
g_pNetConnectWizard = new CNetConnectWizard( hInst, NULL, 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."),
|
||||
TEXT("DirectPlay Sample"), MB_OK | MB_ICONERROR );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
// Check if we were launched from a lobby client
|
||||
if( g_bWasLobbyLaunched && g_pNetConnectWizard->HaveConnectionSettingsFromLobby() )
|
||||
{
|
||||
// If were lobby launched then DPL_MSGID_CONNECT has already been
|
||||
// handled, so we can just tell the wizard to connect to the lobby
|
||||
// that has sent us a DPL_MSGID_CONNECT msg.
|
||||
if( FAILED( hr = g_pNetConnectWizard->ConnectUsingLobbySettings() ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("ConnectUsingLobbySettings"), hr );
|
||||
MessageBox( NULL, TEXT("Failed to connect using lobby settings. ")
|
||||
TEXT("The sample will now quit."),
|
||||
TEXT("DirectPlay Sample"), MB_OK | MB_ICONERROR );
|
||||
|
||||
bConnectSuccess = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read information from g_pNetConnectWizard
|
||||
_tcscpy( g_strLocalPlayerName, g_pNetConnectWizard->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_pNetConnectWizard->SetPlayerName( g_strLocalPlayerName );
|
||||
g_pNetConnectWizard->SetSessionName( g_strSessionName );
|
||||
g_pNetConnectWizard->SetPreferredProvider( g_strPreferredProvider );
|
||||
|
||||
// Do the connection wizard
|
||||
hr = g_pNetConnectWizard->DoConnectWizard( FALSE );
|
||||
if( FAILED( hr ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("DoConnectWizard"), hr );
|
||||
MessageBox( NULL, TEXT("Multiplayer connect failed. ")
|
||||
TEXT("The sample will now quit."),
|
||||
TEXT("DirectPlay Sample"), 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_pNetConnectWizard
|
||||
_tcscpy( g_strLocalPlayerName, g_pNetConnectWizard->GetPlayerName() );
|
||||
_tcscpy( g_strSessionName, g_pNetConnectWizard->GetSessionName() );
|
||||
_tcscpy( g_strPreferredProvider, g_pNetConnectWizard->GetPreferredProvider() );
|
||||
|
||||
// Write information to the registry
|
||||
DXUtil_WriteStringRegKey( hDPlaySampleRegKey, TEXT("Player Name"), g_strLocalPlayerName );
|
||||
DXUtil_WriteStringRegKey( hDPlaySampleRegKey, TEXT("Session Name"), g_strSessionName );
|
||||
DXUtil_WriteStringRegKey( hDPlaySampleRegKey, TEXT("Preferred Provider"), g_strPreferredProvider );
|
||||
}
|
||||
}
|
||||
|
||||
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) ChatDlgProc );
|
||||
|
||||
if( FAILED( g_hrDialog ) )
|
||||
{
|
||||
if( g_hrDialog == DPNERR_CONNECTIONLOST )
|
||||
{
|
||||
MessageBox( NULL, TEXT("The DirectPlay session was lost. ")
|
||||
TEXT("The sample will now quit."),
|
||||
TEXT("DirectPlay Sample"), 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."),
|
||||
TEXT("DirectPlay Sample"), MB_OK | MB_ICONERROR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LCleanup:
|
||||
// Cleanup DirectPlay and helper classes
|
||||
g_pNetConnectWizard->Shutdown();
|
||||
|
||||
if( g_pDP )
|
||||
{
|
||||
g_pDP->Close(0);
|
||||
SAFE_RELEASE( g_pDP );
|
||||
}
|
||||
|
||||
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_pNetConnectWizard );
|
||||
|
||||
RegCloseKey( hDPlaySampleRegKey );
|
||||
DeleteCriticalSection( &g_csPlayerContext );
|
||||
CoUninitialize();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: InitDirectPlay()
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT InitDirectPlay()
|
||||
{
|
||||
DPNHANDLE hLobbyLaunchedConnection = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
// Create IDirectPlay8Peer
|
||||
if( FAILED( hr = CoCreateInstance( CLSID_DirectPlay8Peer, NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_IDirectPlay8Peer,
|
||||
(LPVOID*) &g_pDP ) ) )
|
||||
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_pNetConnectWizard->Init( g_pDP, g_pLobbiedApp );
|
||||
|
||||
// Init IDirectPlay8Peer
|
||||
if( FAILED( hr = g_pDP->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: ChatDlgProc()
|
||||
// Desc: Handles dialog messages
|
||||
//-----------------------------------------------------------------------------
|
||||
INT_PTR CALLBACK ChatDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch( msg )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
g_hDlg = hDlg;
|
||||
if( FAILED( g_hrDialog = OnInitDialog( hDlg ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("OnInitDialog"), g_hrDialog );
|
||||
EndDialog( hDlg, 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_CHAT:
|
||||
{
|
||||
HRESULT hr;
|
||||
DPNID dpnidPlayer = (DPNID) wParam;
|
||||
APP_PLAYER_INFO* pPlayerInfo = NULL;
|
||||
|
||||
PLAYER_LOCK(); // enter player context CS
|
||||
|
||||
// Get the player context accosicated with this DPNID
|
||||
hr = g_pDP->GetPlayerContext( dpnidPlayer,
|
||||
(LPVOID* const) &pPlayerInfo,
|
||||
0);
|
||||
|
||||
PLAYER_ADDREF( pPlayerInfo ); // addref player, since we are using it now
|
||||
PLAYER_UNLOCK(); // leave player context CS
|
||||
|
||||
APP_QUEUED_DATA* pQueuedData = (APP_QUEUED_DATA*) lParam;
|
||||
|
||||
if( FAILED(hr) || pPlayerInfo == NULL )
|
||||
{
|
||||
// The player who sent this may have gone away before this
|
||||
// message was handled, so just ignore it
|
||||
if( pQueuedData )
|
||||
{
|
||||
g_pDP->ReturnBuffer( pQueuedData->hBufferHandle,0 );
|
||||
SAFE_DELETE( pQueuedData );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Add the message to the local listbox
|
||||
HWND hWndChatBox = GetDlgItem( hDlg, IDC_CHAT_LISTBOX );
|
||||
int nCount = (int)SendMessage( hWndChatBox, LB_GETCOUNT, 0, 0 );
|
||||
if( nCount > MAX_CHAT_STRINGS )
|
||||
SendMessage( hWndChatBox, LB_DELETESTRING, 0, 0 );
|
||||
|
||||
// Make the chat string from the player's name and the edit box string
|
||||
TCHAR strChatBuffer[MAX_PLAYER_NAME + MAX_CHAT_STRING_LENGTH + 32];
|
||||
wsprintf( strChatBuffer, TEXT("<%s> %s"), pPlayerInfo->strPlayerName, pQueuedData->pChatMsg->strChatString );
|
||||
|
||||
PLAYER_LOCK(); // enter player context CS
|
||||
PLAYER_RELEASE( pPlayerInfo ); // Release player and cleanup if needed
|
||||
PLAYER_UNLOCK(); // leave player context CS
|
||||
|
||||
// Add it, and make sure it is visible
|
||||
int nIndex = (int)SendMessage( hWndChatBox, LB_ADDSTRING, 0, (LPARAM)strChatBuffer );
|
||||
SendMessage( hWndChatBox, LB_SETTOPINDEX, nIndex, 0 );
|
||||
|
||||
// Done with the buffer, so return it DirectPlay,
|
||||
// so that the memory can be reused
|
||||
g_pDP->ReturnBuffer( pQueuedData->hBufferHandle,0 );
|
||||
SAFE_DELETE( pQueuedData );
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
switch( LOWORD(wParam) )
|
||||
{
|
||||
case IDC_CHAT_EDIT:
|
||||
if( HIWORD(wParam) == EN_UPDATE )
|
||||
{
|
||||
BOOL bEnableSend;
|
||||
if( 0 == GetWindowTextLength( GetDlgItem( hDlg, IDC_CHAT_EDIT ) ) )
|
||||
bEnableSend = FALSE;
|
||||
else
|
||||
bEnableSend = TRUE;
|
||||
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_SEND ), bEnableSend );
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_SEND:
|
||||
// The enter key was pressed, so send out the chat message
|
||||
if( FAILED( g_hrDialog = SendChatMessage( hDlg ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("SendChatMessage"), g_hrDialog );
|
||||
EndDialog( hDlg, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
g_hrDialog = S_OK;
|
||||
EndDialog( hDlg, 0 );
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE; // Didn't handle message
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OnInitDialog()
|
||||
// Desc: Inits the dialog for the chat client.
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT OnInitDialog( HWND 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
|
||||
|
||||
// Display local player's name
|
||||
SetDlgItemText( hDlg, IDC_PLAYER_NAME, g_strLocalPlayerName );
|
||||
|
||||
PostMessage( hDlg, WM_APP_UPDATE_STATS, 0, 0 );
|
||||
SetFocus( GetDlgItem( hDlg, IDC_CHAT_EDIT ) );
|
||||
|
||||
SendMessage( GetDlgItem( hDlg, IDC_CHAT_EDIT ), EM_SETEVENTMASK, 0, ENM_UPDATE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_SEND ), FALSE );
|
||||
|
||||
if( g_pNetConnectWizard->IsHostPlayer() )
|
||||
SetWindowText( hDlg, TEXT("ChatPeer (Host)") );
|
||||
else
|
||||
SetWindowText( hDlg, TEXT("ChatPeer") );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: DirectPlayMessageHandler
|
||||
// Desc: Handler for DirectPlay messages. This function is called by
|
||||
// the DirectPlay message handler pool of threads, so be care 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
|
||||
// as this sample shows
|
||||
|
||||
// This function is called by the DirectPlay message handler pool of
|
||||
// threads, so be care of thread synchronization problems with shared memory
|
||||
|
||||
HRESULT hReturn = S_OK;
|
||||
|
||||
switch( dwMessageId )
|
||||
{
|
||||
case DPN_MSGID_CREATE_PLAYER:
|
||||
{
|
||||
HRESULT hr;
|
||||
PDPNMSG_CREATE_PLAYER pCreatePlayerMsg;
|
||||
pCreatePlayerMsg = (PDPNMSG_CREATE_PLAYER)pMsgBuffer;
|
||||
|
||||
// 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->dpnidPlayer = pCreatePlayerMsg->dpnidPlayer;
|
||||
pPlayerInfo->lRefCount = 1;
|
||||
|
||||
// Get the peer info and extract its name
|
||||
DWORD dwSize = 0;
|
||||
DPN_PLAYER_INFO* pdpPlayerInfo = NULL;
|
||||
hr = DPNERR_CONNECTING;
|
||||
|
||||
// GetPeerInfo might return DPNERR_CONNECTING when connecting,
|
||||
// so just keep calling it if it does
|
||||
while( hr == DPNERR_CONNECTING )
|
||||
hr = g_pDP->GetPeerInfo( pCreatePlayerMsg->dpnidPlayer, pdpPlayerInfo, &dwSize, 0 );
|
||||
|
||||
if( hr == DPNERR_BUFFERTOOSMALL )
|
||||
{
|
||||
pdpPlayerInfo = (DPN_PLAYER_INFO*) new BYTE[ dwSize ];
|
||||
ZeroMemory( pdpPlayerInfo, dwSize );
|
||||
pdpPlayerInfo->dwSize = sizeof(DPN_PLAYER_INFO);
|
||||
|
||||
hr = g_pDP->GetPeerInfo( pCreatePlayerMsg->dpnidPlayer, pdpPlayerInfo, &dwSize, 0 );
|
||||
if( SUCCEEDED(hr) )
|
||||
{
|
||||
// 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 GetPeerInfo()
|
||||
DXUtil_ConvertWideStringToGeneric( pPlayerInfo->strPlayerName,
|
||||
pdpPlayerInfo->pwszName, MAX_PLAYER_NAME );
|
||||
|
||||
if( pdpPlayerInfo->dwPlayerFlags & DPNPLAYER_LOCAL )
|
||||
g_dpnidLocalPlayer = pCreatePlayerMsg->dpnidPlayer;
|
||||
}
|
||||
|
||||
SAFE_DELETE_ARRAY( pdpPlayerInfo );
|
||||
}
|
||||
|
||||
// Tell DirectPlay to store this pPlayerInfo
|
||||
// pointer in the pvPlayerContext.
|
||||
pCreatePlayerMsg->pvPlayerContext = pPlayerInfo;
|
||||
|
||||
// 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;
|
||||
|
||||
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_HOST_MIGRATE:
|
||||
{
|
||||
PDPNMSG_HOST_MIGRATE pHostMigrateMsg;
|
||||
pHostMigrateMsg = (PDPNMSG_HOST_MIGRATE)pMsgBuffer;
|
||||
|
||||
if( pHostMigrateMsg->dpnidNewHost == g_dpnidLocalPlayer )
|
||||
SetWindowText( g_hDlg, TEXT("ChatPeer (Host)") );
|
||||
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;
|
||||
if( NULL == pPlayerInfo )
|
||||
break;
|
||||
|
||||
GAMEMSG_GENERIC* pMsg = (GAMEMSG_GENERIC*) pReceiveMsg->pReceiveData;
|
||||
if( pMsg->nType == GAME_MSGID_CHAT )
|
||||
{
|
||||
// This message is sent when a player has send a chat message 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.
|
||||
GAMEMSG_CHAT* pChatMessage = (GAMEMSG_CHAT*) pMsg;
|
||||
|
||||
// Record the buffer handle so the buffer can be returned later
|
||||
APP_QUEUED_DATA* pQueuedData = new APP_QUEUED_DATA;
|
||||
pQueuedData->hBufferHandle = pReceiveMsg->hBufferHandle;
|
||||
pQueuedData->pChatMsg = pChatMessage;
|
||||
|
||||
// Pass the APP_QUEUED_DATA to the main dialog thread, so it can
|
||||
// process it. It will also cleanup the struct
|
||||
PostMessage( g_hDlg, WM_APP_CHAT,
|
||||
pPlayerInfo->dpnidPlayer, (LPARAM) pQueuedData );
|
||||
|
||||
// Tell DirectPlay to assume that ownership of the buffer
|
||||
// has been transferred to the application, and so it will
|
||||
// neither free nor modify it until ownership is returned
|
||||
// to DirectPlay through the ReturnBuffer() call.
|
||||
hReturn = DPNSUCCESS_PENDING;
|
||||
}
|
||||
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( hReturn != DPNSUCCESS_PENDING && SUCCEEDED(hReturn) && g_pNetConnectWizard )
|
||||
hReturn = g_pNetConnectWizard->MessageHandler( pvUserContext, dwMessageId, pMsgBuffer );
|
||||
|
||||
return hReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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_pNetConnectWizard )
|
||||
return g_pNetConnectWizard->LobbyMessageHandler( pvUserContext, dwMessageId,
|
||||
pMsgBuffer );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: SendChatMessage()
|
||||
// Desc: Create chat string based on the editbox and send it to everyone
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT SendChatMessage( HWND hDlg )
|
||||
{
|
||||
// Get length of item text
|
||||
DWORD dwEditboxBufferSize = (DWORD)SendDlgItemMessage( hDlg, IDC_CHAT_EDIT,
|
||||
WM_GETTEXTLENGTH, 0, 0 );
|
||||
if( dwEditboxBufferSize == 0 )
|
||||
return S_OK; // Don't do anything for blank messages
|
||||
|
||||
GAMEMSG_CHAT msgChat;
|
||||
msgChat.nType = GAME_MSGID_CHAT;
|
||||
GetDlgItemText( hDlg, IDC_CHAT_EDIT, msgChat.strChatString, MAX_CHAT_STRING_LENGTH );
|
||||
|
||||
// Set the dwBufferSize to only send the string that has valid text in it.
|
||||
// Otherwise bandwidth is wasted.
|
||||
DPN_BUFFER_DESC bufferDesc;
|
||||
bufferDesc.dwBufferSize = sizeof(msgChat.nType) +
|
||||
(_tcslen(msgChat.strChatString)+1)*sizeof(TCHAR);
|
||||
bufferDesc.pBufferData = (BYTE*) &msgChat;
|
||||
|
||||
// Send it to all of the players include the local client
|
||||
// DirectPlay will tell via the message handler
|
||||
// if there are any severe errors, so ignore any errors
|
||||
DPNHANDLE hAsync;
|
||||
g_pDP->SendTo( DPNID_ALL_PLAYERS_GROUP, &bufferDesc, 1,
|
||||
0, NULL, &hAsync, DPNSEND_GUARANTEED );
|
||||
|
||||
// Blank out edit box
|
||||
SetDlgItemText( hDlg, IDC_CHAT_EDIT, TEXT("") );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
204
Library/dxx8/samples/Multimedia/DirectPlay/ChatPeer/chatpeer.dsp
Normal file
@@ -0,0 +1,204 @@
|
||||
# Microsoft Developer Studio Project File - Name="ChatPeer" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=ChatPeer - 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 "ChatPeer.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 "ChatPeer.mak" CFG="ChatPeer - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "ChatPeer - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "ChatPeer - Win32 Release Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "ChatPeer - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "ChatPeer - 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)" == "ChatPeer - 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 "." /I "..\..\common\include" /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)" == "ChatPeer - 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" /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)" == "ChatPeer - 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" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /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)" == "ChatPeer - 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 "." /I "..\..\common\include" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /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 "ChatPeer - Win32 Release"
|
||||
# Name "ChatPeer - Win32 Debug"
|
||||
# Name "ChatPeer - Win32 Debug Unicode"
|
||||
# Name "ChatPeer - Win32 Release Unicode"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ChatPeer.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=.\ChatPeer.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\directx.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# 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\NetConnect.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\NetConnect.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\netconnectres.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readme.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
199
Library/dxx8/samples/Multimedia/DirectPlay/ChatPeer/chatpeer.rc
Normal file
@@ -0,0 +1,199 @@
|
||||
//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_MULTIPLAYER_CONNECT DIALOG DISCARDABLE 0, 0, 282, 151
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Multiplayer Connect"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "Player Name:",IDC_STATIC,7,10,43,8
|
||||
EDITTEXT IDC_PLAYER_NAME_EDIT,7,22,268,14,ES_AUTOHSCROLL
|
||||
LTEXT "Connection Type:",IDC_STATIC,7,41,57,8
|
||||
LISTBOX IDC_CONNECTION_LIST,7,53,268,72,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
DEFPUSHBUTTON "OK",IDOK,171,130,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,225,130,50,14
|
||||
END
|
||||
|
||||
IDD_MULTIPLAYER_GAMES DIALOG DISCARDABLE 0, 0, 282, 140
|
||||
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:",-1,7,15,69,8
|
||||
CONTROL "Start Search",IDC_SEARCH_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
BS_PUSHLIKE | WS_TABSTOP,220,7,55,14
|
||||
LISTBOX IDC_GAMES_LIST,7,24,268,91,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Join",IDC_JOIN,7,119,50,14
|
||||
PUSHBUTTON "Create",IDC_CREATE,61,119,50,14
|
||||
PUSHBUTTON "Cancel",IDC_BACK,225,119,50,14
|
||||
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
|
||||
|
||||
IDD_MULTIPLAYER_CREATE DIALOG DISCARDABLE 0, 0, 186, 77
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Create Game"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_SESSION_NAME,7,19,172,14,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,7,56,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,129,56,50,14
|
||||
LTEXT "Game Name:",IDC_STATIC,7,7,42,8
|
||||
CONTROL "Migrate Host",IDC_MIGRATE_HOST,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,66,40,56,10
|
||||
END
|
||||
|
||||
IDD_MAIN_GAME DIALOG DISCARDABLE 0, 0, 262, 156
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "DirectPlay Chat Sample"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
PUSHBUTTON "Exit",IDCANCEL,199,16,50,14
|
||||
EDITTEXT IDC_CHAT_EDIT,14,130,184,14,ES_WANTRETURN
|
||||
LISTBOX IDC_CHAT_LISTBOX,14,34,235,95,WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Number of people in conversation:",IDC_STATIC,14,19,109,
|
||||
8
|
||||
LTEXT "0",IDC_NUM_PLAYERS,127,19,54,8
|
||||
DEFPUSHBUTTON "Send",IDC_SEND,199,130,50,14
|
||||
GROUPBOX "",IDC_STATIC,7,7,248,142
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_MULTIPLAYER_CONNECT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 275
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 144
|
||||
END
|
||||
|
||||
IDD_MULTIPLAYER_GAMES, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 275
|
||||
VERTGUIDE, 141
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 133
|
||||
END
|
||||
|
||||
IDD_LOBBY_WAIT_STATUS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 148
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 45
|
||||
END
|
||||
|
||||
IDD_MULTIPLAYER_CREATE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
VERTGUIDE, 94
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 70
|
||||
END
|
||||
|
||||
IDD_MAIN_GAME, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 255
|
||||
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
|
||||
|
||||
BIN
Library/dxx8/samples/Multimedia/DirectPlay/ChatPeer/directx.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,96 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Sample Name: ChatPeer Sample
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
ChatPeer is similar in form to SimplePeer. Once a player hosts or connects
|
||||
to a session, the players can chat with either other by passing text
|
||||
strings.
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\DirectPlay\ChatPeer
|
||||
|
||||
Executable: DXSDK\Samples\Multimedia\DirectPlay\Bin
|
||||
|
||||
User's Guide
|
||||
============
|
||||
Refer to User's Guide section of the SimplePeer sample.
|
||||
|
||||
Programming Notes
|
||||
=================
|
||||
The ChatPeer sample is very similar in form to the SimplePeer sample. For
|
||||
detailed programming notes on the basics this sample, refer to Programming
|
||||
Notes section of the SimplePeer sample.
|
||||
|
||||
The ChatPeer differs by letting clients send text strings to all players
|
||||
connected to the session.
|
||||
|
||||
* The "Send" button is pressed. See SendChatMessage().
|
||||
1. Retrieves the text string from the dialog.
|
||||
2. Fills a app defined struct, GAMEMSG_CHAT. This struct has
|
||||
a message type ID as the first BYTE. This lets our app
|
||||
figure out what type of app message they received, however
|
||||
ChatPeer only uses one app defined message. See StagedPeer
|
||||
for a more complex example of this process.
|
||||
3. Fills out a DPN_BUFFER_DESC struct using the GAMEMSG_CHAT buffer.
|
||||
4. Calls IDirectPlay8Peer::SendTo() with the DPN_BUFFER_DESC. It passes
|
||||
DPNID_ALL_PLAYERS_GROUP so this message goes to everyone.
|
||||
|
||||
* Handle DirectPlay system messages. See DirectPlayMessageHandler()
|
||||
|
||||
The ChatPeer handles the typical messages as described in the
|
||||
SimplePeer programming notes, and in addition:
|
||||
|
||||
- Upon DPN_MSGID_RECEIVE message:
|
||||
1. It casts pReceiveMsg->pReceiveData into a generic app defined
|
||||
structure, GAMEMSG_GENERIC. This helps to figure out what structure
|
||||
is really contained in pReceiveMsg->pReceiveData. For this simple
|
||||
example, if the ID is GAME_MSGID_CHAT it casts the buffer to a
|
||||
GAMEMSG_CHAT*.
|
||||
2. It then creates a new APP_QUEUED_DATA struct which contains a pointer
|
||||
to the GAMEMSG_CHAT buffer, and the a DirectPlay handle linked to the
|
||||
GAMEMSG_CHAT buffer.
|
||||
3. We then post a user defined message, WM_APP_CHAT, to the dialog thread
|
||||
with the lParam equal to a pointer to the APP_QUEUED_DATA struct and
|
||||
the wParam equal to the DPNID of the player who sent us the buffer.
|
||||
We post a message since this lets us return from the DirectPlay message
|
||||
handler quickly. In a complex game if the handler threads take too
|
||||
long its possible that a backlog of network data may arise.
|
||||
4. We return from DirectPlayMessageHandler() with the result code
|
||||
of DPNSUCCESS_PENDING. This error code tells DirectPlay that the buffer
|
||||
we got in the DPN_MSGID_RECEIVE message is still in use by our app.
|
||||
This allows us to not to have to copy the buffer, but instead pass a
|
||||
pointer of it off to a worker thread. This simple sample just uses
|
||||
the main dialog thread to process queued data. For a more complex
|
||||
example of this process see the DataRelay sample.
|
||||
|
||||
* Upon receiving WM_APP_CHAT in the message loop
|
||||
This is posted to the message loop by one DirectPlay message handler threads
|
||||
whenever we receive a chat message. See above for more detail. Here's what
|
||||
happens:
|
||||
|
||||
1. Cast the wParam to a DPNID. This is the player that sent the message.
|
||||
2. Calls IDirectPlay8Peer::GetPlayerContext(). This retrieves a user
|
||||
specified pointer (which we cast to a APP_PLAYER_INFO*) associated with
|
||||
this player. See the SimplePeer programming notes for more info on how
|
||||
this is setup. Also, note that since player can be deleted at any time,
|
||||
we need to use ref counting to make sure this player context struct isn't
|
||||
deleted while we are still using it.
|
||||
3. Cast the lParam into a APP_QUEUED_DATA*. This tells us the buffer, and the DirectPlay
|
||||
handle associated with that buffer.
|
||||
4. Process the buffer by adding it's text string to the dialog.
|
||||
5. Release the APP_PLAYER_INFO* since we are done using it.
|
||||
6. Now DirectPlay can free the receive buffer since we are done with it.
|
||||
So return the buffer to DirectPlay by calling IDirectPlay8Peer::ReturnBuffer,
|
||||
passing in the DirectPlay buffer handle.
|
||||
7. Deletes the APP_QUEUED_DATA from the heap
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by ChatPeer.rc
|
||||
//
|
||||
#define IDD_MAIN_GAME 101
|
||||
#define IDC_WAVE 1001
|
||||
#define IDC_NUM_PLAYERS 1002
|
||||
#define IDC_PLAYER_NAME 1003
|
||||
#define IDC_CHAT_EDIT 1010
|
||||
#define IDC_CHAT_LISTBOX 1012
|
||||
#define IDC_SEND 1034
|
||||
#define IDD_MULTIPLAYER_CONNECT 10001
|
||||
#define IDD_MULTIPLAYER_GAMES 10002
|
||||
#define IDD_MULTIPLAYER_CREATE 10003
|
||||
#define IDD_LOBBY_WAIT_STATUS 10004
|
||||
#define IDC_RETURN 11001
|
||||
#define IDC_PLAYER_NAME_EDIT 11002
|
||||
#define IDC_GAMES_LIST 11003
|
||||
#define IDC_JOIN 11004
|
||||
#define IDC_CREATE 11005
|
||||
#define IDC_CONNECTION_LIST 11006
|
||||
#define IDC_BACK 11007
|
||||
#define IDC_CHECK_DPLAY_PROTOCOL 11008
|
||||
#define IDC_EDIT_SESSION_NAME 11009
|
||||
#define IDC_SEARCH_CHECK 11010
|
||||
#define IDC_WAIT_TEXT 11012
|
||||
#define IDC_MIGRATE_HOST 11013
|
||||
#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 1004
|
||||
#define _APS_NEXT_SYMED_VALUE 103
|
||||
#endif
|
||||
#endif
|
||||
1689
Library/dxx8/samples/Multimedia/DirectPlay/DataRelay/datarelay.cpp
Normal file
@@ -0,0 +1,204 @@
|
||||
# Microsoft Developer Studio Project File - Name="DataRelay" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=DataRelay - 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 "datarelay.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 "datarelay.mak" CFG="DataRelay - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "DataRelay - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "DataRelay - Win32 Release Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "DataRelay - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "DataRelay - 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)" == "DataRelay - 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 "." /I "..\..\common\include" /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)" == "DataRelay - 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" /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)" == "DataRelay - 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" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /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)" == "DataRelay - 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 "." /I "..\..\common\include" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /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 "DataRelay - Win32 Release"
|
||||
# Name "DataRelay - Win32 Debug"
|
||||
# Name "DataRelay - Win32 Debug Unicode"
|
||||
# Name "DataRelay - Win32 Release Unicode"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DataRelay.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=.\DataRelay.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\directx.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# 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\NetConnect.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\NetConnect.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\netconnectres.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readme.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "DataRelay"=.\datarelay.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,378 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on datarelay.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=DataRelay - Win32 Debug Unicode
|
||||
!MESSAGE No configuration specified. Defaulting to DataRelay - Win32 Debug Unicode.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "DataRelay - Win32 Release" && "$(CFG)" != "DataRelay - Win32 Debug" && "$(CFG)" != "DataRelay - Win32 Debug Unicode" && "$(CFG)" != "DataRelay - 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 "datarelay.mak" CFG="DataRelay - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "DataRelay - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "DataRelay - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "DataRelay - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "DataRelay - 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)" == "DataRelay - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\datarelay.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\DataRelay.obj"
|
||||
-@erase "$(INTDIR)\DataRelay.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\NetConnect.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\datarelay.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\datarelay.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)\DataRelay.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\datarelay.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)\datarelay.pdb" /machine:I386 /out:"$(OUTDIR)\datarelay.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\DataRelay.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\NetConnect.obj" \
|
||||
"$(INTDIR)\DataRelay.res"
|
||||
|
||||
"$(OUTDIR)\datarelay.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "DataRelay - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\datarelay.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\DataRelay.obj"
|
||||
-@erase "$(INTDIR)\DataRelay.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\NetConnect.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\datarelay.exe"
|
||||
-@erase "$(OUTDIR)\datarelay.ilk"
|
||||
-@erase "$(OUTDIR)\datarelay.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\datarelay.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)\DataRelay.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\datarelay.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)\datarelay.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\datarelay.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\DataRelay.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\NetConnect.obj" \
|
||||
"$(INTDIR)\DataRelay.res"
|
||||
|
||||
"$(OUTDIR)\datarelay.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "DataRelay - Win32 Debug Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Debug_Unicode
|
||||
INTDIR=.\Win32_Debug_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Debug_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\datarelay.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\DataRelay.obj"
|
||||
-@erase "$(INTDIR)\DataRelay.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\NetConnect.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\datarelay.exe"
|
||||
-@erase "$(OUTDIR)\datarelay.ilk"
|
||||
-@erase "$(OUTDIR)\datarelay.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\datarelay.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)\DataRelay.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\datarelay.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)\datarelay.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\datarelay.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\DataRelay.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\NetConnect.obj" \
|
||||
"$(INTDIR)\DataRelay.res"
|
||||
|
||||
"$(OUTDIR)\datarelay.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "DataRelay - Win32 Release Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Release_Unicode
|
||||
INTDIR=.\Win32_Release_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Release_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\datarelay.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\DataRelay.obj"
|
||||
-@erase "$(INTDIR)\DataRelay.res"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\NetConnect.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\datarelay.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\datarelay.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)\DataRelay.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\datarelay.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)\datarelay.pdb" /machine:I386 /out:"$(OUTDIR)\datarelay.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\DataRelay.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\NetConnect.obj" \
|
||||
"$(INTDIR)\DataRelay.res"
|
||||
|
||||
"$(OUTDIR)\datarelay.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("datarelay.dep")
|
||||
!INCLUDE "datarelay.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "datarelay.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "DataRelay - Win32 Release" || "$(CFG)" == "DataRelay - Win32 Debug" || "$(CFG)" == "DataRelay - Win32 Debug Unicode" || "$(CFG)" == "DataRelay - Win32 Release Unicode"
|
||||
SOURCE=.\DataRelay.cpp
|
||||
|
||||
"$(INTDIR)\DataRelay.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\DataRelay.rc
|
||||
|
||||
"$(INTDIR)\DataRelay.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\NetConnect.cpp
|
||||
|
||||
"$(INTDIR)\NetConnect.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
//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_MULTIPLAYER_CONNECT DIALOG DISCARDABLE 0, 0, 282, 151
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Multiplayer Connect"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "Player Name:",IDC_STATIC,7,10,43,8
|
||||
EDITTEXT IDC_PLAYER_NAME_EDIT,7,22,268,14,ES_AUTOHSCROLL
|
||||
LTEXT "Connection Type:",IDC_STATIC,7,41,57,8
|
||||
LISTBOX IDC_CONNECTION_LIST,7,53,268,72,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
DEFPUSHBUTTON "OK",IDOK,171,130,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,225,130,50,14
|
||||
END
|
||||
|
||||
IDD_MULTIPLAYER_GAMES DIALOG DISCARDABLE 0, 0, 282, 140
|
||||
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:",-1,7,15,69,8
|
||||
CONTROL "Start Search",IDC_SEARCH_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
BS_PUSHLIKE | WS_TABSTOP,220,7,55,14
|
||||
LISTBOX IDC_GAMES_LIST,7,24,268,91,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Join",IDC_JOIN,7,119,50,14
|
||||
PUSHBUTTON "Create",IDC_CREATE,61,119,50,14
|
||||
PUSHBUTTON "Cancel",IDC_BACK,225,119,50,14
|
||||
END
|
||||
|
||||
IDD_MAIN_GAME DIALOGEX 0, 0, 343, 258
|
||||
STYLE DS_LOCALEDIT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Data Relay"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "Number of players in session:",IDC_STATIC,11,27,95,8
|
||||
LTEXT "0",IDC_NUM_PLAYERS,107,27,54,8
|
||||
GROUPBOX "Game Status",IDC_STATIC,7,7,329,33
|
||||
LTEXT "Local Player Name:",IDC_STATIC,11,17,62,8
|
||||
LTEXT "Test Player",IDC_PLAYER_NAME,76,17,84,8
|
||||
PUSHBUTTON "Exit",IDCANCEL,270,19,50,14
|
||||
GROUPBOX "Send",IDC_STATIC,7,43,128,84
|
||||
COMBOBOX IDC_SEND_TARGET_COMBO,57,54,73,140,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Target:",IDC_STATIC,11,56,43,8
|
||||
RTEXT "Rate (ms):",IDC_STATIC,11,90,43,8
|
||||
COMBOBOX IDC_SEND_RATE_COMBO,57,88,73,85,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_SEND_SIZE_COMBO,57,71,73,77,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Size (bytes):",IDC_STATIC,11,73,43,8
|
||||
GROUPBOX "Log",IDC_STATIC,7,161,329,88
|
||||
EDITTEXT IDC_LOG_EDIT,14,173,314,71,ES_MULTILINE | ES_READONLY
|
||||
CONTROL "Push to Send",IDC_SEND_READY,"Button",BS_AUTOCHECKBOX |
|
||||
BS_PUSHLIKE | WS_DISABLED | WS_TABSTOP,200,19,65,14
|
||||
GROUPBOX "Statistics",IDC_STATIC,7,128,127,32
|
||||
RTEXT "Total Send Rate:",IDC_STATIC,13,137,65,8
|
||||
RTEXT "Total Recieve Rate:",IDC_STATIC,13,145,65,8
|
||||
LTEXT "0.0 BPS",IDC_ACTUAL_SEND_RATE,82,137,50,8
|
||||
LTEXT "0.0 BPS",IDC_ACTUAL_RECIEVE_RATE,82,146,49,8
|
||||
COMBOBOX IDC_SEND_TIMEOUT_COMBO,57,105,73,140,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Timeout (ms):",IDC_STATIC,11,107,43,8
|
||||
GROUPBOX "Connection Info",IDC_CONNINFO,142,43,194,117
|
||||
EDITTEXT IDC_CONNINFO_EDIT,150,71,177,83,ES_MULTILINE |
|
||||
ES_READONLY | WS_VSCROLL
|
||||
COMBOBOX IDC_CONNINFO_COMBO,224,53,73,85,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Info Target:",IDC_STATIC,176,55,43,8,0,WS_EX_RIGHT
|
||||
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
|
||||
|
||||
IDD_MULTIPLAYER_CREATE DIALOG DISCARDABLE 0, 0, 186, 77
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Create Game"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_SESSION_NAME,7,19,172,14,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,7,56,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,129,56,50,14
|
||||
LTEXT "Game Name:",IDC_STATIC,7,7,42,8
|
||||
CONTROL "Migrate Host",IDC_MIGRATE_HOST,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,66,40,56,10
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_MULTIPLAYER_CONNECT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 275
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 144
|
||||
END
|
||||
|
||||
IDD_MULTIPLAYER_GAMES, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 275
|
||||
VERTGUIDE, 141
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 133
|
||||
END
|
||||
|
||||
IDD_MAIN_GAME, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 336
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 251
|
||||
END
|
||||
|
||||
IDD_LOBBY_WAIT_STATUS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 148
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 45
|
||||
END
|
||||
|
||||
IDD_MULTIPLAYER_CREATE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
VERTGUIDE, 94
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 70
|
||||
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
|
||||
|
||||
BIN
Library/dxx8/samples/Multimedia/DirectPlay/DataRelay/directx.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
126
Library/dxx8/samples/Multimedia/DirectPlay/DataRelay/readme.txt
Normal file
@@ -0,0 +1,126 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Sample Name: DataRelay Sample
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
The DataRelay is similar to SimplePeer but differs by sending a single
|
||||
target (or everyone) a packet of data with options specified in the
|
||||
dialog's UI. It uses a worker thread to process received data, and
|
||||
uses the ReturnBuffer() API so that no copying of the received buffers
|
||||
is done.
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\DirectPlay\DataRelay
|
||||
|
||||
Executable: DXSDK\Samples\Multimedia\DirectPlay\Bin
|
||||
|
||||
User's Guide
|
||||
============
|
||||
Host or connect to a session in the same manner as explained in SimplePeer.
|
||||
When the main dialog appears select the target, size, rate, and timeout values.
|
||||
Then click "Push to Send". This will send a packet of data to the target as
|
||||
the rate specified with the specified size. Use the "Connection Info" dropdown
|
||||
to specify a target to gather connection info on periodically.
|
||||
|
||||
Programming Notes
|
||||
=================
|
||||
The DataRelay sample is very similar in form to the SimplePeer sample. For
|
||||
detailed programming notes on the basics this sample, refer to Programming
|
||||
Notes section of the SimplePeer sample.
|
||||
|
||||
The DataRelay differs by sending a single target (or everyone) a packet of
|
||||
data with options specified in the dialog's UI.
|
||||
|
||||
When the "Push to Send" button is clicked, then win32 timer is created
|
||||
that goes off every number of ms according to the UI.
|
||||
|
||||
* Upon the WM_TIMER labeled TIMERID_NETWORK, it calls SendNetworkData().
|
||||
1. It creates a app defined struct, GAMEMSG_DATA_xxx on the heap.
|
||||
The struct derives from GAMEMSG_GENERIC. GAMEMSG_GENERIC contains a
|
||||
packet type field so that the reciever and identify this app defined
|
||||
packet, and it contains a packet ID field. This field is sequential
|
||||
and is displayed to the user whenever a packet is received. The struct
|
||||
is created on the heap, since will use the DPNSEND_NOCOPY when calling
|
||||
SendTo() below. The struct is filled with random data, however a real
|
||||
app would typically send player and world state data here.
|
||||
2. It then creates a GAMEMSG_DATA_NODE which is then handed off to the
|
||||
app worker thread. That thread will process the node, and
|
||||
then update the UI to show that a packet was sent. It is handed off
|
||||
by adding the node to a linked list. Since the worker thread also
|
||||
accesses the linked list, we enter a critical section before adding the
|
||||
node and leave it afterward.
|
||||
3. A DPN_BUFFER_DESC is then filled out passing in a pointer to the
|
||||
app defined struct created above.
|
||||
4. IDirectPlay8Peer::SendTo is called passing in the DPN_BUFFER_DESC, thereby
|
||||
sending the app defined struct, GAMEMSG_DATA_xxx. We call SendTo with
|
||||
the flags DPNSEND_NOLOOPBACK | DPNSEND_NOCOPY. DPNSEND_NOLOOPBACK tells
|
||||
DirectPlay to not to send the buffer to us, and DPNSEND_NOCOPY means that
|
||||
DirectPlay should not copy the buffer. When the DPNSEND_NOCOPY is used,
|
||||
the app itself owns the buffer, and the buffer must be on the heap.
|
||||
When the DPN_MSGID_SEND_COMPLETE comes in, we will delete the buffer.
|
||||
5. The event, g_hDPDataAvailEvent, is set telling the worker thread that
|
||||
there is data (a message to say that a packet was sent), is ready to
|
||||
be processed now.
|
||||
|
||||
* Handle DirectPlay system messages. See DirectPlayMessageHandler()
|
||||
The DataRelay handles the typical messages as described in the
|
||||
SimplePeer programming notes, and in addition:
|
||||
|
||||
- Upon DPN_MSGID_RECEIVE
|
||||
1. It casts the pReceiveMsg->pReceiveData to a GAMEMSG_GENERIC*.
|
||||
2. It then switches off the GAMEMSG_GENERIC's dwType.
|
||||
3. If its a GAME_MSGID_GAMEPACKET, then it creates and fills out
|
||||
a GAMEMSG_DATA_NODE. This node is then handed to a worker thread
|
||||
so it can be processed outside of the DirectPlay message handler.
|
||||
This is important since it keeps the DirectPlay threads working at
|
||||
full speed.
|
||||
4. After the node is added to the linked list using a critical section
|
||||
to lock, it returns DPNSUCCESS_PENDING. This is important since
|
||||
it tells DirectPlay that ownership of the buffer
|
||||
has been transferred to the application, and so DirectPlay will
|
||||
neither free nor modify it until ownership is returned
|
||||
to DirectPlay through the ReturnBuffer() call.
|
||||
|
||||
- Upon DPN_MSGID_SEND_COMPLETE
|
||||
1. It checks the pSendCompleteMsg->hResultCode for DPNERR_TIMEDOUT.
|
||||
2. If this occurs then it creates a new GAMEMSG_DATA_NODE with dwType
|
||||
set to DATA_TYPE_NETPACKET_TIMEOUT. This will is passed to the
|
||||
worker thread. The worker thread will process this node, and
|
||||
post a message to the dialog saying that the message timed out.
|
||||
A realistic application would want to take the appropriate steps here,
|
||||
such as resending new data or other measures.
|
||||
3. It deletes the buffer from the heap since we specified, DPNSEND_NOCOPY,
|
||||
so the buffer on the heap belows the app and it must clean it up.
|
||||
|
||||
* The worker thread. See ProcessNetDataProc()
|
||||
- Upon the g_hDPDataAvailEvent
|
||||
1. When the event is signaled, then new data can be found in the
|
||||
linked list, g_DataHead. So it calls ProcessData().
|
||||
2. ProcessData() first enters the critical section, g_csDataList, so
|
||||
that the other threads don't modify the linked list while it is
|
||||
processing data. It leaves this critical section at the end of the
|
||||
loop. Typically better locking mechanisms would be used so that the
|
||||
other threads (as well as the DirectPlay message handler threads)
|
||||
aren't blocked while data is processed on this thread.
|
||||
3. It runs through the linked list, processing each node. For this
|
||||
simple sample all it does is posting a message to the dialog thread,
|
||||
containing a string for the dialog to display.
|
||||
4. After it is done processing the node, it calls
|
||||
IDirectPlay8Peer::ReturnBuffer() so that DirectPlay can free
|
||||
buffer that it passed us in DPN_MSGID_RECEIVE.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by DataRelay.rc
|
||||
//
|
||||
#define IDD_MAIN_GAME 101
|
||||
#define IDC_NUM_PLAYERS 1002
|
||||
#define IDC_PLAYER_NAME 1003
|
||||
#define IDC_SEND_TARGET_COMBO 1012
|
||||
#define IDC_SEND_RATE_COMBO 1013
|
||||
#define IDC_SEND_SIZE_COMBO 1014
|
||||
#define IDC_SEND_TIMEOUT_COMBO 1015
|
||||
#define IDC_LOG_EDIT 1016
|
||||
#define IDC_SEND_READY 1017
|
||||
#define IDC_ACTUAL_SEND_RATE 1021
|
||||
#define IDC_ACTUAL_RECIEVE_RATE 1022
|
||||
#define IDC_CONNINFO 1023
|
||||
#define IDC_CONNINFO_EDIT 1024
|
||||
#define IDC_CONNINFO_COMBO 1025
|
||||
#define IDD_MULTIPLAYER_CONNECT 10001
|
||||
#define IDD_MULTIPLAYER_GAMES 10002
|
||||
#define IDD_MULTIPLAYER_CREATE 10003
|
||||
#define IDD_LOBBY_WAIT_STATUS 10004
|
||||
#define IDC_PLAYER_NAME_EDIT 11002
|
||||
#define IDC_GAMES_LIST 11003
|
||||
#define IDC_JOIN 11004
|
||||
#define IDC_CREATE 11005
|
||||
#define IDC_CONNECTION_LIST 11006
|
||||
#define IDC_BACK 11007
|
||||
#define IDC_EDIT_SESSION_NAME 11009
|
||||
#define IDC_SEARCH_CHECK 11010
|
||||
#define IDC_WAIT_TEXT 11012
|
||||
#define IDC_MIGRATE_HOST 11013
|
||||
#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 1025
|
||||
#define _APS_NEXT_SYMED_VALUE 103
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,144 @@
|
||||
//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_LOBBY_CLIENT DIALOG DISCARDABLE 0, 0, 332, 260
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "DirectPlay8 Lobby Client"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Launch Parameters",IDC_STATIC,7,7,318,163
|
||||
LTEXT "Registered Applications:",IDC_STATIC,15,16,77,8
|
||||
LISTBOX IDC_APP_LIST,16,25,95,137,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Player Name:",IDC_STATIC,117,27,55,8
|
||||
EDITTEXT IDC_PLAYER_NAME,178,25,140,12,ES_AUTOHSCROLL
|
||||
RTEXT "Session Name:",IDC_STATIC,117,45,55,8
|
||||
EDITTEXT IDC_SESSION_NAME,178,43,140,12,ES_AUTOHSCROLL
|
||||
RTEXT "Serivce Provider:",IDC_STATIC,117,62,55,8
|
||||
COMBOBOX IDC_SP_COMBO,178,60,140,65,CBS_DROPDOWNLIST | CBS_SORT |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "IP Address:",IDC_ADDRESS_LINE1_TEXT,117,79,55,8
|
||||
EDITTEXT IDC_ADDRESS_LINE1,178,77,68,12,ES_AUTOHSCROLL
|
||||
RTEXT "Port:",IDC_ADDRESS_LINE2_TEXT,249,79,24,8
|
||||
EDITTEXT IDC_ADDRESS_LINE2,275,77,43,12,ES_AUTOHSCROLL
|
||||
GROUPBOX "Launch method",IDC_STATIC,119,112,84,49
|
||||
CONTROL "Always launch",IDC_LAUNCH_NEW,"Button",
|
||||
BS_AUTORADIOBUTTON,123,122,61,10
|
||||
CONTROL "Launch if not found",IDC_LAUNCH_NOT_FOUND,"Button",
|
||||
BS_AUTORADIOBUTTON,123,134,77,10
|
||||
CONTROL "Do not launch",IDC_DONT_LAUNCH,"Button",
|
||||
BS_AUTORADIOBUTTON,123,146,61,10
|
||||
CONTROL "Host session",IDC_HOST_SESSION,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,208,118,56,10
|
||||
CONTROL "Do not send connection settings",IDC_NO_SETTINGS,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,208,130,118,10
|
||||
PUSHBUTTON "Launch App",IDC_LAUNCH,259,149,58,14
|
||||
GROUPBOX "Active Connections",IDC_STATIC,7,169,318,63
|
||||
LISTBOX IDC_ACTIVE_CONNECTIONS,13,183,96,40,LBS_SORT |
|
||||
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Send Message",IDC_SEND_MSG,121,184,58,14
|
||||
PUSHBUTTON "Disconnect",IDC_DISCONNECT,185,184,58,14
|
||||
LTEXT "Status:",IDC_STATIC,119,208,24,8
|
||||
EDITTEXT IDC_STATUS,152,205,161,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
PUSHBUTTON "Exit",IDCANCEL,267,239,58,14
|
||||
RTEXT "Adapter:",IDC_STATIC,117,96,55,8
|
||||
COMBOBOX IDC_ADAPTER_COMBO,178,94,140,65,CBS_DROPDOWNLIST |
|
||||
CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_LOBBY_CLIENT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 325
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 253
|
||||
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
|
||||
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,193 @@
|
||||
# Microsoft Developer Studio Project File - Name="LobbyClient" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=LobbyClient - 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 "lobbyclient.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 "lobbyclient.mak" CFG="LobbyClient - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "LobbyClient - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "LobbyClient - Win32 Release Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "LobbyClient - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "LobbyClient - 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)" == "LobbyClient - 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 "." /I "..\..\common\include" /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 ws2_32.lib wsock32.lib 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)" == "LobbyClient - 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" /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 wsock32.lib 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)" == "LobbyClient - 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" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /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 wsock32.lib 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 wsock32.lib 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)" == "LobbyClient - 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 "." /I "..\..\common\include" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /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 ws2_32.lib wsock32.lib 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 ws2_32.lib wsock32.lib 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 "LobbyClient - Win32 Release"
|
||||
# Name "LobbyClient - Win32 Debug"
|
||||
# Name "LobbyClient - Win32 Debug Unicode"
|
||||
# Name "LobbyClient - Win32 Release Unicode"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LobbyClient.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=.\LobbyClient.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# 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
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "LobbyClient"=.\LobbyClient.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,364 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on LobbyClient.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=LobbyClient - Win32 Debug Unicode
|
||||
!MESSAGE No configuration specified. Defaulting to LobbyClient - Win32 Debug Unicode.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "LobbyClient - Win32 Release" && "$(CFG)" != "LobbyClient - Win32 Debug" && "$(CFG)" != "LobbyClient - Win32 Debug Unicode" && "$(CFG)" != "LobbyClient - 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 "LobbyClient.mak" CFG="LobbyClient - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "LobbyClient - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "LobbyClient - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "LobbyClient - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "LobbyClient - 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)" == "LobbyClient - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\LobbyClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\LobbyClient.obj"
|
||||
-@erase "$(INTDIR)\LobbyClient.res"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\LobbyClient.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\LobbyClient.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)\LobbyClient.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\LobbyClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=ws2_32.lib wsock32.lib 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)\LobbyClient.pdb" /machine:I386 /out:"$(OUTDIR)\LobbyClient.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\LobbyClient.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\LobbyClient.res"
|
||||
|
||||
"$(OUTDIR)\LobbyClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "LobbyClient - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\LobbyClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\LobbyClient.obj"
|
||||
-@erase "$(INTDIR)\LobbyClient.res"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\LobbyClient.exe"
|
||||
-@erase "$(OUTDIR)\LobbyClient.ilk"
|
||||
-@erase "$(OUTDIR)\LobbyClient.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\LobbyClient.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)\LobbyClient.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\LobbyClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=wsock32.lib 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)\LobbyClient.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\LobbyClient.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\LobbyClient.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\LobbyClient.res"
|
||||
|
||||
"$(OUTDIR)\LobbyClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "LobbyClient - Win32 Debug Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Debug_Unicode
|
||||
INTDIR=.\Win32_Debug_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Debug_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\LobbyClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\LobbyClient.obj"
|
||||
-@erase "$(INTDIR)\LobbyClient.res"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\LobbyClient.exe"
|
||||
-@erase "$(OUTDIR)\LobbyClient.ilk"
|
||||
-@erase "$(OUTDIR)\LobbyClient.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\LobbyClient.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)\LobbyClient.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\LobbyClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=wsock32.lib 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)\LobbyClient.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\LobbyClient.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\LobbyClient.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\LobbyClient.res"
|
||||
|
||||
"$(OUTDIR)\LobbyClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "LobbyClient - Win32 Release Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Release_Unicode
|
||||
INTDIR=.\Win32_Release_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Release_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\LobbyClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\LobbyClient.obj"
|
||||
-@erase "$(INTDIR)\LobbyClient.res"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\LobbyClient.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I "..\..\common\include" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\LobbyClient.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)\LobbyClient.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\LobbyClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=ws2_32.lib wsock32.lib 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)\LobbyClient.pdb" /machine:I386 /out:"$(OUTDIR)\LobbyClient.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\LobbyClient.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\LobbyClient.res"
|
||||
|
||||
"$(OUTDIR)\LobbyClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("LobbyClient.dep")
|
||||
!INCLUDE "LobbyClient.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "LobbyClient.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "LobbyClient - Win32 Release" || "$(CFG)" == "LobbyClient - Win32 Debug" || "$(CFG)" == "LobbyClient - Win32 Debug Unicode" || "$(CFG)" == "LobbyClient - Win32 Release Unicode"
|
||||
SOURCE=.\LobbyClient.cpp
|
||||
|
||||
"$(INTDIR)\LobbyClient.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\LobbyClient.rc
|
||||
|
||||
"$(INTDIR)\LobbyClient.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Sample Name: LobbyClient Sample
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
LobbyClient is a simple lobby client. It displays all registered DirectPlay
|
||||
applications on the local system. It allows the
|
||||
user to launch one or more of these applications using a chosen
|
||||
service provider. A launched lobbied application may be told to either
|
||||
join or host a game.
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\DirectPlay\LobbyClient
|
||||
|
||||
Executable: DXSDK\Samples\Multimedia\DirectPlay\Bin
|
||||
|
||||
User's Guide
|
||||
============
|
||||
Choose launch settings from dialog, and click "Launch App". The
|
||||
lobby client will launch the app selected based on the settings in the UI.
|
||||
The active connections list will display the handle to all the current
|
||||
lobbied applications. Clicking on "Send Message" will send a lobby message
|
||||
to the lobbied application. This done mainly for demonstration purposes. A more
|
||||
complex lobby client may want to use this functionality in a more meaningful way
|
||||
by passing a message that the lobbied application responds to.
|
||||
|
||||
Programming Notes
|
||||
=================
|
||||
* Initialize DirectPlay. See InitDirectPlay()
|
||||
1. Init COM with CoInitialize()
|
||||
2. Create a IIDirectPlay8Peer with CoCreateInstance()
|
||||
3. Call IDirectPlay8Peer::Initialize to tell the interface about our
|
||||
message handler
|
||||
4. Create a IDirectPlay8LobbyClient with CoCreateInstance()
|
||||
5. Call IDirectPlay8LobbyClient::Initialize to tell the interface
|
||||
about our lobby message handler
|
||||
|
||||
|
||||
* Initialize dialog box. See OnInitDialog()
|
||||
1. Enumerate the registered lobbied applications and display them
|
||||
in the dialog listbox. See EnumRegisteredApplications()
|
||||
2. Enumerate the DirectPlay service providers and display them
|
||||
in the dialog listbox. See EnumServiceProviders()
|
||||
3. Whenever a new service provider is selected (and upon init) then
|
||||
enumerate the service provider's adapters. See EnumAdapters().
|
||||
|
||||
* When "Launch App" button is clicked. See LaunchApp()
|
||||
1. Fill out a DPL_CONNECT_INFO struct. This is complex
|
||||
since it contains the host and device addresses as well as
|
||||
the DPN_APPLICATION_DESC. See LaunchApp() and
|
||||
AllocAndInitConnectSettings().
|
||||
2. Call IDirectPlay8LobbyClient::ConnectApplication() passing in
|
||||
the DPL_CONNECT_INFO struct.
|
||||
3. Free the DPL_CONNECT_INFO struct. This is also complex since this
|
||||
struct has a number of DPlay addresses. See FreeConnectSettings().
|
||||
|
||||
* Upon DirectPlay Lobby messages. See DirectPlayLobbyMessageHandler()
|
||||
- Upon DPL_MSGID_DISCONNECT:
|
||||
pDisconnectMsg->hDisconnectId will contain the handle of the
|
||||
lobbied application that was disconnected, and
|
||||
pDisconnectMsg->hrReason will be the reason. This simple
|
||||
sample just pops up a message box.
|
||||
- Upon DPL_MSGID_RECEIVE:
|
||||
The lobbied application sent the client data. This simple sample
|
||||
doesn't respond to any message.
|
||||
- Upon DPL_MSGID_SESSION_STATUS:
|
||||
A lobbied application has changed its status. pStatusMsg->hSender
|
||||
will one of several predefined status codes. This simple
|
||||
sample just updated the UI showing that the lobby status has
|
||||
updated, however more complex lobby clients many want to take action.
|
||||
- Upon DPL_MSGID_CONNECTION_SETTINGS:
|
||||
A lobbied application has changed its connection settings. This
|
||||
simple lobby client doesn't take any action however, more complex
|
||||
clients may want to take action.
|
||||
|
||||
* When "Send Message" is clicked. See SendMsgToApp()
|
||||
Call IDirectPlay8LobbyClient::Send() with the handle of the
|
||||
lobbied application to send the message to, and the buffer to send.
|
||||
|
||||
* When "Disconnect" is clicked. See DisconnectFromApp()
|
||||
Call IDirectPlay8LobbyClient::ReleaseApplication() with the handle of
|
||||
lobbied application to disconnect from.
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by LobbyClient.rc
|
||||
//
|
||||
#define IDD_LOBBY_CLIENT 101
|
||||
#define IDC_SP_COMBO 1005
|
||||
#define IDC_SESSION_NAME 1006
|
||||
#define IDC_PLAYER_NAME 1007
|
||||
#define IDC_ADAPTER_COMBO 1008
|
||||
#define IDC_ADDRESS_LINE1 1011
|
||||
#define IDC_STATUS 1013
|
||||
#define IDC_LAUNCH 1014
|
||||
#define IDC_ACTIVE_CONNECTIONS 1017
|
||||
#define IDC_APP_LIST 1018
|
||||
#define IDC_DISCONNECT 1019
|
||||
#define IDC_SEND_MSG 1020
|
||||
#define IDC_HOST_SESSION 1021
|
||||
#define IDC_NO_SETTINGS 1022
|
||||
#define IDC_ADDRESS_LINE2 1024
|
||||
#define IDC_ADDRESS_LINE1_TEXT 1025
|
||||
#define IDC_ADDRESS_LINE2_TEXT 1026
|
||||
#define IDC_LAUNCH_NEW 1029
|
||||
#define IDC_LAUNCH_NOT_FOUND 1030
|
||||
#define IDC_DONT_LAUNCH 1031
|
||||
#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 1030
|
||||
#define _APS_NEXT_SYMED_VALUE 103
|
||||
#endif
|
||||
#endif
|
||||
|
After Width: | Height: | Size: 65 KiB |
@@ -0,0 +1,151 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: d3dgraphics.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _MAZE_GRAPHICS_H
|
||||
#define _MAZE_GRAPHICS_H
|
||||
|
||||
|
||||
|
||||
class CMazeApp;
|
||||
|
||||
struct VERTEX_TEXURED
|
||||
{
|
||||
D3DXVECTOR3 vPos;
|
||||
D3DXVECTOR3 vNormal;
|
||||
FLOAT fU, fV;
|
||||
};
|
||||
#define FVF_TEXTURED (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
|
||||
|
||||
|
||||
struct VERTEX_DIFFUSE
|
||||
{
|
||||
D3DXVECTOR3 vPos;
|
||||
DWORD dwDiffuse;
|
||||
};
|
||||
#define FVF_DIFFUSE (D3DFVF_XYZ|D3DFVF_DIFFUSE)
|
||||
|
||||
|
||||
struct VERTEX_TL_DIFFUSE
|
||||
{
|
||||
D3DXVECTOR3 vPos;
|
||||
float fRHW;
|
||||
DWORD dwDiffuse;
|
||||
};
|
||||
#define FVF_TL_DIFFUSE (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)
|
||||
|
||||
|
||||
struct VERTEX_TL_TEXTURED
|
||||
{
|
||||
D3DXVECTOR3 vPos;
|
||||
float fRHW;
|
||||
DWORD dwDiffuse;
|
||||
DWORD dwSpecular;
|
||||
FLOAT fU, fV;
|
||||
};
|
||||
#define FVF_TL_TEXTURED (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_SPECULAR|D3DFVF_TEX1)
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CD3DGraphics : public IMazeGraphics, public CD3DScreensaver
|
||||
{
|
||||
public:
|
||||
CD3DGraphics();
|
||||
~CD3DGraphics();
|
||||
|
||||
// From IMazeGraphics
|
||||
virtual VOID Init( CMazeApp* pMazeApp, CDPlay8Client* pDP8Client, CMazeClient* pMazeClient );
|
||||
virtual HRESULT Create( HINSTANCE hInstance );
|
||||
virtual INT Run();
|
||||
virtual void HandleOutputMsg( EnumLineType enumLineType, TCHAR* strLine );
|
||||
virtual BOOL IsPreview() { return m_bIsPreview; };
|
||||
virtual void Shutdown();
|
||||
|
||||
virtual BOOL GetFloatWinInfo() { return FALSE; }
|
||||
virtual VOID SetDevice( UINT iDevice ) { }
|
||||
virtual HRESULT ConfirmDevice(D3DCAPS8*,DWORD,D3DFORMAT);
|
||||
virtual HRESULT OneTimeSceneInit();
|
||||
virtual HRESULT InitDeviceObjects();
|
||||
virtual HRESULT RestoreDeviceObjects();
|
||||
virtual HRESULT FrameMove();
|
||||
virtual HRESULT Render();
|
||||
virtual HRESULT InvalidateDeviceObjects();
|
||||
virtual HRESULT DeleteDeviceObjects();
|
||||
virtual HRESULT FinalCleanup();
|
||||
virtual LRESULT SaverProc( HWND hWnd , UINT message , WPARAM wParam , LPARAM lParam );
|
||||
|
||||
CMazeApp* m_pMazeApp;
|
||||
CDPlay8Client* m_pDP8Client;
|
||||
CMazeClient* m_pMazeClient;
|
||||
|
||||
protected:
|
||||
static INT_PTR CALLBACK StaticSaverConfigDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||
INT_PTR CALLBACK SaverConfigDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
HRESULT PostCreate();
|
||||
int ScreenSaverDoConfig( BOOL bIsScreenSaverSettings );
|
||||
void ExtractSaverConfigDlgSettings( HWND hDlg );
|
||||
void PopulateSaverConfigDlg( HWND hDlg );
|
||||
HRESULT CreateTextureFromResource( INT nResource, LPDIRECT3DTEXTURE8* ppTexture );
|
||||
void ComputeCameraMatrix();
|
||||
|
||||
void DrawFloor();
|
||||
void DrawWalls();
|
||||
void DrawCeiling();
|
||||
void DrawMiniMap();
|
||||
void DrawPlayers();
|
||||
void DrawIndicators();
|
||||
void LoadQuad( VERTEX_TEXURED* pVerts, WORD* pwIndex, WORD wOffset,
|
||||
const D3DXVECTOR3& vOrigin, const D3DXVECTOR3& vBasis1,
|
||||
const D3DXVECTOR3& vBasis2, const D3DXVECTOR3& vNormal );
|
||||
|
||||
HINSTANCE m_hInstance;
|
||||
|
||||
MazeConfig* m_pConfig;
|
||||
|
||||
BOOL m_bIsPreview;
|
||||
BOOL m_bIsScreenSaverSettings;
|
||||
|
||||
DWORD m_dwStartMode;
|
||||
DWORD m_dwAppFlags;
|
||||
HWND m_hRefWindow;
|
||||
|
||||
CD3DFont* m_pFont;
|
||||
CD3DFont* m_pStatsFont;
|
||||
|
||||
SmartVB<VERTEX_TEXURED,FVF_TEXTURED,1000> m_SmartVB;
|
||||
LPDIRECT3DVERTEXBUFFER8 m_pMiniMapVB;
|
||||
LPDIRECT3DVERTEXBUFFER8 m_pMiniMapBackgroundVB;
|
||||
LPDIRECT3DVERTEXBUFFER8 m_pIndicatorVB;
|
||||
|
||||
D3DXMATRIX m_Projection;
|
||||
D3DXMATRIX m_Camera;
|
||||
|
||||
D3DXVECTOR3 m_vCameraPos;
|
||||
FLOAT m_fCameraYaw;
|
||||
|
||||
D3DLIGHT8 m_Light;
|
||||
|
||||
LPDIRECT3DTEXTURE8 m_pWallTexture;
|
||||
LPDIRECT3DTEXTURE8 m_pFloorTexture;
|
||||
LPDIRECT3DTEXTURE8 m_pCeilingTexture;
|
||||
LPDIRECT3DTEXTURE8 m_pNetIconTexture;
|
||||
LPDIRECT3DTEXTURE8 m_pLocalIconTexture;
|
||||
|
||||
ID3DXMesh* m_pSphere;
|
||||
CD3DFile* m_pPlayerMesh;
|
||||
DWORD m_dwTesselation;
|
||||
|
||||
enum { MAX_VISLIST = 300 };
|
||||
MazeCellRef m_mcrVisList[MAX_VISLIST];
|
||||
DWORD m_dwNumVisibleCells;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 192 KiB |
@@ -0,0 +1,55 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File:
|
||||
//
|
||||
// Desc:
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _FRAMERATE_H
|
||||
#define _FRAMERATE_H
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CFrameRate
|
||||
{
|
||||
public:
|
||||
CFrameRate() { Reset(); };
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_dwCount = m_dwLastFrameCount = 0;
|
||||
m_fLastAppTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
m_fRate = 0;
|
||||
};
|
||||
|
||||
void DoneFrame()
|
||||
{
|
||||
m_dwCount++;
|
||||
FLOAT fCurTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
if ( (fCurTime - m_fLastAppTime) >= 1.0f )
|
||||
{
|
||||
m_fRate = (float(m_dwCount - m_dwLastFrameCount) / (fCurTime - m_fLastAppTime));
|
||||
m_fLastAppTime = fCurTime;
|
||||
m_dwLastFrameCount = m_dwCount;
|
||||
}
|
||||
};
|
||||
|
||||
float GetRate() const { return m_fRate; };
|
||||
DWORD GetCount() const { return m_dwCount; };
|
||||
|
||||
protected:
|
||||
DWORD m_dwCount;
|
||||
float m_fRate;
|
||||
FLOAT m_fLastAppTime;
|
||||
DWORD m_dwLastFrameCount;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,47 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: main.cpp
|
||||
//
|
||||
// Desc: This is a DirectPlay 8 client/server sample. The client comes in two flavors.
|
||||
// A console based version, and a D3D client. The D3D client can optionally
|
||||
// be run as screen saver by simply copying mazeclient.exe to your
|
||||
// \winnt\system32\ and renaming it to mazeclient.scr. This will make
|
||||
// it a screen saver that will be detected by the display control panel.
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#define D3D_OVERLOADS
|
||||
#include <windows.h>
|
||||
#include <D3DX8.h>
|
||||
#include <dplay8.h>
|
||||
#include "DXUtil.h"
|
||||
#include "SyncObjects.h"
|
||||
#include "IMazeGraphics.h"
|
||||
#include "DummyConnector.h"
|
||||
#include "D3DFont.h"
|
||||
#include "D3DUtil.h"
|
||||
#include "D3DFile.h"
|
||||
#include "SmartVB.h"
|
||||
#include "MazeApp.h"
|
||||
#include "MazeServer.h"
|
||||
#include "d3dsaver.h"
|
||||
#include "D3DGraphics.h"
|
||||
|
||||
|
||||
CMazeApp g_MazeApp;
|
||||
CD3DGraphics g_D3DGraphics;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int )
|
||||
{
|
||||
if( FAILED( g_MazeApp.Create( &g_D3DGraphics ) ) )
|
||||
return 0;
|
||||
|
||||
return g_MazeApp.Run( hInstance );
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
# Microsoft Developer Studio Project File - Name="MazeClient" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=MazeClient - 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 "MazeClient.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 "MazeClient.mak" CFG="MazeClient - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "MazeClient - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MazeClient - Win32 Release Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MazeClient - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MazeClient - 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)" == "MazeClient - 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 "..\mazecommon" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# 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 d3dx8dt.lib d3d8.lib d3dxof.lib 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)" == "MazeClient - 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 "..\mazecommon" /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 d3dx8dt.lib d3d8.lib d3dxof.lib 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)" == "MazeClient - 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 "..\mazecommon" /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 "..\mazecommon" /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 d3dx8dt.lib d3d8.lib d3dxof.lib 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 d3dx8dt.lib d3d8.lib d3dxof.lib 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)" == "MazeClient - 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 "..\mazecommon" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# 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 ddraw.lib d3dx.lib 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 d3dx8dt.lib d3d8.lib d3dxof.lib 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 "MazeClient - Win32 Release"
|
||||
# Name "MazeClient - Win32 Debug"
|
||||
# Name "MazeClient - Win32 Debug Unicode"
|
||||
# Name "MazeClient - Win32 Release Unicode"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\D3DGraphics.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\D3DGraphics.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Main.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\SmartVB.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\src\d3dfile.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\include\d3dfile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\src\d3dfont.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\include\d3dfont.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\src\d3dsaver.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\include\d3dsaver.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\src\d3dutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\common\include\d3dutil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\dplay8client.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\dplay8client.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\MazeCommon\DummyConnector.h
|
||||
# End Source File
|
||||
# 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=..\MazeCommon\imazegraphics.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Maze.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Maze.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\MazeCommon\MazeApp.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\MazeCommon\MazeApp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\MazeClient.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\MazeClient.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MazeGraphics.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\MazeServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\MazeServer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\NetAbstract.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Packets.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Random.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\SimpleStack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\StressMazeGuid.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\SyncObjects.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Trig.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Vector2.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CeilingTexture.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DirectX.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FloorTexture.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Font.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LocalIcon.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mazeclient.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\NetIcon.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\PlayerIcon.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\WallTexture.bmp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\readme.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tank.x
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "MazeClient"=.\MazeClient.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,503 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on MazeClient.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=MazeClient - Win32 Debug Unicode
|
||||
!MESSAGE No configuration specified. Defaulting to MazeClient - Win32 Debug Unicode.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "MazeClient - Win32 Release" && "$(CFG)" != "MazeClient - Win32 Debug" && "$(CFG)" != "MazeClient - Win32 Debug Unicode" && "$(CFG)" != "MazeClient - 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 "MazeClient.mak" CFG="MazeClient - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "MazeClient - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MazeClient - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MazeClient - Win32 Debug Unicode" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MazeClient - 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)" == "MazeClient - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\d3dfile.obj"
|
||||
-@erase "$(INTDIR)\d3dfont.obj"
|
||||
-@erase "$(INTDIR)\D3DGraphics.obj"
|
||||
-@erase "$(INTDIR)\d3dsaver.obj"
|
||||
-@erase "$(INTDIR)\d3dutil.obj"
|
||||
-@erase "$(INTDIR)\dplay8client.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeApp.obj"
|
||||
-@erase "$(INTDIR)\MazeClient.obj"
|
||||
-@erase "$(INTDIR)\mazeclient.res"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\MazeClient.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /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)\mazeclient.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=d3dx8dt.lib d3d8.lib d3dxof.lib 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)\MazeClient.pdb" /machine:I386 /out:"$(OUTDIR)\MazeClient.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\D3DGraphics.obj" \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\d3dfile.obj" \
|
||||
"$(INTDIR)\d3dfont.obj" \
|
||||
"$(INTDIR)\d3dsaver.obj" \
|
||||
"$(INTDIR)\d3dutil.obj" \
|
||||
"$(INTDIR)\dplay8client.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeApp.obj" \
|
||||
"$(INTDIR)\MazeClient.obj" \
|
||||
"$(INTDIR)\MazeServer.obj" \
|
||||
"$(INTDIR)\mazeclient.res"
|
||||
|
||||
"$(OUTDIR)\MazeClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeClient - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\d3dfile.obj"
|
||||
-@erase "$(INTDIR)\d3dfont.obj"
|
||||
-@erase "$(INTDIR)\D3DGraphics.obj"
|
||||
-@erase "$(INTDIR)\d3dsaver.obj"
|
||||
-@erase "$(INTDIR)\d3dutil.obj"
|
||||
-@erase "$(INTDIR)\dplay8client.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeApp.obj"
|
||||
-@erase "$(INTDIR)\MazeClient.obj"
|
||||
-@erase "$(INTDIR)\mazeclient.res"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\MazeClient.exe"
|
||||
-@erase "$(OUTDIR)\MazeClient.ilk"
|
||||
-@erase "$(OUTDIR)\MazeClient.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 "..\mazecommon" /D "_WINDOWS" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /Fp"$(INTDIR)\MazeClient.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)\mazeclient.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=d3dx8dt.lib d3d8.lib d3dxof.lib 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)\MazeClient.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\MazeClient.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\D3DGraphics.obj" \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\d3dfile.obj" \
|
||||
"$(INTDIR)\d3dfont.obj" \
|
||||
"$(INTDIR)\d3dsaver.obj" \
|
||||
"$(INTDIR)\d3dutil.obj" \
|
||||
"$(INTDIR)\dplay8client.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeApp.obj" \
|
||||
"$(INTDIR)\MazeClient.obj" \
|
||||
"$(INTDIR)\MazeServer.obj" \
|
||||
"$(INTDIR)\mazeclient.res"
|
||||
|
||||
"$(OUTDIR)\MazeClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeClient - Win32 Debug Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Debug_Unicode
|
||||
INTDIR=.\Win32_Debug_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Debug_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\d3dfile.obj"
|
||||
-@erase "$(INTDIR)\d3dfont.obj"
|
||||
-@erase "$(INTDIR)\D3DGraphics.obj"
|
||||
-@erase "$(INTDIR)\d3dsaver.obj"
|
||||
-@erase "$(INTDIR)\d3dutil.obj"
|
||||
-@erase "$(INTDIR)\dplay8client.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeApp.obj"
|
||||
-@erase "$(INTDIR)\MazeClient.obj"
|
||||
-@erase "$(INTDIR)\mazeclient.res"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\MazeClient.exe"
|
||||
-@erase "$(OUTDIR)\MazeClient.ilk"
|
||||
-@erase "$(OUTDIR)\MazeClient.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 "..\mazecommon" /D "_DEBUG" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /Fp"$(INTDIR)\MazeClient.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)\mazeclient.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=d3dx8dt.lib d3d8.lib d3dxof.lib 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)\MazeClient.pdb" /debug /machine:I386 /nodefaultlib:"LIBC" /out:"$(OUTDIR)\MazeClient.exe" /pdbtype:sept /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\D3DGraphics.obj" \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\d3dfile.obj" \
|
||||
"$(INTDIR)\d3dfont.obj" \
|
||||
"$(INTDIR)\d3dsaver.obj" \
|
||||
"$(INTDIR)\d3dutil.obj" \
|
||||
"$(INTDIR)\dplay8client.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeApp.obj" \
|
||||
"$(INTDIR)\MazeClient.obj" \
|
||||
"$(INTDIR)\MazeServer.obj" \
|
||||
"$(INTDIR)\mazeclient.res"
|
||||
|
||||
"$(OUTDIR)\MazeClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeClient - Win32 Release Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Release_Unicode
|
||||
INTDIR=.\Win32_Release_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Release_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\d3dfile.obj"
|
||||
-@erase "$(INTDIR)\d3dfont.obj"
|
||||
-@erase "$(INTDIR)\D3DGraphics.obj"
|
||||
-@erase "$(INTDIR)\d3dsaver.obj"
|
||||
-@erase "$(INTDIR)\d3dutil.obj"
|
||||
-@erase "$(INTDIR)\dplay8client.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeApp.obj"
|
||||
-@erase "$(INTDIR)\MazeClient.obj"
|
||||
-@erase "$(INTDIR)\mazeclient.res"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\MazeClient.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_MBCS" /D "_WINDOWS" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /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)\mazeclient.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=d3dx8dt.lib d3d8.lib d3dxof.lib 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)\MazeClient.pdb" /machine:I386 /out:"$(OUTDIR)\MazeClient.exe" /stack:0x10000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\D3DGraphics.obj" \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\d3dfile.obj" \
|
||||
"$(INTDIR)\d3dfont.obj" \
|
||||
"$(INTDIR)\d3dsaver.obj" \
|
||||
"$(INTDIR)\d3dutil.obj" \
|
||||
"$(INTDIR)\dplay8client.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeApp.obj" \
|
||||
"$(INTDIR)\MazeClient.obj" \
|
||||
"$(INTDIR)\MazeServer.obj" \
|
||||
"$(INTDIR)\mazeclient.res"
|
||||
|
||||
"$(OUTDIR)\MazeClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("MazeClient.dep")
|
||||
!INCLUDE "MazeClient.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "MazeClient.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "MazeClient - Win32 Release" || "$(CFG)" == "MazeClient - Win32 Debug" || "$(CFG)" == "MazeClient - Win32 Debug Unicode" || "$(CFG)" == "MazeClient - Win32 Release Unicode"
|
||||
SOURCE=.\D3DGraphics.cpp
|
||||
|
||||
"$(INTDIR)\D3DGraphics.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\Main.cpp
|
||||
|
||||
"$(INTDIR)\Main.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=..\..\..\common\src\d3dfile.cpp
|
||||
|
||||
"$(INTDIR)\d3dfile.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\..\common\src\d3dfont.cpp
|
||||
|
||||
"$(INTDIR)\d3dfont.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\..\common\src\d3dsaver.cpp
|
||||
|
||||
"$(INTDIR)\d3dsaver.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\..\common\src\d3dutil.cpp
|
||||
|
||||
"$(INTDIR)\d3dutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\mazecommon\dplay8client.cpp
|
||||
|
||||
"$(INTDIR)\dplay8client.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\..\common\src\dxutil.cpp
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\mazecommon\Maze.cpp
|
||||
|
||||
"$(INTDIR)\Maze.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\MazeCommon\MazeApp.cpp
|
||||
|
||||
"$(INTDIR)\MazeApp.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\mazecommon\MazeClient.cpp
|
||||
|
||||
"$(INTDIR)\MazeClient.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\mazecommon\MazeServer.cpp
|
||||
|
||||
"$(INTDIR)\MazeServer.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\mazeclient.rc
|
||||
|
||||
"$(INTDIR)\mazeclient.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
//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
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_FLOORTEXTURE BITMAP DISCARDABLE "FloorTexture.bmp"
|
||||
IDB_WALLTEXTURE BITMAP DISCARDABLE "WallTexture.bmp"
|
||||
IDB_CEILINGTEXTURE BITMAP DISCARDABLE "CeilingTexture.bmp"
|
||||
IDB_NETICON BITMAP DISCARDABLE "NetIcon.bmp"
|
||||
IDB_LOCALICON BITMAP DISCARDABLE "LocalIcon.bmp"
|
||||
IDB_TANK XFILE DISCARDABLE "tank.x"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_SAVERCONFIG DIALOG DISCARDABLE 0, 0, 236, 201
|
||||
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "DirectPlayMaze Configuration"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Network",IDC_STATIC,7,7,222,94
|
||||
GROUPBOX "Choose One",IDC_STATIC,15,16,208,58
|
||||
CONTROL "DirectPlayMaze.rte.microsoft.com",IDC_MICROSOFT,"Button",
|
||||
BS_AUTORADIOBUTTON,24,28,121,10
|
||||
CONTROL "Local Server (Search Local Subnet)",IDC_LOCAL_SERVER,
|
||||
"Button",BS_AUTORADIOBUTTON,24,41,140,10
|
||||
CONTROL "Remote Server at:",IDC_REMOTE_SERVER,"Button",
|
||||
BS_AUTORADIOBUTTON,24,54,73,10
|
||||
EDITTEXT IDC_IPADDRESS,101,53,111,12,ES_AUTOHSCROLL
|
||||
LTEXT "Reconnect Delay (min):",IDC_STATIC,18,83,77,8
|
||||
EDITTEXT IDC_RETRY_DELAY,95,81,24,12,ES_AUTOHSCROLL | ES_NUMBER
|
||||
GROUPBOX "Options",IDC_STATIC,7,106,222,69
|
||||
CONTROL "Show Framerate",IDC_FRAMERATE,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,18,117,65,10
|
||||
CONTROL "Show Connection Status",IDC_INDICATORS,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,120,117,99,10
|
||||
CONTROL "Draw Mini-Map",IDC_MINIMAP,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,18,130,60,10
|
||||
CONTROL "Full Screen",IDC_FULLSCREEN,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,120,130,51,10
|
||||
CONTROL "Reflections",IDC_REFLECTIONS,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,18,143,54,10
|
||||
CONTROL "File Logging",IDC_FILELOGGING,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,120,143,54,10
|
||||
DEFPUSHBUTTON "Launch",IDC_LAUNCH,7,180,50,14
|
||||
PUSHBUTTON "OK",IDOK,124,180,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,179,180,50,14
|
||||
PUSHBUTTON "&Display Settings...",IDC_SCREENSETTINGS,152,155,70,14
|
||||
END
|
||||
|
||||
IDD_SINGLEMONITORSETTINGS DIALOG DISCARDABLE 0, 0, 255, 170
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Display Settings"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Video adapter",IDC_STATIC,7,7,241,69
|
||||
LTEXT "Name:",IDC_STATIC,13,18,33,8
|
||||
LTEXT "",IDC_ADAPTERNAME,57,18,159,8
|
||||
LTEXT "Rendering:",IDC_STATIC,13,31,36,8
|
||||
LTEXT "",IDC_RENDERING,57,31,130,17
|
||||
PUSHBUTTON "&Help",IDC_MOREINFO,194,33,50,14
|
||||
CONTROL "&Disable hardware 3D rendering",IDC_DISABLEHW,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,14,54,215,10
|
||||
GROUPBOX "Display mode",IDC_DISPLAYMODEBOX,7,84,241,55
|
||||
LTEXT "Display &mode for this video adapter:",IDC_MODESSTATIC,
|
||||
13,95,126,8
|
||||
COMBOBOX IDC_MODESCOMBO,144,93,100,133,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Note: The Automatic display mode finds a mode that works well with your current screen saver settings and video adapter.",
|
||||
IDC_DISPLAYMODENOTE,13,109,227,27
|
||||
LTEXT "Automatic",IDC_AUTOMATIC,184,126,32,8,NOT WS_VISIBLE
|
||||
LTEXT "%d by %d, %d bit color",IDC_MODEFMT,13,152,71,8,NOT
|
||||
WS_VISIBLE
|
||||
DEFPUSHBUTTON "OK",IDOK,143,148,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,197,148,50,14
|
||||
END
|
||||
|
||||
IDD_MULTIMONITORSETTINGS DIALOG DISCARDABLE 0, 0, 270, 236
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Display Settings"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "Monitor %d",IDC_TABNAMEFMT,214,8,32,8,NOT WS_VISIBLE
|
||||
GROUPBOX "Video adapter",IDC_STATIC,13,23,244,65
|
||||
LTEXT "Name:",IDC_STATIC,19,35,40,8
|
||||
LTEXT "",IDC_ADAPTERNAME,65,35,168,8
|
||||
LTEXT "Rendering:",IDC_STATIC,19,48,40,8
|
||||
LTEXT "",IDC_RENDERING,65,48,132,17
|
||||
PUSHBUTTON "&Help",IDC_MOREINFO,202,49,50,14
|
||||
CONTROL "&Disable hardware 3D rendering on this monitor",
|
||||
IDC_DISABLEHW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,
|
||||
71,215,10
|
||||
GROUPBOX "Monitor usage",IDC_SCREENUSAGEBOX,13,94,244,44
|
||||
CONTROL "Display &screen saver on this monitor",IDC_RENDER,
|
||||
"Button",BS_AUTORADIOBUTTON,19,107,200,10
|
||||
CONTROL "Display ¬hing on this monitor",IDC_LEAVEBLACK,"Button",
|
||||
BS_AUTORADIOBUTTON,19,120,200,10
|
||||
GROUPBOX "Display mode",IDC_DISPLAYMODEBOX,13,146,244,55
|
||||
LTEXT "Display &mode for this video adapter:",IDC_MODESSTATIC,
|
||||
19,158,126,8
|
||||
COMBOBOX IDC_MODESCOMBO,152,156,100,133,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Note: The Automatic display mode finds a mode that works well with your current screen saver settings and video adapter.",
|
||||
IDC_DISPLAYMODENOTE,19,173,232,22
|
||||
LTEXT "Automatic",IDC_AUTOMATIC,193,182,32,8,NOT WS_VISIBLE
|
||||
LTEXT "%d by %d, %d bit color",IDC_MODEFMT,22,221,71,8,NOT
|
||||
WS_VISIBLE
|
||||
DEFPUSHBUTTON "OK",IDOK,159,216,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,213,216,50,14
|
||||
CONTROL "Tab1",IDC_MONITORSTAB,"SysTabControl32",WS_TABSTOP,7,7,
|
||||
256,201
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_SAVERCONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 229
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 194
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_MAIN_ICON ICON DISCARDABLE "DirectX.ico"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DESCRIPTION "3D FlowerBox"
|
||||
END
|
||||
|
||||
STRINGTABLE PRELOAD DISCARDABLE
|
||||
BEGIN
|
||||
IDS_ERR_GENERIC "There was an unspecified problem with this screen saver."
|
||||
IDS_ERR_NODIRECT3D "Direct3D 8.0 could not be initialized. Please install the latest version of DirectX."
|
||||
IDS_ERR_NOWINDOWEDHAL "Could not initialize the screen saver."
|
||||
IDS_ERR_CREATEDEVICEFAILED "Could not create the Direct3D device."
|
||||
IDS_ERR_NOCOMPATIBLEDEVICES
|
||||
"Could not find any compatible Direct3D devices."
|
||||
IDS_ERR_NOHARDWAREDEVICE
|
||||
"No hardware-accelerated Direct3D devices were found."
|
||||
IDS_ERR_HALNOTCOMPATIBLE
|
||||
"This screen saver requires functionality that is not available on your Direct3D hardware accelerator."
|
||||
IDS_ERR_NOHALTHISMODE "This screen saver requires functionality that is not available on your Direct3D hardware accelerator with the current desktop display settings."
|
||||
IDS_ERR_MEDIANOTFOUND "Could not load required media."
|
||||
IDS_ERR_RESIZEFAILED "Could not reset the Direct3D device."
|
||||
IDS_ERR_OUTOFMEMORY "Not enough memory."
|
||||
IDS_ERR_OUTOFVIDEOMEMORY "Not enough video memory."
|
||||
IDS_ERR_NOPREVIEW "No preview available"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_INFO_GOODHAL "This video adapter supports hardware 3D rendering. This screen saver can be displayed on this monitor."
|
||||
IDS_INFO_BADHAL_GOODSW "This video adapter supports hardware 3D rendering, but this screensaver requires functionality not available in hardware. A software renderer will be used instead. This screen saver can be displayed on this monitor."
|
||||
IDS_INFO_BADHAL_BADSW "This video adapter supports hardware 3D rendering, but this screensaver requires functionality not available in hardware or software. This screen saver cannot be displayed on this monitor."
|
||||
IDS_INFO_BADHAL_NOSW "This video adapter supports hardware 3D rendering, but this screensaver requires functionality not available in hardware. No software renderer is available. This screen saver cannot be displayed on this monitor."
|
||||
IDS_INFO_NOHAL_GOODSW "This video adapter does not support hardware 3D rendering. A software renderer will be used instead. This screen saver can be displayed on this monitor."
|
||||
IDS_INFO_NOHAL_BADSW "This video adapter does not support hardware 3D rendering. This screensaver requires functionality not available in the software renderer. This screen saver cannot be displayed on this monitor."
|
||||
IDS_INFO_NOHAL_NOSW "This video adapter does not support hardware 3D rendering. No software renderer is available. This screen saver cannot be displayed on this monitor."
|
||||
IDS_INFO_DISABLEDHAL_GOODSW
|
||||
"The video adapter supports hardware 3D rendering, but it has been disabled. A software renderer will be used instead. This screen saver can be displayed on this monitor."
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_INFO_DISABLEDHAL_BADSW
|
||||
"This video adapter supports hardware 3D rendering, but it has been disabled. This screensaver requires functionality not available in the software renderer. This screen saver cannot be displayed on this monitor."
|
||||
IDS_INFO_DISABLEDHAL_NOSW
|
||||
"This video adapter supports hardware 3D rendering, but it has been disabled. No software renderer is available. This screen saver cannot be displayed on this monitor."
|
||||
IDS_RENDERING_HAL "The screen saver can use hardware 3D rendering on this monitor."
|
||||
IDS_RENDERING_SW "The screen saver can use software 3D rendering on this monitor."
|
||||
IDS_RENDERING_NONE "The screen saver cannot be displayed on this monitor."
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,300 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: SmartVB.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _SMARTVB_H
|
||||
#define _SMARTVB_H
|
||||
|
||||
|
||||
#include "DXUtil.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
// Smart vertex buffer template class. This performs the usual NOOVERWRITE/DISCARDCONTENTS
|
||||
// filling loop. Simply call Begin(), then multiple instances of MakeRoom() to be given
|
||||
// pointers to where to store vertex and index data, then End() when done. The class
|
||||
// automatically flushes rendering as the buffer fills.
|
||||
//
|
||||
// By default rendering is performed by calling DrawIndexedPrimitive with a TRIANGELIST
|
||||
// consisting of the submitted data, but the client can supply a callback if more complex
|
||||
// rendering is required (perhaps for multipass?).
|
||||
typedef void (__stdcall *SmartVBRenderCallback)( LPDIRECT3DVERTEXBUFFER8 pVB,
|
||||
DWORD dwStartVertex,
|
||||
DWORD dwNumVertices,
|
||||
LPDIRECT3DINDEXBUFFER8 pIB,
|
||||
DWORD dwStartIndex,
|
||||
DWORD dwIndexCount,
|
||||
void* pParam );
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
template< class VertType, DWORD VertFVF, DWORD NumIndex > class SmartVB
|
||||
{
|
||||
public:
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
SmartVB() : m_pVB(NULL), m_pd3dDevice(NULL), m_pIB(NULL)
|
||||
{
|
||||
SetRenderCallback();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
~SmartVB()
|
||||
{
|
||||
Uninit();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT Init( IDirect3D8* pD3D, IDirect3DDevice8* pDevice, DWORD dwNumVerts )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
Uninit();
|
||||
|
||||
m_dwNumVerts = dwNumVerts;
|
||||
m_pd3dDevice = pDevice;
|
||||
|
||||
if( m_pd3dDevice )
|
||||
m_pd3dDevice->AddRef();
|
||||
else
|
||||
return E_INVALIDARG;
|
||||
|
||||
m_pNextIndex = NULL;
|
||||
m_dwNextIndex = 0;
|
||||
if( FAILED( hr = m_pd3dDevice->CreateIndexBuffer( NumIndex * sizeof(WORD),
|
||||
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, D3DFMT_INDEX16,
|
||||
D3DPOOL_DEFAULT, &m_pIB ) ) )
|
||||
return hr;
|
||||
|
||||
m_pNextVert = NULL;
|
||||
m_dwNextVert = 0;
|
||||
DWORD dwFVFSize = D3DXGetFVFVertexSize( VertFVF );
|
||||
if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( dwFVFSize * dwNumVerts,
|
||||
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, VertFVF,
|
||||
D3DPOOL_DEFAULT, &m_pVB ) ) )
|
||||
return hr;
|
||||
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void Uninit()
|
||||
{
|
||||
SAFE_RELEASE( m_pVB );
|
||||
SAFE_RELEASE( m_pIB );
|
||||
SAFE_RELEASE( m_pd3dDevice );
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Set rendering callback. Passing NULL for the callback gets you a default
|
||||
// call to DrawIndexedPrimitive. pParam is passed through to the callback.
|
||||
//-----------------------------------------------------------------------------
|
||||
void SetRenderCallback( SmartVBRenderCallback pCallback = NULL, void* pParam = NULL )
|
||||
{
|
||||
if ( pCallback != NULL )
|
||||
{
|
||||
m_pCallback = pCallback;
|
||||
m_pCallbackParam = pParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pCallback = DefaultRenderCallback;
|
||||
m_pCallbackParam = this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT Begin()
|
||||
{
|
||||
// Check we haven't already begun
|
||||
if ( m_pNextVert != NULL && m_pNextIndex != NULL )
|
||||
return E_FAIL;
|
||||
|
||||
// Lock buffer, use D3DLOCK_DISCARD flag
|
||||
m_pVB->Lock( 0, 0, (BYTE**)&m_pNextVert, D3DLOCK_DISCARD );
|
||||
m_pNextVert += m_dwNextVert;
|
||||
m_dwFirstVert = m_dwNextVert;
|
||||
m_dwVertexCount = 0;
|
||||
|
||||
m_pIB->Lock( 0, 0, (BYTE**)&m_pNextIndex, D3DLOCK_DISCARD );
|
||||
m_pNextIndex += m_dwNextIndex;
|
||||
m_dwFirstIndex = m_dwNextIndex;
|
||||
m_dwIndexCount = 0;
|
||||
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Request space to submit data, may cause a 'flush' for rendering
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT MakeRoom( DWORD dwNumVert, DWORD dwNumIndex, VertType** pVertPtr,
|
||||
WORD** pIndexPtr, WORD* wIndexOffset )
|
||||
{
|
||||
Flush();
|
||||
// Have we room left in the buffer?
|
||||
if ( (dwNumVert + m_dwNextVert >= m_dwNumVerts) ||
|
||||
(dwNumIndex + m_dwNextIndex >= NumIndex) )
|
||||
{
|
||||
// Nope, so flush current batch
|
||||
Flush();
|
||||
|
||||
// Check we could fit this in at all
|
||||
if ( (dwNumVert > m_dwNumVerts) || (dwNumIndex > NumIndex) )
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
// Got room, so just return position in buffer
|
||||
*pVertPtr = m_pNextVert;
|
||||
*pIndexPtr = m_pNextIndex;
|
||||
*wIndexOffset = WORD(m_dwVertexCount);
|
||||
|
||||
// Update position
|
||||
m_pNextVert += dwNumVert;
|
||||
m_dwNextVert += dwNumVert;
|
||||
m_dwVertexCount += dwNumVert;
|
||||
|
||||
m_pNextIndex += dwNumIndex;
|
||||
m_dwNextIndex += dwNumIndex;
|
||||
m_dwIndexCount += dwNumIndex;
|
||||
|
||||
// Done
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: End data filling, and submit for rendering via callback
|
||||
//-----------------------------------------------------------------------------
|
||||
void End()
|
||||
{
|
||||
// Unlock VB
|
||||
m_pVB->Unlock();
|
||||
m_pIB->Unlock();
|
||||
|
||||
// Submit for rendering
|
||||
if ( m_dwVertexCount > 0 && m_dwIndexCount > 0 )
|
||||
m_pCallback( m_pVB, m_dwFirstVert, m_dwVertexCount,
|
||||
m_pIB, m_dwFirstIndex, m_dwIndexCount,
|
||||
m_pCallbackParam );
|
||||
|
||||
m_pNextVert = NULL;
|
||||
m_pNextIndex = NULL;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Flush data if we overflowed
|
||||
//-----------------------------------------------------------------------------
|
||||
void Flush()
|
||||
{
|
||||
// Unlock VB
|
||||
m_pVB->Unlock();
|
||||
m_pIB->Unlock();
|
||||
|
||||
// Submit for rendering
|
||||
if ( m_dwVertexCount > 0 && m_dwIndexCount > 0 )
|
||||
m_pCallback( m_pVB, m_dwFirstVert, m_dwVertexCount,
|
||||
m_pIB, m_dwFirstIndex, m_dwIndexCount,
|
||||
m_pCallbackParam );
|
||||
|
||||
// Lock VB again
|
||||
m_pVB->Lock( 0, 0, (BYTE**)&m_pNextVert, D3DLOCK_DISCARD );
|
||||
m_dwFirstVert = 0;
|
||||
m_dwVertexCount = 0;
|
||||
m_dwNextVert = 0;
|
||||
|
||||
m_pIB->Lock( 0, 0, (BYTE**)&m_pNextIndex, D3DLOCK_DISCARD );
|
||||
m_dwFirstIndex = 0;
|
||||
m_dwIndexCount = 0;
|
||||
m_dwNextIndex = 0;
|
||||
};
|
||||
|
||||
protected:
|
||||
IDirect3DDevice8* m_pd3dDevice;
|
||||
DWORD m_dwNumVerts;
|
||||
|
||||
SmartVBRenderCallback m_pCallback;
|
||||
void* m_pCallbackParam;
|
||||
|
||||
// Current position of 'write cursor' in buffer
|
||||
LPDIRECT3DINDEXBUFFER8 m_pIB;
|
||||
WORD* m_pNextIndex;
|
||||
DWORD m_dwNextIndex;
|
||||
DWORD m_dwFirstIndex;
|
||||
|
||||
LPDIRECT3DVERTEXBUFFER8 m_pVB;
|
||||
VertType* m_pNextVert;
|
||||
DWORD m_dwNextVert;
|
||||
DWORD m_dwFirstVert;
|
||||
|
||||
// Counts of vertices and indicies in the current batch
|
||||
DWORD m_dwVertexCount;
|
||||
DWORD m_dwIndexCount;
|
||||
|
||||
static void __stdcall DefaultRenderCallback( LPDIRECT3DVERTEXBUFFER8 pVB,
|
||||
DWORD dwStartVertex,
|
||||
DWORD dwNumVertices,
|
||||
LPDIRECT3DINDEXBUFFER8 pIB,
|
||||
DWORD dwStartIndex,
|
||||
DWORD dwIndexCount,
|
||||
void* pParam )
|
||||
{
|
||||
((SmartVB*)pParam)->m_pd3dDevice->SetVertexShader( VertFVF );
|
||||
((SmartVB*)pParam)->m_pd3dDevice->SetStreamSource( 0, pVB, sizeof(VertType) );
|
||||
((SmartVB*)pParam)->m_pd3dDevice->SetIndices( pIB, 0 );
|
||||
((SmartVB*)pParam)->m_pd3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, dwStartVertex,
|
||||
dwNumVertices, dwStartIndex, dwIndexCount/3 );
|
||||
};
|
||||
|
||||
private:
|
||||
SmartVB( const SmartVB& );
|
||||
void operator=( const SmartVB& );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File:
|
||||
//
|
||||
// Desc:
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
After Width: | Height: | Size: 768 KiB |
@@ -0,0 +1,93 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by MazeClient.rc
|
||||
//
|
||||
#define IDS_DESCRIPTION 1
|
||||
#define IDI_MAIN_ICON 101
|
||||
#define IDD_SINGLEMONITORSETTINGS 200
|
||||
#define IDD_MULTIMONITORSETTINGS 201
|
||||
|
||||
#define IDC_MONITORSTAB 2000
|
||||
#define IDC_TABNAMEFMT 2001
|
||||
#define IDC_ADAPTERNAME 2002
|
||||
#define IDC_RENDERING 2003
|
||||
#define IDC_MOREINFO 2004
|
||||
#define IDC_DISABLEHW 2005
|
||||
#define IDC_SCREENUSAGEBOX 2006
|
||||
#define IDC_RENDER 2007
|
||||
#define IDC_LEAVEBLACK 2008
|
||||
#define IDC_DISPLAYMODEBOX 2009
|
||||
#define IDC_MODESSTATIC 2010
|
||||
#define IDC_MODESCOMBO 2011
|
||||
#define IDC_AUTOMATIC 2012
|
||||
#define IDC_DISPLAYMODENOTE 2013
|
||||
#define IDC_GENERALBOX 2014
|
||||
#define IDC_SAME 2015
|
||||
#define IDC_MODEFMT 2016
|
||||
|
||||
#define IDS_ERR_GENERIC 2100
|
||||
#define IDS_ERR_NODIRECT3D 2101
|
||||
#define IDS_ERR_NOWINDOWEDHAL 2102
|
||||
#define IDS_ERR_CREATEDEVICEFAILED 2103
|
||||
#define IDS_ERR_NOCOMPATIBLEDEVICES 2104
|
||||
#define IDS_ERR_NOHARDWAREDEVICE 2105
|
||||
#define IDS_ERR_HALNOTCOMPATIBLE 2106
|
||||
#define IDS_ERR_NOHALTHISMODE 2107
|
||||
#define IDS_ERR_MEDIANOTFOUND 2108
|
||||
#define IDS_ERR_RESIZEFAILED 2109
|
||||
#define IDS_ERR_OUTOFMEMORY 2110
|
||||
#define IDS_ERR_OUTOFVIDEOMEMORY 2111
|
||||
#define IDS_ERR_NOPREVIEW 2112
|
||||
|
||||
#define IDS_INFO_GOODHAL 2200
|
||||
#define IDS_INFO_BADHAL_GOODSW 2201
|
||||
#define IDS_INFO_BADHAL_BADSW 2202
|
||||
#define IDS_INFO_BADHAL_NOSW 2203
|
||||
#define IDS_INFO_NOHAL_GOODSW 2204
|
||||
#define IDS_INFO_NOHAL_BADSW 2205
|
||||
#define IDS_INFO_NOHAL_NOSW 2206
|
||||
#define IDS_INFO_DISABLEDHAL_GOODSW 2207
|
||||
#define IDS_INFO_DISABLEDHAL_BADSW 2208
|
||||
#define IDS_INFO_DISABLEDHAL_NOSW 2209
|
||||
#define IDS_RENDERING_HAL 2210
|
||||
#define IDS_RENDERING_SW 2211
|
||||
#define IDS_RENDERING_NONE 2212
|
||||
|
||||
|
||||
#define IDB_FLOORTEXTURE 102
|
||||
#define IDB_WALLTEXTURE 103
|
||||
#define IDB_CEILINGTEXTURE 104
|
||||
#define IDD_STARTUP 105
|
||||
#define IDD_SAVERCONFIG 106
|
||||
#define IDB_NETICON 107
|
||||
#define IDB_LOCALICON 108
|
||||
#define IDB_FONTTEXTURE 109
|
||||
#define IDB_TANK 110
|
||||
#define IDC_ENUMERATE 1001
|
||||
#define IDC_SESSIONLIST 1002
|
||||
#define IDC_IPADDRESS 1004
|
||||
#define IDC_REFLECTIONS 1007
|
||||
#define IDC_FRAMERATE 1008
|
||||
#define IDC_MINIMAP 1009
|
||||
#define IDC_INDICATORS 1010
|
||||
#define IDC_PREFER32BIT 1011
|
||||
#define IDC_FILELOGGING 1012
|
||||
#define IDC_LAUNCH 1013
|
||||
#define IDC_DPMAZE 1015
|
||||
#define IDC_FULLSCREEN 1018
|
||||
#define IDC_MICROSOFT 1019
|
||||
#define IDC_LOCAL_SERVER 1020
|
||||
#define IDC_REMOTE_SERVER 1021
|
||||
#define IDC_RETRY_DELAY 1023
|
||||
#define IDC_SCREENSETTINGS 1024
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 112
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1025
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
1589
Library/dxx8/samples/Multimedia/DirectPlay/Maze/MazeClient/tank.x
Normal file
@@ -0,0 +1,133 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: dummyconnector.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _DUMMY_CONNECTOR_H
|
||||
#define _DUMMY_CONNECTOR_H
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "NetAbstract.h"
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CDummyConnectorServer : public IOutboundServer
|
||||
{
|
||||
public:
|
||||
CDummyConnectorServer() : m_pTarget(NULL),m_dwID(0) {};
|
||||
|
||||
void SetTarget( INetClient* ptarget )
|
||||
{
|
||||
m_pTarget = ptarget;
|
||||
};
|
||||
|
||||
// From IOutboundServer
|
||||
virtual HRESULT SendPacket( DWORD /*to*/ , void* data , DWORD size , BOOL /*guaranteed*/, DWORD /*dwTimeout*/ )
|
||||
{
|
||||
if ( m_pTarget )
|
||||
return m_pTarget->OnPacket( m_dwID , data , size );
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
virtual HRESULT GetConnectionInfo( DWORD dwID, TCHAR* strConnectionInfo )
|
||||
{
|
||||
_tcscpy( strConnectionInfo, TEXT("") );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
virtual HRESULT RejectClient( DWORD dwID, HRESULT hrReason )
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
INetClient* m_pTarget;
|
||||
DWORD m_dwID;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CDummyConnectorClient : public IOutboundClient
|
||||
{
|
||||
public:
|
||||
CDummyConnectorClient() : m_pTarget(NULL),m_dwID(0) {};
|
||||
|
||||
void SetTarget( INetServer* ptarget )
|
||||
{
|
||||
m_pTarget = ptarget;
|
||||
};
|
||||
|
||||
// Connect (sends an "add connection" message to target)
|
||||
void Connect( DWORD id )
|
||||
{
|
||||
m_dwID = id;
|
||||
if ( m_pTarget )
|
||||
m_pTarget->OnAddConnection( id );
|
||||
};
|
||||
|
||||
// Disconnect (sends a "remove connection" message to target
|
||||
void Disconnect( DWORD id )
|
||||
{
|
||||
if ( m_pTarget )
|
||||
m_pTarget->OnRemoveConnection( m_dwID );
|
||||
}
|
||||
|
||||
// From IOutboundClient
|
||||
virtual HRESULT SendPacket( void* data , DWORD size , BOOL /*guaranteed*/, DWORD /*dwTimeout*/ )
|
||||
{
|
||||
if ( m_pTarget )
|
||||
return m_pTarget->OnPacket( m_dwID , data , size );
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
virtual DWORD GetThroughputBPS()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual DWORD GetRoundTripLatencyMS()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual BOOL IsSessionLost() { return FALSE; };
|
||||
virtual DWORD GetSessionLostReason() { return 0; };
|
||||
|
||||
virtual HRESULT GetConnectionInfo( TCHAR* strConnectionInfo )
|
||||
{
|
||||
_tcscpy( strConnectionInfo, TEXT("") );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
INetServer* m_pTarget;
|
||||
DWORD m_dwID;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File:
|
||||
//
|
||||
// Desc:
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _IDPCLIENT_H
|
||||
#define _IDPCLIENT_H
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,395 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: maze.cpp
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#define D3D_OVERLOADS
|
||||
#include <windows.h>
|
||||
#include <d3dx.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <dplay8.h>
|
||||
#include <dpaddr.h>
|
||||
#include <dxerr8.h>
|
||||
#include "DXUtil.h"
|
||||
#include "Maze.h"
|
||||
#include "MazeServer.h"
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
CMaze::CMaze()
|
||||
{
|
||||
m_dwWidth = m_dwHeight = m_dwSeed = m_dwSize = 0;
|
||||
m_pMaze = NULL;
|
||||
m_dwMaxView = 15;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
CMaze::~CMaze()
|
||||
{
|
||||
if( m_pMaze != NULL )
|
||||
DXTRACE( TEXT("Warning: Destructing CMaze object without calling Empty()\n") );
|
||||
|
||||
Empty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMaze::Init( DWORD dwWidth, DWORD dwHeight, DWORD dwSeed )
|
||||
{
|
||||
HRESULT hr;
|
||||
CellNode* pCells = NULL;
|
||||
CellNode* pCellNode = NULL;
|
||||
DWORD dwNumWalls;
|
||||
WallNode* pWalls = NULL;
|
||||
WallNode* pWallNode = NULL;
|
||||
WallNode tempWall;
|
||||
DWORD dwIndex;
|
||||
DWORD i;
|
||||
|
||||
m_Random.Reset( dwSeed );
|
||||
|
||||
// Empty out any old data
|
||||
Empty();
|
||||
|
||||
// Store parameters and compute number of cells in the maze
|
||||
m_dwWidth = dwWidth;
|
||||
m_dwHeight = dwHeight;
|
||||
m_dwSeed = dwSeed;
|
||||
m_dwSize = m_dwWidth * m_dwHeight;
|
||||
|
||||
// Must be non-zero
|
||||
if( m_dwSize == 0 )
|
||||
{
|
||||
hr = E_INVALIDARG;
|
||||
DXTRACE_ERR( TEXT("Maze height and width need must be greater than 0"), E_INVALIDARG );
|
||||
goto LFail;
|
||||
}
|
||||
|
||||
// Validate maze size
|
||||
if( m_dwWidth > SERVER_MAX_WIDTH || m_dwHeight > SERVER_MAX_HEIGHT )
|
||||
{
|
||||
hr = E_INVALIDARG;
|
||||
DXTRACE_ERR( TEXT("Maze height and width must be less than 128"), E_INVALIDARG );
|
||||
goto LFail;
|
||||
}
|
||||
|
||||
if( (m_dwWidth % LOCK_GRID_SIZE) != 0 || (m_dwHeight % LOCK_GRID_SIZE) != 0 )
|
||||
{
|
||||
hr = E_INVALIDARG;
|
||||
DXTRACE_ERR( TEXT("Maze height and width need to be divisable by 16"), E_INVALIDARG );
|
||||
goto LFail;
|
||||
}
|
||||
|
||||
// Allocate maze, and initially make all walls solid
|
||||
m_pMaze = new BYTE[m_dwSize];
|
||||
if( m_pMaze == NULL )
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
DXTRACE_ERR( TEXT("new"), hr );
|
||||
goto LFail;
|
||||
}
|
||||
memset( m_pMaze, MAZE_WALL_ALL, m_dwSize );
|
||||
|
||||
// Okay, now we're going to generate the maze. We use Kruskal's algorithm, which
|
||||
// works by walking through the list of walls in a random order, removing a wall
|
||||
// if it would connect two previously (path-)disconnected cells. This guarantees
|
||||
// a fully connected maze (i.e. you can reach any cell from any other).
|
||||
|
||||
// Allocate and initialize temporary cell list
|
||||
pCells = new CellNode[m_dwSize];
|
||||
if( pCells == NULL )
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
DXTRACE_ERR( TEXT("new"), hr );
|
||||
goto LFail;
|
||||
}
|
||||
|
||||
pCellNode = pCells;
|
||||
for( i = 0; i < m_dwSize; i++ )
|
||||
{
|
||||
pCellNode->pNext = NULL;
|
||||
pCellNode->pPartition = pCellNode;
|
||||
pCellNode++;
|
||||
}
|
||||
|
||||
// Create list of walls
|
||||
dwNumWalls = ((m_dwWidth-1)*m_dwHeight)+((m_dwHeight-1)*m_dwWidth);
|
||||
pWalls = new WallNode[dwNumWalls];
|
||||
if( pWalls == NULL )
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
DXTRACE_ERR( TEXT("new"), hr );
|
||||
goto LFail;
|
||||
}
|
||||
|
||||
pWallNode = pWalls;
|
||||
for( i = 1; i < m_dwWidth; i++ )
|
||||
{
|
||||
for( DWORD j = 0; j < m_dwHeight; j++, pWallNode++ )
|
||||
{
|
||||
pWallNode->dwX = i;
|
||||
pWallNode->dwY = j;
|
||||
pWallNode->dwType = MAZE_WALL_WEST;
|
||||
}
|
||||
}
|
||||
for( i = 0; i < m_dwWidth; i++ )
|
||||
{
|
||||
for( DWORD j = 1; j < m_dwHeight; j++, pWallNode++ )
|
||||
{
|
||||
pWallNode->dwX = i;
|
||||
pWallNode->dwY = j;
|
||||
pWallNode->dwType = MAZE_WALL_NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
// Randomly permute the wall list
|
||||
for( i = dwNumWalls-1; i > 0; i-- )
|
||||
{
|
||||
dwIndex = m_Random.Get(i);
|
||||
tempWall = pWalls[dwIndex];
|
||||
pWalls[dwIndex] = pWalls[i];
|
||||
pWalls[i] = tempWall;
|
||||
}
|
||||
|
||||
// Walk through all the walls
|
||||
pWallNode = pWalls;
|
||||
for( i = 0; i < dwNumWalls; i++, pWallNode++ )
|
||||
{
|
||||
// Determine the cells either side of the wall
|
||||
DWORD dwCellA = pWallNode->dwX + (pWallNode->dwY * m_dwWidth);
|
||||
DWORD dwCellB = dwCellA;
|
||||
if( pWallNode->dwType == MAZE_WALL_NORTH )
|
||||
dwCellB -= m_dwWidth;
|
||||
else
|
||||
dwCellB--;
|
||||
|
||||
// Are they already connected (partitions equal)?
|
||||
CellNode* pCellA = pCells+dwCellA;
|
||||
CellNode* pCellB = pCells+dwCellB;
|
||||
if( pCellA->pPartition != pCellB->pPartition )
|
||||
{
|
||||
// Nope, so let's take out that wall. First, connect the partition lists
|
||||
while ( pCellA->pNext )
|
||||
pCellA = pCellA->pNext;
|
||||
pCellB = pCellB->pPartition;
|
||||
pCellA->pNext = pCellB;
|
||||
while ( pCellB )
|
||||
{
|
||||
pCellB->pPartition = pCellA->pPartition;
|
||||
pCellB = pCellB->pNext;
|
||||
}
|
||||
|
||||
// Now remove the walls in our maze array
|
||||
if( pWallNode->dwType == MAZE_WALL_NORTH )
|
||||
{
|
||||
m_pMaze[dwCellA] &= ~MAZE_WALL_NORTH;
|
||||
m_pMaze[dwCellB] &= ~MAZE_WALL_SOUTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pMaze[dwCellA] &= ~MAZE_WALL_WEST;
|
||||
m_pMaze[dwCellB] &= ~MAZE_WALL_EAST;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Free temporary wall and cell lists
|
||||
delete[] pWalls;
|
||||
delete[] pCells;
|
||||
|
||||
return S_OK;
|
||||
|
||||
LFail:
|
||||
SAFE_DELETE_ARRAY( pCells );
|
||||
SAFE_DELETE_ARRAY( pWalls );
|
||||
SAFE_DELETE_ARRAY( m_pMaze );
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaze::Empty()
|
||||
{
|
||||
if( m_pMaze != NULL )
|
||||
SAFE_DELETE_ARRAY( m_pMaze );
|
||||
|
||||
m_dwWidth = m_dwHeight = m_dwSeed = m_dwSize = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CMaze::GetVisibleCells( const D3DXVECTOR2& pos, const D3DXVECTOR2& dir ,
|
||||
float fov, MazeCellRef* plist, DWORD maxlist )
|
||||
{
|
||||
// Check we have a maze, and that we were passed reasonable parameters
|
||||
if( m_pMaze == NULL || plist == NULL || maxlist == 0 )
|
||||
return 0;
|
||||
|
||||
// Check bounds of given viewpoint, must be inside maze
|
||||
if( pos.x < 0.0f || pos.y < 0.0f ||
|
||||
pos.x >= float(m_dwWidth) || pos.y >= float(m_dwHeight) )
|
||||
return 0;
|
||||
|
||||
// State data for the algorithm
|
||||
VisState state;
|
||||
|
||||
// Figure out which cell the viewpoint is in
|
||||
state.dwPosX = DWORD(pos.x);
|
||||
state.dwPosY = DWORD(pos.y);
|
||||
state.vPos = pos;
|
||||
|
||||
// Compute view boundaries
|
||||
float c = float(cos(fov*0.5f));
|
||||
float s = float(sin(fov*0.5f));
|
||||
D3DXVECTOR2 left,right;
|
||||
left.x = (dir.x*c)+(dir.y*s);
|
||||
left.y = (dir.y*c)-(dir.x*s);
|
||||
right.x = (dir.x*c)-(dir.y*s);
|
||||
right.y = (dir.y*c)+(dir.x*s);
|
||||
|
||||
// Store view direction (for near plane clip)
|
||||
state.vDir = dir;
|
||||
|
||||
// Figure out boundary of area we're prepared to look at (view cutoff)
|
||||
state.dwMinX = (state.dwPosX > m_dwMaxView) ? state.dwPosX - m_dwMaxView : 0;
|
||||
state.dwMaxX = ((state.dwPosX + m_dwMaxView) > m_dwWidth) ? m_dwWidth : state.dwPosX + m_dwMaxView;
|
||||
state.dwMinY = (state.dwPosY > m_dwMaxView) ? state.dwPosY - m_dwMaxView : 0;
|
||||
state.dwMaxY = ((state.dwPosY + m_dwMaxView) > m_dwHeight) ? m_dwHeight : state.dwPosY + m_dwMaxView;
|
||||
state.dwArrayPitch = state.dwMaxX-state.dwMinX+1;
|
||||
|
||||
// Allocate a temporary buffer which we'll use to mark visited cells
|
||||
DWORD array_size = state.dwArrayPitch * (state.dwMaxY-state.dwMinY+1);
|
||||
state.pArray = (BYTE*)_alloca( array_size );
|
||||
ZeroMemory( state.pArray, array_size );
|
||||
|
||||
state.ppVisList = &plist;
|
||||
state.dwMaxList = maxlist;
|
||||
state.dwListLen = 0;
|
||||
|
||||
// Recurse through cells
|
||||
RecurseCheckCellVis( state, state.dwPosX, state.dwPosY, left, right );
|
||||
|
||||
return state.dwListLen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaze::RecurseCheckCellVis( VisState& state, DWORD x, DWORD y,
|
||||
D3DXVECTOR2 left, D3DXVECTOR2 right )
|
||||
{
|
||||
// Fall out if we've overrun list length
|
||||
if( state.dwListLen >= state.dwMaxList )
|
||||
return;
|
||||
|
||||
// If cell is outside the maximum view bounds, then it's not visible
|
||||
if( x < state.dwMinX || x > state.dwMaxX ||
|
||||
y < state.dwMinY || y > state.dwMaxY )
|
||||
return;
|
||||
|
||||
// If cell is already marked, then we don't visit it either
|
||||
if( state.pArray[x-state.dwMinX+((y-state.dwMinY)*state.dwArrayPitch)] )
|
||||
return;
|
||||
|
||||
// Mark cell as visited
|
||||
state.pArray[x-state.dwMinX+((y-state.dwMinY)*state.dwArrayPitch)] = 1;
|
||||
|
||||
// Compute visibility flags
|
||||
D3DXVECTOR2 offset;
|
||||
offset.x = float(x)-state.vPos.x;
|
||||
offset.y = float(y)-state.vPos.y;
|
||||
BYTE flags[4];
|
||||
flags[0] = ComputeVisFlags( state.vDir, left, right, offset );
|
||||
offset.x += 1.0f;
|
||||
flags[1] = ComputeVisFlags( state.vDir, left, right, offset );
|
||||
offset.y += 1.0f;
|
||||
flags[2] = ComputeVisFlags( state.vDir, left, right, offset );
|
||||
offset.x -= 1.0f;
|
||||
flags[3] = ComputeVisFlags( state.vDir, left, right, offset );
|
||||
offset.y -= 1.0f;
|
||||
|
||||
// If there is an edge which clips all points, then the cell isn't in frustrum
|
||||
if( flags[0]&flags[1]&flags[2]&flags[3] )
|
||||
return;
|
||||
|
||||
// Cell is visible, so add it to list
|
||||
(*state.ppVisList)->x = x;
|
||||
(*state.ppVisList)->y = y;
|
||||
(*state.ppVisList)++;
|
||||
state.dwListLen++;
|
||||
|
||||
// Recurse into adjoining cells. Can move into an adjacent cell only if
|
||||
// there is a 'portal' (i.e. hole in the wall) that is not clipped and
|
||||
// that lies on the correct side of the viewport.
|
||||
BYTE cell = GetCell(x,y);
|
||||
D3DXVECTOR2 se = offset + D3DXVECTOR2(1,1);
|
||||
|
||||
if( !(cell & MAZE_WALL_NORTH) && offset.y < 0 && !(flags[0]&flags[1]) )
|
||||
RecurseCheckCellVis( state, x, y-1, left, right );
|
||||
|
||||
if( !(cell & MAZE_WALL_SOUTH) && se.y > 0 && !(flags[2]&flags[3]) )
|
||||
RecurseCheckCellVis( state, x, y+1, left, right );
|
||||
|
||||
if( !(cell & MAZE_WALL_WEST) && offset.x < 0 && !(flags[3]&flags[0]) )
|
||||
RecurseCheckCellVis( state, x-1, y, left, right );
|
||||
|
||||
if( !(cell & MAZE_WALL_EAST) && se.x > 0 && !(flags[1]&flags[2]) )
|
||||
RecurseCheckCellVis( state, x+1, y, left, right );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
BYTE CMaze::ComputeVisFlags( const D3DXVECTOR2& dir, const D3DXVECTOR2& left,
|
||||
const D3DXVECTOR2& right, const D3DXVECTOR2& offset )
|
||||
{
|
||||
BYTE flag = (D3DXVec2Dot(&offset, &dir) >= 0) ? 0 : 1;
|
||||
|
||||
if( D3DXVec2CCW(&offset,&left) > 0 )
|
||||
flag |= 2;
|
||||
|
||||
if( D3DXVec2CCW(&offset,&right) < 0 )
|
||||
flag |= 4;
|
||||
|
||||
return flag;
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: maze.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _MAZE_H
|
||||
#define _MAZE_H
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Client IDs are 32-bit values that refer to a particular Client. They are
|
||||
// broken up into two bitfields, one of which can be used into an index
|
||||
// of a list of Client 'slots', the other bitfield is a "uniqueness" value
|
||||
// that is incremented each time a new Client is created. Hence, although
|
||||
// the same slot may be reused by different Clients are different times,
|
||||
// it's possible to distinguish between the two by comparing uniqueness
|
||||
// values (you can just compare the whole 32-bit id).
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef DWORD ClientID;
|
||||
|
||||
#define PLAYER_OBJECT_SLOT_BITS 13
|
||||
#define MAX_PLAYER_OBJECTS (1<<PLAYER_OBJECT_SLOT_BITS)
|
||||
#define PLAYER_OBJECT_SLOT_MASK (MAX_PLAYER_OBJECTS-1)
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <assert.h>
|
||||
#include "Random.h"
|
||||
|
||||
const BYTE MAZE_WALL_NORTH = (1<<0);
|
||||
const BYTE MAZE_WALL_EAST = (1<<1);
|
||||
const BYTE MAZE_WALL_SOUTH = (1<<2);
|
||||
const BYTE MAZE_WALL_WEST = (1<<3);
|
||||
const BYTE MAZE_WALL_ALL = MAZE_WALL_NORTH|MAZE_WALL_EAST|
|
||||
MAZE_WALL_SOUTH|MAZE_WALL_WEST;
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
struct MazeCellRef
|
||||
{
|
||||
DWORD x,y;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CMaze
|
||||
{
|
||||
public:
|
||||
CMaze();
|
||||
~CMaze();
|
||||
|
||||
HRESULT Init( DWORD width , DWORD height , DWORD seed );
|
||||
void Empty();
|
||||
|
||||
DWORD GetWidth() const { return m_dwWidth; };
|
||||
DWORD GetHeight() const { return m_dwHeight; };
|
||||
DWORD GetSize() const { return m_dwWidth*m_dwHeight; };
|
||||
BYTE GetCell( DWORD x , DWORD y ) const { assert(m_pMaze!=NULL); return *(m_pMaze+x+(y*m_dwWidth)); };
|
||||
BOOL CanGoNorth( DWORD x , DWORD y ) const { return !(GetCell(x,y)&MAZE_WALL_NORTH); };
|
||||
BOOL CanGoEast( DWORD x , DWORD y ) const { return !(GetCell(x,y)&MAZE_WALL_EAST); };
|
||||
BOOL CanGoSouth( DWORD x , DWORD y ) const { return !(GetCell(x,y)&MAZE_WALL_SOUTH); };
|
||||
BOOL CanGoWest( DWORD x , DWORD y ) const { return !(GetCell(x,y)&MAZE_WALL_WEST); };
|
||||
|
||||
// Get list of visible cells from the given position. Fills out the list pointed to
|
||||
// be plist, and stops if it blows maxlist. Returns number of visible cells
|
||||
DWORD GetVisibleCells( const D3DXVECTOR2& pos , const D3DXVECTOR2& dir ,
|
||||
float fov , MazeCellRef* plist , DWORD maxlist );
|
||||
|
||||
// Get/set max view distance (used by GetVisibleCells)
|
||||
DWORD GetMaxView() const { return m_dwMaxView; };
|
||||
void SetMaxView() { m_dwMaxView = m_dwMaxView; };
|
||||
|
||||
BYTE* m_pMaze;
|
||||
|
||||
protected:
|
||||
DWORD m_dwWidth;
|
||||
DWORD m_dwHeight;
|
||||
DWORD m_dwSize;
|
||||
DWORD m_dwSeed;
|
||||
DWORD m_dwMaxView;
|
||||
CRandom m_Random;
|
||||
|
||||
// Local types for the maze generation algorithm
|
||||
struct CellNode
|
||||
{
|
||||
CellNode* pPartition;
|
||||
CellNode* pNext;
|
||||
};
|
||||
struct WallNode
|
||||
{
|
||||
DWORD dwX,dwY;
|
||||
DWORD dwType;
|
||||
};
|
||||
|
||||
// Local type for visibilty alg state
|
||||
struct VisState
|
||||
{
|
||||
DWORD dwPosX,dwPosY; // Cell containing view position
|
||||
D3DXVECTOR2 vPos; // View position
|
||||
D3DXVECTOR2 vDir; // View direction
|
||||
BYTE* pArray; // Array in which cell visits are marked
|
||||
DWORD dwMinX,dwMaxX; // Extents to consider (also array bounds)
|
||||
DWORD dwMinY,dwMaxY;
|
||||
DWORD dwArrayPitch; // 'Pitch' of array (width)
|
||||
MazeCellRef** ppVisList; // Pointer to vis list pointer
|
||||
DWORD dwMaxList; // Maximum length of vis list
|
||||
DWORD dwListLen; // Current length of vis list
|
||||
};
|
||||
|
||||
void RecurseCheckCellVis( VisState& state , DWORD x , DWORD y , D3DXVECTOR2 left , D3DXVECTOR2 right );
|
||||
BYTE ComputeVisFlags( const D3DXVECTOR2& dir , const D3DXVECTOR2& left , const D3DXVECTOR2& right , const D3DXVECTOR2& offset );
|
||||
|
||||
private:
|
||||
CMaze( const CMaze& );
|
||||
void operator=( const CMaze& );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,901 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: mazeapp.cpp
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#define D3D_OVERLOADS
|
||||
#include <windows.h>
|
||||
#include <d3dx.h>
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
#include <math.h>
|
||||
#include <process.h>
|
||||
#include <dxerr8.h>
|
||||
#include <dplay8.h>
|
||||
#include "DXUtil.h"
|
||||
#include "SyncObjects.h"
|
||||
#include "DummyConnector.h"
|
||||
#include "DPlay8Client.h"
|
||||
#include "MazeClient.h"
|
||||
#include "IMazeGraphics.h"
|
||||
#include "MazeApp.h"
|
||||
|
||||
|
||||
static CMazeApp* s_pMazeApp = NULL;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
CMazeApp::CMazeApp()
|
||||
{
|
||||
s_pMazeApp = this;
|
||||
m_hOutputMsgThread = NULL;
|
||||
m_bQuitThread = NULL;
|
||||
m_hOutputMsgEvent = NULL;
|
||||
m_dwNextOutputMsg = 0;
|
||||
m_bLocalLoopback = TRUE;
|
||||
m_bAllowConnect = FALSE;
|
||||
m_bConnectNow = TRUE;
|
||||
m_bSaveSettings = TRUE;
|
||||
m_lQueueSize = 0;
|
||||
m_dwNextFreeOutputMsg = 0;
|
||||
m_hLogFile = NULL;
|
||||
|
||||
m_bLocalLoopbackInitDone = FALSE;
|
||||
m_bInitDone = FALSE;
|
||||
|
||||
// Create an event object to flag pending output messages
|
||||
m_hOutputMsgEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
|
||||
|
||||
//Initialize our Config structure to 0.
|
||||
ZeroMemory(&m_Config, sizeof(m_Config));
|
||||
|
||||
//Must init buffer size to -1, since 0 is valid.
|
||||
m_Config.dwSPBufferSize = 0xffffffff;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
CMazeApp::~CMazeApp()
|
||||
{
|
||||
CloseHandle( m_hOutputMsgEvent );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMazeApp::Create( IMazeGraphics* pMazeGraphics )
|
||||
{
|
||||
m_pMazeGraphics = pMazeGraphics;
|
||||
if( m_pMazeGraphics == NULL )
|
||||
return E_FAIL;
|
||||
|
||||
m_pMazeGraphics->Init( this, &m_DP8Client, &m_MazeClient );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
int CMazeApp::Run( HINSTANCE hInst )
|
||||
{
|
||||
if( NULL == m_pMazeGraphics )
|
||||
return 0;
|
||||
|
||||
// Start the timer and init the random seed
|
||||
DXUtil_Timer( TIMER_START );
|
||||
DWORD dwSRand = (DWORD) (DXUtil_Timer( TIMER_GETABSOLUTETIME ) * UINT_MAX * (DWORD)GetCurrentThreadId() );
|
||||
srand( dwSRand );
|
||||
|
||||
// Tell OS's that have power management to not
|
||||
// sleep, since this app will be using the
|
||||
// network connection and need very little user input
|
||||
SuspendPowerManagement();
|
||||
|
||||
// Initialize COM
|
||||
CoInitializeEx( NULL, COINIT_MULTITHREADED );
|
||||
|
||||
// Extract configuration settings from the registry
|
||||
ReadConfig();
|
||||
|
||||
if( m_Config.bFileLogging )
|
||||
CreateTempLogFile();
|
||||
|
||||
if( SUCCEEDED( m_pMazeGraphics->Create( hInst ) ) )
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("DirectPlayMaze client started.") );
|
||||
|
||||
// Spin up a thread to record/display the output
|
||||
UINT dwOutputMsgThreadID;
|
||||
m_hOutputMsgThread = (HANDLE)_beginthreadex( NULL, 0, StaticOutputMsgThread,
|
||||
NULL, 0, &dwOutputMsgThreadID );
|
||||
|
||||
// Initialize maze client object - basically just build the maze
|
||||
m_MazeClient.Init( this, m_pMazeGraphics );
|
||||
|
||||
m_pMazeGraphics->Run();
|
||||
|
||||
// Wait for threads to shutdown
|
||||
DXUtil_Trace( TEXT("Quiting\n") );
|
||||
m_bQuitThread = TRUE;
|
||||
SetEvent( m_hOutputMsgEvent );
|
||||
WaitForSingleObject( m_hOutputMsgThread, INFINITE );
|
||||
CloseHandle( m_hOutputMsgThread );
|
||||
|
||||
// Write configuration settings to registry
|
||||
WriteConfig();
|
||||
|
||||
m_pMazeGraphics->Shutdown();
|
||||
}
|
||||
|
||||
// Clean up
|
||||
DXUtil_Trace( TEXT("Shutting down client\n") );
|
||||
m_MazeClient.Shutdown();
|
||||
DXUtil_Trace( TEXT("Shutting down dp8\n") );
|
||||
m_DP8Client.Shutdown();
|
||||
CoUninitialize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeApp::SuspendPowerManagement()
|
||||
{
|
||||
TCHAR szPath[MAX_PATH];
|
||||
HINSTANCE hInstKernel32 = NULL;
|
||||
typedef EXECUTION_STATE (WINAPI* LPSETTHREADEXECUTIONSTATE)( EXECUTION_STATE esFlags );
|
||||
LPSETTHREADEXECUTIONSTATE pSetThreadExecutionState = NULL;
|
||||
|
||||
GetSystemDirectory(szPath, MAX_PATH);
|
||||
|
||||
// SetThreadExecutionState() isn't availible on some old OS's,
|
||||
// so do a LoadLibrary to get to it.
|
||||
lstrcat(szPath, TEXT("\\kernel32.dll"));
|
||||
hInstKernel32 = LoadLibrary(szPath);
|
||||
|
||||
if (hInstKernel32 != NULL)
|
||||
{
|
||||
pSetThreadExecutionState = (LPSETTHREADEXECUTIONSTATE)GetProcAddress(hInstKernel32, "SetThreadExecutionState");
|
||||
if( pSetThreadExecutionState != NULL )
|
||||
{
|
||||
// Tell OS's that have power management to not
|
||||
// sleep, since this app will be using the
|
||||
// network connection and need very little user input
|
||||
pSetThreadExecutionState( ES_SYSTEM_REQUIRED | ES_CONTINUOUS );
|
||||
}
|
||||
|
||||
FreeLibrary(hInstKernel32);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMazeApp::FrameMove( FLOAT fElapsedTime )
|
||||
{
|
||||
HRESULT hr;
|
||||
FLOAT fCurTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
|
||||
static FLOAT s_fLastConnect = INT_MIN;
|
||||
static FLOAT s_fStartEnumTime = INT_MIN;
|
||||
static FLOAT s_fStopEnumTime = INT_MIN;
|
||||
static FLOAT s_fEnumStarted = FALSE;
|
||||
|
||||
if( m_DP8Client.IsSessionLost() )
|
||||
{
|
||||
|
||||
if( FALSE == m_bLocalLoopbackInitDone )
|
||||
{
|
||||
if( m_bInitDone )
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("Disconnected from server") );
|
||||
|
||||
if( m_DP8Client.GetSessionLostReason() == DISCONNNECT_REASON_CLIENT_OUT_OF_DATE )
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("Disconnected because MazeClient is out of date.") );
|
||||
ConsolePrintf( LINE_LOG, TEXT("Please get updated version") );
|
||||
ConsolePrintf( LINE_LOG, TEXT("from http://msdn.microsoft.com/directx/") );
|
||||
m_bOutOfDateClient = TRUE;
|
||||
}
|
||||
|
||||
// Disconnected, so retry in 10 seconds
|
||||
s_fStopEnumTime = fCurTime - m_Config.dwNetworkRetryDelay * 60.0f + 10.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If just starting up, then retry immediately
|
||||
m_bInitDone = TRUE;
|
||||
}
|
||||
|
||||
m_MazeClient.LockWorld();
|
||||
m_MazeClient.Reset();
|
||||
|
||||
// Now that the session is lost we need to
|
||||
// restart DirectPlay by calling Close()
|
||||
// and Init() on m_pDPlay
|
||||
m_DP8Client.Shutdown();
|
||||
|
||||
//Pass in the our structure in order to get out configuration data.
|
||||
m_DP8Client.Init(GetConfig());
|
||||
|
||||
if( m_bAllowLoopback )
|
||||
InitServerForLoopback();
|
||||
|
||||
m_MazeClient.UnlockWorld();
|
||||
m_bLocalLoopbackInitDone = TRUE;
|
||||
}
|
||||
|
||||
if( ( !s_fEnumStarted && fCurTime - s_fStopEnumTime > m_Config.dwNetworkRetryDelay * 60.0f || m_bConnectNow )
|
||||
&& m_bAllowConnect && !m_bOutOfDateClient )
|
||||
{
|
||||
m_bConnectNow = FALSE;
|
||||
|
||||
if( SUCCEEDED( hr = StartSessionEnum() ) )
|
||||
{
|
||||
// DirectPlay host enumeration started
|
||||
ConsolePrintf( LINE_LOG, TEXT("Starting DirectPlay host enumeration") );
|
||||
s_fStartEnumTime = fCurTime;
|
||||
s_fEnumStarted = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//If we are in the stress connect, try the next connection.
|
||||
//When we get back to 1, then we have gone through the list, so let's wait.
|
||||
if(m_Config.dwStressConnect > 1)
|
||||
{
|
||||
//We are going through the list of machines to attempt connection. So lets try the next right away.
|
||||
ConsolePrintf( LINE_LOG, TEXT("Host not found. Trying local subnet.") );
|
||||
m_bConnectNow = TRUE; //Try the enum right away with the next item in the list.
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("DirectPlay host enumeration failed to start.") );
|
||||
ConsolePrintf( LINE_LOG, TEXT("Will try again in %d minutes."), m_Config.dwNetworkRetryDelay );
|
||||
}
|
||||
|
||||
// DirectPlay host enumeration failed to start
|
||||
// Will try again in m_Config.dwNetworkRetryDelay minutes
|
||||
s_fStopEnumTime = fCurTime;
|
||||
s_fEnumStarted = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if( s_fEnumStarted && fCurTime - s_fStartEnumTime > 5.0f * 60.0f )
|
||||
{
|
||||
//If we are in the stress connect, try the next connection.
|
||||
//When we get back to 1, then we have gone through the list, so let's start over.
|
||||
if(m_Config.dwStressConnect > 1)
|
||||
{
|
||||
//We are going through the list of machines to attempt connection. So lets try the next right away.
|
||||
ConsolePrintf( LINE_LOG, TEXT("Host not found. Trying local subnet.") );
|
||||
m_bConnectNow = TRUE; //Try the enum right away with the next item in the list.
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("No host found. Stopping DirectPlay host enumeration") );
|
||||
ConsolePrintf( LINE_LOG, TEXT("Will try again in %d minutes."), m_Config.dwNetworkRetryDelay );
|
||||
}
|
||||
// Stop enumeration
|
||||
m_DP8Client.StopSessionEnum();
|
||||
s_fStopEnumTime = fCurTime;
|
||||
s_fEnumStarted = FALSE;
|
||||
}
|
||||
|
||||
if( s_fEnumStarted && fCurTime - s_fLastConnect > 0.5f )
|
||||
{
|
||||
if( TRUE == TryToConnect() )
|
||||
{
|
||||
// Connect successful
|
||||
ConsolePrintf( LINE_LOG, TEXT("Connected to server. Host enumeration stopped.") );
|
||||
m_bLocalLoopback = FALSE;
|
||||
s_fEnumStarted = FALSE;
|
||||
m_bLocalLoopbackInitDone = FALSE;
|
||||
|
||||
}
|
||||
|
||||
s_fLastConnect = fCurTime;
|
||||
}
|
||||
|
||||
m_bDisconnectNow = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bLocalLoopbackInitDone = FALSE;
|
||||
|
||||
if( m_Config.dwLogLevel > 1 )
|
||||
{
|
||||
// Display position every so often
|
||||
static float fLastPosUpdate = fCurTime;
|
||||
if( fCurTime - fLastPosUpdate > 10.0f )
|
||||
{
|
||||
D3DXVECTOR3 vPos = m_MazeClient.GetCameraPos();
|
||||
DWORD dwNumPlayers, dwNumNearbyPlayers;
|
||||
m_MazeClient.GetPlayerStats( &dwNumPlayers, &dwNumNearbyPlayers );
|
||||
ConsolePrintf( LINE_LOG, TEXT("Position: (%5.1f,%5.1f), Players: %d, Nearby Players: %d"),
|
||||
vPos.x, vPos.z, dwNumPlayers, dwNumNearbyPlayers );
|
||||
fLastPosUpdate = fCurTime;
|
||||
}
|
||||
}
|
||||
|
||||
// Display connection info every so often
|
||||
static float fLastLogUpdate = fCurTime;
|
||||
if( m_Config.dwAutoPrintStats > 0 &&
|
||||
fCurTime - fLastLogUpdate > m_Config.dwAutoPrintStats * 60.0f )
|
||||
{
|
||||
D3DXVECTOR3 vPos = m_MazeClient.GetCameraPos();
|
||||
DWORD dwNumPlayers, dwNumNearbyPlayers;
|
||||
m_MazeClient.GetPlayerStats( &dwNumPlayers, &dwNumNearbyPlayers );
|
||||
ConsolePrintf( LINE_LOG, TEXT("Position: (%5.1f,%5.1f), Players: %d, Nearby Players: %d"),
|
||||
vPos.x, vPos.z, dwNumPlayers, dwNumNearbyPlayers );
|
||||
|
||||
TCHAR strInfo[5000];
|
||||
TCHAR* strEndOfLine;
|
||||
TCHAR* strStartOfLine;
|
||||
|
||||
// Query the IOutboudNet for info about the connection to this user
|
||||
m_DP8Client.GetConnectionInfo( strInfo );
|
||||
|
||||
ConsolePrintf( LINE_LOG, TEXT("Displaying connection info for 0x%0.8x"), m_MazeClient.GetLocalClientID() );
|
||||
ConsolePrintf( LINE_LOG, TEXT("(Key: G=Guaranteed NG=Non-Guaranteed B=Bytes P=Packets)") );
|
||||
|
||||
// Display each line seperately
|
||||
strStartOfLine = strInfo;
|
||||
while( TRUE )
|
||||
{
|
||||
strEndOfLine = _tcschr( strStartOfLine, '\n' );
|
||||
if( strEndOfLine == NULL )
|
||||
break;
|
||||
|
||||
*strEndOfLine = 0;
|
||||
ConsolePrintf( LINE_LOG, strStartOfLine );
|
||||
strStartOfLine = strEndOfLine + 1;
|
||||
}
|
||||
|
||||
fLastLogUpdate = fCurTime;
|
||||
}
|
||||
|
||||
// If we are testing connect/disconnect, break after so many iterations.
|
||||
if( m_Config.bAutoDisconnnect )
|
||||
{
|
||||
// Disconnect between 5-25seconds
|
||||
static float fDisconnectCountdown = 10.0f;
|
||||
|
||||
fDisconnectCountdown -= fElapsedTime;
|
||||
if( fDisconnectCountdown < 0.0f )
|
||||
{
|
||||
fDisconnectCountdown = (float)(rand() % 20000 + 5000 ) / 1000.0f;
|
||||
ConsolePrintf( LINE_LOG, TEXT("Intentional disconnect. Connecting again for %0.0f seconds..."), fDisconnectCountdown );
|
||||
m_DP8Client.Shutdown();
|
||||
m_MazeClient.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
if( m_bDisconnectNow )
|
||||
{
|
||||
m_bDisconnectNow = FALSE;
|
||||
ConsolePrintf( LINE_LOG, TEXT("Intentional disconnect.") );
|
||||
m_DP8Client.Shutdown();
|
||||
m_MazeClient.Shutdown();
|
||||
|
||||
if( m_bAllowLoopback )
|
||||
InitServerForLoopback();
|
||||
}
|
||||
}
|
||||
|
||||
// Update state of client
|
||||
m_MazeClient.Update( fElapsedTime );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMazeApp::StartSessionEnum()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// If we're not the preview, then enum sessions
|
||||
if( m_pMazeGraphics->IsPreview() )
|
||||
return S_OK;
|
||||
|
||||
// Start enumerating available sessions at specified IP address.
|
||||
|
||||
if( m_Config.bConnectToMicrosoftSite )
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("Connecting to DirectPlayMaze.rte.microsoft.com") );
|
||||
hr = m_DP8Client.StartSessionEnum( MICROSOFT_SERVER );
|
||||
}
|
||||
else if( m_Config.bConnectToLocalServer )
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("Connecting to local server (searches the local subnet)") );
|
||||
hr = m_DP8Client.StartSessionEnum( TEXT("") );
|
||||
}
|
||||
else if( m_Config.bConnectToRemoteServer )
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("Connecting to remote server at '%s'"), m_Config.szIPAddress );
|
||||
hr = m_DP8Client.StartSessionEnum( m_Config.szIPAddress );
|
||||
}
|
||||
// If users wants Stress Connect, go through the sequence they have requested.
|
||||
else if( m_Config.dwStressConnect )
|
||||
{
|
||||
if( m_Config.dwStressConnect == 1 )
|
||||
{
|
||||
// Point to local subnet for next enum.
|
||||
m_Config.dwStressConnect = 2;
|
||||
|
||||
ConsolePrintf( LINE_LOG, TEXT("Connecting to remote server at '%s'"), m_Config.szIPAddress );
|
||||
hr = m_DP8Client.StartSessionEnum( m_Config.szIPAddress );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Point back at remote server for next enum.
|
||||
m_Config.dwStressConnect = 1;
|
||||
|
||||
// Must equal 2 or something higher. Try the local subnet.
|
||||
ConsolePrintf( LINE_LOG, TEXT("Connecting to local server (searches the local subnet)") );
|
||||
hr = m_DP8Client.StartSessionEnum( TEXT("") );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL CMazeApp::TryToConnect()
|
||||
{
|
||||
if( m_DP8Client.GetNumSessions() > 0 )
|
||||
{
|
||||
m_MazeClient.Reset();
|
||||
m_MazeClient.SetOutboundClient( m_DP8Client.GetOutboundClient() );
|
||||
m_DP8Client.SetClient( &m_MazeClient );
|
||||
|
||||
// Loop through the available sessions and attempt to connect
|
||||
for( DWORD i = 0; i < m_DP8Client.GetNumSessions(); i++ )
|
||||
{
|
||||
if( SUCCEEDED(m_DP8Client.JoinSession( i ) ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMazeApp::InitServerForLoopback()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
m_bLocalLoopback = TRUE;
|
||||
|
||||
#define LOOPBACK_MAZE_WIDTH 16
|
||||
#define LOOPBACK_MAZE_HEIGHT 16
|
||||
|
||||
// Initalize maze and server objects for loopback mode
|
||||
if( FAILED( hr = m_MazeClient.m_Maze.Init( LOOPBACK_MAZE_WIDTH,
|
||||
LOOPBACK_MAZE_HEIGHT,
|
||||
DEFAULT_SEED ) ) )
|
||||
{
|
||||
return DXTRACE_ERR( TEXT("m_Maze.Init"), hr );
|
||||
}
|
||||
|
||||
// Initialize maze server object - hook up to the maze object in the client
|
||||
m_MazeServer.Init( m_bLocalLoopback, &m_MazeClient.m_Maze );
|
||||
|
||||
m_DummyClientConnection.SetTarget( &m_MazeServer );
|
||||
m_MazeClient.SetOutboundClient( &m_DummyClientConnection );
|
||||
m_DummyServerConnection.SetTarget( &m_MazeClient );
|
||||
m_MazeServer.SetOutboundServer( &m_DummyServerConnection );
|
||||
|
||||
m_DummyClientConnection.Connect( 2 );
|
||||
m_MazeClient.EngageAutopilot( TRUE );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
UINT WINAPI CMazeApp::StaticOutputMsgThread( LPVOID pParam )
|
||||
{
|
||||
return s_pMazeApp->OutputMsgThread( pParam );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
UINT WINAPI CMazeApp::OutputMsgThread( LPVOID pParam )
|
||||
{
|
||||
#define MAX_LOG_LINES 100
|
||||
|
||||
TCHAR szLogBuffer[MAX_PATH];
|
||||
DWORD dwNumProcessed = 0;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
// Wait for output to be added to the queue or the quit flag to be set
|
||||
WaitForSingleObject( m_hOutputMsgEvent, INFINITE );
|
||||
if( m_bQuitThread )
|
||||
break;
|
||||
|
||||
// Update the time stamp
|
||||
UpdateTimeStamp();
|
||||
|
||||
// Lock output queue
|
||||
m_OutputMsgQueueLock.Enter();
|
||||
|
||||
dwNumProcessed = 0;
|
||||
|
||||
// While we have there are messages to print and we
|
||||
// have display'ed less than 5 messages
|
||||
while ( m_lQueueSize > 0 && dwNumProcessed < 5 )
|
||||
{
|
||||
switch( m_EnumLineType[m_dwNextOutputMsg] )
|
||||
{
|
||||
case LINE_LOG:
|
||||
{
|
||||
// Add m_szOutputMsgBuffer[m_dwNextOutputMsg] to szLogBuffer array,
|
||||
// and redisplay the array on the top half of the screen
|
||||
_stprintf( szLogBuffer, TEXT("%s %s"),
|
||||
m_strTimeStamp, m_szOutputMsgBuffer[m_dwNextOutputMsg] );
|
||||
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString( szLogBuffer );
|
||||
OutputDebugString( TEXT("\n") );
|
||||
#endif
|
||||
if( m_hLogFile )
|
||||
{
|
||||
DWORD dwWritten;
|
||||
WriteFile( m_hLogFile, szLogBuffer,
|
||||
lstrlen( szLogBuffer ), &dwWritten, NULL );
|
||||
TCHAR strEOL = TEXT('\r');
|
||||
WriteFile( m_hLogFile, &strEOL,
|
||||
sizeof(TCHAR), &dwWritten, NULL );
|
||||
strEOL = TEXT('\n');
|
||||
WriteFile( m_hLogFile, &strEOL,
|
||||
sizeof(TCHAR), &dwWritten, NULL );
|
||||
|
||||
static float s_fLastFlushTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
float fCurTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
if( fCurTime - s_fLastFlushTime > 0.2f )
|
||||
{
|
||||
FlushFileBuffers( m_hLogFile );
|
||||
s_fLastFlushTime = fCurTime;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
_tcscpy( szLogBuffer, m_szOutputMsgBuffer[m_dwNextOutputMsg] );
|
||||
break;
|
||||
}
|
||||
|
||||
m_pMazeGraphics->HandleOutputMsg( m_EnumLineType[m_dwNextOutputMsg], szLogBuffer );
|
||||
|
||||
m_dwNextOutputMsg++;
|
||||
if( m_dwNextOutputMsg == MAX_OUTPUT_QUEUE )
|
||||
m_dwNextOutputMsg = 0;
|
||||
|
||||
m_lQueueSize--;
|
||||
dwNumProcessed++;
|
||||
}
|
||||
|
||||
// Unlock output queue
|
||||
m_OutputMsgQueueLock.Leave();
|
||||
|
||||
if( m_hLogFile )
|
||||
FlushFileBuffers( m_hLogFile );
|
||||
|
||||
// Yield time to other threads
|
||||
Sleep( 10 );
|
||||
|
||||
// If there are still messages left, then signal the event
|
||||
if( m_lQueueSize > 0 )
|
||||
SetEvent( m_hOutputMsgEvent );
|
||||
}
|
||||
|
||||
if( m_hLogFile )
|
||||
{
|
||||
CloseHandle( m_hLogFile );
|
||||
m_hLogFile = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeApp::ConsolePrintf( EnumLineType enumLineType, const TCHAR* fmt, ... )
|
||||
{
|
||||
// Format the message into a buffer
|
||||
TCHAR buffer[512];
|
||||
_vstprintf( buffer, fmt, (CHAR*) ((&fmt)+1) );
|
||||
|
||||
// Lock the output queue
|
||||
m_OutputMsgQueueLock.Enter();
|
||||
|
||||
// Find free spot
|
||||
if( m_lQueueSize != MAX_OUTPUT_QUEUE )
|
||||
{
|
||||
// Format message into the buffer
|
||||
_vstprintf( m_szOutputMsgBuffer[m_dwNextFreeOutputMsg], fmt, (CHAR*)((&fmt)+1) );
|
||||
m_EnumLineType[m_dwNextFreeOutputMsg] = enumLineType;
|
||||
|
||||
// Increment output pointer and wrap around
|
||||
m_dwNextFreeOutputMsg++;
|
||||
if( m_dwNextFreeOutputMsg == MAX_OUTPUT_QUEUE )
|
||||
m_dwNextFreeOutputMsg = 0;
|
||||
|
||||
// Increment message count
|
||||
m_lQueueSize++;
|
||||
}
|
||||
|
||||
// Unlock output queue
|
||||
m_OutputMsgQueueLock.Leave();
|
||||
|
||||
// Signal event so the output thread empties the queue
|
||||
SetEvent( m_hOutputMsgEvent );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeApp::UpdateTimeStamp()
|
||||
{
|
||||
static float s_fTimeStampUpdateCountdown = -10.0f;
|
||||
float fCurTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
|
||||
if( fCurTime - s_fTimeStampUpdateCountdown > 1.0f )
|
||||
{
|
||||
SYSTEMTIME sysTime;
|
||||
GetLocalTime( &sysTime );
|
||||
_stprintf( m_strTimeStamp, TEXT("[%02d-%02d-%02d %02d:%02d:%02d]"),
|
||||
sysTime.wMonth, sysTime.wDay, sysTime.wYear % 100,
|
||||
sysTime.wHour, sysTime.wMinute, sysTime.wSecond );
|
||||
|
||||
// Compute how many milliseconds until the next second change
|
||||
s_fTimeStampUpdateCountdown = fCurTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeApp::CreateTempLogFile()
|
||||
{
|
||||
BOOL bSuccess;
|
||||
TCHAR strTempFileName[MAX_PATH];
|
||||
TCHAR strTime[MAX_PATH];
|
||||
DWORD dwCount;
|
||||
|
||||
GetTempPath( MAX_PATH, m_strLogDir );
|
||||
lstrcat( m_strLogDir, TEXT("DirectPlayMaze\\") );
|
||||
|
||||
// Create the directory if it doesn't exist
|
||||
if( GetFileAttributes( m_strLogDir ) == -1 )
|
||||
{
|
||||
bSuccess = CreateDirectory( m_strLogDir, NULL );
|
||||
if( !bSuccess )
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("Could not create create temp directory '%s'"), m_strLogDir );
|
||||
goto LFail;
|
||||
}
|
||||
}
|
||||
|
||||
ConsolePrintf( LINE_LOG, TEXT("Log Directory: '%s'"), m_strLogDir );
|
||||
|
||||
SYSTEMTIME sysTime;
|
||||
GetLocalTime( &sysTime );
|
||||
_stprintf( strTime, TEXT("client-%04d-%02d-%02d-"),
|
||||
sysTime.wYear, sysTime.wMonth, sysTime.wDay );
|
||||
|
||||
dwCount = 0;
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
wsprintf( m_strLogFile, TEXT("%s%05d.log"), strTime, dwCount );
|
||||
lstrcpy( strTempFileName, m_strLogDir );
|
||||
lstrcat( strTempFileName, m_strLogFile );
|
||||
DWORD dwResult = GetFileAttributes( strTempFileName );
|
||||
if( dwResult == -1 )
|
||||
break;
|
||||
|
||||
dwCount++;
|
||||
}
|
||||
|
||||
if( m_hLogFile )
|
||||
{
|
||||
CloseHandle( m_hLogFile );
|
||||
m_hLogFile = NULL;
|
||||
}
|
||||
|
||||
m_hLogFile = CreateFile( strTempFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
||||
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
|
||||
if( m_hLogFile == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
ConsolePrintf( LINE_LOG, TEXT("Could not create create temp file '%s'"), strTempFileName );
|
||||
goto LFail;
|
||||
}
|
||||
|
||||
ConsolePrintf( LINE_LOG, TEXT("Logging to temp file: '%s'"), m_strLogFile );
|
||||
return;
|
||||
|
||||
LFail:
|
||||
ConsolePrintf( LINE_LOG, TEXT("File logging disabled") );
|
||||
m_Config.bFileLogging = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeApp::CloseTempLogFile()
|
||||
{
|
||||
CloseHandle( m_hLogFile );
|
||||
m_hLogFile = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeApp::ReadConfig()
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
RegOpenKeyEx( HKEY_CURRENT_USER, MAZE_REGKEYNAME, 0, KEY_READ, &hKey );
|
||||
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("ConnectToMicrosoftSite"), &m_Config.bConnectToMicrosoftSite, TRUE );
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("ConnectToLocalServer"), &m_Config.bConnectToLocalServer, FALSE );
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("ConnectToRemoteServer"), &m_Config.bConnectToRemoteServer, FALSE );
|
||||
DXUtil_ReadIntRegKey( hKey, TEXT("NetworkRetryDelay"), &m_Config.dwNetworkRetryDelay, 30 );
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("FileLogging"), &m_Config.bFileLogging, TRUE );
|
||||
DXUtil_ReadStringRegKey( hKey, TEXT("IPAddress"), m_Config.szIPAddress, sizeof(m_Config.szIPAddress), TEXT("\0") );
|
||||
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("ShowFramerate"), &m_Config.bShowFramerate, TRUE );
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("ShowIndicators"), &m_Config.bShowIndicators, TRUE );
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("DrawMiniMap"), &m_Config.bDrawMiniMap, TRUE );
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("FullScreen"), &m_Config.bFullScreen, TRUE );
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("Reflections"), &m_Config.bReflections, FALSE );
|
||||
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("AutoDisconnnect"), &m_Config.bAutoDisconnnect, FALSE );
|
||||
DXUtil_ReadBoolRegKey( hKey, TEXT("AutoConnnect"), &m_Config.bAutoConnnect, FALSE );
|
||||
DXUtil_ReadIntRegKey( hKey, TEXT("LogLevel"), &m_Config.dwLogLevel, 2 );
|
||||
DXUtil_ReadIntRegKey( hKey, TEXT("AutoPrintStats"), &m_Config.dwAutoPrintStats, 10 );
|
||||
|
||||
RegCloseKey( hKey );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeApp::WriteConfig()
|
||||
{
|
||||
HKEY hKey;
|
||||
DWORD dwDisposition;
|
||||
|
||||
if( !m_bSaveSettings )
|
||||
return;
|
||||
|
||||
RegCreateKeyEx( HKEY_CURRENT_USER, MAZE_REGKEYNAME, 0, NULL,
|
||||
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL,
|
||||
&hKey, &dwDisposition );
|
||||
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("ConnectToMicrosoftSite"), m_Config.bConnectToMicrosoftSite );
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("ConnectToLocalServer"), m_Config.bConnectToLocalServer );
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("ConnectToRemoteServer"), m_Config.bConnectToRemoteServer );
|
||||
DXUtil_WriteIntRegKey( hKey, TEXT("NetworkRetryDelay"), m_Config.dwNetworkRetryDelay );
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("FileLogging"), m_Config.bFileLogging );
|
||||
DXUtil_WriteStringRegKey( hKey, TEXT("IPAddress"), m_Config.szIPAddress );
|
||||
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("ShowFramerate"), m_Config.bShowFramerate );
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("ShowIndicators"), m_Config.bShowIndicators );
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("DrawMiniMap"), m_Config.bDrawMiniMap );
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("FullScreen"), m_Config.bFullScreen );
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("Reflections"), m_Config.bReflections );
|
||||
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("AutoDisconnnect"), m_Config.bAutoDisconnnect );
|
||||
DXUtil_WriteBoolRegKey( hKey, TEXT("AutoConnnect"), m_Config.bAutoConnnect );
|
||||
DXUtil_WriteIntRegKey( hKey, TEXT("LogLevel"), m_Config.dwLogLevel );
|
||||
DXUtil_WriteIntRegKey( hKey, TEXT("AutoPrintStats"), m_Config.dwAutoPrintStats );
|
||||
|
||||
RegCloseKey( hKey );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConsolePrintf( ServerBufferType enumLineType, const TCHAR* fmt , ... )
|
||||
{
|
||||
// Format the message into a buffer
|
||||
TCHAR buffer[512];
|
||||
_vstprintf( buffer, fmt, (CHAR*) ((&fmt)+1) );
|
||||
|
||||
s_pMazeApp->ConsolePrintf( LINE_LOG, buffer );
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: mazeapp.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _MAZE_APP_H
|
||||
#define _MAZE_APP_H
|
||||
|
||||
|
||||
#include "DPlay8Client.h"
|
||||
#include "MazeClient.h"
|
||||
#include "IMazeGraphics.h"
|
||||
|
||||
class CDPlay8Client;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Defines, and constants
|
||||
//-----------------------------------------------------------------------------
|
||||
#define MAX_OUTPUT_QUEUE 256
|
||||
#define MICROSOFT_SERVER TEXT("DirectPlayMaze.rte.microsoft.com")
|
||||
#define MAZE_REGKEYNAME TEXT("Software\\Microsoft\\DirectPlayMaze\\MazeClient")
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Dplay Defines, and constants
|
||||
//-----------------------------------------------------------------------------
|
||||
#define MIN_SP_THREADS 1
|
||||
#define MAX_SP_THREADS 128
|
||||
#define MAX_SP_BUFFER 1024000
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
struct MazeConfig
|
||||
{
|
||||
BOOL bConnectToMicrosoftSite;
|
||||
BOOL bConnectToLocalServer;
|
||||
BOOL bConnectToRemoteServer;
|
||||
DWORD dwNetworkRetryDelay;
|
||||
BOOL bShowFramerate;
|
||||
BOOL bShowIndicators;
|
||||
BOOL bDrawMiniMap;
|
||||
BOOL bFullScreen;
|
||||
BOOL bReflections;
|
||||
BOOL bFileLogging;
|
||||
|
||||
DWORD dwSPThreads;
|
||||
DWORD dwSPBufferSize;
|
||||
|
||||
DWORD dwStressConnect;
|
||||
|
||||
TCHAR szIPAddress[64];
|
||||
|
||||
DWORD dwLogLevel;
|
||||
DWORD dwAutoPrintStats;
|
||||
BOOL bAutoDisconnnect;
|
||||
BOOL bAutoConnnect;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CMazeApp
|
||||
{
|
||||
|
||||
public:
|
||||
CMazeApp();
|
||||
~CMazeApp();
|
||||
|
||||
HRESULT Create( IMazeGraphics* pMazeGraphics );
|
||||
int Run( HINSTANCE hInst );
|
||||
HRESULT FrameMove( FLOAT fElapsedTime );
|
||||
void ConsolePrintf( EnumLineType EnumLineType, const TCHAR* fmt, ... );
|
||||
void ReadConfig();
|
||||
void WriteConfig();
|
||||
void CreateTempLogFile();
|
||||
void CloseTempLogFile();
|
||||
|
||||
MazeConfig* GetConfig() {return &m_Config; };
|
||||
|
||||
TCHAR* GetLogDir() { return m_strLogDir; };
|
||||
TCHAR* GetLogFile() { return m_strLogFile; };
|
||||
BOOL IsOutOfDateClient() { return m_bOutOfDateClient; };
|
||||
|
||||
VOID SetOutOfDateClient( BOOL bOutOfDateClient ) { m_bOutOfDateClient = bOutOfDateClient; };
|
||||
VOID SetAllowConnect( BOOL bAllowConnect ) { m_bAllowConnect = bAllowConnect; };
|
||||
VOID SetSaveSettings( BOOL bSaveSettings ) { m_bSaveSettings = bSaveSettings; };
|
||||
VOID SetConnectNow( BOOL bConnectNow ) { m_bConnectNow = bConnectNow; };
|
||||
VOID SetDisconnectNow( BOOL bDisconnectNow ) { m_bDisconnectNow = bDisconnectNow; };
|
||||
VOID SetAllowLoopback( BOOL bAllowLoopback ) { m_bAllowLoopback = bAllowLoopback; };
|
||||
|
||||
protected:
|
||||
static UINT WINAPI StaticOutputMsgThread( LPVOID pParam );
|
||||
static UINT WINAPI StaticClientThread( LPVOID pParam );
|
||||
UINT WINAPI OutputMsgThread( LPVOID pParam );
|
||||
UINT WINAPI ClientThread( LPVOID pParam );
|
||||
|
||||
void SuspendPowerManagement();
|
||||
BOOL ParseCommandLine();
|
||||
|
||||
HRESULT StartSessionEnum();
|
||||
HRESULT InitServerForLoopback();
|
||||
BOOL TryToConnect();
|
||||
void UpdateTimeStamp();
|
||||
|
||||
IMazeGraphics* m_pMazeGraphics;
|
||||
CDPlay8Client m_DP8Client;
|
||||
CMazeClient m_MazeClient;
|
||||
CMazeServer m_MazeServer;
|
||||
CDummyConnectorServer m_DummyServerConnection;
|
||||
CDummyConnectorClient m_DummyClientConnection;
|
||||
|
||||
MazeConfig m_Config;
|
||||
|
||||
HANDLE m_hOutputMsgThread;
|
||||
BOOL m_bQuitThread;
|
||||
HANDLE m_hClientThread;
|
||||
DWORD m_dwNextOutputMsg;
|
||||
|
||||
BOOL m_bLocalLoopbackInitDone;
|
||||
BOOL m_bInitDone;
|
||||
|
||||
BOOL m_bAllowLoopback;
|
||||
BOOL m_bLocalLoopback;
|
||||
BOOL m_bAllowConnect;
|
||||
BOOL m_bConnectNow;
|
||||
BOOL m_bDisconnectNow;
|
||||
BOOL m_bOutOfDateClient;
|
||||
|
||||
TCHAR m_strTimeStamp[50];
|
||||
|
||||
BOOL m_bSaveSettings;
|
||||
|
||||
CCriticalSection m_OutputMsgQueueLock;
|
||||
LONG m_lQueueSize;
|
||||
TCHAR m_szOutputMsgBuffer[MAX_OUTPUT_QUEUE][256];
|
||||
EnumLineType m_EnumLineType[MAX_OUTPUT_QUEUE];
|
||||
DWORD m_dwNextFreeOutputMsg;
|
||||
HANDLE m_hOutputMsgEvent;
|
||||
HANDLE m_hLogFile;
|
||||
TCHAR m_strLogFile[MAX_PATH];
|
||||
TCHAR m_strLogDir[MAX_PATH];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,945 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: mazecient.cpp
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#define D3D_OVERLOADS
|
||||
#include <windows.h>
|
||||
#include <d3dx.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <dplay8.h>
|
||||
#include <dpaddr.h>
|
||||
#include <dxerr8.h>
|
||||
#include "DXUtil.h"
|
||||
#include "SyncObjects.h"
|
||||
#include "IMazeGraphics.h"
|
||||
#include "DummyConnector.h"
|
||||
#include "MazeApp.h"
|
||||
#include "MazeClient.h"
|
||||
#include "Packets.h"
|
||||
#include "DXUtil.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
#define NORTH_ANGLE 0x8000
|
||||
#define EAST_ANGLE 0xc000
|
||||
#define SOUTH_ANGLE 0x0000
|
||||
#define WEST_ANGLE 0x4000
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
CMazeClient::CMazeClient()
|
||||
{
|
||||
ZeroMemory( m_pctCells, sizeof(m_pctCells) );
|
||||
m_hReady = CreateEvent( NULL, TRUE, FALSE, NULL );
|
||||
m_hGotFirstConfig = CreateEvent( NULL, TRUE, FALSE, NULL );
|
||||
m_pNet = NULL;
|
||||
m_bAutopilot = FALSE;
|
||||
m_bEngageAutopilot = TRUE;
|
||||
m_dwNumNearbyPlayers = 0;
|
||||
|
||||
m_NetConfig.ubReliableRate = 0;
|
||||
m_NetConfig.wUpdateRate = 150;
|
||||
m_NetConfig.wTimeout = 150;
|
||||
m_NetConfig.dwMazeWidth = 0;
|
||||
m_NetConfig.dwMazeHeight = 0;
|
||||
|
||||
m_NetConfig.dwThreadWait = 0;
|
||||
|
||||
m_NetConfig.ubClientPackIndex = 0;
|
||||
m_NetConfig.ubServerPackIndex = 0;
|
||||
for(WORD x = 0; x < PACK_ARRAY_SIZE; x++)
|
||||
{
|
||||
m_NetConfig.wClientPackSizeArray[x] = 0;
|
||||
m_NetConfig.wServerPackSizeArray[x] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
CMazeClient::~CMazeClient()
|
||||
{
|
||||
CloseHandle( m_hGotFirstConfig );
|
||||
CloseHandle( m_hReady );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMazeClient::Init( CMazeApp* pMazeApp, IMazeGraphics* pMazeGraphics )
|
||||
{
|
||||
m_pMazeApp = pMazeApp;
|
||||
m_pMazeGraphics = pMazeGraphics;
|
||||
m_aCameraYaw = 0;
|
||||
m_fLastOutboundTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
m_bHaveInputFocus = TRUE;
|
||||
|
||||
Reset();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMazeClient::Reset()
|
||||
{
|
||||
m_dwNumPlayers = 0;
|
||||
m_bAutopilot = FALSE;
|
||||
|
||||
SetFirstConfig( FALSE );
|
||||
SetMazeReady( FALSE );
|
||||
|
||||
ZeroMemory( m_pctCells, sizeof(m_pctCells) );
|
||||
|
||||
PlayerObject* pPlayerObject = m_PlayerObjects;
|
||||
for( DWORD i = 0; i < MAX_PLAYER_OBJECTS; i++, pPlayerObject++ )
|
||||
{
|
||||
pPlayerObject->dwID = 0;
|
||||
pPlayerObject->wCellX = pPlayerObject->wCellY = 0xffff;
|
||||
pPlayerObject->pNext = NULL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::Shutdown()
|
||||
{
|
||||
// Destroy the maze
|
||||
|
||||
Reset();
|
||||
m_Maze.Empty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::Update( FLOAT fElapsed )
|
||||
{
|
||||
// Don't do anyPlayerObject until we get a server config packet
|
||||
if( !IsMazeReady() )
|
||||
return;
|
||||
|
||||
if( m_bAutopilot )
|
||||
DoAutopilot( fElapsed );
|
||||
else
|
||||
DoManualPilot( fElapsed );
|
||||
|
||||
// See if it's time to send a packet to the server with our updated coordinates
|
||||
FLOAT fCurTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
if( (fCurTime - m_fLastOutboundTime)*1000.0f > m_NetConfig.wUpdateRate )
|
||||
{
|
||||
|
||||
ClientPosPacket packet( m_vCameraPos.x, m_vCameraPos.z, m_aCameraYaw );
|
||||
|
||||
// Pack the buffer with dummy data for testing.
|
||||
if(m_NetConfig.wClientPackSizeArray[m_NetConfig.ubClientPackIndex] > 0)
|
||||
{
|
||||
WORD wBufferSize = sizeof(packet) + m_NetConfig.wClientPackSizeArray[m_NetConfig.ubClientPackIndex];
|
||||
VOID* pTempBuffer = 0;
|
||||
|
||||
pTempBuffer = malloc(wBufferSize);
|
||||
if( NULL == pTempBuffer )
|
||||
{
|
||||
//Out of memory, just bail
|
||||
DXTRACE_ERR_NOMSGBOX( TEXT("System out of Memory!"), E_OUTOFMEMORY );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FillMemory(pTempBuffer, wBufferSize, 'Z');
|
||||
memcpy(pTempBuffer, &packet, sizeof(packet));
|
||||
|
||||
SendPacket( (ClientPacket*)pTempBuffer, wBufferSize, FALSE, m_NetConfig.wTimeout );
|
||||
|
||||
free(pTempBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendPacket( &packet, sizeof(packet), FALSE, m_NetConfig.wTimeout );
|
||||
}
|
||||
|
||||
m_fLastOutboundTime = fCurTime;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::DoManualPilot( FLOAT fElapsed )
|
||||
{
|
||||
// Check if we have the input focus
|
||||
if( !m_bHaveInputFocus )
|
||||
return;
|
||||
|
||||
// Do rotations
|
||||
if( GetAsyncKeyState( VK_LEFT ) & 0x8000 )
|
||||
m_aCameraYaw += (DWORD) ((fElapsed*1000.0f) * 40.0f);
|
||||
if( GetAsyncKeyState( VK_RIGHT ) & 0x8000 )
|
||||
m_aCameraYaw -= (DWORD) ((fElapsed*1000.0f) * 40.0f);
|
||||
|
||||
float e = fElapsed*1000.0f;
|
||||
|
||||
// Compute new position based key input
|
||||
D3DXVECTOR3 pos = m_vCameraPos;
|
||||
if( GetAsyncKeyState( VK_UP ) & 0x8000 )
|
||||
{
|
||||
pos.x -= Sin(m_aCameraYaw) * 0.002f * e;
|
||||
pos.z += Cos(m_aCameraYaw) * 0.002f * e;
|
||||
}
|
||||
|
||||
if( GetAsyncKeyState( VK_DOWN ) & 0x8000 )
|
||||
{
|
||||
pos.x += Sin(m_aCameraYaw) * 0.002f * e;
|
||||
pos.z -= Cos(m_aCameraYaw) * 0.002f * e;
|
||||
}
|
||||
|
||||
// Ensure that we have stayed within the maze boundaries
|
||||
if( pos.x < 0 ) pos.x = 0.1f;
|
||||
if( pos.x >= m_Maze.GetWidth() ) pos.x = m_Maze.GetWidth() - 0.1f;
|
||||
if( pos.z < 0 ) pos.z = 0.1f;
|
||||
if( pos.z >= m_Maze.GetHeight() ) pos.z = m_Maze.GetHeight() - 0.1f;
|
||||
|
||||
m_vCameraPos = pos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::DoAutopilot( FLOAT fElapsed )
|
||||
{
|
||||
// While there is still time to use up...
|
||||
while( fElapsed )
|
||||
{
|
||||
// See if we need to turn
|
||||
if( m_aAutopilotTargetAngle != m_aCameraYaw )
|
||||
{
|
||||
SHORT diff = SHORT((m_aAutopilotTargetAngle - m_aCameraYaw)&TRIG_ANGLE_MASK);
|
||||
FLOAT fNeeded = abs(diff)/40.0f;
|
||||
if( fNeeded/1000.0f <= fElapsed )
|
||||
{
|
||||
m_aCameraYaw = m_aAutopilotTargetAngle;
|
||||
fElapsed -= fNeeded/1000.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( diff < 0 )
|
||||
m_aCameraYaw -= (DWORD) ((fElapsed*1000.0f) * 40.0f);
|
||||
else
|
||||
m_aCameraYaw += (DWORD) ((fElapsed*1000.0f) * 40.0f);
|
||||
fElapsed = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensure vAutopilotTarget is inside the maze boundry
|
||||
if( m_vAutopilotTarget.x < 0 ||
|
||||
m_vAutopilotTarget.x >= m_Maze.GetWidth() ||
|
||||
m_vAutopilotTarget.z < 0 ||
|
||||
m_vAutopilotTarget.z >= m_Maze.GetHeight() )
|
||||
{
|
||||
ZeroMemory( m_AutopilotVisited, sizeof(m_AutopilotVisited) );
|
||||
m_AutopilotStack.Empty();
|
||||
PickAutopilotTarget();
|
||||
return;
|
||||
}
|
||||
|
||||
// Facing right way, so now compute distance to target
|
||||
D3DXVECTOR3 diff = m_vAutopilotTarget - m_vCameraPos;
|
||||
|
||||
float fRange = float(sqrt((diff.x*diff.x)+(diff.z*diff.z)));
|
||||
|
||||
// Are we there yet?
|
||||
if( fRange > 0 )
|
||||
{
|
||||
// No, so compute how long we'd need
|
||||
FLOAT fNeeded = fRange / 0.002f;
|
||||
|
||||
//Ensure we never leave the boundary of the Maze.
|
||||
D3DXVECTOR3 pos = m_vCameraPos;
|
||||
|
||||
// Do we have enough time this frame?
|
||||
if( fNeeded/1000.0f <= fElapsed )
|
||||
{
|
||||
|
||||
// Yes, so just snap us there
|
||||
pos.x = m_vAutopilotTarget.x;
|
||||
pos.z = m_vAutopilotTarget.z;
|
||||
|
||||
fElapsed -= fNeeded/1000.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No, so move us as far as we can
|
||||
pos.x -= Sin(m_aCameraYaw) * 0.002f * fElapsed*1000.0f;
|
||||
pos.z += Cos(m_aCameraYaw) * 0.002f * fElapsed*1000.0f;
|
||||
|
||||
fElapsed = 0;
|
||||
}
|
||||
|
||||
// Ensure that we have stayed within the maze boundaries
|
||||
if( pos.x < 0 ) pos.x = 0.1f;
|
||||
if( pos.x >= m_Maze.GetWidth() ) pos.x = m_Maze.GetWidth() - 0.1f;
|
||||
if( pos.z < 0 ) pos.z = 0.1f;
|
||||
if( pos.z >= m_Maze.GetHeight() ) pos.z = m_Maze.GetHeight() - 0.1f;
|
||||
|
||||
// Assign our new values back to our globals.
|
||||
m_vCameraPos = pos;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reached target, so pick another
|
||||
PickAutopilotTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::EngageAutopilot( BOOL bEngage )
|
||||
{
|
||||
m_bEngageAutopilot = bEngage;
|
||||
|
||||
if( !IsMazeReady() )
|
||||
return;
|
||||
|
||||
BOOL bPrevious = m_bAutopilot;
|
||||
m_bAutopilot = bEngage;
|
||||
|
||||
// If we weren't on autopilot before and are are autopilot now then need to init autopilot
|
||||
if( m_bAutopilot && !bPrevious )
|
||||
{
|
||||
// First of all, snap us to the centre of the current cell
|
||||
int cellx = int(m_vCameraPos.x);
|
||||
int cellz = int(m_vCameraPos.z);
|
||||
m_vCameraPos.x = cellx + 0.5f;
|
||||
m_vCameraPos.z = cellz + 0.5f;
|
||||
|
||||
// Ensure we're within the maze boundaries
|
||||
if( cellx < 0 ) m_vCameraPos.x = 0.5f;
|
||||
if( cellx >= int(m_Maze.GetWidth()) ) m_vCameraPos.x = m_Maze.GetWidth() - 0.5f;
|
||||
if( cellz < 0 ) m_vCameraPos.z = 0.5f;
|
||||
if( cellz >= int(m_Maze.GetHeight()) ) m_vCameraPos.z = m_Maze.GetHeight() - 0.5f;
|
||||
|
||||
// Clear the visited array and stack
|
||||
ZeroMemory( m_AutopilotVisited, sizeof(m_AutopilotVisited) );
|
||||
m_AutopilotStack.Empty();
|
||||
|
||||
// Pick the next target cell
|
||||
PickAutopilotTarget();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::PickAutopilotTarget()
|
||||
{
|
||||
// Get current cell and mark as visited
|
||||
DWORD currentx = DWORD(m_vCameraPos.x);
|
||||
DWORD currentz = DWORD(m_vCameraPos.z);
|
||||
m_AutopilotVisited[currentz][currentx] = 1;
|
||||
|
||||
// Figure out which directions are allowed. We're allowed to go in any direction
|
||||
// where there isn't a wall in the way and that takes us to a cell we've visited before.
|
||||
BYTE cell = m_Maze.GetCell(currentx,currentz);
|
||||
ANGLE alloweddirs[5];
|
||||
DWORD dwAllowed = 0;
|
||||
|
||||
if( !(cell & MAZE_WALL_NORTH) && !m_AutopilotVisited[currentz-1][currentx] )
|
||||
alloweddirs[dwAllowed++] = NORTH_ANGLE;
|
||||
if( !(cell & MAZE_WALL_WEST) && !m_AutopilotVisited[currentz][currentx-1] )
|
||||
alloweddirs[dwAllowed++] = WEST_ANGLE;
|
||||
if( !(cell & MAZE_WALL_EAST) && !m_AutopilotVisited[currentz][currentx+1] )
|
||||
alloweddirs[dwAllowed++] = EAST_ANGLE;
|
||||
if( !(cell & MAZE_WALL_SOUTH) && !m_AutopilotVisited[currentz+1][currentx] )
|
||||
alloweddirs[dwAllowed++] = SOUTH_ANGLE;
|
||||
/*
|
||||
printf( "Walls: ") );
|
||||
if( (cell & MAZE_WALL_NORTH) )
|
||||
printf( "N ") );
|
||||
if( (cell & MAZE_WALL_WEST) )
|
||||
printf( "W ") );
|
||||
if( (cell & MAZE_WALL_EAST) )
|
||||
printf( "E ") );
|
||||
if( (cell & MAZE_WALL_SOUTH) )
|
||||
printf( "S ") );
|
||||
printf( "\n") );
|
||||
*/
|
||||
|
||||
// Is there anywhere to go?
|
||||
if( dwAllowed == 0 )
|
||||
{
|
||||
// Nope. Can we backtrack?
|
||||
if( m_AutopilotStack.GetCount() > 0 )
|
||||
{
|
||||
// Yes, so pop cell off the stack
|
||||
AutopilotCell cell(m_AutopilotStack.Pop());
|
||||
m_vAutopilotTarget.x = float(cell.x) + 0.5f;
|
||||
m_vAutopilotTarget.z = float(cell.y) + 0.5f;
|
||||
|
||||
if( cell.x < currentx )
|
||||
m_aAutopilotTargetAngle = WEST_ANGLE;
|
||||
else if( cell.x > currentx )
|
||||
m_aAutopilotTargetAngle = EAST_ANGLE;
|
||||
else if( cell.y > currentz )
|
||||
m_aAutopilotTargetAngle = SOUTH_ANGLE;
|
||||
else
|
||||
m_aAutopilotTargetAngle = NORTH_ANGLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No, so we have explored entire maze and must start again
|
||||
ZeroMemory( m_AutopilotVisited, sizeof(m_AutopilotVisited) );
|
||||
m_AutopilotStack.Empty();
|
||||
PickAutopilotTarget();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// See if we can continue in current direction
|
||||
BOOL bPossible = FALSE;
|
||||
for( DWORD i = 0; i < dwAllowed; i++ )
|
||||
{
|
||||
if( alloweddirs[i] == m_aCameraYaw )
|
||||
{
|
||||
bPossible = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If it's allowed to go forward, then have 1 in 2 chance of doing that anyway, otherwise pick randomly from
|
||||
// available alternatives
|
||||
if( bPossible && (rand() & 0x1000) )
|
||||
m_aAutopilotTargetAngle = m_aCameraYaw;
|
||||
else
|
||||
m_aAutopilotTargetAngle = alloweddirs[ (rand() % (dwAllowed<<3) ) >>3 ];
|
||||
|
||||
m_vAutopilotTarget.z = float(currentz) + 0.5f;
|
||||
m_vAutopilotTarget.x = float(currentx) + 0.5f;
|
||||
|
||||
switch( m_aAutopilotTargetAngle )
|
||||
{
|
||||
case SOUTH_ANGLE:
|
||||
m_vAutopilotTarget.z += 1.0f;
|
||||
break;
|
||||
|
||||
case WEST_ANGLE:
|
||||
m_vAutopilotTarget.x -= 1.0f;
|
||||
break;
|
||||
|
||||
case EAST_ANGLE:
|
||||
m_vAutopilotTarget.x += 1.0f;
|
||||
break;
|
||||
|
||||
case NORTH_ANGLE:
|
||||
m_vAutopilotTarget.z -= 1.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
// Push current cell onto stack
|
||||
m_AutopilotStack.Push( AutopilotCell(BYTE(currentx),BYTE(currentz)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CMazeClient::OnPacket( DWORD dwFrom, void* dwData, DWORD dwSize )
|
||||
{
|
||||
HRESULT hr = DPN_OK;
|
||||
|
||||
BOOL fFoundSize = FALSE;
|
||||
DWORD dwReqSize = 0;
|
||||
DWORD dwSRand = 0;
|
||||
|
||||
ServerPacket* pPacket = (ServerPacket*)dwData;
|
||||
switch( pPacket->wType )
|
||||
{
|
||||
case PACKETTYPE_SERVER_CONFIG:
|
||||
{
|
||||
if( dwSize != sizeof(ServerConfigPacket) )
|
||||
{
|
||||
m_pMazeApp->SetDisconnectNow( TRUE );
|
||||
m_pMazeApp->SetOutOfDateClient( TRUE );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Disconnected because MazeClient is out of date.") );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Please get updated version") );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("from http://msdn.microsoft.com/directx/") );
|
||||
break;
|
||||
}
|
||||
|
||||
m_NetConfig = ((ServerConfigPacket*)pPacket)->Config;
|
||||
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Got MazeServer config settings") );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Maze Size=(%d,%d) ReliableRate=%d%%"),
|
||||
m_NetConfig.dwMazeWidth, m_NetConfig.dwMazeHeight,
|
||||
DWORD(m_NetConfig.ubReliableRate) );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("UpdateRate=%dms Timeout=%d"),
|
||||
m_NetConfig.wUpdateRate, m_NetConfig.wTimeout );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("ThreadWait=%dms"),
|
||||
m_NetConfig.dwThreadWait );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("ClientPackSize=%d ServerPackSize=%d (bytes)"),
|
||||
m_NetConfig.wClientPackSizeArray[m_NetConfig.ubClientPackIndex],
|
||||
m_NetConfig.wServerPackSizeArray[m_NetConfig.ubServerPackIndex]);
|
||||
|
||||
// See if we have gotten our fist config. If not, send version info.
|
||||
if(! GotFirstConfig()) //If first time in maze.
|
||||
{
|
||||
// The client expects the server to send a ServerConfigPacket packet first,
|
||||
// then the client sends a ClientVersionPacket, and then the server sends a
|
||||
// ServerAckVersionPacket packet and the game begins
|
||||
ClientVersionPacket packet( MAZE_CLIENT_VERSION );
|
||||
SendPacket( &packet, sizeof(packet), TRUE, 0 );
|
||||
|
||||
SetFirstConfig( TRUE );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PACKETTYPE_SERVER_ACKVERSION:
|
||||
{
|
||||
if( dwSize != sizeof(ServerAckVersionPacket) )
|
||||
{
|
||||
m_pMazeApp->SetDisconnectNow( TRUE );
|
||||
m_pMazeApp->SetOutOfDateClient( TRUE );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Disconnected because MazeClient is out of date.") );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Please get updated version") );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("from http://msdn.microsoft.com/directx/") );
|
||||
break;
|
||||
}
|
||||
|
||||
ServerAckVersionPacket* pAckVersionPacket = (ServerAckVersionPacket*)pPacket;
|
||||
|
||||
// Record the dpnid that the server uses for to talk to us.
|
||||
// This is just done so that we can record this number in the
|
||||
// logs to help match server side logs with client side logs.
|
||||
m_dwLocalClientID = pAckVersionPacket->dwClientID;
|
||||
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Server assigned ID: 0x%0.8x"), m_dwLocalClientID );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Server accepted client version") );
|
||||
|
||||
|
||||
hr = m_Maze.Init( m_NetConfig.dwMazeWidth,
|
||||
m_NetConfig.dwMazeHeight, DEFAULT_SEED );
|
||||
if( FAILED(hr) )
|
||||
DXTRACE_ERR( TEXT("Init"), hr );
|
||||
|
||||
//Seed the random number generator.
|
||||
dwSRand = (DWORD) (DXUtil_Timer( TIMER_GETABSOLUTETIME ) * (DWORD)GetCurrentThreadId() );
|
||||
srand( dwSRand );
|
||||
|
||||
// Set random start location
|
||||
m_vCameraPos = D3DXVECTOR3( rand() % m_Maze.GetWidth() + 0.5f, 0.5,
|
||||
rand() % m_Maze.GetHeight() + 0.5f );
|
||||
|
||||
SetMazeReady( TRUE );
|
||||
EngageAutopilot( TRUE );
|
||||
break;
|
||||
}
|
||||
|
||||
case PACKETTYPE_SERVER_ACKPOS:
|
||||
|
||||
//Make sure we at least have a ServerAckPacket.
|
||||
if( dwSize < sizeof(ServerAckPacket) )
|
||||
{
|
||||
fFoundSize = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Size of our required packet. Does not include custom pack data.
|
||||
dwReqSize = (sizeof(ServerAckPacket) +
|
||||
(sizeof(PlayerStatePacket) *
|
||||
((ServerAckPacket*)pPacket)->wPlayerStatePacketCount));
|
||||
|
||||
//Check to see if we have a valid packet size.
|
||||
if (dwSize < dwReqSize)
|
||||
fFoundSize = FALSE;
|
||||
else if ( !IsValidPackSize( dwSize - dwReqSize ))
|
||||
fFoundSize = FALSE;
|
||||
else
|
||||
fFoundSize = TRUE;
|
||||
}
|
||||
|
||||
//If we did not find a correct packet size. Exit.
|
||||
if( !fFoundSize )
|
||||
{
|
||||
m_pMazeApp->SetDisconnectNow( TRUE );
|
||||
m_pMazeApp->SetOutOfDateClient( TRUE );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Disconnected because MazeClient is out of date.") );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Please get updated version") );
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("from http://msdn.microsoft.com/directx/") );
|
||||
break;
|
||||
}
|
||||
|
||||
//Found correct packet size. Update clients.
|
||||
SetPlayerStats( ((ServerAckPacket*)pPacket)->wPlayerCount,
|
||||
((ServerAckPacket*)pPacket)->wPlayerStatePacketCount );
|
||||
|
||||
if( ((ServerAckPacket*)pPacket)->wPlayerStatePacketCount )
|
||||
HandlePlayerObjectsInAckPacket( (ServerAckPacket*)pPacket );
|
||||
break;
|
||||
|
||||
default:
|
||||
m_pMazeApp->ConsolePrintf( LINE_LOG, TEXT("Received unknown %d byte packet from server"), dwSize );
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
//If the server has given us a custom wait time, Let's sleep for that amount of time.
|
||||
if( m_NetConfig.dwThreadWait > 0 )
|
||||
{
|
||||
Sleep( m_NetConfig.dwThreadWait );
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL CMazeClient::IsValidPackSize( DWORD dwSize )
|
||||
{
|
||||
BOOL fFoundSize = FALSE;
|
||||
BYTE ubPackLocation = m_NetConfig.ubServerPackIndex;
|
||||
|
||||
// Look for valid Client pack size in PackArray.
|
||||
// If found, return TRUE, otherwise FALSE.
|
||||
if(dwSize != m_NetConfig.wServerPackSizeArray[ubPackLocation])
|
||||
{
|
||||
for( --ubPackLocation; ubPackLocation != m_NetConfig.ubServerPackIndex; ubPackLocation--)
|
||||
{
|
||||
if(dwSize == m_NetConfig.wServerPackSizeArray[ubPackLocation])
|
||||
{
|
||||
fFoundSize = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if(ubPackLocation >= PACK_ARRAY_SIZE) ubPackLocation = PACK_ARRAY_SIZE; //Wrap the array.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fFoundSize = TRUE;
|
||||
}
|
||||
|
||||
return fFoundSize;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::OnSessionLost( DWORD dwReason )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::SendPacket( ClientPacket* pPacket, DWORD dwSize,
|
||||
BOOL bGuaranteed, DWORD dwTimeout )
|
||||
{
|
||||
if( m_NetConfig.ubReliableRate > m_NetRandom.Get( 100 ) )
|
||||
bGuaranteed = TRUE;
|
||||
|
||||
m_pNet->SendPacket( pPacket, dwSize, bGuaranteed, dwTimeout );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CMazeClient::GetRoundTripLatencyMS()
|
||||
{
|
||||
return m_pNet->GetRoundTripLatencyMS();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CMazeClient::GetThroughputBPS()
|
||||
{
|
||||
return m_pNet->GetThroughputBPS();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::HandlePlayerObjectsInAckPacket( ServerAckPacket* pPacket )
|
||||
{
|
||||
PlayerStatePacket* pClientInfo = (PlayerStatePacket*)(pPacket+1);
|
||||
|
||||
if( !IsMazeReady() )
|
||||
return;
|
||||
|
||||
// Lock the world database
|
||||
LockWorld();
|
||||
|
||||
// Loop though the PlayerObject chunks
|
||||
for( DWORD count = pPacket->wPlayerStatePacketCount; count; count--, pClientInfo++ )
|
||||
{
|
||||
// Get the PlayerObject we think this is
|
||||
PlayerObject* pPlayerObject = &m_PlayerObjects[pClientInfo->dwID & PLAYER_OBJECT_SLOT_MASK];
|
||||
|
||||
// Does the ID match the one we have?
|
||||
if( pPlayerObject->dwID != pClientInfo->dwID )
|
||||
{
|
||||
// No, so the PlayerObject we have needs to be deleted (server reused the same slot
|
||||
// number, so old PlayerObject must be toast)
|
||||
RemovePlayerObjectFromCells( pPlayerObject );
|
||||
|
||||
// Set the ID to the new ID
|
||||
pPlayerObject->dwID = pClientInfo->dwID;
|
||||
pPlayerObject->wCellX = WORD(pClientInfo->fX);
|
||||
pPlayerObject->wCellY = WORD(pClientInfo->fY);
|
||||
|
||||
// Insert into the appropriate cell list
|
||||
AddPlayerObjectToCells( pPlayerObject );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Yes, compute the new cell coordinates
|
||||
DWORD newcellx = DWORD(pClientInfo->fX);
|
||||
DWORD newcelly = DWORD(pClientInfo->fY);
|
||||
|
||||
// Are they the same as the ones we already have?
|
||||
if( newcellx != pPlayerObject->wCellX || newcelly != pPlayerObject->wCellY )
|
||||
{
|
||||
// No, so need to remove from old cell and add to new one
|
||||
RemovePlayerObjectFromCells( pPlayerObject );
|
||||
pPlayerObject->wCellX = WORD(newcellx);
|
||||
pPlayerObject->wCellY = WORD(newcelly);
|
||||
AddPlayerObjectToCells( pPlayerObject );
|
||||
}
|
||||
}
|
||||
|
||||
// Update timestamp and position
|
||||
pPlayerObject->vPos.x = pClientInfo->fX;
|
||||
pPlayerObject->vPos.y = 0.5f;
|
||||
pPlayerObject->vPos.z = pClientInfo->fY;
|
||||
pPlayerObject->aCameraYaw = pClientInfo->aCameraYaw;
|
||||
pPlayerObject->fLastValidTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
}
|
||||
|
||||
// Unlock world database
|
||||
UnlockWorld();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::AddPlayerObjectToCells( PlayerObject* pPlayerObject )
|
||||
{
|
||||
if( pPlayerObject->wCellX == 0xffff )
|
||||
return;
|
||||
|
||||
if( FALSE == IsPlayerObjectInCell( pPlayerObject->wCellX, pPlayerObject->wCellY, pPlayerObject ) )
|
||||
{
|
||||
PlayerObject** ppCell = &m_pctCells[pPlayerObject->wCellY][pPlayerObject->wCellX];
|
||||
pPlayerObject->pNext = *ppCell;
|
||||
*ppCell = pPlayerObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMazeClient::RemovePlayerObjectFromCells( PlayerObject* pPlayerObject )
|
||||
{
|
||||
if( pPlayerObject->wCellX == 0xffff )
|
||||
return;
|
||||
|
||||
PlayerObject** ppCell = &m_pctCells[pPlayerObject->wCellY][pPlayerObject->wCellX];
|
||||
PlayerObject* pCur = *ppCell;
|
||||
PlayerObject* pPrev = NULL;
|
||||
while( pCur )
|
||||
{
|
||||
if( pCur == pPlayerObject )
|
||||
{
|
||||
pCur = pPlayerObject->pNext;
|
||||
|
||||
// Found pPlayerObject, so remove pPlayerObject from the m_pctCells linked list
|
||||
if( pPrev )
|
||||
pPrev->pNext = pPlayerObject->pNext;
|
||||
else
|
||||
*ppCell = pPlayerObject->pNext;
|
||||
pPlayerObject->pNext = NULL;
|
||||
|
||||
// Update pPlayerObject so that it is marked as removed
|
||||
pPlayerObject->wCellX = pPlayerObject->wCellY = 0xffff;
|
||||
|
||||
// Continue searching, and remove any other instances of
|
||||
// pPlayerObject from list (there shouldn't be, however)
|
||||
}
|
||||
else
|
||||
{
|
||||
pPrev = pCur;
|
||||
pCur = pCur->pNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
PlayerObject* CMazeClient::GetFirstPlayerObjectInCell( DWORD x, DWORD z )
|
||||
{
|
||||
if( !IsMazeReady() )
|
||||
return NULL;
|
||||
|
||||
FLOAT fCurTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
|
||||
// Remove any PlayerObjects which are out of date (since they're probably not really in this
|
||||
// cell any more, but the server has just stopped telling us about them)
|
||||
PlayerObject** ppCell = &m_pctCells[z][x];
|
||||
PlayerObject* pCur = m_pctCells[z][x];
|
||||
PlayerObject* pPrev = NULL;
|
||||
PlayerObject* pPlayerObject = NULL;
|
||||
while( pCur )
|
||||
{
|
||||
// Too old?
|
||||
if( (fCurTime - pCur->fLastValidTime) > 5.0f )
|
||||
{
|
||||
pPlayerObject = pCur;
|
||||
pCur = pCur->pNext;
|
||||
|
||||
// pPlayerObject is too old, so remove pPlayerObject from the m_pctCells linked list
|
||||
if( pPrev )
|
||||
pPrev->pNext = pPlayerObject->pNext;
|
||||
else
|
||||
*ppCell = pPlayerObject->pNext;
|
||||
pPlayerObject->pNext = NULL;
|
||||
|
||||
// Update pPlayerObject so that it is marked as removed
|
||||
pPlayerObject->wCellX = pPlayerObject->wCellY = 0xffff;
|
||||
|
||||
// Continue searching, and remove any other old instances from list
|
||||
}
|
||||
else
|
||||
{
|
||||
pPrev = pCur;
|
||||
pCur = pCur->pNext;
|
||||
}
|
||||
}
|
||||
|
||||
// Now return first remaining PlayerObject in the cell (if any)
|
||||
return m_pctCells[z][x];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL CMazeClient::IsPlayerObjectInCell( DWORD wCellX, DWORD wCellY, PlayerObject* pPlayerObject )
|
||||
{
|
||||
PlayerObject* pPlayerObjectTmp = m_pctCells[wCellY][wCellX];
|
||||
while( pPlayerObjectTmp )
|
||||
{
|
||||
if( pPlayerObjectTmp == pPlayerObject )
|
||||
return TRUE;
|
||||
|
||||
pPlayerObjectTmp = pPlayerObjectTmp->pNext;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: mazeclient.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _MAZE_CLIENT_H
|
||||
#define _MAZE_CLIENT_H
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "DXUtil.h"
|
||||
#include "Maze.h"
|
||||
#include "NetAbstract.h"
|
||||
#include "Packets.h"
|
||||
#include "Trig.h"
|
||||
#include "SimpleStack.h"
|
||||
#include "Packets.h"
|
||||
#include "MazeServer.h"
|
||||
#include "IMazeGraphics.h"
|
||||
|
||||
class CMazeApp;
|
||||
|
||||
// The MAZE_CLIENT_VERSION should be rev'ed whenever the client exposes
|
||||
// new functionality that the server expects. This number is sent to
|
||||
// the server so the server can accept or reject the client based on its version.
|
||||
#define MAZE_CLIENT_VERSION 107
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
struct PlayerObject
|
||||
{
|
||||
DWORD dwID;
|
||||
D3DXVECTOR3 vPos;
|
||||
ANGLE aCameraYaw;
|
||||
WORD wCellX;
|
||||
WORD wCellY;
|
||||
FLOAT fLastValidTime;
|
||||
PlayerObject* pNext;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
#define MAZE_WIDTH 128
|
||||
#define MAZE_HEIGHT 128
|
||||
#define MAZE_SIZE (MAZE_WIDTH*MAZE_HEIGHT)
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CMazeClient : public INetClient
|
||||
{
|
||||
public:
|
||||
CMazeClient();
|
||||
~CMazeClient();
|
||||
|
||||
void SetApp( CMazeApp* pMazeApp ) { m_pMazeApp = pMazeApp; };
|
||||
|
||||
// INetClient
|
||||
virtual HRESULT OnPacket( DWORD from , void* data , DWORD size );
|
||||
virtual void OnSessionLost( DWORD dwReason );
|
||||
|
||||
// Connect an outbound network provider
|
||||
void SetOutboundClient( IOutboundClient* poutnet ) { m_pNet = poutnet; };
|
||||
|
||||
HRESULT Init( CMazeApp* pMazeApp, IMazeGraphics* pMazeGraphics );
|
||||
HRESULT Reset();
|
||||
void Shutdown();
|
||||
void Update( FLOAT elapsed );
|
||||
|
||||
// Lock and unlock the world database
|
||||
void LockWorld() { m_WorldLock.Enter(); };
|
||||
void UnlockWorld() { m_WorldLock.Leave(); };
|
||||
|
||||
// Lock and unlock the world database
|
||||
void SetMazeReady( BOOL bReady ) { if( bReady ) SetEvent( m_hReady ); else ResetEvent( m_hReady ); };
|
||||
BOOL IsMazeReady() { if( WaitForSingleObject( m_hReady, 0 ) == WAIT_OBJECT_0 ) return TRUE; else return FALSE; };
|
||||
|
||||
// Check to see if we have received first Connect Config Packet.
|
||||
void SetFirstConfig( BOOL bReady ) { if( bReady ) SetEvent( m_hGotFirstConfig ); else ResetEvent( m_hGotFirstConfig ); };
|
||||
BOOL GotFirstConfig() { if( WaitForSingleObject( m_hGotFirstConfig, 0 ) == WAIT_OBJECT_0 ) return TRUE; else return FALSE; };
|
||||
|
||||
// Get data useful for the engine (current position, etc. etc.)
|
||||
D3DXVECTOR3 GetCameraPos() const { return m_vCameraPos; };
|
||||
ANGLE GetCameraYaw() const { return m_aCameraYaw; };
|
||||
DWORD GetNumPlayerObjects() const { return m_dwNumPlayerObjects; };
|
||||
|
||||
// Get first engine PlayerObject is a cell
|
||||
// NOTE: The engine must lock the world DB before traversing the cells
|
||||
PlayerObject* GetFirstPlayerObjectInCell( DWORD x, DWORD z );
|
||||
|
||||
// The layout of the maze (engine needs this to draw)
|
||||
CMaze m_Maze;
|
||||
|
||||
// Get network stats
|
||||
DWORD GetThroughputBPS();
|
||||
DWORD GetRoundTripLatencyMS();
|
||||
void GetPlayerStats( DWORD* pdwNumPlayers, DWORD* pdwNumNearbyPlayers ) { m_StatLock.Enter(); *pdwNumPlayers = m_dwNumPlayers; *pdwNumNearbyPlayers = m_dwNumNearbyPlayers; m_StatLock.Leave(); };
|
||||
void SetPlayerStats( DWORD dwNumPlayers, DWORD dwNumNearbyPlayers ) { m_StatLock.Enter(); m_dwNumPlayers = dwNumPlayers; m_dwNumNearbyPlayers = dwNumNearbyPlayers; m_StatLock.Leave(); };
|
||||
DWORD GetLocalClientID() const { return m_dwLocalClientID; };
|
||||
|
||||
// Autopilot
|
||||
void EngageAutopilot( BOOL engage );
|
||||
void SetAutopilot(BOOL engage) { m_bEngageAutopilot = engage; };
|
||||
BOOL IsAutopilot() const { return m_bAutopilot; };
|
||||
|
||||
// Set whether or not we have input focus
|
||||
void SetInputFocus( BOOL havefocus ) { m_bHaveInputFocus = havefocus; };
|
||||
|
||||
protected:
|
||||
CMazeApp* m_pMazeApp;
|
||||
IMazeGraphics* m_pMazeGraphics;
|
||||
|
||||
D3DXVECTOR3 m_vCameraPos;
|
||||
ANGLE m_aCameraYaw;
|
||||
|
||||
DWORD m_dwNumPlayerObjects;
|
||||
|
||||
CRandom m_Rand;
|
||||
|
||||
IOutboundClient* m_pNet;
|
||||
|
||||
FLOAT m_fLastOutboundTime;
|
||||
|
||||
DWORD m_dwNumPlayers;
|
||||
DWORD m_dwNumNearbyPlayers;
|
||||
DWORD m_dwLocalClientID;
|
||||
|
||||
BOOL m_bHaveInputFocus;
|
||||
|
||||
void SendPacket( ClientPacket* packet , DWORD size , BOOL guaranteed, DWORD dwTimeout );
|
||||
|
||||
BOOL IsValidPackSize( DWORD dwSize );
|
||||
|
||||
// Arrays of cells and PlayerObjects (this consitutes the world DB), with associated lock
|
||||
PlayerObject* m_pctCells[SERVER_MAX_HEIGHT][SERVER_MAX_WIDTH];
|
||||
PlayerObject m_PlayerObjects[MAX_PLAYER_OBJECTS];
|
||||
CCriticalSection m_WorldLock;
|
||||
CCriticalSection m_StatLock;
|
||||
HANDLE m_hReady;
|
||||
|
||||
|
||||
// Autopilot stuff
|
||||
struct AutopilotCell
|
||||
{
|
||||
AutopilotCell() {};
|
||||
AutopilotCell( BYTE X , BYTE Y ) : x(X),y(Y) {};
|
||||
BYTE x,y;
|
||||
};
|
||||
SimpleStack<AutopilotCell,MAZE_SIZE> m_AutopilotStack;
|
||||
BYTE m_AutopilotVisited[MAZE_HEIGHT][MAZE_WIDTH];
|
||||
BOOL m_bAutopilot;
|
||||
BOOL m_bEngageAutopilot;
|
||||
D3DXVECTOR3 m_vAutopilotTarget;
|
||||
ANGLE m_aAutopilotTargetAngle;
|
||||
|
||||
void DoAutopilot( FLOAT elapsed );
|
||||
void DoManualPilot( FLOAT elapsed );
|
||||
void PickAutopilotTarget();
|
||||
|
||||
void HandlePlayerObjectsInAckPacket( ServerAckPacket* ppacket );
|
||||
|
||||
void AddPlayerObjectToCells( PlayerObject* pPlayerObject );
|
||||
void RemovePlayerObjectFromCells( PlayerObject* pPlayerObject );
|
||||
BOOL IsPlayerObjectInCell( DWORD wCellX, DWORD wCellY, PlayerObject* pPlayerObject );
|
||||
|
||||
HANDLE m_hGotFirstConfig;
|
||||
|
||||
ClientNetConfig m_NetConfig;
|
||||
CRandom m_NetRandom;
|
||||
BOOL m_bDoneInit;
|
||||
|
||||
private:
|
||||
CMazeClient( const CMazeClient& );
|
||||
void operator=( const CMazeClient& );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,275 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: mazeserver.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _MAZESERVER_H
|
||||
#define _MAZESERVER_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "NetAbstract.h"
|
||||
#include "SyncObjects.h"
|
||||
#include "Maze.h"
|
||||
#include "Random.h"
|
||||
#include "Packets.h"
|
||||
#include "Trig.h"
|
||||
|
||||
class CMaze;
|
||||
struct ClientPosPacket;
|
||||
|
||||
#define SERVER_MAX_WIDTH 128
|
||||
#define SERVER_MAX_HEIGHT 128
|
||||
#define DEFAULT_MAZE_WIDTH 16
|
||||
#define DEFAULT_MAZE_HEIGHT 16
|
||||
#define DEFAULT_SEED 314159
|
||||
#define LOCK_GRID_SIZE 16
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
struct PlayerData
|
||||
{
|
||||
DWORD dwID; // Client ID
|
||||
DWORD NetID; // NetID for owning player (0 if none)
|
||||
DWORD dwVersion; // Version of the owning player
|
||||
BOOL bAllow; // If FALSE, then we should drop this player
|
||||
|
||||
// Links for the various lists
|
||||
PlayerData* pNext; // Free/active PlayerData list (double link)
|
||||
PlayerData* pPrevious;
|
||||
PlayerData* pNextInCell; // Cell list (single link)
|
||||
PlayerData* pNextInIDHashBucket; // ID hash bucket (single link)
|
||||
|
||||
FLOAT fLastDisplayTime;
|
||||
FLOAT fLastCITime;
|
||||
BOOL bActive;
|
||||
|
||||
float fPosX; // Floating point position
|
||||
float fPosY;
|
||||
WORD wCellX; // Coordinates of the cell this player is in
|
||||
WORD wCellY; // or (0xffff,0xffff) for off-map
|
||||
ANGLE aCameraYaw;
|
||||
DWORD dwNumNearbyPlayers; // Number of nearby players
|
||||
|
||||
DWORD pad[4];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ServerCell
|
||||
{
|
||||
PlayerData* pFirstPlayerData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CMazeServer : public INetServer
|
||||
{
|
||||
public:
|
||||
CMazeServer();
|
||||
|
||||
// From INetServer
|
||||
void OnAddConnection( DWORD dwID );
|
||||
HRESULT OnPacket( DWORD from, void* pData, DWORD dwSize );
|
||||
void OnRemoveConnection( DWORD dwID );
|
||||
void OnSessionLost( DWORD dwReason );
|
||||
|
||||
// Hook up to the network service
|
||||
void SetOutboundServer( IOutboundServer* poutnet ) { m_pNet = poutnet; };
|
||||
|
||||
// Initialisation - need to hook up a maze object
|
||||
HRESULT Init( BOOL bLocalLoopback, const CMaze* pmaze );
|
||||
void Shutdown();
|
||||
|
||||
// Chance of server sending packets via reliable transport
|
||||
void SetServerReliableRate( DWORD percent ) { m_dwServerReliableRate = percent; };
|
||||
DWORD GetServerReliableRate() const { return m_dwServerReliableRate; };
|
||||
|
||||
// Timeout of server's packets
|
||||
void SetServerTimeout( DWORD timeout ) { m_dwServerTimeout = timeout; };
|
||||
DWORD GetServerTimeout() const { return m_dwServerTimeout; };
|
||||
|
||||
// Change of client sending packets via reliable transport. Setting this causes the server
|
||||
// to propagate this setting to all currently connected clients
|
||||
void SetClientReliableRate( DWORD percent );
|
||||
DWORD GetClientReliableRate() const { return DWORD(m_ClientNetConfig.ubReliableRate); };
|
||||
|
||||
// Change client update rate. Setting this causes the server to propagate this setting to all
|
||||
// currently connected clients
|
||||
void SetClientUpdateRate( DWORD rate );
|
||||
DWORD GetClientUpdateRate() const { return DWORD(m_ClientNetConfig.wUpdateRate); };
|
||||
|
||||
// Change client timeout. Setting this causes the server to propagate this setting to all
|
||||
// currently connected clients
|
||||
void SetClientTimeout( DWORD timeout );
|
||||
DWORD GetClientTimeout() const { return DWORD(m_ClientNetConfig.wTimeout); };
|
||||
|
||||
// Change Client position pack size. Setting this causes the server to propagate this setting to all
|
||||
// currently connected clients
|
||||
void SetClientPackSize( DWORD size );
|
||||
DWORD GetClientPackSize() const { return DWORD(m_ClientNetConfig.wClientPackSizeArray[m_ClientNetConfig.ubClientPackIndex]); };
|
||||
|
||||
// Change Server position pack size.
|
||||
void SetServerPackSize( DWORD size );
|
||||
DWORD GetServerPackSize() const { return DWORD(m_ClientNetConfig.wServerPackSizeArray[m_ClientNetConfig.ubServerPackIndex]); };
|
||||
|
||||
// How long the user wants to hold the Server's Dplay Threads
|
||||
void SetServerThreadWait( DWORD threadwait ) { m_dwServerThreadWait = threadwait; };
|
||||
DWORD GetServerThreadWait() const { return m_dwServerThreadWait; };
|
||||
|
||||
// How long the user wants to hold the Server's Dplay Threads
|
||||
void SetClientThreadWait( DWORD threadwait );
|
||||
DWORD GetClientThreadWait() const { return DWORD(m_ClientNetConfig.dwThreadWait); };
|
||||
|
||||
|
||||
// Various commands
|
||||
void DisplayConnectionInfo( DWORD dwID );
|
||||
void DisplayNextConnectionInfo();
|
||||
void PrintStats();
|
||||
|
||||
void SetLogLevel( DWORD dwLogLevel ) { m_dwLogLevel = dwLogLevel; }
|
||||
DWORD GetLogLevel() { return m_dwLogLevel; }
|
||||
|
||||
DWORD GetNumPlayers() { return m_dwPlayerCount; }
|
||||
|
||||
protected:
|
||||
BOOL m_bLocalLoopback;
|
||||
IOutboundServer* m_pNet;
|
||||
const CMaze* m_pMaze;
|
||||
DWORD m_dwLogLevel;
|
||||
DWORD m_dwWidth;
|
||||
DWORD m_dwHeight;
|
||||
CCriticalSection m_AddRemoveLock;
|
||||
|
||||
// A fixed sized grid of locks which we lay over the maze to control access to it
|
||||
// We demand that the maze dimensions are a power-of-2 times the dimensions of this
|
||||
// grid, and pre-store that power to allow fast translation
|
||||
CLockArray<LOCK_GRID_SIZE,LOCK_GRID_SIZE> m_LockGrid;
|
||||
DWORD m_dwMazeXShift;
|
||||
DWORD m_dwMazeYShift;
|
||||
void LockCell( DWORD x , DWORD y );
|
||||
void UnlockCell( DWORD x , DWORD y );
|
||||
void LockRange( DWORD x1 , DWORD y1 , DWORD x2 , DWORD y2 );
|
||||
void UnlockRange( DWORD x1 , DWORD y1 , DWORD x2 , DWORD y2 );
|
||||
void LockCellPair( DWORD x1 , DWORD y1 , DWORD x2 , DWORD y2 );
|
||||
void UnlockCellPair( DWORD x1 , DWORD y1 , DWORD x2 , DWORD y2 );
|
||||
CCriticalSection m_OffMapLock;
|
||||
|
||||
// The PlayerData lists
|
||||
PlayerData m_PlayerDatas[MAX_PLAYER_OBJECTS];
|
||||
PlayerData* m_pFirstActivePlayerData;
|
||||
PlayerData* m_pFirstFreePlayerData;
|
||||
DWORD m_dwActivePlayerDataCount;
|
||||
DWORD m_dwPlayerDataUniqueValue;
|
||||
CCriticalSection m_PlayerDataListLock;
|
||||
|
||||
// The player object locks
|
||||
enum { NUM_PLAYER_OBJECT_LOCKS = 16 };
|
||||
CCriticalSection m_PlayerDataLocks[NUM_PLAYER_OBJECT_LOCKS];
|
||||
void LockPlayerData( PlayerData* pPlayerData ) { m_PlayerDataLocks[((pPlayerData-m_PlayerDatas) & (NUM_PLAYER_OBJECT_LOCKS-1))].Enter(); };
|
||||
void UnlockPlayerData( PlayerData* pPlayerData ) { m_PlayerDataLocks[((pPlayerData-m_PlayerDatas) & (NUM_PLAYER_OBJECT_LOCKS-1))].Leave(); };
|
||||
|
||||
PlayerData* CreatePlayerData();
|
||||
void DestroyPlayerData( PlayerData* pPlayerData );
|
||||
|
||||
// The cell array and the "off-map" cell.
|
||||
ServerCell m_OffMapCell;
|
||||
ServerCell m_Cells[SERVER_MAX_WIDTH][SERVER_MAX_HEIGHT];
|
||||
|
||||
// Remove playerdata from its cell
|
||||
void RemovePlayerDataFromCell( PlayerData* pPlayerData );
|
||||
|
||||
// Unsafe versions of add/remove. Must have playerdata and cell locked when you call this
|
||||
void UnsafeRemovePlayerDataFromCell( PlayerData* pPlayerData );
|
||||
void UnsafeAddPlayerDataToCell( PlayerData* pPlayerData );
|
||||
|
||||
ServerCell* GetCell( PlayerData* pPlayerData )
|
||||
{
|
||||
if ( pPlayerData->wCellX == 0xffff )
|
||||
return &m_OffMapCell;
|
||||
else
|
||||
return &m_Cells[pPlayerData->wCellY][pPlayerData->wCellX];
|
||||
};
|
||||
|
||||
void HandleClientPosPacket( DWORD dwFrom, ClientPosPacket* pPacket );
|
||||
void HandleClientVersionPacket( DWORD dwFrom, ClientVersionPacket* pClientVersionPack );
|
||||
void HandleUnknownPacket( DWORD dwFrom, ClientPacket* pClientPack, DWORD size );
|
||||
|
||||
BOOL IsValidPackSize( DWORD wSize );
|
||||
BOOL IsClientVersionSupported( DWORD dwClientVersion );
|
||||
|
||||
DWORD m_dwPlayerCount;
|
||||
|
||||
CCriticalSection m_csThreadCountLock;
|
||||
WORD m_wActiveThreadCount;
|
||||
WORD m_wMaxThreadCount;
|
||||
FLOAT m_fAvgThreadCount;
|
||||
FLOAT m_fAvgThreadTime;
|
||||
FLOAT m_fMaxThreadTime;
|
||||
|
||||
DWORD m_dwPeakPlayerCount;
|
||||
|
||||
// Hashing DPIDs to PlayerData pointers
|
||||
void SetPlayerDataForID( DWORD dwID, PlayerData* pPlayerData );
|
||||
PlayerData* GetPlayerDataForID( DWORD dwID );
|
||||
void RemovePlayerDataID( PlayerData* pPlayerData );
|
||||
DWORD IDHash( DWORD dwID );
|
||||
enum { NUM_ID_HASH_BUCKETS = 1024 };
|
||||
enum { NUM_ID_HASH_BUCKET_LOCKS = 16 };
|
||||
PlayerData* m_pstIDHashBucket[NUM_ID_HASH_BUCKETS];
|
||||
CCriticalSection m_IDHashBucketLocks[NUM_ID_HASH_BUCKET_LOCKS];
|
||||
|
||||
// Random number generator
|
||||
CRandom m_Rand;
|
||||
|
||||
// Send packet wrapper
|
||||
HRESULT SendPacket( DWORD dwTo, void* pData, DWORD dwSize, BOOL bReliable, DWORD dwTimeout );
|
||||
void SendConfigPacketToAll( ServerConfigPacket* pPacket );
|
||||
|
||||
// Network configuration parameters
|
||||
DWORD m_dwServerReliableRate;
|
||||
DWORD m_dwServerTimeout;
|
||||
DWORD m_dwServerThreadWait;
|
||||
|
||||
ClientNetConfig m_ClientNetConfig;
|
||||
CCriticalSection m_ClientNetConfigLock;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: This function is called by the server to output informational text.
|
||||
// In the client it should probably just be a dummy function, in the server
|
||||
// it should probably just spew out to the console
|
||||
//-----------------------------------------------------------------------------
|
||||
enum ServerBufferType { SLINE_PROMPT, SLINE_INPUT, SLINE_LOG, SLINE_CMD };
|
||||
void ConsolePrintf( ServerBufferType enumLineType, const TCHAR* fmt , ... );
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: netabstract.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _NETABSTRACT_H
|
||||
#define _NETABSTRACT_H
|
||||
|
||||
|
||||
#define SERVER_ID 1
|
||||
enum { DISCONNNECT_REASON_UNKNOWN = 0, DISCONNNECT_REASON_CLIENT_OUT_OF_DATE };
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
interface INetServer
|
||||
{
|
||||
public:
|
||||
virtual ~INetServer() {} ;
|
||||
|
||||
virtual HRESULT OnPacket( DWORD dwFrom, void* dwData, DWORD dwSize ) = 0;
|
||||
virtual void OnAddConnection( DWORD dwID ) = 0;
|
||||
virtual void OnRemoveConnection( DWORD dwID ) = 0;
|
||||
virtual void OnSessionLost( DWORD dwReason ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
interface INetClient
|
||||
{
|
||||
public:
|
||||
virtual ~INetClient() {} ;
|
||||
|
||||
virtual HRESULT OnPacket( DWORD dwFrom, void* dwData, DWORD dwSize ) = 0;
|
||||
virtual void OnSessionLost( DWORD dwReason ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
interface IOutboundServer
|
||||
{
|
||||
public:
|
||||
virtual HRESULT SendPacket( DWORD dwTo, void* dwData, DWORD dwSize,
|
||||
BOOL dwGuaranteed, DWORD dwTimeout ) = 0;
|
||||
virtual HRESULT GetConnectionInfo( DWORD dwID, TCHAR* strConnectionInfo ) = 0;
|
||||
virtual HRESULT RejectClient( DWORD dwID, HRESULT hrReason ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
interface IOutboundClient
|
||||
{
|
||||
public:
|
||||
virtual HRESULT SendPacket( void* dwData, DWORD dwSize,
|
||||
BOOL dwGuaranteed, DWORD dwTimeout ) = 0;
|
||||
virtual DWORD GetThroughputBPS() = 0;
|
||||
virtual DWORD GetRoundTripLatencyMS() = 0;
|
||||
virtual BOOL IsSessionLost() = 0;
|
||||
virtual DWORD GetSessionLostReason() = 0;
|
||||
virtual HRESULT GetConnectionInfo( TCHAR* strConnectionInfo ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,188 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: packets.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _PACKETS_H
|
||||
#define _PACKETS_H
|
||||
|
||||
#include "Trig.h"
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
#define PACK_ARRAY_SIZE 10 //Set the number of elements in our pack array to 10.
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
enum
|
||||
{
|
||||
PACKETTYPE_SERVER_CONFIG, // first packet sent
|
||||
PACKETTYPE_CLIENT_VERSION, // client responds to PACKETTYPE_SERVER_CONFIG w/ this
|
||||
PACKETTYPE_SERVER_ACKVERSION, // server then responds to PACKETTYPE_CLIENT_VERSION w/ this and game begins
|
||||
PACKETTYPE_CLIENT_POS, // sent to server as client moves
|
||||
PACKETTYPE_SERVER_ACKPOS // sent to client as server acks the PACKETTYPE_CLIENT_POS packets
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Base class for packets sent from client to server
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ClientPacket
|
||||
{
|
||||
ClientPacket();
|
||||
ClientPacket( WORD type ) :
|
||||
wType(type) {};
|
||||
|
||||
WORD wType;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ClientPosPacket : public ClientPacket
|
||||
{
|
||||
ClientPosPacket();
|
||||
ClientPosPacket( float x , float y, ANGLE cameraYaw )
|
||||
: ClientPacket( PACKETTYPE_CLIENT_POS ) , fX(x) , fY(y), aCameraYaw(cameraYaw) {};
|
||||
|
||||
float fX,fY;
|
||||
ANGLE aCameraYaw;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ClientVersionPacket : public ClientPacket
|
||||
{
|
||||
ClientVersionPacket();
|
||||
ClientVersionPacket( DWORD version )
|
||||
: ClientPacket( PACKETTYPE_CLIENT_VERSION ) , dwVersion(version) {};
|
||||
|
||||
DWORD dwVersion;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Structure containing client net configuration data.
|
||||
// The server sends this to clients
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ClientNetConfig
|
||||
{
|
||||
DWORD dwMazeWidth;
|
||||
DWORD dwMazeHeight;
|
||||
DWORD dwThreadWait;
|
||||
WORD wUpdateRate;
|
||||
WORD wTimeout;
|
||||
WORD wClientPackSizeArray[PACK_ARRAY_SIZE]; //Array of 10 custom sizes passed in by user.
|
||||
WORD wServerPackSizeArray[PACK_ARRAY_SIZE]; //Array of 10 custom server sizes.
|
||||
BYTE ubClientPackIndex;
|
||||
BYTE ubServerPackIndex;
|
||||
|
||||
BYTE ubReliableRate; // Percentage of packets to be transmitted reliably
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Base class for packets sent from server to client
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ServerPacket
|
||||
{
|
||||
ServerPacket();
|
||||
ServerPacket( WORD type ) : wType(type) {};
|
||||
|
||||
WORD wType;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Configuration data send from server to client
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ServerAckVersionPacket : public ServerPacket
|
||||
{
|
||||
ServerAckVersionPacket();
|
||||
ServerAckVersionPacket( BOOL accepted, DWORD clientID ) :
|
||||
ServerPacket(PACKETTYPE_SERVER_ACKVERSION), bAccepted(accepted), dwClientID(clientID) {};
|
||||
|
||||
DWORD dwClientID;
|
||||
BOOL bAccepted;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Configuration data send from server to client
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ServerConfigPacket : public ServerPacket
|
||||
{
|
||||
ServerConfigPacket();
|
||||
ServerConfigPacket( const ClientNetConfig& config ) :
|
||||
ServerPacket(PACKETTYPE_SERVER_CONFIG) , Config(config) {};
|
||||
|
||||
ClientNetConfig Config;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Chunk of client data for server send to a client
|
||||
//-----------------------------------------------------------------------------
|
||||
struct PlayerStatePacket
|
||||
{
|
||||
DWORD dwID;
|
||||
float fX;
|
||||
float fY;
|
||||
ANGLE aCameraYaw;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ServerAckPacket : public ServerPacket
|
||||
{
|
||||
ServerAckPacket();
|
||||
ServerAckPacket( DWORD playercount )
|
||||
: ServerPacket(PACKETTYPE_SERVER_ACKPOS),
|
||||
wPlayerCount(WORD(playercount)) {};
|
||||
|
||||
WORD wPlayerCount; // Count of total players on server
|
||||
WORD wPlayerStatePacketCount; // Count of following PlayerStatePacket structures
|
||||
};
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,66 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: random.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _RANDOM_H
|
||||
#define _RANDOM_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Random number generator class - a simple linear congruential generator.
|
||||
// We use this instead of the CRT function because we want to be certain that
|
||||
// we are using the exact same generator on both server and client side and so
|
||||
// (a) don't want to be at the mercy of CRT version changes, and (b) may want
|
||||
// multiple independent generators which we can rely on the sequencing of.
|
||||
//-----------------------------------------------------------------------------
|
||||
class CRandom
|
||||
{
|
||||
public:
|
||||
// Constructor. The random formula is X(n+1) = (a*X(n) + b) mod m
|
||||
// The default values for a,b,m give a maximal period generator that does not
|
||||
// overflow with 32-bit interger arithmetic.
|
||||
CRandom( DWORD seed = 31415, DWORD a = 8121,
|
||||
DWORD b = 28411, DWORD m = 134456 ) :
|
||||
m_dwSeed(seed),m_dwA(a),m_dwB(b),m_dwM(m) {};
|
||||
|
||||
// Grab a random DWORD between 0 and m
|
||||
DWORD Get()
|
||||
{
|
||||
m_dwSeed = ((m_dwA*m_dwSeed)+m_dwB) % m_dwM;
|
||||
return m_dwSeed;
|
||||
};
|
||||
|
||||
// Grab a random DWORD in the range [0,n-1]
|
||||
DWORD Get( DWORD n )
|
||||
{
|
||||
return (Get() % n);
|
||||
};
|
||||
|
||||
// Grab a random float in the range [0,1]
|
||||
float GetFloat()
|
||||
{
|
||||
return Get() / float(m_dwM-1);
|
||||
};
|
||||
|
||||
// Reset the seed
|
||||
void Reset( DWORD seed = 31415 )
|
||||
{
|
||||
m_dwSeed = seed;
|
||||
};
|
||||
|
||||
protected:
|
||||
DWORD m_dwA, m_dwB, m_dwM;
|
||||
DWORD m_dwSeed;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,54 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: simplestack.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _SIMPLE_STACK_H
|
||||
#define _SIMPLE_STACK_H
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
template< class Item , DWORD size > class SimpleStack
|
||||
{
|
||||
public:
|
||||
SimpleStack()
|
||||
{
|
||||
m_dwCount = 0;
|
||||
};
|
||||
|
||||
void Push( const Item& item )
|
||||
{
|
||||
m_Stack[m_dwCount++] = item;
|
||||
};
|
||||
|
||||
Item Pop()
|
||||
{
|
||||
return m_Stack[--m_dwCount];
|
||||
};
|
||||
|
||||
DWORD GetCount() const
|
||||
{
|
||||
return m_dwCount;
|
||||
};
|
||||
|
||||
void Empty()
|
||||
{
|
||||
m_dwCount = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
Item m_Stack[size];
|
||||
DWORD m_dwCount;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: stressmazeguid.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _STRESSMAZE_GUID_H
|
||||
#define _STRESSMAZE_GUID_H
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// {C8078137-D0BD-444a-9CF3-4CFB2A0B759E}
|
||||
static const GUID StressMazeAppGUID =
|
||||
{ 0xc8078137, 0xd0bd, 0x444a, { 0x9c, 0xf3, 0x4c, 0xfb, 0x2a, 0xb, 0x75, 0x9e } };
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,204 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: syncobjects.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _SYNC_OBJECTS_H
|
||||
#define _SYNC_OBJECTS_H
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Simple wrapper for critical section
|
||||
//-----------------------------------------------------------------------------
|
||||
class CCriticalSection
|
||||
{
|
||||
public:
|
||||
CCriticalSection( DWORD spincount = 2000 )
|
||||
{
|
||||
InitializeCriticalSection( &m_CritSec );
|
||||
};
|
||||
|
||||
~CCriticalSection()
|
||||
{
|
||||
DeleteCriticalSection( &m_CritSec );
|
||||
};
|
||||
|
||||
void Enter()
|
||||
{
|
||||
EnterCriticalSection( &m_CritSec );
|
||||
};
|
||||
|
||||
void Leave()
|
||||
{
|
||||
LeaveCriticalSection( &m_CritSec );
|
||||
};
|
||||
|
||||
private:
|
||||
CRITICAL_SECTION m_CritSec;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Array of critical section objects. The methods allow locking single
|
||||
// elements, rectangular regions, or a combination. Using these methods
|
||||
// ensures the cells are locked/unlocked in a consistent order
|
||||
// which prevents deadlocks.
|
||||
//-----------------------------------------------------------------------------
|
||||
template< DWORD width , DWORD height > class CLockArray
|
||||
{
|
||||
public:
|
||||
#define CS_RESOLUTION 4
|
||||
|
||||
// Lock/Unlock a single cell
|
||||
void LockCell( DWORD x , DWORD y )
|
||||
{
|
||||
x /= CS_RESOLUTION;
|
||||
y /= CS_RESOLUTION;
|
||||
|
||||
assert( x<width && y<height );
|
||||
|
||||
m_Grid[y][x].Enter();
|
||||
};
|
||||
|
||||
void UnlockCell( DWORD x , DWORD y )
|
||||
{
|
||||
x /= CS_RESOLUTION;
|
||||
y /= CS_RESOLUTION;
|
||||
|
||||
assert( x<width && y<height );
|
||||
|
||||
m_Grid[y][x].Leave();
|
||||
};
|
||||
|
||||
// Lock/Unlock a rectangular range of cells
|
||||
void LockRange( DWORD x1 , DWORD y1 , DWORD x2 , DWORD y2 )
|
||||
{
|
||||
x1 /= CS_RESOLUTION;
|
||||
y1 /= CS_RESOLUTION;
|
||||
x2 /= CS_RESOLUTION;
|
||||
y2 /= CS_RESOLUTION;
|
||||
|
||||
if ( x1 > x2 ) { DWORD t = x1; x1 = x2; x2 = t; }; // x1 == min
|
||||
if ( y1 > y2 ) { DWORD t = y1; y1 = y2; y2 = t; }; // y1 == min
|
||||
|
||||
assert( x1 <= x2 && y1 <= y2 );
|
||||
assert( x1<width && y1<height );
|
||||
assert( x2<width && y2<height );
|
||||
|
||||
// Lock from xmin,ymin to xmax,ymax (from xmin,y to xmax,y first)
|
||||
for ( INT y = y1 ; y <= (INT) y2 ; y++ )
|
||||
for ( INT x = x1 ; x <= (INT) x2 ; x++ )
|
||||
m_Grid[y][x].Enter();
|
||||
};
|
||||
|
||||
void UnlockRange( DWORD x1 , DWORD y1 , DWORD x2 , DWORD y2 )
|
||||
{
|
||||
x1 /= CS_RESOLUTION;
|
||||
y1 /= CS_RESOLUTION;
|
||||
x2 /= CS_RESOLUTION;
|
||||
y2 /= CS_RESOLUTION;
|
||||
|
||||
if ( x1 > x2 ) { DWORD t = x1; x1 = x2; x2 = t; }; // x1 == min
|
||||
if ( y1 > y2 ) { DWORD t = y1; y1 = y2; y2 = t; }; // y1 == min
|
||||
|
||||
assert( x1 <= x2 && y1 <= y2 );
|
||||
assert( x1<width && y1<height );
|
||||
assert( x2<width && y2<height );
|
||||
|
||||
// Unlock from xmax,ymax to xmin,ymin
|
||||
for ( INT y = y2 ; y >= (INT) y1 ; y-- )
|
||||
for ( INT x = x2 ; x >= (INT) x1 ; x-- )
|
||||
m_Grid[y][x].Leave();
|
||||
};
|
||||
|
||||
void LockCellPair( DWORD x1, DWORD y1, DWORD x2, DWORD y2 )
|
||||
{
|
||||
x1 /= CS_RESOLUTION;
|
||||
y1 /= CS_RESOLUTION;
|
||||
x2 /= CS_RESOLUTION;
|
||||
y2 /= CS_RESOLUTION;
|
||||
|
||||
assert( x1<width && y1<height );
|
||||
assert( x2<width && y2<height );
|
||||
|
||||
if( x1 == x2 && y1 == y2 )
|
||||
{
|
||||
LockCell( x1, y1 );
|
||||
return;
|
||||
}
|
||||
|
||||
if( (y1<y2) || ((y1==y2)&&(x1<=x2)) )
|
||||
{
|
||||
assert( ((y1<y2)) || // y1 < y2 case
|
||||
((y1==y2)&&(x1<=x2)) ); // y1 == y2 case
|
||||
|
||||
// Lock from xmin,ymin to xmax,ymax (from xmin,y to xmax,y first)
|
||||
LockCell(x1,y1);
|
||||
LockCell(x2,y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( ((y1>=y2)) || // y1 < y2 case
|
||||
((y1==y2)&&(x1>x2)) ); // y1 == y2 case
|
||||
|
||||
// Lock from xmin,ymin to xmax,ymax (from xmin,y to xmax,y first)
|
||||
LockCell(x2,y2);
|
||||
LockCell(x1,y1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UnlockCellPair( DWORD x1, DWORD y1, DWORD x2, DWORD y2 )
|
||||
{
|
||||
x1 /= CS_RESOLUTION;
|
||||
y1 /= CS_RESOLUTION;
|
||||
x2 /= CS_RESOLUTION;
|
||||
y2 /= CS_RESOLUTION;
|
||||
|
||||
assert( x1<width && y1<height );
|
||||
assert( x2<width && y2<height );
|
||||
|
||||
if( x1 == x2 && y1 == y2 )
|
||||
{
|
||||
UnlockCell( x1, y1 );
|
||||
return;
|
||||
}
|
||||
|
||||
if( (y1<y2) || ((y1==y2)&&(x1<=x2)) )
|
||||
{
|
||||
assert( ((y1<y2)) || // y1 < y2 case
|
||||
((y1==y2)&&(x1<=x2)) ); // y1 == y2 case
|
||||
|
||||
// Unlock from xmax,ymax to xmin,ymin (from xmax,y to xmin,y first)
|
||||
UnlockCell(x2,y2);
|
||||
UnlockCell(x1,y1);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( ((y1>=y2)) || // y1 < y2 case
|
||||
((y1==y2)&&(x1>x2)) ); // y1 == y2 case
|
||||
|
||||
// Unlock from xmax,ymax to xmin,ymin (from xmax,y to xmin,y first)
|
||||
UnlockCell(x1,y1);
|
||||
UnlockCell(x2,y2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
CCriticalSection m_Grid[height][width];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File:
|
||||
//
|
||||
// Desc:
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _CLIENT_ID_H
|
||||
#define _CLIENT_ID_H
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc: Client IDs are 32-bit values that refer to a particular Client. They are
|
||||
// broken up into two bitfields, one of which can be used into an index
|
||||
// of a list of Client 'slots', the other bitfield is a "uniqueness" value
|
||||
// that is incremented each time a new Client is created. Hence, although
|
||||
// the same slot may be reused by different Clients are different times,
|
||||
// it's possible to distinguish between the two by comparing uniqueness
|
||||
// values (you can just compare the whole 32-bit id).
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef DWORD CLClientID;
|
||||
|
||||
#define CLIENT_SLOT_BITS 13
|
||||
#define MAX_CLIENTS (1<<CLIENT_SLOT_BITS)
|
||||
#define CLIENT_SLOT_MASK (MAX_CLIENTS-1)
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: trig.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _TRIG_H
|
||||
#define _TRIG_H
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef DWORD ANGLE;
|
||||
|
||||
const float TRIG_ANGLE_SCALE = (3.1415926536f*2.0f) / 65536.0f;
|
||||
#define TRIG_ANGLE_MASK 0xffff
|
||||
|
||||
inline float Sin( ANGLE angle ) { return float(sin(float(angle&0xffff)*TRIG_ANGLE_SCALE)); };
|
||||
inline float Cos( ANGLE angle ) { return float(cos(float(angle&0xffff)*TRIG_ANGLE_SCALE)); };
|
||||
inline float AngleToFloat( ANGLE angle ) { return float(angle&0xffff) * TRIG_ANGLE_SCALE; };
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,845 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: dplay8client.cpp
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <windows.h>
|
||||
#include <d3dx.h>
|
||||
#include <process.h>
|
||||
#include <tchar.h>
|
||||
#include <assert.h>
|
||||
#include <dxerr8.h>
|
||||
#include <stdio.h>
|
||||
#include <dplay8.h>
|
||||
#include <dpaddr.h>
|
||||
#include "DummyConnector.h"
|
||||
#include "StressMazeGUID.h"
|
||||
#include "DXUtil.h"
|
||||
#include "MazeApp.h"
|
||||
#include "DPlay8Client.h"
|
||||
|
||||
|
||||
#define DPMAZESERVER_PORT 2309
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
CDPlay8Client::CDPlay8Client()
|
||||
{
|
||||
m_dwNumSessions = 0;
|
||||
|
||||
m_wActiveThreadCount = 0;
|
||||
m_wMaxThreadCount = 0;
|
||||
m_fAvgThreadCount = 0;
|
||||
m_fAvgThreadTime = 0;
|
||||
m_fMaxThreadTime = 0;
|
||||
|
||||
m_pClient = NULL;
|
||||
m_pDPlay = NULL;
|
||||
m_dpnhEnum = NULL;
|
||||
m_bSessionLost = TRUE;
|
||||
m_dwSessionLostReason = DISCONNNECT_REASON_UNKNOWN;
|
||||
|
||||
for( DWORD dwIndex = 0; dwIndex < MAX_SESSIONS; dwIndex++ )
|
||||
{
|
||||
m_pHostAddresses[dwIndex] = NULL;
|
||||
m_pDeviceAddresses[dwIndex] = NULL;
|
||||
}
|
||||
|
||||
InitializeCriticalSection( &m_csLock );
|
||||
InitializeCriticalSection( &m_csThreadCountLock );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
CDPlay8Client::~CDPlay8Client()
|
||||
{
|
||||
DeleteCriticalSection( &m_csLock );
|
||||
DeleteCriticalSection( &m_csThreadCountLock );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Client::Init(MazeConfig* pMazeConfig)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
m_MazeConfig = pMazeConfig;
|
||||
|
||||
Shutdown();
|
||||
|
||||
if( FAILED( hr = CoCreateInstance( CLSID_DirectPlay8Client, NULL,
|
||||
CLSCTX_ALL, IID_IDirectPlay8Client,
|
||||
(LPVOID*) &m_pDPlay ) ) )
|
||||
return DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
|
||||
|
||||
if( FAILED( hr = m_pDPlay->Initialize( this, StaticReceiveHandler, 0 ) ) )
|
||||
return DXTRACE_ERR( TEXT("Initialize"), hr );
|
||||
|
||||
// If between Range, attempt to set SPThreads.
|
||||
if((m_MazeConfig->dwSPThreads >= MIN_SP_THREADS) && (m_MazeConfig->dwSPThreads <= MAX_SP_THREADS))
|
||||
{
|
||||
SetNumSPThreads(m_MazeConfig->dwSPThreads);
|
||||
}
|
||||
|
||||
// If less than MAX, set our SP Buffer.
|
||||
if(m_MazeConfig->dwSPBufferSize <= MAX_SP_BUFFER)
|
||||
{
|
||||
SetSPBuffer(m_MazeConfig->dwSPBufferSize);
|
||||
}
|
||||
|
||||
m_fLastUpdateConnectInfoTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
m_bSessionLost = TRUE;
|
||||
m_dwNumSessions = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CDPlay8Client::GetNumSPThreads()
|
||||
{
|
||||
|
||||
HRESULT hr = DPN_OK;
|
||||
|
||||
DPN_SP_CAPS dnSPCaps;
|
||||
DWORD dwFlags = NULL;
|
||||
DWORD dwNumSPThreads = NULL;
|
||||
|
||||
DXTRACE_MSG( TEXT("Attempting to Get SP Thread Count.") );
|
||||
|
||||
dnSPCaps.dwSize = sizeof(DPN_SP_CAPS);
|
||||
|
||||
hr = m_pDPlay->GetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr != DPN_OK)
|
||||
{
|
||||
DXTRACE_ERR( TEXT("GetSPCaps error"), hr );
|
||||
dwNumSPThreads = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwNumSPThreads = dnSPCaps.dwNumThreads;
|
||||
}
|
||||
|
||||
return dwNumSPThreads;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDPlay8Client::SetNumSPThreads(DWORD dwNumSPThreads)
|
||||
{
|
||||
HRESULT hr = DPN_OK;
|
||||
|
||||
DPN_SP_CAPS dnSPCaps;
|
||||
DWORD dwFlags = NULL;
|
||||
|
||||
dnSPCaps.dwSize = sizeof(DPN_SP_CAPS);
|
||||
hr = m_pDPlay->GetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr == DPN_OK)
|
||||
{
|
||||
if((dwNumSPThreads >= MIN_SP_THREADS) && (dwNumSPThreads <= MAX_SP_THREADS))
|
||||
{
|
||||
dnSPCaps.dwNumThreads = dwNumSPThreads;
|
||||
|
||||
// Attempt to set the number of SP Threads.
|
||||
hr = m_pDPlay->SetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr != DPN_OK)
|
||||
{
|
||||
DXTRACE_ERR( TEXT("SetSPCaps error."), hr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DXTRACE_ERR( TEXT("GetSPCaps error."), hr );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CDPlay8Client::GetSPBuffer()
|
||||
{
|
||||
|
||||
HRESULT hr = DPN_OK;
|
||||
|
||||
DPN_SP_CAPS dnSPCaps;
|
||||
DWORD dwFlags = NULL;
|
||||
DWORD dwSPBufferSize = NULL;
|
||||
|
||||
DXTRACE_MSG( TEXT("Attempting to Get SP Buffer Size.") );
|
||||
|
||||
dnSPCaps.dwSize = sizeof(DPN_SP_CAPS);
|
||||
|
||||
hr = m_pDPlay->GetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr != DPN_OK)
|
||||
{
|
||||
DXTRACE_ERR( TEXT("GetSPCaps error"), hr );
|
||||
dwSPBufferSize = 0xffffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwSPBufferSize = dnSPCaps.dwSystemBufferSize;
|
||||
}
|
||||
|
||||
return dwSPBufferSize;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDPlay8Client::SetSPBuffer(DWORD dwSPBufferSize)
|
||||
{
|
||||
HRESULT hr = DPN_OK;
|
||||
|
||||
DPN_SP_CAPS dnSPCaps;
|
||||
DWORD dwFlags = NULL;
|
||||
|
||||
dnSPCaps.dwSize = sizeof(DPN_SP_CAPS);
|
||||
hr = m_pDPlay->GetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr == DPN_OK)
|
||||
{
|
||||
if(dwSPBufferSize <= MAX_SP_BUFFER)
|
||||
dnSPCaps.dwSystemBufferSize = dwSPBufferSize;
|
||||
|
||||
// Attempt to set the number of SP Threads.
|
||||
hr = m_pDPlay->SetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr != DPN_OK)
|
||||
{
|
||||
DXTRACE_ERR( TEXT("SetSPCaps error."), hr );
|
||||
}
|
||||
}
|
||||
else // !GetSPCase != DPN_OK
|
||||
{
|
||||
DXTRACE_ERR( TEXT("GetSPCaps error."), hr );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDPlay8Client::Shutdown()
|
||||
{
|
||||
for( DWORD dwIndex = 0; dwIndex < MAX_SESSIONS; dwIndex++ )
|
||||
{
|
||||
SAFE_RELEASE( m_pHostAddresses[dwIndex] );
|
||||
SAFE_RELEASE( m_pDeviceAddresses[dwIndex] );
|
||||
}
|
||||
|
||||
if( m_dpnhEnum != NULL )
|
||||
{
|
||||
// Cancel the enumeration if its in progress, and ignore any errors
|
||||
m_pDPlay->CancelAsyncOperation( m_dpnhEnum, 0 );
|
||||
m_dpnhEnum = NULL;
|
||||
}
|
||||
|
||||
if( m_pDPlay != NULL )
|
||||
m_pDPlay->Close(0);
|
||||
|
||||
SAFE_RELEASE( m_pDPlay );
|
||||
m_bSessionLost = TRUE;
|
||||
m_dwNumSessions = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Client::StartSessionEnum( const TCHAR* ipaddress )
|
||||
{
|
||||
if( NULL == m_pDPlay )
|
||||
return E_FAIL;
|
||||
|
||||
DPN_APPLICATION_DESC dpnAppDesc;
|
||||
IDirectPlay8Address* pDP8AddressHost = NULL;
|
||||
IDirectPlay8Address* pDP8AddressLocal = NULL;
|
||||
WCHAR* wszHostName = NULL;
|
||||
HRESULT hr;
|
||||
DWORD dwPort;
|
||||
|
||||
m_dwNumSessions = 0;
|
||||
|
||||
if( m_dpnhEnum != NULL )
|
||||
{
|
||||
// If an enumeration is already running, cancel
|
||||
// it and start a new one. Ignore any errors from CancelAsyncOperation
|
||||
m_pDPlay->CancelAsyncOperation( m_dpnhEnum, 0 );
|
||||
m_dpnhEnum = NULL;
|
||||
}
|
||||
|
||||
// Create the local device address object
|
||||
if( FAILED( hr = CoCreateInstance( CLSID_DirectPlay8Address, NULL,
|
||||
CLSCTX_ALL, IID_IDirectPlay8Address,
|
||||
(LPVOID*) &pDP8AddressLocal ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
// Set IP service provider
|
||||
if( FAILED( hr = pDP8AddressLocal->SetSP( &CLSID_DP8SP_TCPIP ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("SetSP"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
|
||||
// Create the remote host address object
|
||||
if( FAILED( hr = CoCreateInstance( CLSID_DirectPlay8Address, NULL,
|
||||
CLSCTX_ALL, IID_IDirectPlay8Address,
|
||||
(LPVOID*) &pDP8AddressHost ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
// Set IP service provider
|
||||
if( FAILED( hr = pDP8AddressHost->SetSP( &CLSID_DP8SP_TCPIP ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("SetSP"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
// Maze uses a fixed port, so add it to the host address
|
||||
dwPort = DPMAZESERVER_PORT;
|
||||
hr = pDP8AddressHost->AddComponent( DPNA_KEY_PORT,
|
||||
&dwPort, sizeof(dwPort),
|
||||
DPNA_DATATYPE_DWORD );
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("AddComponent"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
// Set the remote host name (if provided)
|
||||
if( ipaddress != NULL && ipaddress[0] != 0 )
|
||||
{
|
||||
wszHostName = new WCHAR[_tcslen(ipaddress)+1];
|
||||
|
||||
DXUtil_ConvertGenericStringToWide( wszHostName, ipaddress );
|
||||
|
||||
hr = pDP8AddressHost->AddComponent( DPNA_KEY_HOSTNAME, wszHostName,
|
||||
(wcslen(wszHostName)+1)*sizeof(WCHAR),
|
||||
DPNA_DATATYPE_STRING );
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("AddComponent"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
}
|
||||
|
||||
ZeroMemory( &dpnAppDesc, sizeof( DPN_APPLICATION_DESC ) );
|
||||
dpnAppDesc.dwSize = sizeof( DPN_APPLICATION_DESC );
|
||||
dpnAppDesc.guidApplication = StressMazeAppGUID;
|
||||
|
||||
// Enumerate all StressMazeApp hosts running on IP service providers
|
||||
hr = m_pDPlay->EnumHosts( &dpnAppDesc, pDP8AddressHost,
|
||||
pDP8AddressLocal, NULL,
|
||||
0, INFINITE, 0, INFINITE, NULL,
|
||||
&m_dpnhEnum, 0 );
|
||||
if( hr != DPNERR_PENDING && FAILED(hr) )
|
||||
{
|
||||
DXTRACE_ERR_NOMSGBOX( TEXT("EnumHosts"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
LCleanup:
|
||||
SAFE_RELEASE( pDP8AddressHost);
|
||||
SAFE_RELEASE( pDP8AddressLocal );
|
||||
SAFE_DELETE( wszHostName );
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Client::StopSessionEnum()
|
||||
{
|
||||
if( NULL == m_pDPlay )
|
||||
return E_FAIL;
|
||||
|
||||
// If an enumeration is already running, cancel it and ignore
|
||||
// any errors from CancelAsyncOperation
|
||||
if( m_dpnhEnum != NULL )
|
||||
{
|
||||
m_pDPlay->CancelAsyncOperation( m_dpnhEnum, 0 );
|
||||
m_dpnhEnum = NULL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
BOOL CDPlay8Client::EnumSessionCallback( const DPN_APPLICATION_DESC *pdesc,
|
||||
IDirectPlay8Address* pDP8AddressHost,
|
||||
IDirectPlay8Address* pDP8AddressDevice )
|
||||
{
|
||||
if( NULL == m_pDPlay )
|
||||
return DPN_OK;
|
||||
|
||||
EnterCriticalSection( &m_csLock );
|
||||
|
||||
if( m_dwNumSessions < MAX_SESSIONS )
|
||||
{
|
||||
// Search for existing record for this session, if
|
||||
// there is one, break this loop so we just update
|
||||
// the current entry.
|
||||
for( DWORD dwIndex = 0; dwIndex < m_dwNumSessions; dwIndex++ )
|
||||
{
|
||||
if( m_Sessions[dwIndex].guidInstance == pdesc->guidInstance )
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy( &m_Sessions[dwIndex], pdesc, sizeof( DPN_APPLICATION_DESC ) );
|
||||
|
||||
// Copy pDP8AddressHost to m_pHostAddresses[dwIndex]
|
||||
SAFE_RELEASE( m_pHostAddresses[dwIndex] );
|
||||
pDP8AddressHost->QueryInterface( IID_IDirectPlay8Address,
|
||||
(LPVOID*) &m_pHostAddresses[dwIndex] );
|
||||
|
||||
// Copy pDP8AddressDevice to m_pDeviceAddresses[dwIndex]
|
||||
SAFE_RELEASE( m_pDeviceAddresses[dwIndex] );
|
||||
pDP8AddressDevice->QueryInterface( IID_IDirectPlay8Address,
|
||||
(LPVOID*) &m_pDeviceAddresses[dwIndex] );
|
||||
|
||||
if( pdesc->pwszSessionName != NULL )
|
||||
{
|
||||
DXUtil_ConvertWideStringToGeneric( m_szSessionNames[dwIndex],
|
||||
pdesc->pwszSessionName );
|
||||
}
|
||||
else
|
||||
{
|
||||
_tcscpy( m_szSessionNames[dwIndex], TEXT("Untitled") );
|
||||
}
|
||||
|
||||
if( m_dwNumSessions == dwIndex )
|
||||
m_dwNumSessions++;
|
||||
}
|
||||
|
||||
LeaveCriticalSection( &m_csLock );
|
||||
|
||||
return DPN_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Client::JoinSession( DWORD num )
|
||||
{
|
||||
HRESULT hr;
|
||||
IDirectPlay8Address* pHostAddress = NULL;
|
||||
IDirectPlay8Address* pDeviceAddress = NULL;
|
||||
|
||||
if( m_pDPlay == NULL )
|
||||
return E_FAIL;
|
||||
|
||||
DXTRACE( TEXT("MazeClient: Trying to connect to server\n") );
|
||||
|
||||
DPN_APPLICATION_DESC dpnAppDesc;
|
||||
ZeroMemory( &dpnAppDesc, sizeof( DPN_APPLICATION_DESC ) );
|
||||
dpnAppDesc.dwSize = sizeof( DPN_APPLICATION_DESC );
|
||||
dpnAppDesc.guidApplication = StressMazeAppGUID;
|
||||
dpnAppDesc.guidInstance = m_Sessions[num].guidInstance;
|
||||
|
||||
EnterCriticalSection( &m_csLock );
|
||||
|
||||
// Copy the host and device address pointers, and addref them.
|
||||
// If this is not done, then there is a rare chance that
|
||||
// EnumSessionCallback() may be called during the Connect() call
|
||||
// and destory the address before DirectPlay gets a chance to copy them.
|
||||
pHostAddress = m_pHostAddresses[num];
|
||||
pHostAddress->AddRef();
|
||||
|
||||
pDeviceAddress = m_pDeviceAddresses[num];
|
||||
pDeviceAddress->AddRef();
|
||||
|
||||
LeaveCriticalSection( &m_csLock );
|
||||
|
||||
// Connect to the remote host
|
||||
// The enumeration is automatically canceled after Connect is called
|
||||
if( FAILED( hr = m_pDPlay->Connect( &dpnAppDesc, // Application description
|
||||
pHostAddress, // Session host address
|
||||
pDeviceAddress, // Address of device used to connect to the host
|
||||
NULL, NULL, // Security descriptions & credientials (MBZ in DPlay8)
|
||||
NULL, 0, // User data & its size
|
||||
NULL, // Asynchronous connection context (returned with DPNMSG_CONNECT_COMPLETE in async handshaking)
|
||||
NULL, // Asynchronous connection handle (used to cancel connection process)
|
||||
DPNOP_SYNC ) ) ) // Connect synchronously
|
||||
{
|
||||
if( hr == DPNERR_NORESPONSE || hr == DPNERR_ABORTED )
|
||||
goto LCleanup; // These are possible if the server exits while joining
|
||||
|
||||
if( hr == DPNERR_INVALIDINSTANCE )
|
||||
goto LCleanup; // This is possible if the original server exits and another server comes online while we are connecting
|
||||
|
||||
DXTRACE_ERR_NOMSGBOX( TEXT("Connect"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
m_bSessionLost = FALSE;
|
||||
|
||||
DXTRACE( TEXT("MazeClient: Connected to server. Enum automatically canceled\n") );
|
||||
|
||||
UpdateConnectionInfo();
|
||||
m_fLastUpdateConnectInfoTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
|
||||
|
||||
LCleanup:
|
||||
SAFE_RELEASE( pHostAddress );
|
||||
SAFE_RELEASE( pDeviceAddress );
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Client::SendPacket( void* pData, DWORD dwSize,
|
||||
BOOL bGuaranteed, DWORD dwTimeout )
|
||||
{
|
||||
if( NULL == m_pDPlay )
|
||||
return S_OK;
|
||||
|
||||
DPNHANDLE hAsync;
|
||||
DWORD dwFlags;
|
||||
DPNHANDLE* phAsync;
|
||||
|
||||
if( bGuaranteed )
|
||||
{
|
||||
// If we are guaranteed then we must specify
|
||||
// DPNSEND_NOCOMPLETE and pass in non-null for the
|
||||
// pvAsyncContext
|
||||
dwFlags = DPNSEND_GUARANTEED;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we aren't guaranteed then we can
|
||||
// specify DPNSEND_NOCOMPLETE. And when
|
||||
// DPNSEND_NOCOMPLETE is on pvAsyncContext
|
||||
// must be NULL.
|
||||
dwFlags = DPNSEND_NOCOMPLETE;
|
||||
}
|
||||
|
||||
// Must pass in a value for the Asyn handle. Will be thrown when proc completes.
|
||||
phAsync = &hAsync;
|
||||
|
||||
DPN_BUFFER_DESC dpnBufferDesc;
|
||||
dpnBufferDesc.dwBufferSize = dwSize;
|
||||
dpnBufferDesc.pBufferData = (PBYTE) pData;
|
||||
|
||||
// Update the throughput counter
|
||||
m_dwThroughputBytes += dwSize;
|
||||
|
||||
// DirectPlay will tell via the message handler
|
||||
// if there are any severe errors, so ignore any errors
|
||||
m_pDPlay->Send( &dpnBufferDesc, 1, dwTimeout,
|
||||
NULL, phAsync, dwFlags );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Client::StaticReceiveHandler( void *pvContext, DWORD dwMessageType,
|
||||
void *pvMessage )
|
||||
{
|
||||
CDPlay8Client* pThisObject = (CDPlay8Client*) pvContext;
|
||||
|
||||
return pThisObject->ReceiveHandler( pvContext, dwMessageType, pvMessage );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Client::ReceiveHandler( void *pvContext, DWORD dwMessageType,
|
||||
void *pvMessage )
|
||||
{
|
||||
// Increment our Active Thread Counter.
|
||||
EnterCriticalSection( &m_csThreadCountLock );
|
||||
|
||||
//Get the time when we entered the Message Handler
|
||||
FLOAT fStartTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
|
||||
m_wActiveThreadCount++;
|
||||
|
||||
if(m_wActiveThreadCount > m_wMaxThreadCount)
|
||||
m_wMaxThreadCount = m_wActiveThreadCount;
|
||||
|
||||
|
||||
// Calculate an average.
|
||||
FLOAT fdiff = m_wActiveThreadCount - m_fAvgThreadCount;
|
||||
m_fAvgThreadCount += fdiff/8;
|
||||
|
||||
LeaveCriticalSection( &m_csThreadCountLock );
|
||||
|
||||
|
||||
switch( dwMessageType )
|
||||
{
|
||||
case DPN_MSGID_RECEIVE:
|
||||
{
|
||||
PDPNMSG_RECEIVE pRecvData = (PDPNMSG_RECEIVE) pvMessage;
|
||||
|
||||
// Update the throughput counter
|
||||
m_dwThroughputBytes += pRecvData->dwReceiveDataSize;
|
||||
|
||||
if( m_pClient != NULL )
|
||||
{
|
||||
m_pClient->OnPacket( pRecvData->dpnidSender,
|
||||
pRecvData->pReceiveData,
|
||||
pRecvData->dwReceiveDataSize );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DPN_MSGID_TERMINATE_SESSION:
|
||||
{
|
||||
m_dwSessionLostReason = DISCONNNECT_REASON_UNKNOWN;
|
||||
PDPNMSG_TERMINATE_SESSION pTermMsg = (PDPNMSG_TERMINATE_SESSION) pvMessage;
|
||||
|
||||
// The MazeServer passes a DWORD in pvTerminateData if
|
||||
// it disconnected us, otherwise it will be null.
|
||||
if( pTermMsg->pvTerminateData != NULL )
|
||||
{
|
||||
DWORD* pdw = (DWORD*) pTermMsg->pvTerminateData;
|
||||
m_dwSessionLostReason = *pdw;
|
||||
}
|
||||
|
||||
if( m_pClient != NULL )
|
||||
m_pClient->OnSessionLost( m_dwSessionLostReason );
|
||||
|
||||
// Now that the session is lost we need to restart DirectPlay by calling
|
||||
// Close() and Init() on m_pDPlay, however this can not be
|
||||
// done in the DirectPlay message callback, so the main thread will
|
||||
// do this when IsSessionLost() returns TRUE
|
||||
m_bSessionLost = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case DPN_MSGID_ENUM_HOSTS_RESPONSE:
|
||||
{
|
||||
PDPNMSG_ENUM_HOSTS_RESPONSE pEnumResponse = (PDPNMSG_ENUM_HOSTS_RESPONSE) pvMessage;
|
||||
|
||||
EnumSessionCallback( pEnumResponse->pApplicationDescription,
|
||||
pEnumResponse->pAddressSender,
|
||||
pEnumResponse->pAddressDevice );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EnterCriticalSection( &m_csThreadCountLock );
|
||||
|
||||
m_wActiveThreadCount-- ;
|
||||
|
||||
// Calculate an average.
|
||||
|
||||
FLOAT fDiffTime = ( DXUtil_Timer( TIMER_GETAPPTIME ) - fStartTime ) - m_fAvgThreadTime;
|
||||
m_fAvgThreadTime += fDiffTime/8;
|
||||
|
||||
//Get the Max time in the thread.
|
||||
if ( fDiffTime > m_fMaxThreadTime )
|
||||
{
|
||||
m_fMaxThreadTime = fDiffTime;
|
||||
}
|
||||
|
||||
LeaveCriticalSection( &m_csThreadCountLock );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Client::UpdateConnectionInfo()
|
||||
{
|
||||
if( NULL == m_pDPlay )
|
||||
return E_FAIL;
|
||||
|
||||
// Update the DPN_CONNECTION_INFO every 1/2 second...
|
||||
float fCurTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
if( fCurTime - m_fLastUpdateConnectInfoTime > 0.5f )
|
||||
{
|
||||
// Call GetConnectionInfo to get DirectPlay stats about connection
|
||||
ZeroMemory( &m_dpnConnectionInfo, sizeof(DPN_CONNECTION_INFO) );
|
||||
m_dpnConnectionInfo.dwSize = sizeof(DPN_CONNECTION_INFO);
|
||||
m_pDPlay->GetConnectionInfo( &m_dpnConnectionInfo, 0 );
|
||||
|
||||
// Call GetSendQueueInfo to get DirectPlay stats about messages
|
||||
m_pDPlay->GetSendQueueInfo( &m_dwHighPriMessages, &m_dwHighPriBytes,
|
||||
DPNGETSENDQUEUEINFO_PRIORITY_HIGH );
|
||||
m_pDPlay->GetSendQueueInfo( &m_dwNormalPriMessages, &m_dwNormalPriBytes,
|
||||
DPNGETSENDQUEUEINFO_PRIORITY_NORMAL );
|
||||
m_pDPlay->GetSendQueueInfo( &m_dwLowPriMessages, &m_dwLowPriBytes,
|
||||
DPNGETSENDQUEUEINFO_PRIORITY_LOW );
|
||||
|
||||
m_fLastUpdateConnectInfoTime = fCurTime;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CDPlay8Client::GetThroughputBPS()
|
||||
{
|
||||
static float s_fLastThroughputBPSTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
float fCurTime = DXUtil_Timer( TIMER_GETAPPTIME );
|
||||
if( fCurTime - s_fLastThroughputBPSTime > 1.0f )
|
||||
{
|
||||
m_fThroughputBPS = (float) m_dwThroughputBytes / (fCurTime - s_fLastThroughputBPSTime);
|
||||
|
||||
s_fLastThroughputBPSTime = fCurTime;
|
||||
m_dwThroughputBytes = 0;
|
||||
}
|
||||
|
||||
return (DWORD) m_fThroughputBPS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CDPlay8Client::GetRoundTripLatencyMS()
|
||||
{
|
||||
UpdateConnectionInfo();
|
||||
return m_dpnConnectionInfo.dwRoundTripLatencyMS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Client::GetConnectionInfo( TCHAR* strConnectionInfo )
|
||||
{
|
||||
UpdateConnectionInfo();
|
||||
|
||||
_stprintf( strConnectionInfo,
|
||||
TEXT(" Thread Count: Current=%d Avg= %.2f Max=%d\n") \
|
||||
TEXT(" Thread Time: Avg= %.4f Max=%.4f(s)\n") \
|
||||
\
|
||||
TEXT(" Round Trip Latency MS=%dms\n") \
|
||||
TEXT(" Throughput BPS: Current=%d Peak=%d\n") \
|
||||
\
|
||||
TEXT(" Messages Received=%d\n") \
|
||||
\
|
||||
TEXT(" Sent: GB=%d GP=%d NGB=%d NGP=%d\n") \
|
||||
TEXT(" Received: GB=%d GP=%d NGB=%d NGP=%d\n") \
|
||||
\
|
||||
TEXT(" Messages Transmitted: HP=%d NP=%d LP=%d\n") \
|
||||
TEXT(" Messages Timed Out: HP=%d NP=%d LP=%d\n") \
|
||||
\
|
||||
TEXT(" Retried: GB=%d GP=%d\n") \
|
||||
TEXT(" Dropped: NGB=%d NGP=%d\n") \
|
||||
\
|
||||
TEXT(" Send Queue Messages: HP=%d NP=%d LP=%d\n") \
|
||||
TEXT(" Send Queue Bytes: HP=%d NP=%d LP=%d\n"), \
|
||||
\
|
||||
\
|
||||
\
|
||||
m_wActiveThreadCount, m_fAvgThreadCount, m_wMaxThreadCount,
|
||||
m_fAvgThreadTime, m_fMaxThreadTime,
|
||||
m_dpnConnectionInfo.dwRoundTripLatencyMS,
|
||||
m_dpnConnectionInfo.dwThroughputBPS,
|
||||
m_dpnConnectionInfo.dwPeakThroughputBPS,
|
||||
|
||||
m_dpnConnectionInfo.dwMessagesReceived,
|
||||
|
||||
m_dpnConnectionInfo.dwBytesSentGuaranteed,
|
||||
m_dpnConnectionInfo.dwPacketsSentGuaranteed,
|
||||
m_dpnConnectionInfo.dwBytesSentNonGuaranteed,
|
||||
m_dpnConnectionInfo.dwPacketsSentNonGuaranteed,
|
||||
|
||||
m_dpnConnectionInfo.dwBytesReceivedGuaranteed,
|
||||
m_dpnConnectionInfo.dwPacketsReceivedGuaranteed,
|
||||
m_dpnConnectionInfo.dwBytesReceivedNonGuaranteed,
|
||||
m_dpnConnectionInfo.dwPacketsReceivedNonGuaranteed,
|
||||
|
||||
m_dpnConnectionInfo.dwMessagesTransmittedHighPriority,
|
||||
m_dpnConnectionInfo.dwMessagesTransmittedNormalPriority,
|
||||
m_dpnConnectionInfo.dwMessagesTransmittedLowPriority,
|
||||
|
||||
m_dpnConnectionInfo.dwMessagesTimedOutHighPriority,
|
||||
m_dpnConnectionInfo.dwMessagesTimedOutNormalPriority,
|
||||
m_dpnConnectionInfo.dwMessagesTimedOutLowPriority,
|
||||
|
||||
m_dpnConnectionInfo.dwBytesRetried,
|
||||
m_dpnConnectionInfo.dwPacketsRetried,
|
||||
|
||||
m_dpnConnectionInfo.dwBytesDropped,
|
||||
m_dpnConnectionInfo.dwPacketsDropped,
|
||||
|
||||
m_dwHighPriMessages, m_dwNormalPriMessages, m_dwLowPriMessages,
|
||||
m_dwHighPriBytes, m_dwNormalPriBytes, m_dwLowPriBytes
|
||||
);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: dplay8client.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _DPLAY8_CLIENT_H
|
||||
#define _DPLAY8_CLIENT_H
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "NetAbstract.h"
|
||||
|
||||
struct MazeConfig;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CDPlay8Client : public IOutboundClient
|
||||
{
|
||||
public:
|
||||
CDPlay8Client();
|
||||
~CDPlay8Client();
|
||||
|
||||
HRESULT Init(MazeConfig* pMazeConfig);
|
||||
void Shutdown();
|
||||
HRESULT StartSessionEnum( const TCHAR* ipaddress );
|
||||
HRESULT StopSessionEnum();
|
||||
DWORD GetNumSessions() const { return m_dwNumSessions; };
|
||||
const TCHAR* GetSessionName( DWORD num ) const { return m_szSessionNames[num]; };
|
||||
DWORD GetSessionMaxPlayers( DWORD num ) const { return m_Sessions[num].dwMaxPlayers; };
|
||||
DWORD GetSessionCurrentPlayers( DWORD num ) const { return m_Sessions[num].dwCurrentPlayers; };
|
||||
GUID GetSessionGUID( DWORD num ) const { return m_Sessions[num].guidInstance; };
|
||||
HRESULT JoinSession( DWORD num );
|
||||
void SetClient( INetClient* pclient ) { m_pClient = pclient; };
|
||||
IOutboundClient* GetOutboundClient() const { return ((IOutboundClient*)this); };
|
||||
|
||||
DWORD GetNumSPThreads();
|
||||
void SetNumSPThreads(DWORD dwNumSPThreads);
|
||||
|
||||
DWORD GetSPBuffer();
|
||||
void SetSPBuffer(DWORD dwSPBufferSize);
|
||||
|
||||
// IOutboundClient
|
||||
virtual HRESULT SendPacket( void* pData, DWORD dwSize, BOOL bGuaranteed, DWORD dwTimeout );
|
||||
virtual DWORD GetThroughputBPS();
|
||||
virtual DWORD GetRoundTripLatencyMS();
|
||||
virtual BOOL IsSessionLost() { return m_bSessionLost; };
|
||||
virtual DWORD GetSessionLostReason() { return m_dwSessionLostReason; };
|
||||
virtual HRESULT GetConnectionInfo( TCHAR* strConnectionInfo );
|
||||
|
||||
protected:
|
||||
IDirectPlay8Client* m_pDPlay;
|
||||
BOOL m_bConnected;
|
||||
INetClient* m_pClient;
|
||||
BOOL m_bSessionLost;
|
||||
DWORD m_dwSessionLostReason;
|
||||
FLOAT m_fThroughputBPS;
|
||||
DWORD m_dwThroughputBytes;
|
||||
|
||||
CRITICAL_SECTION m_csThreadCountLock;
|
||||
WORD m_wActiveThreadCount;
|
||||
WORD m_wMaxThreadCount;
|
||||
FLOAT m_fAvgThreadCount;
|
||||
FLOAT m_fAvgThreadTime;
|
||||
FLOAT m_fMaxThreadTime;
|
||||
|
||||
// Configuration info.
|
||||
MazeConfig* m_MazeConfig;
|
||||
|
||||
// Connection info
|
||||
FLOAT m_fLastUpdateConnectInfoTime;
|
||||
DPN_CONNECTION_INFO m_dpnConnectionInfo;
|
||||
DWORD m_dwHighPriMessages, m_dwHighPriBytes;
|
||||
DWORD m_dwNormalPriMessages, m_dwNormalPriBytes;
|
||||
DWORD m_dwLowPriMessages, m_dwLowPriBytes;
|
||||
HRESULT UpdateConnectionInfo();
|
||||
|
||||
BOOL EnumSessionCallback( const DPN_APPLICATION_DESC *pdesc, IDirectPlay8Address* pDP8AddressHost, IDirectPlay8Address* pDP8AddressDevice );
|
||||
static HRESULT WINAPI StaticReceiveHandler( void *pvContext, DWORD dwMessageType, void *pvMessage );
|
||||
HRESULT WINAPI ReceiveHandler( void *pvContext, DWORD dwMessageType, void *pvMessage );
|
||||
|
||||
enum {MAX_SESSIONS=256};
|
||||
enum {MAX_SESSION_NAME=64};
|
||||
DWORD m_dwNumSessions;
|
||||
DPN_APPLICATION_DESC m_Sessions[MAX_SESSIONS];
|
||||
IDirectPlay8Address* m_pHostAddresses[MAX_SESSIONS];
|
||||
IDirectPlay8Address* m_pDeviceAddresses[MAX_SESSIONS];
|
||||
TCHAR m_szSessionNames[MAX_SESSIONS][MAX_SESSION_NAME];
|
||||
FLOAT m_fSessionLastSeenTime[MAX_SESSIONS];
|
||||
CRITICAL_SECTION m_csLock;
|
||||
DPNHANDLE m_dpnhEnum;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: imazegraphics.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _IMAZEGRAPHICS_
|
||||
#define _IMAZEGRAPHICS_
|
||||
|
||||
|
||||
class CMazeApp;
|
||||
class CDPlay8Client;
|
||||
class CMazeClient;
|
||||
enum EnumLineType { LINE_PROMPT, LINE_INPUT, LINE_LOG, LINE_CMD };
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
interface IMazeGraphics
|
||||
{
|
||||
public:
|
||||
virtual VOID Init( CMazeApp* pMazeApp, CDPlay8Client* pDP8Client, CMazeClient* pMazeClient ) = 0;
|
||||
virtual HRESULT Create( HINSTANCE hInstance ) = 0;
|
||||
virtual INT Run() = 0;
|
||||
virtual void HandleOutputMsg( EnumLineType enumLineType, TCHAR* strLine ) = 0;
|
||||
virtual BOOL IsPreview() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: consolegraphics.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _CONSOLE_GRAPHICS_H
|
||||
#define _CONSOLE_GRAPHICS_H
|
||||
|
||||
|
||||
#define MAX_CMD_LINES 100
|
||||
#define MAX_LOG_LINES 100
|
||||
class CMazeApp;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CConsoleGraphics : public IMazeGraphics
|
||||
{
|
||||
public:
|
||||
CConsoleGraphics();
|
||||
~CConsoleGraphics();
|
||||
|
||||
// From IMazeGraphics
|
||||
virtual VOID Init( CMazeApp* pMazeApp, CDPlay8Client* pDP8Client, CMazeClient* pMazeClient );
|
||||
virtual HRESULT Create( HINSTANCE hInstance );
|
||||
virtual INT Run();
|
||||
virtual VOID HandleOutputMsg( EnumLineType enumLineType, TCHAR* strLine );
|
||||
virtual BOOL IsPreview() { return FALSE; };
|
||||
virtual void Shutdown();
|
||||
|
||||
CMazeApp* m_pMazeApp;
|
||||
CDPlay8Client* m_pDP8Client;
|
||||
CMazeClient* m_pMazeClient;
|
||||
|
||||
protected:
|
||||
static BOOL WINAPI CtrlHandler( DWORD type );
|
||||
WCHAR** ConvertCommandLineToArgvW( WCHAR* strCommandLine, int* argc );
|
||||
void ParseInput( TCHAR* pBuffer );
|
||||
VOID SetupConsole( DWORD dwWindowSizeY );
|
||||
VOID RestoreOldConsoleSettings();
|
||||
VOID WriteLine( DWORD nCoordY, TCHAR* strBuffer );
|
||||
void DoPrompt( TCHAR* strPromptString, TCHAR* strBuffer );
|
||||
void PrintHelp();
|
||||
void ClearScreen();
|
||||
BOOL TryToConnect();
|
||||
void RunSetupWizard();
|
||||
BOOL ParseCommandLine();
|
||||
|
||||
CONSOLE_SCREEN_BUFFER_INFO m_SavedConsoleInfo;
|
||||
|
||||
MazeConfig* m_pConfig;
|
||||
|
||||
BOOL m_bQuitThread;
|
||||
DWORD m_dwNextOutput;
|
||||
HANDLE m_hStdOut;
|
||||
DWORD m_dwNumCmdLines;
|
||||
DWORD m_dwSeperatorLine;
|
||||
DWORD m_dwNumLogLines;
|
||||
DWORD m_dwWindowSizeY;
|
||||
BOOL m_bLocalLoopback;
|
||||
|
||||
static UINT WINAPI StaticPromptThread( LPVOID pParam );
|
||||
UINT WINAPI PromptThread( LPVOID pParam );
|
||||
|
||||
HANDLE m_hPromptThread;
|
||||
|
||||
TCHAR m_szLogBuffer[MAX_LOG_LINES][256];
|
||||
TCHAR m_szCmdBuffer[MAX_CMD_LINES][256];
|
||||
DWORD m_dwLogBufferNext;
|
||||
DWORD m_dwCmdBufferNext;
|
||||
DWORD m_dwLastPrompt;
|
||||
int m_dwCaretPos;
|
||||
DWORD m_dwNumProcessed;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,43 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: main.cpp
|
||||
//
|
||||
// Desc: This is a DirectPlay 8 client/server sample. The client comes in two flavors.
|
||||
// A console based version, and a D3D client. The D3D client can optionally
|
||||
// be run as screen saver by simply copying mazeclient.exe to your
|
||||
// \winnt\system32\ and renaming it to mazeclient.scr. This will make
|
||||
// it a screen saver that will be detected by the display control panel.
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#define D3D_OVERLOADS
|
||||
#include <windows.h>
|
||||
#include <D3DX8.h>
|
||||
#include <dplay8.h>
|
||||
#include "DXUtil.h"
|
||||
#include "SyncObjects.h"
|
||||
#include "IMazeGraphics.h"
|
||||
#include "DummyConnector.h"
|
||||
#include "MazeApp.h"
|
||||
#include "MazeServer.h"
|
||||
#include "ConsoleGraphics.h"
|
||||
#include "MazeApp.h"
|
||||
|
||||
|
||||
CMazeApp g_MazeApp;
|
||||
CConsoleGraphics g_ConsoleGraphics;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
int __cdecl main( int argc, TCHAR* argv[] )
|
||||
{
|
||||
if( FAILED( g_MazeApp.Create( &g_ConsoleGraphics ) ) )
|
||||
return 0;
|
||||
|
||||
return g_MazeApp.Run( 0 );
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
# Microsoft Developer Studio Project File - Name="MazeConsoleClient" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=MazeConsoleClient - 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 "MazeConsoleClient.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 "MazeConsoleClient.mak" CFG="MazeConsoleClient - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "MazeConsoleClient - Win32 Debug Unicode" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeConsoleClient - Win32 Release Unicode" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeConsoleClient - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeConsoleClient - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - 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 "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# 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 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:console /machine:I386
|
||||
# ADD LINK32 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:console /machine:I386 /stack:0x5000,0x5000
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - 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 "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\mazecommon" /I "..\..\..\common\include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# 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 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:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 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:console /debug /machine:I386 /pdbtype:sept /stack:0x5000,0x5000
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - 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 "..\mazecommon" /I "..\..\..\common\include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\mazecommon" /I "..\..\..\common\include" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# 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 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:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 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:console /debug /machine:I386 /pdbtype:sept /stack:0x5000,0x5000
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - 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 "..\mazecommon" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_MBCS" /D "_CONSOLE" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /FR /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# 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 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:console /machine:I386
|
||||
# ADD LINK32 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:console /machine:I386 /stack:0x5000,0x5000
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "MazeConsoleClient - Win32 Release"
|
||||
# Name "MazeConsoleClient - Win32 Debug"
|
||||
# Name "MazeConsoleClient - Win32 Debug Unicode"
|
||||
# Name "MazeConsoleClient - Win32 Release Unicode"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;*.h"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ConsoleGraphics.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ConsoleGraphics.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Main.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MazeConsoleClient.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\dplay8client.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\dplay8client.h
|
||||
# End Source File
|
||||
# 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=..\MazeCommon\imazegraphics.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Maze.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Maze.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\MazeCommon\MazeApp.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\MazeCommon\MazeApp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\MazeClient.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\MazeClient.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\MazeCommon\MazeServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\MazeServer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\NetAbstract.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Packets.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Random.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\SimpleStack.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\StressMazeGuid.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\SyncObjects.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Trig.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DirectX.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\readme.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "MazeConsoleClient"=.\MazeConsoleClient.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,645 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on MazeConsoleClient.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=MazeConsoleClient - Win32 Debug Unicode
|
||||
!MESSAGE No configuration specified. Defaulting to MazeConsoleClient - Win32 Debug Unicode.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "MazeConsoleClient - Win32 Release" && "$(CFG)" != "MazeConsoleClient - Win32 Debug" && "$(CFG)" != "MazeConsoleClient - Win32 Debug Unicode" && "$(CFG)" != "MazeConsoleClient - 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 "MazeConsoleClient.mak" CFG="MazeConsoleClient - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "MazeConsoleClient - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeConsoleClient - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeConsoleClient - Win32 Debug Unicode" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeConsoleClient - Win32 Release Unicode" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeConsoleClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\ConsoleGraphics.obj"
|
||||
-@erase "$(INTDIR)\dplay8client.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeApp.obj"
|
||||
-@erase "$(INTDIR)\MazeClient.obj"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\MazeConsoleClient.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /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) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeConsoleClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=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:console /incremental:no /pdb:"$(OUTDIR)\MazeConsoleClient.pdb" /machine:I386 /out:"$(OUTDIR)\MazeConsoleClient.exe" /stack:0x5000,0x5000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\ConsoleGraphics.obj" \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\dplay8client.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeApp.obj" \
|
||||
"$(INTDIR)\MazeClient.obj" \
|
||||
"$(INTDIR)\MazeServer.obj"
|
||||
|
||||
"$(OUTDIR)\MazeConsoleClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeConsoleClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\ConsoleGraphics.obj"
|
||||
-@erase "$(INTDIR)\dplay8client.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeApp.obj"
|
||||
-@erase "$(INTDIR)\MazeClient.obj"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\MazeConsoleClient.exe"
|
||||
-@erase "$(OUTDIR)\MazeConsoleClient.ilk"
|
||||
-@erase "$(OUTDIR)\MazeConsoleClient.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\mazecommon" /I "..\..\..\common\include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /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) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeConsoleClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=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:console /incremental:yes /pdb:"$(OUTDIR)\MazeConsoleClient.pdb" /debug /machine:I386 /out:"$(OUTDIR)\MazeConsoleClient.exe" /pdbtype:sept /stack:0x5000,0x5000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\ConsoleGraphics.obj" \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\dplay8client.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeApp.obj" \
|
||||
"$(INTDIR)\MazeClient.obj" \
|
||||
"$(INTDIR)\MazeServer.obj"
|
||||
|
||||
"$(OUTDIR)\MazeConsoleClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Debug_Unicode
|
||||
INTDIR=.\Win32_Debug_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Debug_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeConsoleClient.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\ConsoleGraphics.obj"
|
||||
-@erase "$(INTDIR)\dplay8client.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeApp.obj"
|
||||
-@erase "$(INTDIR)\MazeClient.obj"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\MazeConsoleClient.exe"
|
||||
-@erase "$(OUTDIR)\MazeConsoleClient.ilk"
|
||||
-@erase "$(OUTDIR)\MazeConsoleClient.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\mazecommon" /I "..\..\..\common\include" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /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) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeConsoleClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=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:console /incremental:yes /pdb:"$(OUTDIR)\MazeConsoleClient.pdb" /debug /machine:I386 /out:"$(OUTDIR)\MazeConsoleClient.exe" /pdbtype:sept /stack:0x5000,0x5000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\ConsoleGraphics.obj" \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\dplay8client.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeApp.obj" \
|
||||
"$(INTDIR)\MazeClient.obj" \
|
||||
"$(INTDIR)\MazeServer.obj"
|
||||
|
||||
"$(OUTDIR)\MazeConsoleClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Release_Unicode
|
||||
INTDIR=.\Win32_Release_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Release_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeConsoleClient.exe" "$(OUTDIR)\MazeConsoleClient.bsc"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\ConsoleGraphics.obj"
|
||||
-@erase "$(INTDIR)\ConsoleGraphics.sbr"
|
||||
-@erase "$(INTDIR)\dplay8client.obj"
|
||||
-@erase "$(INTDIR)\dplay8client.sbr"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\dxutil.sbr"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Main.sbr"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\Maze.sbr"
|
||||
-@erase "$(INTDIR)\MazeApp.obj"
|
||||
-@erase "$(INTDIR)\MazeApp.sbr"
|
||||
-@erase "$(INTDIR)\MazeClient.obj"
|
||||
-@erase "$(INTDIR)\MazeClient.sbr"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\MazeServer.sbr"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\MazeConsoleClient.bsc"
|
||||
-@erase "$(OUTDIR)\MazeConsoleClient.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_MBCS" /D "_CONSOLE" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /FR"$(INTDIR)\\" /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) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeConsoleClient.bsc"
|
||||
BSC32_SBRS= \
|
||||
"$(INTDIR)\ConsoleGraphics.sbr" \
|
||||
"$(INTDIR)\Main.sbr" \
|
||||
"$(INTDIR)\dplay8client.sbr" \
|
||||
"$(INTDIR)\dxutil.sbr" \
|
||||
"$(INTDIR)\Maze.sbr" \
|
||||
"$(INTDIR)\MazeApp.sbr" \
|
||||
"$(INTDIR)\MazeClient.sbr" \
|
||||
"$(INTDIR)\MazeServer.sbr"
|
||||
|
||||
"$(OUTDIR)\MazeConsoleClient.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
|
||||
$(BSC32) @<<
|
||||
$(BSC32_FLAGS) $(BSC32_SBRS)
|
||||
<<
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=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:console /incremental:no /pdb:"$(OUTDIR)\MazeConsoleClient.pdb" /machine:I386 /out:"$(OUTDIR)\MazeConsoleClient.exe" /stack:0x5000,0x5000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\ConsoleGraphics.obj" \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\dplay8client.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeApp.obj" \
|
||||
"$(INTDIR)\MazeClient.obj" \
|
||||
"$(INTDIR)\MazeServer.obj"
|
||||
|
||||
"$(OUTDIR)\MazeConsoleClient.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("MazeConsoleClient.dep")
|
||||
!INCLUDE "MazeConsoleClient.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "MazeConsoleClient.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release" || "$(CFG)" == "MazeConsoleClient - Win32 Debug" || "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode" || "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
SOURCE=.\ConsoleGraphics.cpp
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\ConsoleGraphics.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\ConsoleGraphics.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\ConsoleGraphics.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\ConsoleGraphics.obj" "$(INTDIR)\ConsoleGraphics.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=.\Main.cpp
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\Main.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\Main.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\Main.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\Main.obj" "$(INTDIR)\Main.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\mazecommon\dplay8client.cpp
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\dplay8client.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\dplay8client.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\dplay8client.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\dplay8client.obj" "$(INTDIR)\dplay8client.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\..\..\common\src\dxutil.cpp
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\dxutil.obj" "$(INTDIR)\dxutil.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\mazecommon\Maze.cpp
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\Maze.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\Maze.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\Maze.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\Maze.obj" "$(INTDIR)\Maze.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\MazeCommon\MazeApp.cpp
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeApp.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeApp.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeApp.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeApp.obj" "$(INTDIR)\MazeApp.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\mazecommon\MazeClient.cpp
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeClient.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeClient.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeClient.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeClient.obj" "$(INTDIR)\MazeClient.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
SOURCE=..\MazeCommon\MazeServer.cpp
|
||||
|
||||
!IF "$(CFG)" == "MazeConsoleClient - Win32 Release"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeServer.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeServer.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Debug Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeServer.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeConsoleClient - Win32 Release Unicode"
|
||||
|
||||
|
||||
"$(INTDIR)\MazeServer.obj" "$(INTDIR)\MazeServer.sbr" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
//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
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\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 ICON DISCARDABLE "DirectX.ico"
|
||||
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by MazeConsoleClient.rc
|
||||
//
|
||||
#define IDI_MAIN_ICON 101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 112
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1025
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
1340
Library/dxx8/samples/Multimedia/DirectPlay/Maze/MazeServer/Main.cpp
Normal file
@@ -0,0 +1,230 @@
|
||||
# Microsoft Developer Studio Project File - Name="MazeServer" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=MazeServer - 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 "MazeServer.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 "MazeServer.mak" CFG="MazeServer - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "MazeServer - Win32 Debug Unicode" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeServer - Win32 Release Unicode" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeServer - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeServer - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "MazeServer - 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 "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# 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 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:console /machine:I386
|
||||
# ADD LINK32 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:console /machine:I386 /stack:0x80000,0x10000
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeServer - 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 "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\mazecommon" /I "..\..\..\common\include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# 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 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:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 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:console /debug /machine:I386 /pdbtype:sept /stack:0x80000,0x10000
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeServer - 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 "..\mazecommon" /I "..\..\..\common\include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\mazecommon" /I "..\..\..\common\include" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# 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 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:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 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:console /debug /machine:I386 /pdbtype:sept /stack:0x80000,0x10000
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeServer - 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 "..\mazecommon" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /FD /c
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_MBCS" /D "_CONSOLE" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# 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 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:console /machine:I386
|
||||
# ADD LINK32 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:console /machine:I386 /stack:0x80000,0x10000
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "MazeServer - Win32 Release"
|
||||
# Name "MazeServer - Win32 Debug"
|
||||
# Name "MazeServer - Win32 Debug Unicode"
|
||||
# Name "MazeServer - Win32 Release Unicode"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Main.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Maze.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\MazeServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MazeServer.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\server.cpp
|
||||
# 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 Group "Header Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Maze.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\MazeServer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\NetAbstract.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Packets.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\Random.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\server.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\StressMazeGuid.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\mazecommon\SyncObjects.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\readme.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "MazeServer"=.\MazeServer.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,379 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on MazeServer.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=MazeServer - Win32 Debug Unicode
|
||||
!MESSAGE No configuration specified. Defaulting to MazeServer - Win32 Debug Unicode.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "MazeServer - Win32 Release" && "$(CFG)" != "MazeServer - Win32 Debug" && "$(CFG)" != "MazeServer - Win32 Debug Unicode" && "$(CFG)" != "MazeServer - 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 "MazeServer.mak" CFG="MazeServer - Win32 Debug Unicode"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "MazeServer - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeServer - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeServer - Win32 Debug Unicode" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "MazeServer - Win32 Release Unicode" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "MazeServer - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeServer.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\server.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\MazeServer.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_WIN32_DCOM" /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) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeServer.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=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:console /incremental:no /pdb:"$(OUTDIR)\MazeServer.pdb" /machine:I386 /out:"$(OUTDIR)\MazeServer.exe" /stack:0x80000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeServer.obj" \
|
||||
"$(INTDIR)\server.obj" \
|
||||
"$(INTDIR)\dxutil.obj"
|
||||
|
||||
"$(OUTDIR)\MazeServer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeServer - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeServer.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\server.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\MazeServer.exe"
|
||||
-@erase "$(OUTDIR)\MazeServer.ilk"
|
||||
-@erase "$(OUTDIR)\MazeServer.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\mazecommon" /I "..\..\..\common\include" /D "_CONSOLE" /D "_DEBUG" /D "WIN32" /D "_WIN32_DCOM" /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) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeServer.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=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:console /incremental:yes /pdb:"$(OUTDIR)\MazeServer.pdb" /debug /machine:I386 /out:"$(OUTDIR)\MazeServer.exe" /pdbtype:sept /stack:0x80000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeServer.obj" \
|
||||
"$(INTDIR)\server.obj" \
|
||||
"$(INTDIR)\dxutil.obj"
|
||||
|
||||
"$(OUTDIR)\MazeServer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeServer - Win32 Debug Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Debug_Unicode
|
||||
INTDIR=.\Win32_Debug_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Debug_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeServer.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\server.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\MazeServer.exe"
|
||||
-@erase "$(OUTDIR)\MazeServer.ilk"
|
||||
-@erase "$(OUTDIR)\MazeServer.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\mazecommon" /I "..\..\..\common\include" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /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) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeServer.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=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:console /incremental:yes /pdb:"$(OUTDIR)\MazeServer.pdb" /debug /machine:I386 /out:"$(OUTDIR)\MazeServer.exe" /pdbtype:sept /stack:0x80000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeServer.obj" \
|
||||
"$(INTDIR)\server.obj" \
|
||||
"$(INTDIR)\dxutil.obj"
|
||||
|
||||
"$(OUTDIR)\MazeServer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "MazeServer - Win32 Release Unicode"
|
||||
|
||||
OUTDIR=.\Win32_Release_Unicode
|
||||
INTDIR=.\Win32_Release_Unicode
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Win32_Release_Unicode
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\MazeServer.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\Main.obj"
|
||||
-@erase "$(INTDIR)\Maze.obj"
|
||||
-@erase "$(INTDIR)\MazeServer.obj"
|
||||
-@erase "$(INTDIR)\server.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\MazeServer.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\..\..\common\include" /I "..\mazecommon" /D "NDEBUG" /D "_MBCS" /D "_CONSOLE" /D "WIN32" /D "_WIN32_DCOM" /D "UNICODE" /D "_UNICODE" /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) $<
|
||||
<<
|
||||
|
||||
RSC=rc.exe
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\MazeServer.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=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:console /incremental:no /pdb:"$(OUTDIR)\MazeServer.pdb" /machine:I386 /out:"$(OUTDIR)\MazeServer.exe" /stack:0x80000,0x10000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\Main.obj" \
|
||||
"$(INTDIR)\Maze.obj" \
|
||||
"$(INTDIR)\MazeServer.obj" \
|
||||
"$(INTDIR)\server.obj" \
|
||||
"$(INTDIR)\dxutil.obj"
|
||||
|
||||
"$(OUTDIR)\MazeServer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("MazeServer.dep")
|
||||
!INCLUDE "MazeServer.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "MazeServer.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "MazeServer - Win32 Release" || "$(CFG)" == "MazeServer - Win32 Debug" || "$(CFG)" == "MazeServer - Win32 Debug Unicode" || "$(CFG)" == "MazeServer - Win32 Release Unicode"
|
||||
SOURCE=.\Main.cpp
|
||||
|
||||
"$(INTDIR)\Main.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=..\mazecommon\Maze.cpp
|
||||
|
||||
"$(INTDIR)\Maze.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\mazecommon\MazeServer.cpp
|
||||
|
||||
"$(INTDIR)\MazeServer.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=.\server.cpp
|
||||
|
||||
"$(INTDIR)\server.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=..\..\..\common\src\dxutil.cpp
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
//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
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\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 ICON DISCARDABLE "DirectX.ico"
|
||||
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File:
|
||||
//
|
||||
// Desc:
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _IDPSERVER_H
|
||||
#define _IDPSERVER_H
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by MazeServer.rc
|
||||
//
|
||||
#define IDI_MAIN_ICON 101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 112
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1025
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,496 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: server.cpp
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
#include <conio.h>
|
||||
#include <dplay8.h>
|
||||
#include <dpaddr.h>
|
||||
#include <DXErr8.h>
|
||||
#include "DXUtil.h"
|
||||
#include "server.h"
|
||||
#include "StressMazeGUID.h"
|
||||
|
||||
#define DPMAZESERVER_PORT 2309
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
CDPlay8Server::CDPlay8Server()
|
||||
{
|
||||
m_pDPlay = NULL;
|
||||
m_pServer = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Server::Start(DWORD dwNumSPThreads)
|
||||
{
|
||||
HRESULT hr;
|
||||
PDIRECTPLAY8ADDRESS pDP8AddrLocal = NULL;
|
||||
DWORD dwPort;
|
||||
|
||||
// Create DirectPlay object
|
||||
hr = CoCreateInstance( CLSID_DirectPlay8Server, NULL,
|
||||
CLSCTX_ALL, IID_IDirectPlay8Server,
|
||||
(LPVOID*) &m_pDPlay );
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
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("BuildLocalAddress"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
dwPort = DPMAZESERVER_PORT;
|
||||
hr = pDP8AddrLocal->AddComponent( DPNA_KEY_PORT,
|
||||
&dwPort, sizeof(dwPort),
|
||||
DPNA_DATATYPE_DWORD );
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("BuildLocalAddress"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
|
||||
hr = m_pDPlay->Initialize( this, StaticReceiveHandler, 0 );
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("Initialize"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
// If greater than 0, and less than 128, attempt to set number of threads.
|
||||
if((dwNumSPThreads >= MIN_SP_THREADS) && (dwNumSPThreads <= MAX_SP_THREADS))
|
||||
{
|
||||
// Set the number of SP Threads
|
||||
SetNumSPThreads(dwNumSPThreads);
|
||||
|
||||
}
|
||||
|
||||
|
||||
DPN_APPLICATION_DESC dpnAppDesc;
|
||||
ZeroMemory( &dpnAppDesc, sizeof(DPN_APPLICATION_DESC) );
|
||||
dpnAppDesc.dwSize = sizeof( DPN_APPLICATION_DESC );
|
||||
dpnAppDesc.dwFlags = DPNSESSION_CLIENT_SERVER;
|
||||
dpnAppDesc.guidApplication = StressMazeAppGUID;
|
||||
dpnAppDesc.pwszSessionName = L"StressMazeServer Session";
|
||||
|
||||
// Set host player context to non-NULL so we can determine which player indication is
|
||||
// the host's.
|
||||
hr = m_pDPlay->Host( &dpnAppDesc, &pDP8AddrLocal, 1, NULL, NULL, (void *) 1, 0 );
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("Host"), hr );
|
||||
goto LCleanup;
|
||||
}
|
||||
|
||||
LCleanup:
|
||||
SAFE_RELEASE( pDP8AddrLocal );
|
||||
SAFE_RELEASE( pDP8AddrLocal );
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CDPlay8Server::GetNumSPThreads()
|
||||
{
|
||||
|
||||
HRESULT hr = DPN_OK;
|
||||
|
||||
DPN_SP_CAPS dnSPCaps;
|
||||
DWORD dwFlags = NULL;
|
||||
DWORD dwNumSPThreads = NULL;
|
||||
|
||||
DXTRACE_MSG( TEXT("Attempting to Get SP Thread Count.") );
|
||||
|
||||
dnSPCaps.dwSize = sizeof(DPN_SP_CAPS);
|
||||
|
||||
hr = m_pDPlay->GetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr != DPN_OK)
|
||||
{
|
||||
DXTRACE_ERR( TEXT("GetSPCaps error"), hr );
|
||||
dwNumSPThreads = 0xffffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwNumSPThreads = dnSPCaps.dwNumThreads;
|
||||
}
|
||||
|
||||
return dwNumSPThreads;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDPlay8Server::SetNumSPThreads(DWORD dwNumSPThreads)
|
||||
{
|
||||
HRESULT hr = DPN_OK;
|
||||
|
||||
DPN_SP_CAPS dnSPCaps;
|
||||
DWORD dwFlags = NULL;
|
||||
|
||||
dnSPCaps.dwSize = sizeof(DPN_SP_CAPS);
|
||||
hr = m_pDPlay->GetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr == DPN_OK)
|
||||
{
|
||||
if((dwNumSPThreads >= MIN_SP_THREADS) && (dwNumSPThreads <= MAX_SP_THREADS))
|
||||
{
|
||||
dnSPCaps.dwNumThreads = dwNumSPThreads;
|
||||
|
||||
// Attempt to set the number of SP Threads.
|
||||
hr = m_pDPlay->SetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr != DPN_OK)
|
||||
{
|
||||
DXTRACE_ERR( TEXT("SetSPCaps error."), hr );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DXTRACE_ERR( TEXT("GetSPCaps error."), hr );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
DWORD CDPlay8Server::GetSPBuffer()
|
||||
{
|
||||
|
||||
HRESULT hr = DPN_OK;
|
||||
|
||||
DPN_SP_CAPS dnSPCaps;
|
||||
DWORD dwFlags = NULL;
|
||||
DWORD dwSPBufferSize = NULL;
|
||||
|
||||
DXTRACE_MSG( TEXT("Attempting to Get SP Buffer Size.") );
|
||||
|
||||
dnSPCaps.dwSize = sizeof(DPN_SP_CAPS);
|
||||
|
||||
hr = m_pDPlay->GetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr != DPN_OK)
|
||||
{
|
||||
DXTRACE_ERR( TEXT("GetSPCaps error"), hr );
|
||||
dwSPBufferSize = 0xffffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwSPBufferSize = dnSPCaps.dwSystemBufferSize;
|
||||
}
|
||||
|
||||
return dwSPBufferSize;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDPlay8Server::SetSPBuffer(DWORD dwSPBufferSize)
|
||||
{
|
||||
HRESULT hr = DPN_OK;
|
||||
|
||||
DPN_SP_CAPS dnSPCaps;
|
||||
DWORD dwFlags = NULL;
|
||||
|
||||
dnSPCaps.dwSize = sizeof(DPN_SP_CAPS);
|
||||
hr = m_pDPlay->GetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr == DPN_OK)
|
||||
{
|
||||
if(dwSPBufferSize <= MAX_SP_BUFFER)
|
||||
dnSPCaps.dwSystemBufferSize = dwSPBufferSize;
|
||||
|
||||
// Attempt to set the number of SP Threads.
|
||||
hr = m_pDPlay->SetSPCaps(&CLSID_DP8SP_TCPIP, &dnSPCaps, dwFlags);
|
||||
if(hr != DPN_OK)
|
||||
{
|
||||
DXTRACE_ERR( TEXT("SetSPCaps error."), hr );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DXTRACE_ERR( TEXT("GetSPCaps error."), hr );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CDPlay8Server::Shutdown()
|
||||
{
|
||||
if( m_pDPlay != NULL )
|
||||
m_pDPlay->Close(0);
|
||||
|
||||
SAFE_RELEASE( m_pDPlay );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Server::RejectClient( DWORD dwID, HRESULT hrReason )
|
||||
{
|
||||
HRESULT hrRet = S_OK;
|
||||
|
||||
if( m_pDPlay )
|
||||
{
|
||||
hrRet = m_pDPlay->DestroyClient( dwID, &hrReason, sizeof(hrReason), 0 );
|
||||
}
|
||||
|
||||
return hrRet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Server::StaticReceiveHandler( void *pvContext, DWORD dwMessageType,
|
||||
void *pvMessage )
|
||||
{
|
||||
CDPlay8Server* pThisObject = (CDPlay8Server*) pvContext;
|
||||
|
||||
return pThisObject->ReceiveHandler( pvContext, dwMessageType, pvMessage );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Server::ReceiveHandler( void *pvContext, DWORD dwMessageType,
|
||||
void *pvMessage )
|
||||
{
|
||||
switch( dwMessageType )
|
||||
{
|
||||
case DPN_MSGID_CREATE_PLAYER:
|
||||
{
|
||||
PDPNMSG_CREATE_PLAYER pCreatePlayer = (PDPNMSG_CREATE_PLAYER) pvMessage;
|
||||
|
||||
if( pCreatePlayer->pvPlayerContext == NULL )
|
||||
m_pServer->OnAddConnection( pCreatePlayer->dpnidPlayer );
|
||||
break;
|
||||
}
|
||||
|
||||
case DPN_MSGID_DESTROY_PLAYER:
|
||||
{
|
||||
PDPNMSG_DESTROY_PLAYER pDestroyPlayer = (PDPNMSG_DESTROY_PLAYER) pvMessage;
|
||||
|
||||
if( pDestroyPlayer->pvPlayerContext == NULL )
|
||||
m_pServer->OnRemoveConnection( pDestroyPlayer->dpnidPlayer );
|
||||
break;
|
||||
}
|
||||
|
||||
case DPN_MSGID_RECEIVE:
|
||||
{
|
||||
PDPNMSG_RECEIVE pRecvData = (PDPNMSG_RECEIVE) pvMessage;
|
||||
|
||||
m_pServer->OnPacket( pRecvData->dpnidSender, pRecvData->pReceiveData, pRecvData->dwReceiveDataSize );
|
||||
break;
|
||||
}
|
||||
|
||||
case DPN_MSGID_TERMINATE_SESSION:
|
||||
{
|
||||
m_pServer->OnSessionLost( DISCONNNECT_REASON_UNKNOWN );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return DPN_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Server::SendPacket( DWORD dwTo, void* pData,
|
||||
DWORD dwSize, BOOL bGuaranteed,
|
||||
DWORD dwTimeout )
|
||||
{
|
||||
DPNHANDLE hAsync;
|
||||
DPNHANDLE* phAsync;
|
||||
DWORD dwFlags = 0;
|
||||
DPN_BUFFER_DESC dpnBufferDesc;
|
||||
|
||||
if( bGuaranteed )
|
||||
{
|
||||
// If we are guaranteed then we must specify
|
||||
// DPNSEND_NOCOMPLETE and pass in non-null for the
|
||||
// pvAsyncContext
|
||||
dwFlags = DPNSEND_GUARANTEED;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we aren't guaranteed then we can
|
||||
// specify DPNSEND_NOCOMPLETE. And when
|
||||
// DPNSEND_NOCOMPLETE is on pvAsyncContext
|
||||
// must be NULL.
|
||||
dwFlags = DPNSEND_NOCOMPLETE;
|
||||
}
|
||||
// Must define an async handle for the SendTo call.
|
||||
phAsync = &hAsync;
|
||||
|
||||
dpnBufferDesc.dwBufferSize = dwSize;
|
||||
dpnBufferDesc.pBufferData = (PBYTE) pData;
|
||||
|
||||
// DirectPlay will tell via the message handler
|
||||
// if there are any severe errors, so ignore any errors
|
||||
m_pDPlay->SendTo( dwTo, &dpnBufferDesc, 1, dwTimeout, NULL, phAsync, dwFlags );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT CDPlay8Server::GetConnectionInfo( DWORD dwID, TCHAR* strConnectionInfo )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// Call GetConnectionInfo and display results
|
||||
DPN_CONNECTION_INFO dpnConnectionInfo;
|
||||
ZeroMemory( &dpnConnectionInfo, sizeof(DPN_CONNECTION_INFO) );
|
||||
dpnConnectionInfo.dwSize = sizeof(DPN_CONNECTION_INFO);
|
||||
hr = m_pDPlay->GetConnectionInfo( dwID, &dpnConnectionInfo, 0 );
|
||||
|
||||
if( SUCCEEDED(hr) )
|
||||
{
|
||||
DWORD dwHighPriMessages, dwHighPriBytes;
|
||||
DWORD dwNormalPriMessages, dwNormalPriBytes;
|
||||
DWORD dwLowPriMessages, dwLowPriBytes;
|
||||
|
||||
hr = m_pDPlay->GetSendQueueInfo( dwID,
|
||||
&dwHighPriMessages, &dwHighPriBytes,
|
||||
DPNGETSENDQUEUEINFO_PRIORITY_HIGH );
|
||||
|
||||
hr = m_pDPlay->GetSendQueueInfo( dwID,
|
||||
&dwNormalPriMessages, &dwNormalPriBytes,
|
||||
DPNGETSENDQUEUEINFO_PRIORITY_NORMAL );
|
||||
|
||||
hr = m_pDPlay->GetSendQueueInfo( dwID,
|
||||
&dwLowPriMessages, &dwLowPriBytes,
|
||||
DPNGETSENDQUEUEINFO_PRIORITY_LOW );
|
||||
|
||||
_stprintf( strConnectionInfo,
|
||||
TEXT(" Round Trip Latency MS=%dms\n") \
|
||||
TEXT(" Throughput BPS: Current=%d Peak=%d\n") \
|
||||
\
|
||||
TEXT(" Messages Received=%d\n") \
|
||||
\
|
||||
TEXT(" Sent: GB=%d GP=%d NGB=%d NGP=%d\n") \
|
||||
TEXT(" Received: GB=%d GP=%d NGB=%d NGP=%d\n") \
|
||||
\
|
||||
TEXT(" Messages Transmitted: HP=%d NP=%d LP=%d\n") \
|
||||
TEXT(" Messages Timed Out: HP=%d NP=%d LP=%d\n") \
|
||||
\
|
||||
TEXT(" Retried: GB=%d GP=%d\n") \
|
||||
TEXT(" Dropped: NGB=%d NGP=%d\n") \
|
||||
\
|
||||
TEXT(" Send Queue Messages: HP=%d NP=%d LP=%d\n") \
|
||||
TEXT(" Send Queue Bytes: HP=%d NP=%d LP=%d\n"), \
|
||||
\
|
||||
\
|
||||
dpnConnectionInfo.dwRoundTripLatencyMS,
|
||||
dpnConnectionInfo.dwThroughputBPS,
|
||||
dpnConnectionInfo.dwPeakThroughputBPS,
|
||||
|
||||
dpnConnectionInfo.dwMessagesReceived,
|
||||
|
||||
dpnConnectionInfo.dwBytesSentGuaranteed,
|
||||
dpnConnectionInfo.dwPacketsSentGuaranteed,
|
||||
dpnConnectionInfo.dwBytesSentNonGuaranteed,
|
||||
dpnConnectionInfo.dwPacketsSentNonGuaranteed,
|
||||
|
||||
dpnConnectionInfo.dwBytesReceivedGuaranteed,
|
||||
dpnConnectionInfo.dwPacketsReceivedGuaranteed,
|
||||
dpnConnectionInfo.dwBytesReceivedNonGuaranteed,
|
||||
dpnConnectionInfo.dwPacketsReceivedNonGuaranteed,
|
||||
|
||||
dpnConnectionInfo.dwMessagesTransmittedHighPriority,
|
||||
dpnConnectionInfo.dwMessagesTransmittedNormalPriority,
|
||||
dpnConnectionInfo.dwMessagesTransmittedLowPriority,
|
||||
|
||||
dpnConnectionInfo.dwMessagesTimedOutHighPriority,
|
||||
dpnConnectionInfo.dwMessagesTimedOutNormalPriority,
|
||||
dpnConnectionInfo.dwMessagesTimedOutLowPriority,
|
||||
|
||||
dpnConnectionInfo.dwBytesRetried,
|
||||
dpnConnectionInfo.dwPacketsRetried,
|
||||
|
||||
dpnConnectionInfo.dwBytesDropped,
|
||||
dpnConnectionInfo.dwPacketsDropped,
|
||||
|
||||
dwHighPriMessages, dwNormalPriMessages, dwLowPriMessages,
|
||||
dwHighPriBytes, dwNormalPriBytes, dwLowPriBytes
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_tcscpy( strConnectionInfo, TEXT("DPNID not found.\n") );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: server.h
|
||||
//
|
||||
// Desc: see main.cpp
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _DPLAY8_SERVER_H
|
||||
#define _DPLAY8_SERVER_H
|
||||
|
||||
|
||||
|
||||
#define MIN_SP_THREADS 1
|
||||
#define MAX_SP_THREADS 128
|
||||
#define MAX_SP_BUFFER 1024000
|
||||
|
||||
#define MAX_PACK_SIZE 2048
|
||||
#define MAX_THREAD_WAIT 60000
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "NetAbstract.h"
|
||||
|
||||
interface IDirectPlay8Server;
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name:
|
||||
// Desc:
|
||||
//-----------------------------------------------------------------------------
|
||||
class CDPlay8Server : public IOutboundServer
|
||||
{
|
||||
public:
|
||||
CDPlay8Server();
|
||||
|
||||
HRESULT Start(DWORD dwNumSPThreads);
|
||||
void Shutdown();
|
||||
void SetServer( INetServer* pServer ) { m_pServer = pServer; };
|
||||
|
||||
DWORD GetNumSPThreads();
|
||||
void SetNumSPThreads(DWORD dwNumSPThreads);
|
||||
|
||||
DWORD GetSPBuffer();
|
||||
void SetSPBuffer(DWORD dwSPBufferSize);
|
||||
|
||||
// From IOutboundServer
|
||||
virtual HRESULT SendPacket( DWORD dwTo, void* pData, DWORD dwSize, BOOL bGuaranteed, DWORD dwTimeout );
|
||||
virtual HRESULT GetConnectionInfo( DWORD dwID, TCHAR* strConnectionInfo );
|
||||
virtual HRESULT RejectClient( DWORD dwID, HRESULT hrReason );
|
||||
|
||||
|
||||
protected:
|
||||
IDirectPlay8Server* m_pDPlay;
|
||||
INetServer* m_pServer;
|
||||
|
||||
static HRESULT WINAPI StaticReceiveHandler( void *pvContext, DWORD dwMessageType, void *pvMessage );
|
||||
HRESULT WINAPI ReceiveHandler( void *pvContext, DWORD dwMessageType, void *pvMessage );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
53
Library/dxx8/samples/Multimedia/DirectPlay/Maze/maze.dsw
Normal file
@@ -0,0 +1,53 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "MazeClient"=.\MazeClient\MazeClient.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "MazeConsoleClient"=.\MazeConsoleClient\MazeConsoleClient.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "MazeServer"=.\MazeServer\MazeServer.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
88
Library/dxx8/samples/Multimedia/DirectPlay/Maze/readme.txt
Normal file
@@ -0,0 +1,88 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Sample Name: Maze Sample
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
This is a DirectPlay 8 client/server sample. The client comes in two flavors.
|
||||
A console based version, and a D3D client. The D3D client can optionally
|
||||
be run as screen saver by simply copying mazeclient.exe to your
|
||||
\winnt\system32\ and renaming it to mazeclient.scr. This will make
|
||||
it a screen saver that will be detected by the display control panel.
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\DirectPlay\VoicePosition
|
||||
|
||||
Executable: DXSDK\Samples\Multimedia\DirectPlay\Bin
|
||||
|
||||
User's Guide
|
||||
============
|
||||
How to use MazeClient:
|
||||
If you run "mazeclient.exe" then you'll be in "settings mode".
|
||||
A dialog box with various settings appears.
|
||||
|
||||
If you run "mazeclient.exe /t" then you'll be in "Test mode" where
|
||||
you don't have to connect to a server, or you can search and join
|
||||
a server game. There are few simple commands you can type when running
|
||||
mazeclient in "test mode":
|
||||
'a': Will turn auto-pilot on/off, but when moving about.
|
||||
There's isn't colision detection code so you can go through walls.
|
||||
'r': Will turn reflections on/off.
|
||||
|
||||
If you run "mazeclient.exe /s" then you'll be in "Screen Saver mode" on
|
||||
auto-pilot. This mode will auto-connect to a server, using the settings
|
||||
from "Setttings Mode". If a server is not found, it will run without
|
||||
connecting to a server. It will also exit upon mouse/keyboard input.
|
||||
|
||||
How to use MazeConsoleClient:
|
||||
Run it from the cmd line, and it will automatically search for a
|
||||
session on the local subnet. If you specify a IP address at the cmd
|
||||
prompt, as in "MazeConsoleClient 255.255.255.255", it will search for
|
||||
a session at that IP address. If a server is not found or the session
|
||||
is lost, then it will exit automatically. Hit Crtl-C to close the
|
||||
session.
|
||||
|
||||
How to use MazeServer:
|
||||
Run it from the cmd line and it will automatically creates a host session
|
||||
that clients can join.
|
||||
|
||||
MazeServer.exe takes an optional command line parameter to set the size of the maze.
|
||||
For example:
|
||||
|
||||
mazeserver.exe /size 16 128
|
||||
|
||||
will set the maze to be 16 wide, and 128 high. The width and height are restricted to
|
||||
these numbers: 16, 32, 64, or 128.
|
||||
|
||||
Once started, the server will display a simple command prompt to control the server.
|
||||
Here is the list of commands:
|
||||
|
||||
"help"
|
||||
A list of simple commands you can do.
|
||||
"stop"
|
||||
Shutdown the server.
|
||||
"stats"
|
||||
How many players are connected.
|
||||
"sr" or "serverreliable":
|
||||
Set what percent of the packets going from the server to the client have
|
||||
the DPNSEND_GUARANTEED flag.
|
||||
"cr" or "clientreliable"
|
||||
Set what percent of the packets going from every client to the server
|
||||
have the DPNSEND_GUARANTEED flag.
|
||||
"cu" or "clientupdate"
|
||||
Set how many milliseconds pass between updates from each client.
|
||||
"ct" or "clienttimeout"
|
||||
Sets the timeout value of packets sent by the clients
|
||||
"st" or "servertimeout"
|
||||
Sets the timeout value of packets sent by the server
|
||||
"ci" or "connectioninfo"
|
||||
Displays info about the connection from the server to a client. Ex. "ci 00300003"
|
||||
"loglevel"
|
||||
Set how much extra info it spews about what is happening behind the scenes.
|
||||
|
||||
@@ -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 )
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||