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-08-27 18:57:56 +02:00
|
|
|
#include "tier0/fasttimer.h"
|
2022-08-19 21:33:31 +02:00
|
|
|
#include "tier0/frametask.h"
|
2022-01-18 11:23:14 +01:00
|
|
|
#include "tier0/commandline.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"
|
2023-05-10 00:05:38 +02:00
|
|
|
#include "engine/cmd.h"
|
2022-05-27 02:08:51 +02:00
|
|
|
#include "engine/cmodel_bsp.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
#include "engine/host_state.h"
|
2022-05-20 20:14:39 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2022-05-20 11:52:19 +02:00
|
|
|
#include "engine/server/server.h"
|
2022-05-20 20:14:39 +02:00
|
|
|
#endif // CLIENT_DLL
|
2022-11-23 12:30:15 +01:00
|
|
|
#include "engine/client/clientstate.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
#include "networksystem/serverlisting.h"
|
2022-07-01 10:29:27 +02:00
|
|
|
#include "networksystem/pylon.h"
|
2022-08-14 15:45:08 +02:00
|
|
|
#include "networksystem/listmanager.h"
|
2024-04-05 17:42:05 +02:00
|
|
|
#include "rtech/playlists/playlists.h"
|
2023-05-10 00:05:38 +02:00
|
|
|
#include "common/callback.h"
|
2022-03-04 12:22:17 +01:00
|
|
|
#include "gameui/IBrowser.h"
|
2022-08-09 17:18:07 +02:00
|
|
|
#include "public/edict.h"
|
2023-05-06 16:23:56 +02:00
|
|
|
#include "game/shared/vscript_shared.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-02-23 00:12:06 +01:00
|
|
|
static ConCommand togglebrowser("togglebrowser", CBrowser::ToggleBrowser_f, "Show/hide the server browser", FCVAR_CLIENTDLL | FCVAR_RELEASE);
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//-----------------------------------------------------------------------------
|
2022-05-27 02:44:36 +02:00
|
|
|
CBrowser::CBrowser(void)
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
: m_reclaimFocusOnTokenField(false)
|
|
|
|
, m_queryNewListNonRecursive(false)
|
|
|
|
, m_queryGlobalBanList(true)
|
|
|
|
, m_hostMessageColor(1.00f, 1.00f, 1.00f, 1.00f)
|
|
|
|
, m_hiddenServerMessageColor(0.00f, 1.00f, 0.00f, 1.00f)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-04-05 18:22:56 +02:00
|
|
|
m_surfaceLabel = "Server Browser";
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
memset(m_serverAddressTextBuf, '\0', sizeof(m_serverAddressTextBuf));
|
|
|
|
memset(m_serverNetKeyTextBuf, '\0', sizeof(m_serverNetKeyTextBuf));
|
2021-12-25 22:36:38 +01:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_lockedIconDataResource = GetModuleResource(IDB_PNG2);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//-----------------------------------------------------------------------------
|
2022-05-27 02:44:36 +02:00
|
|
|
CBrowser::~CBrowser(void)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
Shutdown();
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
2022-08-14 15:45:08 +02:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
bool CBrowser::Init(void)
|
|
|
|
{
|
2024-04-05 18:22:56 +02:00
|
|
|
SetStyleVar(928.f, 524.f, -500.f, 50.f);
|
2022-08-14 15:45:08 +02:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
bool ret = LoadTextureBuffer(reinterpret_cast<unsigned char*>(m_lockedIconDataResource.m_pData), int(m_lockedIconDataResource.m_nSize),
|
|
|
|
&m_lockedIconShaderResource, &m_lockedIconDataResource.m_nWidth, &m_lockedIconDataResource.m_nHeight);
|
2023-05-15 09:54:18 +02:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
IM_ASSERT(ret && m_lockedIconShaderResource);
|
2023-05-15 09:54:18 +02:00
|
|
|
return ret;
|
2022-08-14 15:45:08 +02:00
|
|
|
}
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose:
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void CBrowser::Shutdown(void)
|
|
|
|
{
|
|
|
|
if (m_lockedIconShaderResource)
|
|
|
|
{
|
|
|
|
m_lockedIconShaderResource->Release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
2022-01-12 02:53:07 +01:00
|
|
|
// Purpose: draws the main browser front-end
|
2021-12-25 22:36:38 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
2022-08-14 15:45:08 +02:00
|
|
|
void CBrowser::RunFrame(void)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-10-20 12:29:21 +02:00
|
|
|
// Uncomment these when adjusting the theme or layout.
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-10-20 12:29:21 +02:00
|
|
|
//ImGui::ShowStyleEditor();
|
|
|
|
//ImGui::ShowDemoWindow();
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
2024-04-05 18:22:56 +02:00
|
|
|
if (!m_initialized)
|
2022-01-28 12:56:51 +01:00
|
|
|
{
|
2022-10-20 12:29:21 +02:00
|
|
|
Init();
|
2024-04-05 18:22:56 +02:00
|
|
|
m_initialized = true;
|
2022-01-28 12:56:51 +01:00
|
|
|
}
|
|
|
|
|
2024-04-05 18:22:56 +02:00
|
|
|
Animate();
|
|
|
|
RunTask();
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
int baseWindowStyleVars = 0;
|
|
|
|
ImVec2 minBaseWindowRect;
|
|
|
|
|
2024-04-05 18:22:56 +02:00
|
|
|
if (m_surfaceStyle == ImGuiStyle_t::MODERN)
|
2022-08-22 01:10:18 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{ 8.f, 10.f }); baseWindowStyleVars++;
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, m_fadeAlpha); baseWindowStyleVars++;
|
2023-02-04 01:03:18 +01:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
minBaseWindowRect = ImVec2(621.f, 532.f);
|
2022-08-22 01:10:18 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
minBaseWindowRect = m_surfaceStyle == ImGuiStyle_t::LEGACY
|
|
|
|
? ImVec2(619.f, 526.f)
|
|
|
|
: ImVec2(618.f, 524.f);
|
2023-02-04 01:03:18 +01:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{ 6.f, 6.f }); baseWindowStyleVars++;
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, m_fadeAlpha); baseWindowStyleVars++;
|
2022-06-24 12:22:04 +02:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 1.0f); baseWindowStyleVars++;
|
2022-06-24 12:45:47 +02:00
|
|
|
}
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, minBaseWindowRect); baseWindowStyleVars++;
|
2022-06-24 12:45:47 +02:00
|
|
|
|
2024-04-05 18:22:56 +02:00
|
|
|
if (m_activated && m_reclaimFocus) // Reclaim focus on window apparition.
|
2022-10-20 14:23:14 +02:00
|
|
|
{
|
|
|
|
ImGui::SetNextWindowFocus();
|
2024-04-05 18:22:56 +02:00
|
|
|
m_reclaimFocus = false;
|
2022-10-20 14:23:14 +02:00
|
|
|
}
|
|
|
|
|
2022-10-20 14:37:21 +02:00
|
|
|
DrawSurface();
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PopStyleVar(baseWindowStyleVars);
|
2022-06-09 02:22:01 +02:00
|
|
|
}
|
|
|
|
|
2022-08-27 18:57:56 +02:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: runs tasks for the browser while not being drawn
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void CBrowser::RunTask()
|
|
|
|
{
|
|
|
|
static bool bInitialized = false;
|
|
|
|
static CFastTimer timer;
|
|
|
|
|
|
|
|
if (!bInitialized)
|
|
|
|
{
|
|
|
|
timer.Start();
|
|
|
|
bInitialized = true;
|
|
|
|
}
|
|
|
|
|
2024-02-24 02:15:09 +01:00
|
|
|
if (timer.GetDurationInProgress().GetSeconds() > pylon_host_update_interval.GetFloat())
|
2022-08-27 18:57:56 +02:00
|
|
|
{
|
|
|
|
UpdateHostingStatus();
|
|
|
|
timer.Start();
|
|
|
|
}
|
2022-09-14 02:39:55 +02:00
|
|
|
|
2024-04-05 18:22:56 +02:00
|
|
|
if (m_activated)
|
2022-09-14 02:39:55 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
if (m_queryNewListNonRecursive)
|
2022-09-14 02:39:55 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_queryNewListNonRecursive = false;
|
2024-04-05 18:17:12 +02:00
|
|
|
RefreshServerList();
|
2022-09-14 02:39:55 +02:00
|
|
|
}
|
|
|
|
}
|
2024-04-05 18:22:56 +02:00
|
|
|
else // Refresh server list the next time 'm_activated' evaluates to true.
|
2022-09-14 02:39:55 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_reclaimFocusOnTokenField = true;
|
|
|
|
m_queryNewListNonRecursive = true;
|
2022-09-14 02:39:55 +02:00
|
|
|
}
|
2022-08-27 18:57:56 +02:00
|
|
|
}
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
// Purpose: draws the server browser's main surface
|
|
|
|
// Output : true if a frame has been drawn, false otherwise
|
2021-12-25 22:36:38 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
2024-04-05 18:22:56 +02:00
|
|
|
bool CBrowser::DrawSurface(void)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
if (!ImGui::Begin(m_surfaceLabel, &m_activated, ImGuiWindowFlags_NoScrollbar, &ResetInput))
|
|
|
|
{
|
|
|
|
ImGui::End();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::BeginTabBar("CompMenu");
|
2022-06-27 16:54:40 +02:00
|
|
|
if (ImGui::BeginTabItem("Browsing"))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
DrawBrowserPanel();
|
2022-06-27 15:01:39 +02:00
|
|
|
ImGui::EndTabItem();
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2022-03-27 22:17:30 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2022-06-27 16:54:40 +02:00
|
|
|
if (ImGui::BeginTabItem("Hosting"))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
DrawHostPanel();
|
2022-06-27 15:01:39 +02:00
|
|
|
ImGui::EndTabItem();
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2022-03-27 22:17:30 +02:00
|
|
|
#endif // !CLIENT_DLL
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::EndTabBar();
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::End();
|
2024-04-05 18:22:56 +02:00
|
|
|
|
|
|
|
return true;
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: draws the server browser section
|
|
|
|
//-----------------------------------------------------------------------------
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
void CBrowser::DrawBrowserPanel(void)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
|
|
|
ImGui::BeginGroup();
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_serverBrowserTextFilter.Draw();
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::SameLine();
|
2022-10-20 14:23:14 +02:00
|
|
|
|
2023-01-28 14:20:57 +01:00
|
|
|
if (ImGui::Button("Refresh"))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_serverListMessage.clear();
|
2024-04-05 18:17:12 +02:00
|
|
|
RefreshServerList();
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2022-10-20 14:23:14 +02:00
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::EndGroup();
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::TextColored(ImVec4(1.00f, 0.00f, 0.00f, 1.00f), "%s", m_serverListMessage.c_str());
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::Separator();
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
int windowStyleVars = 0; // Eliminate borders around server list table.
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{ 1.f, 0.f }); windowStyleVars++;
|
2023-01-30 01:18:51 +01:00
|
|
|
|
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-07-01 02:20:47 +02:00
|
|
|
if (ImGui::BeginTable("##ServerBrowser_ServerListTable", 6, ImGuiTableFlags_Resizable))
|
2022-06-09 02:22:01 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
int frameStyleVars = 0;
|
2024-04-05 18:22:56 +02:00
|
|
|
if (m_surfaceStyle == ImGuiStyle_t::MODERN)
|
2022-07-01 02:20:47 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2{ 8.f, 0.f }); frameStyleVars++;
|
2022-07-01 02:20:47 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2{ 4.f, 0.f }); frameStyleVars++;
|
2022-07-01 02:20:47 +02:00
|
|
|
}
|
2022-01-28 12:56:51 +01:00
|
|
|
|
2022-01-22 15:51:09 +01:00
|
|
|
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthStretch, 25);
|
|
|
|
ImGui::TableSetupColumn("Map", ImGuiTableColumnFlags_WidthStretch, 20);
|
|
|
|
ImGui::TableSetupColumn("Playlist", ImGuiTableColumnFlags_WidthStretch, 10);
|
2022-06-27 16:54:40 +02:00
|
|
|
ImGui::TableSetupColumn("Players", ImGuiTableColumnFlags_WidthStretch, 5);
|
|
|
|
ImGui::TableSetupColumn("Port", ImGuiTableColumnFlags_WidthStretch, 5);
|
2022-07-01 02:20:47 +02:00
|
|
|
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch, 5);
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::TableHeadersRow();
|
|
|
|
|
2024-01-21 21:29:23 +01:00
|
|
|
g_ServerListManager.m_Mutex.lock();
|
2024-03-03 14:40:57 +01:00
|
|
|
vector<const NetGameServer_t*> filteredServers;
|
2023-10-15 10:47:19 +02:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
// Filter the server list first before running it over the ImGui list
|
|
|
|
// clipper, if we do this within the clipper, clipper.Step() will fail
|
|
|
|
// as the calculation for the remainder will be off.
|
|
|
|
for (int i = 0; i < g_ServerListManager.m_vServerList.size(); i++)
|
|
|
|
{
|
|
|
|
const NetGameServer_t& server = g_ServerListManager.m_vServerList[i];
|
|
|
|
|
|
|
|
const char* pszHostName = server.name.c_str();
|
|
|
|
const char* pszHostMap = server.map.c_str();
|
|
|
|
const char* pszPlaylist = server.playlist.c_str();
|
|
|
|
|
|
|
|
if (m_serverBrowserTextFilter.PassFilter(pszHostName)
|
|
|
|
|| m_serverBrowserTextFilter.PassFilter(pszHostMap)
|
|
|
|
|| m_serverBrowserTextFilter.PassFilter(pszPlaylist))
|
|
|
|
{
|
|
|
|
filteredServers.push_back(&server);
|
|
|
|
}
|
|
|
|
}
|
2024-03-02 01:45:41 +01:00
|
|
|
|
|
|
|
ImGuiListClipper clipper;
|
2024-03-03 14:40:57 +01:00
|
|
|
clipper.Begin(static_cast<int>(filteredServers.size()));
|
2022-03-04 12:22:17 +01:00
|
|
|
|
2024-03-02 01:45:41 +01:00
|
|
|
while (clipper.Step())
|
|
|
|
{
|
|
|
|
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-03-03 14:40:57 +01:00
|
|
|
const NetGameServer_t* const server = filteredServers[i];
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
const char* pszHostName = server->name.c_str();
|
|
|
|
const char* pszHostMap = server->map.c_str();
|
|
|
|
const char* pszPlaylist = server->playlist.c_str();
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-03-02 01:45:41 +01:00
|
|
|
char pszHostPort[32];
|
2024-03-03 14:40:57 +01:00
|
|
|
sprintf(pszHostPort, "%d", server->port);
|
2022-06-27 16:54:40 +02:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("%s", pszHostName);
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("%s", pszHostMap);
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("%s", pszPlaylist);
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("%s", Format("%3d/%3d", server->numPlayers, server->maxPlayers).c_str());
|
2024-03-02 01:45:41 +01:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("%s", pszHostPort);
|
2024-03-02 01:45:41 +01:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
ImGui::TableNextColumn();
|
|
|
|
string svConnectBtn = "Connect##";
|
|
|
|
svConnectBtn.append(server->name + server->address + server->map);
|
2024-03-02 01:45:41 +01:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
if (ImGui::Button(svConnectBtn.c_str()))
|
|
|
|
{
|
|
|
|
g_ServerListManager.ConnectToServer(server->address, server->port, server->netKey);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-03-02 01:45:41 +01:00
|
|
|
|
2024-03-03 14:40:57 +01:00
|
|
|
filteredServers.clear();
|
2024-01-21 21:29:23 +01:00
|
|
|
g_ServerListManager.m_Mutex.unlock();
|
2022-08-27 18:57:56 +02:00
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::EndTable();
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PopStyleVar(frameStyleVars);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2022-07-01 02:20:47 +02:00
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::EndChild();
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PopStyleVar(windowStyleVars);
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
ImGui::Separator();
|
2024-02-25 01:47:46 +01:00
|
|
|
|
2024-02-29 16:02:18 +01:00
|
|
|
const ImVec2 regionAvail = ImGui::GetContentRegionAvail();
|
|
|
|
const ImGuiStyle& style = ImGui::GetStyle();
|
|
|
|
|
|
|
|
// 4 elements means 3 spacings between items, this has to be subtracted
|
|
|
|
// from the remaining available region to get correct results on all
|
|
|
|
// window padding values!!!
|
|
|
|
const float itemWidth = (regionAvail.x - (3 * style.ItemSpacing.x)) / 4;
|
|
|
|
|
|
|
|
ImGui::PushItemWidth(itemWidth);
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::InputTextWithHint("##ServerBrowser_ServerCon", "Server address and port", m_serverAddressTextBuf, IM_ARRAYSIZE(m_serverAddressTextBuf));
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::InputTextWithHint("##ServerBrowser_ServerKey", "Encryption key", m_serverNetKeyTextBuf, IM_ARRAYSIZE(m_serverNetKeyTextBuf));
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
ImGui::SameLine();
|
2024-02-29 16:02:18 +01:00
|
|
|
if (ImGui::Button("Connect", ImVec2(itemWidth, ImGui::GetFrameHeight())))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
if (m_serverAddressTextBuf[0])
|
2023-04-30 02:08:40 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
g_ServerListManager.ConnectToServer(m_serverAddressTextBuf, m_serverNetKeyTextBuf);
|
2023-04-30 02:08:40 +02:00
|
|
|
}
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
2024-03-02 01:47:11 +01:00
|
|
|
|
|
|
|
// NOTE: -9 to prevent the last button from clipping/colliding with the
|
|
|
|
// window drag handle! -9 makes the distance between the handle and the
|
|
|
|
// last button equal as that of the developer console.
|
|
|
|
if (ImGui::Button("Private servers", ImVec2(itemWidth - 9, ImGui::GetFrameHeight())))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-08-31 15:45:12 +02:00
|
|
|
ImGui::OpenPopup("Private Server");
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2024-02-29 16:02:18 +01:00
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
HiddenServersModal();
|
|
|
|
}
|
2024-02-29 16:02:18 +01:00
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::PopItemWidth();
|
|
|
|
}
|
|
|
|
|
2022-01-12 02:53:07 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: refreshes the server browser list with available servers
|
|
|
|
//-----------------------------------------------------------------------------
|
2022-05-27 02:44:36 +02:00
|
|
|
void CBrowser::RefreshServerList(void)
|
2022-01-12 02:53:07 +01:00
|
|
|
{
|
2024-02-24 02:15:09 +01:00
|
|
|
Msg(eDLL_T::CLIENT, "Refreshing server list with matchmaking host '%s'\n", pylon_matchmaking_hostname.GetString());
|
2023-07-22 21:14:04 +02:00
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
// Thread the request, and let the main thread assign status message back
|
|
|
|
std::thread request([&]
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
std::string serverListMessage;
|
|
|
|
g_ServerListManager.RefreshServerList(serverListMessage);
|
2022-01-12 02:53:07 +01:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
g_TaskQueue.Dispatch([&, serverListMessage]
|
2024-04-05 18:17:12 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
SetServerListMessage(serverListMessage.c_str());
|
2024-04-05 18:17:12 +02:00
|
|
|
}, 0);
|
|
|
|
}
|
|
|
|
);
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
request.detach();
|
2022-01-12 02:53:07 +01:00
|
|
|
}
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: draws the hidden private server modal
|
|
|
|
//-----------------------------------------------------------------------------
|
2022-05-27 02:44:36 +02:00
|
|
|
void CBrowser::HiddenServersModal(void)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
float modalWindowHeight; // Set the padding accordingly for each theme.
|
2024-04-05 18:22:56 +02:00
|
|
|
switch (m_surfaceStyle)
|
2023-01-30 01:18:51 +01:00
|
|
|
{
|
|
|
|
case ImGuiStyle_t::LEGACY:
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
modalWindowHeight = 207.f;
|
2023-01-30 01:18:51 +01:00
|
|
|
break;
|
|
|
|
case ImGuiStyle_t::MODERN:
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
modalWindowHeight = 214.f;
|
2023-01-30 01:18:51 +01:00
|
|
|
break;
|
|
|
|
default:
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
modalWindowHeight = 206.f;
|
2023-01-30 01:18:51 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
int modalStyleVars = 0;
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(408.f, modalWindowHeight)); modalStyleVars++;
|
2023-01-30 01:18:51 +01:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
bool isModalStillOpen = true;
|
|
|
|
if (ImGui::BeginPopupModal("Private Server", &isModalStillOpen, ImGuiWindowFlags_NoResize))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::SetWindowSize(ImVec2(408.f, modalWindowHeight), ImGuiCond_Always);
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.00f, 0.00f, 0.00f, 0.00f)); // Override the style color for child bg.
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::BeginChild("##HiddenServersConnectModal_IconParent", ImVec2(float(m_lockedIconDataResource.m_nWidth), float(m_lockedIconDataResource.m_nHeight)));
|
|
|
|
ImGui::Image(m_lockedIconShaderResource, ImVec2(float(m_lockedIconDataResource.m_nWidth), float(m_lockedIconDataResource.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();
|
2022-08-29 14:00:54 +02:00
|
|
|
ImGui::Text("Enter token to connect");
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
const ImVec2 contentRegionMax = ImGui::GetContentRegionAvail();
|
|
|
|
ImGui::PushItemWidth(contentRegionMax.x); // Override item width.
|
2024-04-05 18:17:12 +02:00
|
|
|
|
|
|
|
string hiddenServerToken;
|
|
|
|
ImGui::InputTextWithHint("##HiddenServersConnectModal_TokenInput", "Token (required)", &hiddenServerToken);
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::PopItemWidth();
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
if (m_reclaimFocusOnTokenField)
|
2023-02-04 20:04:23 +01:00
|
|
|
{
|
|
|
|
ImGui::SetKeyboardFocusHere(-1); // -1 means previous widget.
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_reclaimFocusOnTokenField = false;
|
2023-02-04 20:04:23 +01:00
|
|
|
}
|
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
ImGui::Dummy(ImVec2(contentRegionMax.x, 19.f)); // Place a dummy, basically making space inserting a blank element.
|
2021-12-25 22:36:38 +01:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::TextColored(m_hiddenServerMessageColor, "%s", m_hiddenServerRequestMessage.c_str());
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::Separator();
|
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("Connect", ImVec2(contentRegionMax.x, 24)))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hiddenServerRequestMessage.clear();
|
|
|
|
m_reclaimFocusOnTokenField = true;
|
2023-02-04 20:04:23 +01:00
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
if (!hiddenServerToken.empty())
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-08-31 17:23:23 +02:00
|
|
|
NetGameServer_t server;
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
const bool result = g_MasterServer.GetServerByToken(server, m_hiddenServerRequestMessage, hiddenServerToken); // Send token connect request.
|
2022-08-31 17:23:23 +02:00
|
|
|
|
2024-01-24 23:40:58 +01:00
|
|
|
if (result && !server.name.empty())
|
2022-08-31 17:23:23 +02:00
|
|
|
{
|
2024-01-24 23:40:58 +01:00
|
|
|
g_ServerListManager.ConnectToServer(server.address, server.port, server.netKey); // Connect to the server
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hiddenServerRequestMessage = Format("Found server: %s", server.name.c_str());
|
|
|
|
m_hiddenServerMessageColor = ImVec4(0.00f, 1.00f, 0.00f, 1.00f);
|
2022-08-31 17:23:23 +02:00
|
|
|
ImGui::CloseCurrentPopup();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
if (m_hiddenServerRequestMessage.empty())
|
2023-04-02 17:14:29 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hiddenServerRequestMessage = "Unknown error.";
|
2023-04-02 17:14:29 +02:00
|
|
|
}
|
|
|
|
else // Display error message.
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hiddenServerRequestMessage = Format("Error: %s", m_hiddenServerRequestMessage.c_str());
|
2023-04-02 17:14:29 +02:00
|
|
|
}
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hiddenServerMessageColor = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
2022-08-31 17:23:23 +02:00
|
|
|
}
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hiddenServerRequestMessage = "Token is required.";
|
|
|
|
m_hiddenServerMessageColor = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
}
|
2024-04-05 18:17:12 +02:00
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("Close", ImVec2(contentRegionMax.x, 24)))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hiddenServerRequestMessage.clear();
|
|
|
|
m_reclaimFocusOnTokenField = true;
|
2023-02-04 20:04:23 +01:00
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::CloseCurrentPopup();
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndPopup();
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PopStyleVar(modalStyleVars);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
else if (!isModalStillOpen)
|
2022-08-31 21:49:28 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hiddenServerRequestMessage.clear();
|
|
|
|
m_reclaimFocusOnTokenField = true;
|
2023-02-04 20:04:23 +01:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PopStyleVar(modalStyleVars);
|
2023-01-30 01:18:51 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::PopStyleVar(modalStyleVars);
|
2022-08-31 21:49:28 +02:00
|
|
|
}
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: draws the host section
|
|
|
|
//-----------------------------------------------------------------------------
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
void CBrowser::DrawHostPanel(void)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-03-27 22:17:30 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2024-01-21 21:29:23 +01:00
|
|
|
std::lock_guard<std::mutex> l(g_ServerListManager.m_Mutex);
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-01-24 23:40:58 +01:00
|
|
|
ImGui::InputTextWithHint("##ServerHost_ServerName", "Server name (required)", &g_ServerListManager.m_Server.name);
|
|
|
|
ImGui::InputTextWithHint("##ServerHost_ServerDesc", "Server description (optional)", &g_ServerListManager.m_Server.description);
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::Spacing();
|
|
|
|
|
2024-01-24 23:40:58 +01:00
|
|
|
if (ImGui::BeginCombo("Mode", g_ServerListManager.m_Server.playlist.c_str()))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-08-29 11:55:58 +02:00
|
|
|
g_PlaylistsVecMutex.lock();
|
2022-08-31 02:16:40 +02:00
|
|
|
for (const string& svPlaylist : g_vAllPlaylists)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-01-24 23:40:58 +01:00
|
|
|
if (ImGui::Selectable(svPlaylist.c_str(), svPlaylist == g_ServerListManager.m_Server.playlist))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-01-24 23:40:58 +01:00
|
|
|
g_ServerListManager.m_Server.playlist = svPlaylist;
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
}
|
2022-08-29 11:55:58 +02:00
|
|
|
|
|
|
|
g_PlaylistsVecMutex.unlock();
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::EndCombo();
|
|
|
|
}
|
|
|
|
|
2024-01-24 23:40:58 +01:00
|
|
|
if (ImGui::BeginCombo("Map", g_ServerListManager.m_Server.map.c_str()))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2023-03-31 00:35:01 +02:00
|
|
|
g_InstalledMapsMutex.lock();
|
2023-09-05 17:34:22 +02:00
|
|
|
|
|
|
|
FOR_EACH_VEC(g_InstalledMaps, i)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2023-09-05 17:34:22 +02:00
|
|
|
const CUtlString& mapName = g_InstalledMaps[i];
|
|
|
|
|
|
|
|
if (ImGui::Selectable(mapName.String(),
|
2024-01-24 23:40:58 +01:00
|
|
|
mapName.IsEqual_CaseInsensitive(g_ServerListManager.m_Server.map.c_str())))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-01-24 23:40:58 +01:00
|
|
|
g_ServerListManager.m_Server.map = mapName.String();
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
}
|
2022-08-29 11:55:58 +02:00
|
|
|
|
2023-03-31 00:35:01 +02:00
|
|
|
g_InstalledMapsMutex.unlock();
|
2021-12-25 22:36:38 +01:00
|
|
|
ImGui::EndCombo();
|
|
|
|
}
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_queryGlobalBanList = sv_globalBanlist.GetBool(); // Sync toggle with 'sv_globalBanlist'.
|
|
|
|
if (ImGui::Checkbox("Load global banned list", &m_queryGlobalBanList))
|
2023-01-26 21:20:11 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
sv_globalBanlist.SetValue(m_queryGlobalBanList);
|
2023-01-26 21:20:11 +01:00
|
|
|
}
|
|
|
|
|
2023-01-28 14:20:57 +01:00
|
|
|
ImGui::Text("Server visibility");
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-01-21 21:29:23 +01:00
|
|
|
if (ImGui::SameLine(); ImGui::RadioButton("offline", g_ServerListManager.m_ServerVisibility == EServerVisibility_t::OFFLINE))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-01-21 21:29:23 +01:00
|
|
|
g_ServerListManager.m_ServerVisibility = EServerVisibility_t::OFFLINE;
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2024-01-21 21:29:23 +01:00
|
|
|
if (ImGui::SameLine(); ImGui::RadioButton("hidden", g_ServerListManager.m_ServerVisibility == EServerVisibility_t::HIDDEN))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-01-21 21:29:23 +01:00
|
|
|
g_ServerListManager.m_ServerVisibility = EServerVisibility_t::HIDDEN;
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2024-01-21 21:29:23 +01:00
|
|
|
if (ImGui::SameLine(); ImGui::RadioButton("public", g_ServerListManager.m_ServerVisibility == EServerVisibility_t::PUBLIC))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-01-21 21:29:23 +01:00
|
|
|
g_ServerListManager.m_ServerVisibility = EServerVisibility_t::PUBLIC;
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::TextColored(m_hostMessageColor, "%s", m_hostMessage.c_str());
|
|
|
|
if (!m_hostToken.empty())
|
2022-09-07 01:12:22 +02:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ImGui::InputText("##ServerHost_HostToken", &m_hostToken, ImGuiInputTextFlags_ReadOnly);
|
2022-09-07 01:12:22 +02:00
|
|
|
}
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-09-07 01:12:22 +02:00
|
|
|
ImGui::Spacing();
|
2023-07-19 02:21:58 +02:00
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
const ImVec2 contentRegionMax = ImGui::GetContentRegionAvail();
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
const bool serverActive = g_pServer->IsActive();
|
2023-07-19 02:21:58 +02:00
|
|
|
|
2022-11-26 17:04:12 +01:00
|
|
|
if (!g_pHostState->m_bActiveGame)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("Start server", ImVec2(contentRegionMax.x, 32)))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostMessage.clear();
|
|
|
|
|
|
|
|
const bool enforceField = g_ServerListManager.m_ServerVisibility == EServerVisibility_t::OFFLINE
|
|
|
|
? true
|
|
|
|
: !g_ServerListManager.m_Server.name.empty();
|
2022-09-07 01:12:22 +02:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
if (enforceField && !g_ServerListManager.m_Server.playlist.empty() && !g_ServerListManager.m_Server.map.empty())
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
g_ServerListManager.LaunchServer(serverActive); // Launch server.
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-01-24 23:40:58 +01:00
|
|
|
if (g_ServerListManager.m_Server.name.empty())
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostMessage = "Server name is required.";
|
|
|
|
m_hostMessageColor = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2024-01-24 23:40:58 +01:00
|
|
|
else if (g_ServerListManager.m_Server.playlist.empty())
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostMessage = "Playlist is required.";
|
|
|
|
m_hostMessageColor = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2024-01-24 23:40:58 +01:00
|
|
|
else if (g_ServerListManager.m_Server.map.empty())
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostMessage = "Level name is required.";
|
|
|
|
m_hostMessageColor = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("Reload playlist", ImVec2(contentRegionMax.x, 32)))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-04-05 18:17:12 +02:00
|
|
|
v_Playlists_Download_f();
|
|
|
|
Playlists_SDKInit(); // Re-Init playlist.
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2022-09-07 01:12:22 +02:00
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("Reload banlist", ImVec2(contentRegionMax.x, 32)))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-04-05 18:17:12 +02:00
|
|
|
g_BanSystem.LoadList();
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
}
|
2022-09-07 01:12:22 +02:00
|
|
|
else
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("Stop server", ImVec2(contentRegionMax.x, 32)))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-09-07 01:12:22 +02:00
|
|
|
ProcessCommand("LeaveMatch"); // TODO: use script callback instead.
|
2024-04-05 18:17:12 +02:00
|
|
|
g_pHostState->m_iNextState = HostStates_t::HS_GAME_SHUTDOWN;
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("Change level", ImVec2(contentRegionMax.x, 32)))
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-01-24 23:40:58 +01:00
|
|
|
if (!g_ServerListManager.m_Server.map.empty())
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
g_ServerListManager.LaunchServer(serverActive);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostMessage = "Failed to change level: 'levelname' was empty.";
|
|
|
|
m_hostMessageColor = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
if (serverActive)
|
2022-11-14 01:04:01 +01:00
|
|
|
{
|
2022-11-26 17:04:12 +01:00
|
|
|
ImGui::Spacing();
|
|
|
|
ImGui::Separator();
|
|
|
|
ImGui::Spacing();
|
2022-11-14 01:04:01 +01:00
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("AI network rebuild", ImVec2(contentRegionMax.x, 32)))
|
2022-11-26 17:04:12 +01:00
|
|
|
{
|
|
|
|
ProcessCommand("BuildAINFile");
|
|
|
|
}
|
2022-11-14 01:04:01 +01:00
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("NavMesh hot swap", ImVec2(contentRegionMax.x, 32)))
|
2022-11-26 17:04:12 +01:00
|
|
|
{
|
|
|
|
ProcessCommand("navmesh_hotswap");
|
|
|
|
}
|
2022-11-14 01:04:01 +01:00
|
|
|
|
2022-11-26 17:04:12 +01:00
|
|
|
ImGui::Spacing();
|
|
|
|
ImGui::Separator();
|
|
|
|
ImGui::Spacing();
|
2022-11-23 12:30:15 +01:00
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("AI settings reparse", ImVec2(contentRegionMax.x, 32)))
|
2022-11-23 12:30:15 +01:00
|
|
|
{
|
2023-08-21 19:12:29 +02:00
|
|
|
Msg(eDLL_T::ENGINE, "Reparsing AI data on %s\n", g_pClientState->IsActive() ? "server and client" : "server");
|
2022-11-26 17:04:12 +01:00
|
|
|
ProcessCommand("aisettings_reparse");
|
|
|
|
|
|
|
|
if (g_pClientState->IsActive())
|
|
|
|
{
|
|
|
|
ProcessCommand("aisettings_reparse_client");
|
|
|
|
}
|
2022-11-23 12:30:15 +01:00
|
|
|
}
|
2022-11-14 01:04:01 +01:00
|
|
|
|
2024-02-25 01:47:46 +01:00
|
|
|
if (ImGui::Button("Weapon settings reparse", ImVec2(contentRegionMax.x, 32)))
|
2022-11-26 17:04:12 +01:00
|
|
|
{
|
2023-08-21 19:12:29 +02:00
|
|
|
Msg(eDLL_T::ENGINE, "Reparsing weapon data on %s\n", g_pClientState->IsActive() ? "server and client" : "server");
|
2022-11-26 17:04:12 +01:00
|
|
|
ProcessCommand("weapon_reparse");
|
|
|
|
}
|
2022-09-01 01:20:27 +02:00
|
|
|
}
|
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-09-09 19:47:31 +02:00
|
|
|
// Purpose: updates the host status
|
2021-12-25 22:36:38 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
2022-05-27 02:44:36 +02:00
|
|
|
void CBrowser::UpdateHostingStatus(void)
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-03-27 22:17:30 +02:00
|
|
|
#ifndef CLIENT_DLL
|
2022-10-21 21:28:51 +02:00
|
|
|
assert(g_pHostState && g_pCVar);
|
2021-12-26 02:30:20 +01:00
|
|
|
|
2024-01-21 21:29:23 +01:00
|
|
|
std::lock_guard<std::mutex> l(g_ServerListManager.m_Mutex);
|
|
|
|
g_ServerListManager.m_HostingStatus = g_pServer->IsActive() ? EHostStatus_t::HOSTING : EHostStatus_t::NOT_HOSTING; // Are we hosting a server?
|
2022-08-27 18:57:56 +02:00
|
|
|
|
2024-01-21 21:29:23 +01:00
|
|
|
switch (g_ServerListManager.m_HostingStatus)
|
2022-01-12 02:53:07 +01:00
|
|
|
{
|
2022-08-14 15:45:08 +02:00
|
|
|
case EHostStatus_t::NOT_HOSTING:
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
if (!m_hostToken.empty())
|
2023-02-12 11:22:18 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostToken.clear();
|
2023-02-12 11:22:18 +01:00
|
|
|
}
|
2022-09-07 01:12:22 +02:00
|
|
|
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
if (ImGui::ColorConvertFloat4ToU32(m_hostMessageColor) == // Only clear if this is green (a valid hosting message).
|
2022-09-07 01:12:22 +02:00
|
|
|
ImGui::ColorConvertFloat4ToU32(ImVec4(0.00f, 1.00f, 0.00f, 1.00f)))
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostMessage.clear();
|
|
|
|
m_hostMessageColor = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
2022-09-07 01:12:22 +02:00
|
|
|
}
|
|
|
|
|
2022-01-12 02:53:07 +01:00
|
|
|
break;
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2022-08-14 15:45:08 +02:00
|
|
|
case EHostStatus_t::HOSTING:
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2024-01-21 21:29:23 +01:00
|
|
|
if (g_ServerListManager.m_ServerVisibility == EServerVisibility_t::OFFLINE)
|
2022-01-12 02:53:07 +01:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2023-02-12 11:22:18 +01:00
|
|
|
if (*g_nServerRemoteChecksum == 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
|
|
|
}
|
|
|
|
|
2024-01-21 21:29:23 +01:00
|
|
|
switch (g_ServerListManager.m_ServerVisibility)
|
2022-01-12 02:53:07 +01:00
|
|
|
{
|
|
|
|
|
2022-08-14 15:45:08 +02:00
|
|
|
case EServerVisibility_t::HIDDEN:
|
2024-01-24 23:40:58 +01:00
|
|
|
g_ServerListManager.m_Server.hidden = true;
|
2021-12-25 22:36:38 +01:00
|
|
|
break;
|
2022-08-14 15:45:08 +02:00
|
|
|
case EServerVisibility_t::PUBLIC:
|
2024-01-24 23:40:58 +01:00
|
|
|
g_ServerListManager.m_Server.hidden = false;
|
2021-12-25 22:36:38 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2022-01-12 02:53:07 +01:00
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
NetGameServer_t netGameServer
|
2022-03-04 12:22:17 +01:00
|
|
|
{
|
2024-04-05 18:17:12 +02:00
|
|
|
g_ServerListManager.m_Server.name,
|
|
|
|
g_ServerListManager.m_Server.description,
|
|
|
|
g_ServerListManager.m_Server.hidden,
|
|
|
|
g_pHostState->m_levelName,
|
|
|
|
v_Playlists_GetCurrent(),
|
|
|
|
hostip->GetString(),
|
|
|
|
hostport->GetInt(),
|
|
|
|
g_pNetKey->GetBase64NetKey(),
|
|
|
|
*g_nServerRemoteChecksum,
|
|
|
|
SDK_VERSION,
|
|
|
|
g_pServer->GetNumClients(),
|
|
|
|
g_ServerGlobalVariables->m_nMaxClients,
|
|
|
|
std::chrono::duration_cast<std::chrono::milliseconds>(
|
|
|
|
std::chrono::system_clock::now().time_since_epoch()
|
|
|
|
).count()
|
|
|
|
};
|
|
|
|
|
|
|
|
SendHostingPostRequest(netGameServer);
|
2022-08-27 18:57:56 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif // !CLIENT_DLL
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2024-04-05 18:17:12 +02:00
|
|
|
// Purpose: sends the hosting POST request to the comp server and installs the
|
|
|
|
// host data on the server browser
|
2022-08-27 18:57:56 +02:00
|
|
|
// Input : &gameServer -
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void CBrowser::SendHostingPostRequest(const NetGameServer_t& gameServer)
|
|
|
|
{
|
|
|
|
#ifndef CLIENT_DLL
|
2024-04-05 18:17:12 +02:00
|
|
|
std::thread request([&, gameServer]
|
|
|
|
{
|
|
|
|
string hostRequestMessage;
|
|
|
|
string hostToken;
|
|
|
|
string hostIp;
|
2023-10-15 10:40:46 +02:00
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
const bool result = g_MasterServer.PostServerHost(hostRequestMessage, hostToken, hostIp, gameServer);
|
2022-08-27 18:57:56 +02:00
|
|
|
|
2024-02-28 00:43:57 +01:00
|
|
|
g_TaskQueue.Dispatch([&, result, hostRequestMessage, hostToken, hostIp]
|
2024-04-05 18:17:12 +02:00
|
|
|
{
|
|
|
|
InstallHostingDetails(result, hostRequestMessage.c_str(), hostToken.c_str(), hostIp);
|
|
|
|
}, 0);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
request.detach();
|
|
|
|
#endif // !CLIENT_DLL
|
|
|
|
}
|
2022-08-27 18:57:56 +02:00
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: installs the host data on the server browser
|
|
|
|
// Input : postFailed -
|
|
|
|
// *hostMessage -
|
|
|
|
// *hostToken -
|
|
|
|
// &hostIp -
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void CBrowser::InstallHostingDetails(const bool postFailed, const char* const hostMessage, const char* const hostToken, const string& hostIp)
|
|
|
|
{
|
|
|
|
#ifndef CLIENT_DLL
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostMessage = hostMessage;
|
|
|
|
m_hostToken = hostToken;
|
2022-01-12 02:53:07 +01:00
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
if (!hostIp.empty())
|
2024-01-21 23:06:26 +01:00
|
|
|
{
|
2024-04-05 18:17:12 +02:00
|
|
|
g_MasterServer.SetHostIP(hostIp);
|
2024-01-21 23:06:26 +01:00
|
|
|
}
|
2023-10-15 10:40:46 +02:00
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
if (postFailed)
|
2022-01-12 02:53:07 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostMessageColor = ImVec4(0.00f, 1.00f, 0.00f, 1.00f);
|
2022-05-27 02:39:08 +02:00
|
|
|
stringstream ssMessage;
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ssMessage << "Broadcasting";
|
|
|
|
if (!m_hostToken.empty())
|
2022-01-12 02:53:07 +01:00
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
ssMessage << ": share the following token for clients to connect: ";
|
2022-01-12 02:53:07 +01:00
|
|
|
}
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
|
|
|
|
m_hostMessage = ssMessage.str();
|
2022-01-12 02:53:07 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
ImGui: console and browser code style refactor
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some.
Console:
* Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed
* CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue.
* Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach.
* Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads.
Browser:
* Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render.
* Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server).
Both:
* Added virtual Shutdown() method.
2024-03-01 13:39:06 +01:00
|
|
|
m_hostMessageColor = 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
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2024-04-05 18:17:12 +02:00
|
|
|
// Purpose: processes submitted commands
|
2022-08-09 02:35:00 +02:00
|
|
|
// Input : *pszCommand -
|
2021-12-25 22:36:38 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
2022-08-14 15:45:08 +02:00
|
|
|
void CBrowser::ProcessCommand(const char* pszCommand) const
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2022-08-09 02:35:00 +02:00
|
|
|
Cbuf_AddText(Cbuf_GetCurrentPlayer(), pszCommand, cmd_source_t::kCommandSrcCode);
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
|
|
|
|
2024-02-23 00:12:06 +01:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: toggles the server browser
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void CBrowser::ToggleBrowser_f()
|
|
|
|
{
|
2024-04-05 18:22:56 +02:00
|
|
|
g_Browser.m_activated ^= true;
|
2024-02-23 00:12:06 +01:00
|
|
|
ResetInput(); // Disable input to game when browser is drawn.
|
|
|
|
}
|
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
CBrowser g_Browser;
|