mirror of
https://github.com/ncblakely/GiantsTools
synced 2024-11-21 13:45:37 +01:00
Add work-in-progress console DLL as an example.
This commit is contained in:
parent
c7481e976f
commit
624084421e
39
ServerConsoleExample/CodeAnalysis.ruleset
Normal file
39
ServerConsoleExample/CodeAnalysis.ruleset
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="CodeAnalysis" ToolsVersion="16.0">
|
||||
<Include Path="cppcorecheckarithmeticrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckboundsrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckclassrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckconcurrencyrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckconstrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckdeclrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckenumrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckexperimentalrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckfuncrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckgslrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorechecklifetimerules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckownerpointerrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckrawpointerrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorechecksharedpointerrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckstlrules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckstylerules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorechecktyperules.ruleset" Action="Default" />
|
||||
<Include Path="cppcorecheckuniquepointerrules.ruleset" Action="Default" />
|
||||
<Include Path="nativerecommendedrules.ruleset" Action="Default" />
|
||||
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
|
||||
<Rule Id="C26401" Action="None" />
|
||||
<Rule Id="C26409" Action="None" />
|
||||
<Rule Id="C26426" Action="None" />
|
||||
<Rule Id="C26429" Action="None" />
|
||||
<Rule Id="C26432" Action="None" />
|
||||
<Rule Id="C26433" Action="None" />
|
||||
<Rule Id="C26440" Action="None" />
|
||||
<Rule Id="C26454" Action="None" />
|
||||
<Rule Id="C26462" Action="None" />
|
||||
<Rule Id="C26476" Action="None" />
|
||||
<Rule Id="C26477" Action="None" />
|
||||
<Rule Id="C26486" Action="None" />
|
||||
<Rule Id="C26493" Action="None" />
|
||||
<Rule Id="C26814" Action="None" />
|
||||
</Rules>
|
||||
</RuleSet>
|
4
ServerConsoleExample/ServerConsole.def
Normal file
4
ServerConsoleExample/ServerConsole.def
Normal file
@ -0,0 +1,4 @@
|
||||
LIBRARY
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
61
ServerConsoleExample/ServerConsole.filters
Normal file
61
ServerConsoleExample/ServerConsole.filters
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ServerDialog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GameServerConsole.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ServerConsoleApp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\ServerConsole.rc2">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="ServerConsole.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ServerDialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ServerConsoleApp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ServerConsole.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
BIN
ServerConsoleExample/ServerConsole.rc
Normal file
BIN
ServerConsoleExample/ServerConsole.rc
Normal file
Binary file not shown.
237
ServerConsoleExample/ServerConsole.vcxproj
Normal file
237
ServerConsoleExample/ServerConsole.vcxproj
Normal file
@ -0,0 +1,237 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{8AEE9CFF-0E24-498F-B60A-627A7F4A727D}</ProjectGuid>
|
||||
<Keyword>MFCDLLProj</Keyword>
|
||||
<RootNamespace>ServerInterface</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>ServerConsole</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<CodeAnalysisRuleSet>CodeAnalysis.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<CodeAnalysisRuleSet>CodeAnalysis.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>..\..\Sdk\Include</AdditionalIncludeDirectories>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ModuleDefinitionFile>.\ServerConsole.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>Rpcrt4.lib</AdditionalDependencies>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /DY "$(TargetPath)" "$(GIANTS_PATH)\$(TargetFileName)*"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ModuleDefinitionFile>.\ServerInterface.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>..\..\Sdk\Include</AdditionalIncludeDirectories>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>.\ServerConsole.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /DY "$(TargetPath)" "$(GIANTS_PATH)\$(TargetFileName)*"</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>.\ServerInterface.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ServerDialog.cpp" />
|
||||
<ClCompile Include="ServerConsoleApp.cpp" />
|
||||
<ClCompile Include="Utils.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\ServerConsole.rc2" />
|
||||
<None Include="ServerConsole.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="ServerDialog.h" />
|
||||
<ClInclude Include="ServerConsoleApp.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="Utils.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ServerConsole.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
56
ServerConsoleExample/ServerConsoleApp.cpp
Normal file
56
ServerConsoleExample/ServerConsoleApp.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
#include "pch.h"
|
||||
#include <initguid.h>
|
||||
#include "ServerConsoleApp.h"
|
||||
#include "ServerDialog.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
BEGIN_MESSAGE_MAP(ServerConsoleApp, CWinApp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
ServerConsoleApp ConsoleApp;
|
||||
BOOL ServerConsoleApp::InitInstance()
|
||||
{
|
||||
INITCOMMONCONTROLSEX InitCtrls;
|
||||
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||
InitCommonControlsEx(&InitCtrls);
|
||||
|
||||
CWinApp::InitInstance();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ServerConsoleApp::~ServerConsoleApp()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL ServerConsoleApp::ExitInstance()
|
||||
{
|
||||
return CWinApp::ExitInstance();
|
||||
}
|
||||
|
||||
IGameServerConsole* ServerConsoleApp::InitializeDialog(IComponentContainer* container)
|
||||
{
|
||||
// Create the server console window.
|
||||
// As this is also a Component, Giants will clean up this object automatically once
|
||||
// it is no longer needed (i.e, there is no need to call delete).
|
||||
auto* dialog = new ServerDialog(container);
|
||||
m_pMainWnd = dialog;
|
||||
return dialog;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void CreateServerConsole(
|
||||
int apiVersion,
|
||||
IComponentContainer* container)
|
||||
{
|
||||
if (apiVersion > 1)
|
||||
{
|
||||
throw std::invalid_argument(fmt::format("Unsupported API version {0}", apiVersion).c_str());
|
||||
}
|
||||
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
ConsoleApp.InitializeDialog(container);
|
||||
}
|
24
ServerConsoleExample/ServerConsoleApp.h
Normal file
24
ServerConsoleExample/ServerConsoleApp.h
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error "include 'pch.h' before including this file for PCH"
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "ServerDialog.h"
|
||||
#include <IGameServerConsole.h>
|
||||
#include <ComponentBase.h>
|
||||
|
||||
class ServerConsoleApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
~ServerConsoleApp();
|
||||
|
||||
// MFC methods
|
||||
BOOL InitInstance() override;
|
||||
BOOL ExitInstance() override;
|
||||
|
||||
IGameServerConsole* InitializeDialog(IComponentContainer* container);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
248
ServerConsoleExample/ServerDialog.cpp
Normal file
248
ServerConsoleExample/ServerDialog.cpp
Normal file
@ -0,0 +1,248 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include "ServerConsoleApp.h"
|
||||
#include "ServerDialog.h"
|
||||
#include "Utils.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC(ServerDialog, CDialogEx)
|
||||
|
||||
ServerDialog::ServerDialog(IComponentContainer* container, CWnd* parent)
|
||||
: ComponentBase(container),
|
||||
CDialogEx(IDD_SERVER, parent)
|
||||
{
|
||||
const auto& pGameServer = m_pContainer->Get<IGameServer>();
|
||||
|
||||
using namespace std::placeholders;
|
||||
m_playerConnectedEventHandle = pGameServer->Listen(GameServerEventType::PlayerConnected, std::bind(&ServerDialog::HandlePlayerConnected, this, _1));
|
||||
m_playerDisconnectedEventHandle = pGameServer->Listen(GameServerEventType::PlayerDisconnected, std::bind(&ServerDialog::HandlePlayerDisconnected, this, _1));
|
||||
m_playerChatMessageHandle = pGameServer->Listen(GameServerEventType::ChatMessage, std::bind(&ServerDialog::HandleChatMessage, this, _1));
|
||||
m_worldLoadedHandle = pGameServer->Listen(GameServerEventType::WorldLoaded, std::bind(&ServerDialog::HandleWorldLoaded, this, _1));
|
||||
}
|
||||
|
||||
ServerDialog::~ServerDialog()
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto& pGameServer = m_pContainer->Get<IGameServer>();
|
||||
|
||||
pGameServer->Unlisten(GameServerEventType::PlayerConnected, m_playerConnectedEventHandle);
|
||||
pGameServer->Unlisten(GameServerEventType::PlayerDisconnected, m_playerDisconnectedEventHandle);
|
||||
pGameServer->Unlisten(GameServerEventType::ChatMessage, m_playerChatMessageHandle);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ServerDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_CONSOLE, ConsoleEditBox);
|
||||
DDX_Control(pDX, IDC_PLAYERS, PlayersListCtrl);
|
||||
DDX_Control(pDX, IDC_BAN, ButtonBan);
|
||||
DDX_Control(pDX, IDC_KICK, ButtonKick);
|
||||
}
|
||||
|
||||
void __stdcall ServerDialog::TimerCallback(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
|
||||
{
|
||||
((ServerDialog*)idEvent)->RefreshPlayers();
|
||||
}
|
||||
|
||||
void ServerDialog::CloseDialog()
|
||||
{
|
||||
OnCancel();
|
||||
}
|
||||
|
||||
void ServerDialog::ShowDialog()
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
Create(IDD_SERVER);
|
||||
ShowWindow(SW_SHOW);
|
||||
}
|
||||
|
||||
BOOL ServerDialog::OnInitDialog()
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CreateColumns();
|
||||
|
||||
using namespace std::placeholders;
|
||||
SetTimer((UINT_PTR)this, 1000, TimerCallback);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ServerDialog::CreateColumns()
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
PlayersListCtrl.InsertColumn(0, _T("Name"), LVCFMT_LEFT, 40);
|
||||
PlayersListCtrl.InsertColumn(1, _T("Status"), LVCFMT_LEFT, 80);
|
||||
PlayersListCtrl.InsertColumn(2, _T("Ping"), LVCFMT_LEFT, 40);
|
||||
PlayersListCtrl.InsertColumn(3, _T("Score"), LVCFMT_LEFT, 80);
|
||||
PlayersListCtrl.InsertColumn(4, _T("Team"), LVCFMT_LEFT, 80);
|
||||
|
||||
for (int i = 0; i < NumColumns; i++)
|
||||
{
|
||||
PlayersListCtrl.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
|
||||
}
|
||||
}
|
||||
|
||||
void ServerDialog::PostNcDestroy()
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
CDialog::PostNcDestroy();
|
||||
}
|
||||
|
||||
void ServerDialog::OnOK()
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
if (!UpdateData(TRUE))
|
||||
return;
|
||||
DestroyWindow();
|
||||
}
|
||||
|
||||
void ServerDialog::OnCancel()
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
KillTimer((UINT_PTR)this);
|
||||
ShowWindow(SW_HIDE);
|
||||
DestroyWindow();
|
||||
}
|
||||
|
||||
void ServerDialog::RefreshPlayers()
|
||||
{
|
||||
if (!m_hWnd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
const int savedSelection = PlayersListCtrl.GetSelectionMark();
|
||||
PlayersListCtrl.DeleteAllItems();
|
||||
|
||||
|
||||
const auto& pTextLookupService = m_pContainer->Get<ITextLookupService>();
|
||||
const auto& pGameServer = m_pContainer->Get<IGameServer>();
|
||||
for (const auto& player : pGameServer->GetPlayers())
|
||||
{
|
||||
if (player.host)
|
||||
{
|
||||
continue; // Skip host player
|
||||
}
|
||||
|
||||
LVITEM item{};
|
||||
item.cColumns = NumColumns;
|
||||
item.mask = LVIF_COLUMNS | LVIF_PARAM;
|
||||
item.lParam = player.index;
|
||||
|
||||
const int index = PlayersListCtrl.InsertItem(&item);
|
||||
PlayersListCtrl.SetItemText(index, 0, player.name.c_str());
|
||||
PlayersListCtrl.SetItemText(index, 1, pTextLookupService->GetNetPlayerStateName(player.state).c_str());
|
||||
PlayersListCtrl.SetItemText(index, 2, fmt::format(_T("{0}"), player.ping).c_str());
|
||||
PlayersListCtrl.SetItemText(index, 3, fmt::format(_T("{0}"), player.score).c_str());
|
||||
PlayersListCtrl.SetItemText(index, 4, pTextLookupService->GetPlayerTeamName(player.team).c_str());
|
||||
}
|
||||
|
||||
PlayersListCtrl.SetSelectionMark(savedSelection);
|
||||
}
|
||||
|
||||
void ServerDialog::HandlePlayerConnected(const GameServerEvent& event)
|
||||
{
|
||||
RefreshPlayers();
|
||||
}
|
||||
|
||||
void ServerDialog::HandlePlayerDisconnected(const GameServerEvent& event)
|
||||
{
|
||||
RefreshPlayers();
|
||||
}
|
||||
|
||||
void ServerDialog::HandleChatMessage(const GameServerEvent& event)
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
const auto& chatMessageEvent = (const ChatMessageEvent&)event;
|
||||
|
||||
ConsoleEditBox.SetSel(-1, 0);
|
||||
ConsoleEditBox.ReplaceSel(chatMessageEvent.message.data());
|
||||
ConsoleEditBox.SetSel(-1, 0);
|
||||
ConsoleEditBox.ReplaceSel("\n");
|
||||
}
|
||||
|
||||
void ServerDialog::HandleWorldLoaded(const GameServerEvent& event)
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
const auto& pGameServer = m_pContainer->Get<IGameServer>();
|
||||
|
||||
NetGameDetails details = pGameServer->GetGameDetails();
|
||||
|
||||
// TODO: Connect to world state controls
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(ServerDialog, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BAN, &ServerDialog::OnBnClickedBan)
|
||||
ON_NOTIFY(LVN_ITEMCHANGED, IDC_PLAYERS, &ServerDialog::OnItemChanged)
|
||||
ON_BN_CLICKED(IDC_KICK, &ServerDialog::OnBnClickedKick)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// ServerDialog message handlers
|
||||
|
||||
void ServerDialog::OnBnClickedBan()
|
||||
{
|
||||
const int selection = PlayersListCtrl.GetSelectionMark();
|
||||
if (selection == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const PlayerIndex playerIndex = (PlayerIndex)PlayersListCtrl.GetItemData(selection);
|
||||
if (playerIndex > 0)
|
||||
{
|
||||
const auto& pGameServer = m_pContainer->Get<IGameServer>();
|
||||
pGameServer->BanPlayer(playerIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void ServerDialog::OnBnClickedKick()
|
||||
{
|
||||
const int selection = PlayersListCtrl.GetSelectionMark();
|
||||
if (selection == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const PlayerIndex playerIndex = (PlayerIndex)PlayersListCtrl.GetItemData(selection);
|
||||
if (playerIndex > 0)
|
||||
{
|
||||
const auto& pGameServer = m_pContainer->Get<IGameServer>();
|
||||
pGameServer->KickPlayer(playerIndex, KickReason::Removed);
|
||||
}
|
||||
}
|
||||
|
||||
void ServerDialog::OnItemChanged(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
const LPNMLISTVIEW pNMListView = (const LPNMLISTVIEW)(pNMHDR);
|
||||
|
||||
if (!(pNMListView->uChanged & LVIF_STATE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pNMListView->uOldState & LVIS_SELECTED) == (pNMListView->uNewState & LVIS_SELECTED))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ButtonKick.EnableWindow(TRUE);
|
||||
ButtonBan.EnableWindow(TRUE);
|
||||
|
||||
*pResult = 0;
|
||||
}
|
62
ServerConsoleExample/ServerDialog.h
Normal file
62
ServerConsoleExample/ServerDialog.h
Normal file
@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include <ComponentBase.h>
|
||||
#include <IGameServer.h>
|
||||
#include <IGameServerConsole.h>
|
||||
#include <IComponentContainer.h>
|
||||
#include <ITextLookupService.h>
|
||||
|
||||
// ServerDialog dialog
|
||||
|
||||
class ServerDialog : public CDialogEx, public ComponentBase<IGameServerConsole>
|
||||
{
|
||||
DECLARE_DYNAMIC(ServerDialog)
|
||||
|
||||
public:
|
||||
~ServerDialog();
|
||||
ServerDialog(IComponentContainer* container, CWnd* parent = nullptr);
|
||||
|
||||
void CreateColumns();
|
||||
void RefreshPlayers();
|
||||
|
||||
static void STDMETHODCALLTYPE TimerCallback(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime);
|
||||
void STDMETHODCALLTYPE CloseDialog() override;
|
||||
void STDMETHODCALLTYPE ShowDialog() override;
|
||||
|
||||
void HandlePlayerConnected(const GameServerEvent& event);
|
||||
void HandlePlayerDisconnected(const GameServerEvent& event);
|
||||
void HandleChatMessage(const GameServerEvent& event);
|
||||
void HandleWorldLoaded(const GameServerEvent& event);
|
||||
|
||||
// MFC methods
|
||||
BOOL OnInitDialog() override;
|
||||
void PostNcDestroy() override;
|
||||
void OnOK() override;
|
||||
void OnCancel() override;
|
||||
|
||||
// Dialog Data
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_SERVER };
|
||||
#endif
|
||||
|
||||
private:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
CEdit ConsoleEditBox;
|
||||
CListCtrl PlayersListCtrl;
|
||||
CButton ButtonBan;
|
||||
CButton ButtonKick;
|
||||
|
||||
afx_msg void OnBnClickedKick();
|
||||
afx_msg void OnBnClickedBan();
|
||||
afx_msg void OnItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
|
||||
UUID m_playerConnectedEventHandle{};
|
||||
UUID m_playerDisconnectedEventHandle{};
|
||||
UUID m_playerChatMessageHandle{};
|
||||
UUID m_worldLoadedHandle{};
|
||||
|
||||
const int NumColumns = 5;
|
||||
};
|
12
ServerConsoleExample/Utils.cpp
Normal file
12
ServerConsoleExample/Utils.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include <codecvt>
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
std::wstring to_wstring(const std::string_view& sourceString)
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
|
||||
return converter.from_bytes(sourceString.data());
|
||||
}
|
5
ServerConsoleExample/Utils.h
Normal file
5
ServerConsoleExample/Utils.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
std::wstring to_wstring(const std::string_view& sourceString);
|
35
ServerConsoleExample/framework.h
Normal file
35
ServerConsoleExample/framework.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
#endif
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxole.h> // MFC OLE classes
|
||||
#include <afxodlgs.h> // MFC OLE dialog classes
|
||||
#include <afxdisp.h> // MFC Automation classes
|
||||
#endif // _AFX_NO_OLE_SUPPORT
|
||||
|
||||
#ifndef _AFX_NO_DB_SUPPORT
|
||||
#include <afxdb.h> // MFC ODBC database classes
|
||||
#endif // _AFX_NO_DB_SUPPORT
|
||||
|
||||
#ifndef _AFX_NO_DAO_SUPPORT
|
||||
#include <afxdao.h> // MFC DAO database classes
|
||||
#endif // _AFX_NO_DAO_SUPPORT
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#endif
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
|
5
ServerConsoleExample/pch.cpp
Normal file
5
ServerConsoleExample/pch.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
// pch.cpp: source file corresponding to the pre-compiled header
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
23
ServerConsoleExample/pch.h
Normal file
23
ServerConsoleExample/pch.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <CodeAnalysis/warnings.h>
|
||||
|
||||
// AFX includes:
|
||||
#include "framework.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
// STL includes:
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <codecvt>
|
||||
#include <functional>
|
||||
#include <assert.h>
|
||||
#include <array>
|
||||
#include <guiddef.h>
|
||||
|
||||
// Third party:
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning (disable : ALL_CODE_ANALYSIS_WARNINGS)
|
||||
#include <fmt/format.h>
|
||||
#pragma warning(pop)
|
BIN
ServerConsoleExample/res/ServerConsole.rc2
Normal file
BIN
ServerConsoleExample/res/ServerConsole.rc2
Normal file
Binary file not shown.
27
ServerConsoleExample/resource.h
Normal file
27
ServerConsoleExample/resource.h
Normal file
@ -0,0 +1,27 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by ServerConsole.rc
|
||||
//
|
||||
#define IDD_SERVER 132
|
||||
#define IDC_GAMETYPE 133
|
||||
#define IDC_TEAMS 134
|
||||
#define IDC_WORLD 135
|
||||
#define IDC_PLAYERS 136
|
||||
#define IDC_ROTATIONS 137
|
||||
#define IDC_ROTATION 138
|
||||
#define IDC_TIMEREMAINING 139
|
||||
#define IDC_BAN 140
|
||||
#define IDC_KICK 141
|
||||
#define IDC_INPUT 142
|
||||
#define IDC_CONSOLE 143
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 1000
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 1000
|
||||
#endif
|
||||
#endif
|
8
ServerConsoleExample/targetver.h
Normal file
8
ServerConsoleExample/targetver.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <SDKDDKVer.h>
|
Loading…
Reference in New Issue
Block a user