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 


Making a list of pointers with increment offset

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
LF2005
Newbie cheater
Reputation: 0

Joined: 03 Apr 2014
Posts: 16

PostPosted: Sat Oct 02, 2021 10:10 am    Post subject: Making a list of pointers with increment offset Reply with quote

Code:
local al = getAddressList()

local base = al.createMemoryRecord()
base.setDescription("Base Address")
base.Type = vtString
base.String.Size = 0
base.Address = "Sys43VM.DLL+6DD68"
base.OffsetCount = 4
base.Offset[0] = 0
base.Offset[1] = 0
base.Offset[2] = 0x2EFA
base.Offset[3] = 0x15C

for i = 0, 89 do
  local name= string.format("+%X", i * 0x3+0x2EFA)
  local offset3 = i * 0x3+0x2EFA
  local adress = al.createMemoryRecord()
  adress.Type = vtDword
  adress.Address = "Sys43VM.DLL+6DD68"
  adress.OffsetCount = 4
  adress.Offset[0] = 0
  adress.Offset[1] = 0
  adress.Offset[2] = offset3
  adress.Offset[3] = 0x15C
  adress.Description = name
  adress.appendToEntry(base)
end

I patched a code posted in this forum for my purpose,
that was to make a list of pointers pointing at each of the items in my inventory. this code accomplish it but I want to keep the structure of a manually found pointer, in my case the the 3rd offset of the 1st pointer should be "2EFA*4" and not the result.
is it possible ?


Last edited by LF2005 on Sun Oct 03, 2021 3:58 am; edited 2 times in total
Back to top
View user's profile Send private message
Birdi
Expert Cheater
Reputation: 0

Joined: 08 Jun 2020
Posts: 124
Location: Migrating

PostPosted: Sat Oct 02, 2021 3:20 pm    Post subject: Reply with quote

Code:

function setPointer(base,offsets,numOffsets)
  local base = base or nil
  local offsets = offsets or nil
  local numOffsets = numOffsets or 0
  if base == nil or offsets == nil then return end
  local al = getAddressList()
  local newMem = al.createMemoryRecord()
  newMem.setDescription(base[1])
  newMem.Type = vtString
  newMem.String.Size = 0
  newMem.Address = base[2]
  newMem.OffsetCount = numOffsets
  for i=1,numOffsets do
    newMem.Offset[i-1] = offsets[i]
  end
  for i=0,89 do
    local name = string.format("+%X", i * 0x3+0x2EFA)
    local offset3 = i * 0x3+0x2EFA
    local adress = al.createMemoryRecord()
    local childOffsets = offsets[5]
    adress.Type = vtDword
    adress.Address = "Sys43VM.DLL+6DD68"
    adress.OffsetCount = 4
    adress.Offset[0] = childOffsets[1]
    adress.Offset[1] = childOffsets[2]
    adress.Offset[2] = offset3
    adress.Offset[3] = childOffsets[3]
    adress.Description = name
    adress.appendToEntry(newMem)
  end
end

setPointer({"My Entry","Sys43VM.DLL+6DD68"},{0x10,0x20,0x30,0x40,{0x15,0x25,0x35}},4)


I'm not entirely sure what you mean by "the 1st one" -- the first, parent, entry, or the first offset of each child, or..?

In any case, you can modify this as you need. Just call the function with the correct offsets as an array(table). You can modify the manual section of the child as you need.

_________________
Trying to learn!

Add me on Discord if you want hands-on help:
Birdi.
Back to top
View user's profile Send private message Visit poster's website
LF2005
Newbie cheater
Reputation: 0

Joined: 03 Apr 2014
Posts: 16

PostPosted: Sun Oct 03, 2021 3:42 am    Post subject: Reply with quote

1st, thanks for answering
Thought it was clear.
My base pointer is [[[[["Sys43VM.DLL+6DD68"]0]0]0x2EFA*4 ]0x15C]
In it only the 3rd pointer increases by 3 before being multiplied by 4

I don't get what you send to the offset.
I think you send an array of 5 numbers where the 5th one is another array
setPointer({"My Entry","Sys43VM.DLL+6DD68"},{0x10,0x20,0x30,0x40,{0x15,0x25,0x35}},4)
Pretty sure this doesn't achieve the extra effect of the 3rd offsets being formated as "2EFA*4","2EFD*4","2F00*4"....ect
Back to top
View user's profile Send private message
Birdi
Expert Cheater
Reputation: 0

Joined: 08 Jun 2020
Posts: 124
Location: Migrating

PostPosted: Sun Oct 03, 2021 5:28 am    Post subject: Reply with quote

If you need to adjust the third offset, just change the arithmetic used in defining 'offset3'
As-is, it starts at your base offset 2EFA then adds (0x3 * i), where i is your iterations in the children's For loop... if you want to multiply it differently you need only change that section.
Otherwise, the arrays passed are for every other offset, in case you need to change them for any reason.

_________________
Trying to learn!

Add me on Discord if you want hands-on help:
Birdi.
Back to top
View user's profile Send private message Visit poster's website
LF2005
Newbie cheater
Reputation: 0

Joined: 03 Apr 2014
Posts: 16

PostPosted: Sun Oct 03, 2021 8:29 am    Post subject: Reply with quote

you fail to understand what is the actual question
if I put
offset3=(3*i+0x2EFA)*4
the result will be
offset3=0xBBE8 //for the 1st pointer
but I want it to show
offset3="2EFA*4"

in the original assemble it said something like
mov ecx,[edi+2EFA*4]

so I always take the offset and put it exactly as got it "2EFA*4" when I manually make the pointer, it makes it easier to see the structure and predict the next offset
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4717

PostPosted: Sun Oct 03, 2021 11:21 am    Post subject: Reply with quote

Memory records have an OffsetText property that allows you to set a string as an offset. Use that.
Code:
adress.OffsetText[2] = ('%X*4'):format(3 * i + 0x2EFA)

_________________
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
LF2005
Newbie cheater
Reputation: 0

Joined: 03 Apr 2014
Posts: 16

PostPosted: Mon Oct 04, 2021 12:04 am    Post subject: Reply with quote

ParkourPenguin wrote:
Memory records have an OffsetText property that allows you to set a string as an offset. Use that.
Code:
adress.OffsetText[2] = ('%X*4'):format(3 * i + 0x2EFA)

Great thx, I'm totally new to Lua, so I was wondering if that's even possible, I'm simply manipulating the code based on my C++, Java and JavaScript knowledge
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4717

PostPosted: Mon Oct 04, 2021 12:02 pm    Post subject: Reply with quote

That's part of the API CE exposes to Lua. OffsetText doesn't really have anything special to do with Lua itself.

See celua.txt for documentation.

_________________
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
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