diff options
author | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-07-07 21:31:41 +0100 |
---|---|---|
committer | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-07-07 21:31:41 +0100 |
commit | 2ae34b67e36b8ba05132d481876eb4ed7a826283 (patch) | |
tree | 63f44c8e2dcdc959d7a5317a3a7b36efedbd7d38 /NorthstarDLL/masterserver.h | |
parent | 3406de7aaaf52cbef20b1549f2d7da0255d30f51 (diff) | |
download | NorthstarLauncher-2ae34b67e36b8ba05132d481876eb4ed7a826283.tar.gz NorthstarLauncher-2ae34b67e36b8ba05132d481876eb4ed7a826283.zip |
almost fully replaced hooking lib
Diffstat (limited to 'NorthstarDLL/masterserver.h')
-rw-r--r-- | NorthstarDLL/masterserver.h | 306 |
1 files changed, 153 insertions, 153 deletions
diff --git a/NorthstarDLL/masterserver.h b/NorthstarDLL/masterserver.h index a485a1dc..5fd8aff4 100644 --- a/NorthstarDLL/masterserver.h +++ b/NorthstarDLL/masterserver.h @@ -1,153 +1,153 @@ -#pragma once -#include "convar.h" -#include <WinSock2.h> -#include <string> -#include <cstring> - -extern ConVar* Cvar_ns_masterserver_hostname; -extern ConVar* Cvar_ns_report_server_to_masterserver; -extern ConVar* Cvar_ns_report_sp_server_to_masterserver; - -extern ConVar* Cvar_ns_server_name; -extern ConVar* Cvar_ns_server_desc; -extern ConVar* Cvar_ns_server_password; - -extern ConVar* Cvar_ns_curl_log_enable; - -extern ConVar* Cvar_hostname; -extern ConVar* Cvar_hostport; - -struct RemoteModInfo -{ - public: - std::string Name; - std::string Version; -}; - -class RemoteServerInfo -{ - public: - char id[33]; // 32 bytes + nullterminator - - // server info - char name[64]; - std::string description; - char map[32]; - char playlist[16]; - std::vector<RemoteModInfo> requiredMods; - - int playerCount; - int maxPlayers; - - // connection stuff - bool requiresPassword; - - public: - RemoteServerInfo( - const char* newId, - const char* newName, - const char* newDescription, - const char* newMap, - const char* newPlaylist, - int newPlayerCount, - int newMaxPlayers, - bool newRequiresPassword); -}; - -struct RemoteServerConnectionInfo -{ - public: - char authToken[32]; - - in_addr ip; - unsigned short port; -}; - -struct MainMenuPromoData -{ - public: - std::string newInfoTitle1; - std::string newInfoTitle2; - std::string newInfoTitle3; - - std::string largeButtonTitle; - std::string largeButtonText; - std::string largeButtonUrl; - int largeButtonImageIndex; - - std::string smallButton1Title; - std::string smallButton1Url; - int smallButton1ImageIndex; - - std::string smallButton2Title; - std::string smallButton2Url; - int smallButton2ImageIndex; -}; - -class MasterServerManager -{ - private: - bool m_bRequestingServerList = false; - bool m_bAuthenticatingWithGameServer = false; - - public: - char m_sOwnServerId[33]; - char m_sOwnServerAuthToken[33]; - char m_sOwnClientAuthToken[33]; - - std::string m_sOwnModInfoJson; - std::string m_sUnicodeServerName; // Unicode unescaped version of Cvar_ns_auth_servername for support in cjk characters - std::string m_sUnicodeServerDesc; // Unicode unescaped version of Cvar_ns_auth_serverdesc for support in cjk characters - - bool m_bOriginAuthWithMasterServerDone = false; - bool m_bOriginAuthWithMasterServerInProgress = false; - - bool m_bRequireClientAuth = false; - bool m_bSavingPersistentData = false; - - bool m_bScriptRequestingServerList = false; - bool m_bSuccessfullyConnected = true; - - bool m_bNewgameAfterSelfAuth = false; - bool m_bScriptAuthenticatingWithGameServer = false; - bool m_bSuccessfullyAuthenticatedWithGameServer = false; - - bool m_bHasPendingConnectionInfo = false; - RemoteServerConnectionInfo m_pendingConnectionInfo; - - std::vector<RemoteServerInfo> m_vRemoteServers; - - bool m_bHasMainMenuPromoData = false; - MainMenuPromoData m_sMainMenuPromoData; - - private: - void SetCommonHttpClientOptions(CURL* curl); - - public: - MasterServerManager(); - void ClearServerList(); - void RequestServerList(); - void RequestMainMenuPromos(); - void AuthenticateOriginWithMasterServer(const char* uid, const char* originToken); - void AuthenticateWithOwnServer(const char* uid, const char* playerToken); - void AuthenticateWithServer(const char* uid, const char* playerToken, const char* serverId, const char* password); - void AddSelfToServerList( - int port, - int authPort, - const char* name, - const char* description, - const char* map, - const char* playlist, - int maxPlayers, - const char* password); - void UpdateServerMapAndPlaylist(const char* map, const char* playlist, int playerCount); - void UpdateServerPlayerCount(int playerCount); - void WritePlayerPersistentData(const char* playerId, const char* pdata, size_t pdataSize); - void RemoveSelfFromServerList(); -}; -std::string unescape_unicode(const std::string& str); -void UpdateServerInfoFromUnicodeToUTF8(); - -extern MasterServerManager* g_MasterServerManager; -extern ConVar* Cvar_ns_masterserver_hostname; -extern ConVar* Cvar_ns_server_password; +#pragma once
+#include "convar.h"
+#include <WinSock2.h>
+#include <string>
+#include <cstring>
+
+extern ConVar* Cvar_ns_masterserver_hostname;
+extern ConVar* Cvar_ns_report_server_to_masterserver;
+extern ConVar* Cvar_ns_report_sp_server_to_masterserver;
+
+extern ConVar* Cvar_ns_server_name;
+extern ConVar* Cvar_ns_server_desc;
+extern ConVar* Cvar_ns_server_password;
+
+extern ConVar* Cvar_ns_curl_log_enable;
+
+extern ConVar* Cvar_hostname;
+extern ConVar* Cvar_hostport;
+
+struct RemoteModInfo
+{
+ public:
+ std::string Name;
+ std::string Version;
+};
+
+class RemoteServerInfo
+{
+ public:
+ char id[33]; // 32 bytes + nullterminator
+
+ // server info
+ char name[64];
+ std::string description;
+ char map[32];
+ char playlist[16];
+ std::vector<RemoteModInfo> requiredMods;
+
+ int playerCount;
+ int maxPlayers;
+
+ // connection stuff
+ bool requiresPassword;
+
+ public:
+ RemoteServerInfo(
+ const char* newId,
+ const char* newName,
+ const char* newDescription,
+ const char* newMap,
+ const char* newPlaylist,
+ int newPlayerCount,
+ int newMaxPlayers,
+ bool newRequiresPassword);
+};
+
+struct RemoteServerConnectionInfo
+{
+ public:
+ char authToken[32];
+
+ in_addr ip;
+ unsigned short port;
+};
+
+struct MainMenuPromoData
+{
+ public:
+ std::string newInfoTitle1;
+ std::string newInfoTitle2;
+ std::string newInfoTitle3;
+
+ std::string largeButtonTitle;
+ std::string largeButtonText;
+ std::string largeButtonUrl;
+ int largeButtonImageIndex;
+
+ std::string smallButton1Title;
+ std::string smallButton1Url;
+ int smallButton1ImageIndex;
+
+ std::string smallButton2Title;
+ std::string smallButton2Url;
+ int smallButton2ImageIndex;
+};
+
+class MasterServerManager
+{
+ private:
+ bool m_bRequestingServerList = false;
+ bool m_bAuthenticatingWithGameServer = false;
+
+ public:
+ char m_sOwnServerId[33];
+ char m_sOwnServerAuthToken[33];
+ char m_sOwnClientAuthToken[33];
+
+ std::string m_sOwnModInfoJson;
+ std::string m_sUnicodeServerName; // Unicode unescaped version of Cvar_ns_auth_servername for support in cjk characters
+ std::string m_sUnicodeServerDesc; // Unicode unescaped version of Cvar_ns_auth_serverdesc for support in cjk characters
+
+ bool m_bOriginAuthWithMasterServerDone = false;
+ bool m_bOriginAuthWithMasterServerInProgress = false;
+
+ bool m_bRequireClientAuth = false;
+ bool m_bSavingPersistentData = false;
+
+ bool m_bScriptRequestingServerList = false;
+ bool m_bSuccessfullyConnected = true;
+
+ bool m_bNewgameAfterSelfAuth = false;
+ bool m_bScriptAuthenticatingWithGameServer = false;
+ bool m_bSuccessfullyAuthenticatedWithGameServer = false;
+
+ bool m_bHasPendingConnectionInfo = false;
+ RemoteServerConnectionInfo m_pendingConnectionInfo;
+
+ std::vector<RemoteServerInfo> m_vRemoteServers;
+
+ bool m_bHasMainMenuPromoData = false;
+ MainMenuPromoData m_sMainMenuPromoData;
+
+ private:
+ void SetCommonHttpClientOptions(CURL* curl);
+
+ public:
+ MasterServerManager();
+ void ClearServerList();
+ void RequestServerList();
+ void RequestMainMenuPromos();
+ void AuthenticateOriginWithMasterServer(const char* uid, const char* originToken);
+ void AuthenticateWithOwnServer(const char* uid, const char* playerToken);
+ void AuthenticateWithServer(const char* uid, const char* playerToken, const char* serverId, const char* password);
+ void AddSelfToServerList(
+ int port,
+ int authPort,
+ const char* name,
+ const char* description,
+ const char* map,
+ const char* playlist,
+ int maxPlayers,
+ const char* password);
+ void UpdateServerMapAndPlaylist(const char* map, const char* playlist, int playerCount);
+ void UpdateServerPlayerCount(int playerCount);
+ void WritePlayerPersistentData(const char* playerId, const char* pdata, size_t pdataSize);
+ void RemoveSelfFromServerList();
+};
+std::string unescape_unicode(const std::string& str);
+void UpdateServerInfoFromUnicodeToUTF8();
+
+extern MasterServerManager* g_MasterServerManager;
+extern ConVar* Cvar_ns_masterserver_hostname;
+extern ConVar* Cvar_ns_server_password;
|