3847 Commits

Author SHA1 Message Date
Kawe Mazidjatari
2d084db3a3 LiveAPI: initial WebSocket implementation
Working WebSocket implementation (foundation for game LiveAPI).
2024-03-25 01:26:33 +01:00
Kawe Mazidjatari
aff556732e Link against DirtySDK
Link against recently added libraries.
2024-03-16 16:57:28 +01:00
Kawe Mazidjatari
d24d4a52dd Add EABase, EAThread and DirtySDK to R5sdk
DirtySDK (EA's Dirty Sockets library) will be used for the LiveAPI implementation, and depends on: EABase, EAThread.
2024-03-16 12:44:34 +01:00
Kawe Mazidjatari
57dc081d4a Pylon: rename field "playerCount" to "numPlayers"
Force consistency between code structure.
2024-03-16 11:55:20 +01:00
Kawe Mazidjatari
fcbf285b80 Miles: add global type and prevent non-existent banks from loading
This patch adds miles globals and additional code to prevent banks from loading that don't exist. It falls back to "english" if requested language isn't installed.
2024-03-16 11:47:59 +01:00
Kawe Mazidjatari
c0879dc59c Squirrel: add more types and functions
More reversed types, more functions.
2024-03-16 11:36:49 +01:00
Kawe Mazidjatari
2b104896a5 Protobuf: fix compile error
template Delete<UnknownFieldSet>(); doesn't compile on vs2017 15.6, removed template qualifier.
2024-03-16 01:33:47 +01:00
Kawe Mazidjatari
cd75f47007 Tier1: compile utlsymbol.cpp
Should also be compiled, now that its fully implemented.
2024-03-16 01:31:14 +01:00
Kawe Mazidjatari
d302be7b4d Cleanup/add some comments 2024-03-16 01:30:44 +01:00
Kawe Mazidjatari
e230fb8320 Protobuf: check version on startup
Properly check as per documentation.
2024-03-16 01:27:57 +01:00
Kawe Mazidjatari
78e2a67e84 Squirrel: add functionality to register enums 2024-03-16 01:27:18 +01:00
Kawe Mazidjatari
35ba0cabf0 Tier1: use template index type for memory allocation
For CUtl* classes: use the index type rather than just ssize_t, this will throw compile warnings for code that constructs a CUtl* object allocating more memory than the index type allows (e.g. allocating UINT16_MAX while the index type has been set to UINT8_MAX).
2024-03-14 18:25:40 +01:00
Kawe Mazidjatari
e55ea0718c Tier1: fully implement CUtlSymbol(*)
The class has been modified to match the implementation of the engine, the only modifications done were changing size types, so they compile to the correct size based on the platform (in case of the GameSDK project, this will be 64 bits).
2024-03-14 02:37:39 +01:00
Kawe Mazidjatari
21ec76979a Tier0: implement CThreadSpinRWLock
Implementation matches that of the game executable, this will be used for CUtlStringTableMT.
2024-03-14 02:33:57 +01:00
Kawe Mazidjatari
fd3a805316 Engine: datablock sender cleanup
Mark cvar net_compressDataBlockLzAcceleration static.
2024-03-14 02:31:09 +01:00
Kawe Mazidjatari
6f962a8e2b Engine: server bulk ban check bug fixes
If the code was ran in the main thread, it would never fire the actual check logic. This patch changed the code so it would always fire from the start of the frame. Also fixed a memory leak that occurred when passing in an external banned list to SV_CheckClientsForBan (previously, 'SV_CheckForBan'); the code always allocated a new banned list, but only freed it if no external banned list was provided. This patch changed the code so it only allocates it if no external one is provided.
2024-03-10 02:13:15 +01:00
Kawe Mazidjatari
f9559b609d ImGui: fix server visibility bug
If host status is set to offline after the server is launched, the browser would continue to broadcast the server. This patch makes sure that if the visibility has been set to offline, the server would no longer be broadcasted to the master server.
2024-03-10 01:59:57 +01:00
Kawe Mazidjatari
63237361e9 NetworkSystem: fix numerous issues
This patch splits host logic from CServerListManager. CServerListManager is actually meant for the client to manage the server list to which the client could connect to. The hosting logic has been moved to the new CServerHostManager class.

Previously, we stored all the hosting details in CServerListManager, with connection criteria in CPylon, this data has been moved over to CServerHostManager as well.

Previously, we also needed a mutex to access the server host data, function HostState_KeepAlive() has been refactored to the point this mutex is no longer necessary as the only threaded process is the actual request, the rest is being applied in the main thread. We also now only construct a NetGameServer_t struct if we actually plan to host.

Access to CPylon::m_Language is now also protected by a mutex, as the change callback of cvar 'language' and the threaded method 'CPylon::QueryServer()' are competing for access.
2024-03-10 01:57:04 +01:00
Kawe Mazidjatari
1908efce96 ImGui: constify local variable 2024-03-07 22:36:00 +01:00
Kawe Mazidjatari
8912ceb30c ImGui: properly attach autocomplete suggest window to console
Make sure the autocomplete suggest window is always behind the console window with nothing in between. Previously, the server browser or modal panel ended up between the autocomplete suggest window and console window if the console was focused after the browser was invoked and moved partially on top of the console.
2024-03-07 22:35:13 +01:00
Kawe Mazidjatari
17385d6f1d ImGui: add render frame stage and scope mutex 2024-03-07 22:32:24 +01:00
Kawe Mazidjatari
ac5340543c ImGui: slightly improve cursor scrolling
Add +1 on the right to prevent the cursor from getting under the perimeter, also add note for when feedback loop issue is fixed to accommodate for scrollbar when scrolling.
2024-03-07 22:30:00 +01:00
Kawe Mazidjatari
50620eda20 ImGui: constify local variables 2024-03-07 21:50:06 +01:00
Kawe Mazidjatari
b7d16b1f44 ImGui: fix cursor scrolling bug
* Fix bug where moving cursor all the way to the top + little bit, and then moving below will also scroll the text position below (cursor sticked to top rect).
* Fix bug where cursor skipped a column when moving it past the right perimeter of the console.
2024-03-07 21:47:50 +01:00
Kawe Mazidjatari
d09c48594f ImGui: better name for blinker timer in logger 2024-03-07 21:28:19 +01:00
Kawe Mazidjatari
535a212fc4 Engine: fix return value for game wndproc
Should return LRESULT, not int.
2024-03-03 14:44:25 +01:00
Kawe Mazidjatari
67aab9650a ImGui: remove extraneous window flag
No flags needed here, just pass ImGuiWindowFlags_None.
2024-03-03 14:43:00 +01:00
Kawe Mazidjatari
2d40486881 ImGui: make imgui flags constants instead 2024-03-03 14:42:22 +01:00
Kawe Mazidjatari
f7e7d1fb7a ImGui: fix server browser list clipper and pass filter bug
Filter results first before clipping them.
2024-03-03 14:40:57 +01:00
Kawe Mazidjatari
229a6491c7 ImGui: always rebuild summary text on input text change
This fixes corner case bugs like selecting currently entered text, and deleting it at once. If we happen to show a ConVar's value, and do the mentioned action, it wouldn't clear it as "if (iData->BufTextLen)" won't satisfy.
2024-03-02 01:57:16 +01:00
Kawe Mazidjatari
94a2de05d7 ImGui: move summary text above input text
The pass filter has some features (including, or excluding with the '-' prefix), but this isn't very clear. Added the original 'usage' text back, which caused the following issue: the summary text (showing how many history items, or the currently selected convar's current value/default value) would clip outside the console window on ConVar's that had larger string values, like URL's. The summary text has been moved to just above the input text field to fix this issue. This patch also contains some slight improvement to styling of the console.
2024-03-02 01:54:04 +01:00
Kawe Mazidjatari
06a4587ab7 ImGui: pad last button in server browser correctly
Previously, it would clip with the resize handle due to commit eda8048a982f88611710bcded1d2245e9d42d95e
2024-03-02 01:47:11 +01:00
Kawe Mazidjatari
5f41c4e9f1 ImGui: clip server listings if they exceed rect
Use ImGuiListClipper to clip anything not visible.
2024-03-02 01:45:41 +01:00
Kawe Mazidjatari
9fd37574c0 ImGui: upgrade backend to 1.90.4 as well
This wasn't committed, but was supposed to be part of commit 7f6846a3
2024-03-02 00:11:36 +01:00
Kawe Mazidjatari
0b8017d3e6 ImGui: don't use textures for autocomplete if the loading failed
Otherwise the indices will be incorrect and will cause undefined behavior.
2024-03-01 14:06:09 +01:00
Kawe Mazidjatari
7f36220448 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
Kawe Mazidjatari
5229125915 ImGui: properly implement shift select
The new method wraps around perfectly when the new selection positions overlap each other. This patch also fixes the shift selection drifting when lines are getting deleted.
2024-03-01 09:52:53 +01:00
Kawe Mazidjatari
ddb74c50fc ImGui: fix logger not moving end interactive + reduce duplicate code
Only the start interactive was moved if lines were deleted to clamp the vector size. Also fixed the code so the interactives always move if lines get deleted from before their positions, instead of "if" only the mouse is held down.
2024-03-01 09:48:12 +01:00
Kawe Mazidjatari
06b2226bbc ImGui: make config singleton static
Avoid indirection, also deduplicate common style var assignments.
2024-02-29 22:31:43 +01:00
Kawe Mazidjatari
f3ee2e3e90 ImGui: improve autocomplete window size
Use convars to determine the size, by default the width is the same size as the input text bar. The height has also been increased with 90f (shows 12 elements now, this fits perfectly when the game is launched with default options). Also properly clamp the autocomplete window
2024-02-29 22:26:44 +01:00
Kawe Mazidjatari
eda8048a98 ImGui:: correctly calculate item width
Fixed bug where changing the server browser causes the alignment of the buttons with the right side border to mess up.
2024-02-29 16:02:18 +01:00
Kawe Mazidjatari
4578401f33 ImGui: fix console input suggestions bug
Don't draw the suggestions window if the console has been collapsed.
2024-02-29 13:19:10 +01:00
Kawe Mazidjatari
8f09ac1b86 ImGui: cleanup and improvement to surface implementation
* Properly run fade in-out animations
* Make common methods/members shared
* Remove extraneous SDK thread
2024-02-29 13:18:18 +01:00
Kawe Mazidjatari
e311051148 ImGui: use Dear ImGui API for the cursor render blinker 2024-02-29 02:16:05 +01:00
Kawe Mazidjatari
79d82794ae ImGui: fix regression in logger after improving cursor selections
If you triple click a line in the logger, the selection mode will be set to SelectionMode::Line, however, when we drag with the mouse, the selection remain on SelectionMode::Line, causing the cursor to be stuck, which breaks the ability to scroll select. Mode must be set to normal during dragging.
2024-02-29 02:01:41 +01:00
Kawe Mazidjatari
0c46b15139 ImGui: initialize newly added member vars and fix scrolling regression
The types should be floats instead of ints, the compiler actually compiled it as ints after changing to ImCeil. Made vars of correct type and removed extraneous casts.
2024-02-29 01:32:45 +01:00
Kawe Mazidjatari
f9ed276cbd ImGui: reset horizontal scroll position when command has been submitted
Small UX improvement.
2024-02-29 01:00:24 +01:00
Kawe Mazidjatari
79e457fcf8 ImGui: add ability to reset horizontal scroll position
This allows us to reset the horizontal position only when an user submitted a console command in the text box. We don't want to reset the horizontal position if new lines are added since user could still be reading text that is otherwise clipped away.
2024-02-29 00:59:55 +01:00
Kawe Mazidjatari
476609c06f ImGui: fix bug in CTextEditor::IsHandleMouseInputsEnabled
Returned the incorrect value, should've returned m_bHandleMouseInputs.
2024-02-28 23:55:09 +01:00
Kawe Mazidjatari
88c8727af1 ImGui: add 'ImGuiWindowFlags_NoNavInputs' to console logger
Prevent the logging view area from moving within the console window.
2024-02-28 23:54:10 +01:00