{$STRICT}
{$lua}
if syntaxcheck then return end
[ENABLE]
function aobscanex( aob, p, a, n, s, e, pb )
local p, a, n, s, e = p or '*X*W', a or fsmNotAligned, n or '0', s or 0x0, e or 0xffffffffffffffff
local ms = pb and createMemScan( pb ) or createMemScan()
local fl = createFoundList( ms )
ms.firstScan( soExactValue, vtByteArray, nil, aob, nil, s, e, p, a, n, true, false, false, false )
ms.waitTillDone()
fl.initialize()
local result = nil
if fl ~= nil and fl.getCount() > 0 then
result = createStringlist()
for i = 1, fl.getCount() do result.add( fl.getAddress( i - 1 ) ) end
end
fl.destroy()
ms.destroy()
return result
end
local aob_toUCheatManagerGetPrivateStaticClass = "E8????????41B83D00000048"
local aob_APlayerControllerAddCheats = "405356574883EC??488B010FB6DA4889CF"
local lst_result = aobscanex( aob_toUCheatManagerGetPrivateStaticClass, nil, nil, nil, getAddress( process ), getAddress( process ) + getModuleSize( process ) )
local t = tonumber( lst_result[0], 16 )
local UCheatManager_GetPrivateStaticClass = t + readInteger( t + 0x1, true ) + 0x5
lst_result = aobscanex( aob_APlayerControllerAddCheats, nil, nil, nil, getAddress( process ), getAddress( process ) + getModuleSize( process ) )
local APlayerController_AddCheats = tonumber( lst_result[0], 16 )
local SwPlayerController = getAddressSafe( "SwPlayerController" )
if SwPlayerController ~= nil then
SwPlayerController = readQword( SwPlayerController )
if SwPlayerController ~= nil then
local CheatManager = readQword( SwPlayerController + 0x480 )
if CheatManager == 0 then
local CheatManagerClass = executeCode( UCheatManager_GetPrivateStaticClass )
writeQword( SwPlayerController + 0x488, CheatManagerClass )
executeCodeEx( 0, nil, APlayerController_AddCheats, SwPlayerController, 0 )
end
end
end
[DISABLE]
{$asm}
unregistersymbol( APlayerController_AddCheats )
unregistersymbol( UCheatManager_GetPrivateStaticClass )