From 0c25246f91f4ccc6c9f5efb2b154021157d7f612 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 13 May 2023 19:41:57 +0200 Subject: [PATCH] Check if dedicated using global Global instead of directive as the ebisusdk lib is used for both the server and client. Removed useless directives. --- r5dev/ebisusdk/EbisuSDK.cpp | 25 +++++++++++++------------ r5dev/ebisusdk/EbisuSDK.h | 4 ---- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/r5dev/ebisusdk/EbisuSDK.cpp b/r5dev/ebisusdk/EbisuSDK.cpp index 6beac029..92bcf9ec 100644 --- a/r5dev/ebisusdk/EbisuSDK.cpp +++ b/r5dev/ebisusdk/EbisuSDK.cpp @@ -1,17 +1,19 @@ #include "core/stdafx.h" #include "tier1/cvar.h" #include "ebisusdk/EbisuSDK.h" +#include "engine/server/sv_main.h" //----------------------------------------------------------------------------- // Purpose: sets the EbisuSDK globals for dedicated to satisfy command callbacks //----------------------------------------------------------------------------- void HEbisuSDK_Init() { -#ifdef DEDICATED - *g_EbisuSDKInit = true; // <- 1st EbisuSDK - *g_EbisuProfileInit = true; // <- 2nd EbisuSDK - *g_NucleusID = 9990000; // <- 3rd EbisuSDK -#endif // DEDICATED + if (*s_bIsDedicated) + { + *g_EbisuSDKInit = true; // <- 1st EbisuSDK + *g_EbisuProfileInit = true; // <- 2nd EbisuSDK + *g_NucleusID = 9990000; // <- 3rd EbisuSDK + } } //----------------------------------------------------------------------------- @@ -20,23 +22,23 @@ void HEbisuSDK_Init() //----------------------------------------------------------------------------- bool IsOriginInitialized() { -#ifndef DEDICATED - if ((!(*g_OriginErrorLevel) + if (*s_bIsDedicated) + { + return true; + } + else if ((!(*g_OriginErrorLevel) && (*g_EbisuSDKInit) && (*g_NucleusID) && (*g_EbisuProfileInit))) // && (*g_OriginAuthCode) // && (g_NucleusToken[0]))) -#endif // DEDICATED { return true; } -#ifndef DEDICATED + return false; -#endif // DEDICATED } -#ifndef CLIENT_DLL //----------------------------------------------------------------------------- // Purpose: validates if client's persona name meets EA's criteria // Input : *pszName - @@ -61,4 +63,3 @@ bool IsValidPersonaName(const char* pszName) size_t pos = strspn(pszName, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"); return pszName[pos] == '\0'; } -#endif // !CLIENT_DLL diff --git a/r5dev/ebisusdk/EbisuSDK.h b/r5dev/ebisusdk/EbisuSDK.h index 7db41a3c..f4aa50ae 100644 --- a/r5dev/ebisusdk/EbisuSDK.h +++ b/r5dev/ebisusdk/EbisuSDK.h @@ -1,6 +1,5 @@ #pragma once -//#ifdef DEDICATED inline CMemory p_EbisuSDK_Tier0_Init; inline auto EbisuSDK_Tier0_Init = p_EbisuSDK_Tier0_Init.RCast(); @@ -16,14 +15,11 @@ inline char* g_OriginAuthCode = nullptr; /*SIZE = 256*/ inline int* g_OriginErrorLevel = nullptr; inline bool* g_EbisuSDKInit = nullptr; inline bool* g_EbisuProfileInit = nullptr; -//#endif // DEDICATED /////////////////////////////////////////////////////////////////////////////// void HEbisuSDK_Init(); bool IsOriginInitialized(); -#ifndef CLIENT_DLL bool IsValidPersonaName(const char* pszName); -#endif // !CLIENT_DLL /////////////////////////////////////////////////////////////////////////////// class VEbisuSDK : public IDetour