| View previous topic :: View next topic |
| Author |
Message |
~lev How do I cheat?
Reputation: 0
Joined: 05 Jan 2016 Posts: 2
|
Posted: Tue Jan 05, 2016 3:12 pm Post subject: CE hangs injection with aobscan + lua Active=true |
|
|
Hi All,
This might be a stupid question (if so then sorry, I've just started with CE)
I've a simple aobscan injection:
| Code: |
[ENABLE]
//aobscanmodule(INJECT,game.exe,F3 0F 11 81 A0 01 00 00 5D)
alloc(newmem,$1000)
label(code)
label(return)
newmem:
code:
movss [ecx+000001A0],xmm0
jmp return
"game.exe"+DB6140:
//INJECT:
jmp code
nop
nop
nop
return:
//registersymbol(INJECT)
[DISABLE]
"game.exe"+DB6140:
//INJECT:
db F3 0F 11 81 A0 01 00 00
//unregistersymbol(INJECT)
dealloc(newmem)
|
and a LUA script:
| Code: |
d3dhook_initializeHook()
d3dhook_onKey(keydown)
selectedOption=1
Option1State=false
function ExecuteSelectedOption()
if (selectedOption==1) then
Option1State=not Option1State
if (Option1State) then
getAddressList().getMemoryRecordByDescription("TestHack").Active=true
else
getAddressList().getMemoryRecordByDescription("TestHack").Active=false
end
end
end
function keydown(virtualkey,char)
selectedOption=0
if (virtualkey==VK_L) then
selectedOption=1
end
ExecuteSelectedOption()
return true
end
|
So when I hit the 'L key' in the game it activates my cheat.
But I have had enough of finding the correct address again and again whenever the game gets an update, so I've decided to move to aobscan.
It works fine when from the above code I uncomment everything and comment out the hardcoded addresses: ("game.exe"+DB6140:)
In cheatengine I can still click on the Activate checkbox to activate and deactivate my cheat.
BUT if I hit the 'L key', CE freezes.
What am I missing?
I would be glad for any help.
Thanks in advance
~lev
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25815 Location: The netherlands
|
Posted: Tue Jan 05, 2016 3:24 pm Post subject: |
|
|
hmm. It could be a threading issue where the memory scan does something to the main thread. But since OnKeyDown is called in 'synchronize call' it never gets to...
instead of a memory record try using the memscan class object in lua
Or just simply spawn/activate a timer that runs once after 1 millisecond and activates/deactivates the record (since it runs in the native message handler of the main thread, that should be the safest way)
_________________
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 |
|
 |
~lev How do I cheat?
Reputation: 0
Joined: 05 Jan 2016 Posts: 2
|
Posted: Tue Jan 05, 2016 8:14 pm Post subject: |
|
|
Thanks a lot, It worked!
Just in case if anyone finds this thread:
I've added
| Code: | t=createTimer()
t.setInterval(500)
|
to the very beginning
then from function keydown(virtualkey,char)
instead of calling ExecuteSelectedOption() directly I use
| Code: | t.setOnTimer(ExecuteSelectedOption)
t.setEnabled(true)
|
and of course I've added a t.setEnabled(false) to the end of
function ExecuteSelectedOption()
Thanks again!
|
|
| Back to top |
|
 |
|