55#include " EngineDemoPlayer.hpp"
66#include " EngineDemoRecorder.hpp"
77#include " Event.hpp"
8+ #include " InputSystem.hpp"
89#include " Features/Camera.hpp"
910#include " Features/Cvars.hpp"
1011#include " Features/Demo/DemoParser.hpp"
@@ -57,6 +58,9 @@ Variable sar_cm_rightwarp("sar_cm_rightwarp", "0", "Fix CM wrongwarp.\n");
5758REDECL (Engine::Disconnect);
5859REDECL (Engine::SetSignonState);
5960REDECL (Engine::ChangeLevel);
61+ #ifndef _WIN32
62+ REDECL (Engine::GetMouseDelta);
63+ #endif
6064REDECL (Engine::Frame);
6165REDECL (Engine::PurgeUnusedModels);
6266REDECL (Engine::OnGameOverlayActivated);
@@ -305,6 +309,14 @@ DETOUR(Engine::ChangeLevel, const char *s1, const char *s2) {
305309 return Engine::ChangeLevel (thisptr, s1, s2);
306310}
307311
312+ #ifndef _WIN32
313+ // CVEngineClient::GetMouseDelta
314+ DETOUR_T (void , Engine::GetMouseDelta, int &x, int &y, bool ignore_next) {
315+ Engine::GetMouseDelta (thisptr, x, y, ignore_next);
316+ inputSystem->DPIScaleDeltas (x, y);
317+ }
318+ #endif
319+
308320void Engine::GetTicks (int &host, int &server, int &client) {
309321 auto &et = this ->engineTool ;
310322 using _Fn = int (__rescall *)(void *thisptr);
@@ -773,7 +785,7 @@ DETOUR(Engine::DestroyDebugMesh, int vertCount, Vector *verts) {
773785}
774786
775787bool Engine::Init () {
776- this ->engineClient = Interface::Create (this ->Name (), " VEngineClient015" , false );
788+ this ->engineClient = Interface::Create (this ->Name (), " VEngineClient015" );
777789 this ->s_ServerPlugin = Interface::Create (this ->Name (), " ISERVERPLUGINHELPERS001" , false );
778790
779791 if (this ->engineClient ) {
@@ -792,6 +804,10 @@ bool Engine::Init() {
792804 this ->GetLevelNameShort = this ->engineClient ->Original <_GetLevelNameShort>(Offsets::GetLevelNameShort);
793805 this ->GetLightForPoint = this ->engineClient ->Original <_GetLightForPoint>(Offsets::GetLightForPoint);
794806
807+ #ifndef _WIN32
808+ this ->engineClient ->Hook (Engine::GetMouseDelta_Hook, Engine::GetMouseDelta, Offsets::GetMouseDelta);
809+ #endif
810+
795811 Memory::Read<_Cbuf_AddText>((uintptr_t )this ->ClientCmd + Offsets::Cbuf_AddText, &this ->Cbuf_AddText );
796812#ifndef _WIN32
797813 if (sar.game ->Is (SourceGame_EIPRelPIC)) {
0 commit comments