Raised This Month: $51 Target: $400
 12% 

[CS:GO] Calling source's internal Lag-Compensation functions?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kinsi
Senior Member
Join Date: Apr 2013
Old 05-17-2017 , 16:50   [CS:GO] Calling source's internal Lag-Compensation functions?
Reply With Quote #1

Hey there,

i have no experience in regards to extensions, just plugins, thus i am wondering if it would be possible to create an extension which would allow to call Source's internal lag-compensation functions, namely StartLagCompensation and FinishLagCompensation, ideally by passing the client index and cmdNum to it ofc.

Is such a thing possible? Possibly even right from SM instead of using a custom extension to create a "bridge" ?

Thanks!

Last edited by Kinsi; 05-17-2017 at 20:29.
Kinsi is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 05-17-2017 , 20:23   Re: [CS:GO] Calling source's internal Lag-Compensation functions using an extension?
Reply With Quote #2

Alright i now have a rough idea how this (might) be possible to do. I've used IDA to get the signatures of said functions and created a gamedata file for them.

I dont see a problem with implementing the FinishLagCompensation as it just requires a CBasePlayer to be passed, which sdkcalls conveniently has pre-implemented, however StartLagCompensation requires a CUserCmd as the second parameter, and i've yet to find out how i am supposed to pass, or even get that correctly.

Edit: Currently trying to work around this by just using BacktrackPlayer and giving it a self-calculated time

Last edited by Kinsi; 05-17-2017 at 20:43.
Kinsi is offline
Byte
Senior Member
Join Date: Jun 2010
Location: 📦 CCSPlayer
Old 05-17-2017 , 21:13   Re: [CS:GO] Calling source's internal Lag-Compensation functions?
Reply With Quote #3

May I ask what you are trying to achieve? Sounds interesting.
__________________
STEAM: /id/invexbyte | Github: Mo Beigi | Discord: Byte#0017
Community: Invex Gaming | My Plugins: Click Me!

Byte is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 05-17-2017 , 21:18   Re: [CS:GO] Calling source's internal Lag-Compensation functions?
Reply With Quote #4

Need to revert (some) players back in time by N ticks to do some calculations for a gamemode im working on (raytraces).

Cant give any infos on the gamemode atm as i am trying to keep it secret until its done, but it will be pretty huge (Hopefully at least).
Kinsi is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 05-17-2017 , 22:40   Re: [CS:GO] Calling source's internal Lag-Compensation functions?
Reply With Quote #5

Alright, seems like CS:GO is using an outdated (?) version of lag compensation. I just checked out an old(er) version and it doesnt contain the "BacktrackPlayer" function, merely a (custom?) version of "BacktrackEntity" which is defined as the following in CS:GO. It seems to be the same situation for the latest binaries as i was unable to find it there either.

PHP Code:
BacktrackEntity(CBaseEntity *,float,CUtlFixedLinkedList<LagRecord> *,LagRecord*,LagRecord*,bool
needless to say, i guess im better of calling StartLagCompensation. But now that i see it, it looks like StartLagCompensation differs from the one in SE2013 as well

PHP Code:
CLagCompensationManager::StartLagCompensation(CBasePlayer *,LagCompensationType,Vector const&,QAngle const&,float
Now i need to find out what i need to pass to that :puke: Im heading out for now. If somebody has experience with this stuff and is interested to help i'd appreciate that a lot.

Last edited by Kinsi; 05-17-2017 at 22:41.
Kinsi is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 05-19-2017 , 14:44   Re: [CS:GO] Calling source's internal Lag-Compensation functions?
Reply With Quote #6

Well, either my sig is wrong, Valve changed the code yet another time in the meanwhile, or i just have no idea what i am doing.

Plattform: Windows.

Sig: \x55\x8B\xEC\x83\xE4\xF8\x83\xEC\x48\x56\x8B\ xF1\xC7\x44\x24\x48\x00\x00\x00\x00 (StartLagCompensation)

Code:

PHP Code:
StartPrepSDKCall(SDKCall_Static);
PrepSDKCall_SetFromConf(hConfigSDKConf_Signature"StartLagCompensation");
PrepSDKCall_AddParameter(SDKType_CBasePlayerSDKPass_Pointer);
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
PrepSDKCall_AddParameter(SDKType_VectorSDKPass_ByRef);
PrepSDKCall_AddParameter(SDKType_QAngleSDKPass_ByRef);
PrepSDKCall_AddParameter(SDKType_FloatSDKPass_Plain);
g_hStartLagCompensationCall EndPrepSDKCall();

float tmporigin1[3];
float tmporigin2[3];
float tmporigin3[3];

GetEntDataVector(clientCBaseEntity_vecOrigintmporigin3);

SDKCall(g_hStartLagCompensationCallclient0tmporigin1tmporigin22.0); 
As i have no idea what the Vector or QAngle are meant to represent i just passed empty ones thinking they will be filled with some info as they are by reference but the call results in the server crashing.

Last edited by Kinsi; 05-19-2017 at 15:52.
Kinsi is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-19-2017 , 16:10   Re: [CS:GO] Calling source's internal Lag-Compensation functions?
Reply With Quote #7

I haven't really looked over the rest, but to start, you're missing the |this| pointer. You need to find in memory, probably best with address gamedata, a pointer to the instance of the CLagCompensationManager to be able to call a member function on it. Unlike player/entity and gamerules thiscalls, SM does not have a built-in type for this.
psychonic is offline
Kinsi
Senior Member
Join Date: Apr 2013
Old 05-19-2017 , 16:30   Re: [CS:GO] Calling source's internal Lag-Compensation functions?
Reply With Quote #8

I have just noticed this as well, glad i am on the right path. I've checked out the implementation again and looks like a CLagCompensationManager gets defined with the name ... "CLagCompensationManager", its the same in the SE13 so its getting my hopes high. Seeing as the name passed doesnt get used in any way i suppose it is just a wrapper class (?). So now i've tried to create an instance of the class myself by calling CLagCompensationManager, which doesnt crash the server and even returns something. Unfortunately i dont think im on the right path though as it returns the same when called multiple times (?)

PHP Code:
StartPrepSDKCall(SDKCall_Static);
PrepSDKCall_SetFromConf(hConfigSDKConf_Signature"CLagCompensationManager");
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Plain);
PrepSDKCall_SetReturnInfo(SDKType_PlainOldDataSDKPass_Pointer);
g_hCLagCompensationManagerCall EndPrepSDKCall();

Address cPointer SDKCall(g_hCLagCompensationManagerCall"CLagCompensationManager"); 
Sig: \x68\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\ x2A\x2A\x2A\x2A\xC7\x05\x2A\x2A\x2A\x2A\x2A\x 2A\x2A\x2A\xB8\x2A\x2A\x2A\x2A\xC7\x05\x2A\x2 A\x2A\x2A\x2A\x2A\x2A\x2A\xC7\x05\x2A\x2A\x2A \x2A\x2A\x2A\x2A\x2A\xC7\x05\x2A\x2A\x2A\x2A\ x00\x00\x00\x00\xC7\x05\x2A\x2A\x2A\x2A\x00\x 00\x00\x00\xC7\x05\x2A\x2A\x2A\x2A\x00\x00\x0 0\x00

Needless to say that changing the sdkcall to the start function to raw and passing this address still crashes the server.
Edit: It doesnt crash it, but it freezes which i guess is the same. Code past the start call wont get executed either.

Quote:
Originally Posted by psychonic View Post
probably best with address gamedata
Could you give me a hint towards address gamedata? This is literally the first time i am attempting to do "low level stuff", the stripped symbols arent really helping me either

Edit2: Nvm didnt realize that the lagrecord values are stored in the class instant and not in a global, so ill be needing to find the pre-defined global.. somehow.

Last edited by Kinsi; 05-19-2017 at 18:27.
Kinsi is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 05-20-2017 , 19:24   Re: [CS:GO] Calling source's internal Lag-Compensation functions?
Reply With Quote #9

Quote:
Originally Posted by Kinsi View Post
Could you give me a hint towards address gamedata?
https://forums.alliedmods.net/showthread.php?t=285833
Potato Uno is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode