|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Unicorngoulash Newbie cheater Reputation: 0
Joined: 19 Apr 2018 Posts: 19 Location: Netherlands
|
Posted: Sat Oct 27, 2018 10:28 pm Post subject: Can anyone help me adding Xbox buttons to a script? |
|
|
Ok here's the script.
What I would like is to add a function that activates the script when I hold the LT+RT buttons but as soon as I let go that it disables the script.
[ENABLE]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem:
push eax
mov eax,dword ptr [ePSXe.exe+AEC115]
cmp dword ptr [ePSXe.exe+AEC060],21
cmovz eax,[newvalue]
mov dword ptr [ePSXe.exe+AEC115],eax
pop eax
push eax
mov eax,dword ptr [ePSXe.exe+AEC115]
cmp dword ptr [ePSXe.exe+AEC060],10
cmovz eax,[newvalue]
mov dword ptr [ePSXe.exe+AEC115],eax
pop eax
jmp return
code:
// ...
newvalue:
dd 1
return:
originalcode:
mov [eax+ePSXe.exe+A82020],dl
exit:
jmp returnhere
"ePSXe.exe"+65260:
jmp newmem
nop
returnhere:
[DISABLE]
dealloc(newmem)
"ePSXe.exe"+65260:
mov [eax+ePSXe.exe+A82020],dl
//Alt: db 88 90 20 20 74 01
|
|
Back to top |
|
|
OldCheatEngineUser Whateven rank Reputation: 20
Joined: 01 Feb 2016 Posts: 1587
|
Posted: Sun Oct 28, 2018 3:51 am Post subject: |
|
|
editing your script:
Code: | [ENABLE]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
label(newvalue) // not needed ... but good
newmem:
push eax
mov eax,dword ptr [ePSXe.exe+AEC115]
cmp dword ptr [ePSXe.exe+AEC060],21 // 33 decimal
cmovz eax,[newvalue] // 1
mov dword ptr [ePSXe.exe+AEC115],eax
// pop eax
// push eax
mov eax,dword ptr [ePSXe.exe+AEC115]
cmp dword ptr [ePSXe.exe+AEC060],10 // 16 decimal
cmovz eax,[newvalue] // 1
mov dword ptr [ePSXe.exe+AEC115],eax
pop eax
originalcode:
mov [eax+ePSXe.exe+A82020],dl
exit:
jmp returnhere
newvalue:
dd 1
{
jmp return
code: ///// you dont need these labels, these are used for aob template
return:
}
"ePSXe.exe"+65260:
jmp newmem
nop
returnhere:
[DISABLE]
dealloc(newmem)
"ePSXe.exe"+65260:
mov [eax+ePSXe.exe+A82020],dl
//Alt: db 88 90 20 20 74 01 |
_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote: | i am a sweetheart. |
|
|
Back to top |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Sun Oct 28, 2018 4:49 am Post subject: |
|
|
3 options in preferable order:
1. Code in logic for detecting LT+RT triggers into the script itself
2. Use CE's Lua scripting to setup a timer that constantly checks for Xbox controller state and activate and deactivate the script correspondinly.
3. Use AutoHotKey to detect the LT+RT triggers and correspondingly press hotkeys to activate and deactivate the script. Could cause latency issues due to cross-program interoperability.
For 1, you would need to find the memory location where the xinput or directinput buttons are being recorded. You will need to know the xinput scan codes to be able to search for it, google is your friend. For directinput gamepad i believe the triggers are on a single axes and treated as a single button so probably a float or double and a boolean/byte flag.
For 2, use this script: Code: | function xboxCheck()
al = getAddressList()
mr = al.getMemoryRecordByDescription("INSERT YOUR SCRIPT DESCRIPTION HERE")
xboxState = getXBox360ControllerState()
if (not mr.Active and xboxState[GAMEPAD_LEFT_SHOULDER] and xboxState[GAMEPAD_RIGHT_SHOUDLER]) then
mr.Active = true
else if (mr.Active and not (xboxState[GAMEPAD_LEFT_SHOULDER] and xboxState[GAMEPAD_RIGHT_SHOUDLER])) then
mr.Active = false
end
end
TriggerTimer = createTimer()
TriggerTimer.setInterval(100)
TriggerTimer.onTimer(xboxCheck)
TriggerTimer.setEnabled(true)
|
For 3, google for AutoHotkey and go read its tutorials and documentation. I highly recommend not using this method unless there are no other options.
|
|
Back to top |
|
|
Unicorngoulash Newbie cheater Reputation: 0
Joined: 19 Apr 2018 Posts: 19 Location: Netherlands
|
Posted: Sun Oct 28, 2018 5:00 am Post subject: |
|
|
Thank you for helping me out man, really appreciate it. I'm really new to scripting. I managed to do some succesfull one's but some scripts seem to be turning themselves off for some reason. 2 in particular. But i'll share the most troubling one.
Spyro 2
"Walking on lava turns on invincibility (Walk on lava)"
It's a Spyro 2 code where ground value is 255(FF)Lava 192&193(C0/C1) Invincibillity is 27(1B) and 0 to turn it off. What I did here actually works but sometimes it just disables itself, usually after changing a level I have to re-eactivate the code.
[ENABLE]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem:
push eax
mov eax,dword ptr [ePSXe.exe+AEC1E4]
cmp dword ptr [ePSXe.exe+AEC124][ePSXe.exe+AEC128],C0
cmovz eax,[newvalue]
mov dword ptr [ePSXe.exe+AEC1E4],eax
pop eax
push eax
mov eax,dword ptr [ePSXe.exe+AEC1E4]
cmp dword ptr [ePSXe.exe+AEC124][ePSXe.exe+AEC128],C1
cmovz eax,[newvalue2]
mov dword ptr [ePSXe.exe+AEC1E4],eax
pop eax
push eax
mov eax,dword ptr [ePSXe.exe+AEC1E4]
cmp dword ptr [ePSXe.exe+AEC124][ePSXe.exe+AEC128],FF
cmovz eax,[newvalue3]
mov dword ptr [ePSXe.exe+AEC1E4],eax
pop eax
jmp return
newvalue:
dd 1B
newvalue2:
dd 1B
newvalue3:
dd 0
return:
originalcode:
mov [eax+ePSXe.exe+A82020],edx
exit:
jmp returnhere
"ePSXe.exe"+650F0:
jmp newmem
nop
returnhere:
[DISABLE]
dealloc(newmem)
"ePSXe.exe"+650F0:
mov [eax+ePSXe.exe+A82020],edx
//Alt: db 89 90 20 20 C0 00
|
|
Back to top |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Sun Oct 28, 2018 5:27 am Post subject: |
|
|
Unicorngoulash wrote: | usually after changing a level I have to re-eactivate the code |
do you mean changing level as in like game level or as in vertical position? if its the former it's probably hard coded in game that the developer cheat flags get reset when the map changes. you have to "find out what writes to" that flag position and disable (nop) the offending assembly instructions which you can also write as a script or add it into an existing one as shown:
Code: | [ENABLE]
aobscanmodule(aob_invincivilityNOP,ePSXe.exe,FF FF FF FF FF FF FF FF)
registersymbol(aob_invincivilityNOP)
aob_invincivilityNOP:
db 90 90 90 90 // 0x90 is the machine code for NOP
// Alternatively
nop
nop
nop
nop
[DISABLE]
aob_invincivilityNOP:
db FF FF FF FF
unregistersymbol(aob_invincivilityNOP) |
P.S. use the [code] tag when posting code as OldCheatEngineUser did for you
|
|
Back to top |
|
|
Unicorngoulash Newbie cheater Reputation: 0
Joined: 19 Apr 2018 Posts: 19 Location: Netherlands
|
Posted: Sun Oct 28, 2018 7:01 am Post subject: |
|
|
Well to add to the weirdness, I do actually mean change of levels as in area's.
But something weird occured. The code is working rather well now.... but too well. It seems the game keeps it in memory. When I shut of the script and cheat engine ePSXe still thinks that when being on lava it has to turn on invincibillity. I checked my entire process list, I had all instances of cheat engine closed. But perhaps the script has some sort of memory leak. The game crashes but only when I close it. It's a pretty hefty table I"m working with probably over 200 codes and hotkey mappings for the xbox controller. It takes about 57.4mb in te memory table itself is 272kb
|
|
Back to top |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Sun Oct 28, 2018 7:32 am Post subject: |
|
|
As I said, since it's changing areas, it's hard coded into the game's logic to clear the invincibility flag when area is changed. So it's not weird at all from my understanding. Based on the scripts you gave, that invincibility flag and other developer menu cheat flags are not reset back to their original value even when you close CE so the game still thinks it should give the player invincibility and whatever cheat you activated before. You can try to test my hypothesis here by using your original CE table, and tell me it proves wrong.
I have no idea why the game crashes without more information. Maybe tell us how much memory CE is using in task manager when you have all the cheats you use normally activated.
By the way, you can use the {$LUA}{$ASM} tags to include a Lua script within an Auto Assembler cheat entry. To give you an idea how it may be used:
Parent script with Lua code for timers checking gamepad state
--> Children AA scripts
Then let the parent entry hide children when deactivated so users will always have to first activate the parent script first to create the timers.
EDIT: By "57.4mb in te" do you mean in task manager? If so maybe try not creating so many timers. For the cheats you want activated using the same button combination, use one single timer to toggle them instead.
|
|
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
|
|