aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-08-18 03:56:51 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-08-18 03:56:51 +0100
commit125f53aaa690e4870af88aa3a8947ac5ac0b435d (patch)
tree2ee0c9ec4abd9ad49850a8807b7afd5cc16dcddb /NorthstarDedicatedTest
parentf63b853468225e2bc675cde9484a27acfe8548b5 (diff)
downloadNorthstarLauncher-125f53aaa690e4870af88aa3a8947ac5ac0b435d.tar.gz
NorthstarLauncher-125f53aaa690e4870af88aa3a8947ac5ac0b435d.zip
lots of launcher stuff
Diffstat (limited to 'NorthstarDedicatedTest')
-rw-r--r--NorthstarDedicatedTest/dedicated.cpp51
-rw-r--r--NorthstarDedicatedTest/dllmain.cpp1
-rw-r--r--NorthstarDedicatedTest/modlocalisation.cpp16
-rw-r--r--NorthstarDedicatedTest/serverauthentication.cpp7
4 files changed, 56 insertions, 19 deletions
diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp
index 80ab4002..c7663201 100644
--- a/NorthstarDedicatedTest/dedicated.cpp
+++ b/NorthstarDedicatedTest/dedicated.cpp
@@ -7,7 +7,7 @@
bool IsDedicated()
{
// temp: should get this from commandline
- //return true;
+ return true;
return false;
}
@@ -20,9 +20,18 @@ enum EngineState_t
DLL_PAUSED, // engine is paused, can become active from this state
};
+struct CEngine
+{
+public:
+ char unknown[12];
+
+ EngineState_t m_nDllState;
+ EngineState_t m_nNextDllState;
+};
+
void InitialiseDedicated(HMODULE engineAddress)
{
- std::cout << "InitialiseDedicated()" << std::endl;
+ spdlog::info("InitialiseDedicated");
while (!IsDebuggerPresent())
Sleep(100);
@@ -66,6 +75,32 @@ void InitialiseDedicated(HMODULE engineAddress)
*(ptr + 4) = (char)0x90;
}
+ {
+ // runframeserver
+ char* ptr = (char*)engineAddress + 0x159819;
+ TempReadWrite rw(ptr);
+
+ // nop some access violations
+ *ptr = (char)0x90;
+ *(ptr + 1) = (char)0x90;
+ *(ptr + 2) = (char)0x90;
+ *(ptr + 3) = (char)0x90;
+ *(ptr + 4) = (char)0x90;
+ *(ptr + 5) = (char)0x90;
+ *(ptr + 6) = (char)0x90;
+ *(ptr + 7) = (char)0x90;
+ *(ptr + 8) = (char)0x90;
+ *(ptr + 9) = (char)0x90;
+ *(ptr + 10) = (char)0x90;
+ *(ptr + 11) = (char)0x90;
+ *(ptr + 12) = (char)0x90;
+ *(ptr + 13) = (char)0x90;
+ *(ptr + 14) = (char)0x90;
+ *(ptr + 15) = (char)0x90;
+ *(ptr + 16) = (char)0x90;
+ }
+
+
CDedicatedExports* dedicatedApi = new CDedicatedExports;
dedicatedApi->Sys_Printf = Sys_Printf;
dedicatedApi->RunServer = RunServer;
@@ -100,16 +135,16 @@ void RunServer(CDedicatedExports* dedicated)
CEngine__Frame engineFrame = (CEngine__Frame)((char*)engine + 0x1C8650);
CEngineAPI__ActivateSimulation engineApiStartSimulation = (CEngineAPI__ActivateSimulation)((char*)engine + 0x1C4370);
- void* cEnginePtr = (void*)((char*)engine + 0x7D70C8);
+ CEngine* cEnginePtr = (CEngine*)((char*)engine + 0x7D70C8);
CEngineAPI__SetMap engineApiSetMap = (CEngineAPI__SetMap)((char*)engine + 0x1C7B30);
-
- engineApiSetMap(nullptr, "mp_thaw");
- Sys_Printf(dedicated, (char*)"CDedicatedServerAPI::RunServer(): map mp_lobby");
+
+ // call once to init
+ engineFrame(cEnginePtr);
// allow us to hit CHostState::FrameUpdate
- //*((int*)((char*)cEnginePtr + 12)) = 2;
- //*((int*)((char*)cEnginePtr + 16)) = 2;
+ cEnginePtr->m_nDllState = EngineState_t::DLL_ACTIVE;
+ cEnginePtr->m_nNextDllState = EngineState_t::DLL_ACTIVE;
while (true)
{
diff --git a/NorthstarDedicatedTest/dllmain.cpp b/NorthstarDedicatedTest/dllmain.cpp
index 8cea40a0..12268d85 100644
--- a/NorthstarDedicatedTest/dllmain.cpp
+++ b/NorthstarDedicatedTest/dllmain.cpp
@@ -28,7 +28,6 @@ BOOL APIENTRY DllMain( HMODULE hModule,
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
- DisableThreadLibraryCalls(hModule);
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
diff --git a/NorthstarDedicatedTest/modlocalisation.cpp b/NorthstarDedicatedTest/modlocalisation.cpp
index ccc06722..25c9e19f 100644
--- a/NorthstarDedicatedTest/modlocalisation.cpp
+++ b/NorthstarDedicatedTest/modlocalisation.cpp
@@ -3,14 +3,17 @@
#include "hookutils.h"
#include "modmanager.h"
-typedef char(*AddLocalisationFileType)(void* g_pVguiLocalize, const char* path, const char* pathId);
+typedef bool(*AddLocalisationFileType)(void* g_pVguiLocalize, const char* path, const char* pathId, char unknown);
AddLocalisationFileType AddLocalisationFile;
bool loadModLocalisationFiles = true;
-char AddLocalisationFileHook(void* g_pVguiLocalize, const char* path, char* pathId)
+bool AddLocalisationFileHook(void* g_pVguiLocalize, const char* path, const char* pathId, char unknown)
{
- char ret = AddLocalisationFile(g_pVguiLocalize, path, pathId);
+ bool ret = AddLocalisationFile(g_pVguiLocalize, path, pathId, unknown);
+
+ if (ret)
+ spdlog::info("Loaded localisation file {} successfully", path);
if (!loadModLocalisationFiles)
return ret;
@@ -18,13 +21,8 @@ char AddLocalisationFileHook(void* g_pVguiLocalize, const char* path, char* path
loadModLocalisationFiles = false;
for (Mod* mod : g_ModManager->m_loadedMods)
- {
for (std::string& localisationFile : mod->LocalisationFiles)
- {
- spdlog::info("Adding mod localisation file {}", localisationFile);
- AddLocalisationFile(g_pVguiLocalize, localisationFile.c_str(), pathId);
- }
- }
+ AddLocalisationFile(g_pVguiLocalize, localisationFile.c_str(), pathId, unknown);
loadModLocalisationFiles = true;
diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp
index 68d98455..6dd44284 100644
--- a/NorthstarDedicatedTest/serverauthentication.cpp
+++ b/NorthstarDedicatedTest/serverauthentication.cpp
@@ -32,6 +32,7 @@ CGameClient__ExecuteStringCommandType CGameClient__ExecuteStringCommand;
ServerAuthenticationManager* g_ServerAuthenticationManager;
ConVar* Cvar_ns_player_auth_port;
+ConVar* Cvar_ns_erase_auth_info;
ConVar* CVar_ns_auth_allow_insecure;
ConVar* CVar_ns_auth_allow_insecure_write;
ConVar* CVar_sv_quota_stringcmdspersecond;
@@ -150,6 +151,9 @@ bool ServerAuthenticationManager::AuthenticatePlayer(void* player, int64_t uid,
bool ServerAuthenticationManager::RemovePlayerAuthData(void* player)
{
+ if (!Cvar_ns_erase_auth_info->m_nValue)
+ return false;
+
// we don't have our auth token at this point, so lookup authdata by uid
for (auto& auth : m_authData)
{
@@ -292,11 +296,12 @@ void InitialiseServerAuthentication(HMODULE baseAddress)
{
g_ServerAuthenticationManager = new ServerAuthenticationManager;
+ Cvar_ns_erase_auth_info = RegisterConVar("ns_erase_auth_info", "1", FCVAR_GAMEDLL, "Whether auth info should be erased from this server on disconnect or crash");
CVar_ns_auth_allow_insecure = RegisterConVar("ns_auth_allow_insecure", "0", FCVAR_GAMEDLL, "Whether this server will allow unauthenicated players to connect");
CVar_ns_auth_allow_insecure_write = RegisterConVar("ns_auth_allow_insecure_write", "0", FCVAR_GAMEDLL, "Whether the pdata of unauthenticated clients will be written to disk when changed");
// literally just stolen from a fix valve used in csgo
CVar_sv_quota_stringcmdspersecond = RegisterConVar("sv_quota_stringcmdspersecond", "60", FCVAR_NONE, "How many string commands per second clients are allowed to submit, 0 to disallow all string commands");
- Cvar_ns_player_auth_port = RegisterConVar("Cvar_ns_player_auth_port", "8081", FCVAR_GAMEDLL, "");
+ Cvar_ns_player_auth_port = RegisterConVar("ns_player_auth_port", "8081", FCVAR_GAMEDLL, "");
HookEnabler hook;
ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x114430, &CBaseServer__ConnectClientHook, reinterpret_cast<LPVOID*>(&CBaseServer__ConnectClient));