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 


AutoFill Address list
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
yadamon
How do I cheat?
Reputation: 0

Joined: 15 Mar 2025
Posts: 9

PostPosted: Sat Jun 07, 2025 8:00 pm    Post subject: Reply with quote

It now works without errors.

However, I don't fully understand the pointer settings, so I'm not getting the results I want.

I'll think about what kind of configuration I should use.

Thank you.

-----------------------------------------------------------------------
Part 1:
Input: test-module.dll+offsetA+offsetB+...-count-skipbyte
// Address version without pointers
// offsetA, offsetB, etc. can be omitted.

Output:
Desc_i:
Address: test-module.dll+offsetSum
// test-module.dll is left as is without address conversion.
// offsetSum = offsetA+offsetB+...+(skipbyte * i)

Part 2:
Input: [test-module.dll+offsetA+offsetB+...]+offsetC+offsetD+...-count-skipbyte
// One-level pointer version
// offsetA, offsetB, offsetC, offsetD, etc. can be omitted.

Output:
Desc_i:
Pointer: test-module.dll+offsetSumA
// offsetSumA = offsetA+offsetB+...
Offset: offsetSumB
// offsetSumB = offsetC+offsetD+...+(skipbyte * i)

Part 3:
Input: [[test-module.dll+offsetA+offsetB+...]+offsetC+offsetD+...]+offsetE+offsetF+...-count-skipbyte
// Two-level pointer version
// offsetA, offsetB, offsetC, offsetD, offsetE, offsetF, etc. can be omitted.

Output:
Desc_i:
Pointer: test-module.dll+offsetSumA
// offsetSumA = offsetA+offsetB+...
1st offset: offsetSumB
// offsetSumB = offsetC+offsetD+...
2nd offset: offsetSumB
// offsetSumB = offsetE+offsetF+...+(skipbyte * i)
// In CT, the pointer offset is applied from the bottom, so the bottom is 1st and the top is 2nd.

Can it be created with such a configuration?
Thank you in advance.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 36

Joined: 16 Feb 2017
Posts: 1499

PostPosted: Sun Jun 08, 2025 11:31 am    Post subject: Reply with quote

I didn't expect this topic to be this long.

Please test the code, watch for warnings, and check the offset calculations and additions.

(There are 2 tested examples at the end of the code.)

Code:
function multiPointers(inputStr)
    local lastPart, count, skipbyte = inputStr:match("%[(.-)%-(%d+)%-(%d+)$")

    if not lastPart or not count or not skipbyte then
        print("ERROR: Invalid input format!")
        return
    end

    count, skipbyte = tonumber(count), tonumber(skipbyte)

    lastPart = lastPart:gsub("%[", ""):gsub("%]%+", " ")
    print("Parsed LastPart:", lastPart)

    local i = 0
    local basePtr = ""
    local offTbl = {}

    for s in string.gmatch(lastPart, "%S+") do
        if i == 0 then
            basePtr = s
        else
            local totalOffset = 0
            for num in string.gmatch(s, "[^+]+") do

                local parsedNum = num:match("^%x+$") and tonumber(num, 16) or tonumber(num, 10)

                totalOffset = totalOffset + parsedNum
            end
            table.insert(offTbl, totalOffset)
        end
        i = i + 1
    end

    if basePtr == "" then
        print("ERROR: Base address could not be retrieved!")
        return
    end

    local al = getAddressList()
    if not al then
        print("ERROR: Address list could not be retrieved!")
        return
    end

    for i = 0, count - 1 do
        local rec = al.createMemoryRecord()
        if not rec then
            print("ERROR: Failed to create memory record!")
            return
        end

        rec.setAddress(basePtr)
        rec.setOffsetCount(#offTbl)

        for j = 1, #offTbl do

            if j == #offTbl then
                rec.setOffset(j - 1, string.format("%X", offTbl[j] + tonumber(skipbyte * i)))
            else
                rec.setOffset(j - 1, offTbl[j])
            end
        end
        rec.setDescription("Desc_"..i)
    end
end

function addMoreAddresses(str)
    local baseAddress, num, step = str:match("(.-)%-(.-)%-(.*)")

    if baseAddress~=nil or num~=nil or step~=nil then
        local al = getAddressList()
        baseAddress = tonumber(baseAddress, 16)

        for i = 0, num - 1 do
            local rec = al.createMemoryRecord()
            rec.setAddress(string.format("%X", baseAddress + step * i))
            rec.setType(2) -- List: CE>>Value Type: 0-Byte..1-2 Bytes..2-4 Bytes...
            rec.setDescription("Desc_"..i)
        end
    end
end

function input_str()
    local res = ""
    local str = inputQuery('Address Multiplexer', 'Write: Address-Step-Byte-Method\nMethod: (Enter false for address and true for pointer.)', res)
    if str then
       if str:match("%-(%w+)$") == "true" then
          str = string.gsub(str, "%-" .. str:match("%-(%w+)$"), "")
          multiPointers(str)
       elseif str:match("%-(%w+)$") == "false" then
          str = string.gsub(str, "%-" .. str:match("%-(%w+)$"), "")
          addMoreAddresses(str)
       else
          print("ERROR: Undefined method!\nUse -false for normal addresses,\nUse -true for pointers.")
       end
    end
end

-- Example inputs:
-- [[[[test-module.dll+5F80+10]+F8]+FA+100]+120+F8+64]+50-3-16-true
-- 713347B0-32-16-false
input_str()

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
yadamon
How do I cheat?
Reputation: 0

Joined: 15 Mar 2025
Posts: 9

PostPosted: Mon Jun 09, 2025 6:42 am    Post subject: Reply with quote

True version now works with the edited code below.

Code:

function multiPointers(inputStr)
    local lastPart, count, skipbyte = inputStr:match("%[(.-)%-(%d+)%-(%d+)$")

    if not lastPart or not count or not skipbyte then
        print("ERROR: Invalid input format!")
        return
    end

    count, skipbyte = tonumber(count), tonumber(skipbyte)

    lastPart = lastPart:gsub("%[", ""):gsub("%]%+", " ")
    print("Parsed LastPart:", lastPart)

    local i = 0
    local basePtr = ""
    local offTbl = {}

    for s in string.gmatch(lastPart, "%S+") do
        if i == 0 then
            basePtr = s
        else
            local totalOffset = 0
            for num in string.gmatch(s, "[^+]+") do

                local parsedNum = num:match("^%x+$") and tonumber(num, 16)

                totalOffset = totalOffset + parsedNum
            end
            table.insert(offTbl, totalOffset)
        end
        i = i + 1
    end

    if basePtr == "" then
        print("ERROR: Base address could not be retrieved!")
        return
    end

    local al = getAddressList()
    if not al then
        print("ERROR: Address list could not be retrieved!")
        return
    end

    for i = 0, count - 1 do
        local rec = al.createMemoryRecord()
        if not rec then
            print("ERROR: Failed to create memory record!")
            return
        end

        rec.setAddress(basePtr)
        rec.setOffsetCount(#offTbl)

        for j = 1, #offTbl do

            if j == #offTbl then
                rec.setOffset(#offTbl - j, offTbl[j] + skipbyte * i)
            else
                rec.setOffset(#offTbl - j, offTbl[j])
            end
        end
        rec.setDescription("Desc_"..i)
    end
end


However, if the offset is omitted along the way (like [[game.dll+100]]+200-3-16-true / [game.dll+100]+200]-3-16-true ), an error will occur.
This isn't really a problem as you can just leave it as +0 .

False version sometimes works and sometimes doesn't.
It's tricky even though it doesn't involve pointers.

thank you.
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 Discussions All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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