|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
beagle Cheater Reputation: 0
Joined: 27 Aug 2014 Posts: 36
|
Posted: Mon Feb 13, 2017 4:29 pm Post subject: Use Lua (or AA) to compare many bytes automatically? |
|
|
In my AA script i have to check and see if a register has many different bytes, and rather than doing this for each new byte i need to compare:
Code: |
cmp [register],a
jne exit
cmp [register],b
jne exit
cmp [register],c
jne exit
...
cmp [register],z
jne exit
|
is there a way to use lua or AA to set one variable as all of the bytes i want and just update that one list somewhere, and just do:
Code: |
cmp [register], group
jne exit
|
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Mon Feb 13, 2017 4:56 pm Post subject: |
|
|
You can use value ranges. But why is this necessary? I mean, how many values do you actually need to compare that would make this too tedious?
Alternatively, if you know what values you are looking for, you can filter them out (i.e. instead of using jne, you can use je for values that you know are good in order to minimize the amount of compares that you need to perform). |
|
Back to top |
|
|
beagle Cheater Reputation: 0
Joined: 27 Aug 2014 Posts: 36
|
Posted: Mon Feb 13, 2017 5:03 pm Post subject: |
|
|
i'd need to compare around 130 and they are not in order, eg i need to filter some values like this, which can range from 0 to about 40,000:
Code: |
0c9f, 0ca0, 0ca1, 0ca2, 0ca3, 0ca4, 0ca9, 0cac, 0cad, 0cae, 0caf, 0cb0, 0cb1, 0cb2, 0cb3
0cb4, 0cb5, 0cb6, 0ce9, 0cea, 1773, 1774, 1777, 1778, 177b, 177c, 1b81, 1b84, 1b8d, 1b9c
1b9d, 1b9e, 1b09, 1b15, 1ae1, 1b1c, 0c84, 0c85, 0cc5, 0c8c, 0cbe, 0c37, 0c38, 0c45, 0c46
|
some are right next to each other, but some arent. i was hoping i could just have lua or AA treat this list as one variable somehow
edit: rather than filter them i need to single them out and change them like this
Code: |
cmp word ptr [edi], 0d3f
je changevalue
cmp word ptr [edi], 0d32
je changevalue
jmp exit
changevalue:
mov eax, 2198
jmp exit
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Mon Feb 13, 2017 5:19 pm Post subject: |
|
|
you could use a list of values
e.g:
Code: |
alloc(comparelist, 128)
comparelist:
dw 0c9f, 0ca0, 0ca1, 0ca2, 0ca3, 0ca4, 0ca9, 0cac, 0cad, 0cae, 0caf, 0cb0, 0cb1, 0cb2, 0cb3, 0cb4, 0cb5, 0cb6, 0ce9, 0cea, 1773, 1774, 1777, 1778, 177b, 177c, 1b81, 1b84, 1b8d, 1b9c, 1b9d, 1b9e, 1b09, 1b15, 1ae1, 1b1c, 0c84, 0c85, 0cc5, 0c8c, 0cbe, 0c37, 0c38, 0c45, 0c46
...
push ecx
push eax
mov ecx,(int)44 //not 45 as it starts from the last entry
myloop:
mov ax,[comparelist+ecx*2]
cmp word ptr [esi],ax
je inthelist
loop myloop //loope/ loopne might be used here as well
jmp notinthelist
inthelist:
....
//do somethinbg
...
jmp finally
notinthelist:
...
//do something
...
jmp finally
finally:
pop eax
pop ecx
...
|
_________________
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 Mon Feb 13, 2017 10:08 pm; edited 1 time in total |
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Mon Feb 13, 2017 5:22 pm Post subject: |
|
|
I don't know of any way other than to use value ranges in an effort to minimize some of your work.
Before doing any of that, I'd first make sure that there wasn't a better way...either a better injection location or a shared value that can be used as a proper identifier for your filter.
EDIT:
@ DB...that's pretty slick; I didn't know that you could do that. |
|
Back to top |
|
|
beagle Cheater Reputation: 0
Joined: 27 Aug 2014 Posts: 36
|
Posted: Mon Feb 13, 2017 6:06 pm Post subject: |
|
|
wow thanks DB! i'm just trying this out now
the list works great, but the problem i am having is it only loops once, so only the last item on the list gets selected (i tried loopne too)
edit: Nvm i wasnt using the ecx right. It's working now, thanks a lot :)
edit2: is there a way to split comparelist into multiple lines like [[ ]] for lua? |
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Feb 13, 2017 8:32 pm Post subject: |
|
|
Code: | comparelist:
dw 0c9f, 0ca0, 0ca1, 0ca2, 0ca3, 0ca4, 0ca9, 0cac
dw 0cad, 0cae, 0caf, 0cb0, 0cb1, 0cb2, 0cb3, 0cb4
dw 0cb5, 0cb6, 0ce9, 0cea, 1773, 1774, 1777, 1778
dw 177b, 177c, 1b81, 1b84, 1b8d, 1b9c, 1b9d, 1b9e
dw 1b09, 1b15, 1ae1, 1b1c, 0c84, 0c85, 0cc5, 0c8c
dw 0cbe, 0c37, 0c38, 0c45, 0c4 |
|
|
Back to top |
|
|
|
|
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
|
|