304 Commits

Author SHA1 Message Date
Kawe Mazidjatari
02303d0ffc Merge branch 'indev' into launcher_rework 2024-06-01 12:02:06 +02:00
Kawe Mazidjatari
da09d8b631 CppKore: add callback for drop down opened event 2024-06-01 11:49:16 +02:00
Kawe Mazidjatari
8e81d99585 CppKore: fix potential font resource leak
As of commit 168ad9aabd624510045d56aabcbfeff6f4aaad6f, we can assign uniform fonts to all child controls, but only 1 control can own the font resource. This is by default false since we do not want to free the resource when destroying the child controls, but we do want to free it once the parent window gets destroyed.
2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
d5db4674a4 CppKore: add getter for child control count 2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
4c99efa889 CppKore: try parent font if current is absent
This allows for setting uniform fonts on all controls, by only assigning the font once to the parent control. Else each control needs to have its own set.
2024-06-01 11:43:10 +02:00
Kawe Mazidjatari
9de5f4988f RTech: fixed streamed pak decoding progression bug
During beta tests on a Linux system, we encountered an issue where the I/O could be slower and thus result in not enough bytes being streamed by the time we invoke the decoder (lenStreamed == bufSizeNeeded at this point), after 16 calls with lenStreamed == bufSizeNeeded, the engine errors as ZSTD_NO_FORWARD_PROGRESS_MAX would be reached. Added value of 'ZSTD_nextSrcSizeToDecompress()' to 'PakDecoder_s::bufferSizeNeeded' to make sure we never call the decoder without any new streamed bytes. Also increased the value of ZSTD_NO_FORWARD_PROGRESS_MAX to 1024 since this fixed the issue without applying the aforementioned patch, this was increased as a hardening measure.
2024-06-01 11:43:09 +02:00
Kawe Mazidjatari
890ffa923e Launcher: light overhaul and use KeyValues class
Reworked some of the code to make globals static and used KeyValues class to parse VDF files instead.
2024-06-01 11:35:07 +02:00
Kawe Mazidjatari
91d00d0ab3 ImGui: also take vertical scrollbar into account
Show horizontal scrollbar when console text gets overlapped by the vertical scrollbar.
2024-06-01 11:16:47 +02:00
Kawe Mazidjatari
3e281d785c Merge branch 'indev' into launcher_rework 2024-06-01 11:13:27 +02:00
Kawe Mazidjatari
b4ad19275f ImGui: fix console scrollbar feedback loop bug
Make use of newly added flag "ImGuiWindowFlags_OverlayHorizontalScrollbar" as per commit 60e4514b7b5c56db89102a3d66ef28a14118b8fd. Also removed flag "ImGuiWindowFlags_AlwaysVerticalScrollbar", only show the vertical scrollbar when its visible. Enabled code that takes the scrollbar into account in function CTextLogger::EnsureCursorVisible().
2024-04-05 18:42:30 +02:00
Kawe Mazidjatari
07ca7e1231 ImGui: add flag to draw scrollbars over content
Custom flags: basically tells ImGui to draw the scrollbar as an overlay. This is useful for working around feedback loops caused by the appearance of the scrollbars (might be worth PR'ing into ImGui itself?)

See:
ocornut/imgui#1720
ocornut/imgui#1730
ocornut/imgui#2978
2024-04-05 18:42:30 +02:00
Kawe Mazidjatari
6d8315626e Thirdparty: upgrade ZStd to 1.5.6 2024-04-05 18:42:29 +02:00
Kawe Mazidjatari
ebffccf587 Thirdparty: upgrade RapidJSON to latest
Upgraded to Tencent/rapidjson@5ec44fb920
2024-04-05 18:42:29 +02:00
Kawe Mazidjatari
564efaf394 Recast: reverse some fields 2024-04-05 18:40:36 +02:00
Kawe Mazidjatari
d1498240eb Protobuf: change space indentation
Use 4 space indentation instead of 1 when using the newline/space option.
2024-04-05 18:40:36 +02:00
Kawe Mazidjatari
d853846189 Protobuf: don't wrap uint64/sint64 numbers in quote
Technically this is to support JavaScript as it supports up to 53 bits precision, but we want to stick to the same scheme RapidJSON is using.
2024-04-05 18:40:36 +02:00
Kawe Mazidjatari
9fd41688e2 Compile full protobuf library
Needed for LiveAPI as reflection/descriptors will be used.
2024-04-05 18:33:10 +02:00
Kawe Mazidjatari
b3a68ed095 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-04-05 18:29:03 +02:00
Kawe Mazidjatari
4d0c5dd3da Protobuf: fix compile error
template Delete<UnknownFieldSet>(); doesn't compile on vs2017 15.6, removed template qualifier.
2024-04-05 18:27:10 +02:00
Kawe Mazidjatari
d11718a956 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-04-05 18:24:35 +02:00
Kawe Mazidjatari
431621a1cc ImGui: constify local variables 2024-04-05 18:24:35 +02:00
Kawe Mazidjatari
bd797a92db 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-04-05 18:24:35 +02:00
Kawe Mazidjatari
3273b7112c ImGui: better name for blinker timer in logger 2024-04-05 18:24:35 +02:00
Kawe Mazidjatari
fda018785e ImGui: upgrade backend to 1.90.4 as well
This wasn't committed, but was supposed to be part of commit 7f6846a3
2024-04-05 18:24:34 +02:00
Kawe Mazidjatari
264c104b09 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-04-05 18:24:33 +02:00
Kawe Mazidjatari
6f158811e6 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-04-05 18:24:33 +02:00
Kawe Mazidjatari
1f8cd45626 ImGui: make config singleton static
Avoid indirection, also deduplicate common style var assignments.
2024-04-05 18:24:33 +02:00
Kawe Mazidjatari
bddde13b06 ImGui: use Dear ImGui API for the cursor render blinker 2024-04-05 18:19:41 +02:00
Kawe Mazidjatari
405a16d982 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-04-05 18:19:41 +02:00
Kawe Mazidjatari
71f151397a 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-04-05 18:19:41 +02:00
Kawe Mazidjatari
ef6cd5e444 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-04-05 18:19:40 +02:00
Kawe Mazidjatari
c80d6eb0d2 ImGui: fix bug in CTextEditor::IsHandleMouseInputsEnabled
Returned the incorrect value, should've returned m_bHandleMouseInputs.
2024-04-05 18:19:40 +02:00
Kawe Mazidjatari
56b73af57d ImGui: add multiple fixes and improvements
Add some selection improvements from maintained version at https://github.com/santaclose/ImGuiColorTextEdit.

patch contains:
* advance cursor to end of selection
* add shift + mouse select
2024-04-05 18:19:40 +02:00
Kawe Mazidjatari
dac0ab4d99 ImGui: fix right move
Ctrl + arrow should move to word end, not next word. This also fixes a bug where it would index into into the second character when the line end gets reached.
2024-04-05 18:19:40 +02:00
Kawe Mazidjatari
197772e5f7 ImGui: fix logger not showing horizontal scrollbar when text clips 2024-04-05 18:19:40 +02:00
Kawe Mazidjatari
db2b42cb03 ImGui: heavy optimizations to text logger (WIP)
This code originated from an imgui code editor, where it would make sense to have per-character colors. But for the console, we only ever do 1 color per line. Just store the string and one color instance, this also allows us to just take the string instead of manually reconstructing it which is very slow. The code now also only stores 32bits for color (per line) instead of 128 bits (ImVec4) as we only ever need to convert it once.

As a result, a bunch of rendering code could be dropped, and the pass filter is now also very fast as we don't need to reconstruct the string to check for the filter, we just pass a char* in which doesn't cost any perf.
2024-04-05 18:19:40 +02:00
Kawe Mazidjatari
85c7db410d ImguiSystem: properly implement ImGui and fix several bugs
Moved implementation to dedicated class 'CImguiSystem' with the following changes:

* Added mutex for ImGui_ImplWin32_WndProcHandler(), the window proc is ran from a different thread than CImguiSystem::SampleFrame() is being called from. Needs a mutex as both functions interact with the input queue list.

* Added init stages for debugging and preventing the system from running certain parts of the code if a certain stage hasn't been reached yet.

* NULL out ImGuiContext::ConfigNavWindowingKeyNext , we don't need any nav window shortcuts as users don't need then in-game, and it also interferes with certain key binds some users have.

* CImguiSystem::SampleFrame() (previously ImguiSystem_SampleFrame()), is now being called from CMaterialSystem::SwapBuffers(), as that function is called from the main thread while also getting updated during level loads/etc, so instead of switching between 2 static buffers for as long as the levels are being loaded, we imgui updates properly too and directly swap afterwards.

* Removed hack in CGame::WindowProc() where we would only run windowproc if we aren't shutting the game down. This was needed as there was a chance of a crash at some rare cases, but this was simply due to a missing mutex which has been addressed and fixed as of this commit.

* Lock mutex during init and shutdown.
2024-04-05 18:19:39 +02:00
Kawe Mazidjatari
9e6559a244 ImGui: set X scroll in console window as well
Previously only the Y would reset, making you not see the end if you were scrolled too far in the X.
2024-04-05 18:19:39 +02:00
Kawe Mazidjatari
6cf88dc16c Engine: render ImGui in main thread and fix many threading bugs
ImGui drawing code now takes place in the main thread, a snapshot of the render data is created in CMaterialSystem::SwapBuffers(), and is being rendered in the render thread right before SpinPresent().

The reason why this was necessary, is because ConVar::GetString() isn't thread safe if its not marked FCVAR_MATERIAL_SYSTEM_THREAD or FCVAR_ACCESSIBLE_FROM_THREADS, and we used it for the console suggestions window, which iterates over every ConVar, accessible from threads or not.
2024-04-05 18:17:12 +02:00
Kawe Mazidjatari
1ac38516d8 Upgrade Dear ImGui to 1.90.4 2024-04-05 18:13:33 +02:00
Kawe Mazidjatari
04613822ae Thirdparty: add LZ4 to project
Will be used for data block sender/receiver rebuild
2024-04-05 17:58:51 +02:00
Kawe Mazidjatari
ff9aa78d0d Thirdparty: upgrade SpdLog to 1.13.0 2024-04-05 17:56:52 +02:00
Kawe Mazidjatari
c8e5d263bd Thirdparty: upgrade to latest RapidJSON 2024-04-05 17:56:51 +02:00
Kawe Mazidjatari
29c7cc9e58 ZStd: explicitly set debug level
Explicitly set to 0 for release
2024-04-05 17:56:50 +02:00
Kawe Mazidjatari
cbae59a158 ZStd: fix typo in CMakeLists
Incorrect filter name
2024-04-05 17:56:47 +02:00
Kawe Mazidjatari
a9ed0762e1 ZStd: suppress thirdparty code warnings 2024-04-05 17:56:47 +02:00
Kawe Mazidjatari
2b06bc8abb Add ZSTD to SDK 2024-04-05 17:53:22 +02:00
Kawe Mazidjatari
ee82d5d8e0 Tier1: move KeyValues class to Tier1
The KeyValues class belongs here. Also reimplemented most loading methods for KeyValues, and adjusted the VPK building code to account for it. Pointers to the engine's implementation of KeyValues have been moved to a separate header ('keyvalues_iface.h'), as this allows external tools code to utilize the standalone KeyValues class implementation. Playlist utilities are completely separated from the KeyValues header; these have nothing to do with KeyValues other than manipulating a global KeyValues object for the playlists, and thus have been named as such and moved to rtech/playlists.
2024-04-05 17:42:05 +02:00
Kawe Mazidjatari
1f7bbe5b92 Recast: make detail mesh edge detection more robust
Merge recastnavitagion/recastnavitagion@c393777d26
Instead of using a distance check which can fail at large magnitudes due
to low precision we can check whether the edges are actually on the
hull.
2024-04-05 17:19:29 +02:00
Kawe Mazidjatari
e3bf2036b3 Recast: fix:rcBuildLayerRegions missing areaType
Merge recastnavitagion/recastnavitagion@ddaa361b08
2024-04-05 17:19:28 +02:00