534 Commits

Author SHA1 Message Date
Kawe Mazidjatari
22431e903c FileSystem: make CreateDirHierarchy and IsDirectory general function
Moved to general utility
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
1c2b02b972 RTech: cleanup ZStd pak decoder and fix bugs
* Pak_InitDecoder() now takes the output buf and mask as parameters.
* Pak_InitDecoder() checks if provided masks are a power of 2 (required).
* Pak_ComputeRingBufferFrame() now uses the bit mask instead of modulo to determine # bytes used.
* Fixed a bug where PakDecoder_t::bufferSizeNeeded could be bigger than the file stream, causing a deadlock.
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
2d6533adf1 RTech: add info about small pak file's ring buffers 2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
e1c889719a RTech: properly implement ring buffer stream decode for Zstd decoder
The new decoder can now decode patched and custom rpaks files, all issues so far have been fixed. The code still needs some testing and bench marking to make sure
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
10af9ac695 Tier0: add overload for reading pointer data and fix write overload
Write should've been a pointer instead.
2024-04-05 17:56:48 +02:00
Kawe Mazidjatari
c4691448c1 RTech: initial custom pak compression implementation
Allows paks compressed with ZSTD, to be stream decoded at run time. Currently seems to work pretty good, but needs to be further battle tested + cleaned up still.
2024-04-05 17:54:05 +02:00
Kawe Mazidjatari
e8be704276 GameUI: cleanup and fix race condition
* Use CThreadFastMutex instead
* Rename ISurface to IDebugSurface to prevent a potential name collision with VGUI's ISurface iface if we ever add it
* Fix race condition when setting CPylon::m_HostIP from materialsystem thread, this has been dispatched to the main thread
* Marked 'pylon_matchmaking_hostname' FCVAR_MATERIAL_SYSTEM_THREAD as we use it in the server browser panel.
2024-04-05 17:52:57 +02:00
Kawe Mazidjatari
fe2a95e4ec RTech: major pak system overhaul and rebuild
* split rtech_game and rtech_utils cpp files into multiple files
* rebuilt several large pak load routines for debugging and custom implementations
* moved rson code to rtech_game
* reworked and improved engine and sdk pak precache system
* reversed more of the jobthreads system
2024-04-05 17:51:19 +02:00
Kawe Mazidjatari
6766f5be62 Tier1: map out CCvar completely and get the ptr to the actual class instance
Previously we had a ptr to just its vtable; get the ptr to the actual class instance.
2024-04-05 17:46:56 +02:00
Kawe Mazidjatari
3c74070285 Tier0: initialize CThreadFastMutex member vars
Must be null
2024-04-05 17:46:56 +02:00
Kawe Mazidjatari
8e0e42cdab Tier1: add assert in CCommand::Arg()
This code path shouldn't be hit.
2024-04-05 17:46:56 +02:00
Kawe Mazidjatari
5f554867a1 VpkLib: check for manifest file first before opening the pack file
We do this as if we happen to not have any manifest whatsoever, but already opened the block file, and the block file already existed and was still valid, it would be emptied out. Only open it if we are actually going to write into it!
2024-04-05 17:46:53 +02:00
Kawe Mazidjatari
ff7c3b1435 Tier1: feature proper size types for CFmtStrN
Promote to 64bit for target platform.
2024-04-05 17:46:53 +02:00
Kawe Mazidjatari
6f11fffe63 Tier0: fix netconsole and revpk compile error in debug
CCommandLine isn't implemented in tools, thus unresolved external symbol errors will be thrown. HushAsserts() was unused and therefore removed which fixes these errors.
2024-04-05 17:46:52 +02:00
Kawe Mazidjatari
891a7439f4 AppSystem: implement destructors
Need to be implemented when these are subclassed and implemented (not declared) in the SDK or tools.
2024-04-05 17:42:54 +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
51986ec1c6 VstdLib: reimplement CKeyValuesSystem
NOTE: reimplementation is for tools only, the game and SDK still uses the engine's implementation.
2024-04-05 17:36:37 +02:00
Kawe Mazidjatari
07cc5420bc Tier1: enable CUtlBuffer char conversion
Changed types to const char* instead of char*.
2024-04-05 17:31:35 +02:00
Kawe Mazidjatari
654da2c816 Tier1: fix CUtlMemoryPool::CBlob structure
Only contains the 'previous' pointer, freeing memory now works.
2024-04-05 17:31:35 +02:00
Kawe Mazidjatari
ae681fc118 Tier1: enable CMemoryStack and fix compile errors in debug
Define missing MemAlloc_* inlines.
2024-04-05 17:31:35 +02:00
Kawe Mazidjatari
5721ffd22b Tier1: reimplement CUtlMemoryPool
Class is slightly modified; it uses 2 CBlob pointers instead of a single CBlob member. CUtlMemoryPool::m_pHeadOfFreeList is also replaced with the new CUtlMemoryPool::m_pPrev pointer. Code has been modified to accommodate this change and aligns with the assembly code of r5.
2024-04-05 17:29:12 +02:00
Kawe Mazidjatari
a8074b4c99 VPhysics: add CPhysicsCollision singleton
Used for CStudioVCollide::~CStudioVCollide().
2024-04-05 17:26:16 +02:00
Kawe Mazidjatari
f961b3b013 DataCache: cleanup & improvements
* follow naming convention of studio.h.
* renamed studiocache_t to studiomodelcache_t.
* merged 'ModelHeader' struct with studiomodelcache_t.
* add 'physfile_t' structure.
2024-04-05 17:24:29 +02:00
Kawe Mazidjatari
ad4e8c241b DataCache: remove legacy inlines 2024-04-05 17:24:28 +02:00
Kawe Mazidjatari
c99d7dd8c0 Studio: fix compile error
Include for CRefCounted.
2024-04-05 17:24:28 +02:00
Kawe Mazidjatari
4c798b1eb1 DataCache: cleanup mdlcache code
Cleanup and fixup CMDLCache::GetVCollide (originally named CMDLCache::GetStudioHdr which was incorrect).
2024-04-05 17:24:28 +02:00
Kawe Mazidjatari
17900c4150 VPhysics: add vcollide structure 2024-04-05 17:22:27 +02:00
Kawe Mazidjatari
2b53c32e1d Tier1: add refcount class 2024-04-05 17:21:08 +02:00
Kawe Mazidjatari
0a168aa69d Texture: fix crash caused by unused define
GAMEDLL_S3 is no longer defined due to deprecation.
2024-04-05 17:19:34 +02:00
Kawe Mazidjatari
edc52ad669 IDetour: remove extraneous pointer assignments
Originally, we store the search results in a CMemory instance which we then assign to the actual function pointer. CMemory is just a pointer class; we can assign the results directly to the actual function pointer. This commit reduces a lot of code verbosity, and also reduced roughly 2KiB worth of static pointers in the resulting executable. This commit also officially deprecates the support for any GameDLL's below S3 (Season 3), since it makes more sense to port the assets from earlier/later games back to the version this SDK supports.
2024-04-05 17:19:32 +02:00
Kawe Mazidjatari
de3d3b49a1 CMemory: add reference overload
Assign pointer to reference.
2024-04-05 17:19:32 +02:00
Kawe Mazidjatari
714674ae33 Engine: reversed some CGame field names
Reversable thanks to the CInputSystem rebuild.
2024-04-05 17:19:28 +02:00
Kawe Mazidjatari
053a1ca9e0 Tier0: add template inline for FindPatternSIMD
This allows for directly setting a function pointer without double casting it, and significantly reduce code verbosity.
2024-04-05 17:12:51 +02:00
Kawe Mazidjatari
05352d9d17 Tier1: temporarily comment
Unused and causes errors due to unimplemented mutex class (needs to be reversed still).
2024-04-05 17:12:51 +02:00
Kawe Mazidjatari
02b0a5c7df InputSystem: make InputEventCallback_t return type bool 2024-04-05 17:12:51 +02:00
Kawe Mazidjatari
0067a57aa8 InputSystem: add inline helpers 2024-04-05 17:10:58 +02:00
Kawe Mazidjatari
b72f02d123 InputSystem: fixup enumerants and controller structs
Enumerants:
* ButtonCode_t::JOYSTICK_MAX_BUTTON_COUNT = 32 (previously 26, incorrect...).
* AnalogCode_t::JOYSTICK_FIRST_AXIS = 2 (previously 4, incorrect...).
* Added: ButtonCode_t::KEY_CREDITSIGN (k104, last key).
* Fixed up Xbox controller enums.

Structs xdevice_t:
* Added partially reversed unkownhiddevice_t structure (used for non-xbox hardware).

General:
* Added static assertions for structure sizes.
2024-04-05 17:10:58 +02:00
Kawe Mazidjatari
94d01c39b3 Tier1: make CTier1AppSystem iface public 2024-04-05 17:10:58 +02:00
Kawe Mazidjatari
4e3fdab7e7 InputSystem: joystick deadzone indices and event input callback types
Adjust iface accordingly.
2024-04-05 17:10:58 +02:00
Kawe Mazidjatari
bbebbdac13 InputSystem: largely reversed struct and fully reversed iface
Struct has been largely mapped out (still requires a bit of work, mostly the Xbox/Hid data structures). The vftable has been fully mapped out.
2024-04-05 17:09:47 +02:00
Kawe Mazidjatari
bd35ec6525 Create utlstringmap.h 2024-04-05 17:04:53 +02:00
Kawe Mazidjatari
e64e5674c8 InputSystem: update button codes
Xbox enumerants have changed as the game supports Xbox One controllers. Since the joystick button count has changed, 'JOYSTICK_MAX_BUTTON_COUNT' has also changed which affects the size of datatypes used by the CInputSystem class.
2024-04-05 16:55:29 +02:00
Kawe Mazidjatari
7d0b2d7450 Add/update core headers 2024-04-05 16:53:51 +02:00
Kawe Mazidjatari
82c522a424 Use size types for keyvaluesystem interface 2024-04-05 16:41:11 +02:00
Kawe Mazidjatari
144d5f62e1 IDetour: code refactor
Utilize the new IDetour::DetourSetup() code, IDetour::Attach and IDetour::Detach have been removed in favor of this (significantly reduces chance of user error). Since the template check happens in the idetour header, it is much more aggressive on type mismatches, such as a difference in parameter types, between the function and detour, will now raise a compile time error. As a result, some type mismatches have been fixed in this commit as well.
2024-04-05 16:41:09 +02:00
Kawe Mazidjatari
699a4ce464 Implement CCommandBuffer
Code is based on Valve's implementation, with the following changes:
- Usage of 64bit signed size types.
- Usage of const where possible.
- Removal of field 'CCommandBuffer::m_nLastUsedArgSSize'.
2024-04-05 16:39:22 +02:00
Kawe Mazidjatari
ea8074dff9 Fix bug in utllinkedlist
Should return template type (default 'unsigned short') instead of int as Count.
2024-04-05 16:34:30 +02:00
Kawe Mazidjatari
a8312517f4 CCommand adjustments
Moved inlines to header; made ArgC return 32bit integer instead.
2024-04-05 16:34:30 +02:00
Kawe Mazidjatari
901b4e13ba Bump sig cache version
Signatures changed
2024-04-05 16:34:28 +02:00
Kawe Mazidjatari
c6f2c99619 Improve client-side online authentication error handling and UX
Display the error to the user without having to open the developer console or terminal window. This patch also adds printing to COM_ExplainDisconnection (which has been stripped out of the retail binary).
2024-04-05 16:34:28 +02:00