aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/server/auth/serverauthentication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL/server/auth/serverauthentication.cpp')
-rw-r--r--NorthstarDLL/server/auth/serverauthentication.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/NorthstarDLL/server/auth/serverauthentication.cpp b/NorthstarDLL/server/auth/serverauthentication.cpp
index d5653dcc..0d46426f 100644
--- a/NorthstarDLL/server/auth/serverauthentication.cpp
+++ b/NorthstarDLL/server/auth/serverauthentication.cpp
@@ -40,7 +40,7 @@ void ServerAuthenticationManager::AddRemotePlayer(std::string token, uint64_t ui
m_RemoteAuthenticationData[token] = newAuthData;
}
-void ServerAuthenticationManager::AddPlayer(R2::CBaseClient* pPlayer, const char* pToken)
+void ServerAuthenticationManager::AddPlayer(CBaseClient* pPlayer, const char* pToken)
{
PlayerAuthenticationData additionalData;
@@ -48,14 +48,14 @@ void ServerAuthenticationManager::AddPlayer(R2::CBaseClient* pPlayer, const char
if (remoteAuthData != m_RemoteAuthenticationData.end())
additionalData.pdataSize = remoteAuthData->second.pdataSize;
else
- additionalData.pdataSize = R2::PERSISTENCE_MAX_SIZE;
+ additionalData.pdataSize = PERSISTENCE_MAX_SIZE;
- additionalData.usingLocalPdata = pPlayer->m_iPersistenceReady == R2::ePersistenceReady::READY_INSECURE;
+ additionalData.usingLocalPdata = pPlayer->m_iPersistenceReady == ePersistenceReady::READY_INSECURE;
m_PlayerAuthenticationData.insert(std::make_pair(pPlayer, additionalData));
}
-void ServerAuthenticationManager::RemovePlayer(R2::CBaseClient* pPlayer)
+void ServerAuthenticationManager::RemovePlayer(CBaseClient* pPlayer)
{
if (m_PlayerAuthenticationData.count(pPlayer))
m_PlayerAuthenticationData.erase(pPlayer);
@@ -88,20 +88,20 @@ bool ServerAuthenticationManager::VerifyPlayerName(const char* pAuthToken, const
return true;
}
-bool ServerAuthenticationManager::IsDuplicateAccount(R2::CBaseClient* pPlayer, const char* pPlayerUid)
+bool ServerAuthenticationManager::IsDuplicateAccount(CBaseClient* pPlayer, const char* pPlayerUid)
{
if (m_bAllowDuplicateAccounts)
return false;
bool bHasUidPlayer = false;
- for (int i = 0; i < R2::g_pGlobals->m_nMaxClients; i++)
- if (&R2::g_pClientArray[i] != pPlayer && !strcmp(pPlayerUid, R2::g_pClientArray[i].m_UID))
+ for (int i = 0; i < g_pGlobals->m_nMaxClients; i++)
+ if (&g_pClientArray[i] != pPlayer && !strcmp(pPlayerUid, g_pClientArray[i].m_UID))
return true;
return false;
}
-bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken)
+bool ServerAuthenticationManager::CheckAuthentication(CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken)
{
std::string sUid = std::to_string(iUid);
@@ -111,7 +111,7 @@ bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer,
return true;
// local server that doesn't need auth (probably sp) and local player
- if (m_bStartingLocalSPGame && !strcmp(sUid.c_str(), R2::g_pLocalPlayerUserID))
+ if (m_bStartingLocalSPGame && !strcmp(sUid.c_str(), g_pLocalPlayerUserID))
return true;
// don't allow duplicate accounts
@@ -126,7 +126,7 @@ bool ServerAuthenticationManager::CheckAuthentication(R2::CBaseClient* pPlayer,
return false;
}
-void ServerAuthenticationManager::AuthenticatePlayer(R2::CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken)
+void ServerAuthenticationManager::AuthenticatePlayer(CBaseClient* pPlayer, uint64_t iUid, char* pAuthToken)
{
// for bot players, generate a new uid
if (pPlayer->m_bFakePlayer)
@@ -142,31 +142,31 @@ void ServerAuthenticationManager::AuthenticatePlayer(R2::CBaseClient* pPlayer, u
if (authData != m_RemoteAuthenticationData.end())
{
// if we're resetting let script handle the reset with InitPersistentData() on connect
- if (!m_bForceResetLocalPlayerPersistence || strcmp(sUid.c_str(), R2::g_pLocalPlayerUserID))
+ if (!m_bForceResetLocalPlayerPersistence || strcmp(sUid.c_str(), g_pLocalPlayerUserID))
{
// copy pdata into buffer
memcpy(pPlayer->m_PersistenceBuffer, authData->second.pdata, authData->second.pdataSize);
}
// set persistent data as ready
- pPlayer->m_iPersistenceReady = R2::ePersistenceReady::READY_REMOTE;
+ pPlayer->m_iPersistenceReady = ePersistenceReady::READY_REMOTE;
}
// we probably allow insecure at this point, but make sure not to write anyway if not insecure
else if (Cvar_ns_auth_allow_insecure->GetBool() || pPlayer->m_bFakePlayer)
{
// set persistent data as ready
// note: actual placeholder persistent data is populated in script with InitPersistentData()
- pPlayer->m_iPersistenceReady = R2::ePersistenceReady::READY_INSECURE;
+ pPlayer->m_iPersistenceReady = ePersistenceReady::READY_INSECURE;
}
}
-bool ServerAuthenticationManager::RemovePlayerAuthData(R2::CBaseClient* pPlayer)
+bool ServerAuthenticationManager::RemovePlayerAuthData(CBaseClient* pPlayer)
{
if (!Cvar_ns_erase_auth_info->GetBool()) // keep auth data forever
return false;
// hack for special case where we're on a local server, so we erase our own newly created auth data on disconnect
- if (m_bNeedLocalAuthForNewgame && !strcmp(pPlayer->m_UID, R2::g_pLocalPlayerUserID))
+ if (m_bNeedLocalAuthForNewgame && !strcmp(pPlayer->m_UID, g_pLocalPlayerUserID))
return false;
// we don't have our auth token at this point, so lookup authdata by uid
@@ -187,9 +187,9 @@ bool ServerAuthenticationManager::RemovePlayerAuthData(R2::CBaseClient* pPlayer)
return false;
}
-void ServerAuthenticationManager::WritePersistentData(R2::CBaseClient* pPlayer)
+void ServerAuthenticationManager::WritePersistentData(CBaseClient* pPlayer)
{
- if (pPlayer->m_iPersistenceReady == R2::ePersistenceReady::READY_REMOTE)
+ if (pPlayer->m_iPersistenceReady == ePersistenceReady::READY_REMOTE)
{
g_pMasterServerManager->WritePlayerPersistentData(
pPlayer->m_UID, (const char*)pPlayer->m_PersistenceBuffer, m_PlayerAuthenticationData[pPlayer].pdataSize);
@@ -240,7 +240,7 @@ ConVar* Cvar_ns_allowuserclantags;
// clang-format off
AUTOHOOK(CBaseClient__Connect, engine.dll + 0x101740,
-bool,, (R2::CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer, void* a5, char pDisconnectReason[256], void* a7))
+bool,, (CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer, void* a5, char pDisconnectReason[256], void* a7))
// clang-format on
{
const char* pAuthenticationFailure = nullptr;
@@ -281,13 +281,13 @@ bool,, (R2::CBaseClient* self, char* pName, void* pNetChannel, char bFakePlayer,
// clang-format off
AUTOHOOK(CBaseClient__ActivatePlayer, engine.dll + 0x100F80,
-void,, (R2::CBaseClient* self))
+void,, (CBaseClient* self))
// clang-format on
{
// if we're authed, write our persistent data
// RemovePlayerAuthData returns true if it removed successfully, i.e. on first call only, and we only want to write on >= second call
// (since this func is called on map loads)
- if (self->m_iPersistenceReady >= R2::ePersistenceReady::READY && !g_pServerAuthentication->RemovePlayerAuthData(self))
+ if (self->m_iPersistenceReady >= ePersistenceReady::READY && !g_pServerAuthentication->RemovePlayerAuthData(self))
{
g_pServerAuthentication->m_bForceResetLocalPlayerPersistence = false;
g_pServerAuthentication->WritePersistentData(self);
@@ -299,7 +299,7 @@ void,, (R2::CBaseClient* self))
// clang-format off
AUTOHOOK(_CBaseClient__Disconnect, engine.dll + 0x1012C0,
-void,, (R2::CBaseClient* self, uint32_t unknownButAlways1, const char* pReason, ...))
+void,, (CBaseClient* self, uint32_t unknownButAlways1, const char* pReason, ...))
// clang-format on
{
// have to manually format message because can't pass varargs to original func
@@ -333,7 +333,7 @@ void,, (R2::CBaseClient* self, uint32_t unknownButAlways1, const char* pReason,
void ConCommand_ns_resetpersistence(const CCommand& args)
{
- if (*R2::g_pServerState == R2::server_state_t::ss_active)
+ if (*g_pServerState == server_state_t::ss_active)
{
spdlog::error("ns_resetpersistence must be entered from the main menu");
return;
@@ -370,7 +370,7 @@ ON_DLL_LOAD_RELIESON("engine.dll", ServerAuthentication, (ConCommand, ConVar), (
CBaseServer__RejectConnection = module.Offset(0x1182E0).RCast<CBaseServer__RejectConnectionType>();
- if (Tier0::CommandLine()->CheckParm("-allowdupeaccounts"))
+ if (CommandLine()->CheckParm("-allowdupeaccounts"))
{
// patch to allow same of multiple account
module.Offset(0x114510).Patch("EB");