2021-12-25 22:36:38 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef DEDICATED
|
|
|
|
#include "networksystem/serverlisting.h"
|
|
|
|
#include "networksystem/r5net.h"
|
|
|
|
|
2022-01-15 17:57:18 +00:00
|
|
|
enum class ESection
|
|
|
|
{
|
|
|
|
SERVER_BROWSER,
|
|
|
|
HOST_SERVER,
|
|
|
|
SETTINGS
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class EHostStatus
|
|
|
|
{
|
|
|
|
NOT_HOSTING,
|
|
|
|
HOSTING
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class EServerVisibility
|
|
|
|
{
|
|
|
|
OFFLINE,
|
|
|
|
HIDDEN,
|
|
|
|
PUBLIC
|
|
|
|
};
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
class IBrowser
|
|
|
|
{
|
|
|
|
private:
|
2022-01-12 02:53:07 +01:00
|
|
|
bool m_bInitialized = false;
|
2021-12-25 22:36:38 +01:00
|
|
|
public:
|
2022-01-15 17:57:18 +00:00
|
|
|
////////////////////
|
|
|
|
// Enum Vars //
|
|
|
|
////////////////////
|
|
|
|
|
|
|
|
ESection eCurrentSection = ESection::SERVER_BROWSER;
|
|
|
|
EHostStatus eHostingStatus = EHostStatus::NOT_HOSTING;
|
|
|
|
EServerVisibility eServerVisibility = EServerVisibility::OFFLINE;
|
|
|
|
public:
|
|
|
|
////////////////////
|
|
|
|
// Funcs //
|
|
|
|
////////////////////
|
2021-12-25 22:36:38 +01:00
|
|
|
IBrowser();
|
|
|
|
~IBrowser();
|
|
|
|
|
2022-01-12 02:53:07 +01:00
|
|
|
void Draw(const char* title, bool* bDraw);
|
|
|
|
void CompMenu();
|
|
|
|
|
|
|
|
void ServerBrowserSection();
|
|
|
|
void RefreshServerList();
|
2022-01-15 15:25:19 +01:00
|
|
|
void GetServerList();
|
|
|
|
|
2022-01-15 20:13:11 +01:00
|
|
|
void ConnectToServer(const std::string& ip, const std::string& port, const std::string& encKey);
|
|
|
|
void ConnectToServer(const std::string& connString, const std::string& encKey);
|
2022-01-12 02:53:07 +01:00
|
|
|
|
|
|
|
void HiddenServersModal();
|
|
|
|
void HostServerSection();
|
|
|
|
|
|
|
|
void UpdateHostingStatus();
|
|
|
|
void SendHostingPostRequest();
|
|
|
|
|
|
|
|
void ProcessCommand(const char* command_line);
|
2022-01-15 20:13:11 +01:00
|
|
|
void LaunchServer();
|
2022-01-12 02:53:07 +01:00
|
|
|
|
|
|
|
void SettingsSection();
|
|
|
|
void RegenerateEncryptionKey();
|
2022-01-15 20:13:11 +01:00
|
|
|
void ChangeEncryptionKeyTo(const std::string& str);
|
2022-01-12 02:53:07 +01:00
|
|
|
|
|
|
|
void SetStyleVar();
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
////////////////////
|
|
|
|
// Server Browser //
|
|
|
|
////////////////////
|
|
|
|
public:
|
2022-01-12 02:53:07 +01:00
|
|
|
bool m_bActivate = false;
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
std::vector<ServerListing> m_vServerList;
|
|
|
|
ImGuiTextFilter m_imServerBrowserFilter;
|
|
|
|
char m_chServerConnStringBuffer[256] = { 0 };
|
|
|
|
char m_chServerEncKeyBuffer[30] = { 0 };
|
|
|
|
std::string m_szServerListMessage = std::string();
|
|
|
|
|
|
|
|
std::map<std::string, std::string> mapArray =
|
|
|
|
{
|
|
|
|
{ "mp_rr_canyonlands_64k_x_64k", "King's Canyon Season 0" },
|
|
|
|
{ "mp_rr_desertlands_64k_x_64k", "World's Edge Season 3" },
|
|
|
|
{ "mp_rr_canyonlands_mu1", "King's Canyon Season 2" },
|
|
|
|
{ "mp_rr_canyonlands_mu1_night", "King's Canyon Season 2 After Dark" },
|
|
|
|
{ "mp_rr_desertlands_64k_x_64k_nx", "World's Edge Season 3 After Dark" },
|
|
|
|
{ "mp_lobby", "Lobby Season 3" },
|
|
|
|
{ "mp_rr_canyonlands_staging", "King's Canyon Firing Range" }
|
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////
|
|
|
|
// Settings //
|
|
|
|
////////////////////
|
|
|
|
std::string m_szMatchmakingHostName;
|
|
|
|
|
|
|
|
////////////////////
|
|
|
|
// Host Server //
|
|
|
|
////////////////////
|
|
|
|
ServerListing m_Server;
|
|
|
|
std::vector<std::string> m_vszMapsList;
|
2022-01-15 17:57:18 +00:00
|
|
|
std::vector<std::string> m_vszMapFileNameList;
|
2021-12-25 22:36:38 +01:00
|
|
|
std::string m_szHostRequestMessage = "";
|
|
|
|
std::string m_szHostToken = "";
|
|
|
|
ImVec4 m_iv4HostRequestMessageColor = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
|
|
|
|
|
|
|
////////////////////
|
|
|
|
// Private Server //
|
|
|
|
////////////////////
|
|
|
|
std::string m_szHiddenServerToken = "";
|
|
|
|
std::string m_szHiddenServerRequestMessage = "";
|
|
|
|
ImVec4 m_ivHiddenServerMessageColor = ImVec4(0.00f, 1.00f, 0.00f, 1.00f);
|
|
|
|
|
|
|
|
/* Texture */
|
|
|
|
ID3D11ShaderResourceView* m_idLockedIcon = nullptr;
|
2022-01-12 02:53:07 +01:00
|
|
|
std::vector<unsigned char>* m_vucLockedIconBlob;
|
2021-12-25 22:36:38 +01:00
|
|
|
int m_nLockedIconWidth = 0;
|
|
|
|
int m_nLockedIconHeight = 0;
|
|
|
|
|
|
|
|
void SetSection(ESection section)
|
|
|
|
{
|
|
|
|
eCurrentSection = section;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-01-12 02:53:07 +01:00
|
|
|
extern IBrowser* g_pIBrowser;
|
2022-01-15 15:25:19 +01:00
|
|
|
#endif
|