aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL
diff options
context:
space:
mode:
authorEmma Miler <emma.pi@protonmail.com>2022-12-19 19:32:16 +0100
committerGeckoEidechse <gecko.eidechse+git@pm.me>2023-01-04 14:45:48 +0100
commit27afb0ba38dcf0e74a4d09ba43e73261542b8e96 (patch)
tree28c737bdecc761fc8ca5257adfafaf2b325e1918 /NorthstarDLL
parentaf64117f09ba9b70d27c6b6da885d0474180849b (diff)
downloadNorthstarLauncher-27afb0ba38dcf0e74a4d09ba43e73261542b8e96.tar.gz
NorthstarLauncher-27afb0ba38dcf0e74a4d09ba43e73261542b8e96.zip
Restructuring (#365)
* Remove launcher proxy * Restructuring * More restructuring * Fix include dirs * Fix merge * Remove clang thing * Filters * Oops
Diffstat (limited to 'NorthstarDLL')
-rw-r--r--NorthstarDLL/NorthstarDLL.vcxproj258
-rw-r--r--NorthstarDLL/NorthstarDLL.vcxproj.filters791
-rw-r--r--NorthstarDLL/client/audio.cpp (renamed from NorthstarDLL/audio.cpp)4
-rw-r--r--NorthstarDLL/client/audio.h (renamed from NorthstarDLL/audio.h)0
-rw-r--r--NorthstarDLL/client/chatcommand.cpp (renamed from NorthstarDLL/chatcommand.cpp)4
-rw-r--r--NorthstarDLL/client/clientauthhooks.cpp (renamed from NorthstarDLL/clientauthhooks.cpp)6
-rw-r--r--NorthstarDLL/client/clientruihooks.cpp (renamed from NorthstarDLL/clientruihooks.cpp)2
-rw-r--r--NorthstarDLL/client/clientvideooverrides.cpp (renamed from NorthstarDLL/clientvideooverrides.cpp)2
-rw-r--r--NorthstarDLL/client/debugoverlay.cpp (renamed from NorthstarDLL/debugoverlay.cpp)6
-rw-r--r--NorthstarDLL/client/demofixes.cpp (renamed from NorthstarDLL/demofixes.cpp)2
-rw-r--r--NorthstarDLL/client/diskvmtfixes.cpp (renamed from NorthstarDLL/diskvmtfixes.cpp)32
-rw-r--r--NorthstarDLL/client/languagehooks.cpp (renamed from NorthstarDLL/languagehooks.cpp)2
-rw-r--r--NorthstarDLL/client/latencyflex.cpp (renamed from NorthstarDLL/latencyflex.cpp)2
-rw-r--r--NorthstarDLL/client/localchatwriter.cpp (renamed from NorthstarDLL/localchatwriter.cpp)0
-rw-r--r--NorthstarDLL/client/localchatwriter.h (renamed from NorthstarDLL/localchatwriter.h)2
-rw-r--r--NorthstarDLL/client/modlocalisation.cpp (renamed from NorthstarDLL/modlocalisation.cpp)2
-rw-r--r--NorthstarDLL/client/r2client.cpp (renamed from NorthstarDLL/r2client.cpp)0
-rw-r--r--NorthstarDLL/client/r2client.h (renamed from NorthstarDLL/r2client.h)0
-rw-r--r--NorthstarDLL/config/profile.cpp (renamed from NorthstarDLL/nsprefix.cpp)4
-rw-r--r--NorthstarDLL/config/profile.h (renamed from NorthstarDLL/nsprefix.h)0
-rw-r--r--NorthstarDLL/core/convar/concommand.cpp (renamed from NorthstarDLL/concommand.cpp)2
-rw-r--r--NorthstarDLL/core/convar/concommand.h (renamed from NorthstarDLL/concommand.h)0
-rw-r--r--NorthstarDLL/core/convar/convar.cpp (renamed from NorthstarDLL/convar.cpp)4
-rw-r--r--NorthstarDLL/core/convar/convar.h (renamed from NorthstarDLL/convar.h)4
-rw-r--r--NorthstarDLL/core/convar/cvar.cpp (renamed from NorthstarDLL/cvar.cpp)0
-rw-r--r--NorthstarDLL/core/convar/cvar.h (renamed from NorthstarDLL/cvar.h)0
-rw-r--r--NorthstarDLL/core/filesystem/filesystem.cpp (renamed from NorthstarDLL/filesystem.cpp)4
-rw-r--r--NorthstarDLL/core/filesystem/filesystem.h (renamed from NorthstarDLL/filesystem.h)2
-rw-r--r--NorthstarDLL/core/filesystem/rpakfilesystem.cpp (renamed from NorthstarDLL/rpakfilesystem.cpp)6
-rw-r--r--NorthstarDLL/core/filesystem/rpakfilesystem.h (renamed from NorthstarDLL/rpakfilesystem.h)0
-rw-r--r--NorthstarDLL/core/hooks.cpp (renamed from NorthstarDLL/hooks.cpp)2
-rw-r--r--NorthstarDLL/core/hooks.h (renamed from NorthstarDLL/hooks.h)0
-rw-r--r--NorthstarDLL/core/math/bitbuf.h (renamed from NorthstarDLL/bitbuf.h)0
-rw-r--r--NorthstarDLL/core/math/bits.cpp (renamed from NorthstarDLL/bits.cpp)0
-rw-r--r--NorthstarDLL/core/math/bits.h (renamed from NorthstarDLL/bits.h)0
-rw-r--r--NorthstarDLL/core/math/color.cpp (renamed from NorthstarDLL/color.cpp)0
-rw-r--r--NorthstarDLL/core/math/color.h (renamed from NorthstarDLL/color.h)0
-rw-r--r--NorthstarDLL/core/math/vector.h (renamed from NorthstarDLL/vector.h)104
-rw-r--r--NorthstarDLL/core/memalloc.cpp (renamed from NorthstarDLL/memalloc.cpp)4
-rw-r--r--NorthstarDLL/core/memalloc.h (renamed from NorthstarDLL/memalloc.h)0
-rw-r--r--NorthstarDLL/core/memory.cpp (renamed from NorthstarDLL/memory.cpp)4
-rw-r--r--NorthstarDLL/core/memory.h (renamed from NorthstarDLL/memory.h)0
-rw-r--r--NorthstarDLL/core/structs.h (renamed from NorthstarDLL/structs.h)5
-rw-r--r--NorthstarDLL/core/tier0.cpp (renamed from NorthstarDLL/tier0.cpp)0
-rw-r--r--NorthstarDLL/core/tier0.h (renamed from NorthstarDLL/tier0.h)0
-rw-r--r--NorthstarDLL/dedicated/dedicated.cpp (renamed from NorthstarDLL/dedicated.cpp)12
-rw-r--r--NorthstarDLL/dedicated/dedicated.h (renamed from NorthstarDLL/dedicated.h)0
-rw-r--r--NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp (renamed from NorthstarDLL/dedicatedmaterialsystem.cpp)2
-rw-r--r--NorthstarDLL/dllmain.cpp19
-rw-r--r--NorthstarDLL/dllmain.h (renamed from NorthstarDLL/main.h)0
-rw-r--r--NorthstarDLL/engine/host.cpp (renamed from NorthstarDLL/host.cpp)18
-rw-r--r--NorthstarDLL/engine/hoststate.cpp (renamed from NorthstarDLL/hoststate.cpp)18
-rw-r--r--NorthstarDLL/engine/hoststate.h (renamed from NorthstarDLL/hoststate.h)0
-rw-r--r--NorthstarDLL/engine/r2engine.cpp (renamed from NorthstarDLL/r2engine.cpp)0
-rw-r--r--NorthstarDLL/engine/r2engine.h (renamed from NorthstarDLL/r2engine.h)2
-rw-r--r--NorthstarDLL/engine/runframe.cpp (renamed from NorthstarDLL/runframe.cpp)8
-rw-r--r--NorthstarDLL/logging/crashhandler.cpp (renamed from NorthstarDLL/crashhandler.cpp)8
-rw-r--r--NorthstarDLL/logging/crashhandler.h (renamed from NorthstarDLL/crashhandler.h)0
-rw-r--r--NorthstarDLL/logging/logging.cpp (renamed from NorthstarDLL/logging.cpp)8
-rw-r--r--NorthstarDLL/logging/logging.h (renamed from NorthstarDLL/logging.h)2
-rw-r--r--NorthstarDLL/logging/loghooks.cpp (renamed from NorthstarDLL/loghooks.cpp)13
-rw-r--r--NorthstarDLL/logging/loghooks.h (renamed from NorthstarDLL/loghooks.h)0
-rw-r--r--NorthstarDLL/logging/sourceconsole.cpp (renamed from NorthstarDLL/sourceconsole.cpp)8
-rw-r--r--NorthstarDLL/logging/sourceconsole.h (renamed from NorthstarDLL/sourceconsole.h)2
-rw-r--r--NorthstarDLL/masterserver/masterserver.cpp (renamed from NorthstarDLL/masterserver.cpp)16
-rw-r--r--NorthstarDLL/masterserver/masterserver.h (renamed from NorthstarDLL/masterserver.h)4
-rw-r--r--NorthstarDLL/mods/compiled/kb_act.cpp (renamed from NorthstarDLL/kb_act.cpp)90
-rw-r--r--NorthstarDLL/mods/compiled/modkeyvalues.cpp (renamed from NorthstarDLL/modkeyvalues.cpp)4
-rw-r--r--NorthstarDLL/mods/compiled/modpdef.cpp (renamed from NorthstarDLL/modpdef.cpp)4
-rw-r--r--NorthstarDLL/mods/compiled/modscriptsrson.cpp (renamed from NorthstarDLL/modscriptsrson.cpp)6
-rw-r--r--NorthstarDLL/mods/modmanager.cpp (renamed from NorthstarDLL/modmanager.cpp)24
-rw-r--r--NorthstarDLL/mods/modmanager.h (renamed from NorthstarDLL/modmanager.h)6
-rw-r--r--NorthstarDLL/pch.h14
-rw-r--r--NorthstarDLL/plugins/plugin_abi.h (renamed from NorthstarDLL/plugin_abi.h)0
-rw-r--r--NorthstarDLL/plugins/plugins.cpp (renamed from NorthstarDLL/plugins.cpp)8
-rw-r--r--NorthstarDLL/plugins/plugins.h (renamed from NorthstarDLL/plugins.h)0
-rw-r--r--NorthstarDLL/scripts/client/clientchathooks.cpp (renamed from NorthstarDLL/clientchathooks.cpp)6
-rw-r--r--NorthstarDLL/scripts/client/scriptbrowserhooks.cpp (renamed from NorthstarDLL/scriptbrowserhooks.cpp)0
-rw-r--r--NorthstarDLL/scripts/client/scriptmainmenupromos.cpp (renamed from NorthstarDLL/scriptmainmenupromos.cpp)6
-rw-r--r--NorthstarDLL/scripts/client/scriptmodmenu.cpp (renamed from NorthstarDLL/scriptmodmenu.cpp)4
-rw-r--r--NorthstarDLL/scripts/client/scriptserverbrowser.cpp (renamed from NorthstarDLL/scriptserverbrowser.cpp)10
-rw-r--r--NorthstarDLL/scripts/client/scriptservertoclientstringcommand.cpp (renamed from NorthstarDLL/scriptservertoclientstringcommand.cpp)6
-rw-r--r--NorthstarDLL/scripts/scriptdatatables.cpp (renamed from NorthstarDLL/scriptdatatables.cpp)16
-rw-r--r--NorthstarDLL/scripts/scriptjson.cpp (renamed from NorthstarDLL/scriptjson.cpp)31
-rw-r--r--NorthstarDLL/scripts/scriptutility.cpp (renamed from NorthstarDLL/scriptutility.cpp)2
-rw-r--r--NorthstarDLL/scripts/server/miscserverfixes.cpp (renamed from NorthstarDLL/miscserverfixes.cpp)0
-rw-r--r--NorthstarDLL/scripts/server/miscserverscript.cpp (renamed from NorthstarDLL/miscserverscript.cpp)12
-rw-r--r--NorthstarDLL/scripts/server/scriptuserinfo.cpp (renamed from NorthstarDLL/scriptuserinfo.cpp)210
-rw-r--r--NorthstarDLL/server/auth/bansystem.cpp (renamed from NorthstarDLL/bansystem.cpp)10
-rw-r--r--NorthstarDLL/server/auth/bansystem.h (renamed from NorthstarDLL/bansystem.h)0
-rw-r--r--NorthstarDLL/server/auth/serverauthentication.cpp (renamed from NorthstarDLL/serverauthentication.cpp)28
-rw-r--r--NorthstarDLL/server/auth/serverauthentication.h (renamed from NorthstarDLL/serverauthentication.h)4
-rw-r--r--NorthstarDLL/server/buildainfile.cpp (renamed from NorthstarDLL/buildainfile.cpp)6
-rw-r--r--NorthstarDLL/server/r2server.cpp (renamed from NorthstarDLL/r2server.cpp)0
-rw-r--r--NorthstarDLL/server/r2server.h (renamed from NorthstarDLL/r2server.h)2
-rw-r--r--NorthstarDLL/server/serverchathooks.cpp (renamed from NorthstarDLL/serverchathooks.cpp)6
-rw-r--r--NorthstarDLL/server/serverchathooks.h (renamed from NorthstarDLL/serverchathooks.h)0
-rw-r--r--NorthstarDLL/server/serverpresence.cpp (renamed from NorthstarDLL/serverpresence.cpp)6
-rw-r--r--NorthstarDLL/server/serverpresence.h (renamed from NorthstarDLL/serverpresence.h)2
-rw-r--r--NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp (renamed from NorthstarDLL/exploitfixes.cpp)14
-rw-r--r--NorthstarDLL/shared/exploit_fixes/exploitfixes_lzss.cpp (renamed from NorthstarDLL/exploitfixes_lzss.cpp)0
-rw-r--r--NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp (renamed from NorthstarDLL/exploitfixes_utf8parser.cpp)0
-rw-r--r--NorthstarDLL/shared/exploit_fixes/ns_limits.cpp (renamed from NorthstarDLL/limits.cpp)18
-rw-r--r--NorthstarDLL/shared/exploit_fixes/ns_limits.h (renamed from NorthstarDLL/limits.h)4
-rw-r--r--NorthstarDLL/shared/keyvalues.cpp (renamed from NorthstarDLL/keyvalues.cpp)2632
-rw-r--r--NorthstarDLL/shared/keyvalues.h (renamed from NorthstarDLL/keyvalues.h)268
-rw-r--r--NorthstarDLL/shared/maxplayers.cpp (renamed from NorthstarDLL/maxplayers.cpp)2
-rw-r--r--NorthstarDLL/shared/maxplayers.h (renamed from NorthstarDLL/maxplayers.h)0
-rw-r--r--NorthstarDLL/shared/misccommands.cpp (renamed from NorthstarDLL/misccommands.cpp)21
-rw-r--r--NorthstarDLL/shared/misccommands.h (renamed from NorthstarDLL/misccommands.h)0
-rw-r--r--NorthstarDLL/shared/playlist.cpp (renamed from NorthstarDLL/playlist.cpp)10
-rw-r--r--NorthstarDLL/shared/playlist.h (renamed from NorthstarDLL/playlist.h)0
-rw-r--r--NorthstarDLL/shared/sourceinterface.cpp (renamed from NorthstarDLL/sourceinterface.cpp)2
-rw-r--r--NorthstarDLL/shared/sourceinterface.h (renamed from NorthstarDLL/sourceinterface.h)0
-rw-r--r--NorthstarDLL/squirrel/squirrel.cpp (renamed from NorthstarDLL/squirrel.cpp)18
-rw-r--r--NorthstarDLL/squirrel/squirrel.h (renamed from NorthstarDLL/squirrel.h)6
-rw-r--r--NorthstarDLL/squirrel/squirrelautobind.cpp (renamed from NorthstarDLL/squirrelautobind.cpp)0
-rw-r--r--NorthstarDLL/squirrel/squirrelautobind.h (renamed from NorthstarDLL/squirrelautobind.h)0
-rw-r--r--NorthstarDLL/squirrel/squirrelclasstypes.h (renamed from NorthstarDLL/squirrelclasstypes.h)0
-rw-r--r--NorthstarDLL/squirrel/squirreldatatypes.h (renamed from NorthstarDLL/squirreldatatypes.h)0
-rw-r--r--NorthstarDLL/util/printcommands.cpp (renamed from NorthstarDLL/printcommands.cpp)6
-rw-r--r--NorthstarDLL/util/printcommands.h (renamed from NorthstarDLL/printcommand.h)2
-rw-r--r--NorthstarDLL/util/printmaps.cpp (renamed from NorthstarDLL/printmaps.cpp)10
-rw-r--r--NorthstarDLL/util/printmaps.h (renamed from NorthstarDLL/printmaps.h)0
-rw-r--r--NorthstarDLL/util/version.cpp (renamed from NorthstarDLL/version.cpp)4
-rw-r--r--NorthstarDLL/util/version.h (renamed from NorthstarDLL/version.h)0
126 files changed, 2474 insertions, 2466 deletions
diff --git a/NorthstarDLL/NorthstarDLL.vcxproj b/NorthstarDLL/NorthstarDLL.vcxproj
index f7c16f2a..3a0b8374 100644
--- a/NorthstarDLL/NorthstarDLL.vcxproj
+++ b/NorthstarDLL/NorthstarDLL.vcxproj
@@ -62,7 +62,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
- <AdditionalIncludeDirectories>$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -92,7 +92,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
- <AdditionalIncludeDirectories>$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ProjectDir);$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<Optimization>Disabled</Optimization>
</ClCompile>
@@ -390,144 +390,146 @@
<ClInclude Include="..\include\spdlog\stopwatch.h" />
<ClInclude Include="..\include\spdlog\tweakme.h" />
<ClInclude Include="..\include\spdlog\version.h" />
- <ClInclude Include="audio.h" />
- <ClInclude Include="bansystem.h" />
- <ClInclude Include="bitbuf.h" />
- <ClInclude Include="bits.h" />
- <ClInclude Include="crashhandler.h" />
- <ClInclude Include="keyvalues.h" />
- <ClInclude Include="loghooks.h" />
- <ClInclude Include="squirrelclasstypes.h" />
- <ClInclude Include="squirreldatatypes.h" />
- <ClInclude Include="limits.h" />
- <ClInclude Include="maxplayers.h" />
- <ClInclude Include="memory.h" />
- <ClInclude Include="printcommand.h" />
- <ClInclude Include="hoststate.h" />
- <ClInclude Include="localchatwriter.h" />
- <ClInclude Include="printmaps.h" />
+ <ClInclude Include="client\audio.h" />
+ <ClInclude Include="client\localchatwriter.h" />
+ <ClInclude Include="client\r2client.h" />
+ <ClInclude Include="config\profile.h" />
+ <ClInclude Include="core\convar\concommand.h" />
+ <ClInclude Include="core\convar\convar.h" />
+ <ClInclude Include="core\convar\cvar.h" />
+ <ClInclude Include="core\filesystem\filesystem.h" />
+ <ClInclude Include="core\filesystem\rpakfilesystem.h" />
+ <ClInclude Include="core\hooks.h" />
+ <ClInclude Include="core\math\bitbuf.h" />
+ <ClInclude Include="core\math\bits.h" />
+ <ClInclude Include="core\math\color.h" />
+ <ClInclude Include="core\math\vector.h" />
+ <ClInclude Include="core\memalloc.h" />
+ <ClInclude Include="core\memory.h" />
+ <ClInclude Include="core\structs.h" />
+ <ClInclude Include="core\tier0.h" />
+ <ClInclude Include="dedicated\dedicated.h" />
+ <ClInclude Include="dllmain.h" />
+ <ClInclude Include="engine\hoststate.h" />
+ <ClInclude Include="engine\r2engine.h" />
+ <ClInclude Include="exploit_fixes\ns_limits.h" />
+ <ClInclude Include="hooks\hooks.h" />
+ <ClInclude Include="hooks\maxplayers.h" />
+ <ClInclude Include="hooks\memalloc.h" />
+ <ClInclude Include="hooks\memory.h" />
+ <ClInclude Include="hooks\sourceinterface.h" />
+ <ClInclude Include="hooks\tier0.h" />
+ <ClInclude Include="logging\crashhandler.h" />
+ <ClInclude Include="logging\logging.h" />
+ <ClInclude Include="logging\loghooks.h" />
+ <ClInclude Include="logging\sourceconsole.h" />
+ <ClInclude Include="masterserver\masterserver.h" />
+ <ClInclude Include="mods\modmanager.h" />
<ClInclude Include="ns_version.h" />
- <ClInclude Include="plugins.h" />
- <ClInclude Include="plugin_abi.h" />
- <ClInclude Include="r2client.h" />
- <ClInclude Include="r2engine.h" />
- <ClInclude Include="r2server.h" />
- <ClInclude Include="serverchathooks.h" />
- <ClInclude Include="color.h" />
- <ClInclude Include="concommand.h" />
- <ClInclude Include="nsprefix.h" />
- <ClInclude Include="convar.h" />
- <ClInclude Include="cvar.h" />
- <ClInclude Include="dedicated.h" />
- <ClInclude Include="filesystem.h" />
- <ClInclude Include="hooks.h" />
- <ClInclude Include="logging.h" />
- <ClInclude Include="main.h" />
- <ClInclude Include="masterserver.h" />
- <ClInclude Include="memalloc.h" />
- <ClInclude Include="misccommands.h" />
- <ClInclude Include="modmanager.h" />
<ClInclude Include="pch.h" />
- <ClInclude Include="playlist.h" />
- <ClInclude Include="rpakfilesystem.h" />
- <ClInclude Include="serverauthentication.h" />
- <ClInclude Include="serverpresence.h" />
- <ClInclude Include="sourceconsole.h" />
- <ClInclude Include="sourceinterface.h" />
- <ClInclude Include="squirrel.h" />
- <ClInclude Include="exploitfixes_utf8parser.cpp" />
- <ClInclude Include="structs.h" />
- <ClInclude Include="squirrelautobind.h" />
- <ClInclude Include="tier0.h" />
- <ClInclude Include="vector.h" />
- <ClInclude Include="version.h" />
+ <ClInclude Include="plugins\plugins.h" />
+ <ClInclude Include="plugins\plugin_abi.h" />
+ <ClInclude Include="server\auth\bansystem.h" />
+ <ClInclude Include="server\auth\serverauthentication.h" />
+ <ClInclude Include="server\r2server.h" />
+ <ClInclude Include="server\serverchathooks.h" />
+ <ClInclude Include="server\serverpresence.h" />
+ <ClInclude Include="shared\keyvalues.h" />
+ <ClInclude Include="shared\playlist.h" />
+ <ClInclude Include="squirrel\squirrel.h" />
+ <ClInclude Include="squirrel\squirrelautobind.h" />
+ <ClInclude Include="squirrel\squirrelclasstypes.h" />
+ <ClInclude Include="squirrel\squirreldatatypes.h" />
+ <ClInclude Include="util\version.h" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="audio.cpp" />
- <ClCompile Include="bansystem.cpp" />
- <ClCompile Include="bits.cpp" />
- <ClCompile Include="buildainfile.cpp" />
- <ClCompile Include="chatcommand.cpp" />
- <ClCompile Include="clientauthhooks.cpp" />
- <ClCompile Include="clientchathooks.cpp" />
- <ClCompile Include="clientruihooks.cpp" />
- <ClCompile Include="clientvideooverrides.cpp" />
- <ClCompile Include="concommand.cpp" />
- <ClCompile Include="diskvmtfixes.cpp" />
- <ClCompile Include="exploitfixes_lzss.cpp" />
- <ClCompile Include="kb_act.cpp" />
- <ClCompile Include="keyvalues.cpp" />
- <ClCompile Include="limits.cpp" />
- <ClCompile Include="color.cpp" />
- <ClCompile Include="loghooks.cpp" />
- <ClCompile Include="memory.cpp" />
- <ClCompile Include="nsprefix.cpp" />
- <ClCompile Include="convar.cpp" />
- <ClCompile Include="crashhandler.cpp" />
- <ClCompile Include="cvar.cpp" />
- <ClCompile Include="debugoverlay.cpp" />
- <ClCompile Include="dedicated.cpp" />
- <ClCompile Include="dedicatedmaterialsystem.cpp" />
- <ClCompile Include="demofixes.cpp" />
- <ClCompile Include="dllmain.cpp" />
- <ClCompile Include="filesystem.cpp" />
- <ClCompile Include="hooks.cpp" />
- <ClCompile Include="host.cpp" />
- <ClCompile Include="hoststate.cpp" />
- <ClCompile Include="modkeyvalues.cpp" />
- <ClCompile Include="latencyflex.cpp" />
- <ClCompile Include="localchatwriter.cpp" />
- <ClCompile Include="printmaps.cpp" />
- <ClCompile Include="maxplayers.cpp" />
- <ClCompile Include="languagehooks.cpp" />
- <ClCompile Include="memalloc.cpp" />
- <ClCompile Include="misccommands.cpp" />
- <ClCompile Include="miscserverfixes.cpp" />
- <ClCompile Include="modlocalisation.cpp" />
- <ClCompile Include="logging.cpp" />
- <ClCompile Include="masterserver.cpp" />
- <ClCompile Include="modmanager.cpp" />
+ <None Include="..\include\spdlog\fmt\bundled\LICENSE.rst" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="client\audio.cpp" />
+ <ClCompile Include="client\chatcommand.cpp" />
+ <ClCompile Include="client\clientauthhooks.cpp" />
+ <ClCompile Include="client\clientruihooks.cpp" />
+ <ClCompile Include="client\clientvideooverrides.cpp" />
+ <ClCompile Include="client\debugoverlay.cpp" />
+ <ClCompile Include="client\demofixes.cpp" />
+ <ClCompile Include="client\diskvmtfixes.cpp" />
+ <ClCompile Include="client\languagehooks.cpp" />
+ <ClCompile Include="client\latencyflex.cpp" />
+ <ClCompile Include="client\localchatwriter.cpp" />
+ <ClCompile Include="client\modlocalisation.cpp" />
+ <ClCompile Include="client\r2client.cpp" />
+ <ClCompile Include="config\profile.cpp" />
+ <ClCompile Include="core\convar\concommand.cpp" />
+ <ClCompile Include="core\convar\convar.cpp" />
+ <ClCompile Include="core\convar\cvar.cpp" />
+ <ClCompile Include="core\filesystem\filesystem.cpp" />
+ <ClCompile Include="core\filesystem\rpakfilesystem.cpp" />
+ <ClCompile Include="core\hooks.cpp" />
+ <ClCompile Include="core\math\bits.cpp" />
+ <ClCompile Include="core\math\color.cpp" />
+ <ClCompile Include="core\memalloc.cpp" />
+ <ClCompile Include="core\memory.cpp" />
+ <ClCompile Include="core\tier0.cpp" />
+ <ClCompile Include="dedicated\dedicated.cpp" />
+ <ClCompile Include="dedicated\dedicatedmaterialsystem.cpp" />
+ <ClCompile Include="dllmain.cpp">
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
+ </ClCompile>
+ <ClCompile Include="engine\host.cpp" />
+ <ClCompile Include="engine\hoststate.cpp" />
+ <ClCompile Include="engine\r2engine.cpp" />
+ <ClCompile Include="engine\runframe.cpp" />
+ <ClCompile Include="logging\crashhandler.cpp" />
+ <ClCompile Include="logging\logging.cpp" />
+ <ClCompile Include="logging\loghooks.cpp" />
+ <ClCompile Include="logging\sourceconsole.cpp" />
+ <ClCompile Include="masterserver\masterserver.cpp" />
+ <ClCompile Include="mods\compiled\kb_act.cpp" />
+ <ClCompile Include="mods\compiled\modkeyvalues.cpp" />
+ <ClCompile Include="mods\compiled\modpdef.cpp" />
+ <ClCompile Include="mods\compiled\modscriptsrson.cpp" />
+ <ClCompile Include="mods\modmanager.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="modpdef.cpp" />
- <ClCompile Include="playlist.cpp" />
- <ClCompile Include="plugins.cpp" />
- <ClCompile Include="printcommands.cpp" />
- <ClCompile Include="r2client.cpp" />
- <ClCompile Include="r2engine.cpp" />
- <ClCompile Include="r2server.cpp" />
- <ClCompile Include="rpakfilesystem.cpp" />
- <ClCompile Include="runframe.cpp" />
- <ClCompile Include="scriptbrowserhooks.cpp" />
- <ClCompile Include="scriptjson.cpp" />
- <ClCompile Include="scriptdatatables.cpp" />
- <ClCompile Include="scriptmainmenupromos.cpp" />
- <ClCompile Include="scriptmodmenu.cpp" />
- <ClCompile Include="scriptserverbrowser.cpp" />
- <ClCompile Include="modscriptsrson.cpp" />
- <ClCompile Include="scriptuserinfo.cpp" />
- <ClCompile Include="scriptutility.cpp" />
- <ClCompile Include="serverauthentication.cpp" />
- <ClCompile Include="miscserverscript.cpp" />
- <ClCompile Include="serverchathooks.cpp" />
- <ClCompile Include="scriptservertoclientstringcommand.cpp" />
- <ClCompile Include="serverpresence.cpp" />
- <ClCompile Include="sourceconsole.cpp" />
- <ClCompile Include="sourceinterface.cpp" />
- <ClCompile Include="squirrel.cpp" />
- <ClCompile Include="exploitfixes.cpp" />
- <ClCompile Include="squirrelautobind.cpp" />
- <ClCompile Include="tier0.cpp" />
- <ClCompile Include="version.cpp" />
+ <ClCompile Include="plugins\plugins.cpp" />
+ <ClCompile Include="scripts\client\clientchathooks.cpp" />
+ <ClCompile Include="scripts\client\scriptbrowserhooks.cpp" />
+ <ClCompile Include="scripts\client\scriptmainmenupromos.cpp" />
+ <ClCompile Include="scripts\client\scriptmodmenu.cpp" />
+ <ClCompile Include="scripts\client\scriptserverbrowser.cpp" />
+ <ClCompile Include="scripts\client\scriptservertoclientstringcommand.cpp" />
+ <ClCompile Include="scripts\scriptdatatables.cpp" />
+ <ClCompile Include="scripts\scriptjson.cpp" />
+ <ClCompile Include="scripts\scriptutility.cpp" />
+ <ClCompile Include="scripts\server\miscserverfixes.cpp" />
+ <ClCompile Include="scripts\server\miscserverscript.cpp" />
+ <ClCompile Include="scripts\server\scriptuserinfo.cpp" />
+ <ClCompile Include="server\auth\bansystem.cpp" />
+ <ClCompile Include="server\auth\serverauthentication.cpp" />
+ <ClCompile Include="server\buildainfile.cpp" />
+ <ClCompile Include="server\r2server.cpp" />
+ <ClCompile Include="server\serverchathooks.cpp" />
+ <ClCompile Include="server\serverpresence.cpp" />
+ <ClCompile Include="shared\exploit_fixes\exploitfixes.cpp" />
+ <ClCompile Include="shared\exploit_fixes\exploitfixes_lzss.cpp" />
+ <ClCompile Include="shared\exploit_fixes\exploitfixes_utf8parser.cpp" />
+ <ClCompile Include="shared\exploit_fixes\ns_limits.cpp" />
+ <ClCompile Include="shared\keyvalues.cpp" />
+ <ClCompile Include="shared\maxplayers.cpp" />
+ <ClCompile Include="shared\misccommands.cpp" />
+ <ClCompile Include="shared\playlist.cpp" />
+ <ClCompile Include="squirrel\squirrel.cpp" />
+ <ClCompile Include="squirrel\squirrelautobind.cpp" />
+ <ClCompile Include="util\printcommands.cpp" />
+ <ClCompile Include="util\printmaps.cpp" />
+ <ClCompile Include="util\version.cpp" />
</ItemGroup>
<ItemGroup>
<MASM Include="audio_asm.asm" />
</ItemGroup>
- <ItemGroup>
- <None Include="..\include\spdlog\fmt\bundled\LICENSE.rst" />
- </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
diff --git a/NorthstarDLL/NorthstarDLL.vcxproj.filters b/NorthstarDLL/NorthstarDLL.vcxproj.filters
index 1de56ce5..504a511f 100644
--- a/NorthstarDLL/NorthstarDLL.vcxproj.filters
+++ b/NorthstarDLL/NorthstarDLL.vcxproj.filters
@@ -16,12 +16,6 @@
<Filter Include="Header Files\include">
<UniqueIdentifier>{d4199e4b-10d2-43ce-af9c-e1fa79e1e64e}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Client">
- <UniqueIdentifier>{b6f79919-9735-476d-8798-067a75cbeca0}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\Client">
- <UniqueIdentifier>{ca657be5-c2d8-4322-a689-1154aaafe57b}</UniqueIdentifier>
- </Filter>
<Filter Include="Header Files\include\spdlog">
<UniqueIdentifier>{8596cc1c-0492-4467-91e3-1f03b7e19f77}</UniqueIdentifier>
</Filter>
@@ -52,257 +46,143 @@
<Filter Include="Header Files\include\rapidjson\msinttypes">
<UniqueIdentifier>{85aacdee-0f92-4ec4-b20c-0739c1175055}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Server">
- <UniqueIdentifier>{3d41d3fc-8a3b-4358-b3e8-4f06dc96abfe}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source Files\Server\Authentication">
- <UniqueIdentifier>{d69760a9-d5ec-4f3e-8f43-f74041654d44}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\Server">
- <UniqueIdentifier>{365e5c1f-4b2f-4d8b-a1d8-cdef401ca689}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\Server\Authentication">
- <UniqueIdentifier>{24fd0855-9288-4129-93ba-c6cafdc98d1b}</UniqueIdentifier>
- </Filter>
<Filter Include="Header Files\include\openssl">
<UniqueIdentifier>{4cb0dd89-5f16-4549-a864-34ca3075352a}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\include\libcurl">
<UniqueIdentifier>{ea1e17a6-40b7-4e1b-8edb-e9ae704ce604}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Client\Scripted">
- <UniqueIdentifier>{51910ba0-2ff8-461d-9f67-8d7907b57d22}</UniqueIdentifier>
+ <Filter Include="Source Files\client">
+ <UniqueIdentifier>{757f33f0-f17b-4ecd-8b95-2157b2d2f03c}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\config">
+ <UniqueIdentifier>{7f9657c5-d4c7-464f-b2f6-d9afbbe0bb42}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\dedicated">
+ <UniqueIdentifier>{e45d18f7-8992-47ac-837c-4cb99f5a0487}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\masterserver">
+ <UniqueIdentifier>{62167757-13c1-4f57-a8f5-15a3c800997b}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\mods">
+ <UniqueIdentifier>{25e33568-4125-406d-8661-01ae2abf61a5}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\mods\compiled">
+ <UniqueIdentifier>{008e67ce-bf6a-4792-9ded-69a434edea00}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\plugins">
+ <UniqueIdentifier>{dbf03bda-dd0a-44ce-a6b1-361f7f21a10e}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\server">
+ <UniqueIdentifier>{d83e1c5c-c9c7-47a2-b406-9b5a93e3cc29}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\scripts">
+ <UniqueIdentifier>{57fb0fa6-7665-4d37-bb2b-6f5570023d83}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\server\auth">
+ <UniqueIdentifier>{08436037-e86f-4410-8db6-37c8b10ca5a1}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\squirrel">
+ <UniqueIdentifier>{e8fb33f4-47b5-4fd9-b6c0-2ca1bd8cac81}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Source Files\util">
+ <UniqueIdentifier>{d60e54d0-b4e4-4210-af6b-59bdd84bed0f}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\client">
+ <UniqueIdentifier>{06c7928e-bf66-446e-9cde-c8135c79d14b}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\config">
+ <UniqueIdentifier>{0b8b4a41-6131-4388-85d2-f5754a304610}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\dedicated">
+ <UniqueIdentifier>{9ccd8616-d961-4c37-96e0-3219bd293afb}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\exploit_fixes">
+ <UniqueIdentifier>{a9390f6a-5031-4c65-a636-82cf90899435}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\hooks">
+ <UniqueIdentifier>{acf049ba-358a-4520-8813-2f802ce7167e}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files\masterserver">
+ <UniqueIdentifier>{0075910c-80c9-490f-a0d4-f9e410e4a918}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Server\Scripted">
- <UniqueIdentifier>{325e0d7d-6832-496d-8d8e-968fdfa5dd40}</UniqueIdentifier>
+ <Filter Include="Header Files\mods">
+ <UniqueIdentifier>{31143dec-abe6-477a-9cae-045c5b57380b}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Server\Scripted">
- <UniqueIdentifier>{802d0771-62f1-4733-89f9-57a4d8864b8d}</UniqueIdentifier>
+ <Filter Include="Header Files\plugins">
+ <UniqueIdentifier>{c6c4746d-d6e1-4dba-a3fc-e645b28ac83f}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Console">
- <UniqueIdentifier>{04fd662a-6e70-494c-b720-c694a5cc2fb1}</UniqueIdentifier>
+ <Filter Include="Header Files\scripts">
+ <UniqueIdentifier>{3fba68ef-d715-4e18-b4a2-05d3fee00e2d}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Convar">
- <UniqueIdentifier>{a18afb37-5fdd-4340-a6b4-a6541593e398}</UniqueIdentifier>
+ <Filter Include="Header Files\server">
+ <UniqueIdentifier>{ae9c5353-a3ab-44a9-a328-91df6aa8c80e}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Exploit Fixes">
- <UniqueIdentifier>{4a8a695a-a103-4b1f-b314-0ec19a253119}</UniqueIdentifier>
+ <Filter Include="Header Files\server\auth">
+ <UniqueIdentifier>{87869634-fa0f-48f8-a306-94d5a8157e1e}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Filesystem">
- <UniqueIdentifier>{d8a83b5e-9a23-4124-824f-eab37880cb08}</UniqueIdentifier>
+ <Filter Include="Header Files\squirrel">
+ <UniqueIdentifier>{0ad64562-eb98-4015-a4fc-6fdc63ac9322}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Game Functions">
- <UniqueIdentifier>{2cbddb28-0b17-4881-847d-8773da52b268}</UniqueIdentifier>
+ <Filter Include="Header Files\util">
+ <UniqueIdentifier>{13d0affc-1b4d-4090-8ad6-e9ae8fc56599}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Hooks">
- <UniqueIdentifier>{4db0d1e9-9035-457f-87f1-5dc3f13b6b9e}</UniqueIdentifier>
+ <Filter Include="Source Files\engine">
+ <UniqueIdentifier>{b264a27d-619b-49b3-acbb-4e138ba29daf}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Math">
- <UniqueIdentifier>{59b0f68f-daa7-4641-b6fa-8464b56da2bb}</UniqueIdentifier>
+ <Filter Include="Header Files\engine">
+ <UniqueIdentifier>{35658430-465d-433c-aa2d-b8266edb205a}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Mods">
- <UniqueIdentifier>{3e892d07-2239-44da-9cf3-c288a34cf9a2}</UniqueIdentifier>
+ <Filter Include="Source Files\shared">
+ <UniqueIdentifier>{0517ea0b-2eca-4b1c-a0d1-766d4d1d19d2}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Mods\Compiled Assets">
- <UniqueIdentifier>{14fc0931-acad-46ec-a55e-94f4469d4235}</UniqueIdentifier>
+ <Filter Include="Header Files\shared">
+ <UniqueIdentifier>{6d3f7657-6e58-4007-acd3-0b787f35406a}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Dedicated Server">
- <UniqueIdentifier>{947835db-67d6-42c0-870d-62743f85231f}</UniqueIdentifier>
+ <Filter Include="Source Files\logging">
+ <UniqueIdentifier>{b9c0cfad-46d4-41ea-806e-daef3d66c381}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Console">
- <UniqueIdentifier>{bf0769d8-40fd-4701-85e9-7ed94aab2283}</UniqueIdentifier>
+ <Filter Include="Header Files\logging">
+ <UniqueIdentifier>{a4f7d529-0b21-48af-82ef-9fb971b802f7}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Convar">
- <UniqueIdentifier>{9751b551-5886-45d4-a039-cbd10445263d}</UniqueIdentifier>
+ <Filter Include="Header Files\core">
+ <UniqueIdentifier>{7ee4b436-a5d3-4680-bf99-bc6d7640ded3}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Exploit Fixes">
- <UniqueIdentifier>{96101d42-72af-4fd1-8559-8d1d1ff66240}</UniqueIdentifier>
+ <Filter Include="Header Files\core\convar">
+ <UniqueIdentifier>{53a84980-9a1c-46b0-9b6d-06ec35781297}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Filesystem">
- <UniqueIdentifier>{ee3ba13a-3061-41d7-981d-328ac2596fd2}</UniqueIdentifier>
+ <Filter Include="Header Files\core\filesystem">
+ <UniqueIdentifier>{01e215c3-9fa2-4de1-a3e0-b6a27396c68c}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Game Functions">
- <UniqueIdentifier>{0c93d909-e0d6-4c35-a8a4-a13f681a1012}</UniqueIdentifier>
+ <Filter Include="Header Files\core\math">
+ <UniqueIdentifier>{0fa069c9-302b-4be5-ba47-37e13e181d78}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Hooks">
- <UniqueIdentifier>{94259c8c-5411-48bf-af4f-46ca32b7d0bb}</UniqueIdentifier>
+ <Filter Include="Source Files\scripts\client">
+ <UniqueIdentifier>{08a9ca37-8a6e-458c-9da8-6f3dc917ddf7}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Math">
- <UniqueIdentifier>{44a83740-9d70-480d-9a7a-43b81f8eab9e}</UniqueIdentifier>
+ <Filter Include="Source Files\scripts\server">
+ <UniqueIdentifier>{2c0b196e-3a11-4655-a158-8a1c84be4471}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Mods">
- <UniqueIdentifier>{6bbce8a5-38b4-4763-a7cb-4e98012ec245}</UniqueIdentifier>
+ <Filter Include="Source Files\core">
+ <UniqueIdentifier>{122e2230-0605-40ef-8963-6e339d2c725e}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Mods\Compiled Assets">
- <UniqueIdentifier>{826d5193-3ad0-434b-ba7c-dd24ed4bbd0c}</UniqueIdentifier>
+ <Filter Include="Source Files\core\convar">
+ <UniqueIdentifier>{4e0d0f0e-c8f2-4fe1-a787-57060c610553}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Dedicated Server">
- <UniqueIdentifier>{0f1ba4c4-78ee-4b05-afa5-6f598063f5c1}</UniqueIdentifier>
+ <Filter Include="Source Files\core\math">
+ <UniqueIdentifier>{9e67fc99-0e20-4155-a167-5d251ea36581}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\Squirrel">
- <UniqueIdentifier>{ca669b16-b8bb-4654-993f-fffa44c914f1}</UniqueIdentifier>
+ <Filter Include="Source Files\core\filesystem">
+ <UniqueIdentifier>{62b3cff9-b2d8-4c1c-a2a6-1e2138c0ff88}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Squirrel">
- <UniqueIdentifier>{26365f16-ff52-4e80-a01b-2ca020376c93}</UniqueIdentifier>
+ <Filter Include="Source Files\shared\exploit_fixes">
+ <UniqueIdentifier>{9a819cdd-ebca-4cba-b231-76b6f98ed6ac}</UniqueIdentifier>
</Filter>
- <Filter Include="Source Files\Scripted">
- <UniqueIdentifier>{7263403a-7550-4aa2-a724-f622ab200eed}</UniqueIdentifier>
+ <Filter Include="Header Files\shared\exploit_fixes">
+ <UniqueIdentifier>{1a377c09-bd3d-4757-b3bc-9cd0a1e6ac0d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="pch.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="main.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="sourceconsole.h">
- <Filter>Header Files\Client</Filter>
- </ClInclude>
- <ClInclude Include="serverauthentication.h">
- <Filter>Header Files\Server\Authentication</Filter>
- </ClInclude>
- <ClInclude Include="bansystem.h">
- <Filter>Header Files\Server\Authentication</Filter>
- </ClInclude>
- <ClInclude Include="audio.h">
- <Filter>Header Files\Client</Filter>
- </ClInclude>
- <ClInclude Include="localchatwriter.h">
- <Filter>Header Files\Client</Filter>
- </ClInclude>
- <ClInclude Include="plugins.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="plugin_abi.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="version.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ns_version.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="serverchathooks.h">
- <Filter>Header Files\Server\Scripted</Filter>
- </ClInclude>
- <ClInclude Include="dedicated.h">
- <Filter>Header Files\Dedicated Server</Filter>
- </ClInclude>
- <ClInclude Include="nsprefix.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="exploitfixes_utf8parser.cpp">
- <Filter>Source Files\Exploit Fixes</Filter>
- </ClInclude>
- <ClInclude Include="crashhandler.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="hoststate.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="masterserver.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="memalloc.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="playlist.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="sourceinterface.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="bits.h">
- <Filter>Header Files\Math</Filter>
- </ClInclude>
- <ClInclude Include="bitbuf.h">
- <Filter>Header Files\Math</Filter>
- </ClInclude>
- <ClInclude Include="convar.h">
- <Filter>Header Files\Convar</Filter>
- </ClInclude>
- <ClInclude Include="concommand.h">
- <Filter>Header Files\Convar</Filter>
- </ClInclude>
- <ClInclude Include="cvar.h">
- <Filter>Header Files\Convar</Filter>
- </ClInclude>
- <ClInclude Include="filesystem.h">
- <Filter>Header Files\Filesystem</Filter>
- </ClInclude>
- <ClInclude Include="hooks.h">
- <Filter>Header Files\Hooks</Filter>
- </ClInclude>
- <ClInclude Include="limits.h">
- <Filter>Header Files\Exploit Fixes</Filter>
- </ClInclude>
- <ClInclude Include="logging.h">
- <Filter>Header Files\Console</Filter>
- </ClInclude>
- <ClInclude Include="misccommands.h">
- <Filter>Header Files\Convar</Filter>
- </ClInclude>
- <ClInclude Include="modmanager.h">
- <Filter>Header Files\Mods</Filter>
- </ClInclude>
- <ClInclude Include="printcommand.h">
- <Filter>Header Files\Console</Filter>
- </ClInclude>
- <ClInclude Include="printmaps.h">
- <Filter>Header Files\Console</Filter>
- </ClInclude>
- <ClInclude Include="r2client.h">
- <Filter>Header Files\Game Functions</Filter>
- </ClInclude>
- <ClInclude Include="r2engine.h">
- <Filter>Header Files\Game Functions</Filter>
- </ClInclude>
- <ClInclude Include="r2server.h">
- <Filter>Header Files\Game Functions</Filter>
- </ClInclude>
- <ClInclude Include="tier0.h">
- <Filter>Header Files\Game Functions</Filter>
- </ClInclude>
- <ClInclude Include="rpakfilesystem.h">
- <Filter>Header Files\Filesystem</Filter>
- </ClInclude>
- <ClInclude Include="color.h">
- <Filter>Header Files\Math</Filter>
- </ClInclude>
- <ClInclude Include="serverpresence.h">
- <Filter>Header Files\Server</Filter>
- </ClInclude>
- <ClInclude Include="memory.h">
- <Filter>Header Files\Hooks</Filter>
- </ClInclude>
- <ClInclude Include="maxplayers.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="squirrel.h">
- <Filter>Header Files\Squirrel</Filter>
- </ClInclude>
- <ClInclude Include="squirreldatatypes.h">
- <Filter>Header Files\Squirrel</Filter>
- </ClInclude>
- <ClInclude Include="vector.h">
- <Filter>Header Files\Math</Filter>
- </ClInclude>
- <ClInclude Include="squirrelautobind.h">
- <Filter>Header Files\Squirrel</Filter>
- </ClInclude>
- <ClInclude Include="keyvalues.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="structs.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="loghooks.h">
- <Filter>Header Files\Console</Filter>
- </ClInclude>
- <ClInclude Include="squirrelclasstypes.h">
- <Filter>Header Files\Squirrel</Filter>
- </ClInclude>
<ClInclude Include="..\include\httplib.h">
<Filter>Header Files\include</Filter>
</ClInclude>
@@ -1125,242 +1005,395 @@
<ClInclude Include="..\include\spdlog\sinks\wincolor_sink-inl.h">
<Filter>Header Files\include\spdlog\sinks</Filter>
</ClInclude>
+ <ClInclude Include="client\audio.h">
+ <Filter>Header Files\client</Filter>
+ </ClInclude>
+ <ClInclude Include="client\localchatwriter.h">
+ <Filter>Header Files\client</Filter>
+ </ClInclude>
+ <ClInclude Include="dedicated\dedicated.h">
+ <Filter>Header Files\dedicated</Filter>
+ </ClInclude>
+ <ClInclude Include="exploit_fixes\ns_limits.h">
+ <Filter>Header Files\exploit_fixes</Filter>
+ </ClInclude>
+ <ClInclude Include="hooks\hooks.h">
+ <Filter>Header Files\hooks</Filter>
+ </ClInclude>
+ <ClInclude Include="hooks\memory.h">
+ <Filter>Header Files\hooks</Filter>
+ </ClInclude>
+ <ClInclude Include="hooks\sourceinterface.h">
+ <Filter>Header Files\hooks</Filter>
+ </ClInclude>
+ <ClInclude Include="masterserver\masterserver.h">
+ <Filter>Header Files\masterserver</Filter>
+ </ClInclude>
+ <ClInclude Include="mods\modmanager.h">
+ <Filter>Header Files\mods</Filter>
+ </ClInclude>
+ <ClInclude Include="plugins\plugin_abi.h">
+ <Filter>Header Files\plugins</Filter>
+ </ClInclude>
+ <ClInclude Include="plugins\plugins.h">
+ <Filter>Header Files\plugins</Filter>
+ </ClInclude>
+ <ClInclude Include="server\serverpresence.h">
+ <Filter>Header Files\server</Filter>
+ </ClInclude>
+ <ClInclude Include="server\auth\bansystem.h">
+ <Filter>Header Files\server\auth</Filter>
+ </ClInclude>
+ <ClInclude Include="server\auth\serverauthentication.h">
+ <Filter>Header Files\server\auth</Filter>
+ </ClInclude>
+ <ClInclude Include="squirrel\squirrel.h">
+ <Filter>Header Files\squirrel</Filter>
+ </ClInclude>
+ <ClInclude Include="squirrel\squirrelautobind.h">
+ <Filter>Header Files\squirrel</Filter>
+ </ClInclude>
+ <ClInclude Include="squirrel\squirrelclasstypes.h">
+ <Filter>Header Files\squirrel</Filter>
+ </ClInclude>
+ <ClInclude Include="squirrel\squirreldatatypes.h">
+ <Filter>Header Files\squirrel</Filter>
+ </ClInclude>
+ <ClInclude Include="util\version.h">
+ <Filter>Header Files\util</Filter>
+ </ClInclude>
+ <ClInclude Include="dllmain.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="ns_version.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="pch.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="config\profile.h">
+ <Filter>Header Files\config</Filter>
+ </ClInclude>
+ <ClInclude Include="engine\hoststate.h">
+ <Filter>Header Files\engine</Filter>
+ </ClInclude>
+ <ClInclude Include="hooks\maxplayers.h">
+ <Filter>Header Files\hooks</Filter>
+ </ClInclude>
+ <ClInclude Include="shared\keyvalues.h">
+ <Filter>Header Files\shared</Filter>
+ </ClInclude>
+ <ClInclude Include="shared\playlist.h">
+ <Filter>Header Files\shared</Filter>
+ </ClInclude>
+ <ClInclude Include="client\r2client.h">
+ <Filter>Header Files\client</Filter>
+ </ClInclude>
+ <ClInclude Include="engine\r2engine.h">
+ <Filter>Header Files\engine</Filter>
+ </ClInclude>
+ <ClInclude Include="server\r2server.h">
+ <Filter>Header Files\server</Filter>
+ </ClInclude>
+ <ClInclude Include="hooks\tier0.h">
+ <Filter>Header Files\hooks</Filter>
+ </ClInclude>
+ <ClInclude Include="hooks\memalloc.h">
+ <Filter>Header Files\hooks</Filter>
+ </ClInclude>
+ <ClInclude Include="core\convar\concommand.h">
+ <Filter>Header Files\core\convar</Filter>
+ </ClInclude>
+ <ClInclude Include="core\convar\convar.h">
+ <Filter>Header Files\core\convar</Filter>
+ </ClInclude>
+ <ClInclude Include="core\convar\cvar.h">
+ <Filter>Header Files\core\convar</Filter>
+ </ClInclude>
+ <ClInclude Include="core\filesystem\filesystem.h">
+ <Filter>Header Files\core\filesystem</Filter>
+ </ClInclude>
+ <ClInclude Include="core\filesystem\rpakfilesystem.h">
+ <Filter>Header Files\core\filesystem</Filter>
+ </ClInclude>
+ <ClInclude Include="core\math\bitbuf.h">
+ <Filter>Header Files\core\math</Filter>
+ </ClInclude>
+ <ClInclude Include="core\math\bits.h">
+ <Filter>Header Files\core\math</Filter>
+ </ClInclude>
+ <ClInclude Include="core\math\color.h">
+ <Filter>Header Files\core\math</Filter>
+ </ClInclude>
+ <ClInclude Include="core\math\vector.h">
+ <Filter>Header Files\core\math</Filter>
+ </ClInclude>
+ <ClInclude Include="core\hooks.h">
+ <Filter>Header Files\core</Filter>
+ </ClInclude>
+ <ClInclude Include="core\memalloc.h">
+ <Filter>Header Files\core</Filter>
+ </ClInclude>
+ <ClInclude Include="core\memory.h">
+ <Filter>Header Files\core</Filter>
+ </ClInclude>
+ <ClInclude Include="core\structs.h">
+ <Filter>Header Files\core</Filter>
+ </ClInclude>
+ <ClInclude Include="core\tier0.h">
+ <Filter>Header Files\core</Filter>
+ </ClInclude>
+ <ClInclude Include="logging\crashhandler.h">
+ <Filter>Header Files\logging</Filter>
+ </ClInclude>
+ <ClInclude Include="logging\logging.h">
+ <Filter>Header Files\logging</Filter>
+ </ClInclude>
+ <ClInclude Include="logging\loghooks.h">
+ <Filter>Header Files\logging</Filter>
+ </ClInclude>
+ <ClInclude Include="logging\sourceconsole.h">
+ <Filter>Header Files\logging</Filter>
+ </ClInclude>
+ <ClInclude Include="server\serverchathooks.h">
+ <Filter>Header Files\server</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="pch.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dedicated.cpp">
- <Filter>Source Files\Dedicated Server</Filter>
- </ClCompile>
- <ClCompile Include="sourceconsole.cpp">
- <Filter>Source Files\Client</Filter>
- </ClCompile>
- <ClCompile Include="modmanager.cpp">
- <Filter>Source Files\Mods</Filter>
+ <None Include="..\include\spdlog\fmt\bundled\LICENSE.rst">
+ <Filter>Header Files\include\spdlog\fmt\bundled</Filter>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="client\audio.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="modscriptsrson.cpp">
- <Filter>Source Files\Mods\Compiled Assets</Filter>
+ <ClCompile Include="client\chatcommand.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="serverauthentication.cpp">
- <Filter>Source Files\Server\Authentication</Filter>
+ <ClCompile Include="client\clientauthhooks.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="modkeyvalues.cpp">
- <Filter>Source Files\Mods\Compiled Assets</Filter>
+ <ClCompile Include="client\clientruihooks.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="chatcommand.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="client\clientvideooverrides.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="modlocalisation.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="client\debugoverlay.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="dedicatedmaterialsystem.cpp">
- <Filter>Source Files\Dedicated Server</Filter>
+ <ClCompile Include="client\demofixes.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="modpdef.cpp">
- <Filter>Source Files\Mods\Compiled Assets</Filter>
+ <ClCompile Include="client\diskvmtfixes.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="clientauthhooks.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="client\languagehooks.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="miscserverfixes.cpp">
- <Filter>Source Files\Server</Filter>
+ <ClCompile Include="client\latencyflex.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="bansystem.cpp">
- <Filter>Source Files\Server\Authentication</Filter>
+ <ClCompile Include="client\localchatwriter.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="languagehooks.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="client\modlocalisation.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="latencyflex.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="dedicated\dedicated.cpp">
+ <Filter>Source Files\dedicated</Filter>
</ClCompile>
- <ClCompile Include="audio.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="dedicated\dedicatedmaterialsystem.cpp">
+ <Filter>Source Files\dedicated</Filter>
</ClCompile>
- <ClCompile Include="buildainfile.cpp">
- <Filter>Source Files\Server</Filter>
+ <ClCompile Include="masterserver\masterserver.cpp">
+ <Filter>Source Files\masterserver</Filter>
</ClCompile>
- <ClCompile Include="localchatwriter.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="mods\modmanager.cpp">
+ <Filter>Source Files\mods</Filter>
</ClCompile>
- <ClCompile Include="plugins.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="mods\compiled\kb_act.cpp">
+ <Filter>Source Files\mods\compiled</Filter>
</ClCompile>
- <ClCompile Include="debugoverlay.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="mods\compiled\modkeyvalues.cpp">
+ <Filter>Source Files\mods\compiled</Filter>
</ClCompile>
- <ClCompile Include="clientvideooverrides.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="mods\compiled\modpdef.cpp">
+ <Filter>Source Files\mods\compiled</Filter>
</ClCompile>
- <ClCompile Include="version.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="mods\compiled\modscriptsrson.cpp">
+ <Filter>Source Files\mods\compiled</Filter>
</ClCompile>
- <ClCompile Include="clientruihooks.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="plugins\plugins.cpp">
+ <Filter>Source Files\plugins</Filter>
</ClCompile>
- <ClCompile Include="scriptmainmenupromos.cpp">
- <Filter>Source Files\Client\Scripted</Filter>
+ <ClCompile Include="scripts\scriptdatatables.cpp">
+ <Filter>Source Files\scripts</Filter>
</ClCompile>
- <ClCompile Include="clientchathooks.cpp">
- <Filter>Source Files\Client\Scripted</Filter>
+ <ClCompile Include="scripts\scriptjson.cpp">
+ <Filter>Source Files\scripts</Filter>
</ClCompile>
- <ClCompile Include="scriptmodmenu.cpp">
- <Filter>Source Files\Client\Scripted</Filter>
+ <ClCompile Include="scripts\scriptutility.cpp">
+ <Filter>Source Files\scripts</Filter>
</ClCompile>
- <ClCompile Include="scriptservertoclientstringcommand.cpp">
- <Filter>Source Files\Client\Scripted</Filter>
+ <ClCompile Include="server\buildainfile.cpp">
+ <Filter>Source Files\server</Filter>
</ClCompile>
- <ClCompile Include="scriptserverbrowser.cpp">
- <Filter>Source Files\Client\Scripted</Filter>
+ <ClCompile Include="server\serverpresence.cpp">
+ <Filter>Source Files\server</Filter>
</ClCompile>
- <ClCompile Include="scriptbrowserhooks.cpp">
- <Filter>Source Files\Client\Scripted</Filter>
+ <ClCompile Include="server\auth\bansystem.cpp">
+ <Filter>Source Files\server\auth</Filter>
</ClCompile>
- <ClCompile Include="serverchathooks.cpp">
- <Filter>Source Files\Server\Scripted</Filter>
+ <ClCompile Include="server\auth\serverauthentication.cpp">
+ <Filter>Source Files\server\auth</Filter>
</ClCompile>
- <ClCompile Include="miscserverscript.cpp">
- <Filter>Source Files\Server\Scripted</Filter>
+ <ClCompile Include="squirrel\squirrel.cpp">
+ <Filter>Source Files\squirrel</Filter>
</ClCompile>
- <ClCompile Include="demofixes.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="squirrel\squirrelautobind.cpp">
+ <Filter>Source Files\squirrel</Filter>
</ClCompile>
- <ClCompile Include="nsprefix.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="util\version.cpp">
+ <Filter>Source Files\util</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="crashhandler.cpp">
+ <ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="host.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="config\profile.cpp">
+ <Filter>Source Files\config</Filter>
</ClCompile>
- <ClCompile Include="hoststate.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="engine\host.cpp">
+ <Filter>Source Files\engine</Filter>
</ClCompile>
- <ClCompile Include="masterserver.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="engine\hoststate.cpp">
+ <Filter>Source Files\engine</Filter>
</ClCompile>
- <ClCompile Include="maxplayers.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="engine\runframe.cpp">
+ <Filter>Source Files\engine</Filter>
</ClCompile>
- <ClCompile Include="memalloc.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="shared\keyvalues.cpp">
+ <Filter>Source Files\shared</Filter>
</ClCompile>
- <ClCompile Include="playlist.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="shared\playlist.cpp">
+ <Filter>Source Files\shared</Filter>
</ClCompile>
- <ClCompile Include="sourceinterface.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="client\r2client.cpp">
+ <Filter>Source Files\client</Filter>
</ClCompile>
- <ClCompile Include="r2server.cpp">
- <Filter>Source Files\Game Functions</Filter>
+ <ClCompile Include="server\r2server.cpp">
+ <Filter>Source Files\server</Filter>
</ClCompile>
- <ClCompile Include="r2client.cpp">
- <Filter>Source Files\Game Functions</Filter>
+ <ClCompile Include="engine\r2engine.cpp">
+ <Filter>Source Files\engine</Filter>
</ClCompile>
- <ClCompile Include="r2engine.cpp">
- <Filter>Source Files\Game Functions</Filter>
+ <ClCompile Include="logging\crashhandler.cpp">
+ <Filter>Source Files\logging</Filter>
</ClCompile>
- <ClCompile Include="rpakfilesystem.cpp">
- <Filter>Source Files\Filesystem</Filter>
+ <ClCompile Include="logging\logging.cpp">
+ <Filter>Source Files\logging</Filter>
</ClCompile>
- <ClCompile Include="filesystem.cpp">
- <Filter>Source Files\Filesystem</Filter>
+ <ClCompile Include="logging\loghooks.cpp">
+ <Filter>Source Files\logging</Filter>
</ClCompile>
- <ClCompile Include="exploitfixes.cpp">
- <Filter>Source Files\Exploit Fixes</Filter>
+ <ClCompile Include="logging\sourceconsole.cpp">
+ <Filter>Source Files\logging</Filter>
</ClCompile>
- <ClCompile Include="limits.cpp">
- <Filter>Source Files\Exploit Fixes</Filter>
+ <ClCompile Include="scripts\client\clientchathooks.cpp">
+ <Filter>Source Files\scripts\client</Filter>
</ClCompile>
- <ClCompile Include="hooks.cpp">
- <Filter>Source Files\Hooks</Filter>
+ <ClCompile Include="scripts\client\scriptbrowserhooks.cpp">
+ <Filter>Source Files\scripts\client</Filter>
</ClCompile>
- <ClCompile Include="bits.cpp">
- <Filter>Source Files\Math</Filter>
+ <ClCompile Include="scripts\client\scriptmainmenupromos.cpp">
+ <Filter>Source Files\scripts\client</Filter>
</ClCompile>
- <ClCompile Include="convar.cpp">
- <Filter>Source Files\Convar</Filter>
+ <ClCompile Include="scripts\client\scriptmodmenu.cpp">
+ <Filter>Source Files\scripts\client</Filter>
</ClCompile>
- <ClCompile Include="concommand.cpp">
- <Filter>Source Files\Convar</Filter>
+ <ClCompile Include="scripts\client\scriptserverbrowser.cpp">
+ <Filter>Source Files\scripts\client</Filter>
</ClCompile>
- <ClCompile Include="printcommands.cpp">
- <Filter>Source Files\Console</Filter>
+ <ClCompile Include="scripts\client\scriptservertoclientstringcommand.cpp">
+ <Filter>Source Files\scripts\client</Filter>
</ClCompile>
- <ClCompile Include="printmaps.cpp">
- <Filter>Source Files\Console</Filter>
+ <ClCompile Include="scripts\server\miscserverfixes.cpp">
+ <Filter>Source Files\scripts\server</Filter>
</ClCompile>
- <ClCompile Include="cvar.cpp">
- <Filter>Source Files\Convar</Filter>
+ <ClCompile Include="scripts\server\miscserverscript.cpp">
+ <Filter>Source Files\scripts\server</Filter>
</ClCompile>
- <ClCompile Include="misccommands.cpp">
- <Filter>Source Files\Convar</Filter>
+ <ClCompile Include="scripts\server\scriptuserinfo.cpp">
+ <Filter>Source Files\scripts\server</Filter>
</ClCompile>
- <ClCompile Include="tier0.cpp">
- <Filter>Source Files\Game Functions</Filter>
+ <ClCompile Include="server\serverchathooks.cpp">
+ <Filter>Source Files\server</Filter>
</ClCompile>
- <ClCompile Include="logging.cpp">
- <Filter>Source Files\Console</Filter>
+ <ClCompile Include="core\convar\concommand.cpp">
+ <Filter>Source Files\core\convar</Filter>
</ClCompile>
- <ClCompile Include="serverpresence.cpp">
- <Filter>Source Files\Server</Filter>
+ <ClCompile Include="core\convar\convar.cpp">
+ <Filter>Source Files\core\convar</Filter>
</ClCompile>
- <ClCompile Include="runframe.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="core\convar\cvar.cpp">
+ <Filter>Source Files\core\convar</Filter>
</ClCompile>
- <ClCompile Include="memory.cpp">
- <Filter>Source Files\Hooks</Filter>
+ <ClCompile Include="core\filesystem\filesystem.cpp">
+ <Filter>Source Files\core\filesystem</Filter>
</ClCompile>
- <ClCompile Include="exploitfixes_lzss.cpp">
- <Filter>Source Files\Exploit Fixes</Filter>
+ <ClCompile Include="core\filesystem\rpakfilesystem.cpp">
+ <Filter>Source Files\core\filesystem</Filter>
</ClCompile>
- <ClCompile Include="scriptutility.cpp">
- <Filter>Source Files\Scripted</Filter>
+ <ClCompile Include="core\math\bits.cpp">
+ <Filter>Source Files\core\math</Filter>
</ClCompile>
- <ClCompile Include="scriptjson.cpp">
- <Filter>Source Files\Scripted</Filter>
+ <ClCompile Include="core\math\color.cpp">
+ <Filter>Source Files\core\math</Filter>
</ClCompile>
- <ClCompile Include="squirrel.cpp">
- <Filter>Source Files\Squirrel</Filter>
+ <ClCompile Include="core\hooks.cpp">
+ <Filter>Source Files\core</Filter>
</ClCompile>
- <ClCompile Include="scriptdatatables.cpp">
- <Filter>Source Files\Scripted</Filter>
+ <ClCompile Include="core\memalloc.cpp">
+ <Filter>Source Files\core</Filter>
</ClCompile>
- <ClCompile Include="squirrelautobind.cpp">
- <Filter>Source Files\Squirrel</Filter>
+ <ClCompile Include="core\memory.cpp">
+ <Filter>Source Files\core</Filter>
</ClCompile>
- <ClCompile Include="kb_act.cpp">
- <Filter>Source Files\Mods\Compiled Assets</Filter>
+ <ClCompile Include="core\tier0.cpp">
+ <Filter>Source Files\core</Filter>
</ClCompile>
- <ClCompile Include="diskvmtfixes.cpp">
- <Filter>Source Files\Client</Filter>
+ <ClCompile Include="shared\exploit_fixes\exploitfixes.cpp">
+ <Filter>Source Files\shared\exploit_fixes</Filter>
</ClCompile>
- <ClCompile Include="keyvalues.cpp">
- <Filter>Source Files</Filter>
+ <ClCompile Include="shared\exploit_fixes\exploitfixes_lzss.cpp">
+ <Filter>Source Files\shared\exploit_fixes</Filter>
+ </ClCompile>
+ <ClCompile Include="shared\exploit_fixes\exploitfixes_utf8parser.cpp">
+ <Filter>Source Files\shared\exploit_fixes</Filter>
</ClCompile>
- <ClCompile Include="scriptuserinfo.cpp">
- <Filter>Source Files\Server\Scripted</Filter>
+ <ClCompile Include="shared\exploit_fixes\ns_limits.cpp">
+ <Filter>Source Files\shared\exploit_fixes</Filter>
</ClCompile>
- <ClCompile Include="color.cpp">
- <Filter>Source Files\Math</Filter>
+ <ClCompile Include="shared\maxplayers.cpp">
+ <Filter>Source Files\shared</Filter>
</ClCompile>
- <ClCompile Include="loghooks.cpp">
- <Filter>Source Files\Console</Filter>
+ <ClCompile Include="shared\misccommands.cpp">
+ <Filter>Source Files\shared</Filter>
+ </ClCompile>
+ <ClCompile Include="util\printcommands.cpp">
+ <Filter>Source Files\util</Filter>
+ </ClCompile>
+ <ClCompile Include="util\printmaps.cpp">
+ <Filter>Source Files\util</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<MASM Include="audio_asm.asm">
- <Filter>Source Files\Client</Filter>
+ <Filter>Source Files</Filter>
</MASM>
</ItemGroup>
- <ItemGroup>
- <None Include="..\include\spdlog\fmt\bundled\LICENSE.rst">
- <Filter>Header Files\include\spdlog\fmt\bundled</Filter>
- </None>
- </ItemGroup>
</Project> \ No newline at end of file
diff --git a/NorthstarDLL/audio.cpp b/NorthstarDLL/client/audio.cpp
index b1592b6f..f0bc385b 100644
--- a/NorthstarDLL/audio.cpp
+++ b/NorthstarDLL/client/audio.cpp
@@ -1,7 +1,7 @@
#include "pch.h"
#include "audio.h"
-#include "dedicated.h"
-#include "convar.h"
+#include "dedicated/dedicated.h"
+#include "core/convar/convar.h"
#include "rapidjson/error/en.h"
#include <fstream>
diff --git a/NorthstarDLL/audio.h b/NorthstarDLL/client/audio.h
index 26cda205..26cda205 100644
--- a/NorthstarDLL/audio.h
+++ b/NorthstarDLL/client/audio.h
diff --git a/NorthstarDLL/chatcommand.cpp b/NorthstarDLL/client/chatcommand.cpp
index 37c438f3..76ed9784 100644
--- a/NorthstarDLL/chatcommand.cpp
+++ b/NorthstarDLL/client/chatcommand.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
-#include "convar.h"
-#include "concommand.h"
+#include "core/convar/convar.h"
+#include "core/convar/concommand.h"
#include "localchatwriter.h"
// note: isIngameChat is an int64 because the whole register the arg is stored in needs to be 0'd out to work
diff --git a/NorthstarDLL/clientauthhooks.cpp b/NorthstarDLL/client/clientauthhooks.cpp
index cd01ad91..904ecb2f 100644
--- a/NorthstarDLL/clientauthhooks.cpp
+++ b/NorthstarDLL/client/clientauthhooks.cpp
@@ -1,7 +1,7 @@
#include "pch.h"
-#include "masterserver.h"
-#include "convar.h"
-#include "r2client.h"
+#include "masterserver/masterserver.h"
+#include "core/convar/convar.h"
+#include "client/r2client.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/clientruihooks.cpp b/NorthstarDLL/client/clientruihooks.cpp
index 3cb08368..7896daa8 100644
--- a/NorthstarDLL/clientruihooks.cpp
+++ b/NorthstarDLL/client/clientruihooks.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "convar.h"
+#include "core/convar/convar.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/clientvideooverrides.cpp b/NorthstarDLL/client/clientvideooverrides.cpp
index e4d96ff5..1a5924c7 100644
--- a/NorthstarDLL/clientvideooverrides.cpp
+++ b/NorthstarDLL/client/clientvideooverrides.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "modmanager.h"
+#include "mods/modmanager.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/debugoverlay.cpp b/NorthstarDLL/client/debugoverlay.cpp
index ef456867..dd273227 100644
--- a/NorthstarDLL/debugoverlay.cpp
+++ b/NorthstarDLL/client/debugoverlay.cpp
@@ -1,7 +1,7 @@
#include "pch.h"
-#include "dedicated.h"
-#include "cvar.h"
-#include "vector.h"
+#include "dedicated/dedicated.h"
+#include "core/convar/cvar.h"
+#include "core/math/vector.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/demofixes.cpp b/NorthstarDLL/client/demofixes.cpp
index ab092484..5fb49918 100644
--- a/NorthstarDLL/demofixes.cpp
+++ b/NorthstarDLL/client/demofixes.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "convar.h"
+#include "core/convar/convar.h"
ON_DLL_LOAD_CLIENT("engine.dll", EngineDemoFixes, (CModule module))
{
diff --git a/NorthstarDLL/diskvmtfixes.cpp b/NorthstarDLL/client/diskvmtfixes.cpp
index f5f3e2cd..cd762c8a 100644
--- a/NorthstarDLL/diskvmtfixes.cpp
+++ b/NorthstarDLL/client/diskvmtfixes.cpp
@@ -1,16 +1,16 @@
-#include "pch.h"
-
-ON_DLL_LOAD_CLIENT("materialsystem_dx11.dll", DiskVMTFixes, (CModule module))
-{
- // in retail VMTs will never load if cache read is invalid due to a special case for them in KeyValues::LoadFromFile
- // this effectively makes it impossible to load them from mods because we invalidate cache for doing this
- // so uhh, stop that from happening
-
- // tbh idk why they even changed any of this what's the point it looks like it works fine who cares my god
-
- // matsystem KeyValues::LoadFromFile: patch special case on cache read failure for vmts
- module.Offset(0x1281B9).Patch("EB");
-
- // CMaterialSystem::FindMaterial: don't call function that crashes if previous patch is applied
- module.Offset(0x5F55A).NOP(5);
-}
+#include "pch.h"
+
+ON_DLL_LOAD_CLIENT("materialsystem_dx11.dll", DiskVMTFixes, (CModule module))
+{
+ // in retail VMTs will never load if cache read is invalid due to a special case for them in KeyValues::LoadFromFile
+ // this effectively makes it impossible to load them from mods because we invalidate cache for doing this
+ // so uhh, stop that from happening
+
+ // tbh idk why they even changed any of this what's the point it looks like it works fine who cares my god
+
+ // matsystem KeyValues::LoadFromFile: patch special case on cache read failure for vmts
+ module.Offset(0x1281B9).Patch("EB");
+
+ // CMaterialSystem::FindMaterial: don't call function that crashes if previous patch is applied
+ module.Offset(0x5F55A).NOP(5);
+}
diff --git a/NorthstarDLL/languagehooks.cpp b/NorthstarDLL/client/languagehooks.cpp
index d00beb68..1a46633c 100644
--- a/NorthstarDLL/languagehooks.cpp
+++ b/NorthstarDLL/client/languagehooks.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "tier0.h"
+#include "core/tier0.h"
#include <filesystem>
#include <regex>
diff --git a/NorthstarDLL/latencyflex.cpp b/NorthstarDLL/client/latencyflex.cpp
index 620e031a..a1ef72ca 100644
--- a/NorthstarDLL/latencyflex.cpp
+++ b/NorthstarDLL/client/latencyflex.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "convar.h"
+#include "core/convar/convar.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/localchatwriter.cpp b/NorthstarDLL/client/localchatwriter.cpp
index efa7eeee..efa7eeee 100644
--- a/NorthstarDLL/localchatwriter.cpp
+++ b/NorthstarDLL/client/localchatwriter.cpp
diff --git a/NorthstarDLL/localchatwriter.h b/NorthstarDLL/client/localchatwriter.h
index 0df0cac8..8bb1fb2f 100644
--- a/NorthstarDLL/localchatwriter.h
+++ b/NorthstarDLL/client/localchatwriter.h
@@ -1,6 +1,6 @@
#pragma once
#include "pch.h"
-#include "color.h"
+#include "core/math/color.h"
class vgui_BaseRichText;
diff --git a/NorthstarDLL/modlocalisation.cpp b/NorthstarDLL/client/modlocalisation.cpp
index b12f0a40..430e3a5f 100644
--- a/NorthstarDLL/modlocalisation.cpp
+++ b/NorthstarDLL/client/modlocalisation.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "modmanager.h"
+#include "mods/modmanager.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/r2client.cpp b/NorthstarDLL/client/r2client.cpp
index 2e7bd564..2e7bd564 100644
--- a/NorthstarDLL/r2client.cpp
+++ b/NorthstarDLL/client/r2client.cpp
diff --git a/NorthstarDLL/r2client.h b/NorthstarDLL/client/r2client.h
index 64ed6c61..64ed6c61 100644
--- a/NorthstarDLL/r2client.h
+++ b/NorthstarDLL/client/r2client.h
diff --git a/NorthstarDLL/nsprefix.cpp b/NorthstarDLL/config/profile.cpp
index 8057865e..7518a2b3 100644
--- a/NorthstarDLL/nsprefix.cpp
+++ b/NorthstarDLL/config/profile.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
-#include "nsprefix.h"
-#include "dedicated.h"
+#include "config/profile.h"
+#include "dedicated/dedicated.h"
#include <string>
std::string GetNorthstarPrefix()
diff --git a/NorthstarDLL/nsprefix.h b/NorthstarDLL/config/profile.h
index 9f3087fb..9f3087fb 100644
--- a/NorthstarDLL/nsprefix.h
+++ b/NorthstarDLL/config/profile.h
diff --git a/NorthstarDLL/concommand.cpp b/NorthstarDLL/core/convar/concommand.cpp
index 6d77e137..02c9e50f 100644
--- a/NorthstarDLL/concommand.cpp
+++ b/NorthstarDLL/core/convar/concommand.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
#include "concommand.h"
-#include "misccommands.h"
+#include "shared/misccommands.h"
#include <iostream>
diff --git a/NorthstarDLL/concommand.h b/NorthstarDLL/core/convar/concommand.h
index 89363bc7..89363bc7 100644
--- a/NorthstarDLL/concommand.h
+++ b/NorthstarDLL/core/convar/concommand.h
diff --git a/NorthstarDLL/convar.cpp b/NorthstarDLL/core/convar/convar.cpp
index 80f93c64..eaa988dc 100644
--- a/NorthstarDLL/convar.cpp
+++ b/NorthstarDLL/core/convar/convar.cpp
@@ -2,7 +2,7 @@
#include "bits.h"
#include "cvar.h"
#include "convar.h"
-#include "sourceinterface.h"
+#include "shared/sourceinterface.h"
#include <float.h>
@@ -315,7 +315,7 @@ void ConVar::SetValue(const char* pszValue)
{
// Not a color, do the standard thing
float flNewValue = (float)atof(pszValue);
- if (!IsFinite(flNewValue))
+ if (!isfinite(flNewValue))
{
spdlog::warn("Warning: ConVar '{}' = '{}' is infinite, clamping value.\n", GetBaseName(), pszValue);
flNewValue = FLT_MAX;
diff --git a/NorthstarDLL/convar.h b/NorthstarDLL/core/convar/convar.h
index 176d0d72..86ec64e6 100644
--- a/NorthstarDLL/convar.h
+++ b/NorthstarDLL/core/convar/convar.h
@@ -1,6 +1,6 @@
#pragma once
-#include "sourceinterface.h"
-#include "color.h"
+#include "shared/sourceinterface.h"
+#include "core/math/color.h"
#include "cvar.h"
#include "concommand.h"
diff --git a/NorthstarDLL/cvar.cpp b/NorthstarDLL/core/convar/cvar.cpp
index 787790be..787790be 100644
--- a/NorthstarDLL/cvar.cpp
+++ b/NorthstarDLL/core/convar/cvar.cpp
diff --git a/NorthstarDLL/cvar.h b/NorthstarDLL/core/convar/cvar.h
index e65e5145..e65e5145 100644
--- a/NorthstarDLL/cvar.h
+++ b/NorthstarDLL/core/convar/cvar.h
diff --git a/NorthstarDLL/filesystem.cpp b/NorthstarDLL/core/filesystem/filesystem.cpp
index 6ac6cc43..230c9161 100644
--- a/NorthstarDLL/filesystem.cpp
+++ b/NorthstarDLL/core/filesystem/filesystem.cpp
@@ -1,7 +1,7 @@
#include "pch.h"
#include "filesystem.h"
-#include "sourceinterface.h"
-#include "modmanager.h"
+#include "shared/sourceinterface.h"
+#include "mods/modmanager.h"
#include <iostream>
#include <sstream>
diff --git a/NorthstarDLL/filesystem.h b/NorthstarDLL/core/filesystem/filesystem.h
index 9a22893a..8739d342 100644
--- a/NorthstarDLL/filesystem.h
+++ b/NorthstarDLL/core/filesystem/filesystem.h
@@ -1,5 +1,5 @@
#pragma once
-#include "sourceinterface.h"
+#include "shared/sourceinterface.h"
// taken from ttf2sdk
typedef void* FileHandle_t;
diff --git a/NorthstarDLL/rpakfilesystem.cpp b/NorthstarDLL/core/filesystem/rpakfilesystem.cpp
index f6de514b..b46218e0 100644
--- a/NorthstarDLL/rpakfilesystem.cpp
+++ b/NorthstarDLL/core/filesystem/rpakfilesystem.cpp
@@ -1,8 +1,8 @@
#include "pch.h"
#include "rpakfilesystem.h"
-#include "modmanager.h"
-#include "dedicated.h"
-#include "tier0.h"
+#include "mods/modmanager.h"
+#include "dedicated/dedicated.h"
+#include "core/tier0.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/rpakfilesystem.h b/NorthstarDLL/core/filesystem/rpakfilesystem.h
index 3f608dba..3f608dba 100644
--- a/NorthstarDLL/rpakfilesystem.h
+++ b/NorthstarDLL/core/filesystem/rpakfilesystem.h
diff --git a/NorthstarDLL/hooks.cpp b/NorthstarDLL/core/hooks.cpp
index cc1c284d..79bcbb92 100644
--- a/NorthstarDLL/hooks.cpp
+++ b/NorthstarDLL/core/hooks.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "dedicated.h"
+#include "dedicated/dedicated.h"
#include <iostream>
#include <wchar.h>
diff --git a/NorthstarDLL/hooks.h b/NorthstarDLL/core/hooks.h
index f47791fb..f47791fb 100644
--- a/NorthstarDLL/hooks.h
+++ b/NorthstarDLL/core/hooks.h
diff --git a/NorthstarDLL/bitbuf.h b/NorthstarDLL/core/math/bitbuf.h
index 8e8e216f..8e8e216f 100644
--- a/NorthstarDLL/bitbuf.h
+++ b/NorthstarDLL/core/math/bitbuf.h
diff --git a/NorthstarDLL/bits.cpp b/NorthstarDLL/core/math/bits.cpp
index 014899f2..014899f2 100644
--- a/NorthstarDLL/bits.cpp
+++ b/NorthstarDLL/core/math/bits.cpp
diff --git a/NorthstarDLL/bits.h b/NorthstarDLL/core/math/bits.h
index 0532a9bd..0532a9bd 100644
--- a/NorthstarDLL/bits.h
+++ b/NorthstarDLL/core/math/bits.h
diff --git a/NorthstarDLL/color.cpp b/NorthstarDLL/core/math/color.cpp
index 05cf645f..05cf645f 100644
--- a/NorthstarDLL/color.cpp
+++ b/NorthstarDLL/core/math/color.cpp
diff --git a/NorthstarDLL/color.h b/NorthstarDLL/core/math/color.h
index 4dc9b36e..4dc9b36e 100644
--- a/NorthstarDLL/color.h
+++ b/NorthstarDLL/core/math/color.h
diff --git a/NorthstarDLL/vector.h b/NorthstarDLL/core/math/vector.h
index c06e0bba..95eae7ca 100644
--- a/NorthstarDLL/vector.h
+++ b/NorthstarDLL/core/math/vector.h
@@ -1,52 +1,52 @@
-#pragma once
-
-union Vector3
-{
- struct
- {
- float x;
- float y;
- float z;
- };
-
- float raw[3];
-
- Vector3() : x(0), y(0), z(0) {}
- Vector3(float x, float y, float z) : x(x), y(y), z(z) {}
- Vector3(float* pRawFloats) // assumes float[3] => vector
- {
- memcpy(raw, pRawFloats, sizeof(this));
- }
-
- void MakeValid()
- {
- for (auto& fl : raw)
- if (isnan(fl))
- fl = 0;
- }
-
- // todo: more operators maybe
- bool operator==(const Vector3& other)
- {
- return x == other.x && y == other.y && z == other.z;
- }
-};
-
-union QAngle
-{
- struct
- {
- float x;
- float y;
- float z;
- float w;
- };
-
- float raw[4];
-
- // todo: more operators maybe
- bool operator==(const QAngle& other)
- {
- return x == other.x && y == other.y && z == other.z && w == other.w;
- }
-};
+#pragma once
+
+union Vector3
+{
+ struct
+ {
+ float x;
+ float y;
+ float z;
+ };
+
+ float raw[3];
+
+ Vector3() : x(0), y(0), z(0) {}
+ Vector3(float x, float y, float z) : x(x), y(y), z(z) {}
+ Vector3(float* pRawFloats) // assumes float[3] => vector
+ {
+ memcpy(raw, pRawFloats, sizeof(this));
+ }
+
+ void MakeValid()
+ {
+ for (auto& fl : raw)
+ if (isnan(fl))
+ fl = 0;
+ }
+
+ // todo: more operators maybe
+ bool operator==(const Vector3& other)
+ {
+ return x == other.x && y == other.y && z == other.z;
+ }
+};
+
+union QAngle
+{
+ struct
+ {
+ float x;
+ float y;
+ float z;
+ float w;
+ };
+
+ float raw[4];
+
+ // todo: more operators maybe
+ bool operator==(const QAngle& other)
+ {
+ return x == other.x && y == other.y && z == other.z && w == other.w;
+ }
+};
diff --git a/NorthstarDLL/memalloc.cpp b/NorthstarDLL/core/memalloc.cpp
index 8c0fafc8..122ab444 100644
--- a/NorthstarDLL/memalloc.cpp
+++ b/NorthstarDLL/core/memalloc.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
-#include "memalloc.h"
-#include "tier0.h"
+#include "core/memalloc.h"
+#include "core/tier0.h"
using namespace Tier0;
diff --git a/NorthstarDLL/memalloc.h b/NorthstarDLL/core/memalloc.h
index 7df68429..7df68429 100644
--- a/NorthstarDLL/memalloc.h
+++ b/NorthstarDLL/core/memalloc.h
diff --git a/NorthstarDLL/memory.cpp b/NorthstarDLL/core/memory.cpp
index 2e994fb2..5e7c3e78 100644
--- a/NorthstarDLL/memory.cpp
+++ b/NorthstarDLL/core/memory.cpp
@@ -132,7 +132,7 @@ inline std::vector<uint8_t> HexBytesToString(const char* pHexString)
}
else
{
- assert(false, "Failed to parse invalid hex string.");
+ assert_msg(false, "Failed to parse invalid hex string.");
val = -1;
}
@@ -324,7 +324,7 @@ inline std::pair<std::vector<uint8_t>, std::string> MaskedBytesFromPattern(const
}
else
{
- assert(false, "Failed to parse invalid pattern string.");
+ assert_msg(false, "Failed to parse invalid pattern string.");
val = -1;
}
diff --git a/NorthstarDLL/memory.h b/NorthstarDLL/core/memory.h
index 38c76cb3..38c76cb3 100644
--- a/NorthstarDLL/memory.h
+++ b/NorthstarDLL/core/memory.h
diff --git a/NorthstarDLL/structs.h b/NorthstarDLL/core/structs.h
index 939fd302..ac29f711 100644
--- a/NorthstarDLL/structs.h
+++ b/NorthstarDLL/core/structs.h
@@ -45,16 +45,15 @@ OFFSET_STRUCT(Name)
#define IIF_1(t, ...) t
#define PROBE(x) x, 1
-
#define MSVC_VA_ARGS_WORKAROUND(define, args) define args
#define CHECK(...) MSVC_VA_ARGS_WORKAROUND(CHECK_N, (__VA_ARGS__, 0))
-#define CHECK_N(x, n, ...) n
-
#define DO_PROBE(offset) PROBE_PROXY(OFFSET_##offset) // concatenate prefix with offset
#define PROBE_PROXY(...) PROBE_PRIMITIVE(__VA_ARGS__) // expand arguments
#define PROBE_PRIMITIVE(x) PROBE_COMBINE_##x // merge
#define PROBE_COMBINE_(...) PROBE(~) // if merge successful, expand to probe
+#define CHECK_N(x, n, ...) n
+
#define IS_0(offset) CHECK(DO_PROBE(offset))
#define FIELD(offset, signature) IIF(IS_0(offset))(STRUCT_FIELD_NOOFFSET, STRUCT_FIELD_OFFSET)(offset, signature)
diff --git a/NorthstarDLL/tier0.cpp b/NorthstarDLL/core/tier0.cpp
index 61ad7783..61ad7783 100644
--- a/NorthstarDLL/tier0.cpp
+++ b/NorthstarDLL/core/tier0.cpp
diff --git a/NorthstarDLL/tier0.h b/NorthstarDLL/core/tier0.h
index 92a63027..92a63027 100644
--- a/NorthstarDLL/tier0.h
+++ b/NorthstarDLL/core/tier0.h
diff --git a/NorthstarDLL/dedicated.cpp b/NorthstarDLL/dedicated/dedicated.cpp
index 7ba62d24..33a3f034 100644
--- a/NorthstarDLL/dedicated.cpp
+++ b/NorthstarDLL/dedicated/dedicated.cpp
@@ -1,12 +1,12 @@
#include "pch.h"
#include "dedicated.h"
-#include "tier0.h"
+#include "core/tier0.h"
#include "playlist.h"
-#include "r2engine.h"
-#include "hoststate.h"
-#include "serverauthentication.h"
-#include "masterserver.h"
-#include "printcommand.h"
+#include "engine/r2engine.h"
+#include "engine/hoststate.h"
+#include "server/auth/serverauthentication.h"
+#include "masterserver/masterserver.h"
+#include "util/printcommands.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/dedicated.h b/NorthstarDLL/dedicated/dedicated.h
index 82806763..82806763 100644
--- a/NorthstarDLL/dedicated.h
+++ b/NorthstarDLL/dedicated/dedicated.h
diff --git a/NorthstarDLL/dedicatedmaterialsystem.cpp b/NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp
index 28ee9b76..37b74576 100644
--- a/NorthstarDLL/dedicatedmaterialsystem.cpp
+++ b/NorthstarDLL/dedicated/dedicatedmaterialsystem.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
#include "dedicated.h"
-#include "tier0.h"
+#include "core/tier0.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/dllmain.cpp b/NorthstarDLL/dllmain.cpp
index 4a9da4af..cd52940d 100644
--- a/NorthstarDLL/dllmain.cpp
+++ b/NorthstarDLL/dllmain.cpp
@@ -1,14 +1,13 @@
#include "pch.h"
-#include "main.h"
-#include "logging.h"
-#include "crashhandler.h"
-#include "memalloc.h"
-#include "nsprefix.h"
-#include "plugin_abi.h"
-#include "plugins.h"
-#include "version.h"
-#include "pch.h"
-#include "squirrel.h"
+#include "dllmain.h"
+#include "logging/logging.h"
+#include "logging/crashhandler.h"
+#include "core/memalloc.h"
+#include "config/profile.h"
+#include "plugins/plugin_abi.h"
+#include "plugins/plugins.h"
+#include "util/version.h"
+#include "squirrel/squirrel.h"
#include "rapidjson/document.h"
#include "rapidjson/stringbuffer.h"
diff --git a/NorthstarDLL/main.h b/NorthstarDLL/dllmain.h
index 412f1e25..412f1e25 100644
--- a/NorthstarDLL/main.h
+++ b/NorthstarDLL/dllmain.h
diff --git a/NorthstarDLL/host.cpp b/NorthstarDLL/engine/host.cpp
index 87b1ce4e..a55c8dfd 100644
--- a/NorthstarDLL/host.cpp
+++ b/NorthstarDLL/engine/host.cpp
@@ -1,14 +1,12 @@
#include "pch.h"
-#include "convar.h"
-#include "modmanager.h"
-#include "printcommand.h"
-#include "printmaps.h"
-#include "misccommands.h"
+#include "core/convar/convar.h"
+#include "mods/modmanager.h"
+#include "util/printcommands.h"
+#include "util/printmaps.h"
+#include "shared/misccommands.h"
#include "r2engine.h"
-#include "tier0.h"
-
+#include "core/tier0.h"
AUTOHOOK_INIT()
-
// clang-format off
AUTOHOOK(Host_Init, engine.dll + 0x155EA0,
void, __fastcall, (bool bDedicated))
@@ -16,13 +14,10 @@ void, __fastcall, (bool bDedicated))
{
spdlog::info("Host_Init()");
Host_Init(bDedicated);
-
FixupCvarFlags();
-
// need to initialise these after host_init since they do stuff to preexisting concommands/convars without being client/server specific
InitialiseCommandPrint();
InitialiseMapsPrint();
-
// client/server autoexecs on necessary platforms
// dedi needs autoexec_ns_server on boot, while non-dedi will run it on on listen server start
if (bDedicated)
@@ -30,7 +25,6 @@ void, __fastcall, (bool bDedicated))
else
R2::Cbuf_AddText(R2::Cbuf_GetCurrentPlayer(), "exec autoexec_ns_client", R2::cmd_source_t::kCommandSrcCode);
}
-
ON_DLL_LOAD("engine.dll", Host_Init, (CModule module))
{
AUTOHOOK_DISPATCH()
diff --git a/NorthstarDLL/hoststate.cpp b/NorthstarDLL/engine/hoststate.cpp
index 24e4bf63..f2318c78 100644
--- a/NorthstarDLL/hoststate.cpp
+++ b/NorthstarDLL/engine/hoststate.cpp
@@ -1,13 +1,13 @@
#include "pch.h"
-#include "hoststate.h"
-#include "masterserver.h"
-#include "serverauthentication.h"
-#include "serverpresence.h"
-#include "playlist.h"
-#include "tier0.h"
-#include "r2engine.h"
-#include "limits.h"
-#include "squirrel.h"
+#include "engine/hoststate.h"
+#include "masterserver/masterserver.h"
+#include "server/auth/serverauthentication.h"
+#include "server/serverpresence.h"
+#include "shared/playlist.h"
+#include "core/tier0.h"
+#include "engine/r2engine.h"
+#include "shared/exploit_fixes/ns_limits.h"
+#include "squirrel/squirrel.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/hoststate.h b/NorthstarDLL/engine/hoststate.h
index a77385ef..a77385ef 100644
--- a/NorthstarDLL/hoststate.h
+++ b/NorthstarDLL/engine/hoststate.h
diff --git a/NorthstarDLL/r2engine.cpp b/NorthstarDLL/engine/r2engine.cpp
index 11233a2d..11233a2d 100644
--- a/NorthstarDLL/r2engine.cpp
+++ b/NorthstarDLL/engine/r2engine.cpp
diff --git a/NorthstarDLL/r2engine.h b/NorthstarDLL/engine/r2engine.h
index 2614b4cc..68b762e1 100644
--- a/NorthstarDLL/r2engine.h
+++ b/NorthstarDLL/engine/r2engine.h
@@ -1,5 +1,5 @@
#pragma once
-#include "keyvalues.h"
+#include "shared/keyvalues.h"
// use the R2 namespace for game funcs
namespace R2
diff --git a/NorthstarDLL/runframe.cpp b/NorthstarDLL/engine/runframe.cpp
index eb401f51..d81356f2 100644
--- a/NorthstarDLL/runframe.cpp
+++ b/NorthstarDLL/engine/runframe.cpp
@@ -1,11 +1,10 @@
#include "pch.h"
-#include "r2engine.h"
-#include "r2server.h"
+#include "engine/r2engine.h"
+#include "server/r2server.h"
#include "hoststate.h"
-#include "serverpresence.h"
+#include "server/serverpresence.h"
AUTOHOOK_INIT()
-
// clang-format off
AUTOHOOK(CEngine__Frame, engine.dll + 0x1C8650,
void, __fastcall, (R2::CEngine* self))
@@ -13,7 +12,6 @@ void, __fastcall, (R2::CEngine* self))
{
CEngine__Frame(self);
}
-
ON_DLL_LOAD("engine.dll", RunFrame, (CModule module))
{
AUTOHOOK_DISPATCH()
diff --git a/NorthstarDLL/crashhandler.cpp b/NorthstarDLL/logging/crashhandler.cpp
index be09f870..d4a54169 100644
--- a/NorthstarDLL/crashhandler.cpp
+++ b/NorthstarDLL/logging/crashhandler.cpp
@@ -1,9 +1,9 @@
#include "pch.h"
#include "crashhandler.h"
-#include "dedicated.h"
-#include "nsprefix.h"
-#include "version.h"
-#include "modmanager.h"
+#include "dedicated/dedicated.h"
+#include "config/profile.h"
+#include "util/version.h"
+#include "mods/modmanager.h"
#include <minidumpapiset.h>
diff --git a/NorthstarDLL/crashhandler.h b/NorthstarDLL/logging/crashhandler.h
index 4d8a59ce..4d8a59ce 100644
--- a/NorthstarDLL/crashhandler.h
+++ b/NorthstarDLL/logging/crashhandler.h
diff --git a/NorthstarDLL/logging.cpp b/NorthstarDLL/logging/logging.cpp
index 2184bd3f..6bb57170 100644
--- a/NorthstarDLL/logging.cpp
+++ b/NorthstarDLL/logging/logging.cpp
@@ -1,9 +1,9 @@
#include "pch.h"
#include "logging.h"
-#include "convar.h"
-#include "concommand.h"
-#include "nsprefix.h"
-#include "tier0.h"
+#include "core/convar/convar.h"
+#include "core/convar/concommand.h"
+#include "config/profile.h"
+#include "core/tier0.h"
#include "spdlog/sinks/basic_file_sink.h"
#include <iomanip>
diff --git a/NorthstarDLL/logging.h b/NorthstarDLL/logging/logging.h
index 78f65e18..af20c3e8 100644
--- a/NorthstarDLL/logging.h
+++ b/NorthstarDLL/logging/logging.h
@@ -2,7 +2,7 @@
#include "pch.h"
#include "spdlog/sinks/base_sink.h"
#include "spdlog/logger.h"
-#include "color.h"
+#include "core/math/color.h"
void CreateLogFiles();
void InitialiseLogging();
diff --git a/NorthstarDLL/loghooks.cpp b/NorthstarDLL/logging/loghooks.cpp
index a352f4c1..d09f23cc 100644
--- a/NorthstarDLL/loghooks.cpp
+++ b/NorthstarDLL/logging/loghooks.cpp
@@ -1,13 +1,12 @@
#include "pch.h"
#include "logging.h"
#include "loghooks.h"
-#include "convar.h"
-#include "concommand.h"
-#include "bitbuf.h"
-#include "nsprefix.h"
-#include "tier0.h"
-#include "squirrel.h"
-
+#include "core/convar/convar.h"
+#include "core/convar/concommand.h"
+#include "core/math/bitbuf.h"
+#include "config/profile.h"
+#include "core/tier0.h"
+#include "squirrel/squirrel.h"
#include <iomanip>
#include <sstream>
diff --git a/NorthstarDLL/loghooks.h b/NorthstarDLL/logging/loghooks.h
index 6f70f09b..6f70f09b 100644
--- a/NorthstarDLL/loghooks.h
+++ b/NorthstarDLL/logging/loghooks.h
diff --git a/NorthstarDLL/sourceconsole.cpp b/NorthstarDLL/logging/sourceconsole.cpp
index 0048ac4c..62b41e1a 100644
--- a/NorthstarDLL/sourceconsole.cpp
+++ b/NorthstarDLL/logging/sourceconsole.cpp
@@ -1,9 +1,9 @@
#include "pch.h"
-#include "convar.h"
+#include "core/convar/convar.h"
#include "sourceconsole.h"
-#include "sourceinterface.h"
-#include "concommand.h"
-#include "printcommand.h"
+#include "shared/sourceinterface.h"
+#include "core/convar/concommand.h"
+#include "util/printcommands.h"
SourceInterface<CGameConsole>* g_pSourceGameConsole;
diff --git a/NorthstarDLL/sourceconsole.h b/NorthstarDLL/logging/sourceconsole.h
index b22ef2d3..00498054 100644
--- a/NorthstarDLL/sourceconsole.h
+++ b/NorthstarDLL/logging/sourceconsole.h
@@ -1,6 +1,6 @@
#pragma once
#include "pch.h"
-#include "sourceinterface.h"
+#include "shared/sourceinterface.h"
#include "spdlog/sinks/base_sink.h"
#include <map>
diff --git a/NorthstarDLL/masterserver.cpp b/NorthstarDLL/masterserver/masterserver.cpp
index 2e1c5321..5679939b 100644
--- a/NorthstarDLL/masterserver.cpp
+++ b/NorthstarDLL/masterserver/masterserver.cpp
@@ -1,13 +1,13 @@
#include "pch.h"
-#include "masterserver.h"
-#include "concommand.h"
+#include "masterserver/masterserver.h"
+#include "core/convar/concommand.h"
#include "playlist.h"
-#include "serverauthentication.h"
-#include "tier0.h"
-#include "r2engine.h"
-#include "modmanager.h"
-#include "misccommands.h"
-#include "version.h"
+#include "server/auth/serverauthentication.h"
+#include "core/tier0.h"
+#include "engine/r2engine.h"
+#include "mods/modmanager.h"
+#include "shared/misccommands.h"
+#include "util/version.h"
#include "rapidjson/document.h"
#include "rapidjson/stringbuffer.h"
diff --git a/NorthstarDLL/masterserver.h b/NorthstarDLL/masterserver/masterserver.h
index 4e649fae..bded9952 100644
--- a/NorthstarDLL/masterserver.h
+++ b/NorthstarDLL/masterserver/masterserver.h
@@ -1,7 +1,7 @@
#pragma once
-#include "convar.h"
-#include "serverpresence.h"
+#include "core/convar/convar.h"
+#include "server/serverpresence.h"
#include <winsock2.h>
#include <string>
#include <cstring>
diff --git a/NorthstarDLL/kb_act.cpp b/NorthstarDLL/mods/compiled/kb_act.cpp
index 5fe71cdb..4a011dc7 100644
--- a/NorthstarDLL/kb_act.cpp
+++ b/NorthstarDLL/mods/compiled/kb_act.cpp
@@ -1,45 +1,45 @@
-#include "pch.h"
-#include "modmanager.h"
-#include "filesystem.h"
-
-#include <fstream>
-
-const char* KB_ACT_PATH = "scripts\\kb_act.lst";
-
-// compiles the file kb_act.lst, that defines entries for keybindings in the options menu
-void ModManager::BuildKBActionsList()
-{
- spdlog::info("Building kb_act.lst");
-
- fs::create_directories(GetCompiledAssetsPath() / "scripts");
- std::ofstream soCompiledKeys(GetCompiledAssetsPath() / KB_ACT_PATH, std::ios::binary);
-
- // write vanilla file's content to compiled file
- soCompiledKeys << R2::ReadVPKOriginalFile(KB_ACT_PATH);
-
- for (Mod& mod : m_LoadedMods)
- {
- if (!mod.m_bEnabled)
- continue;
-
- // write content of each modded file to compiled file
- std::ifstream siModKeys(mod.m_ModDirectory / "kb_act.lst");
-
- if (siModKeys.good())
- soCompiledKeys << siModKeys.rdbuf() << std::endl;
-
- siModKeys.close();
- }
-
- soCompiledKeys.close();
-
- // push to overrides
- ModOverrideFile overrideFile;
- overrideFile.m_pOwningMod = nullptr;
- overrideFile.m_Path = KB_ACT_PATH;
-
- if (m_ModFiles.find(KB_ACT_PATH) == m_ModFiles.end())
- m_ModFiles.insert(std::make_pair(KB_ACT_PATH, overrideFile));
- else
- m_ModFiles[KB_ACT_PATH] = overrideFile;
-}
+#include "pch.h"
+#include "mods/modmanager.h"
+#include "core/filesystem/filesystem.h"
+
+#include <fstream>
+
+const char* KB_ACT_PATH = "scripts\\kb_act.lst";
+
+// compiles the file kb_act.lst, that defines entries for keybindings in the options menu
+void ModManager::BuildKBActionsList()
+{
+ spdlog::info("Building kb_act.lst");
+
+ fs::create_directories(GetCompiledAssetsPath() / "scripts");
+ std::ofstream soCompiledKeys(GetCompiledAssetsPath() / KB_ACT_PATH, std::ios::binary);
+
+ // write vanilla file's content to compiled file
+ soCompiledKeys << R2::ReadVPKOriginalFile(KB_ACT_PATH);
+
+ for (Mod& mod : m_LoadedMods)
+ {
+ if (!mod.m_bEnabled)
+ continue;
+
+ // write content of each modded file to compiled file
+ std::ifstream siModKeys(mod.m_ModDirectory / "kb_act.lst");
+
+ if (siModKeys.good())
+ soCompiledKeys << siModKeys.rdbuf() << std::endl;
+
+ siModKeys.close();
+ }
+
+ soCompiledKeys.close();
+
+ // push to overrides
+ ModOverrideFile overrideFile;
+ overrideFile.m_pOwningMod = nullptr;
+ overrideFile.m_Path = KB_ACT_PATH;
+
+ if (m_ModFiles.find(KB_ACT_PATH) == m_ModFiles.end())
+ m_ModFiles.insert(std::make_pair(KB_ACT_PATH, overrideFile));
+ else
+ m_ModFiles[KB_ACT_PATH] = overrideFile;
+}
diff --git a/NorthstarDLL/modkeyvalues.cpp b/NorthstarDLL/mods/compiled/modkeyvalues.cpp
index 75188329..774be0eb 100644
--- a/NorthstarDLL/modkeyvalues.cpp
+++ b/NorthstarDLL/mods/compiled/modkeyvalues.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
-#include "modmanager.h"
-#include "filesystem.h"
+#include "mods/modmanager.h"
+#include "core/filesystem/filesystem.h"
#include <fstream>
diff --git a/NorthstarDLL/modpdef.cpp b/NorthstarDLL/mods/compiled/modpdef.cpp
index d33ba8a6..219c744b 100644
--- a/NorthstarDLL/modpdef.cpp
+++ b/NorthstarDLL/mods/compiled/modpdef.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
-#include "modmanager.h"
-#include "filesystem.h"
+#include "mods/modmanager.h"
+#include "core/filesystem/filesystem.h"
#include <map>
#include <sstream>
diff --git a/NorthstarDLL/modscriptsrson.cpp b/NorthstarDLL/mods/compiled/modscriptsrson.cpp
index 3615dd80..15fcdd13 100644
--- a/NorthstarDLL/modscriptsrson.cpp
+++ b/NorthstarDLL/mods/compiled/modscriptsrson.cpp
@@ -1,7 +1,7 @@
#include "pch.h"
-#include "modmanager.h"
-#include "filesystem.h"
-#include "squirrel.h"
+#include "mods/modmanager.h"
+#include "core/filesystem/filesystem.h"
+#include "squirrel/squirrel.h"
#include <fstream>
diff --git a/NorthstarDLL/modmanager.cpp b/NorthstarDLL/mods/modmanager.cpp
index d95bcbce..2196b118 100644
--- a/NorthstarDLL/modmanager.cpp
+++ b/NorthstarDLL/mods/modmanager.cpp
@@ -1,12 +1,12 @@
#include "pch.h"
#include "modmanager.h"
-#include "convar.h"
-#include "concommand.h"
-#include "audio.h"
-#include "masterserver.h"
-#include "filesystem.h"
-#include "rpakfilesystem.h"
-#include "nsprefix.h"
+#include "core/convar/convar.h"
+#include "core/convar/concommand.h"
+#include "client/audio.h"
+#include "masterserver/masterserver.h"
+#include "core/filesystem/filesystem.h"
+#include "core/filesystem/rpakfilesystem.h"
+#include "config/profile.h"
#include "rapidjson/error/en.h"
#include "rapidjson/document.h"
@@ -598,8 +598,9 @@ void ModManager::LoadMods()
// build modinfo obj for masterserver
rapidjson_document modinfoDoc;
+ auto& alloc = modinfoDoc.GetAllocator();
modinfoDoc.SetObject();
- modinfoDoc.AddMember("Mods", rapidjson_document::GenericValue(rapidjson::kArrayType), modinfoDoc.GetAllocator());
+ modinfoDoc.AddMember("Mods", rapidjson::kArrayType, alloc);
int currentModIndex = 0;
for (Mod& mod : m_LoadedMods)
@@ -607,7 +608,7 @@ void ModManager::LoadMods()
if (!mod.m_bEnabled || (!mod.RequiredOnClient && !mod.Pdiff.size()))
continue;
- modinfoDoc["Mods"].PushBack(rapidjson_document::GenericValue(rapidjson::kObjectType), modinfoDoc.GetAllocator());
+ modinfoDoc["Mods"].PushBack(rapidjson::kObjectType, modinfoDoc.GetAllocator());
modinfoDoc["Mods"][currentModIndex].AddMember("Name", rapidjson::StringRef(&mod.Name[0]), modinfoDoc.GetAllocator());
modinfoDoc["Mods"][currentModIndex].AddMember("Version", rapidjson::StringRef(&mod.Version[0]), modinfoDoc.GetAllocator());
modinfoDoc["Mods"][currentModIndex].AddMember("RequiredOnClient", mod.RequiredOnClient, modinfoDoc.GetAllocator());
@@ -649,10 +650,7 @@ void ModManager::UnloadMods()
// main issue with doing this here is when we reload mods for connecting to a server, we write enabled mods, which isn't necessarily
// what we wanna do
if (!m_EnabledModsCfg.HasMember(mod.Name.c_str()))
- m_EnabledModsCfg.AddMember(
- rapidjson_document::StringRefType(mod.Name.c_str()),
- rapidjson_document::GenericValue(false),
- m_EnabledModsCfg.GetAllocator());
+ m_EnabledModsCfg.AddMember(rapidjson_document::StringRefType(mod.Name.c_str()), false, m_EnabledModsCfg.GetAllocator());
m_EnabledModsCfg[mod.Name.c_str()].SetBool(mod.m_bEnabled);
}
diff --git a/NorthstarDLL/modmanager.h b/NorthstarDLL/mods/modmanager.h
index 6540a3de..a77d85bd 100644
--- a/NorthstarDLL/modmanager.h
+++ b/NorthstarDLL/mods/modmanager.h
@@ -1,7 +1,7 @@
#pragma once
-#include "convar.h"
-#include "memalloc.h"
-#include "squirrel.h"
+#include "core/convar/convar.h"
+#include "core/memalloc.h"
+#include "squirrel/squirrel.h"
#include "rapidjson/document.h"
#include <string>
diff --git a/NorthstarDLL/pch.h b/NorthstarDLL/pch.h
index 824aaee8..a6a3f06d 100644
--- a/NorthstarDLL/pch.h
+++ b/NorthstarDLL/pch.h
@@ -9,7 +9,7 @@
#define RAPIDJSON_HAS_STDSTRING 1
// add headers that you want to pre-compile here
-#include "memalloc.h"
+#include "core/memalloc.h"
#include <windows.h>
#include <psapi.h>
@@ -20,13 +20,17 @@
namespace fs = std::filesystem;
-#include "structs.h"
-#include "color.h"
+// clang-format off
+#define assert_msg(exp, msg) assert((exp, msg))
+//clang-format on
+
+#include "core/structs.h"
+#include "core/math/color.h"
#include "spdlog/spdlog.h"
-#include "logging.h"
+#include "logging/logging.h"
#include "MinHook.h"
#include "libcurl/include/curl/curl.h"
-#include "hooks.h"
+#include "core/hooks.h"
#include "memory.h"
template <typename ReturnType, typename... Args> ReturnType CallVFunc(int index, void* thisPtr, Args... args)
diff --git a/NorthstarDLL/plugin_abi.h b/NorthstarDLL/plugins/plugin_abi.h
index 4b176a32..4b176a32 100644
--- a/NorthstarDLL/plugin_abi.h
+++ b/NorthstarDLL/plugins/plugin_abi.h
diff --git a/NorthstarDLL/plugins.cpp b/NorthstarDLL/plugins/plugins.cpp
index 790439d1..97ac0b9f 100644
--- a/NorthstarDLL/plugins.cpp
+++ b/NorthstarDLL/plugins/plugins.cpp
@@ -1,9 +1,9 @@
#include "pch.h"
-#include "squirrel.h"
+#include "squirrel/squirrel.h"
#include "plugins.h"
-#include "masterserver.h"
-#include "convar.h"
-#include "serverpresence.h"
+#include "masterserver/masterserver.h"
+#include "core/convar/convar.h"
+#include "server/serverpresence.h"
#include <chrono>
#include <windows.h>
diff --git a/NorthstarDLL/plugins.h b/NorthstarDLL/plugins/plugins.h
index 953801a2..953801a2 100644
--- a/NorthstarDLL/plugins.h
+++ b/NorthstarDLL/plugins/plugins.h
diff --git a/NorthstarDLL/clientchathooks.cpp b/NorthstarDLL/scripts/client/clientchathooks.cpp
index 847b5eb1..0fc68302 100644
--- a/NorthstarDLL/clientchathooks.cpp
+++ b/NorthstarDLL/scripts/client/clientchathooks.cpp
@@ -1,8 +1,8 @@
#include "pch.h"
-#include "squirrel.h"
+#include "squirrel/squirrel.h"
-#include "serverchathooks.h"
-#include "localchatwriter.h"
+#include "server/serverchathooks.h"
+#include "client/localchatwriter.h"
#include <rapidjson/document.h>
diff --git a/NorthstarDLL/scriptbrowserhooks.cpp b/NorthstarDLL/scripts/client/scriptbrowserhooks.cpp
index df4014de..df4014de 100644
--- a/NorthstarDLL/scriptbrowserhooks.cpp
+++ b/NorthstarDLL/scripts/client/scriptbrowserhooks.cpp
diff --git a/NorthstarDLL/scriptmainmenupromos.cpp b/NorthstarDLL/scripts/client/scriptmainmenupromos.cpp
index 5f7a09c1..0ea167f8 100644
--- a/NorthstarDLL/scriptmainmenupromos.cpp
+++ b/NorthstarDLL/scripts/client/scriptmainmenupromos.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
-#include "squirrel.h"
-#include "masterserver.h"
+#include "squirrel/squirrel.h"
+#include "masterserver/masterserver.h"
// mirror this in script
enum eMainMenuPromoDataProperty
@@ -121,4 +121,4 @@ ADD_SQFUNC("var", NSGetCustomMainMenuPromoData, "int promoDataKey", "", ScriptCo
}
return SQRESULT_NOTNULL;
-} \ No newline at end of file
+}
diff --git a/NorthstarDLL/scriptmodmenu.cpp b/NorthstarDLL/scripts/client/scriptmodmenu.cpp
index 1dd80261..75d05acc 100644
--- a/NorthstarDLL/scriptmodmenu.cpp
+++ b/NorthstarDLL/scripts/client/scriptmodmenu.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
-#include "modmanager.h"
-#include "squirrel.h"
+#include "mods/modmanager.h"
+#include "squirrel/squirrel.h"
ADD_SQFUNC("array<string>", NSGetModNames, "", "", ScriptContext::SERVER | ScriptContext::CLIENT | ScriptContext::UI)
{
diff --git a/NorthstarDLL/scriptserverbrowser.cpp b/NorthstarDLL/scripts/client/scriptserverbrowser.cpp
index 05f83269..5f1287ad 100644
--- a/NorthstarDLL/scriptserverbrowser.cpp
+++ b/NorthstarDLL/scripts/client/scriptserverbrowser.cpp
@@ -1,9 +1,9 @@
#include "pch.h"
-#include "squirrel.h"
-#include "masterserver.h"
-#include "serverauthentication.h"
-#include "r2engine.h"
-#include "r2client.h"
+#include "squirrel/squirrel.h"
+#include "masterserver/masterserver.h"
+#include "server/auth/serverauthentication.h"
+#include "engine/r2engine.h"
+#include "client/r2client.h"
// functions for viewing server browser
diff --git a/NorthstarDLL/scriptservertoclientstringcommand.cpp b/NorthstarDLL/scripts/client/scriptservertoclientstringcommand.cpp
index ac19c3af..f3cb2f18 100644
--- a/NorthstarDLL/scriptservertoclientstringcommand.cpp
+++ b/NorthstarDLL/scripts/client/scriptservertoclientstringcommand.cpp
@@ -1,7 +1,7 @@
#include "pch.h"
-#include "squirrel.h"
-#include "convar.h"
-#include "concommand.h"
+#include "squirrel/squirrel.h"
+#include "core/convar/convar.h"
+#include "core/convar/concommand.h"
void ConCommand_ns_script_servertoclientstringcommand(const CCommand& arg)
{
diff --git a/NorthstarDLL/scriptdatatables.cpp b/NorthstarDLL/scripts/scriptdatatables.cpp
index dfa45737..915d4df0 100644
--- a/NorthstarDLL/scriptdatatables.cpp
+++ b/NorthstarDLL/scripts/scriptdatatables.cpp
@@ -1,12 +1,12 @@
#include "pch.h"
-#include "squirrel.h"
-#include "rpakfilesystem.h"
-#include "convar.h"
-#include "dedicated.h"
-#include "filesystem.h"
-#include "vector.h"
-#include "tier0.h"
-#include "r2engine.h"
+#include "squirrel/squirrel.h"
+#include "core/filesystem/rpakfilesystem.h"
+#include "core/convar/convar.h"
+#include "dedicated/dedicated.h"
+#include "core/filesystem/filesystem.h"
+#include "core/math/vector.h"
+#include "core/tier0.h"
+#include "engine/r2engine.h"
#include <iostream>
#include <sstream>
#include <map>
diff --git a/NorthstarDLL/scriptjson.cpp b/NorthstarDLL/scripts/scriptjson.cpp
index 049a7b20..f41b0457 100644
--- a/NorthstarDLL/scriptjson.cpp
+++ b/NorthstarDLL/scripts/scriptjson.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "squirrel.h"
+#include "squirrel/squirrel.h"
#include "rapidjson/error/en.h"
#include "rapidjson/document.h"
@@ -117,32 +117,19 @@ template <ScriptContext context> void EncodeJSONTable(
rapidjson::StringRef(node->key._VAL.asString->_val), rapidjson::StringRef(node->val._VAL.asString->_val), allocator);
break;
case OT_INTEGER:
- obj->AddMember(
- rapidjson::StringRef(node->key._VAL.asString->_val),
- rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>(
- (int)node->val._VAL.asInteger),
- allocator);
+ obj->AddMember(rapidjson::StringRef(node->key._VAL.asString->_val), node->val._VAL.asInteger, allocator);
break;
case OT_FLOAT:
- obj->AddMember(
- rapidjson::StringRef(node->key._VAL.asString->_val),
- rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>(node->val._VAL.asFloat),
- allocator);
+ obj->AddMember(rapidjson::StringRef(node->key._VAL.asString->_val), node->val._VAL.asFloat, allocator);
break;
case OT_BOOL:
if (node->val._VAL.asInteger)
{
- obj->AddMember(
- rapidjson::StringRef(node->key._VAL.asString->_val),
- rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>(true),
- allocator);
+ obj->AddMember(rapidjson::StringRef(node->key._VAL.asString->_val), true, allocator);
}
else
{
- obj->AddMember(
- rapidjson::StringRef(node->key._VAL.asString->_val),
- rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>(false),
- allocator);
+ obj->AddMember(rapidjson::StringRef(node->key._VAL.asString->_val), false, allocator);
}
break;
case OT_TABLE:
@@ -179,14 +166,10 @@ template <ScriptContext context> void EncodeJSONArray(
obj->PushBack(rapidjson::StringRef(node->_VAL.asString->_val), allocator);
break;
case OT_INTEGER:
- obj->PushBack(
- rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>((int)node->_VAL.asInteger),
- allocator);
+ obj->PushBack(node->_VAL.asInteger, allocator);
break;
case OT_FLOAT:
- obj->PushBack(
- rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<SourceAllocator>>(node->_VAL.asFloat),
- allocator);
+ obj->PushBack(node->_VAL.asFloat, allocator);
break;
case OT_BOOL:
if (node->_VAL.asInteger)
diff --git a/NorthstarDLL/scriptutility.cpp b/NorthstarDLL/scripts/scriptutility.cpp
index 1ff8e4bb..8dae49cf 100644
--- a/NorthstarDLL/scriptutility.cpp
+++ b/NorthstarDLL/scripts/scriptutility.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "squirrel.h"
+#include "squirrel/squirrel.h"
// asset function StringToAsset( string assetName )
ADD_SQFUNC(
diff --git a/NorthstarDLL/miscserverfixes.cpp b/NorthstarDLL/scripts/server/miscserverfixes.cpp
index 4feca505..4feca505 100644
--- a/NorthstarDLL/miscserverfixes.cpp
+++ b/NorthstarDLL/scripts/server/miscserverfixes.cpp
diff --git a/NorthstarDLL/miscserverscript.cpp b/NorthstarDLL/scripts/server/miscserverscript.cpp
index a8e7264b..0d865388 100644
--- a/NorthstarDLL/miscserverscript.cpp
+++ b/NorthstarDLL/scripts/server/miscserverscript.cpp
@@ -1,10 +1,10 @@
#include "pch.h"
-#include "squirrel.h"
-#include "masterserver.h"
-#include "serverauthentication.h"
-#include "dedicated.h"
-#include "r2client.h"
-#include "r2server.h"
+#include "squirrel/squirrel.h"
+#include "masterserver/masterserver.h"
+#include "server/auth/serverauthentication.h"
+#include "dedicated/dedicated.h"
+#include "client/r2client.h"
+#include "server/r2server.h"
#include <filesystem>
diff --git a/NorthstarDLL/scriptuserinfo.cpp b/NorthstarDLL/scripts/server/scriptuserinfo.cpp
index 415ae3ea..68baac0e 100644
--- a/NorthstarDLL/scriptuserinfo.cpp
+++ b/NorthstarDLL/scripts/server/scriptuserinfo.cpp
@@ -1,105 +1,105 @@
-#include "pch.h"
-#include "squirrel.h"
-#include "r2engine.h"
-#include "r2server.h"
-
-// clang-format off
-ADD_SQFUNC("string", GetUserInfoKVString_Internal, "entity player, string key, string defaultValue = \"\"",
- "Gets the string value of a given player's userinfo convar by name", ScriptContext::SERVER)
-// clang-format on
-{
- const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
- if (!pPlayer)
- {
- g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
- return SQRESULT_ERROR;
- }
-
- const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
- const char* pDefaultValue = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 3);
-
- const char* pResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetString(pKey, pDefaultValue);
- g_pSquirrel<ScriptContext::SERVER>->pushstring(sqvm, pResult);
- return SQRESULT_NOTNULL;
-}
-
-// clang-format off
-ADD_SQFUNC("asset", GetUserInfoKVAsset_Internal, "entity player, string key, asset defaultValue = $\"\"",
- "Gets the asset value of a given player's userinfo convar by name", ScriptContext::SERVER)
-// clang-format on
-{
- const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
- if (!pPlayer)
- {
- g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
- return SQRESULT_ERROR;
- }
-
- const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
- const char* pDefaultValue;
- g_pSquirrel<ScriptContext::SERVER>->getasset(sqvm, 3, &pDefaultValue);
-
- const char* pResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetString(pKey, pDefaultValue);
- g_pSquirrel<ScriptContext::SERVER>->pushasset(sqvm, pResult);
- return SQRESULT_NOTNULL;
-}
-
-// clang-format off
-ADD_SQFUNC("int", GetUserInfoKVInt_Internal, "entity player, string key, int defaultValue = 0",
- "Gets the int value of a given player's userinfo convar by name", ScriptContext::SERVER)
-// clang-format on
-{
- const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
- if (!pPlayer)
- {
- g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
- return SQRESULT_ERROR;
- }
-
- const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
- const int iDefaultValue = g_pSquirrel<ScriptContext::SERVER>->getinteger(sqvm, 3);
-
- const int iResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetInt(pKey, iDefaultValue);
- g_pSquirrel<ScriptContext::SERVER>->pushinteger(sqvm, iResult);
- return SQRESULT_NOTNULL;
-}
-
-// clang-format off
-ADD_SQFUNC("float", GetUserInfoKVFloat_Internal, "entity player, string key, float defaultValue = 0",
- "Gets the float value of a given player's userinfo convar by name", ScriptContext::SERVER)
-// clang-format on
-{
- const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
- if (!pPlayer)
- {
- g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
- return SQRESULT_ERROR;
- }
-
- const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
- const float flDefaultValue = g_pSquirrel<ScriptContext::SERVER>->getfloat(sqvm, 3);
-
- const float flResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetFloat(pKey, flDefaultValue);
- g_pSquirrel<ScriptContext::SERVER>->pushfloat(sqvm, flResult);
- return SQRESULT_NOTNULL;
-}
-
-// clang-format off
-ADD_SQFUNC("bool", GetUserInfoKVBool_Internal, "entity player, string key, bool defaultValue = false",
- "Gets the bool value of a given player's userinfo convar by name", ScriptContext::SERVER)
-// clang-format on
-{
- const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
- if (!pPlayer)
- {
- g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
- return SQRESULT_ERROR;
- }
-
- const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
- const bool bDefaultValue = g_pSquirrel<ScriptContext::SERVER>->getbool(sqvm, 3);
-
- const bool bResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetInt(pKey, bDefaultValue);
- g_pSquirrel<ScriptContext::SERVER>->pushbool(sqvm, bResult);
- return SQRESULT_NOTNULL;
-}
+#include "pch.h"
+#include "squirrel/squirrel.h"
+#include "engine/r2engine.h"
+#include "server/r2server.h"
+
+// clang-format off
+ADD_SQFUNC("string", GetUserInfoKVString_Internal, "entity player, string key, string defaultValue = \"\"",
+ "Gets the string value of a given player's userinfo convar by name", ScriptContext::SERVER)
+// clang-format on
+{
+ const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
+ if (!pPlayer)
+ {
+ g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
+ return SQRESULT_ERROR;
+ }
+
+ const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
+ const char* pDefaultValue = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 3);
+
+ const char* pResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetString(pKey, pDefaultValue);
+ g_pSquirrel<ScriptContext::SERVER>->pushstring(sqvm, pResult);
+ return SQRESULT_NOTNULL;
+}
+
+// clang-format off
+ADD_SQFUNC("asset", GetUserInfoKVAsset_Internal, "entity player, string key, asset defaultValue = $\"\"",
+ "Gets the asset value of a given player's userinfo convar by name", ScriptContext::SERVER)
+// clang-format on
+{
+ const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
+ if (!pPlayer)
+ {
+ g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
+ return SQRESULT_ERROR;
+ }
+
+ const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
+ const char* pDefaultValue;
+ g_pSquirrel<ScriptContext::SERVER>->getasset(sqvm, 3, &pDefaultValue);
+
+ const char* pResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetString(pKey, pDefaultValue);
+ g_pSquirrel<ScriptContext::SERVER>->pushasset(sqvm, pResult);
+ return SQRESULT_NOTNULL;
+}
+
+// clang-format off
+ADD_SQFUNC("int", GetUserInfoKVInt_Internal, "entity player, string key, int defaultValue = 0",
+ "Gets the int value of a given player's userinfo convar by name", ScriptContext::SERVER)
+// clang-format on
+{
+ const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
+ if (!pPlayer)
+ {
+ g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
+ return SQRESULT_ERROR;
+ }
+
+ const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
+ const int iDefaultValue = g_pSquirrel<ScriptContext::SERVER>->getinteger(sqvm, 3);
+
+ const int iResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetInt(pKey, iDefaultValue);
+ g_pSquirrel<ScriptContext::SERVER>->pushinteger(sqvm, iResult);
+ return SQRESULT_NOTNULL;
+}
+
+// clang-format off
+ADD_SQFUNC("float", GetUserInfoKVFloat_Internal, "entity player, string key, float defaultValue = 0",
+ "Gets the float value of a given player's userinfo convar by name", ScriptContext::SERVER)
+// clang-format on
+{
+ const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
+ if (!pPlayer)
+ {
+ g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
+ return SQRESULT_ERROR;
+ }
+
+ const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
+ const float flDefaultValue = g_pSquirrel<ScriptContext::SERVER>->getfloat(sqvm, 3);
+
+ const float flResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetFloat(pKey, flDefaultValue);
+ g_pSquirrel<ScriptContext::SERVER>->pushfloat(sqvm, flResult);
+ return SQRESULT_NOTNULL;
+}
+
+// clang-format off
+ADD_SQFUNC("bool", GetUserInfoKVBool_Internal, "entity player, string key, bool defaultValue = false",
+ "Gets the bool value of a given player's userinfo convar by name", ScriptContext::SERVER)
+// clang-format on
+{
+ const R2::CBasePlayer* pPlayer = g_pSquirrel<ScriptContext::SERVER>->getentity<R2::CBasePlayer>(sqvm, 1);
+ if (!pPlayer)
+ {
+ g_pSquirrel<ScriptContext::SERVER>->raiseerror(sqvm, "player is null");
+ return SQRESULT_ERROR;
+ }
+
+ const char* pKey = g_pSquirrel<ScriptContext::SERVER>->getstring(sqvm, 2);
+ const bool bDefaultValue = g_pSquirrel<ScriptContext::SERVER>->getbool(sqvm, 3);
+
+ const bool bResult = R2::g_pClientArray[pPlayer->m_nPlayerIndex - 1].m_ConVars->GetInt(pKey, bDefaultValue);
+ g_pSquirrel<ScriptContext::SERVER>->pushbool(sqvm, bResult);
+ return SQRESULT_NOTNULL;
+}
diff --git a/NorthstarDLL/bansystem.cpp b/NorthstarDLL/server/auth/bansystem.cpp
index 25c0e6bf..56719ed9 100644
--- a/NorthstarDLL/bansystem.cpp
+++ b/NorthstarDLL/server/auth/bansystem.cpp
@@ -2,11 +2,11 @@
#include "pch.h"
#include "bansystem.h"
#include "serverauthentication.h"
-#include "maxplayers.h"
-#include "concommand.h"
-#include "r2server.h"
-#include "r2engine.h"
-#include "nsprefix.h"
+#include "shared/maxplayers.h"
+#include "core/convar/concommand.h"
+#include "server/r2server.h"
+#include "engine/r2engine.h"
+#include "config/profile.h"
#include <filesystem>
diff --git a/NorthstarDLL/bansystem.h b/NorthstarDLL/server/auth/bansystem.h
index 6f180126..6f180126 100644
--- a/NorthstarDLL/bansystem.h
+++ b/NorthstarDLL/server/auth/bansystem.h
diff --git a/NorthstarDLL/serverauthentication.cpp b/NorthstarDLL/server/auth/serverauthentication.cpp
index 350d8521..ac1d5f17 100644
--- a/NorthstarDLL/serverauthentication.cpp
+++ b/NorthstarDLL/server/auth/serverauthentication.cpp
@@ -1,20 +1,20 @@
#include "pch.h"
#include "serverauthentication.h"
-#include "limits.h"
-#include "cvar.h"
-#include "convar.h"
-#include "masterserver.h"
-#include "serverpresence.h"
-#include "hoststate.h"
-#include "maxplayers.h"
+#include "shared/exploit_fixes/ns_limits.h"
+#include "core/convar/cvar.h"
+#include "core/convar/convar.h"
+#include "masterserver/masterserver.h"
+#include "server/serverpresence.h"
+#include "engine/hoststate.h"
+#include "shared/maxplayers.h"
#include "bansystem.h"
-#include "concommand.h"
-#include "dedicated.h"
-#include "nsprefix.h"
-#include "tier0.h"
-#include "r2engine.h"
-#include "r2client.h"
-#include "r2server.h"
+#include "core/convar/concommand.h"
+#include "dedicated/dedicated.h"
+#include "config/profile.h"
+#include "core/tier0.h"
+#include "engine/r2engine.h"
+#include "client/r2client.h"
+#include "server/r2server.h"
#include "httplib.h"
diff --git a/NorthstarDLL/serverauthentication.h b/NorthstarDLL/server/auth/serverauthentication.h
index 65050d56..4ffbbfd6 100644
--- a/NorthstarDLL/serverauthentication.h
+++ b/NorthstarDLL/server/auth/serverauthentication.h
@@ -1,7 +1,7 @@
#pragma once
-#include "convar.h"
+#include "core/convar/convar.h"
#include "httplib.h"
-#include "r2engine.h"
+#include "engine/r2engine.h"
#include <unordered_map>
#include <string>
diff --git a/NorthstarDLL/buildainfile.cpp b/NorthstarDLL/server/buildainfile.cpp
index 8190adba..f6dc4717 100644
--- a/NorthstarDLL/buildainfile.cpp
+++ b/NorthstarDLL/server/buildainfile.cpp
@@ -1,7 +1,7 @@
#include "pch.h"
-#include "convar.h"
-#include "hoststate.h"
-#include "r2engine.h"
+#include "core/convar/convar.h"
+#include "engine/hoststate.h"
+#include "engine/r2engine.h"
#include <fstream>
#include <filesystem>
diff --git a/NorthstarDLL/r2server.cpp b/NorthstarDLL/server/r2server.cpp
index 50cfa239..50cfa239 100644
--- a/NorthstarDLL/r2server.cpp
+++ b/NorthstarDLL/server/r2server.cpp
diff --git a/NorthstarDLL/r2server.h b/NorthstarDLL/server/r2server.h
index aadfdefe..313284be 100644
--- a/NorthstarDLL/r2server.h
+++ b/NorthstarDLL/server/r2server.h
@@ -1,6 +1,6 @@
#pragma once
-#include "vector.h"
+#include "core/math/vector.h"
// use the R2 namespace for game funcs
namespace R2
diff --git a/NorthstarDLL/serverchathooks.cpp b/NorthstarDLL/server/serverchathooks.cpp
index e4e67e05..57c2c31a 100644
--- a/NorthstarDLL/serverchathooks.cpp
+++ b/NorthstarDLL/server/serverchathooks.cpp
@@ -1,8 +1,8 @@
#include "pch.h"
#include "serverchathooks.h"
-#include "limits.h"
-#include "squirrel.h"
-#include "r2server.h"
+#include "shared/exploit_fixes/ns_limits.h"
+#include "squirrel/squirrel.h"
+#include "server/r2server.h"
#include <rapidjson/document.h>
#include <rapidjson/stringbuffer.h>
diff --git a/NorthstarDLL/serverchathooks.h b/NorthstarDLL/server/serverchathooks.h
index 1d8a806a..1d8a806a 100644
--- a/NorthstarDLL/serverchathooks.h
+++ b/NorthstarDLL/server/serverchathooks.h
diff --git a/NorthstarDLL/serverpresence.cpp b/NorthstarDLL/server/serverpresence.cpp
index fb8cf624..bda5e7fe 100644
--- a/NorthstarDLL/serverpresence.cpp
+++ b/NorthstarDLL/server/serverpresence.cpp
@@ -1,8 +1,8 @@
#include "pch.h"
#include "serverpresence.h"
-#include "playlist.h"
-#include "tier0.h"
-#include "convar.h"
+#include "shared/playlist.h"
+#include "core/tier0.h"
+#include "core/convar/convar.h"
#include <regex>
diff --git a/NorthstarDLL/serverpresence.h b/NorthstarDLL/server/serverpresence.h
index 97b4654c..125b2e68 100644
--- a/NorthstarDLL/serverpresence.h
+++ b/NorthstarDLL/server/serverpresence.h
@@ -1,5 +1,5 @@
#pragma once
-#include "convar.h"
+#include "core/convar/convar.h"
struct ServerPresence
{
diff --git a/NorthstarDLL/exploitfixes.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp
index 240c352c..e4430fd4 100644
--- a/NorthstarDLL/exploitfixes.cpp
+++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes.cpp
@@ -1,11 +1,11 @@
#include "pch.h"
-#include "cvar.h"
-#include "limits.h"
-#include "dedicated.h"
-#include "tier0.h"
-#include "r2engine.h"
-#include "r2client.h"
-#include "vector.h"
+#include "core/convar/cvar.h"
+#include "ns_limits.h"
+#include "dedicated/dedicated.h"
+#include "core/tier0.h"
+#include "engine/r2engine.h"
+#include "client/r2client.h"
+#include "core/math/vector.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/exploitfixes_lzss.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes_lzss.cpp
index 4205133a..4205133a 100644
--- a/NorthstarDLL/exploitfixes_lzss.cpp
+++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes_lzss.cpp
diff --git a/NorthstarDLL/exploitfixes_utf8parser.cpp b/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp
index e2510765..e2510765 100644
--- a/NorthstarDLL/exploitfixes_utf8parser.cpp
+++ b/NorthstarDLL/shared/exploit_fixes/exploitfixes_utf8parser.cpp
diff --git a/NorthstarDLL/limits.cpp b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp
index c254de52..49f80bab 100644
--- a/NorthstarDLL/limits.cpp
+++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp
@@ -1,13 +1,13 @@
#include "pch.h"
-#include "limits.h"
-#include "hoststate.h"
-#include "r2client.h"
-#include "r2engine.h"
-#include "r2server.h"
-#include "maxplayers.h"
-#include "tier0.h"
-#include "vector.h"
-#include "serverauthentication.h"
+#include "ns_limits.h"
+#include "engine/hoststate.h"
+#include "client/r2client.h"
+#include "engine/r2engine.h"
+#include "server/r2server.h"
+#include "shared/maxplayers.h"
+#include "core/tier0.h"
+#include "core/math/vector.h"
+#include "server/auth/serverauthentication.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/limits.h b/NorthstarDLL/shared/exploit_fixes/ns_limits.h
index 068f91c9..bbc0a85f 100644
--- a/NorthstarDLL/limits.h
+++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.h
@@ -1,6 +1,6 @@
#pragma once
-#include "r2engine.h"
-#include "convar.h"
+#include "engine/r2engine.h"
+#include "core/convar/convar.h"
#include <unordered_map>
struct PlayerLimitData
diff --git a/NorthstarDLL/keyvalues.cpp b/NorthstarDLL/shared/keyvalues.cpp
index afb7ae30..fe7d6299 100644
--- a/NorthstarDLL/keyvalues.cpp
+++ b/NorthstarDLL/shared/keyvalues.cpp
@@ -1,1316 +1,1316 @@
-#include "pch.h"
-#include "keyvalues.h"
-#include <winnt.h>
-
-// implementation of the ConVar class
-// heavily based on https://github.com/Mauler125/r5sdk/blob/master/r5dev/vpc/keyvalues.cpp
-
-typedef int HKeySymbol;
-#define INVALID_KEY_SYMBOL (-1)
-
-#define MAKE_3_BYTES_FROM_1_AND_2(x1, x2) ((((uint16_t)x2) << 8) | (uint8_t)(x1))
-#define SPLIT_3_BYTES_INTO_1_AND_2(x1, x2, x3) \
- do \
- { \
- x1 = (uint8_t)(x3); \
- x2 = (uint16_t)((x3) >> 8); \
- } while (0)
-
-struct CKeyValuesSystem
-{
- public:
- struct __VTable
- {
- char pad0[8 * 3]; // 2 methods
- HKeySymbol (*GetSymbolForString)(CKeyValuesSystem* self, const char* name, bool bCreate);
- const char* (*GetStringForSymbol)(CKeyValuesSystem* self, HKeySymbol symbol);
- char pad1[8 * 5];
- HKeySymbol (*GetSymbolForStringCaseSensitive)(
- CKeyValuesSystem* self, HKeySymbol& hCaseInsensitiveSymbol, const char* name, bool bCreate);
- };
-
- const __VTable* m_pVtable;
-};
-
-int (*V_UTF8ToUnicode)(const char* pUTF8, wchar_t* pwchDest, int cubDestSizeInBytes);
-int (*V_UnicodeToUTF8)(const wchar_t* pUnicode, char* pUTF8, int cubDestSizeInBytes);
-CKeyValuesSystem* (*KeyValuesSystem)();
-
-KeyValues::KeyValues() {} // default constructor for copying and such
-
-//-----------------------------------------------------------------------------
-// Purpose: Constructor
-// Input : *pszSetName -
-//-----------------------------------------------------------------------------
-KeyValues::KeyValues(const char* pszSetName)
-{
- Init();
- SetName(pszSetName);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Constructor
-// Input : *pszSetName -
-// *pszFirstKey -
-// *pszFirstValue -
-//-----------------------------------------------------------------------------
-KeyValues::KeyValues(const char* pszSsetName, const char* pszFirstKey, const char* pszFirstValue)
-{
- Init();
- SetName(pszSsetName);
- SetString(pszFirstKey, pszFirstValue);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Constructor
-// Input : *pszSetName -
-// *pszFirstKey -
-// *pwszFirstValue -
-//-----------------------------------------------------------------------------
-KeyValues::KeyValues(const char* pszSetName, const char* pszFirstKey, const wchar_t* pwszFirstValue)
-{
- Init();
- SetName(pszSetName);
- SetWString(pszFirstKey, pwszFirstValue);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Constructor
-// Input : *pszSetName -
-// *pszFirstKey -
-// iFirstValue -
-//-----------------------------------------------------------------------------
-KeyValues::KeyValues(const char* pszSetName, const char* pszFirstKey, int iFirstValue)
-{
- Init();
- SetName(pszSetName);
- SetInt(pszFirstKey, iFirstValue);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Constructor
-// Input : *pszSetName -
-// *pszFirstKey -
-// *pszFirstValue -
-// *pszSecondKey -
-// *pszSecondValue -
-//-----------------------------------------------------------------------------
-KeyValues::KeyValues(
- const char* pszSetName, const char* pszFirstKey, const char* pszFirstValue, const char* pszSecondKey, const char* pszSecondValue)
-{
- Init();
- SetName(pszSetName);
- SetString(pszFirstKey, pszFirstValue);
- SetString(pszSecondKey, pszSecondValue);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Constructor
-// Input : *pszSetName -
-// *pszFirstKey -
-// iFirstValue -
-// *pszSecondKey -
-// iSecondValue -
-//-----------------------------------------------------------------------------
-KeyValues::KeyValues(const char* pszSetName, const char* pszFirstKey, int iFirstValue, const char* pszSecondKey, int iSecondValue)
-{
- Init();
- SetName(pszSetName);
- SetInt(pszFirstKey, iFirstValue);
- SetInt(pszSecondKey, iSecondValue);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Destructor
-//-----------------------------------------------------------------------------
-KeyValues::~KeyValues(void)
-{
- RemoveEverything();
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Initialize member variables
-//-----------------------------------------------------------------------------
-void KeyValues::Init(void)
-{
- m_iKeyName = 0;
- m_iKeyNameCaseSensitive1 = 0;
- m_iKeyNameCaseSensitive2 = 0;
- m_iDataType = TYPE_NONE;
-
- m_pSub = nullptr;
- m_pPeer = nullptr;
- m_pChain = nullptr;
-
- m_sValue = nullptr;
- m_wsValue = nullptr;
- m_pValue = nullptr;
-
- m_bHasEscapeSequences = 0;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Clear out all subkeys, and the current value
-//-----------------------------------------------------------------------------
-void KeyValues::Clear(void)
-{
- delete m_pSub;
- m_pSub = nullptr;
- m_iDataType = TYPE_NONE;
-}
-
-//-----------------------------------------------------------------------------
-// for backwards compat - we used to need this to force the free to run from the same DLL
-// as the alloc
-//-----------------------------------------------------------------------------
-void KeyValues::DeleteThis(void)
-{
- delete this;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: remove everything
-//-----------------------------------------------------------------------------
-void KeyValues::RemoveEverything(void)
-{
- KeyValues* dat;
- KeyValues* datNext = nullptr;
- for (dat = m_pSub; dat != nullptr; dat = datNext)
- {
- datNext = dat->m_pPeer;
- dat->m_pPeer = nullptr;
- delete dat;
- }
-
- for (dat = m_pPeer; dat && dat != this; dat = datNext)
- {
- datNext = dat->m_pPeer;
- dat->m_pPeer = nullptr;
- delete dat;
- }
-
- delete[] m_sValue;
- m_sValue = nullptr;
- delete[] m_wsValue;
- m_wsValue = nullptr;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Find a keyValue, create it if it is not found.
-// Set bCreate to true to create the key if it doesn't already exist
-// (which ensures a valid pointer will be returned)
-// Input : *pszKeyName -
-// bCreate -
-// Output : *KeyValues
-//-----------------------------------------------------------------------------
-KeyValues* KeyValues::FindKey(const char* pszKeyName, bool bCreate)
-{
- assert(this, "Member function called on NULL KeyValues");
-
- if (!pszKeyName || !*pszKeyName)
- return this;
-
- const char* pSubStr = strchr(pszKeyName, '/');
-
- HKeySymbol iSearchStr = KeyValuesSystem()->m_pVtable->GetSymbolForString(KeyValuesSystem(), pszKeyName, bCreate);
- if (iSearchStr == INVALID_KEY_SYMBOL)
- {
- // not found, couldn't possibly be in key value list
- return nullptr;
- }
-
- KeyValues* pLastKVs = nullptr;
- KeyValues* pCurrentKVs;
- // find the searchStr in the current peer list
- for (pCurrentKVs = m_pSub; pCurrentKVs != NULL; pCurrentKVs = pCurrentKVs->m_pPeer)
- {
- pLastKVs = pCurrentKVs; // record the last item looked at (for if we need to append to the end of the list)
-
- // symbol compare
- if (pLastKVs->m_iKeyName == (uint32_t)iSearchStr)
- break;
- }
-
- if (!pCurrentKVs && m_pChain)
- pCurrentKVs = m_pChain->FindKey(pszKeyName, false);
-
- // make sure a key was found
- if (!pCurrentKVs)
- {
- if (bCreate)
- {
- // we need to create a new key
- pCurrentKVs = new KeyValues(pszKeyName);
- // Assert(dat != NULL);
-
- // insert new key at end of list
- if (pLastKVs)
- pLastKVs->m_pPeer = pCurrentKVs;
- else
- m_pSub = pCurrentKVs;
-
- pCurrentKVs->m_pPeer = NULL;
-
- // a key graduates to be a submsg as soon as it's m_pSub is set
- // this should be the only place m_pSub is set
- m_iDataType = TYPE_NONE;
- }
- else
- {
- return NULL;
- }
- }
-
- // if we've still got a subStr we need to keep looking deeper in the tree
- if (pSubStr)
- {
- // recursively chain down through the paths in the string
- return pCurrentKVs->FindKey(pSubStr + 1, bCreate);
- }
-
- return pCurrentKVs;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Locate last child. Returns NULL if we have no children
-// Output : *KeyValues
-//-----------------------------------------------------------------------------
-KeyValues* KeyValues::FindLastSubKey(void) const
-{
- // No children?
- if (m_pSub == nullptr)
- return nullptr;
-
- // Scan for the last one
- KeyValues* pLastChild = m_pSub;
- while (pLastChild->m_pPeer)
- pLastChild = pLastChild->m_pPeer;
- return pLastChild;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Adds a subkey. Make sure the subkey isn't a child of some other keyvalues
-// Input : *pSubKey -
-//-----------------------------------------------------------------------------
-void KeyValues::AddSubKey(KeyValues* pSubkey)
-{
- // Make sure the subkey isn't a child of some other keyvalues
- assert(pSubkey != nullptr);
- assert(pSubkey->m_pPeer == nullptr);
-
- // add into subkey list
- if (m_pSub == nullptr)
- {
- m_pSub = pSubkey;
- }
- else
- {
- KeyValues* pTempDat = m_pSub;
- while (pTempDat->GetNextKey() != nullptr)
- {
- pTempDat = pTempDat->GetNextKey();
- }
-
- pTempDat->SetNextKey(pSubkey);
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Remove a subkey from the list
-// Input : *pSubKey -
-//-----------------------------------------------------------------------------
-void KeyValues::RemoveSubKey(KeyValues* pSubKey)
-{
- if (!pSubKey)
- return;
-
- // check the list pointer
- if (m_pSub == pSubKey)
- {
- m_pSub = pSubKey->m_pPeer;
- }
- else
- {
- // look through the list
- KeyValues* kv = m_pSub;
- while (kv->m_pPeer)
- {
- if (kv->m_pPeer == pSubKey)
- {
- kv->m_pPeer = pSubKey->m_pPeer;
- break;
- }
-
- kv = kv->m_pPeer;
- }
- }
-
- pSubKey->m_pPeer = nullptr;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Insert a subkey at index
-// Input : nIndex -
-// *pSubKey -
-//-----------------------------------------------------------------------------
-void KeyValues::InsertSubKey(int nIndex, KeyValues* pSubKey)
-{
- // Sub key must be valid and not part of another chain
- assert(pSubKey && pSubKey->m_pPeer == nullptr);
-
- if (nIndex == 0)
- {
- pSubKey->m_pPeer = m_pSub;
- m_pSub = pSubKey;
- return;
- }
- else
- {
- int nCurrentIndex = 0;
- for (KeyValues* pIter = GetFirstSubKey(); pIter != nullptr; pIter = pIter->GetNextKey())
- {
- ++nCurrentIndex;
- if (nCurrentIndex == nIndex)
- {
- pSubKey->m_pPeer = pIter->m_pPeer;
- pIter->m_pPeer = pSubKey;
- return;
- }
- }
- // Index is out of range if we get here
- assert(0);
- return;
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Checks if key contains a subkey
-// Input : *pSubKey -
-// Output : true if contains, false otherwise
-//-----------------------------------------------------------------------------
-bool KeyValues::ContainsSubKey(KeyValues* pSubKey)
-{
- for (KeyValues* pIter = GetFirstSubKey(); pIter != nullptr; pIter = pIter->GetNextKey())
- {
- if (pSubKey == pIter)
- {
- return true;
- }
- }
- return false;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Swaps existing subkey with another
-// Input : *pExistingSubkey -
-// *pNewSubKey -
-//-----------------------------------------------------------------------------
-void KeyValues::SwapSubKey(KeyValues* pExistingSubkey, KeyValues* pNewSubKey)
-{
- assert(pExistingSubkey != nullptr && pNewSubKey != nullptr);
-
- // Make sure the new sub key isn't a child of some other keyvalues
- assert(pNewSubKey->m_pPeer == nullptr);
-
- // Check the list pointer
- if (m_pSub == pExistingSubkey)
- {
- pNewSubKey->m_pPeer = pExistingSubkey->m_pPeer;
- pExistingSubkey->m_pPeer = nullptr;
- m_pSub = pNewSubKey;
- }
- else
- {
- // Look through the list
- KeyValues* kv = m_pSub;
- while (kv->m_pPeer)
- {
- if (kv->m_pPeer == pExistingSubkey)
- {
- pNewSubKey->m_pPeer = pExistingSubkey->m_pPeer;
- pExistingSubkey->m_pPeer = nullptr;
- kv->m_pPeer = pNewSubKey;
- break;
- }
-
- kv = kv->m_pPeer;
- }
- // Existing sub key should always be found, otherwise it's a bug in the calling code.
- assert(kv->m_pPeer != nullptr);
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Elides subkey
-// Input : *pSubKey -
-//-----------------------------------------------------------------------------
-void KeyValues::ElideSubKey(KeyValues* pSubKey)
-{
- // This pointer's "next" pointer needs to be fixed up when we elide the key
- KeyValues** ppPointerToFix = &m_pSub;
- for (KeyValues* pKeyIter = m_pSub; pKeyIter != nullptr; ppPointerToFix = &pKeyIter->m_pPeer, pKeyIter = pKeyIter->GetNextKey())
- {
- if (pKeyIter == pSubKey)
- {
- if (pSubKey->m_pSub == nullptr)
- {
- // No children, simply remove the key
- *ppPointerToFix = pSubKey->m_pPeer;
- delete pSubKey;
- }
- else
- {
- *ppPointerToFix = pSubKey->m_pSub;
- // Attach the remainder of this chain to the last child of pSubKey
- KeyValues* pChildIter = pSubKey->m_pSub;
- while (pChildIter->m_pPeer != nullptr)
- {
- pChildIter = pChildIter->m_pPeer;
- }
- // Now points to the last child of pSubKey
- pChildIter->m_pPeer = pSubKey->m_pPeer;
- // Detach the node to be elided
- pSubKey->m_pSub = nullptr;
- pSubKey->m_pPeer = nullptr;
- delete pSubKey;
- }
- return;
- }
- }
- // Key not found; that's caller error.
- assert(0);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Check if a keyName has no value assigned to it.
-// Input : *pszKeyName -
-// Output : true on success, false otherwise
-//-----------------------------------------------------------------------------
-bool KeyValues::IsEmpty(const char* pszKeyName)
-{
- KeyValues* pKey = FindKey(pszKeyName, false);
- if (!pKey)
- return true;
-
- if (pKey->m_iDataType == TYPE_NONE && pKey->m_pSub == nullptr)
- return true;
-
- return false;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: gets the first true sub key
-// Output : *KeyValues
-//-----------------------------------------------------------------------------
-KeyValues* KeyValues::GetFirstTrueSubKey(void) const
-{
- assert(this, "Member function called on NULL KeyValues");
- KeyValues* pRet = this ? m_pSub : nullptr;
- while (pRet && pRet->m_iDataType != TYPE_NONE)
- pRet = pRet->m_pPeer;
-
- return pRet;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: gets the next true sub key
-// Output : *KeyValues
-//-----------------------------------------------------------------------------
-KeyValues* KeyValues::GetNextTrueSubKey(void) const
-{
- assert(this, "Member function called on NULL KeyValues");
- KeyValues* pRet = this ? m_pPeer : nullptr;
- while (pRet && pRet->m_iDataType != TYPE_NONE)
- pRet = pRet->m_pPeer;
-
- return pRet;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: gets the first value
-// Output : *KeyValues
-//-----------------------------------------------------------------------------
-KeyValues* KeyValues::GetFirstValue(void) const
-{
- assert(this, "Member function called on NULL KeyValues");
- KeyValues* pRet = this ? m_pSub : nullptr;
- while (pRet && pRet->m_iDataType == TYPE_NONE)
- pRet = pRet->m_pPeer;
-
- return pRet;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: gets the next value
-// Output : *KeyValues
-//-----------------------------------------------------------------------------
-KeyValues* KeyValues::GetNextValue(void) const
-{
- assert(this, "Member function called on NULL KeyValues");
- KeyValues* pRet = this ? m_pPeer : nullptr;
- while (pRet && pRet->m_iDataType == TYPE_NONE)
- pRet = pRet->m_pPeer;
-
- return pRet;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Return the first subkey in the list
-//-----------------------------------------------------------------------------
-KeyValues* KeyValues::GetFirstSubKey() const
-{
- assert(this, "Member function called on NULL KeyValues");
- return this ? m_pSub : nullptr;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Return the next subkey
-//-----------------------------------------------------------------------------
-KeyValues* KeyValues::GetNextKey() const
-{
- assert(this, "Member function called on NULL KeyValues");
- return this ? m_pPeer : nullptr;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Get the name of the current key section
-// Output : const char*
-//-----------------------------------------------------------------------------
-const char* KeyValues::GetName(void) const
-{
- return KeyValuesSystem()->m_pVtable->GetStringForSymbol(
- KeyValuesSystem(), MAKE_3_BYTES_FROM_1_AND_2(m_iKeyNameCaseSensitive1, m_iKeyNameCaseSensitive2));
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Get the integer value of a keyName. Default value is returned
-// if the keyName can't be found.
-// Input : *pszKeyName -
-// nDefaultValue -
-// Output : int
-//-----------------------------------------------------------------------------
-int KeyValues::GetInt(const char* pszKeyName, int iDefaultValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, false);
- if (pKey)
- {
- switch (pKey->m_iDataType)
- {
- case TYPE_STRING:
- return atoi(pKey->m_sValue);
- case TYPE_WSTRING:
- return _wtoi(pKey->m_wsValue);
- case TYPE_FLOAT:
- return static_cast<int>(pKey->m_flValue);
- case TYPE_UINT64:
- // can't convert, since it would lose data
- assert(0);
- return 0;
- case TYPE_INT:
- case TYPE_PTR:
- default:
- return pKey->m_iValue;
- };
- }
- return iDefaultValue;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Get the integer value of a keyName. Default value is returned
-// if the keyName can't be found.
-// Input : *pszKeyName -
-// nDefaultValue -
-// Output : uint64_t
-//-----------------------------------------------------------------------------
-uint64_t KeyValues::GetUint64(const char* pszKeyName, uint64_t nDefaultValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, false);
- if (pKey)
- {
- switch (pKey->m_iDataType)
- {
- case TYPE_STRING:
- {
- uint64_t uiResult = 0ull;
- sscanf(pKey->m_sValue, "%lld", &uiResult);
- return uiResult;
- }
- case TYPE_WSTRING:
- {
- uint64_t uiResult = 0ull;
- swscanf(pKey->m_wsValue, L"%lld", &uiResult);
- return uiResult;
- }
- case TYPE_FLOAT:
- return static_cast<int>(pKey->m_flValue);
- case TYPE_UINT64:
- return *reinterpret_cast<uint64_t*>(pKey->m_sValue);
- case TYPE_PTR:
- return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(pKey->m_pValue));
- case TYPE_INT:
- default:
- return pKey->m_iValue;
- };
- }
- return nDefaultValue;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Get the pointer value of a keyName. Default value is returned
-// if the keyName can't be found.
-// Input : *pszKeyName -
-// pDefaultValue -
-// Output : void*
-//-----------------------------------------------------------------------------
-void* KeyValues::GetPtr(const char* pszKeyName, void* pDefaultValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, false);
- if (pKey)
- {
- switch (pKey->m_iDataType)
- {
- case TYPE_PTR:
- return pKey->m_pValue;
-
- case TYPE_WSTRING:
- case TYPE_STRING:
- case TYPE_FLOAT:
- case TYPE_INT:
- case TYPE_UINT64:
- default:
- return nullptr;
- };
- }
- return pDefaultValue;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Get the float value of a keyName. Default value is returned
-// if the keyName can't be found.
-// Input : *pszKeyName -
-// flDefaultValue -
-// Output : float
-//-----------------------------------------------------------------------------
-float KeyValues::GetFloat(const char* pszKeyName, float flDefaultValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, false);
- if (pKey)
- {
- switch (pKey->m_iDataType)
- {
- case TYPE_STRING:
- return static_cast<float>(atof(pKey->m_sValue));
- case TYPE_WSTRING:
- return static_cast<float>(_wtof(pKey->m_wsValue)); // no wtof
- case TYPE_FLOAT:
- return pKey->m_flValue;
- case TYPE_INT:
- return static_cast<float>(pKey->m_iValue);
- case TYPE_UINT64:
- return static_cast<float>((*(reinterpret_cast<uint64_t*>(pKey->m_sValue))));
- case TYPE_PTR:
- default:
- return 0.0f;
- };
- }
- return flDefaultValue;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Get the string pointer of a keyName. Default value is returned
-// if the keyName can't be found.
-// // Input : *pszKeyName -
-// pszDefaultValue -
-// Output : const char*
-//-----------------------------------------------------------------------------
-const char* KeyValues::GetString(const char* pszKeyName, const char* pszDefaultValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, false);
- if (pKey)
- {
- // convert the data to string form then return it
- char buf[64];
- switch (pKey->m_iDataType)
- {
- case TYPE_FLOAT:
- snprintf(buf, sizeof(buf), "%f", pKey->m_flValue);
- SetString(pszKeyName, buf);
- break;
- case TYPE_PTR:
- snprintf(buf, sizeof(buf), "%lld", reinterpret_cast<uint64_t>(pKey->m_pValue));
- SetString(pszKeyName, buf);
- break;
- case TYPE_INT:
- snprintf(buf, sizeof(buf), "%d", pKey->m_iValue);
- SetString(pszKeyName, buf);
- break;
- case TYPE_UINT64:
- snprintf(buf, sizeof(buf), "%lld", *(reinterpret_cast<uint64_t*>(pKey->m_sValue)));
- SetString(pszKeyName, buf);
- break;
- case TYPE_COLOR:
- snprintf(buf, sizeof(buf), "%d %d %d %d", pKey->m_Color[0], pKey->m_Color[1], pKey->m_Color[2], pKey->m_Color[3]);
- SetString(pszKeyName, buf);
- break;
-
- case TYPE_WSTRING:
- {
- // convert the string to char *, set it for future use, and return it
- char wideBuf[512];
- int result = V_UnicodeToUTF8(pKey->m_wsValue, wideBuf, 512);
- if (result)
- {
- // note: this will copy wideBuf
- SetString(pszKeyName, wideBuf);
- }
- else
- {
- return pszDefaultValue;
- }
- break;
- }
- case TYPE_STRING:
- break;
- default:
- return pszDefaultValue;
- };
-
- return pKey->m_sValue;
- }
- return pszDefaultValue;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Get the wide string pointer of a keyName. Default value is returned
-// if the keyName can't be found.
-// // Input : *pszKeyName -
-// pwszDefaultValue -
-// Output : const wchar_t*
-//-----------------------------------------------------------------------------
-const wchar_t* KeyValues::GetWString(const char* pszKeyName, const wchar_t* pwszDefaultValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, false);
- if (pKey)
- {
- wchar_t wbuf[64];
- switch (pKey->m_iDataType)
- {
- case TYPE_FLOAT:
- swprintf(wbuf, ARRAYSIZE(wbuf), L"%f", pKey->m_flValue);
- SetWString(pszKeyName, wbuf);
- break;
- case TYPE_PTR:
- swprintf(wbuf, ARRAYSIZE(wbuf), L"%lld", static_cast<int64_t>(reinterpret_cast<size_t>(pKey->m_pValue)));
- SetWString(pszKeyName, wbuf);
- break;
- case TYPE_INT:
- swprintf(wbuf, ARRAYSIZE(wbuf), L"%d", pKey->m_iValue);
- SetWString(pszKeyName, wbuf);
- break;
- case TYPE_UINT64:
- {
- swprintf(wbuf, ARRAYSIZE(wbuf), L"%lld", *(reinterpret_cast<uint64_t*>(pKey->m_sValue)));
- SetWString(pszKeyName, wbuf);
- }
- break;
- case TYPE_COLOR:
- swprintf(wbuf, ARRAYSIZE(wbuf), L"%d %d %d %d", pKey->m_Color[0], pKey->m_Color[1], pKey->m_Color[2], pKey->m_Color[3]);
- SetWString(pszKeyName, wbuf);
- break;
-
- case TYPE_WSTRING:
- break;
- case TYPE_STRING:
- {
- size_t bufSize = strlen(pKey->m_sValue) + 1;
- wchar_t* pWBuf = new wchar_t[bufSize];
- int result = V_UTF8ToUnicode(pKey->m_sValue, pWBuf, static_cast<int>(bufSize * sizeof(wchar_t)));
- if (result >= 0) // may be a zero length string
- {
- SetWString(pszKeyName, pWBuf);
- delete[] pWBuf;
- }
- else
- {
- delete[] pWBuf;
- return pwszDefaultValue;
- }
-
- break;
- }
- default:
- return pwszDefaultValue;
- };
-
- return reinterpret_cast<const wchar_t*>(pKey->m_wsValue);
- }
- return pwszDefaultValue;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Gets a color
-// Input : *pszKeyName -
-// &defaultColor -
-// Output : Color
-//-----------------------------------------------------------------------------
-Color KeyValues::GetColor(const char* pszKeyName, const Color& defaultColor)
-{
- Color color = defaultColor;
- KeyValues* pKey = FindKey(pszKeyName, false);
- if (pKey)
- {
- if (pKey->m_iDataType == TYPE_COLOR)
- {
- color[0] = pKey->m_Color[0];
- color[1] = pKey->m_Color[1];
- color[2] = pKey->m_Color[2];
- color[3] = pKey->m_Color[3];
- }
- else if (pKey->m_iDataType == TYPE_FLOAT)
- {
- color[0] = static_cast<unsigned char>(pKey->m_flValue);
- }
- else if (pKey->m_iDataType == TYPE_INT)
- {
- color[0] = static_cast<unsigned char>(pKey->m_iValue);
- }
- else if (pKey->m_iDataType == TYPE_STRING)
- {
- // parse the colors out of the string
- float a = 0, b = 0, c = 0, d = 0;
- sscanf(pKey->m_sValue, "%f %f %f %f", &a, &b, &c, &d);
- color[0] = static_cast<unsigned char>(a);
- color[1] = static_cast<unsigned char>(b);
- color[2] = static_cast<unsigned char>(c);
- color[3] = static_cast<unsigned char>(d);
- }
- }
- return color;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Get the data type of the value stored in a keyName
-// Input : *pszKeyName -
-//-----------------------------------------------------------------------------
-KeyValuesTypes_t KeyValues::GetDataType(const char* pszKeyName)
-{
- KeyValues* pKey = FindKey(pszKeyName, false);
- if (pKey)
- return static_cast<KeyValuesTypes_t>(pKey->m_iDataType);
-
- return TYPE_NONE;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Get the data type of the value stored in this keyName
-//-----------------------------------------------------------------------------
-KeyValuesTypes_t KeyValues::GetDataType(void) const
-{
- return static_cast<KeyValuesTypes_t>(m_iDataType);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Set the integer value of a keyName.
-// Input : *pszKeyName -
-// iValue -
-//-----------------------------------------------------------------------------
-void KeyValues::SetInt(const char* pszKeyName, int iValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, true);
- if (pKey)
- {
- pKey->m_iValue = iValue;
- pKey->m_iDataType = TYPE_INT;
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Set the integer value of a keyName.
-//-----------------------------------------------------------------------------
-void KeyValues::SetUint64(const char* pszKeyName, uint64_t nValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, true);
-
- if (pKey)
- {
- // delete the old value
- delete[] pKey->m_sValue;
- // make sure we're not storing the WSTRING - as we're converting over to STRING
- delete[] pKey->m_wsValue;
- pKey->m_wsValue = nullptr;
-
- pKey->m_sValue = new char[sizeof(uint64_t)];
- *(reinterpret_cast<uint64_t*>(pKey->m_sValue)) = nValue;
- pKey->m_iDataType = TYPE_UINT64;
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Set the float value of a keyName.
-// Input : *pszKeyName -
-// flValue -
-//-----------------------------------------------------------------------------
-void KeyValues::SetFloat(const char* pszKeyName, float flValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, true);
- if (pKey)
- {
- pKey->m_flValue = flValue;
- pKey->m_iDataType = TYPE_FLOAT;
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Set the name value of a keyName.
-// Input : *pszSetName -
-//-----------------------------------------------------------------------------
-void KeyValues::SetName(const char* pszSetName)
-{
- HKeySymbol hCaseSensitiveKeyName = INVALID_KEY_SYMBOL, hCaseInsensitiveKeyName = INVALID_KEY_SYMBOL;
- hCaseSensitiveKeyName =
- KeyValuesSystem()->m_pVtable->GetSymbolForStringCaseSensitive(KeyValuesSystem(), hCaseInsensitiveKeyName, pszSetName, false);
-
- m_iKeyName = hCaseInsensitiveKeyName;
- SPLIT_3_BYTES_INTO_1_AND_2(m_iKeyNameCaseSensitive1, m_iKeyNameCaseSensitive2, hCaseSensitiveKeyName);
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Set the pointer value of a keyName.
-// Input : *pszKeyName -
-// *pValue -
-//-----------------------------------------------------------------------------
-void KeyValues::SetPtr(const char* pszKeyName, void* pValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, true);
-
- if (pKey)
- {
- pKey->m_pValue = pValue;
- pKey->m_iDataType = TYPE_PTR;
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Set the string value (internal)
-// Input : *pszValue -
-//-----------------------------------------------------------------------------
-void KeyValues::SetStringValue(char const* pszValue)
-{
- // delete the old value
- delete[] m_sValue;
- // make sure we're not storing the WSTRING - as we're converting over to STRING
- delete[] m_wsValue;
- m_wsValue = nullptr;
-
- if (!pszValue)
- {
- // ensure a valid value
- pszValue = "";
- }
-
- // allocate memory for the new value and copy it in
- size_t len = strlen(pszValue);
- m_sValue = new char[len + 1];
- memcpy(m_sValue, pszValue, len + 1);
-
- m_iDataType = TYPE_STRING;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Sets this key's peer to the KeyValues passed in
-// Input : *pDat -
-//-----------------------------------------------------------------------------
-void KeyValues::SetNextKey(KeyValues* pDat)
-{
- m_pPeer = pDat;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Set the string value of a keyName.
-// Input : *pszKeyName -
-// *pszValue -
-//-----------------------------------------------------------------------------
-void KeyValues::SetString(const char* pszKeyName, const char* pszValue)
-{
- if (KeyValues* pKey = FindKey(pszKeyName, true))
- {
- pKey->SetStringValue(pszValue);
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Set the string value of a keyName.
-// Input : *pszKeyName -
-// *pwszValue -
-//-----------------------------------------------------------------------------
-void KeyValues::SetWString(const char* pszKeyName, const wchar_t* pwszValue)
-{
- KeyValues* pKey = FindKey(pszKeyName, true);
- if (pKey)
- {
- // delete the old value
- delete[] pKey->m_wsValue;
- // make sure we're not storing the STRING - as we're converting over to WSTRING
- delete[] pKey->m_sValue;
- pKey->m_sValue = nullptr;
-
- if (!pwszValue)
- {
- // ensure a valid value
- pwszValue = L"";
- }
-
- // allocate memory for the new value and copy it in
- size_t len = wcslen(pwszValue);
- pKey->m_wsValue = new wchar_t[len + 1];
- memcpy(pKey->m_wsValue, pwszValue, (len + 1) * sizeof(wchar_t));
-
- pKey->m_iDataType = TYPE_WSTRING;
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Sets a color
-// Input : *pszKeyName -
-// color -
-//-----------------------------------------------------------------------------
-void KeyValues::SetColor(const char* pszKeyName, Color color)
-{
- KeyValues* pKey = FindKey(pszKeyName, true);
-
- if (pKey)
- {
- pKey->m_iDataType = TYPE_COLOR;
- pKey->m_Color[0] = color[0];
- pKey->m_Color[1] = color[1];
- pKey->m_Color[2] = color[2];
- pKey->m_Color[3] = color[3];
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Input : &src -
-//-----------------------------------------------------------------------------
-void KeyValues::RecursiveCopyKeyValues(KeyValues& src)
-{
- // garymcthack - need to check this code for possible buffer overruns.
-
- m_iKeyName = src.m_iKeyName;
- m_iKeyNameCaseSensitive1 = src.m_iKeyNameCaseSensitive1;
- m_iKeyNameCaseSensitive2 = src.m_iKeyNameCaseSensitive2;
-
- if (!src.m_pSub)
- {
- m_iDataType = src.m_iDataType;
- char buf[256];
- switch (src.m_iDataType)
- {
- case TYPE_NONE:
- break;
- case TYPE_STRING:
- if (src.m_sValue)
- {
- size_t len = strlen(src.m_sValue) + 1;
- m_sValue = new char[len];
- strncpy(m_sValue, src.m_sValue, len);
- }
- break;
- case TYPE_INT:
- {
- m_iValue = src.m_iValue;
- snprintf(buf, sizeof(buf), "%d", m_iValue);
- size_t len = strlen(buf) + 1;
- m_sValue = new char[len];
- strncpy(m_sValue, buf, len);
- }
- break;
- case TYPE_FLOAT:
- {
- m_flValue = src.m_flValue;
- snprintf(buf, sizeof(buf), "%f", m_flValue);
- size_t len = strlen(buf) + 1;
- m_sValue = new char[len];
- strncpy(m_sValue, buf, len);
- }
- break;
- case TYPE_PTR:
- {
- m_pValue = src.m_pValue;
- }
- break;
- case TYPE_UINT64:
- {
- m_sValue = new char[sizeof(uint64_t)];
- memcpy(m_sValue, src.m_sValue, sizeof(uint64_t));
- }
- break;
- case TYPE_COLOR:
- {
- m_Color[0] = src.m_Color[0];
- m_Color[1] = src.m_Color[1];
- m_Color[2] = src.m_Color[2];
- m_Color[3] = src.m_Color[3];
- }
- break;
-
- default:
- {
- // do nothing . .what the heck is this?
- assert(0);
- }
- break;
- }
- }
-
- // Handle the immediate child
- if (src.m_pSub)
- {
- m_pSub = new KeyValues;
-
- m_pSub->Init();
- m_pSub->SetName(nullptr);
-
- m_pSub->RecursiveCopyKeyValues(*src.m_pSub);
- }
-
- // Handle the immediate peer
- if (src.m_pPeer)
- {
- m_pPeer = new KeyValues;
-
- m_pPeer->Init();
- m_pPeer->SetName(nullptr);
-
- m_pPeer->RecursiveCopyKeyValues(*src.m_pPeer);
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Make a new copy of all subkeys, add them all to the passed-in keyvalues
-// Input : *pParent -
-//-----------------------------------------------------------------------------
-void KeyValues::CopySubkeys(KeyValues* pParent) const
-{
- // recursively copy subkeys
- // Also maintain ordering....
- KeyValues* pPrev = nullptr;
- for (KeyValues* pSub = m_pSub; pSub != nullptr; pSub = pSub->m_pPeer)
- {
- // take a copy of the subkey
- KeyValues* pKey = pSub->MakeCopy();
-
- // add into subkey list
- if (pPrev)
- {
- pPrev->m_pPeer = pKey;
- }
- else
- {
- pParent->m_pSub = pKey;
- }
- pKey->m_pPeer = nullptr;
- pPrev = pKey;
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Makes a copy of the whole key-value pair set
-// Output : KeyValues*
-//-----------------------------------------------------------------------------
-KeyValues* KeyValues::MakeCopy(void) const
-{
- KeyValues* pNewKeyValue = new KeyValues;
-
- pNewKeyValue->Init();
- pNewKeyValue->SetName(GetName());
-
- // copy data
- pNewKeyValue->m_iDataType = m_iDataType;
- switch (m_iDataType)
- {
- case TYPE_STRING:
- {
- if (m_sValue)
- {
- size_t len = strlen(m_sValue);
- assert(!pNewKeyValue->m_sValue);
- pNewKeyValue->m_sValue = new char[len + 1];
- memcpy(pNewKeyValue->m_sValue, m_sValue, len + 1);
- }
- }
- break;
- case TYPE_WSTRING:
- {
- if (m_wsValue)
- {
- size_t len = wcslen(m_wsValue);
- pNewKeyValue->m_wsValue = new wchar_t[len + 1];
- memcpy(pNewKeyValue->m_wsValue, m_wsValue, len + 1 * sizeof(wchar_t));
- }
- }
- break;
-
- case TYPE_INT:
- pNewKeyValue->m_iValue = m_iValue;
- break;
-
- case TYPE_FLOAT:
- pNewKeyValue->m_flValue = m_flValue;
- break;
-
- case TYPE_PTR:
- pNewKeyValue->m_pValue = m_pValue;
- break;
-
- case TYPE_COLOR:
- pNewKeyValue->m_Color[0] = m_Color[0];
- pNewKeyValue->m_Color[1] = m_Color[1];
- pNewKeyValue->m_Color[2] = m_Color[2];
- pNewKeyValue->m_Color[3] = m_Color[3];
- break;
-
- case TYPE_UINT64:
- pNewKeyValue->m_sValue = new char[sizeof(uint64_t)];
- memcpy(pNewKeyValue->m_sValue, m_sValue, sizeof(uint64_t));
- break;
- };
-
- // recursively copy subkeys
- CopySubkeys(pNewKeyValue);
- return pNewKeyValue;
-}
-
-ON_DLL_LOAD("vstdlib.dll", KeyValues, (CModule module))
-{
- V_UTF8ToUnicode = module.GetExport("V_UTF8ToUnicode").As<int (*)(const char*, wchar_t*, int)>();
- V_UnicodeToUTF8 = module.GetExport("V_UnicodeToUTF8").As<int (*)(const wchar_t*, char*, int)>();
- KeyValuesSystem = module.GetExport("KeyValuesSystem").As<CKeyValuesSystem* (*)()>();
-}
-
-AUTOHOOK_INIT()
-
-// clang-format off
-AUTOHOOK(KeyValues__LoadFromBuffer, engine.dll + 0x426C30,
-char, __fastcall, (KeyValues* self, const char* pResourceName, const char* pBuffer, void* pFileSystem, void* a5, void* a6, int a7))
-// clang-format on
-{
- static void* pSavedFilesystemPtr = nullptr;
-
- // this is just to allow playlists to get a valid pFileSystem ptr for kv building, other functions that call this particular overload of
- // LoadFromBuffer seem to get called on network stuff exclusively not exactly sure what the address wanted here is, so just taking it
- // from a function call that always happens before playlists is loaded
-
- // note: would be better if we could serialize this to disk for playlists, as this method breaks saving playlists in demos
- if (pFileSystem != nullptr)
- pSavedFilesystemPtr = pFileSystem;
- if (!pFileSystem && !strcmp(pResourceName, "playlists"))
- pFileSystem = pSavedFilesystemPtr;
-
- return KeyValues__LoadFromBuffer(self, pResourceName, pBuffer, pFileSystem, a5, a6, a7);
-}
-
-ON_DLL_LOAD("engine.dll", EngineKeyValues, (CModule module))
-{
- AUTOHOOK_DISPATCH()
-}
+#include "pch.h"
+#include "keyvalues.h"
+#include <winnt.h>
+
+// implementation of the ConVar class
+// heavily based on https://github.com/Mauler125/r5sdk/blob/master/r5dev/vpc/keyvalues.cpp
+
+typedef int HKeySymbol;
+#define INVALID_KEY_SYMBOL (-1)
+
+#define MAKE_3_BYTES_FROM_1_AND_2(x1, x2) ((((uint16_t)x2) << 8) | (uint8_t)(x1))
+#define SPLIT_3_BYTES_INTO_1_AND_2(x1, x2, x3) \
+ do \
+ { \
+ x1 = (uint8_t)(x3); \
+ x2 = (uint16_t)((x3) >> 8); \
+ } while (0)
+
+struct CKeyValuesSystem
+{
+ public:
+ struct __VTable
+ {
+ char pad0[8 * 3]; // 2 methods
+ HKeySymbol (*GetSymbolForString)(CKeyValuesSystem* self, const char* name, bool bCreate);
+ const char* (*GetStringForSymbol)(CKeyValuesSystem* self, HKeySymbol symbol);
+ char pad1[8 * 5];
+ HKeySymbol (*GetSymbolForStringCaseSensitive)(
+ CKeyValuesSystem* self, HKeySymbol& hCaseInsensitiveSymbol, const char* name, bool bCreate);
+ };
+
+ const __VTable* m_pVtable;
+};
+
+int (*V_UTF8ToUnicode)(const char* pUTF8, wchar_t* pwchDest, int cubDestSizeInBytes);
+int (*V_UnicodeToUTF8)(const wchar_t* pUnicode, char* pUTF8, int cubDestSizeInBytes);
+CKeyValuesSystem* (*KeyValuesSystem)();
+
+KeyValues::KeyValues() {} // default constructor for copying and such
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+// Input : *pszSetName -
+//-----------------------------------------------------------------------------
+KeyValues::KeyValues(const char* pszSetName)
+{
+ Init();
+ SetName(pszSetName);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+// Input : *pszSetName -
+// *pszFirstKey -
+// *pszFirstValue -
+//-----------------------------------------------------------------------------
+KeyValues::KeyValues(const char* pszSsetName, const char* pszFirstKey, const char* pszFirstValue)
+{
+ Init();
+ SetName(pszSsetName);
+ SetString(pszFirstKey, pszFirstValue);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+// Input : *pszSetName -
+// *pszFirstKey -
+// *pwszFirstValue -
+//-----------------------------------------------------------------------------
+KeyValues::KeyValues(const char* pszSetName, const char* pszFirstKey, const wchar_t* pwszFirstValue)
+{
+ Init();
+ SetName(pszSetName);
+ SetWString(pszFirstKey, pwszFirstValue);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+// Input : *pszSetName -
+// *pszFirstKey -
+// iFirstValue -
+//-----------------------------------------------------------------------------
+KeyValues::KeyValues(const char* pszSetName, const char* pszFirstKey, int iFirstValue)
+{
+ Init();
+ SetName(pszSetName);
+ SetInt(pszFirstKey, iFirstValue);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+// Input : *pszSetName -
+// *pszFirstKey -
+// *pszFirstValue -
+// *pszSecondKey -
+// *pszSecondValue -
+//-----------------------------------------------------------------------------
+KeyValues::KeyValues(
+ const char* pszSetName, const char* pszFirstKey, const char* pszFirstValue, const char* pszSecondKey, const char* pszSecondValue)
+{
+ Init();
+ SetName(pszSetName);
+ SetString(pszFirstKey, pszFirstValue);
+ SetString(pszSecondKey, pszSecondValue);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+// Input : *pszSetName -
+// *pszFirstKey -
+// iFirstValue -
+// *pszSecondKey -
+// iSecondValue -
+//-----------------------------------------------------------------------------
+KeyValues::KeyValues(const char* pszSetName, const char* pszFirstKey, int iFirstValue, const char* pszSecondKey, int iSecondValue)
+{
+ Init();
+ SetName(pszSetName);
+ SetInt(pszFirstKey, iFirstValue);
+ SetInt(pszSecondKey, iSecondValue);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Destructor
+//-----------------------------------------------------------------------------
+KeyValues::~KeyValues(void)
+{
+ RemoveEverything();
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Initialize member variables
+//-----------------------------------------------------------------------------
+void KeyValues::Init(void)
+{
+ m_iKeyName = 0;
+ m_iKeyNameCaseSensitive1 = 0;
+ m_iKeyNameCaseSensitive2 = 0;
+ m_iDataType = TYPE_NONE;
+
+ m_pSub = nullptr;
+ m_pPeer = nullptr;
+ m_pChain = nullptr;
+
+ m_sValue = nullptr;
+ m_wsValue = nullptr;
+ m_pValue = nullptr;
+
+ m_bHasEscapeSequences = 0;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Clear out all subkeys, and the current value
+//-----------------------------------------------------------------------------
+void KeyValues::Clear(void)
+{
+ delete m_pSub;
+ m_pSub = nullptr;
+ m_iDataType = TYPE_NONE;
+}
+
+//-----------------------------------------------------------------------------
+// for backwards compat - we used to need this to force the free to run from the same DLL
+// as the alloc
+//-----------------------------------------------------------------------------
+void KeyValues::DeleteThis(void)
+{
+ delete this;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: remove everything
+//-----------------------------------------------------------------------------
+void KeyValues::RemoveEverything(void)
+{
+ KeyValues* dat;
+ KeyValues* datNext = nullptr;
+ for (dat = m_pSub; dat != nullptr; dat = datNext)
+ {
+ datNext = dat->m_pPeer;
+ dat->m_pPeer = nullptr;
+ delete dat;
+ }
+
+ for (dat = m_pPeer; dat && dat != this; dat = datNext)
+ {
+ datNext = dat->m_pPeer;
+ dat->m_pPeer = nullptr;
+ delete dat;
+ }
+
+ delete[] m_sValue;
+ m_sValue = nullptr;
+ delete[] m_wsValue;
+ m_wsValue = nullptr;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Find a keyValue, create it if it is not found.
+// Set bCreate to true to create the key if it doesn't already exist
+// (which ensures a valid pointer will be returned)
+// Input : *pszKeyName -
+// bCreate -
+// Output : *KeyValues
+//-----------------------------------------------------------------------------
+KeyValues* KeyValues::FindKey(const char* pszKeyName, bool bCreate)
+{
+ assert_msg(this, "Member function called on NULL KeyValues");
+
+ if (!pszKeyName || !*pszKeyName)
+ return this;
+
+ const char* pSubStr = strchr(pszKeyName, '/');
+
+ HKeySymbol iSearchStr = KeyValuesSystem()->m_pVtable->GetSymbolForString(KeyValuesSystem(), pszKeyName, bCreate);
+ if (iSearchStr == INVALID_KEY_SYMBOL)
+ {
+ // not found, couldn't possibly be in key value list
+ return nullptr;
+ }
+
+ KeyValues* pLastKVs = nullptr;
+ KeyValues* pCurrentKVs;
+ // find the searchStr in the current peer list
+ for (pCurrentKVs = m_pSub; pCurrentKVs != NULL; pCurrentKVs = pCurrentKVs->m_pPeer)
+ {
+ pLastKVs = pCurrentKVs; // record the last item looked at (for if we need to append to the end of the list)
+
+ // symbol compare
+ if (pLastKVs->m_iKeyName == (uint32_t)iSearchStr)
+ break;
+ }
+
+ if (!pCurrentKVs && m_pChain)
+ pCurrentKVs = m_pChain->FindKey(pszKeyName, false);
+
+ // make sure a key was found
+ if (!pCurrentKVs)
+ {
+ if (bCreate)
+ {
+ // we need to create a new key
+ pCurrentKVs = new KeyValues(pszKeyName);
+ // Assert(dat != NULL);
+
+ // insert new key at end of list
+ if (pLastKVs)
+ pLastKVs->m_pPeer = pCurrentKVs;
+ else
+ m_pSub = pCurrentKVs;
+
+ pCurrentKVs->m_pPeer = NULL;
+
+ // a key graduates to be a submsg as soon as it's m_pSub is set
+ // this should be the only place m_pSub is set
+ m_iDataType = TYPE_NONE;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ // if we've still got a subStr we need to keep looking deeper in the tree
+ if (pSubStr)
+ {
+ // recursively chain down through the paths in the string
+ return pCurrentKVs->FindKey(pSubStr + 1, bCreate);
+ }
+
+ return pCurrentKVs;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Locate last child. Returns NULL if we have no children
+// Output : *KeyValues
+//-----------------------------------------------------------------------------
+KeyValues* KeyValues::FindLastSubKey(void) const
+{
+ // No children?
+ if (m_pSub == nullptr)
+ return nullptr;
+
+ // Scan for the last one
+ KeyValues* pLastChild = m_pSub;
+ while (pLastChild->m_pPeer)
+ pLastChild = pLastChild->m_pPeer;
+ return pLastChild;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Adds a subkey. Make sure the subkey isn't a child of some other keyvalues
+// Input : *pSubKey -
+//-----------------------------------------------------------------------------
+void KeyValues::AddSubKey(KeyValues* pSubkey)
+{
+ // Make sure the subkey isn't a child of some other keyvalues
+ assert(pSubkey != nullptr);
+ assert(pSubkey->m_pPeer == nullptr);
+
+ // add into subkey list
+ if (m_pSub == nullptr)
+ {
+ m_pSub = pSubkey;
+ }
+ else
+ {
+ KeyValues* pTempDat = m_pSub;
+ while (pTempDat->GetNextKey() != nullptr)
+ {
+ pTempDat = pTempDat->GetNextKey();
+ }
+
+ pTempDat->SetNextKey(pSubkey);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Remove a subkey from the list
+// Input : *pSubKey -
+//-----------------------------------------------------------------------------
+void KeyValues::RemoveSubKey(KeyValues* pSubKey)
+{
+ if (!pSubKey)
+ return;
+
+ // check the list pointer
+ if (m_pSub == pSubKey)
+ {
+ m_pSub = pSubKey->m_pPeer;
+ }
+ else
+ {
+ // look through the list
+ KeyValues* kv = m_pSub;
+ while (kv->m_pPeer)
+ {
+ if (kv->m_pPeer == pSubKey)
+ {
+ kv->m_pPeer = pSubKey->m_pPeer;
+ break;
+ }
+
+ kv = kv->m_pPeer;
+ }
+ }
+
+ pSubKey->m_pPeer = nullptr;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Insert a subkey at index
+// Input : nIndex -
+// *pSubKey -
+//-----------------------------------------------------------------------------
+void KeyValues::InsertSubKey(int nIndex, KeyValues* pSubKey)
+{
+ // Sub key must be valid and not part of another chain
+ assert(pSubKey && pSubKey->m_pPeer == nullptr);
+
+ if (nIndex == 0)
+ {
+ pSubKey->m_pPeer = m_pSub;
+ m_pSub = pSubKey;
+ return;
+ }
+ else
+ {
+ int nCurrentIndex = 0;
+ for (KeyValues* pIter = GetFirstSubKey(); pIter != nullptr; pIter = pIter->GetNextKey())
+ {
+ ++nCurrentIndex;
+ if (nCurrentIndex == nIndex)
+ {
+ pSubKey->m_pPeer = pIter->m_pPeer;
+ pIter->m_pPeer = pSubKey;
+ return;
+ }
+ }
+ // Index is out of range if we get here
+ assert(0);
+ return;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Checks if key contains a subkey
+// Input : *pSubKey -
+// Output : true if contains, false otherwise
+//-----------------------------------------------------------------------------
+bool KeyValues::ContainsSubKey(KeyValues* pSubKey)
+{
+ for (KeyValues* pIter = GetFirstSubKey(); pIter != nullptr; pIter = pIter->GetNextKey())
+ {
+ if (pSubKey == pIter)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Swaps existing subkey with another
+// Input : *pExistingSubkey -
+// *pNewSubKey -
+//-----------------------------------------------------------------------------
+void KeyValues::SwapSubKey(KeyValues* pExistingSubkey, KeyValues* pNewSubKey)
+{
+ assert(pExistingSubkey != nullptr && pNewSubKey != nullptr);
+
+ // Make sure the new sub key isn't a child of some other keyvalues
+ assert(pNewSubKey->m_pPeer == nullptr);
+
+ // Check the list pointer
+ if (m_pSub == pExistingSubkey)
+ {
+ pNewSubKey->m_pPeer = pExistingSubkey->m_pPeer;
+ pExistingSubkey->m_pPeer = nullptr;
+ m_pSub = pNewSubKey;
+ }
+ else
+ {
+ // Look through the list
+ KeyValues* kv = m_pSub;
+ while (kv->m_pPeer)
+ {
+ if (kv->m_pPeer == pExistingSubkey)
+ {
+ pNewSubKey->m_pPeer = pExistingSubkey->m_pPeer;
+ pExistingSubkey->m_pPeer = nullptr;
+ kv->m_pPeer = pNewSubKey;
+ break;
+ }
+
+ kv = kv->m_pPeer;
+ }
+ // Existing sub key should always be found, otherwise it's a bug in the calling code.
+ assert(kv->m_pPeer != nullptr);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Elides subkey
+// Input : *pSubKey -
+//-----------------------------------------------------------------------------
+void KeyValues::ElideSubKey(KeyValues* pSubKey)
+{
+ // This pointer's "next" pointer needs to be fixed up when we elide the key
+ KeyValues** ppPointerToFix = &m_pSub;
+ for (KeyValues* pKeyIter = m_pSub; pKeyIter != nullptr; ppPointerToFix = &pKeyIter->m_pPeer, pKeyIter = pKeyIter->GetNextKey())
+ {
+ if (pKeyIter == pSubKey)
+ {
+ if (pSubKey->m_pSub == nullptr)
+ {
+ // No children, simply remove the key
+ *ppPointerToFix = pSubKey->m_pPeer;
+ delete pSubKey;
+ }
+ else
+ {
+ *ppPointerToFix = pSubKey->m_pSub;
+ // Attach the remainder of this chain to the last child of pSubKey
+ KeyValues* pChildIter = pSubKey->m_pSub;
+ while (pChildIter->m_pPeer != nullptr)
+ {
+ pChildIter = pChildIter->m_pPeer;
+ }
+ // Now points to the last child of pSubKey
+ pChildIter->m_pPeer = pSubKey->m_pPeer;
+ // Detach the node to be elided
+ pSubKey->m_pSub = nullptr;
+ pSubKey->m_pPeer = nullptr;
+ delete pSubKey;
+ }
+ return;
+ }
+ }
+ // Key not found; that's caller error.
+ assert(0);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Check if a keyName has no value assigned to it.
+// Input : *pszKeyName -
+// Output : true on success, false otherwise
+//-----------------------------------------------------------------------------
+bool KeyValues::IsEmpty(const char* pszKeyName)
+{
+ KeyValues* pKey = FindKey(pszKeyName, false);
+ if (!pKey)
+ return true;
+
+ if (pKey->m_iDataType == TYPE_NONE && pKey->m_pSub == nullptr)
+ return true;
+
+ return false;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: gets the first true sub key
+// Output : *KeyValues
+//-----------------------------------------------------------------------------
+KeyValues* KeyValues::GetFirstTrueSubKey(void) const
+{
+ assert_msg(this, "Member function called on NULL KeyValues");
+ KeyValues* pRet = this ? m_pSub : nullptr;
+ while (pRet && pRet->m_iDataType != TYPE_NONE)
+ pRet = pRet->m_pPeer;
+
+ return pRet;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: gets the next true sub key
+// Output : *KeyValues
+//-----------------------------------------------------------------------------
+KeyValues* KeyValues::GetNextTrueSubKey(void) const
+{
+ assert_msg(this, "Member function called on NULL KeyValues");
+ KeyValues* pRet = this ? m_pPeer : nullptr;
+ while (pRet && pRet->m_iDataType != TYPE_NONE)
+ pRet = pRet->m_pPeer;
+
+ return pRet;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: gets the first value
+// Output : *KeyValues
+//-----------------------------------------------------------------------------
+KeyValues* KeyValues::GetFirstValue(void) const
+{
+ assert_msg(this, "Member function called on NULL KeyValues");
+ KeyValues* pRet = this ? m_pSub : nullptr;
+ while (pRet && pRet->m_iDataType == TYPE_NONE)
+ pRet = pRet->m_pPeer;
+
+ return pRet;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: gets the next value
+// Output : *KeyValues
+//-----------------------------------------------------------------------------
+KeyValues* KeyValues::GetNextValue(void) const
+{
+ assert_msg(this, "Member function called on NULL KeyValues");
+ KeyValues* pRet = this ? m_pPeer : nullptr;
+ while (pRet && pRet->m_iDataType == TYPE_NONE)
+ pRet = pRet->m_pPeer;
+
+ return pRet;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Return the first subkey in the list
+//-----------------------------------------------------------------------------
+KeyValues* KeyValues::GetFirstSubKey() const
+{
+ assert_msg(this, "Member function called on NULL KeyValues");
+ return this ? m_pSub : nullptr;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Return the next subkey
+//-----------------------------------------------------------------------------
+KeyValues* KeyValues::GetNextKey() const
+{
+ assert_msg(this, "Member function called on NULL KeyValues");
+ return this ? m_pPeer : nullptr;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Get the name of the current key section
+// Output : const char*
+//-----------------------------------------------------------------------------
+const char* KeyValues::GetName(void) const
+{
+ return KeyValuesSystem()->m_pVtable->GetStringForSymbol(
+ KeyValuesSystem(), MAKE_3_BYTES_FROM_1_AND_2(m_iKeyNameCaseSensitive1, m_iKeyNameCaseSensitive2));
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Get the integer value of a keyName. Default value is returned
+// if the keyName can't be found.
+// Input : *pszKeyName -
+// nDefaultValue -
+// Output : int
+//-----------------------------------------------------------------------------
+int KeyValues::GetInt(const char* pszKeyName, int iDefaultValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, false);
+ if (pKey)
+ {
+ switch (pKey->m_iDataType)
+ {
+ case TYPE_STRING:
+ return atoi(pKey->m_sValue);
+ case TYPE_WSTRING:
+ return _wtoi(pKey->m_wsValue);
+ case TYPE_FLOAT:
+ return static_cast<int>(pKey->m_flValue);
+ case TYPE_UINT64:
+ // can't convert, since it would lose data
+ assert(0);
+ return 0;
+ case TYPE_INT:
+ case TYPE_PTR:
+ default:
+ return pKey->m_iValue;
+ };
+ }
+ return iDefaultValue;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Get the integer value of a keyName. Default value is returned
+// if the keyName can't be found.
+// Input : *pszKeyName -
+// nDefaultValue -
+// Output : uint64_t
+//-----------------------------------------------------------------------------
+uint64_t KeyValues::GetUint64(const char* pszKeyName, uint64_t nDefaultValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, false);
+ if (pKey)
+ {
+ switch (pKey->m_iDataType)
+ {
+ case TYPE_STRING:
+ {
+ uint64_t uiResult = 0ull;
+ sscanf(pKey->m_sValue, "%lld", &uiResult);
+ return uiResult;
+ }
+ case TYPE_WSTRING:
+ {
+ uint64_t uiResult = 0ull;
+ swscanf(pKey->m_wsValue, L"%lld", &uiResult);
+ return uiResult;
+ }
+ case TYPE_FLOAT:
+ return static_cast<int>(pKey->m_flValue);
+ case TYPE_UINT64:
+ return *reinterpret_cast<uint64_t*>(pKey->m_sValue);
+ case TYPE_PTR:
+ return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(pKey->m_pValue));
+ case TYPE_INT:
+ default:
+ return pKey->m_iValue;
+ };
+ }
+ return nDefaultValue;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Get the pointer value of a keyName. Default value is returned
+// if the keyName can't be found.
+// Input : *pszKeyName -
+// pDefaultValue -
+// Output : void*
+//-----------------------------------------------------------------------------
+void* KeyValues::GetPtr(const char* pszKeyName, void* pDefaultValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, false);
+ if (pKey)
+ {
+ switch (pKey->m_iDataType)
+ {
+ case TYPE_PTR:
+ return pKey->m_pValue;
+
+ case TYPE_WSTRING:
+ case TYPE_STRING:
+ case TYPE_FLOAT:
+ case TYPE_INT:
+ case TYPE_UINT64:
+ default:
+ return nullptr;
+ };
+ }
+ return pDefaultValue;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Get the float value of a keyName. Default value is returned
+// if the keyName can't be found.
+// Input : *pszKeyName -
+// flDefaultValue -
+// Output : float
+//-----------------------------------------------------------------------------
+float KeyValues::GetFloat(const char* pszKeyName, float flDefaultValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, false);
+ if (pKey)
+ {
+ switch (pKey->m_iDataType)
+ {
+ case TYPE_STRING:
+ return static_cast<float>(atof(pKey->m_sValue));
+ case TYPE_WSTRING:
+ return static_cast<float>(_wtof(pKey->m_wsValue)); // no wtof
+ case TYPE_FLOAT:
+ return pKey->m_flValue;
+ case TYPE_INT:
+ return static_cast<float>(pKey->m_iValue);
+ case TYPE_UINT64:
+ return static_cast<float>((*(reinterpret_cast<uint64_t*>(pKey->m_sValue))));
+ case TYPE_PTR:
+ default:
+ return 0.0f;
+ };
+ }
+ return flDefaultValue;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Get the string pointer of a keyName. Default value is returned
+// if the keyName can't be found.
+// // Input : *pszKeyName -
+// pszDefaultValue -
+// Output : const char*
+//-----------------------------------------------------------------------------
+const char* KeyValues::GetString(const char* pszKeyName, const char* pszDefaultValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, false);
+ if (pKey)
+ {
+ // convert the data to string form then return it
+ char buf[64];
+ switch (pKey->m_iDataType)
+ {
+ case TYPE_FLOAT:
+ snprintf(buf, sizeof(buf), "%f", pKey->m_flValue);
+ SetString(pszKeyName, buf);
+ break;
+ case TYPE_PTR:
+ snprintf(buf, sizeof(buf), "%lld", reinterpret_cast<uint64_t>(pKey->m_pValue));
+ SetString(pszKeyName, buf);
+ break;
+ case TYPE_INT:
+ snprintf(buf, sizeof(buf), "%d", pKey->m_iValue);
+ SetString(pszKeyName, buf);
+ break;
+ case TYPE_UINT64:
+ snprintf(buf, sizeof(buf), "%lld", *(reinterpret_cast<uint64_t*>(pKey->m_sValue)));
+ SetString(pszKeyName, buf);
+ break;
+ case TYPE_COLOR:
+ snprintf(buf, sizeof(buf), "%d %d %d %d", pKey->m_Color[0], pKey->m_Color[1], pKey->m_Color[2], pKey->m_Color[3]);
+ SetString(pszKeyName, buf);
+ break;
+
+ case TYPE_WSTRING:
+ {
+ // convert the string to char *, set it for future use, and return it
+ char wideBuf[512];
+ int result = V_UnicodeToUTF8(pKey->m_wsValue, wideBuf, 512);
+ if (result)
+ {
+ // note: this will copy wideBuf
+ SetString(pszKeyName, wideBuf);
+ }
+ else
+ {
+ return pszDefaultValue;
+ }
+ break;
+ }
+ case TYPE_STRING:
+ break;
+ default:
+ return pszDefaultValue;
+ };
+
+ return pKey->m_sValue;
+ }
+ return pszDefaultValue;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Get the wide string pointer of a keyName. Default value is returned
+// if the keyName can't be found.
+// // Input : *pszKeyName -
+// pwszDefaultValue -
+// Output : const wchar_t*
+//-----------------------------------------------------------------------------
+const wchar_t* KeyValues::GetWString(const char* pszKeyName, const wchar_t* pwszDefaultValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, false);
+ if (pKey)
+ {
+ wchar_t wbuf[64];
+ switch (pKey->m_iDataType)
+ {
+ case TYPE_FLOAT:
+ swprintf(wbuf, ARRAYSIZE(wbuf), L"%f", pKey->m_flValue);
+ SetWString(pszKeyName, wbuf);
+ break;
+ case TYPE_PTR:
+ swprintf(wbuf, ARRAYSIZE(wbuf), L"%lld", static_cast<int64_t>(reinterpret_cast<size_t>(pKey->m_pValue)));
+ SetWString(pszKeyName, wbuf);
+ break;
+ case TYPE_INT:
+ swprintf(wbuf, ARRAYSIZE(wbuf), L"%d", pKey->m_iValue);
+ SetWString(pszKeyName, wbuf);
+ break;
+ case TYPE_UINT64:
+ {
+ swprintf(wbuf, ARRAYSIZE(wbuf), L"%lld", *(reinterpret_cast<uint64_t*>(pKey->m_sValue)));
+ SetWString(pszKeyName, wbuf);
+ }
+ break;
+ case TYPE_COLOR:
+ swprintf(wbuf, ARRAYSIZE(wbuf), L"%d %d %d %d", pKey->m_Color[0], pKey->m_Color[1], pKey->m_Color[2], pKey->m_Color[3]);
+ SetWString(pszKeyName, wbuf);
+ break;
+
+ case TYPE_WSTRING:
+ break;
+ case TYPE_STRING:
+ {
+ size_t bufSize = strlen(pKey->m_sValue) + 1;
+ wchar_t* pWBuf = new wchar_t[bufSize];
+ int result = V_UTF8ToUnicode(pKey->m_sValue, pWBuf, static_cast<int>(bufSize * sizeof(wchar_t)));
+ if (result >= 0) // may be a zero length string
+ {
+ SetWString(pszKeyName, pWBuf);
+ delete[] pWBuf;
+ }
+ else
+ {
+ delete[] pWBuf;
+ return pwszDefaultValue;
+ }
+
+ break;
+ }
+ default:
+ return pwszDefaultValue;
+ };
+
+ return reinterpret_cast<const wchar_t*>(pKey->m_wsValue);
+ }
+ return pwszDefaultValue;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Gets a color
+// Input : *pszKeyName -
+// &defaultColor -
+// Output : Color
+//-----------------------------------------------------------------------------
+Color KeyValues::GetColor(const char* pszKeyName, const Color& defaultColor)
+{
+ Color color = defaultColor;
+ KeyValues* pKey = FindKey(pszKeyName, false);
+ if (pKey)
+ {
+ if (pKey->m_iDataType == TYPE_COLOR)
+ {
+ color[0] = pKey->m_Color[0];
+ color[1] = pKey->m_Color[1];
+ color[2] = pKey->m_Color[2];
+ color[3] = pKey->m_Color[3];
+ }
+ else if (pKey->m_iDataType == TYPE_FLOAT)
+ {
+ color[0] = static_cast<unsigned char>(pKey->m_flValue);
+ }
+ else if (pKey->m_iDataType == TYPE_INT)
+ {
+ color[0] = static_cast<unsigned char>(pKey->m_iValue);
+ }
+ else if (pKey->m_iDataType == TYPE_STRING)
+ {
+ // parse the colors out of the string
+ float a = 0, b = 0, c = 0, d = 0;
+ sscanf(pKey->m_sValue, "%f %f %f %f", &a, &b, &c, &d);
+ color[0] = static_cast<unsigned char>(a);
+ color[1] = static_cast<unsigned char>(b);
+ color[2] = static_cast<unsigned char>(c);
+ color[3] = static_cast<unsigned char>(d);
+ }
+ }
+ return color;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Get the data type of the value stored in a keyName
+// Input : *pszKeyName -
+//-----------------------------------------------------------------------------
+KeyValuesTypes_t KeyValues::GetDataType(const char* pszKeyName)
+{
+ KeyValues* pKey = FindKey(pszKeyName, false);
+ if (pKey)
+ return static_cast<KeyValuesTypes_t>(pKey->m_iDataType);
+
+ return TYPE_NONE;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Get the data type of the value stored in this keyName
+//-----------------------------------------------------------------------------
+KeyValuesTypes_t KeyValues::GetDataType(void) const
+{
+ return static_cast<KeyValuesTypes_t>(m_iDataType);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Set the integer value of a keyName.
+// Input : *pszKeyName -
+// iValue -
+//-----------------------------------------------------------------------------
+void KeyValues::SetInt(const char* pszKeyName, int iValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, true);
+ if (pKey)
+ {
+ pKey->m_iValue = iValue;
+ pKey->m_iDataType = TYPE_INT;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Set the integer value of a keyName.
+//-----------------------------------------------------------------------------
+void KeyValues::SetUint64(const char* pszKeyName, uint64_t nValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, true);
+
+ if (pKey)
+ {
+ // delete the old value
+ delete[] pKey->m_sValue;
+ // make sure we're not storing the WSTRING - as we're converting over to STRING
+ delete[] pKey->m_wsValue;
+ pKey->m_wsValue = nullptr;
+
+ pKey->m_sValue = new char[sizeof(uint64_t)];
+ *(reinterpret_cast<uint64_t*>(pKey->m_sValue)) = nValue;
+ pKey->m_iDataType = TYPE_UINT64;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Set the float value of a keyName.
+// Input : *pszKeyName -
+// flValue -
+//-----------------------------------------------------------------------------
+void KeyValues::SetFloat(const char* pszKeyName, float flValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, true);
+ if (pKey)
+ {
+ pKey->m_flValue = flValue;
+ pKey->m_iDataType = TYPE_FLOAT;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Set the name value of a keyName.
+// Input : *pszSetName -
+//-----------------------------------------------------------------------------
+void KeyValues::SetName(const char* pszSetName)
+{
+ HKeySymbol hCaseSensitiveKeyName = INVALID_KEY_SYMBOL, hCaseInsensitiveKeyName = INVALID_KEY_SYMBOL;
+ hCaseSensitiveKeyName =
+ KeyValuesSystem()->m_pVtable->GetSymbolForStringCaseSensitive(KeyValuesSystem(), hCaseInsensitiveKeyName, pszSetName, false);
+
+ m_iKeyName = hCaseInsensitiveKeyName;
+ SPLIT_3_BYTES_INTO_1_AND_2(m_iKeyNameCaseSensitive1, m_iKeyNameCaseSensitive2, hCaseSensitiveKeyName);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Set the pointer value of a keyName.
+// Input : *pszKeyName -
+// *pValue -
+//-----------------------------------------------------------------------------
+void KeyValues::SetPtr(const char* pszKeyName, void* pValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, true);
+
+ if (pKey)
+ {
+ pKey->m_pValue = pValue;
+ pKey->m_iDataType = TYPE_PTR;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Set the string value (internal)
+// Input : *pszValue -
+//-----------------------------------------------------------------------------
+void KeyValues::SetStringValue(char const* pszValue)
+{
+ // delete the old value
+ delete[] m_sValue;
+ // make sure we're not storing the WSTRING - as we're converting over to STRING
+ delete[] m_wsValue;
+ m_wsValue = nullptr;
+
+ if (!pszValue)
+ {
+ // ensure a valid value
+ pszValue = "";
+ }
+
+ // allocate memory for the new value and copy it in
+ size_t len = strlen(pszValue);
+ m_sValue = new char[len + 1];
+ memcpy(m_sValue, pszValue, len + 1);
+
+ m_iDataType = TYPE_STRING;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Sets this key's peer to the KeyValues passed in
+// Input : *pDat -
+//-----------------------------------------------------------------------------
+void KeyValues::SetNextKey(KeyValues* pDat)
+{
+ m_pPeer = pDat;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Set the string value of a keyName.
+// Input : *pszKeyName -
+// *pszValue -
+//-----------------------------------------------------------------------------
+void KeyValues::SetString(const char* pszKeyName, const char* pszValue)
+{
+ if (KeyValues* pKey = FindKey(pszKeyName, true))
+ {
+ pKey->SetStringValue(pszValue);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Set the string value of a keyName.
+// Input : *pszKeyName -
+// *pwszValue -
+//-----------------------------------------------------------------------------
+void KeyValues::SetWString(const char* pszKeyName, const wchar_t* pwszValue)
+{
+ KeyValues* pKey = FindKey(pszKeyName, true);
+ if (pKey)
+ {
+ // delete the old value
+ delete[] pKey->m_wsValue;
+ // make sure we're not storing the STRING - as we're converting over to WSTRING
+ delete[] pKey->m_sValue;
+ pKey->m_sValue = nullptr;
+
+ if (!pwszValue)
+ {
+ // ensure a valid value
+ pwszValue = L"";
+ }
+
+ // allocate memory for the new value and copy it in
+ size_t len = wcslen(pwszValue);
+ pKey->m_wsValue = new wchar_t[len + 1];
+ memcpy(pKey->m_wsValue, pwszValue, (len + 1) * sizeof(wchar_t));
+
+ pKey->m_iDataType = TYPE_WSTRING;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Sets a color
+// Input : *pszKeyName -
+// color -
+//-----------------------------------------------------------------------------
+void KeyValues::SetColor(const char* pszKeyName, Color color)
+{
+ KeyValues* pKey = FindKey(pszKeyName, true);
+
+ if (pKey)
+ {
+ pKey->m_iDataType = TYPE_COLOR;
+ pKey->m_Color[0] = color[0];
+ pKey->m_Color[1] = color[1];
+ pKey->m_Color[2] = color[2];
+ pKey->m_Color[3] = color[3];
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+// Input : &src -
+//-----------------------------------------------------------------------------
+void KeyValues::RecursiveCopyKeyValues(KeyValues& src)
+{
+ // garymcthack - need to check this code for possible buffer overruns.
+
+ m_iKeyName = src.m_iKeyName;
+ m_iKeyNameCaseSensitive1 = src.m_iKeyNameCaseSensitive1;
+ m_iKeyNameCaseSensitive2 = src.m_iKeyNameCaseSensitive2;
+
+ if (!src.m_pSub)
+ {
+ m_iDataType = src.m_iDataType;
+ char buf[256];
+ switch (src.m_iDataType)
+ {
+ case TYPE_NONE:
+ break;
+ case TYPE_STRING:
+ if (src.m_sValue)
+ {
+ size_t len = strlen(src.m_sValue) + 1;
+ m_sValue = new char[len];
+ strncpy(m_sValue, src.m_sValue, len);
+ }
+ break;
+ case TYPE_INT:
+ {
+ m_iValue = src.m_iValue;
+ snprintf(buf, sizeof(buf), "%d", m_iValue);
+ size_t len = strlen(buf) + 1;
+ m_sValue = new char[len];
+ strncpy(m_sValue, buf, len);
+ }
+ break;
+ case TYPE_FLOAT:
+ {
+ m_flValue = src.m_flValue;
+ snprintf(buf, sizeof(buf), "%f", m_flValue);
+ size_t len = strlen(buf) + 1;
+ m_sValue = new char[len];
+ strncpy(m_sValue, buf, len);
+ }
+ break;
+ case TYPE_PTR:
+ {
+ m_pValue = src.m_pValue;
+ }
+ break;
+ case TYPE_UINT64:
+ {
+ m_sValue = new char[sizeof(uint64_t)];
+ memcpy(m_sValue, src.m_sValue, sizeof(uint64_t));
+ }
+ break;
+ case TYPE_COLOR:
+ {
+ m_Color[0] = src.m_Color[0];
+ m_Color[1] = src.m_Color[1];
+ m_Color[2] = src.m_Color[2];
+ m_Color[3] = src.m_Color[3];
+ }
+ break;
+
+ default:
+ {
+ // do nothing . .what the heck is this?
+ assert(0);
+ }
+ break;
+ }
+ }
+
+ // Handle the immediate child
+ if (src.m_pSub)
+ {
+ m_pSub = new KeyValues;
+
+ m_pSub->Init();
+ m_pSub->SetName(nullptr);
+
+ m_pSub->RecursiveCopyKeyValues(*src.m_pSub);
+ }
+
+ // Handle the immediate peer
+ if (src.m_pPeer)
+ {
+ m_pPeer = new KeyValues;
+
+ m_pPeer->Init();
+ m_pPeer->SetName(nullptr);
+
+ m_pPeer->RecursiveCopyKeyValues(*src.m_pPeer);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Make a new copy of all subkeys, add them all to the passed-in keyvalues
+// Input : *pParent -
+//-----------------------------------------------------------------------------
+void KeyValues::CopySubkeys(KeyValues* pParent) const
+{
+ // recursively copy subkeys
+ // Also maintain ordering....
+ KeyValues* pPrev = nullptr;
+ for (KeyValues* pSub = m_pSub; pSub != nullptr; pSub = pSub->m_pPeer)
+ {
+ // take a copy of the subkey
+ KeyValues* pKey = pSub->MakeCopy();
+
+ // add into subkey list
+ if (pPrev)
+ {
+ pPrev->m_pPeer = pKey;
+ }
+ else
+ {
+ pParent->m_pSub = pKey;
+ }
+ pKey->m_pPeer = nullptr;
+ pPrev = pKey;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: Makes a copy of the whole key-value pair set
+// Output : KeyValues*
+//-----------------------------------------------------------------------------
+KeyValues* KeyValues::MakeCopy(void) const
+{
+ KeyValues* pNewKeyValue = new KeyValues;
+
+ pNewKeyValue->Init();
+ pNewKeyValue->SetName(GetName());
+
+ // copy data
+ pNewKeyValue->m_iDataType = m_iDataType;
+ switch (m_iDataType)
+ {
+ case TYPE_STRING:
+ {
+ if (m_sValue)
+ {
+ size_t len = strlen(m_sValue);
+ assert(!pNewKeyValue->m_sValue);
+ pNewKeyValue->m_sValue = new char[len + 1];
+ memcpy(pNewKeyValue->m_sValue, m_sValue, len + 1);
+ }
+ }
+ break;
+ case TYPE_WSTRING:
+ {
+ if (m_wsValue)
+ {
+ size_t len = wcslen(m_wsValue);
+ pNewKeyValue->m_wsValue = new wchar_t[len + 1];
+ memcpy(pNewKeyValue->m_wsValue, m_wsValue, len + 1 * sizeof(wchar_t));
+ }
+ }
+ break;
+
+ case TYPE_INT:
+ pNewKeyValue->m_iValue = m_iValue;
+ break;
+
+ case TYPE_FLOAT:
+ pNewKeyValue->m_flValue = m_flValue;
+ break;
+
+ case TYPE_PTR:
+ pNewKeyValue->m_pValue = m_pValue;
+ break;
+
+ case TYPE_COLOR:
+ pNewKeyValue->m_Color[0] = m_Color[0];
+ pNewKeyValue->m_Color[1] = m_Color[1];
+ pNewKeyValue->m_Color[2] = m_Color[2];
+ pNewKeyValue->m_Color[3] = m_Color[3];
+ break;
+
+ case TYPE_UINT64:
+ pNewKeyValue->m_sValue = new char[sizeof(uint64_t)];
+ memcpy(pNewKeyValue->m_sValue, m_sValue, sizeof(uint64_t));
+ break;
+ };
+
+ // recursively copy subkeys
+ CopySubkeys(pNewKeyValue);
+ return pNewKeyValue;
+}
+
+ON_DLL_LOAD("vstdlib.dll", KeyValues, (CModule module))
+{
+ V_UTF8ToUnicode = module.GetExport("V_UTF8ToUnicode").As<int (*)(const char*, wchar_t*, int)>();
+ V_UnicodeToUTF8 = module.GetExport("V_UnicodeToUTF8").As<int (*)(const wchar_t*, char*, int)>();
+ KeyValuesSystem = module.GetExport("KeyValuesSystem").As<CKeyValuesSystem* (*)()>();
+}
+
+AUTOHOOK_INIT()
+
+// clang-format off
+AUTOHOOK(KeyValues__LoadFromBuffer, engine.dll + 0x426C30,
+char, __fastcall, (KeyValues* self, const char* pResourceName, const char* pBuffer, void* pFileSystem, void* a5, void* a6, int a7))
+// clang-format on
+{
+ static void* pSavedFilesystemPtr = nullptr;
+
+ // this is just to allow playlists to get a valid pFileSystem ptr for kv building, other functions that call this particular overload of
+ // LoadFromBuffer seem to get called on network stuff exclusively not exactly sure what the address wanted here is, so just taking it
+ // from a function call that always happens before playlists is loaded
+
+ // note: would be better if we could serialize this to disk for playlists, as this method breaks saving playlists in demos
+ if (pFileSystem != nullptr)
+ pSavedFilesystemPtr = pFileSystem;
+ if (!pFileSystem && !strcmp(pResourceName, "playlists"))
+ pFileSystem = pSavedFilesystemPtr;
+
+ return KeyValues__LoadFromBuffer(self, pResourceName, pBuffer, pFileSystem, a5, a6, a7);
+}
+
+ON_DLL_LOAD("engine.dll", EngineKeyValues, (CModule module))
+{
+ AUTOHOOK_DISPATCH()
+}
diff --git a/NorthstarDLL/keyvalues.h b/NorthstarDLL/shared/keyvalues.h
index 3ea682d6..64ca0cc7 100644
--- a/NorthstarDLL/keyvalues.h
+++ b/NorthstarDLL/shared/keyvalues.h
@@ -1,134 +1,134 @@
-#pragma once
-#include "color.h"
-
-enum KeyValuesTypes_t : char
-{
- TYPE_NONE = 0x0,
- TYPE_STRING = 0x1,
- TYPE_INT = 0x2,
- TYPE_FLOAT = 0x3,
- TYPE_PTR = 0x4,
- TYPE_WSTRING = 0x5,
- TYPE_COLOR = 0x6,
- TYPE_UINT64 = 0x7,
- TYPE_COMPILED_INT_BYTE = 0x8,
- TYPE_COMPILED_INT_0 = 0x9,
- TYPE_COMPILED_INT_1 = 0xA,
- TYPE_NUMTYPES = 0xB,
-};
-
-enum MergeKeyValuesOp_t
-{
- MERGE_KV_ALL,
- MERGE_KV_UPDATE, // update values are copied into storage, adding new keys to storage or updating existing ones
- MERGE_KV_DELETE, // update values specify keys that get deleted from storage
- MERGE_KV_BORROW, // update values only update existing keys in storage, keys in update that do not exist in storage are discarded
-};
-
-//-----------------------------------------------------------------------------
-// Purpose: Simple recursive data access class
-// Used in vgui for message parameters and resource files
-// Destructor deletes all child KeyValues nodes
-// Data is stored in key (string names) - (string/int/float)value pairs called nodes.
-//
-// About KeyValues Text File Format:
-
-// It has 3 control characters '{', '}' and '"'. Names and values may be quoted or
-// not. The quote '"' character must not be used within name or values, only for
-// quoting whole tokens. You may use escape sequences wile parsing and add within a
-// quoted token a \" to add quotes within your name or token. When using Escape
-// Sequence the parser must now that by setting KeyValues::UsesEscapeSequences( true ),
-// which it's off by default. Non-quoted tokens ends with a whitespace, '{', '}' and '"'.
-// So you may use '{' and '}' within quoted tokens, but not for non-quoted tokens.
-// An open bracket '{' after a key name indicates a list of subkeys which is finished
-// with a closing bracket '}'. Subkeys use the same definitions recursively.
-// Whitespaces are space, return, newline and tabulator. Allowed Escape sequences
-// are \n, \t, \\, \n and \". The number character '#' is used for macro purposes
-// (eg #include), don't use it as first character in key names.
-//-----------------------------------------------------------------------------
-class KeyValues
-{
- private:
- KeyValues(); // for internal use only
-
- public:
- // Constructors/destructors
- KeyValues(const char* pszSetName);
- KeyValues(const char* pszSetName, const char* pszFirstKey, const char* pszFirstValue);
- KeyValues(const char* pszSetName, const char* pszFirstKey, const wchar_t* pwszFirstValue);
- KeyValues(const char* pszSetName, const char* pszFirstKey, int iFirstValue);
- KeyValues(
- const char* pszSetName, const char* pszFirstKey, const char* pszFirstValue, const char* pszSecondKey, const char* pszSecondValue);
- KeyValues(const char* pszSetName, const char* pszFirstKey, int iFirstValue, const char* pszSecondKey, int iSecondValue);
- ~KeyValues(void);
-
- void Init(void);
- void Clear(void);
- void DeleteThis(void);
- void RemoveEverything();
-
- KeyValues* FindKey(const char* pKeyName, bool bCreate = false);
- KeyValues* FindLastSubKey(void) const;
-
- void AddSubKey(KeyValues* pSubkey);
- void RemoveSubKey(KeyValues* pSubKey);
- void InsertSubKey(int nIndex, KeyValues* pSubKey);
- bool ContainsSubKey(KeyValues* pSubKey);
- void SwapSubKey(KeyValues* pExistingSubkey, KeyValues* pNewSubKey);
- void ElideSubKey(KeyValues* pSubKey);
-
- // Data access
- bool IsEmpty(const char* pszKeyName);
- KeyValues* GetFirstTrueSubKey(void) const;
- KeyValues* GetNextTrueSubKey(void) const;
- KeyValues* GetFirstValue(void) const;
- KeyValues* GetNextValue(void) const;
- KeyValues* GetFirstSubKey() const;
- KeyValues* GetNextKey() const;
- const char* GetName(void) const;
- int GetInt(const char* pszKeyName, int iDefaultValue);
- uint64_t GetUint64(const char* pszKeyName, uint64_t nDefaultValue);
- void* GetPtr(const char* pszKeyName, void* pDefaultValue);
- float GetFloat(const char* pszKeyName, float flDefaultValue);
- const char* GetString(const char* pszKeyName = nullptr, const char* pszDefaultValue = "");
- const wchar_t* GetWString(const char* pszKeyName = nullptr, const wchar_t* pwszDefaultValue = L"");
- Color GetColor(const char* pszKeyName, const Color& defaultColor);
- KeyValuesTypes_t GetDataType(const char* pszKeyName);
- KeyValuesTypes_t GetDataType(void) const;
-
- // Key writing
- void SetInt(const char* pszKeyName, int iValue);
- void SetUint64(const char* pszKeyName, uint64_t nValue);
- void SetPtr(const char* pszKeyName, void* pValue);
- void SetNextKey(KeyValues* pDat);
- void SetName(const char* pszName);
- void SetString(const char* pszKeyName, const char* pszValue);
- void SetWString(const char* pszKeyName, const wchar_t* pwszValue);
- void SetStringValue(char const* pszValue);
- void SetColor(const char* pszKeyName, Color color);
- void SetFloat(const char* pszKeyName, float flValue);
-
- void RecursiveCopyKeyValues(KeyValues& src);
- void CopySubkeys(KeyValues* pParent) const;
- KeyValues* MakeCopy(void) const;
-
- public:
- uint32_t m_iKeyName : 24; // 0x0000
- uint32_t m_iKeyNameCaseSensitive1 : 8; // 0x0003
- char* m_sValue; // 0x0008
- wchar_t* m_wsValue; // 0x0010
- union // 0x0018
- {
- int m_iValue;
- float m_flValue;
- void* m_pValue;
- unsigned char m_Color[4];
- };
- char m_szShortName[8]; // 0x0020
- char m_iDataType; // 0x0028
- char m_bHasEscapeSequences; // 0x0029
- uint16_t m_iKeyNameCaseSensitive2; // 0x002A
- KeyValues* m_pPeer; // 0x0030
- KeyValues* m_pSub; // 0x0038
- KeyValues* m_pChain; // 0x0040
-};
+#pragma once
+#include "core/math/color.h"
+
+enum KeyValuesTypes_t : char
+{
+ TYPE_NONE = 0x0,
+ TYPE_STRING = 0x1,
+ TYPE_INT = 0x2,
+ TYPE_FLOAT = 0x3,
+ TYPE_PTR = 0x4,
+ TYPE_WSTRING = 0x5,
+ TYPE_COLOR = 0x6,
+ TYPE_UINT64 = 0x7,
+ TYPE_COMPILED_INT_BYTE = 0x8,
+ TYPE_COMPILED_INT_0 = 0x9,
+ TYPE_COMPILED_INT_1 = 0xA,
+ TYPE_NUMTYPES = 0xB,
+};
+
+enum MergeKeyValuesOp_t
+{
+ MERGE_KV_ALL,
+ MERGE_KV_UPDATE, // update values are copied into storage, adding new keys to storage or updating existing ones
+ MERGE_KV_DELETE, // update values specify keys that get deleted from storage
+ MERGE_KV_BORROW, // update values only update existing keys in storage, keys in update that do not exist in storage are discarded
+};
+
+//-----------------------------------------------------------------------------
+// Purpose: Simple recursive data access class
+// Used in vgui for message parameters and resource files
+// Destructor deletes all child KeyValues nodes
+// Data is stored in key (string names) - (string/int/float)value pairs called nodes.
+//
+// About KeyValues Text File Format:
+
+// It has 3 control characters '{', '}' and '"'. Names and values may be quoted or
+// not. The quote '"' character must not be used within name or values, only for
+// quoting whole tokens. You may use escape sequences wile parsing and add within a
+// quoted token a \" to add quotes within your name or token. When using Escape
+// Sequence the parser must now that by setting KeyValues::UsesEscapeSequences( true ),
+// which it's off by default. Non-quoted tokens ends with a whitespace, '{', '}' and '"'.
+// So you may use '{' and '}' within quoted tokens, but not for non-quoted tokens.
+// An open bracket '{' after a key name indicates a list of subkeys which is finished
+// with a closing bracket '}'. Subkeys use the same definitions recursively.
+// Whitespaces are space, return, newline and tabulator. Allowed Escape sequences
+// are \n, \t, \\, \n and \". The number character '#' is used for macro purposes
+// (eg #include), don't use it as first character in key names.
+//-----------------------------------------------------------------------------
+class KeyValues
+{
+ private:
+ KeyValues(); // for internal use only
+
+ public:
+ // Constructors/destructors
+ KeyValues(const char* pszSetName);
+ KeyValues(const char* pszSetName, const char* pszFirstKey, const char* pszFirstValue);
+ KeyValues(const char* pszSetName, const char* pszFirstKey, const wchar_t* pwszFirstValue);
+ KeyValues(const char* pszSetName, const char* pszFirstKey, int iFirstValue);
+ KeyValues(
+ const char* pszSetName, const char* pszFirstKey, const char* pszFirstValue, const char* pszSecondKey, const char* pszSecondValue);
+ KeyValues(const char* pszSetName, const char* pszFirstKey, int iFirstValue, const char* pszSecondKey, int iSecondValue);
+ ~KeyValues(void);
+
+ void Init(void);
+ void Clear(void);
+ void DeleteThis(void);
+ void RemoveEverything();
+
+ KeyValues* FindKey(const char* pKeyName, bool bCreate = false);
+ KeyValues* FindLastSubKey(void) const;
+
+ void AddSubKey(KeyValues* pSubkey);
+ void RemoveSubKey(KeyValues* pSubKey);
+ void InsertSubKey(int nIndex, KeyValues* pSubKey);
+ bool ContainsSubKey(KeyValues* pSubKey);
+ void SwapSubKey(KeyValues* pExistingSubkey, KeyValues* pNewSubKey);
+ void ElideSubKey(KeyValues* pSubKey);
+
+ // Data access
+ bool IsEmpty(const char* pszKeyName);
+ KeyValues* GetFirstTrueSubKey(void) const;
+ KeyValues* GetNextTrueSubKey(void) const;
+ KeyValues* GetFirstValue(void) const;
+ KeyValues* GetNextValue(void) const;
+ KeyValues* GetFirstSubKey() const;
+ KeyValues* GetNextKey() const;
+ const char* GetName(void) const;
+ int GetInt(const char* pszKeyName, int iDefaultValue);
+ uint64_t GetUint64(const char* pszKeyName, uint64_t nDefaultValue);
+ void* GetPtr(const char* pszKeyName, void* pDefaultValue);
+ float GetFloat(const char* pszKeyName, float flDefaultValue);
+ const char* GetString(const char* pszKeyName = nullptr, const char* pszDefaultValue = "");
+ const wchar_t* GetWString(const char* pszKeyName = nullptr, const wchar_t* pwszDefaultValue = L"");
+ Color GetColor(const char* pszKeyName, const Color& defaultColor);
+ KeyValuesTypes_t GetDataType(const char* pszKeyName);
+ KeyValuesTypes_t GetDataType(void) const;
+
+ // Key writing
+ void SetInt(const char* pszKeyName, int iValue);
+ void SetUint64(const char* pszKeyName, uint64_t nValue);
+ void SetPtr(const char* pszKeyName, void* pValue);
+ void SetNextKey(KeyValues* pDat);
+ void SetName(const char* pszName);
+ void SetString(const char* pszKeyName, const char* pszValue);
+ void SetWString(const char* pszKeyName, const wchar_t* pwszValue);
+ void SetStringValue(char const* pszValue);
+ void SetColor(const char* pszKeyName, Color color);
+ void SetFloat(const char* pszKeyName, float flValue);
+
+ void RecursiveCopyKeyValues(KeyValues& src);
+ void CopySubkeys(KeyValues* pParent) const;
+ KeyValues* MakeCopy(void) const;
+
+ public:
+ uint32_t m_iKeyName : 24; // 0x0000
+ uint32_t m_iKeyNameCaseSensitive1 : 8; // 0x0003
+ char* m_sValue; // 0x0008
+ wchar_t* m_wsValue; // 0x0010
+ union // 0x0018
+ {
+ int m_iValue;
+ float m_flValue;
+ void* m_pValue;
+ unsigned char m_Color[4];
+ };
+ char m_szShortName[8]; // 0x0020
+ char m_iDataType; // 0x0028
+ char m_bHasEscapeSequences; // 0x0029
+ uint16_t m_iKeyNameCaseSensitive2; // 0x002A
+ KeyValues* m_pPeer; // 0x0030
+ KeyValues* m_pSub; // 0x0038
+ KeyValues* m_pChain; // 0x0040
+};
diff --git a/NorthstarDLL/maxplayers.cpp b/NorthstarDLL/shared/maxplayers.cpp
index ece8d14b..ebb44341 100644
--- a/NorthstarDLL/maxplayers.cpp
+++ b/NorthstarDLL/shared/maxplayers.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "tier0.h"
+#include "core/tier0.h"
#include "maxplayers.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/maxplayers.h b/NorthstarDLL/shared/maxplayers.h
index b251f6a6..b251f6a6 100644
--- a/NorthstarDLL/maxplayers.h
+++ b/NorthstarDLL/shared/maxplayers.h
diff --git a/NorthstarDLL/misccommands.cpp b/NorthstarDLL/shared/misccommands.cpp
index f877dcc0..ad8b2a32 100644
--- a/NorthstarDLL/misccommands.cpp
+++ b/NorthstarDLL/shared/misccommands.cpp
@@ -1,15 +1,15 @@
#include "pch.h"
#include "misccommands.h"
-#include "concommand.h"
-#include "playlist.h"
-#include "r2engine.h"
-#include "r2client.h"
-#include "tier0.h"
-#include "hoststate.h"
-#include "masterserver.h"
-#include "modmanager.h"
-#include "serverauthentication.h"
-#include "squirrel.h"
+#include "core/convar/concommand.h"
+#include "shared/playlist.h"
+#include "engine/r2engine.h"
+#include "client/r2client.h"
+#include "core/tier0.h"
+#include "engine/hoststate.h"
+#include "masterserver/masterserver.h"
+#include "mods/modmanager.h"
+#include "server/auth/serverauthentication.h"
+#include "squirrel/squirrel.h"
void ConCommand_force_newgame(const CCommand& arg)
{
@@ -202,7 +202,6 @@ void FixupCvarFlags()
{"cam_collision", FCVAR_DEVELOPMENTONLY},
{"cam_idealdelta", FCVAR_DEVELOPMENTONLY},
{"cam_ideallag", FCVAR_DEVELOPMENTONLY},
- {"r_drawviewmodel", FCVAR_CHEAT}, // this is a cheat command, but shouldn't be as you can achieve similar effects through mods
// graphics/visual settings
{"mat_colorcorrection", FCVAR_DEVELOPMENTONLY},
diff --git a/NorthstarDLL/misccommands.h b/NorthstarDLL/shared/misccommands.h
index 07a07fb3..07a07fb3 100644
--- a/NorthstarDLL/misccommands.h
+++ b/NorthstarDLL/shared/misccommands.h
diff --git a/NorthstarDLL/playlist.cpp b/NorthstarDLL/shared/playlist.cpp
index 4f34dbb1..2fb856b3 100644
--- a/NorthstarDLL/playlist.cpp
+++ b/NorthstarDLL/shared/playlist.cpp
@@ -1,10 +1,10 @@
#include "pch.h"
#include "playlist.h"
-#include "concommand.h"
-#include "convar.h"
-#include "squirrel.h"
-#include "hoststate.h"
-#include "serverpresence.h"
+#include "core/convar/concommand.h"
+#include "core/convar/convar.h"
+#include "squirrel/squirrel.h"
+#include "engine/hoststate.h"
+#include "server/serverpresence.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/playlist.h b/NorthstarDLL/shared/playlist.h
index c77b37d9..c77b37d9 100644
--- a/NorthstarDLL/playlist.h
+++ b/NorthstarDLL/shared/playlist.h
diff --git a/NorthstarDLL/sourceinterface.cpp b/NorthstarDLL/shared/sourceinterface.cpp
index d5f7b7cd..ed95de50 100644
--- a/NorthstarDLL/sourceinterface.cpp
+++ b/NorthstarDLL/shared/sourceinterface.cpp
@@ -1,6 +1,6 @@
#include "pch.h"
#include "sourceinterface.h"
-#include "sourceconsole.h"
+#include "console/sourceconsole.h"
AUTOHOOK_INIT()
diff --git a/NorthstarDLL/sourceinterface.h b/NorthstarDLL/shared/sourceinterface.h
index 474e961b..474e961b 100644
--- a/NorthstarDLL/sourceinterface.h
+++ b/NorthstarDLL/shared/sourceinterface.h
diff --git a/NorthstarDLL/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp
index 3d62ac62..eb4b6bed 100644
--- a/NorthstarDLL/squirrel.cpp
+++ b/NorthstarDLL/squirrel/squirrel.cpp
@@ -1,10 +1,10 @@
#include "pch.h"
#include "squirrel.h"
-#include "concommand.h"
-#include "modmanager.h"
-#include "dedicated.h"
-#include "r2engine.h"
-#include "tier0.h"
+#include "core/convar/concommand.h"
+#include "mods/modmanager.h"
+#include "dedicated/dedicated.h"
+#include "engine/r2engine.h"
+#include "core/tier0.h"
#include <any>
@@ -317,11 +317,11 @@ template <ScriptContext context> CSquirrelVM* __fastcall CreateNewVMHook(void* a
return sqvm;
}
-template <ScriptContext context> void (*__fastcall DestroyVM)(void* a1, CSquirrelVM* sqvm);
-template <ScriptContext context> void __fastcall DestroyVMHook(void* a1, CSquirrelVM* sqvm)
+template <ScriptContext context> void (*__fastcall DestroyVM)(void* a1, HSquirrelVM* sqvm);
+template <ScriptContext context> void __fastcall DestroyVMHook(void* a1, HSquirrelVM* sqvm)
{
ScriptContext realContext = context; // ui and client use the same function so we use this for prints
- if (IsUIVM(context, sqvm->sqvm))
+ if (IsUIVM(context, sqvm))
{
realContext = ScriptContext::UI;
g_pSquirrel<ScriptContext::UI>->VMDestroyed();
@@ -329,7 +329,7 @@ template <ScriptContext context> void __fastcall DestroyVMHook(void* a1, CSquirr
}
else
{
- g_pSquirrel<context>->VMDestroyed();
+ g_pSquirrel<context>->m_pSQVM = nullptr; // Fixes a race-like bug
DestroyVM<context>(a1, sqvm);
}
diff --git a/NorthstarDLL/squirrel.h b/NorthstarDLL/squirrel/squirrel.h
index a1f1dd5f..3e3d08c9 100644
--- a/NorthstarDLL/squirrel.h
+++ b/NorthstarDLL/squirrel/squirrel.h
@@ -1,9 +1,9 @@
#pragma once
+#include "logging/logging.h"
#include "squirrelclasstypes.h"
#include "squirrelautobind.h"
-#include "vector.h"
-#include "logging.h"
+#include "core/math/vector.h"
// stolen from ttf2sdk: sqvm types
typedef float SQFloat;
@@ -122,7 +122,7 @@ class SquirrelManagerBase
return __sq_call(sqvm, args + 1, false, false);
}
- inline SQInteger raiseerror(HSquirrelVM* sqvm, const const SQChar* sError)
+ inline SQInteger raiseerror(HSquirrelVM* sqvm, const SQChar* sError)
{
return __sq_raiseerror(sqvm, sError);
}
diff --git a/NorthstarDLL/squirrelautobind.cpp b/NorthstarDLL/squirrel/squirrelautobind.cpp
index d5f42477..d5f42477 100644
--- a/NorthstarDLL/squirrelautobind.cpp
+++ b/NorthstarDLL/squirrel/squirrelautobind.cpp
diff --git a/NorthstarDLL/squirrelautobind.h b/NorthstarDLL/squirrel/squirrelautobind.h
index 865479a1..865479a1 100644
--- a/NorthstarDLL/squirrelautobind.h
+++ b/NorthstarDLL/squirrel/squirrelautobind.h
diff --git a/NorthstarDLL/squirrelclasstypes.h b/NorthstarDLL/squirrel/squirrelclasstypes.h
index e26bc8d0..e26bc8d0 100644
--- a/NorthstarDLL/squirrelclasstypes.h
+++ b/NorthstarDLL/squirrel/squirrelclasstypes.h
diff --git a/NorthstarDLL/squirreldatatypes.h b/NorthstarDLL/squirrel/squirreldatatypes.h
index e9f88d08..e9f88d08 100644
--- a/NorthstarDLL/squirreldatatypes.h
+++ b/NorthstarDLL/squirrel/squirreldatatypes.h
diff --git a/NorthstarDLL/printcommands.cpp b/NorthstarDLL/util/printcommands.cpp
index 90af1575..5552c50c 100644
--- a/NorthstarDLL/printcommands.cpp
+++ b/NorthstarDLL/util/printcommands.cpp
@@ -1,7 +1,7 @@
#include "pch.h"
-#include "printcommand.h"
-#include "convar.h"
-#include "concommand.h"
+#include "printcommands.h"
+#include "core/convar/convar.h"
+#include "core/convar/concommand.h"
void PrintCommandHelpDialogue(const ConCommandBase* command, const char* name)
{
diff --git a/NorthstarDLL/printcommand.h b/NorthstarDLL/util/printcommands.h
index 6c3ef850..cb72e5cc 100644
--- a/NorthstarDLL/printcommand.h
+++ b/NorthstarDLL/util/printcommands.h
@@ -1,5 +1,5 @@
#pragma once
-#include "concommand.h"
+#include "core/convar/concommand.h"
void PrintCommandHelpDialogue(const ConCommandBase* command, const char* name);
void TryPrintCvarHelpForCommand(const char* pCommand);
diff --git a/NorthstarDLL/printmaps.cpp b/NorthstarDLL/util/printmaps.cpp
index c378daad..e0192d69 100644
--- a/NorthstarDLL/printmaps.cpp
+++ b/NorthstarDLL/util/printmaps.cpp
@@ -1,10 +1,10 @@
#include "pch.h"
#include "printmaps.h"
-#include "convar.h"
-#include "concommand.h"
-#include "modmanager.h"
-#include "tier0.h"
-#include "r2engine.h"
+#include "core/convar/convar.h"
+#include "core/convar/concommand.h"
+#include "mods/modmanager.h"
+#include "core/tier0.h"
+#include "engine/r2engine.h"
#include <filesystem>
#include <regex>
diff --git a/NorthstarDLL/printmaps.h b/NorthstarDLL/util/printmaps.h
index b01761c0..b01761c0 100644
--- a/NorthstarDLL/printmaps.h
+++ b/NorthstarDLL/util/printmaps.h
diff --git a/NorthstarDLL/version.cpp b/NorthstarDLL/util/version.cpp
index 088fb491..8697b61f 100644
--- a/NorthstarDLL/version.cpp
+++ b/NorthstarDLL/util/version.cpp
@@ -1,7 +1,7 @@
-#include "version.h"
+#include "util/version.h"
#include "pch.h"
#include "ns_version.h"
-#include "dedicated.h"
+#include "dedicated/dedicated.h"
char version[16];
char NSUserAgent[256];
diff --git a/NorthstarDLL/version.h b/NorthstarDLL/util/version.h
index 261a4cf1..261a4cf1 100644
--- a/NorthstarDLL/version.h
+++ b/NorthstarDLL/util/version.h