Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
1340
Library/dxx8/samples/Multimedia/DirectPlay/Maze/MazeServer/Main.cpp
Normal file
1340
Library/dxx8/samples/Multimedia/DirectPlay/Maze/MazeServer/Main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
Reference in New Issue
Block a user