2021-12-25 22:36:38 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef DEDICATED
|
2022-04-26 20:24:51 +02:00
|
|
|
#include "common/sdkdefs.h"
|
|
|
|
#include "windows/resource.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"
|
2023-03-29 00:19:19 +02:00
|
|
|
#include "thirdparty/imgui/misc/imgui_utility.h"
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2024-04-05 18:22:56 +02:00
|
|
|
#include "imgui_surface.h"
|
|
|
|
|
|
|
|
class CBrowser : public CImguiSurface
|
2022-01-15 17:57:18 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-05-27 02:44:36 +02:00
|
|
|
CBrowser(void);
|
2022-08-14 15:43:49 +02:00
|
|
|
virtual ~CBrowser(void);
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-08-14 15:43:49 +02:00
|
|
|
virtual bool Init(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
|
|
|
virtual void Shutdown(void);
|
2022-06-09 02:22:01 +02:00
|
|
|
|
2022-08-14 15:43:49 +02:00
|
|
|
virtual void RunFrame(void);
|
2024-04-05 18:22:56 +02:00
|
|
|
void RunTask(void);
|
2022-08-20 01:48:42 +02:00
|
|
|
|
2024-04-05 18:22:56 +02:00
|
|
|
virtual bool DrawSurface(void);
|
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
|
|
|
void DrawBrowserPanel(void);
|
2022-03-04 12:22:17 +01:00
|
|
|
void RefreshServerList(void);
|
2022-01-12 02:53:07 +01:00
|
|
|
|
2022-03-04 12:22:17 +01:00
|
|
|
void HiddenServersModal(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
|
|
|
void DrawHostPanel(void);
|
2022-01-12 02:53:07 +01:00
|
|
|
|
2022-03-04 12:22:17 +01:00
|
|
|
void UpdateHostingStatus(void);
|
2024-04-05 18:17:12 +02:00
|
|
|
void InstallHostingDetails(const bool postFailed, const char* const hostMessage, const char* const hostToken, const string& hostIp);
|
2022-08-27 18:57:56 +02:00
|
|
|
void SendHostingPostRequest(const NetGameServer_t& gameServer);
|
2022-01-12 02:53:07 +01:00
|
|
|
|
2022-08-14 15:43:49 +02:00
|
|
|
void ProcessCommand(const char* pszCommand) const;
|
2022-01-12 02:53:07 +01:00
|
|
|
|
2024-02-23 00:12:06 +01:00
|
|
|
public:
|
|
|
|
// Command callbacks
|
|
|
|
static void ToggleBrowser_f();
|
|
|
|
|
2024-04-05 18:17:12 +02:00
|
|
|
private:
|
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
|
|
|
inline void SetServerListMessage(const char* const message) { m_serverListMessage = message; };
|
|
|
|
inline void SetHostMessage(const char* const message) { m_hostMessage = message; }
|
|
|
|
inline void SetHostToken(const char* const message) { m_hostToken = message; }
|
2024-04-05 18:17:12 +02:00
|
|
|
|
2022-08-14 15:43:49 +02:00
|
|
|
private:
|
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 m_reclaimFocusOnTokenField;
|
|
|
|
bool m_queryNewListNonRecursive; // When set, refreshes the server list once the next frame.
|
|
|
|
bool m_queryGlobalBanList;
|
2024-04-17 21:18:51 +02:00
|
|
|
char m_serverTokenTextBuf[128];
|
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
|
|
|
char m_serverAddressTextBuf[128];
|
2024-04-17 21:22:13 +02:00
|
|
|
char m_serverNetKeyTextBuf[45];
|
2022-10-21 21:28:51 +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
|
|
|
ID3D11ShaderResourceView* m_lockedIconShaderResource;
|
|
|
|
MODULERESOURCE m_lockedIconDataResource;
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
////////////////////
|
2022-08-14 15:43:49 +02:00
|
|
|
// Server List //
|
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
|
|
|
ImGuiTextFilter m_serverBrowserTextFilter;
|
|
|
|
string m_serverListMessage;
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
////////////////////
|
|
|
|
// Host 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
|
|
|
string m_hostMessage;
|
|
|
|
string m_hostToken;
|
|
|
|
ImVec4 m_hostMessageColor;
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
////////////////////
|
|
|
|
// Private 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
|
|
|
string m_hiddenServerRequestMessage;
|
|
|
|
ImVec4 m_hiddenServerMessageColor;
|
2021-12-25 22:36:38 +01:00
|
|
|
};
|
|
|
|
|
2024-01-21 21:29:23 +01:00
|
|
|
extern CBrowser g_Browser;
|
2022-01-15 15:25:19 +01:00
|
|
|
#endif
|