Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Need help converting Auto Press Key Script for Gamepad

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
SparkleArts
How do I cheat?
Reputation: 0

Joined: 11 Dec 2020
Posts: 5
Location: Germany

PostPosted: Mon Dec 19, 2022 8:24 am    Post subject: Need help converting Auto Press Key Script for Gamepad Reply with quote

I have an Auto Counter Script for Shadow of War that works with Keyboard really good but I want to use it with Gamepad.

But this need to change the Auto Press Key Script to make it compatible to Gamepad.

Code:

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
registersymbol(counterattack3)
aobscanmodule(counterattack3,shadowofwar.exe,8A 84 11 08 02 00 00 88 44 11 08 48 FF C2)
alloc(newmem,2048,counterattack3)
GLOBALALLOC(times,4)
GLOBALALLOC(times2,4)
GLOBALALLOC(times3,4)
label(returnhere)
label(originalcode)
label(exit)
label(autocounter)
label(ekeycounter)

label(zero1)
label(zero2)
label(zero3)
label(intime)
label(red)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here

push rbx
push rdi
push rax


cmp rdx,55  //counter key "U" intime counter
je intime

cmp rdx,4c //counter key "L" RED counter
je red

cmp rdx,4a //counter key "E" KEY counter
je ekeycounter

jmp originalcode

intime:
mov rbx,times2
mov rdi,[rbx]
cmp rdi,01 //delay loop
jge zero1
cmp byte [countertag],01
je autocounter
cmp byte [countertagsr1],01
je autocounter
mov byte [rcx+rdx+00000208],00
jmp originalcode

red:
mov rbx,times
mov rdi,[rbx]
cmp rdi,01 //delay loop
jge zero2

mov rax,[redcountertag]
test rax,rax
jz originalcode
cmp byte [rax],02
je autocounter
mov byte [rcx+rdx+00000208],00
jmp originalcode

ekeycounter:
mov rbx,times3
mov rdi,[rbx]
cmp rdi,01 //delay loop
jge zero3

cmp byte [countertagsre],01
je autocounter
mov byte [rcx+rdx+00000208],00
jmp originalcode

//autocounter2:
//inc rdi
//mov [rbx],rdi
//mov byte [rcx+rdx+00000208],01
//jmp originalcode

autocounter:
inc rdi
mov [rbx],rdi
mov byte [rcx+rdx+00000208],01
jmp originalcode

zero1:
mov byte [countertag],00
mov byte [countertagsr1],00
mov [rbx],0
xor rdi,rdi
mov byte [rcx+rdx+00000208],0
jmp originalcode

zero2:
mov [rbx],0
xor rdi,rdi
mov byte [rcx+rdx+00000208],0
jmp originalcode

zero3:
mov byte [countertagsre],00
mov [rbx],0
xor rdi,rdi
mov byte [rcx+rdx+00000208],0
jmp originalcode


originalcode:
pop rax
pop rdi
pop rbx
mov al,[rcx+rdx+00000208]
jmp exit

exit:
jmp returnhere

counterattack3:
jmp newmem
nop
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
unregistersymbol(counterattack3)
counterattack3:
//mov al,[rcx+rdx+00000208]
db 8A 84 11 08 02 00 00

_________________
Call me KitsuneHD because I'm a cute Kitsune, lol.
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Mon Dec 19, 2022 10:57 pm    Post subject: Reply with quote

You need to update a section of the code:

Quote:
cmp rdx,55 //counter key "U" intime counter
je intime

cmp rdx,4c //counter key "L" RED counter
je red

cmp rdx,4a //counter key "E" KEY counter
je ekeycounter


To register the gamepad keys.

Just google the keycodes or use something like spy++ to read what the controller sends to the window and capture that.
Back to top
View user's profile Send private message
SparkleArts
How do I cheat?
Reputation: 0

Joined: 11 Dec 2020
Posts: 5
Location: Germany

PostPosted: Thu Dec 22, 2022 4:45 am    Post subject: Reply with quote

cooleko wrote:
You need to update a section of the code:

Quote:
cmp rdx,55 //counter key "U" intime counter
je intime

cmp rdx,4c //counter key "L" RED counter
je red

cmp rdx,4a //counter key "E" KEY counter
je ekeycounter


To register the gamepad keys.

Just google the keycodes or use something like spy++ to read what the controller sends to the window and capture that.


I did this but it seems it changed into keyboard automatically because for some reason it presses the Keyboard Input for some reason, but not the gamepad input.

_________________
Call me KitsuneHD because I'm a cute Kitsune, lol.
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Fri Dec 23, 2022 11:40 am    Post subject: Reply with quote

If Spy++ shows that the window is receiving the keyboard key, then the script should work when triggering off that keyboard key if it is running the window from the process.

Can you clearly delineate the steps you have taken so far and what the observations were?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites