View previous topic :: View next topic |
Author |
Message |
laowang How do I cheat?
Reputation: 0
Joined: 04 Nov 2021 Posts: 2
|
Posted: Thu Nov 04, 2021 12:15 am Post subject: How to print register value whenever the instruction is bein |
|
|
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem:
mov [eax+00005578],ecx
????
....
code inject / How to print [eax] to console
I have just started learning CE so simple answers will be appreciated, thanks.
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4696
|
Posted: Thu Nov 04, 2021 1:46 am Post subject: |
|
|
Maybe using "Find out what addresses this instruction accesses" in the right click menu of the disassembler would be better?
You could use the new {$luacode} feature.
https://forum.cheatengine.org/viewtopic.php?t=618134
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Thu Nov 04, 2021 1:52 am Post subject: |
|
|
You should use code tags when posting code.
(code)
... code here ...
(/code)
Note: replace parentheses "()" with square brackets "[]"
One way you can achieve this is like so:
Code: |
[ENABLE]
...
alloc(newmem,2048)
alloc(registerToConsole,8) // use 4 if 32-bit
label(returnhere)
label(originalcode)
label(exit)
newmem:
mov [eax+00005578],ecx
mov [registerToConsole],eax
return:
// ...
{$LUA}
local eax = getAddressSafe('[registerToConsole]')
print(string.format("%X", eax))
{$ASM}
//...
|
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Thu Nov 04, 2021 5:25 am Post subject: |
|
|
Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem:
mov [eax+00005578],ecx
{$luacode r1=eax r2=ecx}
printf("eax=%x ecx=%x address=%x", r1,r2,r1+0x5578)
{$asm}
...
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
MH00 Newbie cheater
Reputation: 0
Joined: 29 Jul 2024 Posts: 10 Location: Ohio
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Mon Oct 07, 2024 1:06 pm Post subject: |
|
|
execute it once regardless of the error
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
MH00 Newbie cheater
Reputation: 0
Joined: 29 Jul 2024 Posts: 10 Location: Ohio
|
Posted: Fri Oct 11, 2024 8:17 am Post subject: Crash the browser |
|
|
I tried that and the browser crashed. I used the debugger - jmp to the inject, then call to routine which saved to the stack then call to another routine which caused the window to disappear because the browser crashed.
I can copy the code if you wish to see this part.
|
|
Back to top |
|
 |
MH00 Newbie cheater
Reputation: 0
Joined: 29 Jul 2024 Posts: 10 Location: Ohio
|
Posted: Thu Oct 24, 2024 11:27 pm Post subject: |
|
|
The browser crashes when I try to use $luacode - what am I missing or what am I doing wrong that there is a complete crash when I try to do a simple print inside $luacode section??
Also - how do I get $lua to work with every inject code instead of only when I inject but not with each invoke of the injection? What am I miswing or doing wrong to be able to use $lua??
|
|
Back to top |
|
 |
jgoemat Master Cheater
Reputation: 23
Joined: 25 Sep 2011 Posts: 264
|
Posted: Fri Jan 24, 2025 11:34 pm Post subject: |
|
|
Wow, learning something new every day! {luacode} worked fine for me, just tried it with a function I was hooking in 7 days to die. It's executed each frame, so I did this right after enable:
Code: | [enable]
{$lua}
lc = 0
{$asm} |
Then in the injection:
Code: | newmem:
{$luacode r1=ecx}
lc = lc + 1
if lc > 100 then
printf("ecx=%x", r1)
lc = 0
end
{$asm} |
No errors for me, I'm using CE 7.6.0 if that matters.
The normal {$lua} ... {$asm} block only executes when the script is syntax checked when saving or when the code is assembled, not each time the injected code is called by the game.
|
|
Back to top |
|
 |
|