From 2f2b497aca23239406ce3f8d94f29f10d205a68b Mon Sep 17 00:00:00 2001 From: BobTheBob9 Date: Thu, 1 Sep 2022 23:08:58 +0100 Subject: add scriptdatatable.cpp rewrite --- NorthstarDLL/NorthstarDLL.vcxproj | 1 + NorthstarDLL/NorthstarDLL.vcxproj.filters | 3597 ++++++++++---------- NorthstarDLL/audio.h | 2 - NorthstarDLL/buildainfile.cpp | 2 - NorthstarDLL/clientchathooks.cpp | 12 +- NorthstarDLL/debugoverlay.cpp | 11 +- NorthstarDLL/dllmain.cpp | 1 - NorthstarDLL/exploitfixes.cpp | 14 +- NorthstarDLL/hooks.cpp | 2 - NorthstarDLL/languagehooks.cpp | 2 - NorthstarDLL/masterserver.cpp | 4 +- NorthstarDLL/misccommands.cpp | 2 +- NorthstarDLL/modmanager.h | 2 - NorthstarDLL/pch.h | 2 + NorthstarDLL/scriptdatatables.cpp | 1177 +++---- NorthstarDLL/scriptservertoclientstringcommand.cpp | 6 +- NorthstarDLL/serverchathooks.cpp | 8 +- NorthstarDLL/squirrel.cpp | 250 +- NorthstarDLL/squirrel.h | 37 +- NorthstarDLL/squirreldatatypes.h | 18 +- NorthstarDLL/vector.h | 44 + 21 files changed, 2618 insertions(+), 2576 deletions(-) create mode 100644 NorthstarDLL/vector.h (limited to 'NorthstarDLL') diff --git a/NorthstarDLL/NorthstarDLL.vcxproj b/NorthstarDLL/NorthstarDLL.vcxproj index e4cce334..ac1b3991 100644 --- a/NorthstarDLL/NorthstarDLL.vcxproj +++ b/NorthstarDLL/NorthstarDLL.vcxproj @@ -559,6 +559,7 @@ + diff --git a/NorthstarDLL/NorthstarDLL.vcxproj.filters b/NorthstarDLL/NorthstarDLL.vcxproj.filters index ab788fff..293543f7 100644 --- a/NorthstarDLL/NorthstarDLL.vcxproj.filters +++ b/NorthstarDLL/NorthstarDLL.vcxproj.filters @@ -1,1798 +1,1801 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {d4199e4b-10d2-43ce-af9c-e1fa79e1e64e} - - - {b6f79919-9735-476d-8798-067a75cbeca0} - - - {ca657be5-c2d8-4322-a689-1154aaafe57b} - - - {8596cc1c-0492-4467-91e3-1f03b7e19f77} - - - {11eaa578-6336-456e-9c7c-8bd202470945} - - - {7ecd75d2-7eee-41c4-87b6-3b7c2213f34e} - - - {8afc70f1-639c-49ef-9348-ef6dcece114e} - - - {398efed5-0a92-4d32-b5ba-b4a725b2a70a} - - - {74567974-c66b-45ef-ab28-97b7154ca224} - - - {4ca5392e-7d3d-4066-833f-f534cd5787c3} - - - {94b15898-ef33-41c7-995a-31791fccb7e2} - - - {6495657f-ea55-4552-8aa7-b54eb8e86a99} - - - {85aacdee-0f92-4ec4-b20c-0739c1175055} - - - {3d41d3fc-8a3b-4358-b3e8-4f06dc96abfe} - - - {d69760a9-d5ec-4f3e-8f43-f74041654d44} - - - {365e5c1f-4b2f-4d8b-a1d8-cdef401ca689} - - - {24fd0855-9288-4129-93ba-c6cafdc98d1b} - - - {4cb0dd89-5f16-4549-a864-34ca3075352a} - - - {914d8b8f-6b19-4f23-b746-f40062d72906} - - - {09516029-fac7-4235-ad61-402977534a0b} - - - {8cc1ae44-9dbf-4719-91a2-82e00b8d78e2} - - - {ea1e17a6-40b7-4e1b-8edb-e9ae704ce604} - - - {51910ba0-2ff8-461d-9f67-8d7907b57d22} - - - {325e0d7d-6832-496d-8d8e-968fdfa5dd40} - - - {802d0771-62f1-4733-89f9-57a4d8864b8d} - - - {04fd662a-6e70-494c-b720-c694a5cc2fb1} - - - {a18afb37-5fdd-4340-a6b4-a6541593e398} - - - {4a8a695a-a103-4b1f-b314-0ec19a253119} - - - {d8a83b5e-9a23-4124-824f-eab37880cb08} - - - {2cbddb28-0b17-4881-847d-8773da52b268} - - - {4db0d1e9-9035-457f-87f1-5dc3f13b6b9e} - - - {59b0f68f-daa7-4641-b6fa-8464b56da2bb} - - - {3e892d07-2239-44da-9cf3-c288a34cf9a2} - - - {14fc0931-acad-46ec-a55e-94f4469d4235} - - - {947835db-67d6-42c0-870d-62743f85231f} - - - {bf0769d8-40fd-4701-85e9-7ed94aab2283} - - - {9751b551-5886-45d4-a039-cbd10445263d} - - - {96101d42-72af-4fd1-8559-8d1d1ff66240} - - - {ee3ba13a-3061-41d7-981d-328ac2596fd2} - - - {0c93d909-e0d6-4c35-a8a4-a13f681a1012} - - - {94259c8c-5411-48bf-af4f-46ca32b7d0bb} - - - {44a83740-9d70-480d-9a7a-43b81f8eab9e} - - - {6bbce8a5-38b4-4763-a7cb-4e98012ec245} - - - {826d5193-3ad0-434b-ba7c-dd24ed4bbd0c} - - - {0f1ba4c4-78ee-4b05-afa5-6f598063f5c1} - - - {ca669b16-b8bb-4654-993f-fffa44c914f1} - - - {26365f16-ff52-4e80-a01b-2ca020376c93} - - - {7263403a-7550-4aa2-a724-f622ab200eed} - - - - - Header Files - - - Header Files\include - - - Header Files - - - Header Files\Client - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog - - - Header Files\include\spdlog\cfg - - - Header Files\include\spdlog\cfg - - - Header Files\include\spdlog\cfg - - - Header Files\include\spdlog\cfg - - - Header Files\include\spdlog\fmt - - - Header Files\include\spdlog\fmt - - - Header Files\include\spdlog\fmt - - - Header Files\include\spdlog\fmt - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\sinks - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\spdlog\details - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson - - - Header Files\include\rapidjson\error - - - Header Files\include\rapidjson\error - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\internal - - - Header Files\include\rapidjson\msinttypes - - - Header Files\include\rapidjson\msinttypes - - - Header Files\Server\Authentication - - - Header Files\include - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\openssl\internal - - - Header Files\include\libcurl - - - Header Files\include\libcurl - - - Header Files\include\libcurl - - - Header Files\include\libcurl - - - Header Files\include\libcurl - - - Header Files\include\libcurl - - - Header Files\include\libcurl - - - Header Files\include\libcurl - - - Header Files\include\libcurl - - - Header Files\include\libcurl - - - Header Files\Server\Authentication - - - Header Files\Client - - - Header Files\Client - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files\Server\Scripted - - - Header Files\Dedicated Server - - - Header Files - - - Source Files\Exploit Fixes - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files\Math - - - Header Files\Math - - - Header Files\Convar - - - Header Files\Convar - - - Header Files\Convar - - - Header Files\Filesystem - - - Header Files\Hooks - - - Header Files\Exploit Fixes - - - Header Files\Console - - - Header Files\Convar - - - Header Files\Mods - - - Header Files\Mods\Compiled Assets - - - Header Files\Console - - - Header Files\Console - - - Header Files\Game Functions - - - Header Files\Game Functions - - - Header Files\Game Functions - - - Header Files\Mods\Compiled Assets - - - Header Files\Game Functions - - - Header Files\Hooks - - - Header Files\Filesystem - - - Header Files\Math - - - Header Files\Server - - - Header Files\Hooks - - - Header Files - - - Header Files\Squirrel - - - Header Files\Squirrel - - - - - Source Files - - - Source Files\Dedicated Server - - - Source Files\Client - - - Source Files\Mods - - - Source Files\Mods\Compiled Assets - - - Source Files\Server\Authentication - - - Source Files\Mods\Compiled Assets - - - Source Files\Client - - - Source Files\Client - - - Source Files\Dedicated Server - - - Source Files\Mods\Compiled Assets - - - Source Files\Client - - - Source Files\Server - - - Source Files\Server\Authentication - - - Source Files\Client - - - Source Files\Client - - - Source Files\Client - - - Source Files\Server - - - Source Files\Client - - - Source Files - - - Source Files\Client - - - Source Files\Client - - - Source Files - - - Source Files\Client - - - Source Files\Client\Scripted - - - Source Files\Client\Scripted - - - Source Files\Client\Scripted - - - Source Files\Client\Scripted - - - Source Files\Client\Scripted - - - Source Files\Client\Scripted - - - Source Files\Server\Scripted - - - Source Files\Server\Scripted - - - Source Files\Client - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files\Game Functions - - - Source Files\Game Functions - - - Source Files\Game Functions - - - Source Files\Filesystem - - - Source Files\Filesystem - - - Source Files\Exploit Fixes - - - Source Files\Exploit Fixes - - - Source Files\Hooks - - - Source Files\Hooks - - - Source Files\Math - - - Source Files\Convar - - - Source Files\Convar - - - Source Files\Console - - - Source Files\Console - - - Source Files\Convar - - - Source Files\Convar - - - Source Files\Game Functions - - - Source Files\Console - - - Source Files\Server - - - Source Files - - - Source Files\Hooks - - - Source Files\Exploit Fixes - - - Source Files\Scripted - - - Source Files\Scripted - - - Source Files\Squirrel - - - Source Files\Scripted - - - - - Source Files\Client - - - - - Header Files\include\spdlog\fmt\bundled - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\openssl - - - Header Files\include\openssl\crypto - - - Header Files\include\openssl\crypto - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {d4199e4b-10d2-43ce-af9c-e1fa79e1e64e} + + + {b6f79919-9735-476d-8798-067a75cbeca0} + + + {ca657be5-c2d8-4322-a689-1154aaafe57b} + + + {8596cc1c-0492-4467-91e3-1f03b7e19f77} + + + {11eaa578-6336-456e-9c7c-8bd202470945} + + + {7ecd75d2-7eee-41c4-87b6-3b7c2213f34e} + + + {8afc70f1-639c-49ef-9348-ef6dcece114e} + + + {398efed5-0a92-4d32-b5ba-b4a725b2a70a} + + + {74567974-c66b-45ef-ab28-97b7154ca224} + + + {4ca5392e-7d3d-4066-833f-f534cd5787c3} + + + {94b15898-ef33-41c7-995a-31791fccb7e2} + + + {6495657f-ea55-4552-8aa7-b54eb8e86a99} + + + {85aacdee-0f92-4ec4-b20c-0739c1175055} + + + {3d41d3fc-8a3b-4358-b3e8-4f06dc96abfe} + + + {d69760a9-d5ec-4f3e-8f43-f74041654d44} + + + {365e5c1f-4b2f-4d8b-a1d8-cdef401ca689} + + + {24fd0855-9288-4129-93ba-c6cafdc98d1b} + + + {4cb0dd89-5f16-4549-a864-34ca3075352a} + + + {914d8b8f-6b19-4f23-b746-f40062d72906} + + + {09516029-fac7-4235-ad61-402977534a0b} + + + {8cc1ae44-9dbf-4719-91a2-82e00b8d78e2} + + + {ea1e17a6-40b7-4e1b-8edb-e9ae704ce604} + + + {51910ba0-2ff8-461d-9f67-8d7907b57d22} + + + {325e0d7d-6832-496d-8d8e-968fdfa5dd40} + + + {802d0771-62f1-4733-89f9-57a4d8864b8d} + + + {04fd662a-6e70-494c-b720-c694a5cc2fb1} + + + {a18afb37-5fdd-4340-a6b4-a6541593e398} + + + {4a8a695a-a103-4b1f-b314-0ec19a253119} + + + {d8a83b5e-9a23-4124-824f-eab37880cb08} + + + {2cbddb28-0b17-4881-847d-8773da52b268} + + + {4db0d1e9-9035-457f-87f1-5dc3f13b6b9e} + + + {59b0f68f-daa7-4641-b6fa-8464b56da2bb} + + + {3e892d07-2239-44da-9cf3-c288a34cf9a2} + + + {14fc0931-acad-46ec-a55e-94f4469d4235} + + + {947835db-67d6-42c0-870d-62743f85231f} + + + {bf0769d8-40fd-4701-85e9-7ed94aab2283} + + + {9751b551-5886-45d4-a039-cbd10445263d} + + + {96101d42-72af-4fd1-8559-8d1d1ff66240} + + + {ee3ba13a-3061-41d7-981d-328ac2596fd2} + + + {0c93d909-e0d6-4c35-a8a4-a13f681a1012} + + + {94259c8c-5411-48bf-af4f-46ca32b7d0bb} + + + {44a83740-9d70-480d-9a7a-43b81f8eab9e} + + + {6bbce8a5-38b4-4763-a7cb-4e98012ec245} + + + {826d5193-3ad0-434b-ba7c-dd24ed4bbd0c} + + + {0f1ba4c4-78ee-4b05-afa5-6f598063f5c1} + + + {ca669b16-b8bb-4654-993f-fffa44c914f1} + + + {26365f16-ff52-4e80-a01b-2ca020376c93} + + + {7263403a-7550-4aa2-a724-f622ab200eed} + + + + + Header Files + + + Header Files\include + + + Header Files + + + Header Files\Client + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog + + + Header Files\include\spdlog\cfg + + + Header Files\include\spdlog\cfg + + + Header Files\include\spdlog\cfg + + + Header Files\include\spdlog\cfg + + + Header Files\include\spdlog\fmt + + + Header Files\include\spdlog\fmt + + + Header Files\include\spdlog\fmt + + + Header Files\include\spdlog\fmt + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\sinks + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\spdlog\details + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson + + + Header Files\include\rapidjson\error + + + Header Files\include\rapidjson\error + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\internal + + + Header Files\include\rapidjson\msinttypes + + + Header Files\include\rapidjson\msinttypes + + + Header Files\Server\Authentication + + + Header Files\include + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\openssl\internal + + + Header Files\include\libcurl + + + Header Files\include\libcurl + + + Header Files\include\libcurl + + + Header Files\include\libcurl + + + Header Files\include\libcurl + + + Header Files\include\libcurl + + + Header Files\include\libcurl + + + Header Files\include\libcurl + + + Header Files\include\libcurl + + + Header Files\include\libcurl + + + Header Files\Server\Authentication + + + Header Files\Client + + + Header Files\Client + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\Server\Scripted + + + Header Files\Dedicated Server + + + Header Files + + + Source Files\Exploit Fixes + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\Math + + + Header Files\Math + + + Header Files\Convar + + + Header Files\Convar + + + Header Files\Convar + + + Header Files\Filesystem + + + Header Files\Hooks + + + Header Files\Exploit Fixes + + + Header Files\Console + + + Header Files\Convar + + + Header Files\Mods + + + Header Files\Mods\Compiled Assets + + + Header Files\Console + + + Header Files\Console + + + Header Files\Game Functions + + + Header Files\Game Functions + + + Header Files\Game Functions + + + Header Files\Mods\Compiled Assets + + + Header Files\Game Functions + + + Header Files\Hooks + + + Header Files\Filesystem + + + Header Files\Math + + + Header Files\Server + + + Header Files\Hooks + + + Header Files + + + Header Files\Squirrel + + + Header Files\Squirrel + + + Header Files\Math + + + + + Source Files + + + Source Files\Dedicated Server + + + Source Files\Client + + + Source Files\Mods + + + Source Files\Mods\Compiled Assets + + + Source Files\Server\Authentication + + + Source Files\Mods\Compiled Assets + + + Source Files\Client + + + Source Files\Client + + + Source Files\Dedicated Server + + + Source Files\Mods\Compiled Assets + + + Source Files\Client + + + Source Files\Server + + + Source Files\Server\Authentication + + + Source Files\Client + + + Source Files\Client + + + Source Files\Client + + + Source Files\Server + + + Source Files\Client + + + Source Files + + + Source Files\Client + + + Source Files\Client + + + Source Files + + + Source Files\Client + + + Source Files\Client\Scripted + + + Source Files\Client\Scripted + + + Source Files\Client\Scripted + + + Source Files\Client\Scripted + + + Source Files\Client\Scripted + + + Source Files\Client\Scripted + + + Source Files\Server\Scripted + + + Source Files\Server\Scripted + + + Source Files\Client + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\Game Functions + + + Source Files\Game Functions + + + Source Files\Game Functions + + + Source Files\Filesystem + + + Source Files\Filesystem + + + Source Files\Exploit Fixes + + + Source Files\Exploit Fixes + + + Source Files\Hooks + + + Source Files\Hooks + + + Source Files\Math + + + Source Files\Convar + + + Source Files\Convar + + + Source Files\Console + + + Source Files\Console + + + Source Files\Convar + + + Source Files\Convar + + + Source Files\Game Functions + + + Source Files\Console + + + Source Files\Server + + + Source Files + + + Source Files\Hooks + + + Source Files\Exploit Fixes + + + Source Files\Scripted + + + Source Files\Scripted + + + Source Files\Squirrel + + + Source Files\Scripted + + + + + Source Files\Client + + + + + Header Files\include\spdlog\fmt\bundled + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\openssl + + + Header Files\include\openssl\crypto + + + Header Files\include\openssl\crypto + + \ No newline at end of file diff --git a/NorthstarDLL/audio.h b/NorthstarDLL/audio.h index 04bc00b5..26cda205 100644 --- a/NorthstarDLL/audio.h +++ b/NorthstarDLL/audio.h @@ -5,8 +5,6 @@ #include #include -namespace fs = std::filesystem; - enum class AudioSelectionStrategy { INVALID = -1, diff --git a/NorthstarDLL/buildainfile.cpp b/NorthstarDLL/buildainfile.cpp index d0397fce..c61484c7 100644 --- a/NorthstarDLL/buildainfile.cpp +++ b/NorthstarDLL/buildainfile.cpp @@ -8,8 +8,6 @@ AUTOHOOK_INIT() -namespace fs = std::filesystem; - const int AINET_VERSION_NUMBER = 57; const int AINET_SCRIPT_VERSION_NUMBER = 21; const int PLACEHOLDER_CRC = 0; diff --git a/NorthstarDLL/clientchathooks.cpp b/NorthstarDLL/clientchathooks.cpp index fc7c1f19..647e67f1 100644 --- a/NorthstarDLL/clientchathooks.cpp +++ b/NorthstarDLL/clientchathooks.cpp @@ -29,12 +29,12 @@ void,, (void* self, const char* message, int inboxId, bool isTeam, bool isDead)) payload = message + 1; } - g_pSquirrel->pushinteger(g_pSquirrel->sqvm, (int)senderId - 1); - g_pSquirrel->pushstring(g_pSquirrel->sqvm, payload); - g_pSquirrel->pushbool(g_pSquirrel->sqvm, isTeam); - g_pSquirrel->pushbool(g_pSquirrel->sqvm, isDead); - g_pSquirrel->pushinteger(g_pSquirrel->sqvm, type); - g_pSquirrel->call(g_pSquirrel->sqvm, 5); + g_pSquirrel->pushinteger(g_pSquirrel->m_pSQVM->sqvm, (int)senderId - 1); + g_pSquirrel->pushstring(g_pSquirrel->m_pSQVM->sqvm, payload); + g_pSquirrel->pushbool(g_pSquirrel->m_pSQVM->sqvm, isTeam); + g_pSquirrel->pushbool(g_pSquirrel->m_pSQVM->sqvm, isDead); + g_pSquirrel->pushinteger(g_pSquirrel->m_pSQVM->sqvm, type); + g_pSquirrel->call(g_pSquirrel->m_pSQVM->sqvm, 5); } else for (CHudChat* hud = *CHudChat::allHuds; hud != NULL; hud = hud->next) diff --git a/NorthstarDLL/debugoverlay.cpp b/NorthstarDLL/debugoverlay.cpp index 18975830..2d2d03e0 100644 --- a/NorthstarDLL/debugoverlay.cpp +++ b/NorthstarDLL/debugoverlay.cpp @@ -1,19 +1,10 @@ #include "pch.h" #include "dedicated.h" #include "cvar.h" +#include "vector.h" AUTOHOOK_INIT() -struct Vector3 -{ - float x, y, z; -}; - -struct QAngle -{ - float x, y, z, w; -}; - enum OverlayType_t { OVERLAY_BOX = 0, diff --git a/NorthstarDLL/dllmain.cpp b/NorthstarDLL/dllmain.cpp index 600fb339..8d78ee2c 100644 --- a/NorthstarDLL/dllmain.cpp +++ b/NorthstarDLL/dllmain.cpp @@ -16,7 +16,6 @@ #include #include -namespace fs = std::filesystem; typedef void (*initPluginFuncPtr)(void* (*getPluginObject)(PluginObject)); diff --git a/NorthstarDLL/exploitfixes.cpp b/NorthstarDLL/exploitfixes.cpp index 3a9a504f..dbe065cc 100644 --- a/NorthstarDLL/exploitfixes.cpp +++ b/NorthstarDLL/exploitfixes.cpp @@ -13,12 +13,11 @@ ConVar* Cvar_ns_should_log_all_clientcommands; ConVar* Cvar_sv_cheats; -#define SHOULD_LOG (Cvar_ns_exploitfixes_log->m_Value.m_nValue > 0) #define BLOCKED_INFO(s) \ ( \ [=]() -> bool \ { \ - if (SHOULD_LOG) \ + if (Cvar_ns_exploitfixes_log->GetBool()) \ { \ std::stringstream stream; \ stream << "ExploitFixes.cpp: " << BLOCK_PREFIX << s; \ @@ -109,7 +108,6 @@ bool, __fastcall, (void* pMsg)) // 48 8B D1 48 8B 49 18 48 8B 01 48 FF 60 10 // Safety check for memory access if (MemoryAddress(entry).IsMemoryReadable(sizeof(*entry))) { - // Find null terminators bool nameValid = false, valValid = false; for (int i = 0; i < ENTRY_STR_LEN; i++) @@ -193,14 +191,6 @@ bool, __fastcall, (void* thisptr, void* pMsg)) // 40 55 56 48 83 EC 58 return BLOCKED_INFO("Invalid m_nNewCommands (" << msg->m_nNewCommands << ")"); } - // removing, as vanilla already limits num usercmds per frame - /*constexpr int NUMCMD_SANITY_LIMIT = 16; - if ((msg->m_nNewCommands + msg->m_nBackupCommands) > NUMCMD_SANITY_LIMIT) - { - return BLOCKED_INFO("Command count is too high (new: " << msg->m_nNewCommands << ", backup: " << msg->m_nBackupCommands << ")"); - - }*/ - if (msg->m_nLength <= 0) return BLOCKED_INFO("Invalid message length (" << msg->m_nLength << ")"); @@ -285,7 +275,7 @@ INVALID_CMD: AUTOHOOK(IsRespawnMod, engine.dll + 0x1C6360, bool, __fastcall, (const char* pModName)) // 48 83 EC 28 48 8B 0D ? ? ? ? 48 8D 15 ? ? ? ? E8 ? ? ? ? 85 C0 74 63 { - // somewhat temp, store the modname here, since we don't have a proper ptr to it rn + // somewhat temp, store the modname here, since we don't have a proper ptr in engine to it rn int iSize = strlen(pModName); R2::g_pModName = new char[iSize + 1]; strcpy(R2::g_pModName, pModName); diff --git a/NorthstarDLL/hooks.cpp b/NorthstarDLL/hooks.cpp index 08050be6..f0ea74e9 100644 --- a/NorthstarDLL/hooks.cpp +++ b/NorthstarDLL/hooks.cpp @@ -10,8 +10,6 @@ #include #include -namespace fs = std::filesystem; - AUTOHOOK_INIT() // called from the ON_DLL_LOAD macros diff --git a/NorthstarDLL/languagehooks.cpp b/NorthstarDLL/languagehooks.cpp index 8a6b3dc1..9e5dda86 100644 --- a/NorthstarDLL/languagehooks.cpp +++ b/NorthstarDLL/languagehooks.cpp @@ -6,8 +6,6 @@ AUTOHOOK_INIT() -namespace fs = std::filesystem; - typedef LANGID (*Tier0_DetectDefaultLanguageType)(); bool CheckLangAudioExists(char* lang) diff --git a/NorthstarDLL/masterserver.cpp b/NorthstarDLL/masterserver.cpp index ef23c919..a1fb839a 100644 --- a/NorthstarDLL/masterserver.cpp +++ b/NorthstarDLL/masterserver.cpp @@ -859,9 +859,11 @@ class MasterServerPresenceReporter : public ServerPresenceReporter { if (++m_nNumRegistrationAttempts == MAX_REGISTRATION_ATTEMPTS) m_bShouldTryRegisterServer = false; + + goto REQUEST_END_CLEANUP_RETRY; } - goto REQUEST_END_CLEANUP_RETRY; + goto REQUEST_END_CLEANUP; } if (!serverAddedJson["success"].IsTrue()) diff --git a/NorthstarDLL/misccommands.cpp b/NorthstarDLL/misccommands.cpp index e745752f..572d5620 100644 --- a/NorthstarDLL/misccommands.cpp +++ b/NorthstarDLL/misccommands.cpp @@ -34,7 +34,7 @@ void ConCommand_ns_end_reauth_and_leave_to_lobby(const CCommand& arg) R2::Cbuf_Execute(); // weird way of checking, but check if client script vm is initialised, mainly just to allow players to cancel this - if (g_pSquirrel->SquirrelVM) + if (g_pSquirrel->m_pSQVM) { g_pServerAuthentication->m_bNeedLocalAuthForNewgame = true; diff --git a/NorthstarDLL/modmanager.h b/NorthstarDLL/modmanager.h index 621df76f..f622c675 100644 --- a/NorthstarDLL/modmanager.h +++ b/NorthstarDLL/modmanager.h @@ -8,8 +8,6 @@ #include #include -namespace fs = std::filesystem; - const std::string MOD_FOLDER_SUFFIX = "/mods"; const std::string REMOTE_MOD_FOLDER_SUFFIX = "/runtime/remote/mods"; const fs::path MOD_OVERRIDE_DIR = "mod"; diff --git a/NorthstarDLL/pch.h b/NorthstarDLL/pch.h index 66543859..e23d6a9b 100644 --- a/NorthstarDLL/pch.h +++ b/NorthstarDLL/pch.h @@ -18,6 +18,8 @@ #include #include +namespace fs = std::filesystem; + #include "logging.h" #include "MinHook.h" #include "spdlog/spdlog.h" diff --git a/NorthstarDLL/scriptdatatables.cpp b/NorthstarDLL/scriptdatatables.cpp index 40bb6a39..cd8a6b2a 100644 --- a/NorthstarDLL/scriptdatatables.cpp +++ b/NorthstarDLL/scriptdatatables.cpp @@ -2,914 +2,921 @@ #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 #include #include #include -#include "tier0.h" +#include + +const uint64_t USERDATA_TYPE_DATATABLE = 0xFFF7FFF700000004; +const uint64_t USERDATA_TYPE_DATATABLE_CUSTOM = 0xFFFCFFFC12345678; + +enum class DatatableType : int +{ + BOOL = 0, + INT, + FLOAT, + VECTOR, + STRING, + ASSET, + UNK_STRING // unknown but deffo a string type +}; struct ColumnInfo { char* name; - int type; + DatatableType type; int offset; }; -struct DataTable +struct Datatable { - int columnAmount; - int rowAmount; + int numColumns; + int numRows; ColumnInfo* columnInfo; - long long data; // actually data pointer + char* data; // actually data pointer int rowInfo; }; ConVar* Cvar_ns_prefer_datatable_from_disk; -void datatableReleaseHook(void*, int size); -const long long customDatatableTypeId = 0xFFFCFFFC12345678; -const long long vanillaDatatableTypeId = 0xFFF7FFF700000004; -void* (*getDataTableStructure)(HSquirrelVM* sqvm); -std::string DataTableToString(DataTable* datatable); -struct csvData +template Datatable* (*SQ_GetDatatableInternal)(HSquirrelVM* sqvm); +std::string DataTableToString(Datatable* datatable); + +struct CSVData { - char* name; + std::string m_sAssetName; + std::string m_sCSVString; + char* m_pDataBuf; + size_t m_nDataBufSize; + + std::vector columns; std::vector> dataPointers; - char* fullData = 0; - std::vector columnNames; }; -std::unordered_map cacheMap; +std::unordered_map CSVCache; -void StringToVector(char* string, float* vector) +Vector3 StringToVector(char* pString) { + Vector3 vRet; + int length = 0; - while (string[length]) + while (pString[length]) { - if ((string[length] == '<') || (string[length] == '>')) - string[length] = '\0'; + if ((pString[length] == '<') || (pString[length] == '>')) + pString[length] = '\0'; length++; } int startOfFloat = 1; int currentIndex = 1; - while (string[currentIndex] && (string[currentIndex] != ',')) + + while (pString[currentIndex] && (pString[currentIndex] != ',')) currentIndex++; - string[currentIndex] = '\0'; - vector[0] = std::stof(&string[startOfFloat]); + pString[currentIndex] = '\0'; + vRet.x = std::stof(&pString[startOfFloat]); startOfFloat = ++currentIndex; - while (string[currentIndex] && (string[currentIndex] != ',')) + + while (pString[currentIndex] && (pString[currentIndex] != ',')) currentIndex++; - string[currentIndex] = '\0'; - vector[1] = std::stof(&string[startOfFloat]); + pString[currentIndex] = '\0'; + vRet.y = std::stof(&pString[startOfFloat]); startOfFloat = ++currentIndex; - while (string[currentIndex] && (string[currentIndex] != ',')) + + while (pString[currentIndex] && (pString[currentIndex] != ',')) currentIndex++; - string[currentIndex] = '\0'; - vector[2] = std::stof(&string[startOfFloat]); + pString[currentIndex] = '\0'; + vRet.z = std::stof(&pString[startOfFloat]); startOfFloat = ++currentIndex; + + return vRet; } -template SQRESULT GetDatatable(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDatatable(HSquirrelVM* sqvm) { - const char* assetName; - g_pSquirrel->getasset(sqvm, 2, &assetName); - SQRESULT result = SQRESULT_ERROR; - if (strncmp(assetName, "datatable/", 10) != 0) - { - spdlog::error("Asset \"{}\" doesn't start with \"datatable/\"", assetName); - } - else if ((!Cvar_ns_prefer_datatable_from_disk->GetBool()) && g_pPakLoadManager->LoadFile(assetName)) + const char* pAssetName; + g_pSquirrel->getasset(sqvm, 2, &pAssetName); + + if (strncmp(pAssetName, "datatable/", 10)) { - // spdlog::info("Load Datatable {} from rpak", assetName); - result = g_pSquirrel->m_funcOriginals["GetDataTable"](sqvm); + g_pSquirrel->raiseerror(sqvm, fmt::format("Asset \"{}\" doesn't start with \"datatable/\"", pAssetName).c_str()); + return SQRESULT_ERROR; } + else if (!Cvar_ns_prefer_datatable_from_disk->GetBool() && g_pPakLoadManager->LoadFile(pAssetName)) + return g_pSquirrel->m_funcOriginals["GetDataTable"](sqvm); + // either we prefer disk datatables, or we're loading a datatable that wasn't found in rpak else { - char assetPath[250]; - snprintf(assetPath, 250, "scripts/%s", assetName); - if (cacheMap.count(assetName)) + std::string sAssetPath(fmt::format("scripts/{}", pAssetName)); + + // first, check the cache + if (CSVCache.find(pAssetName) != CSVCache.end()) { - // spdlog::info("Loaded custom Datatable {} from cache", assetName); - csvData** dataPointer = (csvData**)g_pSquirrel->createuserdata(sqvm, sizeof(csvData*)); - *dataPointer = cacheMap[assetName]; - g_pSquirrel->setuserdatatypeid(sqvm, -1, customDatatableTypeId); - // sqvm->_stack[sqvm->_top -1]._VAL.asUserdata->releaseHook = datatableReleaseHook; - result = SQRESULT_NOTNULL; + CSVData** pUserdata = g_pSquirrel->createuserdata(sqvm, sizeof(CSVData*)); + g_pSquirrel->setuserdatatypeid(sqvm, -1, USERDATA_TYPE_DATATABLE_CUSTOM); + *pUserdata = &CSVCache[pAssetName]; + + return SQRESULT_NOTNULL; } - else if ((*R2::g_pFilesystem)->m_vtable2->FileExists(&(*R2::g_pFilesystem)->m_vtable2, assetPath, "GAME")) - { + + // check files on disk + // we don't use .rpak as the extension for on-disk datatables, so we need to replace .rpak with .csv in the filename we're reading + fs::path diskAssetPath("scripts"); + if (fs::path(pAssetName).extension() == ".rpak") + diskAssetPath /= fs::path(pAssetName).remove_filename() / (fs::path(pAssetName).stem().string() + ".csv"); + else + diskAssetPath /= fs::path(pAssetName); - std::string dataFile = R2::ReadVPKFile(assetPath); - if (dataFile.size() == 0) + std::string sDiskAssetPath(diskAssetPath.string()); + if ((*R2::g_pFilesystem)->m_vtable2->FileExists(&(*R2::g_pFilesystem)->m_vtable2, sDiskAssetPath.c_str(), "GAME")) + { + std::string sTableCSV = R2::ReadVPKFile(sDiskAssetPath.c_str()); + if (!sTableCSV.size()) + { + g_pSquirrel->raiseerror(sqvm, fmt::format("Datatable \"{}\" is empty", pAssetName).c_str()); return SQRESULT_ERROR; - char* csvFullData = (char*)malloc(dataFile.size()); - memcpy(csvFullData, dataFile.c_str(), dataFile.size()); + } - csvData* data = new csvData(); - data->fullData = csvFullData; + // somewhat shit, but ensure we end with a newline to make parsing easier + if (sTableCSV[sTableCSV.length() - 1] != '\n') + sTableCSV += '\n'; - std::vector currentLine; - int startIndex = 0; - if (csvFullData[0] == '\"') - { - currentLine.push_back(&csvFullData[1]); - startIndex = 1; - int i = 1; - while (csvFullData[i] != '\"') - i++; - csvFullData[i] = '\0'; - } - else - { - currentLine.push_back(csvFullData); - } + CSVData csv; + csv.m_sAssetName = pAssetName; + csv.m_sCSVString = sTableCSV; + csv.m_nDataBufSize = sTableCSV.size(); + csv.m_pDataBuf = new char[csv.m_nDataBufSize]; + memcpy(csv.m_pDataBuf, &sTableCSV[0], csv.m_nDataBufSize); + + // parse the csv + // csvs are essentially comma and newline-deliniated sets of strings for parsing, only thing we need to worry about is quoted entries + // when we parse an element of the csv, rather than allocating an entry for it, we just convert that element to a null-terminated string + // i.e., store the ptr to the first char of it, then make the comma that delinates it a nullchar + + bool bHasColumns = false; + bool bInQuotes = false; - bool firstLine = true; - for (int i = startIndex; i < dataFile.size(); i++) + std::vector vCurrentRow; + char* pElemStart = csv.m_pDataBuf; + char* pElemEnd = nullptr; + + for (int i = 0; i < csv.m_nDataBufSize; i++) { - if (csvFullData[i] == ',') + if (csv.m_pDataBuf[i] == '\r' && csv.m_pDataBuf[i + 1] == '\n') { - if (csvFullData[i + 1] == '\"') - { + if (!pElemEnd) + pElemEnd = csv.m_pDataBuf + i; - currentLine.push_back(&csvFullData[i + 2]); - csvFullData[i] = '\0'; - csvFullData[i + 1] = '\0'; - while (true) - { - if ((csvFullData[i] == '\n') || (csvFullData[i] == '\r')) - return SQRESULT_ERROR; - if (csvFullData[i] == '\"') - break; - i++; - } - csvFullData[i] = '\0'; - } - else - { - currentLine.push_back(&csvFullData[i + 1]); - csvFullData[i] = '\0'; - } + continue; // next iteration can handle the \n } - if ((csvFullData[i] == '\n') || (csvFullData[i] == '\r')) + + // newline, end of a row + if (csv.m_pDataBuf[i] == '\n') { - csvFullData[i] = '\0'; - if ((csvFullData[i + 1] == '\n') || (csvFullData[i + 1] == '\r')) - { - i++; - csvFullData[i] = '\0'; - } - if (firstLine) + // shouldn't have newline in string + if (bInQuotes) { - data->columnNames = currentLine; - firstLine = false; + g_pSquirrel->raiseerror(sqvm, "Unexpected \\n in string"); + return SQRESULT_ERROR; } + + // push last entry to current row + if (pElemEnd) + *pElemEnd = '\0'; else + csv.m_pDataBuf[i] = '\0'; + + vCurrentRow.push_back(pElemStart); + + // newline, push last line to csv data and go from there + if (!bHasColumns) { - data->dataPointers.push_back(currentLine); + bHasColumns = true; + csv.columns = vCurrentRow; } + else + csv.dataPointers.push_back(vCurrentRow); - currentLine.clear(); - if (i + 1 >= dataFile.size()) - break; - if (csvFullData[i + 1] == '\"') + vCurrentRow.clear(); + // put start of current element at char after newline + pElemStart = csv.m_pDataBuf + i + 1; + pElemEnd = nullptr; + } + // we're starting or ending a quoted string + else if (csv.m_pDataBuf[i] == '"') + { + // start quoted string + if (!bInQuotes) { - - currentLine.push_back(&csvFullData[i + 2]); - csvFullData[i] = '\0'; - csvFullData[i + 1] = '\0'; - while (true) + // shouldn't have quoted strings in column names + if (!bHasColumns) { - if ((csvFullData[i] == '\n') || (csvFullData[i] == '\r')) - return SQRESULT_ERROR; - if (csvFullData[i] == '\"') - break; - i++; + g_pSquirrel->raiseerror(sqvm, "Unexpected \" in column name"); + return SQRESULT_ERROR; } - csvFullData[i] = '\0'; + + bInQuotes = true; + // put start of current element at char after string begin + pElemStart = csv.m_pDataBuf + i + 1; } + // end quoted string else { - currentLine.push_back(&csvFullData[i + 1]); - csvFullData[i] = '\0'; + pElemEnd = csv.m_pDataBuf + i; + bInQuotes = false; } } - } - if (currentLine.size() != 0) - { - if (firstLine) + // don't parse commas in quotes + else if (bInQuotes) { - data->columnNames = currentLine; + continue; } - else + // comma, push new entry to current row + else if (csv.m_pDataBuf[i] == ',') { - data->dataPointers.push_back(currentLine); + if (pElemEnd) + *pElemEnd = '\0'; + else + csv.m_pDataBuf[i] = '\0'; + + vCurrentRow.push_back(pElemStart); + // put start of next element at char after comma + pElemStart = csv.m_pDataBuf + i + 1; + pElemEnd = nullptr; } } - data->name = (char*)malloc(256); - strncpy(data->name, assetName, 256); - csvData** dataPointer = (csvData**)g_pSquirrel->createuserdata(sqvm, sizeof(csvData*)); - g_pSquirrel->setuserdatatypeid(sqvm, -1, customDatatableTypeId); + // add to cache and return + CSVData** pUserdata = g_pSquirrel->createuserdata(sqvm, sizeof(CSVData*)); + g_pSquirrel->setuserdatatypeid(sqvm, -1, USERDATA_TYPE_DATATABLE_CUSTOM); + CSVCache[pAssetName] = csv; + *pUserdata = &CSVCache[pAssetName]; - *dataPointer = data; - // vm->_stack[vm->_top -1]._VAL.asUserdata->releaseHook = datatableReleaseHook; - cacheMap[assetName] = data; - // spdlog::info("Loaded custom Datatable from file at {} with pointer {}", assetPath, (void*)data); - - result = SQRESULT_NOTNULL; - } - else if (Cvar_ns_prefer_datatable_from_disk->GetBool() && g_pPakLoadManager->LoadFile(assetName)) - { - result = g_pSquirrel->m_funcOriginals["GetDataTable"](sqvm); + return SQRESULT_NOTNULL; } + // the file doesn't exist on disk, check rpak if we haven't already + else if (Cvar_ns_prefer_datatable_from_disk->GetBool() && g_pPakLoadManager->LoadFile(pAssetName)) + return g_pSquirrel->m_funcOriginals["GetDataTable"](sqvm); + // the file doesn't exist at all, error else { - spdlog::error("Datatable {} not found", assetPath); + g_pSquirrel->raiseerror(sqvm, fmt::format("Datatable {} not found", pAssetName).c_str()); + return SQRESULT_ERROR; } } - return result; } -template SQRESULT GetDatatabeColumnByName(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableColumnByName(HSquirrelVM* sqvm) { - // spdlog::info("start getDatatableColumnByName"); - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); + + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) return g_pSquirrel->m_funcOriginals["GetDataTableColumnByName"](sqvm); - } - if (typeId != customDatatableTypeId) + CSVData* csv = *pData; + const char* pColumnName = g_pSquirrel->getstring(sqvm, 2); + + for (int i = 0; i < csv->columns.size(); i++) { - return SQRESULT_ERROR; + if (!strcmp(csv->columns[i], pColumnName)) + { + g_pSquirrel->pushinteger(sqvm, i); + return SQRESULT_NOTNULL; + } } - // spdlog::info("GetColumnByName form datatable with pointer {}",(void*)data); - const char* searchName = g_pSquirrel->getstring(sqvm, 2); - int col = 0; - for (auto colName : data->columnNames) - { - if (!strcmp(colName, searchName)) - break; - col++; - } - if (col == data->columnNames.size()) - col = -1; - // spdlog::info("Datatable CoulumnName {} in column {}", std::string(searchName), col); - g_pSquirrel->pushinteger(sqvm, col); + // column not found + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDatatabeRowCount(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowCount(HSquirrelVM* sqvm) { - // spdlog::info("start getDatatableRowCount"); - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) return g_pSquirrel->m_funcOriginals["GetDatatableRowCount"](sqvm); - } - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } - g_pSquirrel->pushinteger(sqvm, data->dataPointers.size()); + CSVData* csv = *pData; + const char* pColumnName = g_pSquirrel->getstring(sqvm, 2); + + g_pSquirrel->pushinteger(sqvm, csv->dataPointers.size()); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableString(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableString(HSquirrelVM* sqvm) { - // spdlog::info("start getDatatableString"); - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); + + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) return g_pSquirrel->m_funcOriginals["GetDataTableString"](sqvm); - } - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } - int row = g_pSquirrel->getinteger(sqvm, 2); - int col = g_pSquirrel->getinteger(sqvm, 3); - if (row >= data->dataPointers.size() || col >= data->dataPointers[row].size()) + CSVData* csv = *pData; + const int nRow = g_pSquirrel->getinteger(sqvm, 2); + const int nCol = g_pSquirrel->getinteger(sqvm, 3); + if (nRow >= csv->dataPointers.size() || nCol >= csv->dataPointers[nRow].size()) { - spdlog::info("row {} and col {} are outside of range row {} and col {}", row, col, data->dataPointers.size(), data->columnNames.size()); + g_pSquirrel->raiseerror( + sqvm, + fmt::format( + "row {} and col {} are outside of range row {} and col {}", nRow, nCol, csv->dataPointers.size(), csv->columns.size()) + .c_str()); return SQRESULT_ERROR; } - g_pSquirrel->pushstring(sqvm, data->dataPointers[row][col], -1); + g_pSquirrel->pushstring(sqvm, csv->dataPointers[nRow][nCol], -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableAsset(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableAsset(HSquirrelVM* sqvm) { - // spdlog::info("start getDatatableAsset"); - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); + + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) return g_pSquirrel->m_funcOriginals["GetDataTableAsset"](sqvm); - } - if (typeId != customDatatableTypeId) + CSVData* csv = *pData; + const int nRow = g_pSquirrel->getinteger(sqvm, 2); + const int nCol = g_pSquirrel->getinteger(sqvm, 3); + if (nRow >= csv->dataPointers.size() || nCol >= csv->dataPointers[nRow].size()) { + g_pSquirrel->raiseerror( + sqvm, + fmt::format( + "row {} and col {} are outside of range row {} and col {}", nRow, nCol, csv->dataPointers.size(), csv->columns.size()) + .c_str()); return SQRESULT_ERROR; } - int row = g_pSquirrel->getinteger(sqvm, 2); - int col = g_pSquirrel->getinteger(sqvm, 3); - if (row >= data->dataPointers.size() || col >= data->dataPointers[row].size()) - { - spdlog::info("row {} and col {} are outside of range row {} and col {}", row, col, data->dataPointers.size(), data->columnNames.size()); - return SQRESULT_ERROR; - } - char* asset = data->dataPointers[row][col]; - g_pSquirrel->pushasset(sqvm, asset, -1); + + g_pSquirrel->pushasset(sqvm, csv->dataPointers[nRow][nCol], -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableInt(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableInt(HSquirrelVM* sqvm) { - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); + + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) return g_pSquirrel->m_funcOriginals["GetDataTableInt"](sqvm); - } - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } - int row = g_pSquirrel->getinteger(sqvm, 2); - int col = g_pSquirrel->getinteger(sqvm, 3); - if (row >= data->dataPointers.size() || col >= data->dataPointers[row].size()) + CSVData* csv = *pData; + const int nRow = g_pSquirrel->getinteger(sqvm, 2); + const int nCol = g_pSquirrel->getinteger(sqvm, 3); + if (nRow >= csv->dataPointers.size() || nCol >= csv->dataPointers[nRow].size()) { - spdlog::info("row {} and col {} are outside of range row {} and col {}", row, col, data->dataPointers.size(), data->columnNames.size()); + g_pSquirrel->raiseerror( + sqvm, + fmt::format( + "row {} and col {} are outside of range row {} and col {}", nRow, nCol, csv->dataPointers.size(), csv->columns.size()) + .c_str()); return SQRESULT_ERROR; } - g_pSquirrel->pushinteger(sqvm, std::stoi(data->dataPointers[row][col])); + + g_pSquirrel->pushinteger(sqvm, std::stoi(csv->dataPointers[nRow][nCol])); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableFloat(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableFloat(HSquirrelVM* sqvm) { - // spdlog::info("start getDatatableFloat"); - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); + + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) return g_pSquirrel->m_funcOriginals["GetDataTableFloat"](sqvm); - } - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } - int row = g_pSquirrel->getinteger(sqvm, 2); - int col = g_pSquirrel->getinteger(sqvm, 3); - if (row >= data->dataPointers.size() || col >= data->dataPointers[row].size()) + CSVData* csv = *pData; + const int nRow = g_pSquirrel->getinteger(sqvm, 2); + const int nCol = g_pSquirrel->getinteger(sqvm, 3); + if (nRow >= csv->dataPointers.size() || nCol >= csv->dataPointers[nRow].size()) { - spdlog::info("row {} and col {} are outside of range row {} and col {}", row, col, data->dataPointers.size(), data->columnNames.size()); + g_pSquirrel->raiseerror( + sqvm, + fmt::format( + "row {} and col {} are outside of range row {} and col {}", nRow, nCol, csv->dataPointers.size(), csv->columns.size()) + .c_str()); return SQRESULT_ERROR; } - g_pSquirrel->pushfloat(sqvm, std::stof(data->dataPointers[row][col])); + + g_pSquirrel->pushfloat(sqvm, std::stof(csv->dataPointers[nRow][nCol])); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableBool(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableBool(HSquirrelVM* sqvm) { - // spdlog::info("start getDatatableBool"); - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); + + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) return g_pSquirrel->m_funcOriginals["GetDataTableBool"](sqvm); - } - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } - int row = g_pSquirrel->getinteger(sqvm, 2); - int col = g_pSquirrel->getinteger(sqvm, 3); - if (row >= data->dataPointers.size() || col >= data->dataPointers[row].size()) + CSVData* csv = *pData; + const int nRow = g_pSquirrel->getinteger(sqvm, 2); + const int nCol = g_pSquirrel->getinteger(sqvm, 3); + if (nRow >= csv->dataPointers.size() || nCol >= csv->dataPointers[nRow].size()) { - spdlog::info("row {} and col {} are outside of range row {} and col {}", row, col, data->dataPointers.size(), data->columnNames.size()); + g_pSquirrel->raiseerror( + sqvm, + fmt::format( + "row {} and col {} are outside of range row {} and col {}", nRow, nCol, csv->dataPointers.size(), csv->columns.size()) + .c_str()); return SQRESULT_ERROR; } - g_pSquirrel->pushbool(sqvm, std::stoi(data->dataPointers[row][col])); + + g_pSquirrel->pushbool(sqvm, std::stoi(csv->dataPointers[nRow][nCol])); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableVector(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableVector(HSquirrelVM* sqvm) { - // spdlog::info("start getDatatableVector"); - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableVector"](sqvm); - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } - float vector[3]; + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableVector"](sqvm); - int row = g_pSquirrel->getinteger(sqvm, 2); - int col = g_pSquirrel->getinteger(sqvm, 3); - if (row >= data->dataPointers.size() || col >= data->dataPointers[row].size()) + CSVData* csv = *pData; + const int nRow = g_pSquirrel->getinteger(sqvm, 2); + const int nCol = g_pSquirrel->getinteger(sqvm, 3); + if (nRow >= csv->dataPointers.size() || nCol >= csv->dataPointers[nRow].size()) { - spdlog::info( - "row {} and col {} are outside of range row {} and col {}", row, col, data->dataPointers.size(), data->columnNames.size()); + g_pSquirrel->raiseerror( + sqvm, fmt::format("row {} and col {} are outside of range row {} and col {}", nRow, nCol, csv->dataPointers.size(), csv->columns.size()).c_str()); return SQRESULT_ERROR; } - StringToVector(data->dataPointers[row][col], vector); - g_pSquirrel->pushvector(sqvm, vector); - + g_pSquirrel->pushvector(sqvm, StringToVector(csv->dataPointers[nRow][nCol])); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableRowMatchingStringValue(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowMatchingStringValue(HSquirrelVM* sqvm) { - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingStringValue"](sqvm); - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } - - int col = g_pSquirrel->getinteger(sqvm, 2); - const char* stringValue = g_pSquirrel->getstring(sqvm, 3); + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingStringValue"](sqvm); - for (int i = 0; i < data->dataPointers.size(); i++) + CSVData* csv = *pData; + int nCol = g_pSquirrel->getinteger(sqvm, 2); + const char* pStringVal = g_pSquirrel->getstring(sqvm, 3); + for (int i = 0; i < csv->dataPointers.size(); i++) { - if (!strcmp(data->dataPointers[i][col], stringValue)) + if (!strcmp(csv->dataPointers[i][nCol], pStringVal)) { g_pSquirrel->pushinteger(sqvm, i); return SQRESULT_NOTNULL; } } + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableRowMatchingAssetValue(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowMatchingAssetValue(HSquirrelVM* sqvm) { - // spdlog::info("start getDatatableRowMatchingAsset"); - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingAssetValue"](sqvm); - } - - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - int col = g_pSquirrel->getinteger(sqvm, 2); - const char* stringValue; - g_pSquirrel->getasset(sqvm, 3, &stringValue); + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingAssetValue"](sqvm); - for (int i = 0; i < data->dataPointers.size(); i++) + CSVData* csv = *pData; + int nCol = g_pSquirrel->getinteger(sqvm, 2); + const char* pStringVal; + g_pSquirrel->getasset(sqvm, 3, &pStringVal); + for (int i = 0; i < csv->dataPointers.size(); i++) { - if (!strcmp(data->dataPointers[i][col], stringValue)) + if (!strcmp(csv->dataPointers[i][nCol], pStringVal)) { g_pSquirrel->pushinteger(sqvm, i); return SQRESULT_NOTNULL; } } + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableRowMatchingFloatValue(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowMatchingFloatValue(HSquirrelVM* sqvm) { - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingFloatValue"](sqvm); - } - - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - int col = g_pSquirrel->getinteger(sqvm, 2); - float compareValue = g_pSquirrel->getfloat(sqvm, 3); + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingFloatValue"](sqvm); - for (int i = 0; i < data->dataPointers.size(); i++) + CSVData* csv = *pData; + int nCol = g_pSquirrel->getinteger(sqvm, 2); + const float flFloatVal = g_pSquirrel->getfloat(sqvm, 3); + for (int i = 0; i < csv->dataPointers.size(); i++) { - - if (compareValue == std::stof(data->dataPointers[i][col])) + if (flFloatVal == std::stof(csv->dataPointers[i][nCol])) { g_pSquirrel->pushinteger(sqvm, i); return SQRESULT_NOTNULL; } } + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableRowMatchingIntValue(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowMatchingIntValue(HSquirrelVM* sqvm) { - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingIntValue"](sqvm); - } - - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - int col = g_pSquirrel->getinteger(sqvm, 2); - int compareValue = g_pSquirrel->getinteger(sqvm, 3); + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingIntValue"](sqvm); - for (int i = 0; i < data->dataPointers.size(); i++) + CSVData* csv = *pData; + int nCol = g_pSquirrel->getinteger(sqvm, 2); + const int nIntVal = g_pSquirrel->getinteger(sqvm, 3); + for (int i = 0; i < csv->dataPointers.size(); i++) { - - if (compareValue == std::stoi(data->dataPointers[i][col])) + if (nIntVal == std::stoi(csv->dataPointers[i][nCol])) { g_pSquirrel->pushinteger(sqvm, i); return SQRESULT_NOTNULL; } } + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableRowGreaterThanOrEqualToIntValue(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowMatchingVectorValue(HSquirrelVM* sqvm) { - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableRowGreaterThanOrEqualToIntValue"](sqvm); - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingVectorValue"](sqvm); - int col = g_pSquirrel->getinteger(sqvm, 2); - int compareValue = g_pSquirrel->getinteger(sqvm, 3); + CSVData* csv = *pData; + int nCol = g_pSquirrel->getinteger(sqvm, 2); + const Vector3 vVectorVal = g_pSquirrel->getvector(sqvm, 3); - for (int i = 0; i < data->dataPointers.size(); i++) + for (int i = 0; i < csv->dataPointers.size(); i++) { - - if (compareValue >= std::stoi(data->dataPointers[i][col])) + if (vVectorVal == StringToVector(csv->dataPointers[i][nCol])) { g_pSquirrel->pushinteger(sqvm, i); return SQRESULT_NOTNULL; } } + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableRowLessThanOrEqualToIntValue(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowGreaterThanOrEqualToIntValue(HSquirrelVM* sqvm) { - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableRowLessThanOrEqualToIntValue"](sqvm); - } - - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - int col = g_pSquirrel->getinteger(sqvm, 2); - int compareValue = g_pSquirrel->getinteger(sqvm, 3); + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableRowGreaterThanOrEqualToIntValue"](sqvm); - for (int i = 0; i < data->dataPointers.size(); i++) + CSVData* csv = *pData; + int nCol = g_pSquirrel->getinteger(sqvm, 2); + const int nIntVal = g_pSquirrel->getinteger(sqvm, 3); + for (int i = 0; i < csv->dataPointers.size(); i++) { - - if (compareValue <= std::stoi(data->dataPointers[i][col])) + if (nIntVal >= std::stoi(csv->dataPointers[i][nCol])) { - g_pSquirrel->pushinteger(sqvm, i); - return SQRESULT_NOTNULL; - } + spdlog::info("datatable not loaded"); + g_pSquirrel->pushinteger(sqvm, 1); + return SQRESULT_NOTNULL; } + } + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableRowGreaterThanOrEqualToFloatValue(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowLessThanOrEqualToIntValue(HSquirrelVM* sqvm) { - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableRowGreaterThanOrEqualToFloatValue"](sqvm); - } - - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - int col = g_pSquirrel->getinteger(sqvm, 2); - float compareValue = g_pSquirrel->getfloat(sqvm, 3); + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableRowLessThanOrEqualToIntValue"](sqvm); - for (int i = 0; i < data->dataPointers.size(); i++) + CSVData* csv = *pData; + int nCol = g_pSquirrel->getinteger(sqvm, 2); + const int nIntVal = g_pSquirrel->getinteger(sqvm, 3); + for (int i = 0; i < csv->dataPointers.size(); i++) { - - if (compareValue >= std::stof(data->dataPointers[i][col])) + if (nIntVal <= std::stoi(csv->dataPointers[i][nCol])) { g_pSquirrel->pushinteger(sqvm, i); return SQRESULT_NOTNULL; } } + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableRowLessThanOrEqualToFloatValue(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowGreaterThanOrEqualToFloatValue(HSquirrelVM* sqvm) { - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableRowLessThanOrEqualToFloatValue"](sqvm); - } - - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - int col = g_pSquirrel->getinteger(sqvm, 2); - int compareValue = g_pSquirrel->getfloat(sqvm, 3); + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableRowGreaterThanOrEqualToFloatValue"](sqvm); - for (int i = 0; i < data->dataPointers.size(); i++) + CSVData* csv = *pData; + int nCol = g_pSquirrel->getinteger(sqvm, 2); + const float flFloatVal = g_pSquirrel->getfloat(sqvm, 3); + for (int i = 0; i < csv->dataPointers.size(); i++) { - - if (compareValue <= std::stof(data->dataPointers[i][col])) + if (flFloatVal >= std::stof(csv->dataPointers[i][nCol])) { g_pSquirrel->pushinteger(sqvm, i); return SQRESULT_NOTNULL; } } + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT GetDataTableRowMatchingVectorValue(HSquirrelVM* sqvm) +template SQRESULT SQ_GetDataTableRowLessThanOrEqualToFloatValue(HSquirrelVM* sqvm) { - csvData** dataPointer; - long long typeId; - g_pSquirrel->getuserdata(sqvm, 2, (void**)&dataPointer, &typeId); - csvData* data = *dataPointer; - if (typeId == vanillaDatatableTypeId) - { - return g_pSquirrel->m_funcOriginals["GetDataTableRowMatchingVectorValue"](sqvm); - } - - if (typeId != customDatatableTypeId) - { - return SQRESULT_ERROR; - } + CSVData** pData; + uint64_t typeId; + g_pSquirrel->getuserdata(sqvm, 2, &pData, &typeId); - int col = g_pSquirrel->getinteger(sqvm, 2); - float* compareValue = g_pSquirrel->getvector(sqvm, 3); + if (typeId != USERDATA_TYPE_DATATABLE_CUSTOM) + return g_pSquirrel->m_funcOriginals["GetDataTableRowLessThanOrEqualToFloatValue"](sqvm); - for (int i = 0; i < data->dataPointers.size(); i++) + CSVData* csv = *pData; + int nCol = g_pSquirrel->getinteger(sqvm, 2); + const float flFloatVal = g_pSquirrel->getfloat(sqvm, 3); + for (int i = 0; i < csv->dataPointers.size(); i++) { - float dataTableVector[3]; - StringToVector(data->dataPointers[i][col], dataTableVector); - if ((dataTableVector[0] == compareValue[0]) && (dataTableVector[1] == compareValue[1]) && (dataTableVector[2] == compareValue[2])) + if (flFloatVal <= std::stof(csv->dataPointers[i][nCol])) { g_pSquirrel->pushinteger(sqvm, i); return SQRESULT_NOTNULL; } } + g_pSquirrel->pushinteger(sqvm, -1); return SQRESULT_NOTNULL; } -template SQRESULT DumpDataTable(HSquirrelVM* sqvm) +std::string DataTableToString(Datatable* datatable) { + std::string sCSVString; - DataTable* datatable = (DataTable*)getDataTableStructure(sqvm); - if (datatable == 0) + // write columns + bool bShouldComma = false; + for (int i = 0; i < datatable->numColumns; i++) { - spdlog::info("datatable not loaded"); - g_pSquirrel->pushinteger(sqvm, 1); - return SQRESULT_NOTNULL; - } - // spdlog::info("Datatable size row = {} col = {}", datatable->rowAmount, datatable->columnAmount); - // std::string header = std::string(datatable->columnInfo[0].name); - - spdlog::info(DataTableToString(datatable)); - - return SQRESULT_NULL; -} + if (bShouldComma) + sCSVString += ','; + else + bShouldComma = true; -template SQRESULT DumpDataTableToFile(HSquirrelVM* sqvm) -{ - DataTable* datatable = (DataTable*)getDataTableStructure(sqvm); - if (datatable == 0) - { - spdlog::info("datatable not loaded"); - g_pSquirrel->pushinteger(sqvm, 1); - return SQRESULT_NOTNULL; + sCSVString += datatable->columnInfo[i].name; } - // spdlog::info("Datatable size row = {} col = {}", datatable->rowAmount, datatable->columnAmount); - // std::string header = std::string(datatable->columnInfo[0].name); - const char* pathName = g_pSquirrel->getstring(sqvm, 2); - std::ofstream ofs(pathName); - std::string data = DataTableToString(datatable); - ofs.write(data.c_str(), data.size()); - ofs.close(); - return SQRESULT_NULL; -} -std::string DataTableToString(DataTable* datatable) -{ - std::string line = std::string(datatable->columnInfo[0].name); - for (int col = 1; col < datatable->columnAmount; col++) - { - ColumnInfo* colInfo = &datatable->columnInfo[col]; - line += "," + std::string(colInfo->name); - } - line += std::string("\n"); - for (int row = 0; row < datatable->rowAmount; row++) + // write rows + for (int row = 0; row < datatable->numRows; row++) { + sCSVString += '\n'; - bool seperator = false; - for (int col = 0; col < datatable->columnAmount; col++) + bool bShouldComma = false; + for (int col = 0; col < datatable->numColumns; col++) { - if (seperator) - { - line += std::string(","); - } - seperator = true; - ColumnInfo* colInfo = &datatable->columnInfo[col]; - switch (colInfo->type) + if (bShouldComma) + sCSVString += ','; + else + bShouldComma = true; + + // output typed data + ColumnInfo column = datatable->columnInfo[col]; + const void* pUntypedVal = datatable->data + column.offset + row * datatable->rowInfo; + switch (column.type) { - case 0: + case DatatableType::BOOL: { - bool input = *((bool*)(datatable->data + colInfo->offset + row * datatable->rowInfo)); - if (input) - { - line += std::string("1"); - } - else - { - line += std::string("0"); - } + sCSVString += *(bool*)pUntypedVal ? '1' : '0'; break; } - case 1: + + case DatatableType::INT: { - int input = *((int*)(datatable->data + colInfo->offset + row * datatable->rowInfo)); - line += std::to_string(input); + sCSVString += std::to_string(*(int*)pUntypedVal); break; } - case 2: + + case DatatableType::FLOAT: { - float input = *((float*)(datatable->data + colInfo->offset + row * datatable->rowInfo)); - line += std::to_string(input); + sCSVString += std::to_string(*(float*)pUntypedVal); break; } - case 3: + + case DatatableType::VECTOR: { - float* input = ((float*)(datatable->data + colInfo->offset + row * datatable->rowInfo)); - char string[256]; - snprintf(string, 256, "\"<%f,%f,%f>\"", input[0], input[1], input[2]); - line += std::string(string); + Vector3 pVector((float*)pUntypedVal); + sCSVString += fmt::format("<{},{},{}>", pVector.x, pVector.y, pVector.z); break; } - case 4: - case 5: - case 6: + case DatatableType::STRING: + case DatatableType::ASSET: + case DatatableType::UNK_STRING: { - char* string = *((char**)(datatable->data + colInfo->offset + row * datatable->rowInfo)); - line += "\"" + std::string(string) + "\""; + sCSVString += fmt::format("\"{}\"", *(char**)pUntypedVal); break; } } } - line += std::string("\n"); } - return line; + + return sCSVString; +} + +void DumpDatatable(const char* pDatatablePath) +{ + Datatable* pDatatable = (Datatable*)g_pPakLoadManager->LoadFile(pDatatablePath); + if (!pDatatable) + { + spdlog::error("couldn't load datatable {} (rpak containing it may not be loaded?)", pDatatablePath); + return; + } + + std::string sOutputPath(fmt::format("{}/scripts/datatable/{}.csv", R2::g_pModName, fs::path(pDatatablePath).stem().string())); + std::string sDatatableContents(DataTableToString(pDatatable)); + + fs::create_directories(fs::path(sOutputPath).remove_filename()); + std::ofstream outputStream(sOutputPath); + outputStream.write(sDatatableContents.c_str(), sDatatableContents.size()); + outputStream.close(); + + spdlog::info("dumped datatable {} {} to {}", pDatatablePath, (void*)pDatatable, sOutputPath); +} + +void ConCommand_dump_datatable(const CCommand& args) +{ + if (args.ArgC() < 2) + { + spdlog::info("usage: dump_datatable datatable/tablename.rpak"); + return; + } + + DumpDatatable(args.Arg(1)); } -void datatableReleaseHook(void* d, int size) +void ConCommand_dump_datatables(const CCommand& args) { - csvData* data = *(csvData**)d; - free(data->fullData); - delete data; + // likely not a comprehensive list, might be missing a couple? + static const std::vector VANILLA_DATATABLE_PATHS = { + "datatable/burn_meter_rewards.rpak", + "datatable/burn_meter_store.rpak", + "datatable/calling_cards.rpak", + "datatable/callsign_icons.rpak", + "datatable/camo_skins.rpak", + "datatable/default_pilot_loadouts.rpak", + "datatable/default_titan_loadouts.rpak", + "datatable/faction_leaders.rpak", + "datatable/fd_awards.rpak", + "datatable/features_mp.rpak", + "datatable/non_loadout_weapons.rpak", + "datatable/pilot_abilities.rpak", + "datatable/pilot_executions.rpak", + "datatable/pilot_passives.rpak", + "datatable/pilot_properties.rpak", + "datatable/pilot_weapons.rpak", + "datatable/pilot_weapon_features.rpak", + "datatable/pilot_weapon_mods.rpak", + "datatable/pilot_weapon_mods_common.rpak", + "datatable/playlist_items.rpak", + "datatable/titans_mp.rpak", + "datatable/titan_abilities.rpak", + "datatable/titan_executions.rpak", + "datatable/titan_fd_upgrades.rpak", + "datatable/titan_nose_art.rpak", + "datatable/titan_passives.rpak", + "datatable/titan_primary_mods.rpak", + "datatable/titan_primary_mods_common.rpak", + "datatable/titan_primary_weapons.rpak", + "datatable/titan_properties.rpak", + "datatable/titan_skins.rpak", + "datatable/titan_voices.rpak", + "datatable/unlocks_faction_level.rpak", + "datatable/unlocks_fd_titan_level.rpak", + "datatable/unlocks_player_level.rpak", + "datatable/unlocks_random.rpak", + "datatable/unlocks_titan_level.rpak", + "datatable/unlocks_weapon_level_pilot.rpak", + "datatable/weapon_skins.rpak", + "datatable/xp_per_faction_level.rpak", + "datatable/xp_per_fd_titan_level.rpak", + "datatable/xp_per_player_level.rpak", + "datatable/xp_per_titan_level.rpak", + "datatable/xp_per_weapon_level.rpak", + "datatable/faction_leaders_dropship_anims.rpak", + "datatable/score_events.rpak", + "datatable/startpoints.rpak", + "datatable/sp_levels.rpak", + "datatable/community_entries.rpak", + "datatable/spotlight_images.rpak", + "datatable/death_hints_mp.rpak", + "datatable/flightpath_assets.rpak", + "datatable/earn_meter_mp.rpak", + "datatable/battle_chatter_voices.rpak", + "datatable/battle_chatter.rpak", + "datatable/titan_os_conversations.rpak", + "datatable/faction_dialogue.rpak", + "datatable/grunt_chatter_mp.rpak", + "datatable/spectre_chatter_mp.rpak", + "datatable/pain_death_sounds.rpak", + "datatable/caller_ids_mp.rpak"}; + + for (const char* datatable : VANILLA_DATATABLE_PATHS) + DumpDatatable(datatable); } -template void RegisterDataTableFunctions() +template void RegisterDataTableFunctions() { - g_pSquirrel->AddFuncOverride("GetDataTable", GetDatatable); - g_pSquirrel->AddFuncOverride("GetDataTableColumnByName", GetDatatabeColumnByName); - g_pSquirrel->AddFuncOverride("GetDatatableRowCount", GetDatatabeRowCount); - g_pSquirrel->AddFuncOverride("GetDataTableString", GetDataTableString); - g_pSquirrel->AddFuncOverride("GetDataTableInt", GetDataTableInt); - g_pSquirrel->AddFuncOverride("GetDataTableFloat", GetDataTableFloat); - g_pSquirrel->AddFuncOverride("GetDataTableBool", GetDataTableBool); - g_pSquirrel->AddFuncOverride("GetDataTableAsset", GetDataTableAsset); - g_pSquirrel->AddFuncOverride("GetDataTableVector", GetDataTableVector); - g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingStringValue", GetDataTableRowMatchingStringValue); - g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingAssetValue", GetDataTableRowMatchingAssetValue); - g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingFloatValue", GetDataTableRowMatchingFloatValue); - g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingIntValue", GetDataTableRowMatchingIntValue); - g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingVectorValue", GetDataTableRowMatchingVectorValue); + g_pSquirrel->AddFuncOverride("GetDataTable", SQ_GetDatatable); + g_pSquirrel->AddFuncOverride("GetDataTableColumnByName", SQ_GetDataTableColumnByName); + g_pSquirrel->AddFuncOverride("GetDatatableRowCount", SQ_GetDataTableRowCount); + g_pSquirrel->AddFuncOverride("GetDataTableString", SQ_GetDataTableString); + g_pSquirrel->AddFuncOverride("GetDataTableInt", SQ_GetDataTableInt); + g_pSquirrel->AddFuncOverride("GetDataTableFloat", SQ_GetDataTableFloat); + g_pSquirrel->AddFuncOverride("GetDataTableBool", SQ_GetDataTableBool); + g_pSquirrel->AddFuncOverride("GetDataTableAsset", SQ_GetDataTableAsset); + g_pSquirrel->AddFuncOverride("GetDataTableVector", SQ_GetDataTableVector); + g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingStringValue", SQ_GetDataTableRowMatchingStringValue); + g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingAssetValue", SQ_GetDataTableRowMatchingAssetValue); + g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingFloatValue", SQ_GetDataTableRowMatchingFloatValue); + g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingIntValue", SQ_GetDataTableRowMatchingIntValue); + g_pSquirrel->AddFuncOverride("GetDataTableRowMatchingVectorValue", SQ_GetDataTableRowMatchingVectorValue); g_pSquirrel->AddFuncOverride( - "GetDataTableRowLessThanOrEqualToFloatValue", GetDataTableRowLessThanOrEqualToFloatValue); + "GetDataTableRowLessThanOrEqualToFloatValue", SQ_GetDataTableRowLessThanOrEqualToFloatValue); g_pSquirrel->AddFuncOverride( - "GetDataTableRowGreaterThanOrEqualToFloatValue", GetDataTableRowGreaterThanOrEqualToFloatValue); - g_pSquirrel->AddFuncOverride("GetDataTableRowLessThanOrEqualToIntValue", GetDataTableRowLessThanOrEqualToIntValue); + "GetDataTableRowGreaterThanOrEqualToFloatValue", SQ_GetDataTableRowGreaterThanOrEqualToFloatValue); + g_pSquirrel->AddFuncOverride("GetDataTableRowLessThanOrEqualToIntValue", SQ_GetDataTableRowLessThanOrEqualToIntValue); g_pSquirrel->AddFuncOverride( - "GetDataTableRowGreaterThanOrEqualToFloatValue", GetDataTableRowGreaterThanOrEqualToIntValue); + "GetDataTableRowGreaterThanOrEqualToFloatValue", SQ_GetDataTableRowGreaterThanOrEqualToIntValue); } ON_DLL_LOAD_RELIESON("server.dll", ServerScriptDatatables, ServerSquirrel, (CModule module)) { RegisterDataTableFunctions(); - g_pSquirrel->AddFuncRegistration( - "void", "DumpDataTable", "var", "Dumps rpak datatable contents to console", DumpDataTable); - // g_pSquirrel->AddFuncRegistration( "void", "DumpDataTableToFile", "var,string", "Dumps datatable contents to - // console", DumpDataTableToFile); - getDataTableStructure = module.Offset(0x1250f0).As(); + SQ_GetDatatableInternal = module.Offset(0x1250f0).As(); } ON_DLL_LOAD_RELIESON("client.dll", ClientScriptDatatables, ClientSquirrel, (CModule module)) { - RegisterDataTableFunctions(); RegisterDataTableFunctions(); + + SQ_GetDatatableInternal = module.Offset(0x1C9070).As(); + SQ_GetDatatableInternal = SQ_GetDatatableInternal; } -ON_DLL_LOAD_RELIESON("engine.dll", GeneralScriptDataTables, ConCommand, (CModule module)) +ON_DLL_LOAD_RELIESON("engine.dll", SharedScriptDataTables, ConVar, (CModule module)) { - Cvar_ns_prefer_datatable_from_disk = - new ConVar("ns_prefer_datatable_from_disk", "0", FCVAR_NONE, "whether datatables from disk overwrite rpak datatables"); - if (Tier0::CommandLine()->CheckParm("-nopakdedi")) - { - Cvar_ns_prefer_datatable_from_disk->SetValue(true); - } + Cvar_ns_prefer_datatable_from_disk = new ConVar( + "ns_prefer_datatable_from_disk", + IsDedicatedServer() && Tier0::CommandLine()->CheckParm("-nopakdedi") ? "1" : "0", + FCVAR_NONE, + "whether to prefer loading datatables from disk, rather than rpak"); + + RegisterConCommand("dump_datatables", ConCommand_dump_datatables, "dumps all datatables from a hardcoded list", FCVAR_NONE); + RegisterConCommand("dump_datatable", ConCommand_dump_datatable, "dump a datatable", FCVAR_NONE); } \ No newline at end of file diff --git a/NorthstarDLL/scriptservertoclientstringcommand.cpp b/NorthstarDLL/scriptservertoclientstringcommand.cpp index 555ea7cf..b3a405fc 100644 --- a/NorthstarDLL/scriptservertoclientstringcommand.cpp +++ b/NorthstarDLL/scriptservertoclientstringcommand.cpp @@ -5,11 +5,11 @@ void ConCommand_ns_script_servertoclientstringcommand(const CCommand& arg) { - if (g_pSquirrel->SquirrelVM && + if (g_pSquirrel->m_pSQVM && g_pSquirrel->setupfunc("NSClientCodeCallback_RecievedServerToClientStringCommand") != SQRESULT_ERROR) { - g_pSquirrel->pushstring(g_pSquirrel->sqvm, arg.ArgS()); - g_pSquirrel->call(g_pSquirrel->sqvm, 1); // todo: doesn't throw or log errors from within this, probably not great behaviour + g_pSquirrel->pushstring(g_pSquirrel->m_pSQVM->sqvm, arg.ArgS()); + g_pSquirrel->call(g_pSquirrel->m_pSQVM->sqvm, 1); // todo: doesn't throw or log errors from within this, probably not great behaviour } } diff --git a/NorthstarDLL/serverchathooks.cpp b/NorthstarDLL/serverchathooks.cpp index a87a0034..bc9098dc 100644 --- a/NorthstarDLL/serverchathooks.cpp +++ b/NorthstarDLL/serverchathooks.cpp @@ -54,10 +54,10 @@ void,, (CServerGameDLL* self, unsigned int senderPlayerId, const char* text, boo if (g_pSquirrel->setupfunc("CServerGameDLL_ProcessMessageStartThread") != SQRESULT_ERROR) { - g_pSquirrel->pushinteger(g_pSquirrel->sqvm, (int)senderPlayerId - 1); - g_pSquirrel->pushstring(g_pSquirrel->sqvm, text); - g_pSquirrel->pushbool(g_pSquirrel->sqvm, isTeam); - g_pSquirrel->call(g_pSquirrel->sqvm, 3); + g_pSquirrel->pushinteger(g_pSquirrel->m_pSQVM->sqvm, (int)senderPlayerId - 1); + g_pSquirrel->pushstring(g_pSquirrel->m_pSQVM->sqvm, text); + g_pSquirrel->pushbool(g_pSquirrel->m_pSQVM->sqvm, isTeam); + g_pSquirrel->call(g_pSquirrel->m_pSQVM->sqvm, 3); } else _CServerGameDLL__OnReceivedSayTextMessage(self, senderPlayerId, text, isTeam); diff --git a/NorthstarDLL/squirrel.cpp b/NorthstarDLL/squirrel.cpp index 056fe401..4bd4bca8 100644 --- a/NorthstarDLL/squirrel.cpp +++ b/NorthstarDLL/squirrel.cpp @@ -4,6 +4,7 @@ #include "modmanager.h" #include "dedicated.h" #include "r2engine.h" +#include "tier0.h" AUTOHOOK_INIT() @@ -41,6 +42,58 @@ eSQReturnType SQReturnTypeFromString(const char* pReturnType) return eSQReturnType::Default; // previous default value } +const char* SQTypeNameFromID(int type) +{ + switch (type) + { + case OT_ASSET: + return "asset"; + case OT_INTEGER: + return "int"; + case OT_BOOL: + return "bool"; + case SQOBJECT_NUMERIC: + return "float or int"; + case OT_NULL: + return "null"; + case OT_VECTOR: + return "vector"; + case 0: + return "var"; + case OT_USERDATA: + return "userdata"; + case OT_FLOAT: + return "float"; + case OT_STRING: + return "string"; + case OT_ARRAY: + return "array"; + case 0x8000200: + return "function"; + case 0x8100000: + return "structdef"; + case OT_THREAD: + return "thread"; + case OT_FUNCPROTO: + return "function"; + case OT_CLAAS: + return "class"; + case OT_WEAKREF: + return "weakref"; + case 0x8080000: + return "unimplemented function"; + case 0x8200000: + return "struct instance"; + case OT_TABLE: + return "table"; + case 0xA008000: + return "instance"; + case OT_ENTITY: + return "entity"; + } + return ""; +} + // needed to define implementations for squirrelmanager outside of squirrel.h without compiler errors template class SquirrelManager; template class SquirrelManager; @@ -48,13 +101,12 @@ template class SquirrelManager; template void SquirrelManager::VMCreated(CSquirrelVM* newSqvm) { - SquirrelVM = newSqvm; - sqvm = SquirrelVM->sqvm; // honestly not 100% sure on what this is, but alot of functions take it + m_pSQVM = newSqvm; for (SQFuncRegistration* funcReg : m_funcRegistrations) { spdlog::info("Registering {} function {}", GetContextName(context), funcReg->squirrelFuncName); - RegisterSquirrelFunc(SquirrelVM, funcReg, 1); + RegisterSquirrelFunc(m_pSQVM, funcReg, 1); } for (auto& pair : g_pModManager->m_DependencyConstants) @@ -72,18 +124,18 @@ template void SquirrelManager::VMCreated(CSquir } } - defconst(SquirrelVM, pair.first.c_str(), bWasFound); + defconst(m_pSQVM, pair.first.c_str(), bWasFound); } } template void SquirrelManager::VMDestroyed() { - SquirrelVM = nullptr; + m_pSQVM = nullptr; } template void SquirrelManager::ExecuteCode(const char* pCode) { - if (!SquirrelVM) + if (!m_pSQVM) { spdlog::error("Cannot execute code, {} squirrel vm is not initialised", GetContextName(context)); return; @@ -99,8 +151,8 @@ template void SquirrelManager::ExecuteCode(cons if (compileResult != SQRESULT_ERROR) { - pushroottable(sqvm); - SQRESULT callResult = call(sqvm, 0); + pushroottable(m_pSQVM->sqvm); + SQRESULT callResult = call(m_pSQVM->sqvm, 0); spdlog::info("sq_call returned {}", PrintSQRESULT.at(callResult)); } } @@ -131,29 +183,36 @@ template void SquirrelManager::AddFuncRegistrat template SQRESULT SquirrelManager::setupfunc(const SQChar* funcname) { - pushroottable(sqvm); - pushstring(sqvm, funcname, -1); + pushroottable(m_pSQVM->sqvm); + pushstring(m_pSQVM->sqvm, funcname, -1); - SQRESULT result = get(sqvm, -2); + SQRESULT result = get(m_pSQVM->sqvm, -2); if (result != SQRESULT_ERROR) - pushroottable(sqvm); + pushroottable(m_pSQVM->sqvm); return result; } + template void SquirrelManager::AddFuncOverride(std::string name, SQFunction func) { m_funcOverrides[name] = func; } // hooks +bool IsUIVM(ScriptContext context, HSquirrelVM* pSqvm) +{ + return context != ScriptContext::SERVER && g_pSquirrel->m_pSQVM && + g_pSquirrel->m_pSQVM->sqvm == pSqvm; +} + template void* (*sq_compiler_create)(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError); template void* sq_compiler_createHook(HSquirrelVM* sqvm, void* a2, void* a3, SQBool bShouldThrowError) { // store whether errors generated from this compile should be fatal - if (context == ScriptContext::CLIENT && sqvm == g_pSquirrel->sqvm) - g_pSquirrel->m_bCompilationErrorsFatal = bShouldThrowError; + if (IsUIVM(context, sqvm)) + g_pSquirrel->m_bFatalCompilationErrors = bShouldThrowError; else - g_pSquirrel->m_bCompilationErrorsFatal = bShouldThrowError; + g_pSquirrel->m_bFatalCompilationErrors = bShouldThrowError; return sq_compiler_create(sqvm, a2, a3, bShouldThrowError); } @@ -179,7 +238,7 @@ template SQInteger SQPrintHook(HSquirrelVM* sqvm, const return 0; } -template CSquirrelVM* (*CreateNewVM)(void* a1, ScriptContext contextArg); +template CSquirrelVM* (*CreateNewVM)(void* a1, ScriptContext realContext); template CSquirrelVM* CreateNewVMHook(void* a1, ScriptContext realContext) { CSquirrelVM* sqvm = CreateNewVM(a1, realContext); @@ -192,11 +251,11 @@ template CSquirrelVM* CreateNewVMHook(void* a1, ScriptCo return sqvm; } -template void (*DestroyVM)(void* a1, void* sqvm); -template void DestroyVMHook(void* a1, void* sqvm) +template void (*DestroyVM)(void* a1, HSquirrelVM* sqvm); +template void DestroyVMHook(void* a1, HSquirrelVM* sqvm) { ScriptContext realContext = context; // ui and client use the same function so we use this for prints - if (context == ScriptContext::CLIENT && sqvm == g_pSquirrel->sqvm) + if (IsUIVM(context, sqvm)) { realContext = ScriptContext::UI; g_pSquirrel->VMDestroyed(); @@ -204,18 +263,18 @@ template void DestroyVMHook(void* a1, void* sqvm) else DestroyVM(a1, sqvm); - spdlog::info("DestroyVM {} {}", GetContextName(realContext), sqvm); + spdlog::info("DestroyVM {} {}", GetContextName(realContext), (void*)sqvm); } -template void (*SQCompileError)(void* sqvm, const char* error, const char* file, int line, int column); -template void ScriptCompileErrorHook(void* sqvm, const char* error, const char* file, int line, int column) +template void (*SQCompileError)(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column); +template void ScriptCompileErrorHook(HSquirrelVM* sqvm, const char* error, const char* file, int line, int column) { - bool bIsFatalError = g_pSquirrel->m_bCompilationErrorsFatal; + bool bIsFatalError = g_pSquirrel->m_bFatalCompilationErrors; ScriptContext realContext = context; // ui and client use the same function so we use this for prints - if (context == ScriptContext::CLIENT && sqvm == g_pSquirrel->sqvm) + if (IsUIVM(context, sqvm)) { realContext = ScriptContext::UI; - bIsFatalError = g_pSquirrel->m_bCompilationErrorsFatal; + bIsFatalError = g_pSquirrel->m_bFatalCompilationErrors; } spdlog::error("{} SCRIPT COMPILE ERROR {}", GetContextName(realContext), error); @@ -247,11 +306,10 @@ template void ScriptCompileErrorHook(void* sqvm, const c // dont call the original function since it kills game lol } -template int64_t (*RegisterSquirrelFunction)(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown); +template int64_t(*RegisterSquirrelFunction)(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown); template int64_t RegisterSquirrelFunctionHook(CSquirrelVM* sqvm, SQFuncRegistration* funcReg, char unknown) { - - if (context == ScriptContext::CLIENT && sqvm == g_pSquirrel->SquirrelVM) + if (IsUIVM(context, sqvm->sqvm)) { if (g_pSquirrel->m_funcOverrides.count(funcReg->squirrelFuncName)) { @@ -263,7 +321,7 @@ template int64_t RegisterSquirrelFunctionHook(CSquirrelV return g_pSquirrel->RegisterSquirrelFunc(sqvm, funcReg, unknown); } - if (g_pSquirrel->m_funcOverrides.count(funcReg->squirrelFuncName)) + if (g_pSquirrel->m_funcOverrides.find(funcReg->squirrelFuncName) != g_pSquirrel->m_funcOverrides.end()) { g_pSquirrel->m_funcOriginals[funcReg->squirrelFuncName] = funcReg->funcPtr; funcReg->funcPtr = g_pSquirrel->m_funcOverrides[funcReg->squirrelFuncName]; @@ -276,7 +334,6 @@ template int64_t RegisterSquirrelFunctionHook(CSquirrelV template bool (*CallScriptInitCallback)(void* sqvm, const char* callback); template bool CallScriptInitCallbackHook(void* sqvm, const char* callback) { - ScriptContext realContext = context; bool bShouldCallCustomCallbacks = true; @@ -346,21 +403,43 @@ template void ConCommand_script(const CCommand& args) g_pSquirrel->ExecuteCode(args.ArgS()); } -SQRESULT SQ_Stub(HSquirrelVM* sqvm) +// literal class type that wraps a constant expression string +template struct TemplateStringLiteral +{ + constexpr TemplateStringLiteral(const char (&str)[N]) + { + std::copy_n(str, N, value); + } + + char value[N]; +}; + +template SQRESULT SQ_StubbedFunc(HSquirrelVM* sqvm) { - spdlog::info("Stubbed Function called"); + spdlog::info("Blocking call to stubbed function {} in {}", funcName.value, GetContextName(context)); return SQRESULT_NULL; } +template void StubUnsafeSQFuncs() +{ + if (!Tier0::CommandLine()->CheckParm("-allowunsafesqfuncs")) + { + g_pSquirrel->AddFuncOverride("DevTextBufferWrite", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("DevTextBufferClear", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("DevTextBufferDumpToFile", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("Dev_CommandLineAddParam", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("DevP4Checkout", SQ_StubbedFunc); + g_pSquirrel->AddFuncOverride("DevP4Add", SQ_StubbedFunc); + } +} + ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) { AUTOHOOK_DISPATCH_MODULE(client.dll) g_pSquirrel = new SquirrelManager; g_pSquirrel = new SquirrelManager; - - // g_pSquirrel->RegisterSquirrelFunc = module.Offset(0x108E0).As(); - // g_pSquirrel->RegisterSquirrelFunc = g_pSquirrel->RegisterSquirrelFunc; + g_pSquirrel->__sq_defconst = module.Offset(0x12120).As(); g_pSquirrel->__sq_defconst = g_pSquirrel->__sq_defconst; @@ -419,6 +498,12 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) g_pSquirrel->__sq_createuserdata = g_pSquirrel->__sq_createuserdata; g_pSquirrel->__sq_setuserdatatypeid = g_pSquirrel->__sq_setuserdatatypeid; + MAKEHOOK( + module.Offset(0x108E0), + &RegisterSquirrelFunctionHook, + &g_pSquirrel->RegisterSquirrelFunc); + g_pSquirrel->RegisterSquirrelFunc = g_pSquirrel->RegisterSquirrelFunc; + // uiscript_reset concommand: don't loop forever if compilation fails module.Offset(0x3C6E4C).NOP(6); @@ -431,31 +516,16 @@ ON_DLL_LOAD_RELIESON("client.dll", ClientSquirrel, ConCommand, (CModule module)) MAKEHOOK(module.Offset(0x26E70), &DestroyVMHook, &DestroyVM); MAKEHOOK(module.Offset(0x79A50), &ScriptCompileErrorHook, &SQCompileError); - MAKEHOOK(module.Offset(0x10190), &CallScriptInitCallbackHook, &CallScriptInitCallback); - MAKEHOOK( - module.Offset(0x108E0), - &RegisterSquirrelFunctionHook, - &g_pSquirrel->RegisterSquirrelFunc); - - g_pSquirrel->RegisterSquirrelFunc = g_pSquirrel->RegisterSquirrelFunc; + module.Offset(0x10190), + &CallScriptInitCallbackHook, + &CallScriptInitCallback); RegisterConCommand("script_client", ConCommand_script, "Executes script code on the client vm", FCVAR_CLIENTDLL); RegisterConCommand("script_ui", ConCommand_script, "Executes script code on the ui vm", FCVAR_CLIENTDLL); - g_pSquirrel->AddFuncOverride("DevTextBufferWrite", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevTextBufferClear", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevTextBufferDumpToFile", SQ_Stub); - g_pSquirrel->AddFuncOverride("Dev_CommandLineAddParam", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevP4Checkout", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevP4Add", SQ_Stub); - - g_pSquirrel->AddFuncOverride("DevTextBufferWrite", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevTextBufferClear", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevTextBufferDumpToFile", SQ_Stub); - g_pSquirrel->AddFuncOverride("Dev_CommandLineAddParam", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevP4Checkout", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevP4Add", SQ_Stub); + StubUnsafeSQFuncs(); + StubUnsafeSQFuncs(); } ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module)) @@ -464,7 +534,6 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module)) g_pSquirrel = new SquirrelManager; - // g_pSquirrel->RegisterSquirrelFunc = module.Offset(0x1DD10).As(); g_pSquirrel->__sq_defconst = module.Offset(0x1F550).As(); g_pSquirrel->__sq_compilebuffer = module.Offset(0x3110).As(); @@ -497,6 +566,11 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module)) g_pSquirrel->__sq_createuserdata = module.Offset(0x38D0).As(); g_pSquirrel->__sq_setuserdatatypeid = module.Offset(0x6470).As(); + MAKEHOOK( + module.Offset(0x1DD10), + &RegisterSquirrelFunctionHook, + &g_pSquirrel->RegisterSquirrelFunc); + MAKEHOOK(module.Offset(0x8AA0), &sq_compiler_createHook, &sq_compiler_create); MAKEHOOK(module.Offset(0x1FE90), &SQPrintHook, &SQPrint); @@ -505,11 +579,6 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module)) MAKEHOOK(module.Offset(0x799E0), &ScriptCompileErrorHook, &SQCompileError); MAKEHOOK(module.Offset(0x1D5C0), &CallScriptInitCallbackHook, &CallScriptInitCallback); - MAKEHOOK( - module.Offset(0x1DD10), - &RegisterSquirrelFunctionHook, - &g_pSquirrel->RegisterSquirrelFunc); - // FCVAR_CHEAT and FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS allows clients to execute this, but since it's unsafe we only allow it when cheats // are enabled for script_client and script_ui, we don't use cheats, so clients can execute them on themselves all they want RegisterConCommand( @@ -518,62 +587,5 @@ ON_DLL_LOAD_RELIESON("server.dll", ServerSquirrel, ConCommand, (CModule module)) "Executes script code on the server vm", FCVAR_GAMEDLL | FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS | FCVAR_CHEAT); - g_pSquirrel->AddFuncOverride("DevTextBufferWrite", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevTextBufferClear", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevTextBufferDumpToFile", SQ_Stub); - g_pSquirrel->AddFuncOverride("Dev_CommandLineAddParam", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevP4Checkout", SQ_Stub); - g_pSquirrel->AddFuncOverride("DevP4Add", SQ_Stub); + StubUnsafeSQFuncs(); } - -const char* SQTypeNameFromID(int type) -{ - switch (type) - { - case OT_ASSET: - return "asset"; - case OT_INTEGER: - return "int"; - case OT_BOOL: - return "bool"; - case SQOBJECT_NUMERIC: - return "float or int"; - case OT_NULL: - return "null"; - case OT_VECTOR: - return "vector"; - case 0: - return "var"; - case OT_USERDATA: - return "userdata"; - case OT_FLOAT: - return "float"; - case OT_STRING: - return "string"; - case OT_ARRAY: - return "array"; - case 0x8000200: - return "function"; - case 0x8100000: - return "structdef"; - case OT_THREAD: - return "thread"; - case OT_FUNCPROTO: - return "function"; - case OT_CLAAS: - return "class"; - case OT_WEAKREF: - return "weakref"; - case 0x8080000: - return "unimplemented function"; - case 0x8200000: - return "struct instance"; - case OT_TABLE: - return "table"; - case 0xA008000: - return "instance"; - case OT_ENTITY: - return "entity"; - } - return ""; -} \ No newline at end of file diff --git a/NorthstarDLL/squirrel.h b/NorthstarDLL/squirrel.h index fc727357..2fa50ba6 100644 --- a/NorthstarDLL/squirrel.h +++ b/NorthstarDLL/squirrel.h @@ -1,6 +1,8 @@ #pragma once #include "squirreldatatypes.h" +#include "vector.h" + // stolen from ttf2sdk: sqvm types typedef float SQFloat; typedef long SQInteger; @@ -37,8 +39,6 @@ const std::map PrintSQRESULT = { {SQRESULT_NOTNULL, "SQRESULT_NOTNULL"} }; - - struct CompileBufferState { const SQChar* buffer; @@ -123,12 +123,12 @@ typedef SQFloat (*sq_getfloatType)(HSquirrelVM*, SQInteger iStackpos); typedef SQBool (*sq_getboolType)(HSquirrelVM*, SQInteger iStackpos); typedef SQRESULT (*sq_getType)(HSquirrelVM* sqvm, SQInteger iStackpos); typedef SQRESULT (*sq_getassetType)(HSquirrelVM* sqvm, SQInteger iStackpos, const char** pResult); -typedef SQRESULT (*sq_getuserdataType)(HSquirrelVM* sqvm, SQInteger iStackpos, void** pData, long long* pTypeId); +typedef SQRESULT (*sq_getuserdataType)(HSquirrelVM* sqvm, SQInteger iStackpos, void** pData, uint64_t* pTypeId); typedef SQFloat* (*sq_getvectorType)(HSquirrelVM* sqvm, SQInteger iStackpos); // sq stack userpointer funcs typedef void* (*sq_createuserdataType)(HSquirrelVM* sqvm, SQInteger iSize); -typedef SQRESULT (*sq_setuserdatatypeidType)(HSquirrelVM* sqvm, SQInteger iStackpos, long long iTypeId); +typedef SQRESULT (*sq_setuserdatatypeidType)(HSquirrelVM* sqvm, SQInteger iStackpos, uint64_t iTypeId); template class SquirrelManager { @@ -136,12 +136,11 @@ template class SquirrelManager std::vector m_funcRegistrations; public: - CSquirrelVM* SquirrelVM; - HSquirrelVM* sqvm; + CSquirrelVM* m_pSQVM; std::map m_funcOverrides = {}; std::map m_funcOriginals = {}; - bool m_bCompilationErrorsFatal = false; + bool m_bFatalCompilationErrors = false; #pragma region SQVM funcs RegisterSquirrelFuncType RegisterSquirrelFunc; @@ -179,7 +178,7 @@ template class SquirrelManager #pragma endregion public: - SquirrelManager() : SquirrelVM(nullptr) {} + SquirrelManager() : m_pSQVM(nullptr) {} void VMCreated(CSquirrelVM* newSqvm); void VMDestroyed(); @@ -197,7 +196,7 @@ template class SquirrelManager inline SQRESULT compilebuffer(CompileBufferState* bufferState, const SQChar* bufferName = "unnamedbuffer", const SQBool bShouldThrowError = false) { - return __sq_compilebuffer(sqvm, bufferState, bufferName, -1, bShouldThrowError); + return __sq_compilebuffer(m_pSQVM->sqvm, bufferState, bufferName, -1, bShouldThrowError); } inline SQRESULT call(HSquirrelVM* sqvm, const SQInteger args) @@ -259,9 +258,10 @@ template class SquirrelManager { __sq_pushasset(sqvm, sVal, length); } - inline void pushvector(HSquirrelVM* sqvm, const SQFloat* pVal) + + inline void pushvector(HSquirrelVM* sqvm, const Vector3 pVal) { - __sq_pushvector(sqvm, pVal); + __sq_pushvector(sqvm, *(float**)&pVal); } inline const SQChar* getstring(HSquirrelVM* sqvm, const SQInteger stackpos) @@ -289,9 +289,10 @@ template class SquirrelManager return __sq_get(sqvm, stackpos); } - inline SQFloat* getvector(HSquirrelVM* sqvm, const SQInteger stackpos) + inline Vector3 getvector(HSquirrelVM* sqvm, const SQInteger stackpos) { - return __sq_getvector(sqvm, stackpos); + float* pRet = __sq_getvector(sqvm, stackpos); + return *(Vector3*)&pRet; } inline SQRESULT getasset(HSquirrelVM* sqvm, const SQInteger stackpos, const char** result) @@ -299,19 +300,19 @@ template class SquirrelManager return __sq_getasset(sqvm, stackpos, result); } - inline SQRESULT getuserdata(HSquirrelVM* sqvm, const SQInteger stackpos, void** data, long long* typeId) + template inline SQRESULT getuserdata(HSquirrelVM* sqvm, const SQInteger stackpos, T* data, uint64_t* typeId) { - return __sq_getuserdata(sqvm, stackpos, data, typeId); // this sometimes crashes idk + return __sq_getuserdata(sqvm, stackpos, (void**)data, typeId); // this sometimes crashes idk } - inline void* createuserdata(HSquirrelVM* sqvm, SQInteger size) + template inline T* createuserdata(HSquirrelVM* sqvm, SQInteger size) { void* ret = __sq_createuserdata(sqvm, size); memset(ret, 0, size); - return ret; + return (T*)ret; } - SQRESULT setuserdatatypeid(HSquirrelVM* sqvm, const SQInteger stackpos, long long typeId) + inline SQRESULT setuserdatatypeid(HSquirrelVM* sqvm, const SQInteger stackpos, uint64_t typeId) { return __sq_setuserdatatypeid(sqvm, stackpos, typeId); } diff --git a/NorthstarDLL/squirreldatatypes.h b/NorthstarDLL/squirreldatatypes.h index 95d079bf..818ce2a4 100644 --- a/NorthstarDLL/squirreldatatypes.h +++ b/NorthstarDLL/squirreldatatypes.h @@ -103,7 +103,7 @@ struct SQObject }; /* 138 */ -struct __declspec(align(8)) SQString +struct alignas(8) SQString { void* vftable; int uiRef; @@ -117,7 +117,7 @@ struct __declspec(align(8)) SQString }; /* 137 */ -struct __declspec(align(8)) SQTable +struct alignas(8) SQTable { void* vftable; unsigned char gap_08[4]; @@ -138,7 +138,7 @@ struct __declspec(align(8)) SQTable }; /* 140 */ -struct __declspec(align(8)) SQClosure +struct alignas(8) SQClosure { void* vftable; unsigned char gap_08[4]; @@ -157,7 +157,7 @@ struct __declspec(align(8)) SQClosure }; /* 139 */ -struct __declspec(align(8)) SQFunctionProto +struct alignas(8) SQFunctionProto { void* vftable; unsigned char gap_08[4]; @@ -198,7 +198,7 @@ struct SQStructDef }; /* 157 */ -struct __declspec(align(8)) SQNativeClosure +struct alignas(8) SQNativeClosure { void* vftable; int uiRef; @@ -233,7 +233,7 @@ struct SQArray }; /* 129 */ -struct __declspec(align(8)) HSquirrelVM +struct alignas(8) HSquirrelVM { void* vftable; int uiRef; @@ -398,7 +398,7 @@ struct tableNode }; /* 136 */ -struct __declspec(align(8)) CallInfo +struct alignas(8) CallInfo { long long ip; SQObject* _literals; @@ -420,7 +420,7 @@ struct StringTable }; /* 141 */ -struct __declspec(align(8)) SQStackInfos +struct alignas(8) SQStackInfos { char* _name; char* _sourceName; @@ -428,7 +428,7 @@ struct __declspec(align(8)) SQStackInfos }; /* 151 */ -struct __declspec(align(4)) SQInstruction +struct alignas(4) SQInstruction { int op; int arg1; diff --git a/NorthstarDLL/vector.h b/NorthstarDLL/vector.h new file mode 100644 index 00000000..a5d68003 --- /dev/null +++ b/NorthstarDLL/vector.h @@ -0,0 +1,44 @@ +#pragma once + +union Vector3 +{ + struct + { + float x; + float y; + float z; + }; + + float raw[3]; + + Vector3() : x(0), y(0), z(0) {} + Vector3(float* pRawFloats) // assumes float[3] => vector + { + memcpy(raw, pRawFloats, sizeof(this)); + } + + // 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; + } +}; \ No newline at end of file -- cgit v1.2.3