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 


Curious to know

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
phpjunkie
Cheater
Reputation: 0

Joined: 26 Dec 2022
Posts: 26
Location: Wasilla, Ak

PostPosted: Sun Jan 01, 2023 5:14 pm    Post subject: Curious to know Reply with quote

Code:

alloc(EnemyInfo,4)
registersymbol(EnemyInfo)

EnemyInfo+4:
    dd (float)0

EnemyInfo+8:
    dd (float)0

EnemyInfo+10:
    dd (float)0

EnemyInfo+20:
    dd (float)0


Can this conflict with anything already written to memory, and would I have to dealloc all of the offsets?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4695

PostPosted: Sun Jan 01, 2023 6:41 pm    Post subject: Reply with quote

Technically you should have at least 0x24 (36) bytes allocated to EnemyInfo.

Have `dealloc(EnemyInfo)` / `unregistersymbol(EnemyInfo)` in the disable section and it'll be fine.

Why are all those values spaced out like that?

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
phpjunkie
Cheater
Reputation: 0

Joined: 26 Dec 2022
Posts: 26
Location: Wasilla, Ak

PostPosted: Sun Jan 01, 2023 8:07 pm    Post subject: Reply with quote

Curiosity, through trial and error. When I tried to use 1 2 3 4, none of it worked, so I looked through the Dissect Data/Structures, and noticed it followed a pattern. I was thinking it went from 4 8 16 32 but I was wrong, it is spaced in groups of 4. It'd be 4 8 C 10 14.

ParkourPenguin wrote:
Technically you should have at least 0x24 (36) bytes allocated to EnemyInfo.
How are you getting the number 36?

In the Auto Assemble the generated code puts 2048 for the newmem, and I was thinking that the hex didn't matter for allocating new memory. Do I really need to put the 24 for allocating the new memory?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Jan 01, 2023 9:16 pm    Post subject: Reply with quote

if you have more than 1 alloc in the script it matters
_________________
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
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4695

PostPosted: Mon Jan 02, 2023 2:21 am    Post subject: Reply with quote

I have absolutely no idea what you're trying to do, but you're doing it wrong.

`alloc` allocates memory in the target process.

`registersymbol` lets that symbol be used outside the script.

`EnemyInfo+4:` etc. specifies an address. EnemyInfo is the starting address where memory was allocated, and +4 means 4 bytes after that.

`dd (float)0`: dd writes 4 bytes of data to an address, and (float)0 is the data to write.
In this case, these lines do nothing practical since memory gets zero-initialized on allocation. It's still good to include for documentation purposes.

The alloc should have 36 bytes because the last `dd` writes 4 bytes to the address EnemyInfo+20. 0x20 + 4 = 0x24 = 36

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
phpjunkie
Cheater
Reputation: 0

Joined: 26 Dec 2022
Posts: 26
Location: Wasilla, Ak

PostPosted: Mon Jan 02, 2023 6:42 am    Post subject: Reply with quote

Code:
alloc(EnemyInfo,20)
registersymbol(EnemyInfo)

EnemyInfo+4:
    dd (float)0

EnemyInfo+8:
    dd (float)0

EnemyInfo+C:
    dd (float)0

EnemyInfo+10:
    dd (float)0

That about correct?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4695

PostPosted: Mon Jan 02, 2023 1:02 pm    Post subject: Reply with quote

The first 4 bytes of the alloc appear to be unused, but that's weird, not wrong.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
phpjunkie
Cheater
Reputation: 0

Joined: 26 Dec 2022
Posts: 26
Location: Wasilla, Ak

PostPosted: Mon Jan 02, 2023 1:19 pm    Post subject: Reply with quote

ParkourPenguin wrote:
`EnemyInfo+4:` etc. specifies an address. EnemyInfo is the starting address where memory was allocated, and +4 means 4 bytes after that.

`dd (float)0`: dd writes 4 bytes of data to an address, and (float)0 is the data to write.
In this case, these lines do nothing practical since memory gets zero-initialized on allocation. It's still good to include for documentation purposes.
I put the zeros there so in the address list it shows the zeros instead of the question marks, until something happens.

The point of them is to report information as it happens.

phpjunkie wrote:
EnemyInfo+4: Enemy health before damage.

EnemyInfo+8: Damage before modification.

EnemyInfo+C: Enemy health after damage has been taken.

EnemyInfo+10: Damage after modification


The whole point of this (4, 8, C, 10) was to shrink down the script.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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