r5sdk/r5dev/include/overlay.h

88 lines
2.2 KiB
C
Raw Normal View History

#pragma once
#include "imgui.h"
2021-07-09 22:27:32 +03:00
#include "serverlisting.h"
#include "json.hpp"
#include <vector>
/////////////////////////////////////////////////////////////////////////////
// Initialization
void PrintDXAddress();
void InstallDXHooks();
void RemoveDXHooks();
void ShowGameConsole(bool* p_open);
/////////////////////////////////////////////////////////////////////////////
// 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);
/////////////////////////////////////////////////////////////////////////////
// Globals
inline ImVector<char*> Items;
2021-07-09 22:27:32 +03:00
inline std::string OriginUID = "1010417302770";
/////////////////////////////////////////////////////////////////////////////
2021-07-09 22:27:32 +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 {
2021-07-17 01:48:46 +03:00
NotHosting,
2021-07-16 23:10:10 +03:00
WaitingForStateChange,
Hosting,
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;
2021-07-17 01:48:46 +03:00
EHostStatus HostingStatus = EHostStatus::NotHosting;
2021-07-16 23:10:10 +03:00
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();
};