2022-01-12 02:53:07 +01:00
/******************************************************************************
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
File : IBrowser . cpp
Date : 09 : 06 : 2021
Author : Sal
Purpose : Implements the in - game server browser front - end
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
History :
- 09 : 06 : 2021 21 : 07 : Created by Sal
- 25 : 07 : 2021 14 : 26 : Implement private servers connect dialog and password field
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2021-12-25 22:36:38 +01:00
# include "core/stdafx.h"
# include "core/init.h"
# include "core/resource.h"
2022-01-18 11:23:14 +01:00
# include "tier0/commandline.h"
2022-04-09 16:16:40 +02:00
# include "tier1/IConVar.h"
# include "tier1/cvar.h"
2021-12-25 22:36:38 +01:00
# include "windows/id3dx.h"
# include "windows/console.h"
2022-04-26 20:24:51 +02:00
# include "windows/resource.h"
2022-04-02 02:48:54 +02:00
# include "engine/net.h"
2021-12-25 22:36:38 +01:00
# include "engine/sys_utils.h"
# include "engine/host_state.h"
2022-05-20 11:52:19 +02:00
# include "engine/server/server.h"
2021-12-25 22:36:38 +01:00
# include "networksystem/serverlisting.h"
# include "networksystem/r5net.h"
# include "squirrel/sqinit.h"
2022-01-15 15:25:19 +01:00
# include "squirrel/sqapi.h"
2022-04-02 12:27:35 +02:00
# include "client/vengineclient_impl.h"
2022-03-04 12:22:17 +01:00
# include "vpc/keyvalues.h"
2022-05-16 21:15:25 +02:00
# include "vstdlib/callback.h"
2022-03-04 12:22:17 +01:00
# include "vpklib/packedstore.h"
# include "gameui/IBrowser.h"
2021-12-25 22:36:38 +01:00
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
IBrowser : : IBrowser ( void )
2021-12-25 22:36:38 +01:00
{
memset ( m_chServerConnStringBuffer , 0 , sizeof ( m_chServerConnStringBuffer ) ) ;
2022-05-04 17:36:23 +02:00
std : : regex rgArchiveRegex { R " ([^_]*_(.*)(.bsp.pak000_dir).*) " } ;
std : : smatch smRegexMatches ;
2022-05-16 21:54:46 +02:00
for ( const auto & dEntry : fs : : directory_iterator ( " vpk " ) )
2021-12-25 22:36:38 +01:00
{
2022-05-04 17:36:23 +02:00
std : : string svFileName = dEntry . path ( ) . string ( ) ;
std : : regex_search ( svFileName , smRegexMatches , rgArchiveRegex ) ;
if ( smRegexMatches . size ( ) > 0 )
{
if ( strcmp ( smRegexMatches [ 1 ] . str ( ) . c_str ( ) , " frontend " ) = = 0 )
{
continue ;
}
else if ( strcmp ( smRegexMatches [ 1 ] . str ( ) . c_str ( ) , " mp_common " ) = = 0 )
{
m_vszMapsList . push_back ( " mp_lobby " ) ;
continue ;
}
2021-12-25 22:36:38 +01:00
2022-05-04 17:36:23 +02:00
m_vszMapsList . push_back ( smRegexMatches [ 1 ] . str ( ) ) ;
}
2021-12-25 22:36:38 +01:00
}
2022-03-27 22:17:30 +02:00
# ifndef CLIENT_DLL
2021-12-25 22:36:38 +01:00
static std : : thread hostingServerRequestThread ( [ this ] ( )
{
while ( true )
{
UpdateHostingStatus ( ) ;
std : : this_thread : : sleep_for ( std : : chrono : : milliseconds ( 5000 ) ) ;
}
} ) ;
hostingServerRequestThread . detach ( ) ;
2022-03-27 22:17:30 +02:00
# endif // !CLIENT_DLL
2022-04-26 20:24:51 +02:00
m_rLockedIconBlob = GetModuleResource ( IDB_PNG2 ) ;
2021-12-25 22:36:38 +01:00
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
IBrowser : : ~ IBrowser ( void )
2021-12-25 22:36:38 +01:00
{
//delete r5net;
}
//-----------------------------------------------------------------------------
2022-01-12 02:53:07 +01:00
// Purpose: draws the main browser front-end
2021-12-25 22:36:38 +01:00
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : Draw ( const char * pszTitle , bool * bDraw )
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
if ( ! m_bInitialized )
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
SetStyleVar ( ) ;
m_szMatchmakingHostName = r5net_matchmaking_hostname - > GetString ( ) ;
m_bInitialized = true ;
2021-12-25 22:36:38 +01:00
}
2022-01-28 12:56:51 +01:00
{
//ImGui::ShowStyleEditor();
//ImGui::ShowDemoWindow();
}
2022-03-04 12:22:17 +01:00
if ( ! ImGui : : Begin ( pszTitle , bDraw ) )
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
ImGui : : End ( ) ;
return ;
}
ImGui : : End ( ) ;
if ( * bDraw = = NULL )
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
m_bActivate = false ;
2021-12-25 22:36:38 +01:00
}
2022-01-12 02:53:07 +01:00
ImGui : : SetNextWindowSize ( ImVec2 ( 840 , 600 ) , ImGuiCond_FirstUseEver ) ;
ImGui : : SetWindowPos ( ImVec2 ( - 500 , 50 ) , ImGuiCond_FirstUseEver ) ;
2022-03-04 12:22:17 +01:00
ImGui : : Begin ( pszTitle , NULL , ImGuiWindowFlags_NoScrollbar ) ;
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
CompMenu ( ) ;
2021-12-25 22:36:38 +01:00
2022-01-12 02:53:07 +01:00
switch ( eCurrentSection )
2021-12-25 22:36:38 +01:00
{
2022-03-04 12:22:17 +01:00
case eSection : : SERVER_BROWSER :
2022-01-12 02:53:07 +01:00
ServerBrowserSection ( ) ;
2021-12-25 22:36:38 +01:00
break ;
2022-03-04 12:22:17 +01:00
case eSection : : HOST_SERVER :
2022-01-12 02:53:07 +01:00
HostServerSection ( ) ;
2021-12-25 22:36:38 +01:00
break ;
2022-03-04 12:22:17 +01:00
case eSection : : SETTINGS :
2022-01-12 02:53:07 +01:00
SettingsSection ( ) ;
2021-12-25 22:36:38 +01:00
break ;
default :
break ;
}
}
2022-01-12 02:53:07 +01:00
ImGui : : End ( ) ;
2021-12-25 22:36:38 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: draws the compmenu
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : CompMenu ( void )
2021-12-25 22:36:38 +01:00
{
ImGui : : BeginTabBar ( " CompMenu " ) ;
if ( ImGui : : TabItemButton ( " Server Browser " ) )
{
2022-03-04 12:22:17 +01:00
SetSection ( eSection : : SERVER_BROWSER ) ;
2021-12-25 22:36:38 +01:00
}
2022-03-27 22:17:30 +02:00
# ifndef CLIENT_DLL
2021-12-25 22:36:38 +01:00
if ( ImGui : : TabItemButton ( " Host Server " ) )
{
2022-03-04 12:22:17 +01:00
SetSection ( eSection : : HOST_SERVER ) ;
2021-12-25 22:36:38 +01:00
}
2022-03-27 22:17:30 +02:00
# endif // !CLIENT_DLL
2021-12-25 22:36:38 +01:00
if ( ImGui : : TabItemButton ( " Settings " ) )
{
2022-03-04 12:22:17 +01:00
SetSection ( eSection : : SETTINGS ) ;
2021-12-25 22:36:38 +01:00
}
ImGui : : EndTabBar ( ) ;
}
//-----------------------------------------------------------------------------
// Purpose: draws the server browser section
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : ServerBrowserSection ( void )
2021-12-25 22:36:38 +01:00
{
ImGui : : BeginGroup ( ) ;
m_imServerBrowserFilter . Draw ( ) ;
ImGui : : SameLine ( ) ;
if ( ImGui : : Button ( " Refresh List " ) )
{
RefreshServerList ( ) ;
}
ImGui : : EndGroup ( ) ;
ImGui : : TextColored ( ImVec4 ( 1.00f , 0.00f , 0.00f , 1.00f ) , m_szServerListMessage . c_str ( ) ) ;
ImGui : : Separator ( ) ;
2022-03-04 12:22:17 +01:00
const float fFooterHeight = ImGui : : GetStyle ( ) . ItemSpacing . y + ImGui : : GetFrameHeightWithSpacing ( ) ;
2022-05-08 16:20:48 +02:00
ImGui : : BeginChild ( " ##ServerBrowser_ServerList " , { 0 , - fFooterHeight } , true , ImGuiWindowFlags_AlwaysVerticalScrollbar ) ;
2022-01-22 15:51:09 +01:00
2022-01-28 12:56:51 +01:00
if ( m_bDefaultTheme ) { ImGui : : PushStyleVar ( ImGuiStyleVar_FramePadding , ImVec2 { 8.f , 0.f } ) ; }
else { ImGui : : PushStyleVar ( ImGuiStyleVar_FramePadding , ImVec2 ( 4.f , 0.f ) ) ; }
2022-05-08 16:20:48 +02:00
if ( ImGui : : BeginTable ( " ##ServerBrowser_ServerListTable " , 5 , ImGuiTableFlags_Resizable ) )
2021-12-25 22:36:38 +01:00
{
2022-01-22 15:51:09 +01:00
ImGui : : TableSetupColumn ( " Name " , ImGuiTableColumnFlags_WidthStretch , 25 ) ;
ImGui : : TableSetupColumn ( " Map " , ImGuiTableColumnFlags_WidthStretch , 20 ) ;
2021-12-25 22:36:38 +01:00
ImGui : : TableSetupColumn ( " Port " , ImGuiTableColumnFlags_WidthStretch , 5 ) ;
2022-01-22 15:51:09 +01:00
ImGui : : TableSetupColumn ( " Playlist " , ImGuiTableColumnFlags_WidthStretch , 10 ) ;
2021-12-25 22:36:38 +01:00
ImGui : : TableSetupColumn ( " " , ImGuiTableColumnFlags_WidthStretch , 5 ) ;
ImGui : : TableHeadersRow ( ) ;
for ( ServerListing & server : m_vServerList )
{
2022-03-04 12:22:17 +01:00
const char * pszHostName = server . svServerName . c_str ( ) ;
const char * pszHostMap = server . svMapName . c_str ( ) ;
const char * pszHostPort = server . svPort . c_str ( ) ;
const char * pszPlaylist = server . svPlaylist . c_str ( ) ;
if ( m_imServerBrowserFilter . PassFilter ( pszHostName )
| | m_imServerBrowserFilter . PassFilter ( pszHostMap )
| | m_imServerBrowserFilter . PassFilter ( pszHostPort ) )
2021-12-25 22:36:38 +01:00
{
ImGui : : TableNextColumn ( ) ;
2022-03-04 12:22:17 +01:00
ImGui : : Text ( pszHostName ) ;
2021-12-25 22:36:38 +01:00
ImGui : : TableNextColumn ( ) ;
2022-03-04 12:22:17 +01:00
ImGui : : Text ( pszHostMap ) ;
2021-12-25 22:36:38 +01:00
ImGui : : TableNextColumn ( ) ;
2022-03-04 12:22:17 +01:00
ImGui : : Text ( pszHostPort ) ;
2021-12-25 22:36:38 +01:00
ImGui : : TableNextColumn ( ) ;
2022-03-04 12:22:17 +01:00
ImGui : : Text ( pszPlaylist ) ;
2021-12-25 22:36:38 +01:00
ImGui : : TableNextColumn ( ) ;
2022-03-04 12:22:17 +01:00
std : : string svConnectBtn = " Connect## " ;
svConnectBtn + = ( server . svServerName + server . svIpAddress + server . svMapName ) ;
2021-12-25 22:36:38 +01:00
2022-03-04 12:22:17 +01:00
if ( ImGui : : Button ( svConnectBtn . c_str ( ) ) )
2021-12-25 22:36:38 +01:00
{
ConnectToServer ( server . svIpAddress , server . svPort , server . svEncryptionKey ) ;
}
}
}
ImGui : : EndTable ( ) ;
2022-01-22 15:51:09 +01:00
ImGui : : PopStyleVar ( 1 ) ;
2021-12-25 22:36:38 +01:00
}
ImGui : : EndChild ( ) ;
ImGui : : Separator ( ) ;
ImGui : : PushItemWidth ( ImGui : : GetWindowContentRegionWidth ( ) / 4 ) ;
{
ImGui : : InputTextWithHint ( " ##ServerBrowser_ServerConnString " , " Enter IP address or \" localhost \" " , m_chServerConnStringBuffer , IM_ARRAYSIZE ( m_chServerConnStringBuffer ) ) ;
ImGui : : SameLine ( ) ;
ImGui : : InputTextWithHint ( " ##ServerBrowser_ServerEncKey " , " Enter encryption key " , m_chServerEncKeyBuffer , IM_ARRAYSIZE ( m_chServerEncKeyBuffer ) ) ;
ImGui : : SameLine ( ) ;
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Connect " , ImVec2 ( ImGui : : GetWindowContentRegionWidth ( ) / 4.2 , 18.5 ) ) )
2021-12-25 22:36:38 +01:00
{
ConnectToServer ( m_chServerConnStringBuffer , m_chServerEncKeyBuffer ) ;
}
ImGui : : SameLine ( ) ;
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Private Servers " , ImVec2 ( ImGui : : GetWindowContentRegionWidth ( ) / 4.2 , 18.5 ) ) )
2021-12-25 22:36:38 +01:00
{
2022-05-08 16:20:48 +02:00
ImGui : : OpenPopup ( " Connect to Private Server " ) ;
2021-12-25 22:36:38 +01:00
}
HiddenServersModal ( ) ;
}
ImGui : : PopItemWidth ( ) ;
}
2022-01-12 02:53:07 +01:00
//-----------------------------------------------------------------------------
// Purpose: refreshes the server browser list with available servers
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : RefreshServerList ( void )
2022-01-12 02:53:07 +01:00
{
static bool bThreadLocked = false ;
m_vServerList . clear ( ) ;
m_szServerListMessage . clear ( ) ;
if ( ! bThreadLocked )
{
std : : thread t ( [ this ] ( )
{
DevMsg ( eDLL_T : : CLIENT , " Refreshing server list with matchmaking host '%s' \n " , r5net_matchmaking_hostname - > GetString ( ) ) ;
bThreadLocked = true ;
m_vServerList = g_pR5net - > GetServersList ( m_szServerListMessage ) ;
bThreadLocked = false ;
} ) ;
t . detach ( ) ;
}
}
2022-01-15 15:25:19 +01:00
//-----------------------------------------------------------------------------
// Purpose: get server list from pylon.
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : GetServerList ( void )
2022-01-15 15:25:19 +01:00
{
m_vServerList . clear ( ) ;
m_szServerListMessage . clear ( ) ;
m_vServerList = g_pR5net - > GetServersList ( m_szServerListMessage ) ;
}
2022-01-12 02:53:07 +01:00
//-----------------------------------------------------------------------------
// Purpose: connects to specified server
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : ConnectToServer ( const std : : string & svIp , const std : : string & svPort , const std : : string & svNetKey )
2022-01-12 02:53:07 +01:00
{
2022-03-04 12:22:17 +01:00
if ( ! svNetKey . empty ( ) )
2022-01-12 02:53:07 +01:00
{
2022-03-04 12:22:17 +01:00
ChangeEncryptionKeyTo ( svNetKey ) ;
2022-01-12 02:53:07 +01:00
}
std : : stringstream cmd ;
2022-03-04 12:22:17 +01:00
cmd < < " connect " < < svIp < < " : " < < svPort ;
2022-01-12 02:53:07 +01:00
ProcessCommand ( cmd . str ( ) . c_str ( ) ) ;
}
//-----------------------------------------------------------------------------
// Purpose: connects to specified server
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : ConnectToServer ( const std : : string & svServer , const std : : string & svNetKey )
2022-01-12 02:53:07 +01:00
{
2022-03-04 12:22:17 +01:00
if ( ! svNetKey . empty ( ) )
2022-01-12 02:53:07 +01:00
{
2022-03-04 12:22:17 +01:00
ChangeEncryptionKeyTo ( svNetKey ) ;
2022-01-12 02:53:07 +01:00
}
std : : stringstream cmd ;
2022-03-04 12:22:17 +01:00
cmd < < " connect " < < svServer ;
2022-01-12 02:53:07 +01:00
ProcessCommand ( cmd . str ( ) . c_str ( ) ) ;
}
2022-01-15 15:25:19 +01:00
//-----------------------------------------------------------------------------
2022-01-15 20:13:11 +01:00
// Purpose: Launch server with given parameters
2022-01-15 15:25:19 +01:00
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : LaunchServer ( void )
2022-01-15 15:25:19 +01:00
{
2022-03-27 22:17:30 +02:00
# ifndef CLIENT_DLL
2022-05-08 16:20:48 +02:00
DevMsg ( eDLL_T : : ENGINE , " Starting server with name: \" %s \" map: \" %s \" playlist: \" %s \" \n " , m_Server . svServerName . c_str ( ) , m_Server . svMapName . c_str ( ) , m_Server . svPlaylist . c_str ( ) ) ;
2022-01-15 20:13:11 +01:00
/*
* Playlist gets parsed in two instances , first in LoadPlaylist all the neccessary values .
* Then when you would normally call launchplaylist which calls StartPlaylist it would cmd call mp_gamemode which parses the gamemode specific part of the playlist . .
*/
KeyValues_LoadPlaylist ( m_Server . svPlaylist . c_str ( ) ) ;
std : : stringstream cgmd ;
cgmd < < " mp_gamemode " < < m_Server . svPlaylist ;
ProcessCommand ( cgmd . str ( ) . c_str ( ) ) ;
// This is to avoid a race condition.
std : : this_thread : : sleep_for ( std : : chrono : : milliseconds ( 100 ) ) ;
std : : stringstream cmd ;
cmd < < " map " < < m_Server . svMapName ;
ProcessCommand ( cmd . str ( ) . c_str ( ) ) ;
2022-03-27 22:17:30 +02:00
# endif // !CLIENT_DLL
2022-01-15 15:25:19 +01:00
}
2021-12-25 22:36:38 +01:00
//-----------------------------------------------------------------------------
// Purpose: draws the hidden private server modal
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : HiddenServersModal ( void )
2021-12-25 22:36:38 +01:00
{
bool modalOpen = true ;
2022-05-08 16:28:20 +02:00
if ( ImGui : : BeginPopupModal ( " Connect to Private Server " , & modalOpen ) )
2021-12-25 22:36:38 +01:00
{
ImGui : : SetWindowSize ( ImVec2 ( 400.f , 200.f ) , ImGuiCond_Always ) ;
if ( ! m_idLockedIcon )
{
2022-04-26 20:24:51 +02:00
bool ret = LoadTextureBuffer ( reinterpret_cast < unsigned char * > ( m_rLockedIconBlob . m_pData ) , static_cast < int > ( m_rLockedIconBlob . m_nSize ) ,
& m_idLockedIcon , & m_rLockedIconBlob . m_nWidth , & m_rLockedIconBlob . m_nHeight ) ;
2021-12-25 22:36:38 +01:00
IM_ASSERT ( ret ) ;
}
ImGui : : PushStyleColor ( ImGuiCol_ChildBg , ImVec4 ( 0.00f , 0.00f , 0.00f , 0.00f ) ) ; // Override the style color for child bg.
2022-04-26 20:24:51 +02:00
ImGui : : BeginChild ( " ##HiddenServersConnectModal_IconParent " , ImVec2 ( m_rLockedIconBlob . m_nWidth , m_rLockedIconBlob . m_nHeight ) ) ;
ImGui : : Image ( m_idLockedIcon , ImVec2 ( m_rLockedIconBlob . m_nWidth , m_rLockedIconBlob . m_nHeight ) ) ; // Display texture.
2021-12-25 22:36:38 +01:00
ImGui : : EndChild ( ) ;
ImGui : : PopStyleColor ( ) ; // Pop the override for the child bg.
ImGui : : SameLine ( ) ;
ImGui : : Text ( " Enter the token to connect " ) ;
ImGui : : PushItemWidth ( ImGui : : GetWindowContentRegionWidth ( ) ) ; // Override item width.
ImGui : : InputTextWithHint ( " ##HiddenServersConnectModal_TokenInput " , " Token " , & m_szHiddenServerToken ) ;
ImGui : : PopItemWidth ( ) ;
ImGui : : Dummy ( ImVec2 ( ImGui : : GetWindowContentRegionWidth ( ) , 19.f ) ) ; // Place a dummy, basically making space inserting a blank element.
ImGui : : TextColored ( m_ivHiddenServerMessageColor , m_szHiddenServerRequestMessage . c_str ( ) ) ;
ImGui : : Separator ( ) ;
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Connect " , ImVec2 ( ImGui : : GetWindowContentRegionWidth ( ) / 2 , 24 ) ) )
2021-12-25 22:36:38 +01:00
{
m_szHiddenServerRequestMessage . clear ( ) ;
ServerListing server ;
bool result = g_pR5net - > GetServerByToken ( server , m_szHiddenServerRequestMessage , m_szHiddenServerToken ) ; // Send token connect request.
if ( ! server . svServerName . empty ( ) )
{
ConnectToServer ( server . svIpAddress , server . svPort , server . svEncryptionKey ) ; // Connect to the server
m_szHiddenServerRequestMessage = " Found Server: " + server . svServerName ;
m_ivHiddenServerMessageColor = ImVec4 ( 0.00f , 1.00f , 0.00f , 1.00f ) ;
ImGui : : CloseCurrentPopup ( ) ;
}
else
{
m_szHiddenServerRequestMessage = " Error: " + m_szHiddenServerRequestMessage ;
m_ivHiddenServerMessageColor = ImVec4 ( 1.00f , 0.00f , 0.00f , 1.00f ) ;
}
}
ImGui : : SameLine ( ) ;
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Close " , ImVec2 ( ImGui : : GetWindowContentRegionWidth ( ) / 2 , 24 ) ) )
2021-12-25 22:36:38 +01:00
{
ImGui : : CloseCurrentPopup ( ) ;
}
ImGui : : EndPopup ( ) ;
}
}
//-----------------------------------------------------------------------------
// Purpose: draws the host section
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : HostServerSection ( void )
2021-12-25 22:36:38 +01:00
{
2022-03-27 22:17:30 +02:00
# ifndef CLIENT_DLL
2022-03-04 12:22:17 +01:00
static std : : string svServerNameErr = " " ;
2021-12-25 22:36:38 +01:00
ImGui : : InputTextWithHint ( " ##ServerHost_ServerName " , " Server Name (Required) " , & m_Server . svServerName ) ;
ImGui : : Spacing ( ) ;
2022-05-08 16:20:48 +02:00
if ( ImGui : : BeginCombo ( " Playlist " , m_Server . svPlaylist . c_str ( ) ) )
2021-12-25 22:36:38 +01:00
{
for ( auto & item : g_szAllPlaylists )
{
if ( ImGui : : Selectable ( item . c_str ( ) , item = = m_Server . svPlaylist ) )
{
m_Server . svPlaylist = item ;
}
}
ImGui : : EndCombo ( ) ;
}
if ( ImGui : : BeginCombo ( " Map##ServerHost_MapListBox " , m_Server . svMapName . c_str ( ) ) )
{
for ( auto & item : m_vszMapsList )
{
if ( ImGui : : Selectable ( item . c_str ( ) , item = = m_Server . svMapName ) )
{
m_Server . svMapName = item ;
}
}
ImGui : : EndCombo ( ) ;
}
2022-05-08 16:20:48 +02:00
ImGui : : Checkbox ( " Load Global Ban List " , & g_bCheckCompBanDB ) ;
2021-12-25 22:36:38 +01:00
ImGui : : Spacing ( ) ;
ImGui : : SameLine ( ) ;
ImGui : : Text ( " Server Visiblity " ) ;
2022-05-08 16:20:48 +02:00
if ( ImGui : : SameLine ( ) ; ImGui : : RadioButton ( " Offline " , eServerVisibility = = EServerVisibility : : OFFLINE ) )
2021-12-25 22:36:38 +01:00
{
eServerVisibility = EServerVisibility : : OFFLINE ;
}
2022-05-08 16:20:48 +02:00
if ( ImGui : : SameLine ( ) ; ImGui : : RadioButton ( " Hidden " , eServerVisibility = = EServerVisibility : : HIDDEN ) )
2021-12-25 22:36:38 +01:00
{
eServerVisibility = EServerVisibility : : HIDDEN ;
}
2022-05-08 16:20:48 +02:00
if ( ImGui : : SameLine ( ) ; ImGui : : RadioButton ( " Public " , eServerVisibility = = EServerVisibility : : PUBLIC ) )
2021-12-25 22:36:38 +01:00
{
eServerVisibility = EServerVisibility : : PUBLIC ;
}
ImGui : : Spacing ( ) ;
ImGui : : Separator ( ) ;
if ( ! g_pHostState - > m_bActiveGame )
{
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Start Server " , ImVec2 ( ImGui : : GetWindowSize ( ) . x , 32 ) ) )
2021-12-25 22:36:38 +01:00
{
2022-03-04 12:22:17 +01:00
svServerNameErr . clear ( ) ;
2021-12-25 22:36:38 +01:00
if ( ! m_Server . svServerName . empty ( ) & & ! m_Server . svPlaylist . empty ( ) & & ! m_Server . svMapName . empty ( ) )
{
2022-01-15 20:13:11 +01:00
LaunchServer ( ) ; // Launch server.
UpdateHostingStatus ( ) ; // Update hosting status.
2021-12-25 22:36:38 +01:00
}
else
{
if ( m_Server . svServerName . empty ( ) )
{
2022-03-04 12:22:17 +01:00
svServerNameErr = " No Server Name assigned. " ;
2021-12-25 22:36:38 +01:00
}
else if ( m_Server . svPlaylist . empty ( ) )
{
2022-03-04 12:22:17 +01:00
svServerNameErr = " No Playlist assigned. " ;
2021-12-25 22:36:38 +01:00
}
else if ( m_Server . svMapName . empty ( ) )
{
2022-03-04 12:22:17 +01:00
svServerNameErr = " 'levelname' was empty. " ;
2021-12-25 22:36:38 +01:00
}
}
}
}
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Force Start " , ImVec2 ( ImGui : : GetWindowSize ( ) . x , 32 ) ) )
2021-12-25 22:36:38 +01:00
{
2022-03-04 12:22:17 +01:00
svServerNameErr . clear ( ) ;
2021-12-25 22:36:38 +01:00
if ( ! m_Server . svPlaylist . empty ( ) & & ! m_Server . svMapName . empty ( ) )
{
2022-01-15 20:13:11 +01:00
LaunchServer ( ) ; // Launch server.
UpdateHostingStatus ( ) ; // Update hosting status.
2021-12-25 22:36:38 +01:00
}
else
{
if ( m_Server . svPlaylist . empty ( ) )
{
2022-03-04 12:22:17 +01:00
svServerNameErr = " No Playlist assigned. " ;
2021-12-25 22:36:38 +01:00
}
else if ( m_Server . svMapName . empty ( ) )
{
2022-03-04 12:22:17 +01:00
svServerNameErr = " 'levelname' was empty. " ;
2021-12-25 22:36:38 +01:00
}
}
}
2022-03-04 12:22:17 +01:00
ImGui : : TextColored ( ImVec4 ( 1.00f , 0.00f , 0.00f , 1.00f ) , svServerNameErr . c_str ( ) ) ;
2021-12-25 22:36:38 +01:00
ImGui : : TextColored ( m_iv4HostRequestMessageColor , m_szHostRequestMessage . c_str ( ) ) ;
if ( ! m_szHostToken . empty ( ) )
{
ImGui : : InputText ( " ##ServerHost_HostToken " , & m_szHostToken , ImGuiInputTextFlags_ReadOnly ) ;
}
if ( g_pHostState - > m_bActiveGame )
{
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Weapon Reparse " , ImVec2 ( ImGui : : GetWindowSize ( ) . x , 32 ) ) )
2021-12-25 22:36:38 +01:00
{
2022-05-08 16:20:48 +02:00
DevMsg ( eDLL_T : : ENGINE , " Reparsing weapon data on %s \n " , " server and client " ) ;
2022-04-08 23:03:09 +02:00
ProcessCommand ( " weapon_reparse " ) ;
2021-12-25 22:36:38 +01:00
ProcessCommand ( " reload " ) ;
}
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Change Level " , ImVec2 ( ImGui : : GetWindowSize ( ) . x , 32 ) ) )
2021-12-25 22:36:38 +01:00
{
if ( ! m_Server . svMapName . empty ( ) )
{
strncpy_s ( g_pHostState - > m_levelName , m_Server . svMapName . c_str ( ) , 64 ) ; // Copy new map into hoststate levelname. 64 is size of m_levelname.
g_pHostState - > m_iNextState = HostStates_t : : HS_CHANGE_LEVEL_MP ; // Force CHostState::FrameUpdate to change the level.
}
else
{
2022-03-04 12:22:17 +01:00
svServerNameErr = " Failed to change level: 'levelname' was empty. " ;
2021-12-25 22:36:38 +01:00
}
}
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Stop Server " , ImVec2 ( ImGui : : GetWindowSize ( ) . x , 32 ) ) )
2021-12-25 22:36:38 +01:00
{
ProcessCommand ( " LeaveMatch " ) ; // TODO: use script callback instead.
g_pHostState - > m_iNextState = HostStates_t : : HS_GAME_SHUTDOWN ; // Force CHostState::FrameUpdate to shutdown the server for dedicated.
}
}
else
{
2022-05-08 16:20:48 +02:00
if ( ImGui : : Button ( " Reload Playlist " , ImVec2 ( ImGui : : GetWindowSize ( ) . x , 32 ) ) )
2021-12-25 22:36:38 +01:00
{
2022-05-16 21:15:25 +02:00
_DownloadPlaylists_f ( ) ;
2022-04-09 16:16:40 +02:00
KeyValues : : InitPlaylist ( ) ; // Re-Init playlist.
2021-12-25 22:36:38 +01:00
}
}
2022-03-27 22:17:30 +02:00
# endif // !CLIENT_DLL
2021-12-25 22:36:38 +01:00
}
//-----------------------------------------------------------------------------
2022-01-12 02:53:07 +01:00
// Purpose: updates the hoster's status
2021-12-25 22:36:38 +01:00
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : UpdateHostingStatus ( void )
2021-12-25 22:36:38 +01:00
{
2022-03-27 22:17:30 +02:00
# ifndef CLIENT_DLL
2022-01-12 02:53:07 +01:00
if ( ! g_pHostState | | ! g_pCVar )
2021-12-25 22:36:38 +01:00
{
return ;
}
2021-12-26 02:30:20 +01:00
2022-03-04 12:22:17 +01:00
eHostingStatus = g_pHostState - > m_bActiveGame ? eHostStatus : : HOSTING : eHostStatus : : NOT_HOSTING ; // Are we hosting a server?
2022-01-12 02:53:07 +01:00
switch ( eHostingStatus )
{
2022-03-04 12:22:17 +01:00
case eHostStatus : : NOT_HOSTING :
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
m_szHostRequestMessage . clear ( ) ;
m_iv4HostRequestMessageColor = ImVec4 ( 1.00f , 1.00f , 1.00f , 1.00f ) ;
break ;
2021-12-25 22:36:38 +01:00
}
2022-03-04 12:22:17 +01:00
case eHostStatus : : HOSTING :
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
if ( eServerVisibility = = EServerVisibility : : OFFLINE )
{
break ;
}
2021-12-25 22:36:38 +01:00
2022-01-20 16:04:10 +01:00
if ( * g_nClientRemoteChecksum = = NULL ) // Check if script checksum is valid yet.
2021-12-25 22:36:38 +01:00
{
break ;
2022-01-12 02:53:07 +01:00
}
switch ( eServerVisibility )
{
case EServerVisibility : : HIDDEN :
m_Server . bHidden = true ;
2021-12-25 22:36:38 +01:00
break ;
2022-01-12 02:53:07 +01:00
case EServerVisibility : : PUBLIC :
m_Server . bHidden = false ;
2021-12-25 22:36:38 +01:00
break ;
default :
break ;
}
2022-01-12 02:53:07 +01:00
SendHostingPostRequest ( ) ;
break ;
}
default :
break ;
}
2022-03-27 22:17:30 +02:00
# endif // !CLIENT_DLL
2022-01-12 02:53:07 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: sends the hosting POST request to the comp server
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : SendHostingPostRequest ( void )
2022-01-12 02:53:07 +01:00
{
2022-03-27 22:17:30 +02:00
# ifndef CLIENT_DLL
2022-01-12 02:53:07 +01:00
m_szHostToken = std : : string ( ) ;
bool result = g_pR5net - > PostServerHost ( m_szHostRequestMessage , m_szHostToken ,
2022-03-04 12:22:17 +01:00
ServerListing
{
2022-03-26 18:06:54 +01:00
m_Server . svServerName . c_str ( ) ,
2022-01-12 02:53:07 +01:00
std : : string ( g_pHostState - > m_levelName ) ,
" " ,
2022-03-26 18:06:54 +01:00
hostport - > GetString ( ) ,
mp_gamemode - > GetString ( ) ,
2022-01-12 02:53:07 +01:00
m_Server . bHidden ,
2022-01-20 16:04:10 +01:00
std : : to_string ( * g_nClientRemoteChecksum ) ,
2022-01-12 02:53:07 +01:00
std : : string ( ) ,
g_szNetKey . c_str ( )
}
) ;
if ( result )
{
m_iv4HostRequestMessageColor = ImVec4 ( 0.00f , 1.00f , 0.00f , 1.00f ) ;
std : : stringstream msg ;
msg < < " Broadcasting! " ;
if ( ! m_szHostToken . empty ( ) )
{
msg < < " Share the following token for clients to connect: " ;
}
m_szHostRequestMessage = msg . str ( ) . c_str ( ) ;
2022-01-16 12:40:25 +01:00
DevMsg ( eDLL_T : : CLIENT , " PostServerHost replied with: %s \n " , m_szHostRequestMessage . c_str ( ) ) ;
2022-01-12 02:53:07 +01:00
}
else
{
m_iv4HostRequestMessageColor = ImVec4 ( 1.00f , 0.00f , 0.00f , 1.00f ) ;
2021-12-25 22:36:38 +01:00
}
2022-03-27 22:17:30 +02:00
# endif // !CLIENT_DLL
2021-12-25 22:36:38 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: executes submitted commands in a separate thread
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : ProcessCommand ( const char * pszCommand )
2021-12-25 22:36:38 +01:00
{
2022-05-06 00:34:46 +02:00
std : : thread t ( CEngineClient_CommandExecute , this , pszCommand ) ;
2021-12-25 22:36:38 +01:00
t . detach ( ) ; // Detach from render thread.
// This is to avoid a race condition.
std : : this_thread : : sleep_for ( std : : chrono : : milliseconds ( 1 ) ) ;
}
//-----------------------------------------------------------------------------
2022-01-12 02:53:07 +01:00
// Purpose: draws the settings section
2021-12-25 22:36:38 +01:00
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : SettingsSection ( void )
2021-12-25 22:36:38 +01:00
{
2022-05-08 16:20:48 +02:00
ImGui : : InputTextWithHint ( " Hostname " , " Matchmaking Server String " , & m_szMatchmakingHostName ) ;
2022-01-12 02:53:07 +01:00
if ( ImGui : : Button ( " Update Hostname " ) )
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
r5net_matchmaking_hostname - > SetValue ( m_szMatchmakingHostName . c_str ( ) ) ;
if ( g_pR5net )
{
delete g_pR5net ;
g_pR5net = new R5Net : : Client ( r5net_matchmaking_hostname - > GetString ( ) ) ;
}
2021-12-25 22:36:38 +01:00
}
2022-05-08 16:20:48 +02:00
ImGui : : InputText ( " Netkey " , ( char * ) g_szNetKey . c_str ( ) , ImGuiInputTextFlags_ReadOnly ) ;
if ( ImGui : : Button ( " Regenerate Encryption Key " ) )
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
RegenerateEncryptionKey ( ) ;
2021-12-25 22:36:38 +01:00
}
}
//-----------------------------------------------------------------------------
// Purpose: regenerates encryption key
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : RegenerateEncryptionKey ( void ) const
2021-12-25 22:36:38 +01:00
{
2022-04-02 02:48:54 +02:00
NET_GenerateKey ( ) ;
2021-12-25 22:36:38 +01:00
}
//-----------------------------------------------------------------------------
// Purpose: changes encryption key to specified one
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : ChangeEncryptionKeyTo ( const std : : string & svNetKey ) const
2021-12-25 22:36:38 +01:00
{
2022-04-02 02:48:54 +02:00
NET_SetKey ( svNetKey ) ;
2021-12-25 22:36:38 +01:00
}
2022-01-12 02:53:07 +01:00
//-----------------------------------------------------------------------------
// Purpose: sets the browser front-end style
//-----------------------------------------------------------------------------
2022-03-04 12:22:17 +01:00
void IBrowser : : SetStyleVar ( void )
2021-12-25 22:36:38 +01:00
{
2022-01-12 02:53:07 +01:00
ImGuiStyle & style = ImGui : : GetStyle ( ) ;
ImVec4 * colors = style . Colors ;
2022-04-16 00:30:46 +02:00
if ( ! CommandLine ( ) - > CheckParm ( " -imgui_default_theme " ) )
2022-01-18 11:23:14 +01:00
{
colors [ ImGuiCol_Text ] = ImVec4 ( 0.81f , 0.81f , 0.81f , 1.00f ) ;
colors [ ImGuiCol_TextDisabled ] = ImVec4 ( 0.56f , 0.56f , 0.56f , 1.00f ) ;
colors [ ImGuiCol_WindowBg ] = ImVec4 ( 0.27f , 0.27f , 0.27f , 1.00f ) ;
colors [ ImGuiCol_ChildBg ] = ImVec4 ( 0.00f , 0.00f , 0.00f , 1.00f ) ;
colors [ ImGuiCol_PopupBg ] = ImVec4 ( 0.27f , 0.27f , 0.27f , 1.00f ) ;
colors [ ImGuiCol_Border ] = ImVec4 ( 0.41f , 0.41f , 0.41f , 1.00f ) ;
colors [ ImGuiCol_BorderShadow ] = ImVec4 ( 0.04f , 0.04f , 0.04f , 0.64f ) ;
colors [ ImGuiCol_FrameBg ] = ImVec4 ( 0.13f , 0.13f , 0.13f , 1.00f ) ;
colors [ ImGuiCol_FrameBgHovered ] = ImVec4 ( 0.19f , 0.19f , 0.19f , 1.00f ) ;
colors [ ImGuiCol_FrameBgActive ] = ImVec4 ( 0.24f , 0.24f , 0.24f , 1.00f ) ;
colors [ ImGuiCol_TitleBg ] = ImVec4 ( 0.22f , 0.22f , 0.22f , 1.00f ) ;
colors [ ImGuiCol_TitleBgActive ] = ImVec4 ( 0.27f , 0.27f , 0.27f , 1.00f ) ;
colors [ ImGuiCol_TitleBgCollapsed ] = ImVec4 ( 0.00f , 0.00f , 0.00f , 1.00f ) ;
colors [ ImGuiCol_MenuBarBg ] = ImVec4 ( 0.22f , 0.22f , 0.22f , 1.00f ) ;
colors [ ImGuiCol_ScrollbarBg ] = ImVec4 ( 0.10f , 0.10f , 0.10f , 1.00f ) ;
colors [ ImGuiCol_ScrollbarGrab ] = ImVec4 ( 0.41f , 0.41f , 0.41f , 1.00f ) ;
colors [ ImGuiCol_ScrollbarGrabHovered ] = ImVec4 ( 0.53f , 0.53f , 0.53f , 1.00f ) ;
colors [ ImGuiCol_ScrollbarGrabActive ] = ImVec4 ( 0.63f , 0.63f , 0.63f , 1.00f ) ;
colors [ ImGuiCol_CheckMark ] = ImVec4 ( 0.61f , 0.61f , 0.61f , 1.00f ) ;
colors [ ImGuiCol_SliderGrab ] = ImVec4 ( 0.41f , 0.41f , 0.41f , 1.00f ) ;
colors [ ImGuiCol_SliderGrabActive ] = ImVec4 ( 0.53f , 0.53f , 0.53f , 1.00f ) ;
colors [ ImGuiCol_Button ] = ImVec4 ( 0.35f , 0.35f , 0.35f , 1.00f ) ;
colors [ ImGuiCol_ButtonHovered ] = ImVec4 ( 0.45f , 0.45f , 0.45f , 1.00f ) ;
colors [ ImGuiCol_ButtonActive ] = ImVec4 ( 0.52f , 0.52f , 0.52f , 1.00f ) ;
colors [ ImGuiCol_Header ] = ImVec4 ( 0.35f , 0.35f , 0.35f , 1.00f ) ;
colors [ ImGuiCol_HeaderHovered ] = ImVec4 ( 0.45f , 0.45f , 0.45f , 1.00f ) ;
colors [ ImGuiCol_HeaderActive ] = ImVec4 ( 0.53f , 0.53f , 0.53f , 1.00f ) ;
colors [ ImGuiCol_Separator ] = ImVec4 ( 0.53f , 0.53f , 0.57f , 1.00f ) ;
colors [ ImGuiCol_SeparatorHovered ] = ImVec4 ( 0.53f , 0.53f , 0.53f , 1.00f ) ;
colors [ ImGuiCol_SeparatorActive ] = ImVec4 ( 0.63f , 0.63f , 0.63f , 1.00f ) ;
colors [ ImGuiCol_ResizeGrip ] = ImVec4 ( 0.41f , 0.41f , 0.41f , 1.00f ) ;
colors [ ImGuiCol_ResizeGripHovered ] = ImVec4 ( 0.52f , 0.52f , 0.52f , 1.00f ) ;
colors [ ImGuiCol_ResizeGripActive ] = ImVec4 ( 0.63f , 0.63f , 0.63f , 1.00f ) ;
colors [ ImGuiCol_Tab ] = ImVec4 ( 0.18f , 0.18f , 0.18f , 1.00f ) ;
colors [ ImGuiCol_TabHovered ] = ImVec4 ( 0.39f , 0.39f , 0.39f , 1.00f ) ;
colors [ ImGuiCol_TabActive ] = ImVec4 ( 0.39f , 0.39f , 0.39f , 1.00f ) ;
2022-01-28 12:56:51 +01:00
style . WindowBorderSize = 0.0f ;
style . FrameBorderSize = 1.0f ;
style . ChildBorderSize = 1.0f ;
style . PopupBorderSize = 1.0f ;
style . TabBorderSize = 1.0f ;
style . WindowRounding = 4.0f ;
style . FrameRounding = 1.0f ;
style . ChildRounding = 1.0f ;
style . PopupRounding = 3.0f ;
style . TabRounding = 1.0f ;
style . ScrollbarRounding = 1.0f ;
2022-01-18 11:23:14 +01:00
}
else
{
2022-01-28 12:56:51 +01:00
colors [ ImGuiCol_WindowBg ] = ImVec4 ( 0.11f , 0.13f , 0.17f , 1.00f ) ;
colors [ ImGuiCol_ChildBg ] = ImVec4 ( 0.02f , 0.04f , 0.06f , 1.00f ) ;
colors [ ImGuiCol_PopupBg ] = ImVec4 ( 0.11f , 0.13f , 0.17f , 1.00f ) ;
colors [ ImGuiCol_Border ] = ImVec4 ( 0.41f , 0.41f , 0.41f , 0.50f ) ;
colors [ ImGuiCol_BorderShadow ] = ImVec4 ( 0.04f , 0.04f , 0.04f , 0.00f ) ;
colors [ ImGuiCol_FrameBg ] = ImVec4 ( 0.02f , 0.04f , 0.06f , 1.00f ) ;
colors [ ImGuiCol_FrameBgHovered ] = ImVec4 ( 0.04f , 0.06f , 0.10f , 1.00f ) ;
colors [ ImGuiCol_FrameBgActive ] = ImVec4 ( 0.04f , 0.07f , 0.12f , 1.00f ) ;
colors [ ImGuiCol_TitleBg ] = ImVec4 ( 0.26f , 0.51f , 0.78f , 1.00f ) ;
colors [ ImGuiCol_TitleBgActive ] = ImVec4 ( 0.26f , 0.51f , 0.78f , 1.00f ) ;
colors [ ImGuiCol_MenuBarBg ] = ImVec4 ( 0.11f , 0.13f , 0.17f , 1.00f ) ;
colors [ ImGuiCol_ScrollbarBg ] = ImVec4 ( 0.14f , 0.19f , 0.24f , 1.00f ) ;
colors [ ImGuiCol_ScrollbarGrab ] = ImVec4 ( 0.23f , 0.36f , 0.51f , 1.00f ) ;
colors [ ImGuiCol_ScrollbarGrabHovered ] = ImVec4 ( 0.30f , 0.46f , 0.65f , 1.00f ) ;
colors [ ImGuiCol_ScrollbarGrabActive ] = ImVec4 ( 0.31f , 0.49f , 0.69f , 1.00f ) ;
colors [ ImGuiCol_SliderGrab ] = ImVec4 ( 0.31f , 0.43f , 0.43f , 1.00f ) ;
colors [ ImGuiCol_SliderGrabActive ] = ImVec4 ( 0.41f , 0.56f , 0.57f , 1.00f ) ;
colors [ ImGuiCol_Button ] = ImVec4 ( 0.31f , 0.43f , 0.43f , 1.00f ) ;
colors [ ImGuiCol_ButtonHovered ] = ImVec4 ( 0.38f , 0.52f , 0.53f , 1.00f ) ;
colors [ ImGuiCol_ButtonActive ] = ImVec4 ( 0.41f , 0.56f , 0.57f , 1.00f ) ;
colors [ ImGuiCol_Header ] = ImVec4 ( 0.31f , 0.43f , 0.43f , 1.00f ) ;
colors [ ImGuiCol_HeaderHovered ] = ImVec4 ( 0.38f , 0.53f , 0.53f , 1.00f ) ;
colors [ ImGuiCol_HeaderActive ] = ImVec4 ( 0.41f , 0.56f , 0.57f , 1.00f ) ;
colors [ ImGuiCol_Separator ] = ImVec4 ( 0.53f , 0.53f , 0.57f , 0.00f ) ;
colors [ ImGuiCol_ResizeGrip ] = ImVec4 ( 0.41f , 0.41f , 0.41f , 0.50f ) ;
colors [ ImGuiCol_Tab ] = ImVec4 ( 0.31f , 0.43f , 0.43f , 1.00f ) ;
colors [ ImGuiCol_TabHovered ] = ImVec4 ( 0.38f , 0.53f , 0.53f , 1.00f ) ;
colors [ ImGuiCol_TabActive ] = ImVec4 ( 0.41f , 0.56f , 0.57f , 1.00f ) ;
colors [ ImGuiCol_TableHeaderBg ] = ImVec4 ( 0.14f , 0.19f , 0.24f , 1.00f ) ;
colors [ ImGuiCol_TableBorderStrong ] = ImVec4 ( 0.20f , 0.26f , 0.33f , 1.00f ) ;
colors [ ImGuiCol_TableBorderLight ] = ImVec4 ( 0.22f , 0.29f , 0.37f , 1.00f ) ;
style . WindowBorderSize = 1.0f ;
style . FrameBorderSize = 0.0f ;
style . ChildBorderSize = 0.0f ;
style . PopupBorderSize = 1.0f ;
style . TabBorderSize = 1.0f ;
style . WindowRounding = 4.0f ;
style . FrameRounding = 1.0f ;
style . ChildRounding = 1.0f ;
style . PopupRounding = 3.0f ;
style . TabRounding = 1.0f ;
style . ScrollbarRounding = 3.0f ;
m_bDefaultTheme = true ;
2022-01-18 11:23:14 +01:00
}
2022-01-12 02:53:07 +01:00
2022-01-22 15:51:09 +01:00
style . ItemSpacing = ImVec2 ( 4 , 4 ) ;
style . FramePadding = ImVec2 ( 4 , 4 ) ;
style . WindowPadding = ImVec2 ( 5 , 5 ) ;
style . WindowMinSize = ImVec2 ( 750 , 510 ) ;
2021-12-25 22:36:38 +01:00
}
2022-01-12 02:53:07 +01:00
2022-01-15 15:25:19 +01:00
IBrowser * g_pIBrowser = new IBrowser ( ) ;