Change callbacks actually take a structure of 2 pointers, one being for the callback itself, and the other being 'userdata' which typically is used to sync the ConVar with VGUI slider elements. This issue was noticed after implementing the ADS scalars and attempting to hook them up to VGUI, only to find out it would crash due to this lacking detail. All change callback prototypes had to be adjusted.
Implemented by popular demand. Allows setting different sensitivity values per optic zoom level on a weapon. The mouse input handler already had this, but the controller one didn't so it had to be implemented here.
This function didn't decompile properly, so a bunch of manual assembly work had to be used to reconstruct the truncated bits. The code does work correct for the most part. The call to the subroutine 'sub_1405AD760' has been commented as the parameter appears incorrect; passes in the address of a bool but indexes 4 bytes outside the size of a bool. Most likely incorrect decompile/disasm. Currently being investigated.
Mutex is technically no longer needed as imgui now draws in main and gets buffer swapped / rendered in the render thread just like the rest of the game. But the mutex was still in because of the shared script function 'Script_GetAvailablePlaylists' that can be used on the server. Both the 'playlist_reload' and 'downloadPlaylists' commands will now join the active server job if ran to prevent crashing in the engine or sdk when ran during the game.
There was also a performance difference between 'playlist_reload' and 'downloadPlaylists' while the commands are identical. There was a bug where the 'playlist_reload' one called 'Playlists_SDKInit' twice. This has also been fixed in this commit.
Properly load it from CServerGameDLL::DLLInit (and new in this commit, the client's shared globals from CHLClient::Init), this way we can also avoid the double dereference which improves performance. Also performed an architectural change where anything outside Game DLL code uses the shared interface pointer instead of the objects directly.
Use Min instead of an inline check, this generates better assembly code. Also made all the used defines a float to avoid having to cast each time since we aren't working with double precision floating points here.
The interface layout and implementation in the SDK was different than that of the engine. This has been changed to maintain ABI compatibility and to ensure the same values are generated.
This is required as otherwise arrays will be out of alignment, e.g. CPlayer::m_playerKnockBacks was off with 4 bytes on the next array element as it was aligned to a 4 byte boundary while it contains a virtual function table pointer.
Some methods had missing parameters, and this interface expects CBaseHandle being passed in as a reference, which explains why GetClientEntityFromHandle() didn't work properly in the past.