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 


CE hangs injection with aobscan + lua Active=true

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

Joined: 05 Jan 2016
Posts: 2

PostPosted: Tue Jan 05, 2016 3:12 pm    Post subject: CE hangs injection with aobscan + lua Active=true Reply with quote

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
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25815
Location: The netherlands

PostPosted: Tue Jan 05, 2016 3:24 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
~lev
How do I cheat?
Reputation: 0

Joined: 05 Jan 2016
Posts: 2

PostPosted: Tue Jan 05, 2016 8:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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