mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fully implemented ConVar class so we could statically construct all SDK convars, this avoids a level of indirection, and allows for creating ConVar's everywhere in the project. This patch also removed the settings tab of the ImGui server browser, as it has threading issues, while it technically never caused a crash yet, it has been removed as there was no point keeping it vs the work required to make it thread save (it only managed 2 convars which are perfectly manageable through cfg's or the in-game console). Also temporarily disabled the creation of ConVar's in the mod system due to a memory leak, we would allocate and register a convar based on details parsed out of a mod file definition, but never unregister and free it.
84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
#pragma once
|
|
#ifndef DEDICATED
|
|
#include "common/sdkdefs.h"
|
|
#include "windows/resource.h"
|
|
#include "networksystem/serverlisting.h"
|
|
#include "networksystem/pylon.h"
|
|
#include "public/isurfacesystem.h"
|
|
#include "thirdparty/imgui/misc/imgui_utility.h"
|
|
|
|
class CBrowser : public IDebugSurface
|
|
{
|
|
public:
|
|
CBrowser(void);
|
|
virtual ~CBrowser(void);
|
|
|
|
virtual bool Init(void);
|
|
virtual void Think(void);
|
|
|
|
virtual void RunFrame(void);
|
|
virtual void RunTask(void);
|
|
|
|
virtual void DrawSurface(void);
|
|
|
|
void BrowserPanel(void);
|
|
void RefreshServerList(void);
|
|
|
|
void HiddenServersModal(void);
|
|
void HostPanel(void);
|
|
|
|
void UpdateHostingStatus(void);
|
|
void SendHostingPostRequest(const NetGameServer_t& gameServer);
|
|
|
|
void ProcessCommand(const char* pszCommand) const;
|
|
|
|
virtual void SetStyleVar(void);
|
|
|
|
inline bool IsVisible() { return m_flFadeAlpha > 0.0f; }
|
|
|
|
public:
|
|
// Command callbacks
|
|
static void ToggleBrowser_f();
|
|
|
|
const char* m_pszBrowserLabel;
|
|
bool m_bActivate;
|
|
|
|
private:
|
|
bool m_bInitialized;
|
|
bool m_bReclaimFocus;
|
|
bool m_bReclaimFocusTokenField;
|
|
bool m_bQueryListNonRecursive; // When set, refreshes the server list once the next frame.
|
|
bool m_bQueryGlobalBanList;
|
|
char m_szServerAddressBuffer[128];
|
|
char m_szServerEncKeyBuffer[30];
|
|
float m_flFadeAlpha;
|
|
|
|
ID3D11ShaderResourceView* m_idLockedIcon;
|
|
MODULERESOURCE m_rLockedIconBlob;
|
|
mutable CThreadFastMutex m_Mutex;
|
|
|
|
////////////////////
|
|
// Server List //
|
|
////////////////////
|
|
ImGuiTextFilter m_imServerBrowserFilter;
|
|
string m_svServerListMessage;
|
|
|
|
////////////////////
|
|
// Host Server //
|
|
////////////////////
|
|
string m_svHostRequestMessage;
|
|
string m_svHostToken;
|
|
ImVec4 m_HostRequestMessageColor;
|
|
|
|
////////////////////
|
|
// Private Server //
|
|
////////////////////
|
|
string m_svHiddenServerToken;
|
|
string m_svHiddenServerRequestMessage;
|
|
ImVec4 m_ivHiddenServerMessageColor;
|
|
|
|
ImGuiStyle_t m_Style;
|
|
};
|
|
|
|
extern CBrowser g_Browser;
|
|
#endif |