109 Commits

Author SHA1 Message Date
Kawe Mazidjatari
a63d66b667 /W4: Fix unreferenced symbol bugs
Return value of 'g_pMasterServer->GetServerByToken' was never checked. Added check to improve the error messages that could be displayed.
2023-04-02 17:14:29 +02:00
Kawe Mazidjatari
4357c9dbf3 Fix many compiler warnings
Fix many compiler warnings indicating potentially unwanted implicit conversions/truncations.
2023-04-02 00:59:24 +02:00
Kawe Mazidjatari
29616f4810 Rename 'g_vAllMaps' to 'g_InstalledMaps' 2023-03-31 00:35:01 +02:00
Kawe Mazidjatari
612ab83b20 Use 'GetNumClients' for hosting and status bar
Use 'GetNumClients' instead of iterating over the client array twice. Also fixed a bug causing the status bar only to display real clients, buts were never counted.
2023-02-12 15:21:33 +01:00
Kawe Mazidjatari
3139948141 Rename mutex guard lock
Already one named 'l' in this scope. It will work just fine, but having a different name is better.
2023-02-12 11:24:34 +01:00
Kawe Mazidjatari
26f52eea28 Server browser hosting logic improvements
* Added missing mutex lock in 'CBrowser::UpdateHostingStatus' when host status is 'NOT_HOSTING'.
* Use server's remote checksum to test whether or not the checksum is valid, as this is the one that will be used for hosting.
* Construct 'NetGameServer_t' from the main thread instead, and dispatch back into separate thread for remote query.
2023-02-12 11:22:18 +01:00
Kawe Mazidjatari
e98a6c31e9 Improve netkey logic
Removed extraneous copy of the base64 netkey. The base64 key is now directly obtained from the netkey singleton.
2023-02-12 02:28:03 +01:00
Kawe Mazidjatari
4116edfe4c Server browser UX improvement
Auto focus token input field when private server modal is invoked or a token is submitted without success.
2023-02-04 20:04:23 +01:00
Kawe Mazidjatari
b160f39379 Improve server browser styling
Set minimum window size based on theme, so that if there are more servers than displayable, the last listing wouldn't clip under the panel frame.
2023-02-04 01:03:18 +01:00
Kawe Mazidjatari
a872c9ac7a Server browser theme improvements
* Pad server list tables properly.
* Pad and size private server modal properly for each theme.
* Light code cleanup.
2023-01-30 01:18:51 +01:00
Kawe Mazidjatari
9164856b95 Fix browser display defect
Fix defect causing frames to not animate properly when browser menu is invoked.
2023-01-29 19:30:37 +01:00
Kawe Mazidjatari
96e482f814 Server browser UX improvements 2023-01-28 14:20:57 +01:00
Kawe Mazidjatari
1b3223d5cb Sync 'sv_globalBanlist' with global banned list toggle 2023-01-28 13:05:02 +01:00
Kawe Mazidjatari
61684ddf87 Create cvar for global banned list queries
This was planned to be changed a long time ago. This change allows dedicated server users to disable the logic as well.
2023-01-26 21:20:11 +01:00
Kawe Mazidjatari
81154df155 Improve Server Browser host panel
* Immediately display the "Stop Server" and "Change Level" buttons when hoststate indicated there is an active game, since stopping the server or switching levels is still valid when the server is not simulating.
* Only display the AINetwork/NavMesh rebuild/reload and Settings Reparse buttons when the server is simulating.
2022-11-26 17:04:12 +01:00
Kawe Mazidjatari
6eb31ad881 Only activate server command panel when server is simulating
Only activate the command panel in the host section of the Server Browser when the server is actually simulating. Else we can crash the server by submitting commands when its in an uninitialized state.
Client AI Settings reparse is also only executed when the client is simulating from now on.
2022-11-23 12:30:15 +01:00
Kawe Mazidjatari
9533afc628 Add new 'shortcut' buttons to host panel
* Added "Rebuild AI Network" (rebuilds the AIN file).
* Added "NavMesh Hot Swap" (hot reloads the navmesh files).
* Added "AI Settings Reparse" (reparses ai settings on the server and client).
2022-11-14 01:04:01 +01:00
Kawe Mazidjatari
b97176a04b CBrowser: light cleanup 2022-10-21 21:28:51 +02:00
Kawe Mazidjatari
49658c498f Fix private server modal size not being set correctly
ImGui::PopStyleVar() had to be called before ISurface::DrawSurface().
2022-10-20 14:37:21 +02:00
Kawe Mazidjatari
c7d828610d Fix server browser not claiming focus on window apparition
The console draws focus as it does SetKeyboardFocusHere(-1) (on the previous widget, which is the input text field). We don't do this in the server browser, so we must explicitly claim focus by calling SetNextWindowFocus() once before the next frame gets renderer.
2022-10-20 14:23:24 +02:00
Kawe Mazidjatari
5f84803ac6 ImGui and DirectX code improvements
* Fix history duplication by removing trailing white space characters from submitted commands in console.
* Fix out of range exception caused by caching svConVar.size() in CConsole::BuildSummary while we are modifying it.
* Fixed memory leak  caused by extraneous Strdup calls in CConsole.
* Renamed variables and structure members, static vars in id3dx.cpp are not prefixed with s_, IBrowser_Config is now m_BrowserConfig.
* Performed code cleanup in id3dx.cpp.
2022-10-20 12:29:50 +02:00
Kawe Mazidjatari
31845425d6 Only enable/disable input system on open/close events
Previously we enabled/disabled the input system each frame, depending on the state of the ImGui windows. This commit changes the behavior into only enabling/disabling when the menu's are closed (either through the keyboard or the close button).

I added a simple callback to ImGui::Begin which will be called when the close button on the ImGui panel is pressed and the callback pointer isn't nullptr, this was required as there was otherwise no way to determine when the close button was clicked.
2022-10-20 12:29:50 +02:00
Kawe Mazidjatari
84b4772006 Refresh server list when the browser is activated 2022-09-14 02:39:55 +02:00
Kawe Mazidjatari
34a06147d7 Fix spelling errors
Overall spelling improvements and cleanup..
2022-09-09 19:47:31 +02:00
Kawe Mazidjatari
708e6992e4 Server browser UX improvements
* Removed extraneous text line for hosting, combined error and hosting into 1.
* Removed extraneous 'Force Start' button. The server will now 'Force Start' when the visibility is offline, else require the user to fill out the required fields in order to host the server.
* Only clear the request message when the color is green and we are no longer hosting. All errors will remain until the server is restarted through the browser panel.
2022-09-07 01:12:22 +02:00
Kawe Mazidjatari
2887e79bcb CBroswer: fix 'Stop Server' button not appearing when server script error occurs while client is attempting to connect 2022-09-05 22:32:47 +02:00
Kawe Mazidjatari
13c91c72fa Add 'Reload Banlist' button 2022-09-01 01:20:27 +02:00
Kawe Mazidjatari
41fda3a8ac Clear message when modal is closed with the 'Close' or 'X' button
This does not happen when you connect, because then you can retrieve the name of the server you connected to the next time you open the modal.
2022-08-31 21:49:28 +02:00
Kawe Mazidjatari
66ea9484e9 Hidden server modal sanity check
* Check if the input field isn't empty.
2022-08-31 17:23:23 +02:00
Kawe Mazidjatari
0309d9cd6b Server browser UX improvements
* Use proper method of obtaining content regions for buttons.
* Set min and default size to (928 - 524), this improves the anti-aliasing effect even more.
* Significantly decrease the size of the private server modal.
* Removed extraneous min window size constraint set by 'ImGuiConfig::InitStyle()'.
2022-08-31 15:45:12 +02:00
Kawe Mazidjatari
a5f71dc4d8 Change default size for browser window
Default size is tested to show the least amount of anti-aliasing effects.
2022-08-31 02:16:40 +02:00
Kawe Mazidjatari
8712f7db81 Fix concurrency of g_svNetKey
* Fix concurrency of g_svNetKey.
* Improve logging.
* Overall code cleanup.
2022-08-30 01:22:53 +02:00
Kawe Mazidjatari
e54c2df621 Light cleanup 2022-08-29 14:00:54 +02:00
Kawe Mazidjatari
ab8fc757c8 Fix concurrent access to 'g_vAllPlaylists' and 'g_vAllMaps' 2022-08-29 11:55:58 +02:00
Kawe Mazidjatari
73ff0bd0c1 Licht cleanup
* Removed unnecessary header files.
* Removed unnecessary c-string cast.
* Use lock_guard for mutex.
2022-08-29 03:03:53 +02:00
Kawe Mazidjatari
e174cb2b1d Turn static var into member 2022-08-29 02:38:19 +02:00
Kawe Mazidjatari
0f488c685c Move simple task to global fixed frame
Avoids having to create threads for tiny little things.
2022-08-29 02:21:32 +02:00
Kawe Mazidjatari
50fceec016 Update error messages 2022-08-29 00:19:11 +02:00
Kawe Mazidjatari
f6d8a966a3 Don't reload level when reparsing weapon scripts 2022-08-28 17:42:58 +02:00
Kawe Mazidjatari
0b49ea1f29 Use 'g_pServer->IsActive()' over 'g_pHostState->m_bActiveGame' 2022-08-28 17:40:03 +02:00
Kawe Mazidjatari
532b4125d5 More thread safety improvements
* Run 'CHostState::Think()' in the main thread.
* Construct 'NetGameServer_t' objects in main thread before dispatching (TODO: browser).
* Dispatch the call to 'CBanSystem::AddConnectionRefuse' from 'SV_IsClientBanned' to the main thread if we aren't main.
* Return bool for CBanSystem::AddEntry and CBanSystem::DeleteEntry for future optimizations (next commit).
2022-08-27 23:45:58 +02:00
Kawe Mazidjatari
656b0be3ec Improve threading (work in progress)
* Only run '_DownloadPlaylists_f()' in the main thread, schedule for next frame if we aren't in the main thread. (this should fix crash cases related to disconnecting from the game).

* Locked read/write to CBrowser members (thread for obtaining the server list is detached, but once the 'slow' post operation in this thread is complete, mutex lock is acquired (locking the render thread if the browser is active) to set the string members of CBrowser, this operation is very fast as we only set the string and the color after the http post operation (this never caused a crash, but the behavior without any lock mechanism is technically undefined regardless).

* Obtain the host name dynamically from the ConVar 'pylon_matchmaking_hostname' (atomic operation). Initial approach was deleting the whole master server pointer just to construct a new httpclient object..
2022-08-27 18:57:56 +02:00
Kawe Mazidjatari
3414a2cd2c ImGui panel improvements
* Eliminated all forms of concurrency for CConsole logger.
* Used enum for determining which theme user loaded (DEFAULT, LEGACY, MODERN).
* Fixed issue where browser panel doesn't have the same frame padding as the console for the modern theme.
* Fixed issue where the history items count shows number higher than maximum until updated (updates vector before displaying, else this happens in g_pConsole->RunTask which is the operation that happens before we add new elements to the vector, thus showing the wrong count as this size is getting corrected the next frame after we painted, we don't update the summary each frame for performance reasons).
2022-08-22 01:10:18 +02:00
Kawe Mazidjatari
8476d22777 Fix concurrent access to several CConsole members
* Fix concurrent access to CConsole::m_Logger.
* Fix concurrent access to CConsole::m_vHistory.
* Additional DX system cleanup.
2022-08-21 19:35:06 +02:00
Marvin D
eeec292238 Don't need to run CBuf_Execute. Game does it itself.
* How did I forget to remember that for almost a year..
* Connect and disconnect commands also fixed now.
2022-08-19 22:25:26 +02:00
Kawe Mazidjatari
6764b5e56e Implement frame tasks
Run all Cbuf_Execute calls in the main thread. This should fix every problem related to (but not only):
* Connecting to server while RUI dialogue is still open.
* Connecting to server while in an active game.
* Running 'weapon_reparse'.
2022-08-19 21:33:31 +02:00
Kawe Mazidjatari
851682ab89 Fix most compiler warnings 2022-08-14 18:35:01 +02:00
Kawe Mazidjatari
c18dbc2270 Update IBrowser.cpp 2022-08-14 15:45:08 +02:00
Kawe Mazidjatari
329621c6ad Move all public headers into root of 'public' 2022-08-09 17:18:07 +02:00
Kawe Mazidjatari
f015667f88 Light ImGui cleanup
* CTextLogger: Explicit cast return value of size() to int when testing int value against size_t.
* CBrowser: Run think and request thread on client.dll, but for the request, only the refresh.
2022-08-09 12:13:31 +02:00