678 Commits

Author SHA1 Message Date
Kawe Mazidjatari
6786d800cd More cleanup and slight performance boost 2022-05-03 03:40:47 +02:00
Kawe Mazidjatari
6bc638b7ce Little cleanup 2022-05-03 03:17:45 +02:00
Kawe Mazidjatari
84181f931c Remove redundant check 2022-05-03 03:10:55 +02:00
Kawe Mazidjatari
1d48574731 Refactored BuildPropStaticFrustumCullMap (see description)
Redacted most code to only perform operation to obtain studiohdr and staticprop material (read only operation, function does not modify memory used by the original 'v_BuildPropStaticFrustumCullMap()' implementation!)

The new function checks if pointer is within bounds (must stay within .data memory), if this isn't the case, the 'batch' is considered corrupt and function call to 'v_BuildPropStaticFrustumCullMap' won't proceed (note that the loop checks all bodygroups/LOD's of a model, it is possible that one doesn't have corrupt data, but a model where only one of its submeshes culls properly in the level is too much effort to fix as this function is based of disassembled output of the engine implementation, which in it self, comes with its own limitations).

For a better implementation we should proceed fully rebuilding the function (see commented function body).
The current and only problem with this is that it doesn't compute cull data properly (see bsplib.cpp line '222').
2022-05-03 02:37:37 +02:00
PixieCore
6ea81db14f ClientClass implementation and CHLClient::GetAllClasses.
* ClientClass is currently included in dedicated so it compiles for now. Please remove it at a later point it should not be compiled into dedicated.
2022-05-02 23:53:26 +02:00
Kawe Mazidjatari
9178068c55 Added note to root cause of BSP problem 2022-05-02 14:53:48 +02:00
Kawe Mazidjatari
c02214748b Small bsplib improvement 2022-05-02 14:14:07 +02:00
Kawe Mazidjatari
8b4df33151 Use 'sqrtf' for computing fade distance
This has to be debugged still as the computed data does not match the one computed from the engine (this is the reason the larger maps show artifacts!)
2022-05-02 03:40:07 +02:00
Kawe Mazidjatari
7df48151d4 Some 'BuildPropStaticFrustumCullMap' improvements
Artifact problem for large maps is still not solved.
2022-05-02 03:13:39 +02:00
PixieCore
096ecdd333 IClientEntityList and CUtlDict.
* IClientEntityList is the full virtual function table.
* CUtlDict "implementation" is temporary.
2022-05-01 23:03:20 +02:00
Kawe Mazidjatari
a23c0b1ba9 Merge branch 'indev' of https://github.com/Mauler125/r5sdk into indev 2022-05-01 21:09:06 +02:00
Kawe Mazidjatari
8ad4350f9f Improved BuildPropStaticFrustumCullMap
* Fixed bug where the address of g_pStaticPropMgr wasn't properly dereferenced and passed to function via its reference (engine addr).
* Fixed dword dereference.

Problems: engine still culls models improperly.
2022-05-01 21:09:05 +02:00
PixieCore
83048e856c Removed debug code. 2022-05-01 20:58:24 +02:00
PixieCore
51ace16074 Fix CBaseClientState pointer vars. 2022-05-01 20:57:08 +02:00
Kawe Mazidjatari
4877666fe9 Update bsplib.cpp 2022-05-01 18:00:15 +02:00
Kawe Mazidjatari
f036f2cc44 BuildPropStaticFrustumCullMap optimizations 2022-05-01 17:59:56 +02:00
Kawe Mazidjatari
a479b4ac78 See description
Fixed rare crash in CMDLCache when buffer itteration returns invalid pointer (not null!) for handle.

Made all variables and functions used by BuildPropStaticFrustumCullMap searched dynamically (these should also work on s0, s1 and s2, they are compared but at the moment untested).

TODO: Fix deref crash properly (see bsplib.cpp l291).
2022-05-01 05:38:51 +02:00
Kawe Mazidjatari
f8f2ce6fa4 Initial working implementation of frustum building in SDK 2022-05-01 01:32:23 +02:00
Kawe Mazidjatari
4ead3ab1c9 Fix rare crash
This crash happens when the BSP is missing a lot of shaders and materials.
The call originates from 'R_DrawWorldMeshesDepthOnly()', but it is unclear which missing shader is causing the nullptr.  checking for a nullptr here should be sufficient to deal with this kind of missing shader
2022-04-30 20:35:08 +02:00
Kawe Mazidjatari
a4314b1c37 Add to other project 2022-04-30 19:05:56 +02:00
Kawe Mazidjatari
7dd107916c Fix rare crash
Rare crash when the sqvm tries to look for an animation sequence on a missing prop_dynamic model (mdl/error.rmdl doesn't support animations), its purely to indicate there is a problem).
2022-04-30 18:59:55 +02:00
Kawe Mazidjatari
97fb3fd8d4 Also lock the upgrade error behind already known bad model handles
Reduce console verbosity
2022-04-30 05:06:59 +02:00
Kawe Mazidjatari
a496254b93 Add mutex for CMDLCache methods
Als fall back to old GatherProps when at least one model is replaced with mdl/error.rmdl as the new GatherProps function does not support this yet.
2022-04-30 03:30:16 +02:00
PixieCore
73dd49e8d1 Start processing of unknown commands print.
* UserMessages need to be properly read like in sub_14028E890
* Started building bf_read
* Clean up will follow later.
2022-04-30 03:00:24 +02:00
Kawe Mazidjatari
1bf7b96641 Only print out missing models once
Don't print duplicated
2022-04-29 22:46:37 +02:00
Kawe Mazidjatari
7441bf156b Return proper studio hardware for mdl/error.rmdl
Now mdl/error.rmdl draws properly
2022-04-29 22:11:35 +02:00
Kawe Mazidjatari
192f9b4a9b Fixup pattern for P_DrawWorldMeshes 2022-04-29 22:07:30 +02:00
Kawe Mazidjatari
d569d58378 Made missing model error handling more robust 2022-04-29 21:05:26 +02:00
Kawe Mazidjatari
30ce3e949f Add ConVar's and hooks for disabling the rendering of world brush entity
This is mainly for development only and in the event so many models/textures/shaders are missing, the engine would effectively crash otherwise (if some of these aren't disabled).
2022-04-29 20:12:54 +02:00
Kawe Mazidjatari
827641b9b1 Early working implementation of the 'mdl/error.rmdl' fallback
Only works for prop_static (for the time being)
Only works for the S3 game_dll.

In order to get this to work: you must set 'old_gather_props' to nun-null and (for certain maps) perform the patch to prevent the frustum culling code to deref a bad pointer (see command 'opcodes test').
2022-04-29 18:25:54 +02:00
Kawe Mazidjatari
3cb4976c23 Start or 'mdl/error.rmdl' fallback implementation (see description)
In 'datacache/mdlcache.cpp' the function 'CMDLCache::FindMDL' attempts to find 'mdl/error.rmdl' and assigns the studiohdr and handle to the members of CMDLFallback.

In 'CMDLCache::FindUncachedMDL' we check if a model exists, if a model does not exist, we replace the studiohdr with the one of error.rmdl we stored in the CMDLFallback structure.

This does actually work (on the dedicated server it doesn't crash at all!), but on the client it crashes when trying to gather props (right before rendering), setting the ConVar* 'old_gather_props' does interesting things (check IDA around this ConVar*). setting this to 1 causes it to crash in another CMDLCache method when trying to deref something in the global cache pool.

This method is easy to rebuild. I will do this soon and attempt to return error.rmdl parts from here as well if results are null (this might actually just work).

Leaving 'old_gather_props' to 0 causes it to crash in the middle of the function which is supposed to gather the props the 'new' way.

The gather props functions are kind of daunting

NOTE: Currently only confirmed to work somewhat properly on the dedicated server for prop_static. prop_dynamic is unconfirmed. And (almost?) works on the client.
2022-04-29 05:30:06 +02:00
PixieCore
1ea4dd6163 Moved SVC_Print::Process to a class method.
* Virtual Method Swap also points to the class method now with some dodgy memory dereferencing.
2022-04-27 18:42:49 +02:00
Kawe Mazidjatari
3736d71bb1 Implement 'net_encryptionEnable' ConVar
This ConVar governs the use of encryption on game packets.
Also removed 'net_toggletrace' ConCommand and added 'net_tracePayload' ConVar as we can no longer hook on-demand as we bound the encryption parameter of the function to a ConVar.
2022-04-27 18:22:08 +02:00
PixieCore
a874d086cb Some defines for clientsdk compilation. 2022-04-27 16:48:18 +02:00
PixieCore
867072e814 SVC_Print::Process will print the server message to console now.
* Added new function to CMemory allowing you to hook a virtual method from a virtual method table.
* Added SVC_Print Class
* Hooked SVC_Print::Process and print the messages the server sends.
*!! Still needs verification for earlier seasons.
2022-04-27 16:29:14 +02:00
Kawe Mazidjatari
6ff10228ee Fix incorrect color code
Added FCVAR_DEVELOPMENTONLY | FCVAR_HIDDEN and fixed FCVAR_DEVELOPMENTONLY | FCVAR_CLIENTDLL
2022-04-26 20:35:51 +02:00
Kawe Mazidjatari
c0511fa8e4 See description
* Add ConVar to allow user to set/unset FCVAR_DEVELOPMENTONLY ConVar's (default behavior would never be hit without this ConVar).
* Add icons to display the flags of a certain CommandBase.
* Fixed Dear ImGui not displaying images correctly (descriptor needs DXGI_FORMAT_R8G8B8A8_UNORM_SRGB due to the nature of this game).
* Dynamically obtain buffer sizes of resources taken from modules.
* Light SDK cleanup.
2022-04-26 20:24:51 +02:00
PixieCore
daf1cfe14d Added CreateInterface typedef to new interaces.h 2022-04-26 16:14:39 +02:00
PixieCore
d5a2c2de09 Forgot proj removes. 2022-04-26 16:11:15 +02:00
PixieCore
8fc2e03772 Remove old interface.h 2022-04-26 15:57:44 +02:00
Kawe Mazidjatari
34502e5147 Make loading required paks per level more reliable
Also seems to work good on the dedicated server
2022-04-25 04:05:42 +02:00
Kawe Mazidjatari
624f91a054 Offset by 12 instead 2022-04-25 03:14:49 +02:00
Kawe Mazidjatari
f425c09608 Default SDL to MSVC 2022-04-25 02:28:02 +02:00
Kawe Mazidjatari
84fe122e43 Update ImGui lib
Update to 1.87
2022-04-24 20:52:40 +02:00
Kawe Mazidjatari
3a46bff5ee Don't update material system configs on the dedicated server 2022-04-24 19:34:14 +02:00
Kawe Mazidjatari
82261f6c56 Small improvements 2022-04-24 19:32:47 +02:00
Kawe Mazidjatari
31b95f41e8 Don't initialize SDL when running naveditor from the commandline
+ some additional cleanup.
TODO: get logging working on command line
2022-04-22 02:33:26 +02:00
Kawe Mazidjatari
a778d910e7 Fix rare crash in naveditor
Running tests in the naveditor without building navigation segfaults the application.

Reduced verbose prints when building navigation.
2022-04-22 02:31:06 +02:00
Kawe Mazidjatari
3ad668e37a Fix script command
Fixed problem where in certain cases input doesn't get compiled at all.
Fixed problem where quote marks don't get passed correctly to the execute wrapper function.

problems:
passing non-string object as reference to constructor.
using CCommand::Arg(index) seems to 'strip' quote marks from the actual buffer.
2022-04-22 02:27:35 +02:00
Kawe Mazidjatari
02cbb36474 Improved script commands
Quotes are no longer needed
2022-04-19 22:47:58 +02:00