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 


Trainer freezes for a while on script enable

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Dodish
Cheater
Reputation: 0

Joined: 16 Nov 2016
Posts: 27

PostPosted: Thu Dec 15, 2016 3:52 am    Post subject: Trainer freezes for a while on script enable Reply with quote

Hello, I've created a trainer for my game but when I activate the hack with F1 hotkey, the trainer takes long time like a minute to do everything while freezing.
Is there any possibility to reduce these lags?

Here's my code:
Code:
[ENABLE]
aobscan(nocensor, 55 8B EC 83 EC 08 8B 05 E8 ?? ?? ?? 85 C0 74 1E 8B 05 E8 ?? ?? ?? 83 EC 04 68 ?? ?? ?? ?? FF 75 08 50 39 00 E8 ?? ?? ?? ?? 83 C4 10 EB 03 8B 45 08 C9 C3)
label(_nocensor)
registersymbol(_nocensor)

nocensor:
_nocensor:
db 55 8B EC 83 EC 08 8B 05 E8 ?? ?? ?? 85 C0 74 1E 8B 05 E8 ?? ?? ?? 83 EC 04 68 ?? ?? ?? ?? FF 75 08 50 39 00 E8 ?? ?? ?? ?? 83 C4 10 90 90 8B 45 08 C9 C3

[DISABLE]
_nocensor:
db 55 8B EC 83 EC 08 8B 05 E8 ?? ?? ?? 85 C0 74 1E 8B 05 E8 ?? ?? ?? 83 EC 04 68 ?? ?? ?? ?? FF 75 08 50 39 00 E8 ?? ?? ?? ?? 83 C4 10 EB 03 8B 45 08 C9 C3

unregistersymbol(_nocensor)

Simply, nopping EB 03. (Changing EB 03 to 90 90)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Dec 15, 2016 4:21 am    Post subject: Reply with quote

If you know which module this aob is in you can use aobscanmodule

or resort to lua, and run your code in a thread

_________________
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
Dodish
Cheater
Reputation: 0

Joined: 16 Nov 2016
Posts: 27

PostPosted: Thu Dec 15, 2016 6:13 am    Post subject: Reply with quote

The function is JITed (Mono) so it will not belong to any module.
About the second thing, can you give me an example?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Dec 15, 2016 6:55 am    Post subject: Reply with quote

ah, mono.
In that case I recommend activating the mono features and then fetch the address of the function you're interested in. (if it's not JITed yet CE will JIT it for you)

and if you worry that it can change the compilation and cause different sized instructions (jumps could change size), then use AOBSCANREGION(nocensor,monoclass:monomethod,monoclass:monomethod+8192,xx xx xx xx xx)


as for threaded:

Code:

[enable]
{$lua}
createNativeThread(function()
autoAssemble([[
aobscan(nocensor, 55 8B EC 83 EC 08 8B 05 E8 ?? ?? ?? 85 C0 74 1E 8B 05 E8 ?? ?? ?? 83 EC 04 68 ?? ?? ?? ?? FF 75 08 50 39 00 E8 ?? ?? ?? ?? 83 C4 10 EB 03 8B 45 08 C9 C3)
label(_nocensor)
registersymbol(_nocensor)

nocensor:
_nocensor:
db 55 8B EC 83 EC 08 8B 05 E8 ?? ?? ?? 85 C0 74 1E 8B 05 E8 ?? ?? ?? 83 EC 04 68 ?? ?? ?? ?? FF 75 08 50 39 00 E8 ?? ?? ?? ?? 83 C4 10 90 90 8B 45 08 C9 C3
]])
end
)

[disable]
{$lua}
createNativeThread(function()
autoAssemble([[
_nocensor:
db 55 8B EC 83 EC 08 8B 05 E8 ?? ?? ?? 85 C0 74 1E 8B 05 E8 ?? ?? ?? 83 EC 04 68 ?? ?? ?? ?? FF 75 08 50 39 00 E8 ?? ?? ?? ?? 83 C4 10 EB 03 8B 45 08 C9 C3

unregistersymbol(_nocensor)
]]
)


_________________
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


Last edited by Dark Byte on Wed Dec 21, 2016 6:45 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Dodish
Cheater
Reputation: 0

Joined: 16 Nov 2016
Posts: 27

PostPosted: Thu Dec 15, 2016 9:43 am    Post subject: Reply with quote

Using AOBSCANREGION, I'm afraid I cannot find the mono class and method names because it has a random name like "a:EEEE", but I got to it from another function which uses it that I could find in Mono dissector called "_SendChatMessage".
Is there any way using cheat engine to get to the mono file of a:EEEE?
Also if I may ask, what's the "+8192" for?
In _SendChatMessage, calling the function I want looks like that:



Capture.PNG
 Description:
 Filesize:  85.54 KB
 Viewed:  8197 Time(s)

Capture.PNG


Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Dec 15, 2016 10:45 am    Post subject: Reply with quote

Nexero wrote:
Also if I may ask, what's the "+8192" for?

AOBSCANREGION takes 4 arguments:

AOBSCANREGION(name,startAddress,endAddress,xx xx xx xx xx)


if you know that endAddress is, for example, 8192 bytes after start address you can use
AOBSCANREGION(name,startAddress,startAddress+8191,xx xx xx xx xx)

_________________
Back to top
View user's profile Send private message MSN Messenger
Dodish
Cheater
Reputation: 0

Joined: 16 Nov 2016
Posts: 27

PostPosted: Wed Dec 21, 2016 9:37 am    Post subject: Reply with quote

Thanks mgr.inz.Player & Dark_Byte!
I was kinda busy with schools so couldn't test everything, I've just tested the threaded method and it returns with an error at the disable section, I don't understand why though.



Capture.PNG
 Description:
 Filesize:  50.1 KB
 Viewed:  7953 Time(s)

Capture.PNG


Back to top
View user's profile Send private message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Wed Dec 21, 2016 12:43 pm    Post subject: Reply with quote

You must have forgotten to close something. Type when one opens ( must have another one that closes it ).
Code:

[ENABLE]
{$lua}



{$asm}
[DISABLE]
{$lua}
autoAssemble([[


]])
{$asm}




_________________
...
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Dec 21, 2016 6:44 pm    Post subject: Reply with quote

fixed my example, and your disable doesn't need a thread as it doesn't do an aob scan (it's fast)
_________________
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
Dodish
Cheater
Reputation: 0

Joined: 16 Nov 2016
Posts: 27

PostPosted: Thu Dec 22, 2016 3:39 am    Post subject: Reply with quote

Thank you two, I was too dumb to figure this out by myself, now it works after I removed the thread as DB suggested but there's one more thing.
Whenever I activate the cheat, it causes the game client huge lags/freezes.
The hotkeys are F1 for enable and F2 for disable.
When I press F1, it gets activated and the client starts to get huge lags.
However, when I press F2, it doesn't disable BUT stops the lags while the cheat is still activated.
Is it possible that the activate section keeps on repeating the thread?
Back to top
View user's profile Send private message
Dodish
Cheater
Reputation: 0

Joined: 16 Nov 2016
Posts: 27

PostPosted: Thu Dec 22, 2016 1:26 pm    Post subject: Reply with quote

Nevermind I figured it out, thank you all. This will really help me with the project I'm working on. Will give credits. Smile
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 Lua Scripting 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