"just" look for stuff that aint there he says , lols, dude i have 0 clue how to handle code its like a jungle to me , i dont get jack lol, ill gladly wait till you got some spare time to finish this for sure , no rush but was a great start for sure thanks a ton , btw ive atleast managed to add autoload on fresh start feature , for that single profile , from some old lua code i had laying around, heres the lua code, just gotta make sure to change both the DefaultProccessName and PROCESS_NAME at the bottom to your own game exe >
Code: Select all
local format = string.format
local strE = string.empty or STRING_EMPTY or ''
local t = translate
if AddressList == nil then
AddressList = getAddressList()
end
if MainForm == nil then
MainForm = getMainForm()
end
if getCEVersion == nil or getCEVersion() < 6.5 then
messageDialog('It is recommended to use at least Cheat Engine 6.7! (Your Version: '..getCEVersion()..')', mtError, mbOK)
end
errorOnLookupFailure(false)
setGlobalDelayBetweenHotkeyActivation(200)
DefaultProccessName = "pcsx2.exe"
strings_add(getAutoAttachList(), DefaultProccessName)
PRIVATETABLE, SWITCHSUPPORT = true, false
----
--
---- Logger
local Logger = {
LEVELS = {
OFF = 0,
FATAL = 1,
ERROR = 2,
WARN = 3,
INFO = 4,
DEBUG = 5,
TRACE = 6
},
Level = 0,
}
for k, v in pairs(Logger.LEVELS) do
Logger[k:lower()] = function( ... ) return end
Logger[k:lower() .. 'f'] = function( ... ) return end
-- Logger[k:lower()] = function(msg, ex) return print(msg, ex) end
-- Logger[k:lower() .. 'f'] = function(msg, ... ) return print(string.format(msg, ... )) end
end
--
---- Helpers
local function split(s, delimiter)
result = {}
for match in (s .. delimiter):gmatch('(.-)' .. delimiter) do
table.insert(result, match)
end
return result
end
local function interp(s, tbl)
if s == nil then return end
return (s:gsub('($%b{})', function(w) return tbl[w:sub(3, -2)] or w end))
end
--
---- I2CETState
I2CETState = {
--
---- Settings
DefaultState = 'default',
SaveFileName = 'I2CETState.${StateName}.txt',
UseMemoryRecordDescriptions = false,
LineEnd = '\n',
DisableBeforeLoad = true,
PrintStatus = false, --true,
SaveValueMatch = 'AUTO SET:',
LineDelimiter = ',',
ScriptID = 'I2CETStateSCRIPTID',
BlackList = {
['_[ I2CETState ]_'] = true,
['_[ Save Table State ]_'] = true,
['_[ Load Table State ]_'] = true,
},
}
function I2CETState.saveTableState(stateName)
if not inMainThread() then
synchronize(function(thread)
I2CETState.saveTableState(stateName)
end)
return
end
Logger.trace()
if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
getLuaEngine().show()
end
if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
print(format('Saving Table State: %s', stateName))
end
local le = I2CETState.LineEnd
local ld = I2CETState.LineDelimiter
local sid = I2CETState.ScriptID
local svm = I2CETState.SaveValueMatch
if stateName == nil then
stateName = I2CETState.DefaultState
end
local fileName = interp(I2CETState.SaveFileName, { StateName = stateName } )
Logger.debugf('Using state file name: "%s"', fileName)
local fileStr = strE
for i = 0, AddressList.Count - 1 do
local mr = AddressList.getMemoryRecord(i)
if I2CETState.BlackList[mr.Description] ~= true
and mr.Description:sub(0, 16) ~= 'Load Table State'
and mr.Description:sub(0, 16) ~= 'Save Table State' then
local id = tostring(mr.ID)
if I2CETState.UseMemoryRecordDescriptions then
id = mr.Description
end
if mr.Type == vtAutoAssembler and mr.Active then
Logger.debugf('Saving script state: %d, %d, "%s"', mr.Index, mr.ID, mr.Description)
fileStr = fileStr..id..ld..sid..ld..tostring(mr.Active)..le
elseif mr.Value ~= '??' then
Logger.debugf('Saving value: %d, %d, "%s", %s', mr.Index, mr.ID, mr.Description, mr.Value)
fileStr = fileStr..id..ld..mr.Value..ld..tostring(mr.Active)..le
end
end
end
local f, err = io.open(fileName, 'w')
if err then
Logger.errorf('The file could not be opened, "%s", %s', fileName, err)
elseif f and not err then
f:write(fileStr)
f:close()
end
end
saveTableState = I2CETState.saveTableState
function I2CETState.loadTableState(stateName)
if not inMainThread() then
synchronize(function(thread)
I2CETState.loadTableState(stateName)
end)
return
end
Logger.trace()
if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
getLuaEngine().show()
end
if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
print(format('Setting Table State: %s', stateName))
end
local le = I2CETState.LineEnd
local ld = I2CETState.LineDelimiter
local sid = I2CETState.ScriptID
local svm = I2CETState.SaveValueMatch
if stateName == nil then
stateName = I2CETState.DefaultState
end
local fileName = interp(I2CETState.SaveFileName, { StateName = stateName } )
Logger.debugf('Using state file name: "%s"', fileName)
local fileStr = nil
local f, err = io.open(fileName, 'r')
if err then
Logger.infof('The local file could not be opened, "%s", %s', fileName, err)
local tableFile = findTableFile(fileName)
if tableFile == nil then
Logger.warnf('file not found, "%s"', fileName)
return
end
local stream = tableFile.getData()
local bytes = stream.read(stream.Size)
for i = 1, #bytes do
if fileStr == nil then
fileStr = strE
end
fileStr = fileStr .. string.char(bytes[i])
end
elseif f and not err then
fileStr = f:read('*all')
f:close()
else
Logger.errorf('The file could not be opened, "%s"', fileName)
end
if I2CETState.DisableBeforeLoad then
for i = AddressList.Count - 1, 0, -1 do
local mr = AddressList.getMemoryRecord(i)
if I2CETState.BlackList[mr.Description] ~= true
and mr.Description:sub(0, 16) ~= 'Load Table State'
and mr.Description:sub(0, 16) ~= 'Save Table State' then
if mr.Active then
Logger.infof('Disabling memory record: %d, %d, "%s"', mr.Index, mr.ID, mr.Description)
if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
print(format('Disabling: %s', mr.Description))
end
mr.Active = false
while mr.Async and mr.AsyncProcessing do
checkSynchronize()
end
sleep(0)
end
end
end
sleep(0)
end
if fileStr == nil then
Logger.info('File string was nil')
return
end
local lines = split(fileStr, I2CETState.LineEnd)
for i, v in ipairs(lines) do
if v ~= nil and v ~= strE then
local data = split(v, I2CETState.LineDelimiter)
local mr = nil
if I2CETState.UseMemoryRecordDescriptions then
mr = AddressList.getMemoryRecordByDescription(data[1])
else
mr = AddressList.getMemoryRecordByID(tonumber(data[1]))
end
if mr ~= nil then
if mr.Type == vtAutoAssembler and mr.Active == false
and data[2] == sid and data[3] == tostring(true) then
Logger.infof('Enabling memory record: %d, %d, "%s"', mr.Index, mr.ID, mr.Description)
if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
print(format('Enabling: "%s"', mr.Description))
end
mr.Active = true
while mr.Async and mr.AsyncProcessing do
checkSynchronize()
end
sleep(0)
elseif mr.Type ~= vtAutoAssembler then
if mr.Value == '??' then
Logger.warnf('Memory record value not set: %d, %d, "%s", "%s"', mr.Index, mr.ID, mr.Description, mr.Value)
if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
print(format('Memory record value not set: "%s", "%s"', mr.Description, mr.Value))
end
else
Logger.infof('Setting memory record: %d, %d, "%s", %s, %s', mr.Index, mr.ID, mr.Description, data[1], data[2])
if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
print(format('Setting: "%s", %s', mr.Description, data[2]))
end
mr.Value = data[2]
if data[3] == tostring(true) then
mr.Active = true
end
end
end
else
Logger.errorf('Memory record not found: "%s", "%s", "%s"', data[1], data[2], v)
end
end
end
if I2CETState.PrintStatus and Logger.Level <= Logger.LEVELS.WARN then
print(format('Table State Set: %s', stateName))
getLuaEngine().hide()
end
end
loadTableState = I2CETState.loadTableState
--------
PROCESS_NAME = 'pcsx2.exe'
--------
-------- Auto Attach
--------
local autoAttachTimer = nil
local autoAttachTimerInterval = 100
local autoAttachTimerTicks = 0
local autoAttachTimerTickMax = 5000
local function autoAttachTimer_tick(timer)
if autoAttachTimerTickMax > 0 and autoAttachTimerTicks >= autoAttachTimerTickMax then
timer.destroy()
end
if getProcessIDFromProcessName(PROCESS_NAME) ~= nil then
timer.destroy()
openProcess(PROCESS_NAME)
getAddressList().getMemoryRecordByDescription("Load Table State").active=true
end
autoAttachTimerTicks = autoAttachTimerTicks + 1
end
autoAttachTimer = createTimer(MainForm)
autoAttachTimer.Interval = autoAttachTimerInterval
autoAttachTimer.OnTimer = autoAttachTimer_tick
maybe someone else might like to help out on polishing this further besides you , not too hopeful bout that tho lol , but you never know