 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Wed Jun 10, 2020 9:44 am Post subject: Enter as offset [tInventory+2A*2] in addresslist - [Solved] |
|
|
I have a situation whereby the offset list changes constantly. I have now built a 'table' which saves the proper corresponding offsets accordingly (based on ItemType value ~> a fixed integer value, starting from 1).
However: I currently "only" save a 2-byte offset-value per record/item. CE does calculate the proper memory location (as shown in title), but returns a 4-byte (8-byte ? ~ x64 game) value. While I only need it to return the first 2 bytes, basically get 'word ptr [tInventory+2A*2]'... (which CE does not accept as such)
Is there a proper formulation for this? and if not supported, workaround...
ps: ultimately, I can save those offsets in 8-byte addresses (but that kinda feels "lazy", if you catch my drift )
just to be clear: this offset is part of a "chain" of offsets in the Address field...
Last edited by paul44 on Thu Jun 11, 2020 12:52 pm; edited 1 time in total |
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4696
|
|
Back to top |
|
 |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Wed Jun 10, 2020 12:31 pm Post subject: euh, hickup... |
|
|
thx; works (almost) great...
Following offset values return 'nil':
- word_ptr[tInventory+9*2]
- word_ptr[tInventory+2D*2]
- word_ptr[tInventory+3A*2]
incrementing/decrementing f.e. '9' with +/- 1 is ok... (can not immediately identify a commonality here)
My first assumption is, it has to do with that "str:match" expression. Looked at some lua examples, but it will probably take me ages to pinpoint the issue (if it is even the cause of it). (I "recognize" the 1st part, which evaluates the 'vt_ptr' part ~ that is doing its job right; any typo results in "red lettering")
Anyways: if you can give some suggestions/directions, I'm more then willing to research this myself...
ps: did a print of 'str', resulting in continues "reporting". This function seems to run on global level (if that is the correct phrazing)?! Any chance in limiting it to the 'local' script...? (I'm thinking in terms of load balance, if any)
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4696
|
Posted: Wed Jun 10, 2020 2:57 pm Post subject: |
|
|
If any of the read*() calls return 0 (i.e. offset read is 0), the callback handler will interpret that as meaning the callback couldn't resolve the symbol.
The callback works globally for every string being parsed as an address. I guess you could unregister the handle when you want to turn it off, but if you want it to work for only one script, why not traverse the pointer path yourself? e.g.:
Lua:
Code: | function getSpecialAddress()
local node1 = readPointer('foo.exe+1234')
local node2 = readPointer(node1+0x13C)
local node3 = readPointer(node2+readSmallInteger('[foo.exe+56BC]+56'))
return node3+0x14
end
writeInteger(getSpecialAddress(), 5)
|
AA:
Code: | {$lua}
if syntaxcheck then return 'define(mySpecialAddress,0)' end
local node1 = readPointer('foo.exe+1234')
local node2 = readPointer(node1+0x13C)
local node3 = readPointer(node2+readSmallInteger('[foo.exe+56BC]+56'))
local addr = getAddress(node3+0x14)
return ('define(mySpecialAddress,%08X)'):format(addr)
{$asm}
[ENABLE]
...
mov eax,[mySpecialAddress]
test eax,eax
jz ...
[DISABLE]
...
|
Memory records:
Just put "readSmallInteger(...)" for the offset field
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Thu Jun 11, 2020 12:46 pm Post subject: Solved... |
|
|
I got it working now; there were 2 issues actually:
a) some of the nil-entries basically got overwritten by my asm code. Now - instead of using 'mov [rdx],word ptr [rbx]' - i'm using ',bx'...
(will do some reading why not 2, but more bytes are written here)
b) 2 record-entries were indeed missing; as being part of DLC.
thx for that.
fyi:
1. the callback does have some (additional) impact, but gamers can easily disable the script once they've collected/updated entries...
2. as for your suggestion: 'traverse path itself'. Not sure if I understand you correctly here, but basically my addresslist entries look (should look) like this: [ https://imgur.com/a/0DCD7mn ].
Perhaps an example: (game is ACS ~ inventory stuff)
* itemID 'money' = 1 (in prev titles, this record would always be in the same offset location; for money being offset {0}. (ACS keeps on "re-shuffling" those offsets constantly, while playing in the same session...
* so - taking some code traversing the complete list - I use that itemId (= 1) and place its offset value @ location '1' (2 bytes). If there is an itemID 2, its offset will be located @ table-offset+2*2, etc. Hence the formula you see in the example: <startaddr_myOffsetTable>+itemID*2.
So finding/linking offset-value with corresponding itemID is working fine... now...
(and indeed, quite some intermittent itemIDs do not exist, and therefore "offset-table" will have {0} values/entries; which should never 'hit' anyways)
So, my Q now being: how does your suggestion fits in this "framework"?
ps: at first, I thought you were suggestion what is shown in the other example (basically lua functionality in that offset field)...
ps: would it make sense to post a REQ, making that actually possible? (either using Lua and/or asm basics ~ basically that fn of yours)
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4696
|
Posted: Thu Jun 11, 2020 2:19 pm Post subject: |
|
|
'mov [rdx],word ptr [rbx]' isn't a valid instruction- you can't directly move data from a memory location to a memory location.
In the memory records, put the address arguments to readSmallInteger in quotes:
Code: | readSmallInteger('tInventory')
readSmallInteger('tInventory+8')
-- maybe you wanted this?
readSmallInteger('tInventory')+8 |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
paul44 Expert Cheater
Reputation: 2
Joined: 20 Jul 2017 Posts: 206
|
Posted: Fri Jun 12, 2020 10:45 am Post subject: yep, them quotes... |
|
|
that is/was indeed what I was looking for. And the performance impact is "apparent"... thx again.
ps1: you will probably not believe me, but I thought about that... while laying in bed... Forgot about it when I woke up the next day though
ps2: 'invalid instruction': my bad, did that from memory instead of checking a prev table version.
ps3: not important really, but address/offset-calc is indeed {readSmallInteger('tInventory+8*2')}. basically, one can see it as a 1-DIM "array", with itemID (here = '8') being the appropriate indexnumber; and each element a 2-byte (= offset) value.
|
|
Back to top |
|
 |
|
|
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
|
|