Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Cheat Engine Lua script snippet
- -- formats string drop down list values to AoBs and writes 0s to unused bytes
- for i = 0, AddressList.count - 1 do
- local mr = AddressList[i]
- -- identify memory records to change
- if mr.Type == vtString
- and not mr.IsGroupHeader
- and mr.DropDownCount > 0
- and not mr.DropDownLinked then -- possibly undesirable; I haven't experimented w/ linking
- local size = mr.String.Size
- -- sanity check
- for j = 0, mr.DropDownCount - 1 do
- assert(#mr.DropDownValue[j] <= size,
- ('Error: memory record "%s" (#%d, ID %d): drop down value "%s" longer than size "%d".'):format(
- mr.Description, i, mr.ID, mr.DropDownValue[j], size))
- end
- mr.Type = vtByteArray
- mr.Aob.Size = size
- mr.DropDownList.beginUpdate()
- for j = 0, mr.DropDownCount - 1 do
- local val_str = mr.DropDownValue[j]
- local bt = stringToByteTable(val_str)
- for k = #val_str + 1, size, 1 do
- bt[#bt+1] = 0
- end
- if bt[#bt] ~= 0 then
- print(('Warning: memory record "%s" (#%d, ID %d): value of drop down description "%s" has no null terminator.'):format(
- mr.Description, i, mr.ID, mr.DropDownDescription[j]))
- end
- for k,v in ipairs(bt) do
- bt[k] = ('%02X'):format(v)
- end
- mr.DropDownList.setString(j, ('%s:%s'):format(table.concat(bt), mr.DropDownDescription[j]))
- end
- mr.DropDownList.endUpdate()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement