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.
Member m_RefEHandle is always at offset 8 for Server and Client BaseEntity class. The onyl way to achieve this is to put this into the IHandleEntity interface, as otherwise it will be placed after the interface pointers in C_BaseEntity for client. This also eliminates the need of padding at the beginning of both the server and client's version of the BaseEntity class. The IClientEntity interface has also been properly reversed and applied to the SDK now, the unknown vftable entries have now been identified correctly and moved to IClientUnknown .