diff --git a/external/source-sdk-2013-headers b/external/source-sdk-2013-headers index c80b09c1..a2b2bf54 160000 --- a/external/source-sdk-2013-headers +++ b/external/source-sdk-2013-headers @@ -1 +1 @@ -Subproject commit c80b09c1b6f40dc58b0a1d408832abb2b027d897 +Subproject commit a2b2bf54816ec2ad780f4b5a509e53e4a3f58fba diff --git a/include/core/interfaces.hpp b/include/core/interfaces.hpp index a0c3196c..58889d8f 100644 --- a/include/core/interfaces.hpp +++ b/include/core/interfaces.hpp @@ -20,6 +20,7 @@ class ILocalize; class IToolFrameworkInternal; class ISteamClient; +class ISteamNetworkingSockets; class ISteamFriends; class IVEngineClient013; class IClientEntityList; @@ -62,6 +63,7 @@ extern TFGCClientSystem *g_TFGCClientSystem; extern CHud *g_CHUD; extern ISteamClient *g_ISteamClient; extern ISteamFriends *g_ISteamFriends; +extern ISteamNetworkingSockets *g_ISteamNetworkingSockets; extern IVEngineClient013 *g_IEngine; extern void *demoplayer; extern IEngineSound *g_ISoundEngine; diff --git a/src/core/interfaces.cpp b/src/core/interfaces.cpp index c1387ada..e2eb86c6 100644 --- a/src/core/interfaces.cpp +++ b/src/core/interfaces.cpp @@ -18,46 +18,47 @@ // class ISteamFriends002; -IVModelRender *g_IVModelRender = nullptr; -ISteamClient *g_ISteamClient = nullptr; -ISteamFriends *g_ISteamFriends = nullptr; -IVEngineClient013 *g_IEngine = nullptr; -void *demoplayer = nullptr; -IEngineSound *g_ISoundEngine = nullptr; -vgui::ISurface *g_ISurface = nullptr; -vgui::IPanel *g_IPanel = nullptr; -vgui::ILocalize *g_ILocalize = nullptr; -IClientEntityList *g_IEntityList = nullptr; -ICvar *g_ICvar = nullptr; -IGameEventManager2 *g_IEventManager2 = nullptr; -IBaseClientDLL *g_IBaseClient = nullptr; -IEngineTrace *g_ITrace = nullptr; -IVModelInfoClient *g_IModelInfo = nullptr; -IInputSystem *g_IInputSystem = nullptr; -CGlobalVarsBase **rg_GlobalVars = nullptr; -IPrediction *g_IPrediction = nullptr; -IGameMovement *g_IGameMovement = nullptr; -IInput *g_IInput = nullptr; -ISteamUser *g_ISteamUser = nullptr; -IAchievementMgr *g_IAchievementMgr = nullptr; -ISteamUserStats *g_ISteamUserStats = nullptr; -IStudioRender *g_IStudioRender = nullptr; -IVDebugOverlay *g_IVDebugOverlay = nullptr; -IMaterialSystemFixed *g_IMaterialSystem = nullptr; -IVRenderView *g_IVRenderView = nullptr; -IMaterialSystem *g_IMaterialSystemHL = nullptr; -IMoveHelperServer *g_IMoveHelperServer = nullptr; -CBaseClientState *g_IBaseClientState = nullptr; -IGameEventManager *g_IGameEventManager = nullptr; -TFGCClientSystem *g_TFGCClientSystem = nullptr; -CHud *g_CHUD = nullptr; -CGameRules *g_pGameRules = nullptr; -IEngineVGui *g_IEngineVGui = nullptr; -IUniformRandomStream *g_pUniformStream = nullptr; -int *g_PredictionRandomSeed = nullptr; -IFileSystem *g_IFileSystem = nullptr; -IMDLCache *g_IMDLCache = nullptr; -IToolFrameworkInternal *g_IToolFramework = nullptr; +IVModelRender *g_IVModelRender = nullptr; +ISteamClient *g_ISteamClient = nullptr; +ISteamFriends *g_ISteamFriends = nullptr; +ISteamNetworkingSockets *g_ISteamNetworkingSockets = nullptr; +IVEngineClient013 *g_IEngine = nullptr; +void *demoplayer = nullptr; +IEngineSound *g_ISoundEngine = nullptr; +vgui::ISurface *g_ISurface = nullptr; +vgui::IPanel *g_IPanel = nullptr; +vgui::ILocalize *g_ILocalize = nullptr; +IClientEntityList *g_IEntityList = nullptr; +ICvar *g_ICvar = nullptr; +IGameEventManager2 *g_IEventManager2 = nullptr; +IBaseClientDLL *g_IBaseClient = nullptr; +IEngineTrace *g_ITrace = nullptr; +IVModelInfoClient *g_IModelInfo = nullptr; +IInputSystem *g_IInputSystem = nullptr; +CGlobalVarsBase **rg_GlobalVars = nullptr; +IPrediction *g_IPrediction = nullptr; +IGameMovement *g_IGameMovement = nullptr; +IInput *g_IInput = nullptr; +ISteamUser *g_ISteamUser = nullptr; +IAchievementMgr *g_IAchievementMgr = nullptr; +ISteamUserStats *g_ISteamUserStats = nullptr; +IStudioRender *g_IStudioRender = nullptr; +IVDebugOverlay *g_IVDebugOverlay = nullptr; +IMaterialSystemFixed *g_IMaterialSystem = nullptr; +IVRenderView *g_IVRenderView = nullptr; +IMaterialSystem *g_IMaterialSystemHL = nullptr; +IMoveHelperServer *g_IMoveHelperServer = nullptr; +CBaseClientState *g_IBaseClientState = nullptr; +IGameEventManager *g_IGameEventManager = nullptr; +TFGCClientSystem *g_TFGCClientSystem = nullptr; +CHud *g_CHUD = nullptr; +CGameRules *g_pGameRules = nullptr; +IEngineVGui *g_IEngineVGui = nullptr; +IUniformRandomStream *g_pUniformStream = nullptr; +int *g_PredictionRandomSeed = nullptr; +IFileSystem *g_IFileSystem = nullptr; +IMDLCache *g_IMDLCache = nullptr; +IToolFrameworkInternal *g_IToolFramework = nullptr; template T *BruteforceInterface(std::string name, sharedobj::SharedObject &object, int start = 0) { @@ -87,6 +88,8 @@ template T *BruteforceInterface(std::string name, sharedobj::Shared extern "C" typedef HSteamPipe (*GetHSteamPipe_t)(); extern "C" typedef HSteamUser (*GetHSteamUser_t)(); +extern "C" typedef void *(*SteamInternal_FindOrCreateUserInterface_t)(HSteamUser, const char *); + void CreateEarlyInterfaces() { g_IFileSystem = BruteforceInterface("VFileSystem", sharedobj::filesystem_stdio()); @@ -124,6 +127,8 @@ void CreateInterfaces() } logging::Info("Inited SteamAPI"); + g_ISteamNetworkingSockets = (ISteamNetworkingSockets *) reinterpret_cast(dlsym(sharedobj::steamapi().lmap, "SteamInternal_FindOrCreateUserInterface"))(su, "SteamNetworkingSockets009"); + g_IVModelRender = BruteforceInterface("VEngineModel", sharedobj::engine(), 16); g_ISteamFriends = nullptr; g_IEngineVGui = BruteforceInterface("VEngineVGui", sharedobj::engine()); diff --git a/src/hacks/DataCenter.cpp b/src/hacks/DataCenter.cpp index 7cb0a07e..2f6e6af0 100644 --- a/src/hacks/DataCenter.cpp +++ b/src/hacks/DataCenter.cpp @@ -32,7 +32,7 @@ static settings::Boolean enable_africa{ "dc.toggle-africa", "false" }; typedef std::array CidStr_t; -struct SteamNetworkingPOPID +struct SteamNetworkingPOPID_decl { unsigned v; /* 'out' must point to array with capacity at least 5 */ @@ -95,7 +95,7 @@ static std::vector africa_datacenters = { { "jnb" } }; static CatCommand print("dc_print", "Print codes of all available data centers", []() { static auto GetPOPCount = *(int (**)(void *))(*(uintptr_t *) g_ISteamNetworkingUtils + 37); - static auto GetPOPList = *(int (**)(void *, SteamNetworkingPOPID *, int))(*(uintptr_t *) g_ISteamNetworkingUtils + 41); + static auto GetPOPList = *(int (**)(void *, SteamNetworkingPOPID_decl *, int))(*(uintptr_t *) g_ISteamNetworkingUtils + 41); char region[5]; @@ -105,7 +105,7 @@ static CatCommand print("dc_print", "Print codes of all available data centers", g_ICvar->ConsoleColorPrintf(MENU_COLOR, "List of regions is not available yet\n"); return; } - SteamNetworkingPOPID *list = new SteamNetworkingPOPID[count]; + SteamNetworkingPOPID_decl *list = new SteamNetworkingPOPID_decl[count]; GetPOPList(g_ISteamNetworkingUtils, list, count); auto it = list; @@ -156,8 +156,8 @@ static void OnRegionsUpdate(std::string regions) Refresh(); } -static int (*o_GetDirectPingToPOP)(void *self, SteamNetworkingPOPID cid); -static int h_GetDirectPingToPOP(void *self, SteamNetworkingPOPID cid) +static int (*o_GetDirectPingToPOP)(void *self, SteamNetworkingPOPID_decl cid); +static int h_GetDirectPingToPOP(void *self, SteamNetworkingPOPID_decl cid) { CidStr_t cidStr;