 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
PinPoint Expert Cheater
Reputation: 10
Joined: 07 Apr 2016 Posts: 223 Location: Scotland
|
Posted: Mon Aug 08, 2016 6:02 pm Post subject: Created thread isn't doing what I think it should be doing |
|
|
Long story short, I made a no recoil hack for KF2 and used createthread() to do so as the pointers I managed to get change in relation to the weapon you are holding. So by using createthread to write to the pointers value(s) it saves have a pointer for each weapon or manually entering a value each time a weapon is changed. I can use AOB injection on the instructions that write to them (which took forever to find filters for) but dont want to only use this method in all the hacks I make.
so, the problem... the thread only seems to write the values twice then stop. I added a counter that I defined as 00 and added an "inc [counter]" (as well as an "add byte ptr [counter],1" when this didnt work) before the code that writes to the pointer values to check and it only ever went up to 2.
In my head from following the code, it should be writing to the pointer values every half second
this is my script:
Code: | [ENABLE]
globalalloc(no_recoil,2048)
CREATETHREAD(no_recoil)
registersymbol(end)
label(skip)
label(end)
no_recoil:
mov eax,["KFGame.exe"+02184280]
test eax,eax
je skip
mov eax,[eax+70]
test eax,eax
je skip
mov eax,[eax+40]
test eax,eax
je skip
mov eax,[eax+7f4]
test eax,eax
je skip
mov eax,[eax+4a4]
test eax,eax
je skip
mov [eax+7B8],0
mov [eax+7BC],0
mov [eax+7C0],0
mov [eax+7C4],0
skip:
push #500
call sleep
cmp [end],01
jne no_recoil
ret
end:
dd 0
[DISABLE]
end:
dd 01
|
I added the test eax,eax parts as there was a crash when it was activated before entering the map, but even with this gone it still doesnt write to the pointers value when i change weapon (or count up the counter I had added)
I know this isnt really necessary for what anyone really needs but it would be tidy to just have the one toggleable script to make everything have no recoil instead of having the pointer in the table to be manually changed each time a weapon is changed.
Am I missing something obvious?
edit: I just realised this is a 64bit game so ive changed the sleep part to
Code: |
push eax
mov eax,#500
call kernel32.sleep
pop eax
cmp [end],01
jne no_recoil
ret |
although no difference
|
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Mon Aug 08, 2016 6:16 pm Post subject: |
|
|
Code: | SUB RSP,20
MOV RCX,#500
CALL SLEEP
ADD RSP,20 |
|
|
Back to top |
|
 |
PinPoint Expert Cheater
Reputation: 10
Joined: 07 Apr 2016 Posts: 223 Location: Scotland
|
Posted: Mon Aug 08, 2016 6:23 pm Post subject: |
|
|
thats brilliant and working methos thanks.
I am assuming this is keeping the alignment of the stack and allocating the space for the pointer values?
if it were only 8bytes worth or values would the push/pop have wokred in the same way?
|
|
Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Mon Aug 08, 2016 6:35 pm Post subject: |
|
|
In case you need stack alignment and reservation, yes. I did not include any push/pop, but figured you knew if/when to include them. I am not an expert...this is my understanding.
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Tue Aug 09, 2016 12:14 pm Post subject: |
|
|
64bit applications. About registers and calling:
https://msdn.microsoft.com/en-us/library/6t169e9c.aspx
https://msdn.microsoft.com/en-us/library/984x0h58.aspx
https://msdn.microsoft.com/en-us/library/ms235286.aspx
Quote: | The caller is responsible for allocating space for parameters to the callee, and must always allocate sufficient space to store four register parameters, even if the callee doesn’t take that many parameters. This simplifies support for unprototyped C-language functions, and vararg C/C++ functions. For vararg or unprototyped functions, any floating point values must be duplicated in the corresponding general-purpose register. Any parameters beyond the first four must be stored on the stack, above the shadow store for the first four, prior to the call. Vararg function details can be found in Varargs. Unprototyped function information is detailed in Unprototyped Functions. |
Quote: | The registers RAX, RCX, RDX, R8, R9, R10, R11 are considered volatile |
In some games those registers are considered volatile:
RAX, RBX, RCX, RDX, R8, R9, R10, R11
_________________
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|