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 


[Need help with AA] Multiple aobscan's

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

Joined: 20 Nov 2012
Posts: 5
Location: Middle of nowhere

PostPosted: Sat Apr 25, 2015 11:30 am    Post subject: [Need help with AA] Multiple aobscan's Reply with quote

EDIT: Just looked and I am a bit confused is this was the right sub-forum for this question compared to "General Gamehacking", Sorry if this isn't the right section.

The game I'm trying to cheat has a free version and a paid version, despite both of them being on "Alpha 13" they have slightly different internals, in particular the function that I'm trying to hook has entirely changed(picture of IDA screenshot below). I want to make a single script that works for both of these but am having issues doing so.

Is there anyway to do something like this?(this is not valid of course)
Code:
[ENABLE]

registersymbol(isKnownTileHookFree)
registersymbol(isKnownTileHookPaid)
alloc(returnTrue,$256)

alloc(CheckVersionEnable,$256)
label(Free)
label(Paid)
CREATETHREAD(CheckVersionEnable);

CheckVersionEnable:
   //Try to aobscan the free version's function
   aobscan(isKnownTileHookFree ,8B 44 24 04 2B 01 0F AF 41 14 8B 51 18)
   cmp isKnownTileHookFree, #0
   jne Free

   //If the the previous scan didn't work, scan for the paid version's function
   aobscan(isKnownTileHookPaid ,53 89 CB 83 EC 18 89 0C 24 8D 4C 24 20 E8 ? ? ? ? 83 EC 04 84 C0 74 18)
   cmp isKnownTileHookPaid, #0
   jne Paid
   ret

   //enable cheat for free version's function
   Free:
   isKnownTileHookFree:
      jmp returnTrue
      nop
   ret

   //enable cheat for paid version's function
   Paid:
   isKnownTileHookPaid:
      jmp returnTrue
      nop
   ret


returnTrue:
       mov eax, #1
       retn 8


[DISABLE]
alloc(CheckVersionDisable);
label(Free)
label(Paid)

CREATETHREAD(CheckVersionDisable);

//Disable the cheat with the previous results of the aobscans
CheckVersionDisable:
   cmp isKnownTileHookFree, #0
   jne Free

   cmp isKnownTileHookPaid, #0
   jne Paid
   ret

   Free:
   isKnownTileHookFree:
      db 8B 44 24 04 2B 01
   ret

   Paid:
   isKnownTileHookPaid:
      db 53 89 CB 83 EC 18
   ret



unregistersymbol(isKnownTileHookFree)
unregistersymbol(isKnownTileHookPaid)
dealloc(returnTrue)



the function.png
 Description:
Screenshot of the functions in IDA pro
 Filesize:  63.58 KB
 Viewed:  7493 Time(s)

the function.png


Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Sat Apr 25, 2015 12:27 pm    Post subject: Reply with quote

Currently, AA Script will abort the execution when error encountered
No result for an AA aobscan is considered error. So It is not be possible to search 2 exclusive aobscan in one AA script.

But AA script can be mix with lua script, and lua script should be executed before AA script.
May be the 2 aobscan can be done on lua 1st then register the address to a symbol.
However, lua AOBScan will search for all memory for all possible match, it won't just return 1 result. A custom Memory Scan may need to made to return one and first match.

Going lua may be not your prefer way of hacking.

Here an alternative suggestion.

Make 2 cheat entries with paid and free version respectively, said P and F script.

Then make another script G like this:
[ENABLE]
globalalloc(VERSION,4)
VERSION:
dd 0
[DIABLE]

Then drag and drop P and F under G, then right click G and set 'Group Config' -> ''(De)activate this entry (De)activate child'.

Like these:
G
+-P
+-F

Inside P somewhere add these lines:
VERSION:
dd 1

and in the beginning of F, added this
assert(VERSION,00 00 00 00)

Now by click G, G will allocate VERSION and set it to 0.
Then P will be executed.
If P success , VERSION will be written as 1 otherwise it will keep as 0.

No matter P success or not, F will be executed afterward.
But if P success, the assert in F will be fail, so stop the aobscan in F.

Also, inside F, you may insert
VERSION:
dd 2

...so that if there are other script need to executed according to the version. You can insert an appropriate beginning command
assert(VERSION,01 00 00 00) // for example

Hope it work like you want.
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 891

PostPosted: Sat Apr 25, 2015 1:08 pm    Post subject: This post has 1 review(s) Reply with quote

If it's a learning exercise then more power to you, but I just wanted to chime in to say that if someone were giving me a table I would 100% prefer it to have separate, simple scripts for each version than convoluted AA (or worse, Lua) that tries to do everything at once. It will also be much easier to update small, simple scripts than big monolithic monsters that even the author won't understand two years in the future.
_________________
A nagy kapu mellett, mindig van egy kis kapu.
----------------------
Come on...
Back to top
View user's profile Send private message
vkiko2
How do I cheat?
Reputation: 1

Joined: 20 Nov 2012
Posts: 5
Location: Middle of nowhere

PostPosted: Sat Apr 25, 2015 1:56 pm    Post subject: Thanks Reply with quote

@panraven Thanks! I didn't know you could use lua inside a AA script, I'll try doing that.

@justa_dude
Quote:

If it's a learning exercise then more power to you, but I just wanted to chime in to say that if someone were giving me a table I would 100% prefer it to have separate, simple scripts for each version than convoluted AA (or worse, Lua) that tries to do everything at once. It will also be much easier to update small, simple scripts than big monolithic monsters that even the author won't understand two years in the future.


I see your point, I'm mostly doing this because all my other scripts work across versions and it seemed out of place to have a script for each version just for this cheat. I think that as long as I make it small and well-commented, anybody should be able to understand it(even a few years in the future). Thanks for the advice, I appreciate it.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Sat Apr 25, 2015 7:53 pm    Post subject: Reply with quote

justa_dude wrote:
If it's a learning exercise then more power to you, but I just wanted to chime in to say that if someone were giving me a table I would 100% prefer it to have separate, simple scripts for each version than convoluted AA (or worse, Lua) that tries to do everything at once. It will also be much easier to update small, simple scripts than big monolithic monsters that even the author won't understand two years in the future.


If I'm a user, I would agree.
But I don't want maintenance monster as well if I'm the maintainer.
Anyway, lua solution should please everyone :]

vkiko2 wrote:
@panraven Thanks! I didn't know you could use lua inside a AA script, I'll try doing that.


When editing lua inside an AA entry, and click 'ok' to save the script, the lua part will be executed because of syntax checking. It may be less annoying by put the lua script inside a function with one of the parameter to receive a global variable 'syntaxcheck', and skip execution if this variable is 'true'.

use {$lua} and {$asm} to toggle lua/aa section.

eg.:
Code:

{$lua}
-- define function
function testversion(skip)
   if skip == true then return '' end
   .... your code
   .... set symbol etc.
   return ''   -- return an empty string for success, a nil to abort aa script on error
end
{$asm}

[ENABLE]

{$lua}
return testversion(syntaxcheck) -- syntaxcheck is global variable turn true or false depending if it is for syntax checking or actual execution.
{$asm}

... other AA

[DISABLE]

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