2021-06-14 17:56:18 -07:00
|
|
|
#pragma once
|
|
|
|
#include "imgui.h"
|
2021-07-09 22:27:32 +03:00
|
|
|
#include "serverlisting.h"
|
|
|
|
#include "json.hpp"
|
|
|
|
#include <vector>
|
2021-06-16 16:43:03 -07:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Initialization
|
2021-06-14 17:56:18 -07:00
|
|
|
void PrintDXAddress();
|
|
|
|
void InstallDXHooks();
|
|
|
|
void RemoveDXHooks();
|
|
|
|
void ShowGameConsole(bool* p_open);
|
|
|
|
|
2021-06-16 16:43:03 -07:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2021-06-19 07:18:39 -07:00
|
|
|
// Internals
|
|
|
|
int Stricmp(const char* s1, const char* s2);
|
|
|
|
int Strnicmp(const char* s1, const char* s2, int n);
|
|
|
|
char* Strdup(const char* s);
|
|
|
|
void Strtrim(char* s);
|
2021-06-16 16:43:03 -07:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Globals
|
|
|
|
inline ImVector<char*> Items;
|
|
|
|
|
2021-07-09 22:27:32 +03:00
|
|
|
inline std::string OriginUID = "1010417302770";
|
|
|
|
|
2021-06-19 07:18:39 -07:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2021-07-09 22:27:32 +03:00
|
|
|
|
2021-07-12 20:34:54 +03:00
|
|
|
using json = nlohmann::json;
|
|
|
|
void RunConsoleCommand(std::string command);
|
2021-07-16 23:10:10 +03:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// ServerBrowser
|
|
|
|
|
|
|
|
class CCompanion
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum class ESection {
|
|
|
|
ServerBrowser,
|
|
|
|
HostServer,
|
|
|
|
Settings
|
|
|
|
} CurrentSection;
|
|
|
|
|
|
|
|
enum class EHostStatus {
|
|
|
|
WaitingForStateChange,
|
|
|
|
Hosting,
|
|
|
|
NotHosting,
|
|
|
|
ConnectedToSomeoneElse
|
|
|
|
};
|
|
|
|
|
|
|
|
CCompanion();
|
|
|
|
////////////////////
|
|
|
|
// Server Browser //
|
|
|
|
////////////////////
|
|
|
|
ImVector<ServerListing*> ServerList;
|
|
|
|
ServerListing* SelectedServer;
|
|
|
|
|
|
|
|
ImGuiTextFilter ServerBrowserFilter;
|
|
|
|
|
|
|
|
char ServerConnStringBuffer[256] = { 0 };
|
|
|
|
|
|
|
|
////////////////////
|
|
|
|
// Settings //
|
|
|
|
////////////////////
|
|
|
|
char MatchmakingServerStringBuffer[256] = { 0 };
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////
|
|
|
|
// Host Server //
|
|
|
|
////////////////////
|
|
|
|
std::vector<std::string> MapsList;
|
|
|
|
std::string* SelectedMap = nullptr;
|
|
|
|
char ServerNameBuffer[64] = { 0 };
|
|
|
|
bool StartAsDedi;
|
|
|
|
EHostStatus HostingStatus = EHostStatus::WaitingForStateChange;
|
|
|
|
|
|
|
|
void RefreshServerList();
|
|
|
|
|
|
|
|
void SendHostingPostRequest();
|
|
|
|
void SetSection(ESection section);
|
|
|
|
void CompMenu();
|
|
|
|
void ServerBrowserSection();
|
|
|
|
void SettingsSection();
|
|
|
|
void HostServerSection();
|
|
|
|
void Draw(const char* title, bool* p_open);
|
|
|
|
void UpdateHostingStatus();
|
|
|
|
|
|
|
|
std::string GetGameStateLastMap();
|
|
|
|
};
|