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 


[6.6] How exactly is `align` supposed to be used?

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

Joined: 06 Oct 2016
Posts: 6

PostPosted: Sat Oct 08, 2016 11:40 am    Post subject: [6.6] How exactly is `align` supposed to be used? Reply with quote

This:

Code:
[ENABLE]
alloc(M,1024)
label(L)

M:
align #16
L:

[DISABLE]
dealloc(M)


...bugs out: allocates the memory, but doesn't mark table's script entry as active, so it can't be deactivated.

Is this the right way to use it? Is there an example in some place that I'm missing?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Oct 08, 2016 11:48 am    Post subject: Reply with quote

Attach CE to the process first?
Back to top
View user's profile Send private message
chase0
How do I cheat?
Reputation: 0

Joined: 06 Oct 2016
Posts: 6

PostPosted: Sat Oct 08, 2016 11:56 am    Post subject: Reply with quote

Nice try. Now how about you try using that directive first.
Back to top
View user's profile Send private message
Merlini
Advanced Cheater
Reputation: 2

Joined: 12 Jun 2016
Posts: 53

PostPosted: Sat Oct 08, 2016 12:34 pm    Post subject: Reply with quote

Test condition:

1 ) Open Notepad
2 ) Type StartHere
3 ) Open CE 6.6
4 ) Attach Notepad
5 ) Search String UTF-16 for StartHere
6 ) Open CE memory view at the address
7 ) Ctrl+A for auto assemble
8 ) AA code as in screenshot, replacing first address with StartHere address.
9 ) Execute

Seems like it's working exactly as it is supposed to.
I've actually been wanting for align functionality.
Thanks DB.



a.png
 Description:
 Filesize:  10.72 KB
 Viewed:  9509 Time(s)

a.png


Back to top
View user's profile Send private message
chase0
How do I cheat?
Reputation: 0

Joined: 06 Oct 2016
Posts: 6

PostPosted: Sat Oct 08, 2016 12:42 pm    Post subject: Reply with quote

It does work, in the sense that the alignment works (although it silently swallows specifying non-powers of 2 instead of generating an error). It just messes up table scripts, preventing them from getting marked as active.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Oct 08, 2016 1:57 pm    Post subject: Reply with quote

if for some reason you want to align it on a non-power of 2 then sure. You can do that.


Also, align lets you specify a filler byte as 2nd parameter
e.g:
Code:

00400500:
align 7 cc

will fill 00400500 to 00400505 with cc

and if you ask why, that's because 00400506=4195590 which is dividable by 7

edit: ah I see, the aa doesn't like it when it writes 0 bytes which it interprets as failure

It's fixed in this download https://github.com/cheat-engine/cheat-engine/releases/download/6.6/CheatEngine66.exe
(the main website will be updated once the mirror updates tomorrow)

_________________
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
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Sat Oct 08, 2016 2:53 pm    Post subject: Reply with quote

Dark Byte wrote:
...

edit: ah I see, the aa doesn't like it when it writes 0 bytes which it interprets as failure
...




hi, quote in lua AOBScan function
Code:

alignmenttype is an integer:
  0=No alignment check
  1=Address must be dividable by alignmentparam
  2=Address must end with alignmentparam

Can it be use the alignment type 2 ? may be by a special notation, eg.
Code:

align x7 --  align to 400107,400117,etc.
align x00 --  align to 400100,400200,etc.


Also, mgr.inz.Player has made a registerAssembler ( http://forum.cheatengine.org/viewtopic.php?t=574426 ) include custom alignment, at that time, it has related issue that it emit full align bytes in case of zero bytes needed.

Can allow registerAssembler callback function emit zero bytes?

ADDED:

may also be use something like :
Code:

align 8 code

so that the padding bytes are using the set like mgr.inz.Player's .

Thank you~

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

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

PostPosted: Sat Oct 08, 2016 3:12 pm    Post subject: Reply with quote

Quote:

align x7 -- align to 400107,400117,etc.

Code:

align 10
db * * * * * * *


or if you don't mind the bytes being initialized to 0:
Code:

align 10
resb 7  //7 is an decimal, not hex


Quote:

align x00 -- align to 400100,400200,etc.


Code:

align 100


and the link I posted above may support 0 byte aa commands as well (untested)

_________________
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
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Sat Oct 08, 2016 3:35 pm    Post subject: Reply with quote

Thank you!

Not know resb can initialize bytes.

Someone (with decent English ) should put these tip & trick in Wiki !

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
chase0
How do I cheat?
Reputation: 0

Joined: 06 Oct 2016
Posts: 6

PostPosted: Sun Oct 09, 2016 1:36 am    Post subject: Reply with quote

Dark Byte wrote:
if for some reason you want to align it on a non-power of 2 then sure. You can do that.


No, I was just pointing out assemblers tend to treat that as an error.

Dark Byte wrote:
edit: ah I see, the aa doesn't like it when it writes 0 bytes which it interprets as failure


Exactly, it's issue #512 on Mantis BT. And thanks.

panraven wrote:
Not know resb can initialize bytes.


Well, to nitpick, `resb`, etc. shouldn't *initialize*, they reserve storage, leaving it *un*initialized.
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