CS2 Extended API
This API is available in both the Uni API and the CS2 product.
In the CS2 product, all standard Proc API functions are supported except:
Process referencing by PID/name
Engine-specific helpers
Virtual memory allocation (
alloc_vm/free_vm)
On CS2 Product, ref_process() always returns the CS2 process only, so it is used like:
local cs2 = ref_process() -- for CS2 Product onlyThere is no memory allocation API exposed in the CS2 product.
🔗 process:cs2_get_interface(module_base, name)
Resolves a CreateInterface-style interface exported by a CS2 module.
addr = process:cs2_get_interface(module_base, name)Parameters
module_baseBase address of the module that exportsCreateInterface, e.g.:"tier0.dll"
Typically obtained via:
local base, size = process:get_module("tier0.dll")nameInterface name string, e.g.:"VEngineCvar007"
Returns
Absolute pointer to the resolved interface (Lua integer).
0if the interface cannot be found or the arguments are invalid.
🧬 process:cs2_get_schema_dump()
Dumps all Schema System fields for client.dll via schemasystem.dll.
entries = process:cs2_get_schema_dump()Return value
A Lua array-style table (1..N) where each element is a table:
{
name = "ClassName::fieldName", -- string
offset = 0x10, -- integer offset
}Fields
name—"ClassName::fieldName", UTF-8 string e.g."CPulse_CallInfo::m_nEditorNodeID","C_BaseEntity::m_iHealth"offset— field offset from the base of that class.
If no schema data can be read, returns an empty table.
🧪 Example – Interface Lookup + Schema Dump (Lua)
local function dump_schema(proc)
local entries = proc:cs2_get_schema_dump()
if not entries or #entries == 0 then
log("[LUA] schema dump empty")
return
end
log("[LUA] Dumping " .. #entries .. " schema fields...")
for i = 1, #entries do
local e = entries[i]
if e then
-- format: CPulse_CallInfo::m_nEditorNodeID @ 0x00000010
log(string.format(
"%s @ 0x%08X",
e.name,
e.offset
))
end
end
log("[LUA] Schema dump complete.")
end
function main()
-- Uni API build:
local cs2 = ref_process("cs2.exe")
-- On the CS2 Product build, just use:
-- local cs2 = ref_process()
if not cs2 or not cs2:alive() then
log("[LUA] cs2.exe not found")
return 0
end
local tierBase, tierSize = cs2:get_module("tier0.dll")
if not tierBase then
log("[LUA] tier0.dll not found")
return 0
end
local iface = cs2:cs2_get_interface(tierBase, "VEngineCvar007")
if iface == 0 then
log("[LUA] interface not found!")
return 0
end
log(string.format(
"VEngineCvar007 interface at 0x%016X",
iface
))
dump_schema(cs2)
return 1
endLast updated