View previous topic :: View next topic |
Author |
Message |
DaviFN Cheater Reputation: 0
Joined: 23 Oct 2016 Posts: 32
|
Posted: Tue May 01, 2018 3:42 pm Post subject: Show the number of executions per second? |
|
|
Hello everyone!
Is there a way to make a lua script to show the number of executions of a particular line of assembly code per second?
I mean, suppose I disassemble a program and I see an instruction that appears to be in a loop, e.g. xor eax,eax. But there may be something limiting the number of executions of that loop, such as a sleep().
I have the idea. Set a breakpoint on the address of the instruction and increase an integer variable each time the breakpoint is hit (but letting the program flow, "unbreakpointing" it as soon as possible), and then, when another "thread" of lua tells us 1 second has passed, we simply print the value of the variable, effectively printing the number of executions per second.
However, I have no knowledge of lua whatsoever. Where do I begin?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Tue May 01, 2018 4:01 pm Post subject: |
|
|
instead of breakpoints you can do a code injection that increases the value.
_________________
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 |
|
|
DaviFN Cheater Reputation: 0
Joined: 23 Oct 2016 Posts: 32
|
Posted: Tue May 01, 2018 4:07 pm Post subject: |
|
|
Could you give me an example, Dark Byte?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Tue May 01, 2018 4:16 pm Post subject: |
|
|
i can't post a full script atm as i'm on a phone, but in short:
record the current time (getTickCount())
do a normal codeinjection where you allocate a counter, register the countersymbol and each time the injection runs increase the counter
then in lua start a timer to take the current time and read out the counter. then count/timedifference is executions per ms
_________________
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 |
|
|
DaviFN Cheater Reputation: 0
Joined: 23 Oct 2016 Posts: 32
|
Posted: Tue May 01, 2018 4:21 pm Post subject: |
|
|
I just need a quick solution... I'm trying to do it via threads right now, but, as my lua script has an infinite loop, it executes "forever", and I have to reopen Cheat Engine in order to make it stop...
How do I stop a lua script execution?
(p.s. this per second thing is an useful thing and I think you should consider, in future editions of Cheat Engine, adding such a functionality)
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Tue May 01, 2018 4:34 pm Post subject: |
|
|
in your lua thread check for a variable you define that says it should terminate or not. (timers are a lot easier and safer, since you can't just access gui objects in threads without crashing unless you encapsule them using synchronize.)
once your thread returns it exits
_________________
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 |
|
|
|