feat(core): CheatEngine script loaders

This commit is contained in:
gromchek 2026-01-31 18:29:03 +03:00
parent f9fe6ca3e7
commit 4ca5f1bbe5
15 changed files with 4578 additions and 17 deletions

47
cheatengine/cmaparea.lua Normal file
View file

@ -0,0 +1,47 @@
-- #include "cmapbaseobj.lua"
local CMapAreaTexture = Struct("CMapAreaTexture")
:field("memoryCapacity", "uint32")
:field("count", "uint32")
:hex("memoryPtr", "uint32")
local CMapArea = Struct('CMapArea', CMapBaseObj)
:embed('bottomRight', C3Vector)
:embed('topLeft', C3Vector)
:embed('topLeft2', C3Vector)
:embed('index', C2iVector)
:embed('tileChunkIndex', C2iVector)
:embed("textures", TSGrowableArray)
:ptr('SMMapHeader', 'header')
:field('unk_6C', 'int32')
:ptr('CAsyncObject', 'asyncObject')
:embed('chunkLinkList', TSExplicitList)
:ptr('filePtr')
:field('fileSize', 'int32')
:ptr('SMChunkInfo', 'chunkInfo')
:field('unk_8C', 'int32')
:ptr('SMDoodadDef', 'doodadDef')
:ptr('SMMapObjDef', 'mapObjDef')
:field('doodadDefCount', 'int32')
:field('mapObjDefCount', 'int32')
:ptr('m2FileNames')
:ptr('wmoFileNames')
:ptr('modelFilenamesOffsets')
:ptr('wmoFilenamesOffsets')
:ptr('flyingBbox')
:ptr('textureFlags')
:ptr('unk_B8')
:ptrArray('mapChunk', 256)
local address = 0x007b5c18 -- at CMap__PreUpdateAreas
debugger_onBreakpoint = nil
function onBreakpoint()
loadStructToTable(CMapArea, ESI)
debugger_onBreakpoint = nil
debug_removeBreakpoint(address)
debug_continueFromBreakpoint(co_run)
return 1
end
debug_setBreakpoint(address)
debugger_onBreakpoint = onBreakpoint

View file

@ -0,0 +1,48 @@
-- #include "StructDef.lua"
local CImVector = Struct("CImVector")
:field("r", "uint8")
:field("g", "uint8")
:field("b", "uint8")
:field("a", "uint8")
local C3Vector = Struct("C3Vector")
:field("x", "float")
:field("y", "float")
:field("z", "float")
local C2iVector = Struct("C2iVector")
:field("x", "int32")
:field("y", "int32")
local CAaBox = Struct("CAaBox")
:embed("top", C3Vector)
:embed("bottom", C3Vector)
local CAaSphere = Struct("CAaSphere")
:embed("center", C3Vector)
:field("d", "float")
local C44Matrix = Struct("C44Matrix")
:array('m', 'float', 16)
local TSGrowableArray = Struct("TSGrowableArray")
:field('m_alloc', 'uint32')
:field('m_count', 'uint32')
:ptr('data')
:field('m_chunk', 'uint32')
local TSExplicitList = Struct("TSExplicitList")
:field("m_linkOffset", "uint32")
:ptr("ptr1")
:ptr("ptr2")
local CMapBaseObj = Struct("CMapBaseObj")
:ptr("void*", "vtable")
:field("objectIndex", "uint32")
:field("type", "uint16")
:field("refCount", "uint16")
:field("unk_C", "int32")
:ptr("prev")
:ptr("next")
:embed("objLink", TSExplicitList)

60
cheatengine/cmapchunk.lua Normal file
View file

@ -0,0 +1,60 @@
-- #include "cmapbaseobj.lua"
local CMapChunk = Struct('CMapChunk', CMapBaseObj)
:embed('aIndex', C2iVector)
:embed('sOffset', C2iVector)
:embed('cOffset', C2iVector)
:embed('center', C3Vector)
:field('radius', 'float')
:embed('bbox', CAaBox)
:embed('bottomRight', C3Vector)
:embed('topLeft', C3Vector)
:embed('topLeftCoords', C3Vector)
:field('distToCamera', 'float')
:embed('bbox2', CAaBox)
:ptr('detailDoodadInst')
:ptr('renderChunk')
:field('unk_AC', 'int32')
:field('areaId', 'int32')
:field('unk_B4', 'int32')
:field('unk_B8', 'int32')
:field('unk_BC', 'int32')
:field('unk_C0', 'int32')
:embed('doodadDefLinkList', TSExplicitList)
:embed('mapObjDefLinkList', TSExplicitList)
:embed('unkList', TSExplicitList)
:embed('lightLinkList', TSExplicitList)
:embed('mapSoundEmitterLinkList', TSExplicitList)
:embed('liquidChunkLinkList', TSExplicitList)
:ptr('chunkInfoBeginPtr')
:ptr('header')
:ptr('lowQualityTexMap')
:ptr('predTexture')
:ptr('vertices')
:ptr('vertexShading')
:ptr('normals')
:ptr('shadowMap')
:ptr('layers')
:ptr('additionalShadowmap')
:ptr('MCRF')
:ptr('liquid')
:ptr('soundEmitters')
:field('unk_140', 'int32')
:field('unk_144', 'int32')
:field('unk_148', 'int32')
:field('unk_14C', 'int32')
:field('unk_150', 'int32')
:field('unk_154', 'int32')
local address = 0x00795e25 -- at CWorldScene__LocateViewer3
debugger_onBreakpoint = nil
function onBreakpoint()
loadStructToTable(CMapChunk, ECX)
debugger_onBreakpoint = nil
debug_removeBreakpoint(address)
debug_continueFromBreakpoint(co_run)
return 1
end
debug_setBreakpoint(address)
debugger_onBreakpoint = onBreakpoint

View file

@ -0,0 +1,17 @@
-- #include "cmapstaticentity.lua"
local CMapEntity = Struct("CMapEntity", CMapStaticEntity)
:paddingTo(0x98)
:hex("GUID", "uint64")
:paddingTo(0xC0)
:embed("ambientTarget", CImVector)
:field("dirLightScaleTarget", "float")
:paddingTo(0xD0)
local addr, typ = GetCGObjectAddr(readQword(0x00bd07b0)) -- target guid
if addr then
if typ == "unit" or typ == "player" then
local cmapentityOffset = 0xB8
loadStructToTable(CMapEntity, readPointer(addr + cmapentityOffset))
end
end

View file

@ -0,0 +1,45 @@
-- #include "cmapbaseobj.lua"
local CMapObjDef = Struct('CMapObjDef', CMapBaseObj)
:ptr('unk_24')
:ptr('unk_28')
:ptr('unk_2C')
:ptr('unk_30')
:ptr('unk_34')
:field('unk_38', 'int32')
:embed('position', C3Vector)
:embed('bbox', CAaBox)
:embed('sphere', CAaSphere)
:embed('mat', C44Matrix)
:embed('invMat', C44Matrix)
:field('unk_F0', 'int32')
:ptr('owner')
:field('unk_F8', 'int32')
:field('unkFlags', 'uint32')
:field('unk_100', 'int32')
:field('unk_104', 'int32')
:field('unk_108', 'int32')
:field('unk_10C', 'int32')
:field('unk_110', 'int32')
:embed('mapObjDefGroupLinkList', TSExplicitList)
:embed('defGroups', TSGrowableArray)
:ptr('unk_130')
:embed('unkGrowableArray', TSGrowableArray)
:embed('color', CImVector)
:field('unk_148', 'int32')
:field('unk_14C', 'int32')
:field('unk_150', 'int32')
:ptr('unk_154')
local address = 0x0078261f -- at CMap__QueryAreaId
debugger_onBreakpoint = nil
function onBreakpoint()
loadStructToTable(CMapObjDef, ESI)
debugger_onBreakpoint = nil
debug_removeBreakpoint(address)
debug_continueFromBreakpoint(co_run)
return 1
end
debug_setBreakpoint(address)
debugger_onBreakpoint = onBreakpoint

View file

@ -0,0 +1,42 @@
-- #include "cmapbaseobj.lua"
local CMapObjDefGroup = Struct('CMapObjDefGroup', CMapBaseObj)
:embed('bbox', CAaBox)
:embed('sphere', CAaSphere)
:field('unk_4C', 'float')
:field('groupNum', 'uint32')
:field('unkFlags', 'uint32')
:field('unk_58', 'int32')
:embed('ambientColor', CImVector)
:field('unk_60', 'int32')
:field('unk_64', 'int32')
:field('unk_68', 'int32')
:embed('unkExplicitList', TSExplicitList)
:embed('doodadDefLinkList', TSExplicitList)
:embed('mapEntityLinkList', TSExplicitList)
:embed('unkExplicitList', TSExplicitList)
:embed('unkExplicitList', TSExplicitList)
:field('unk_A8', 'int32')
:field('unk_AC', 'int32')
:field('unk_B0', 'int32')
:field('unk_B4', 'int32')
:field('unk_B8', 'int32')
:field('unk_BC', 'int32')
local address = 0x0078261f -- at CMap__QueryAreaId
debugger_onBreakpoint = nil
function onBreakpoint()
local defGroupsNum = readPointer(ESI + 0x124)
local defGroupsDataPtr = ESI + 0x128
local CMapObjDefGroupSize = 0xC0
for i = 0, defGroupsNum, 1 do
loadStructToTable(CMapObjDefGroup, readPointer(readPointer(defGroupsDataPtr)) + CMapObjDefGroupSize * i)
end
debugger_onBreakpoint = nil
debug_removeBreakpoint(address)
debug_continueFromBreakpoint(co_run)
return 1
end
debug_setBreakpoint(address)
debugger_onBreakpoint = onBreakpoint

View file

@ -0,0 +1,17 @@
-- #include "cmapbaseobj.lua"
local CMapStaticEntity = Struct("CMapStaticEntity", CMapBaseObj)
:paddingTo(0x28)
:field("unkFlags", "uint32")
:field("unkCounter", "int32")
:field("unk_030", "float")
:ptr("CM2Model", "model")
:embed("sphere", CAaSphere)
:embed("bbox", CAaBox)
:embed("vec2", C3Vector)
:embed("position", C3Vector)
:field("scale", "float")
:paddingTo(0x84)
:embed("m2AmbietColor", CImVector)
:embed("m2DiffuseColor", CImVector)
:field("unk_08C", "float")