![Cheat Engine Forum Index](templates/subSilver/images/logo_phpBB.gif) |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
neofsn Newbie cheater
Reputation: 0
Joined: 19 Mar 2022 Posts: 10
|
Posted: Sat Mar 19, 2022 7:54 pm Post subject: Remove unwanted addresses from allocation |
|
|
Hello,
Good day, seeking your assistance on this if possible.
I do have an allocated memory with a bunch of pointers in it.
Code: | alloc(enemyAddresses,1024) |
Let's say this is a list of all of my seen enemies.
I fill it up with:
Code: | mov ebx,enemyAddresses
move [ebx],esi
|
How can I remove unwanted addresses such as dead enemies?
Example I can see their health on:
Code: | [enemyAddresses -> 0x8 -> 0x115] |
How can I do
Code: | if [enemyAddresses -> 0x8 -> 0x115] == 0 : remove |
There, thanks for reading. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
AylinCE Grandmaster Cheater Supreme
Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Wed Mar 30, 2022 2:47 am Post subject: |
|
|
Just one example;
If equal or the same; "=="
Not equal or not the same; "~="
Code: | if [enemyAddresses -> 0x8 -> 0x115] ~= 0 then -- If the value is not 0.
print("The owner of this address is still alive!")
end |
_________________
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
panraven Grandmaster Cheater
Reputation: 55
Joined: 01 Oct 2008 Posts: 941
|
Posted: Wed Mar 30, 2022 10:22 am Post subject: |
|
|
The check function may do in a lua timer function if not time critical, which has benefit of safer pointer check, ie. it wont crash the game reading an unreadable address from lua. It may also do it in assembler with badpointer check but there may still risk of crashing.
Before the checking function, let's exam how the pointer pool based at enemyAddresses can be operated.
These are some situations I can think of,
1. how to add the pointers into the pool without duplicated;
2. how to tell if the pointer is already added before;
3. how to tell if the pool is full; <so you can't add the new pointer>
This pseudo code that handle above situation:
Code: |
-- input is pointer address try to added, addr
-- var first
0. first <- -1
1. loop all address in the pool;
1-1. record the first null pointer address from pool(content is zero) as first ;
1-2. check if non-null pointer content equal addr
1-2-1 if equal, it is duplicated, set first to zeo and break the loop ;
2. loop ended, check first
2-1 if first is zero, it is duplicated, no pointer added;
2-2 if it is negative (-1), the pool is full, no pointer added;
2-3 if it is positive, we set the addr into first as content (first address in pool with null content)
3. in assembler, do a [test first,first] command can tell which situation is after function return.
|
@pointer"[enemyAddresses -> 0x8 -> 0x115]"
*** assume it means [[enemyAddresses+0x8]+0x115], or [[[enemyAddresses]+0x8]+0x115] ?
As said, there is risky of crashing on making pointers in assembler,
this may be least safety, which only assume address readable if the address content is not zero
Code: |
-- assume eax is the input base address, it return eax as ADDRESS [eax(base)+08] + 115 if (seemly)valid else 0 ;
getPointer:
test eax,eax
je skip
mov eax,[eax+08]
test eax,eax
je skip
lea eax,[eax+115]
jmp done
skip:
xor eax,eax
done:
test eax,eax
ret
///------ usage:
mov eax, <-the base address->
call getPointer
je invalidPointer
-- eax is now the address of [base+08]+115
cmp dword ptr[eax],(float)1
jl smallerThan1
...
|
These some idea suggestions.
We may continue later. _________________
- Retarded. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|
|