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 


Using struct AA command

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Hatschi
Master Cheater
Reputation: 2

Joined: 28 Jan 2010
Posts: 327

PostPosted: Tue Dec 12, 2017 9:52 am    Post subject: Using struct AA command Reply with quote

Referencing to Dark bytes post I'm trying to use the struct AA command but it doesn't work as it should:

Code:
STRUCT player
  gold: db A0
ENDSTRUCT

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048,1BD1517000A)
label(returnhere)
label(originalcode)
label(exit)



newmem: //this is allocated memory, you have read,write,execute access
//place your code here
mov dword ptr[rax+player.gold],(int)100

originalcode:


exit:
jmp returnhere

1BD1517000A:
jmp newmem
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
1BD1517000A:
add [rax],al
add [rax],al
add [rax],al
//Alt: db 00 00 00 00 00 00


this actually gives me:

Code:
1BD15310000 - C7 00 64000000        - mov [rax],00000064 { 100 }


but shouldn't it be?!:

Code:
mov dword ptr[rax+A0],64


What am I doing wrong?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Tue Dec 12, 2017 12:27 pm    Post subject: Reply with quote

Code:

STRUCT player
  everythingbeforeit: resb 160  //or 0xa0
  gold: resb 4
ENDSTRUCT

00400500:
mov [rax+player.gold],#100

_________________
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
Hatschi
Master Cheater
Reputation: 2

Joined: 28 Jan 2010
Posts: 327

PostPosted: Wed Dec 13, 2017 6:38 am    Post subject: Reply with quote

Ok so basically I have to write hex decimal values with 0x in front of it and also to "fill" the structure first. And then I write my offset name and the size of it?

For example my gold is at 0x50 4 bytes and health is at 0x60 double the structure would be like:

Code:
STRUCT player
 everythingbeforeit: resb 0x50
 gold: dd ? // what is the difference between this and resb 4 ?
 everythingbeforeit: resb 0x10
 health: dq ?
ENDSTRUCT
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Wed Dec 13, 2017 6:51 am    Post subject: Reply with quote

don't forget that dd allocates 4 bytes, so instead of 0x10 do 0xc
_________________
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: 54

Joined: 01 Oct 2008
Posts: 941

PostPosted: Wed Dec 13, 2017 7:30 am    Post subject: Reply with quote

A limitation of the AA Struct is it can't use cpu instruction name.
Won't work if comment removed.
Code:

struct ST
gold: dd ?
health: dd ?
//enter: dd ?
//leave: dd ?
ends


May try a Lua work around
Code:

function gDefine(t)
  local r,prefix = {},''
  if t[1] then t[1],prefix = nil,t[1]..'.'end
  for k,v in pairs(t)do r[1+#r] = string.format("define(%s,%X)",prefix..k,v)end
  return table.concat(r,'\r\n')
end


In AA :
Code:

{$lua}
return gDefine{
 gold = 0x108,  -- no padding need
 health = 0x200,
 enter = 0x14,
 leave = 0x18
}
{$asm}

but offset has to calculated yourself.

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

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

PostPosted: Wed Dec 13, 2017 9:34 am    Post subject: Reply with quote

you can also just define a structure in the cheat table and use that
_________________
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
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