View previous topic :: View next topic |
Author |
Message |
phpjunkie Cheater
Reputation: 0
Joined: 26 Dec 2022 Posts: 26 Location: Wasilla, Ak
|
Posted: Sun Jan 01, 2023 5:14 pm Post subject: Curious to know |
|
|
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 |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4695
|
Posted: Sun Jan 01, 2023 6:41 pm Post subject: |
|
|
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 |
|
 |
phpjunkie Cheater
Reputation: 0
Joined: 26 Dec 2022 Posts: 26 Location: Wasilla, Ak
|
Posted: Sun Jan 01, 2023 8:07 pm Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25778 Location: The netherlands
|
Posted: Sun Jan 01, 2023 9:16 pm Post subject: |
|
|
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 |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4695
|
Posted: Mon Jan 02, 2023 2:21 am Post subject: |
|
|
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 |
|
 |
phpjunkie Cheater
Reputation: 0
Joined: 26 Dec 2022 Posts: 26 Location: Wasilla, Ak
|
Posted: Mon Jan 02, 2023 6:42 am Post subject: |
|
|
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 |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4695
|
Posted: Mon Jan 02, 2023 1:02 pm Post subject: |
|
|
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 |
|
 |
phpjunkie Cheater
Reputation: 0
Joined: 26 Dec 2022 Posts: 26 Location: Wasilla, Ak
|
Posted: Mon Jan 02, 2023 1:19 pm Post subject: |
|
|
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 |
|
 |
|