diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-26 03:16:46 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-26 03:16:46 +0100 |
commit | cc7b0ded08e3dc26fc970169a79c74c54e4f923b (patch) | |
tree | 6de8896695ab89534adaa912b9fdfac9d6bf396c /NorthstarDedicatedTest/clientauthhooks.cpp | |
parent | 93d540dd37298b9e9a6c1f07b5c4a8dc46a2787d (diff) | |
download | NorthstarLauncher-cc7b0ded08e3dc26fc970169a79c74c54e4f923b.tar.gz NorthstarLauncher-cc7b0ded08e3dc26fc970169a79c74c54e4f923b.zip |
lots of cleanup and starting moving to new hooking macros
Diffstat (limited to 'NorthstarDedicatedTest/clientauthhooks.cpp')
-rw-r--r-- | NorthstarDedicatedTest/clientauthhooks.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/NorthstarDedicatedTest/clientauthhooks.cpp b/NorthstarDedicatedTest/clientauthhooks.cpp index 6e1da395..7463028b 100644 --- a/NorthstarDedicatedTest/clientauthhooks.cpp +++ b/NorthstarDedicatedTest/clientauthhooks.cpp @@ -1,10 +1,10 @@ #include "pch.h" -#include "hooks.h" -#include "hookutils.h" #include "masterserver.h" #include "convar.h" #include "r2client.h" +AUTOHOOK_INIT() + ConVar* Cvar_ns_has_agreed_to_send_token; // mirrored in script @@ -12,9 +12,8 @@ const int NOT_DECIDED_TO_SEND_TOKEN = 0; const int AGREED_TO_SEND_TOKEN = 1; const int DISAGREED_TO_SEND_TOKEN = 2; -typedef void (*AuthWithStryderType)(void* a1); -AuthWithStryderType AuthWithStryder; -void AuthWithStryderHook(void* a1) +AUTOHOOK(AuthWithStryder, engine.dll + 0x1843A0, +void,, (void* a1), { // game will call this forever, until it gets a valid auth key // so, we need to manually invalidate our key until we're authed with northstar, then we'll allow game to auth with stryder @@ -23,24 +22,23 @@ void AuthWithStryderHook(void* a1) // if player has agreed to send token and we aren't already authing, try to auth if (Cvar_ns_has_agreed_to_send_token->GetInt() == AGREED_TO_SEND_TOKEN && !g_MasterServerManager->m_bOriginAuthWithMasterServerInProgress) - g_MasterServerManager->AuthenticateOriginWithMasterServer(R2::g_LocalPlayerUserID, R2::g_LocalPlayerOriginToken); + g_MasterServerManager->AuthenticateOriginWithMasterServer(R2::g_pLocalPlayerUserID, R2::g_pLocalPlayerOriginToken); // invalidate key so auth will fail - *R2::g_LocalPlayerOriginToken = 0; + *R2::g_pLocalPlayerOriginToken = 0; } AuthWithStryder(a1); -} +}) ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", ClientAuthHooks, ConVar, [](HMODULE baseAddress) { + AUTOHOOK_DISPATCH() + // this cvar will save to cfg once initially agreed with Cvar_ns_has_agreed_to_send_token = new ConVar( "ns_has_agreed_to_send_token", "0", FCVAR_ARCHIVE_PLAYERPROFILE, "whether the user has agreed to send their origin token to the northstar masterserver"); - - HookEnabler hook; - ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x1843A0, &AuthWithStryderHook, reinterpret_cast<LPVOID*>(&AuthWithStryder)); })
\ No newline at end of file |