Skip to content

Memory

Functions

Return Type Name Description
number memory.base() Base address of the game
number memory.size() Size of the game
allocated_memory memory.alloc(number size) Allocates memory
allocated_memory memory.free(allocated_memory mem) Frees alocated memory
memory_address memory.scan(string signature, string? module) Scans memory for a signature
memory_address memory.call(number address, ... params) Calls a function by address

Types

allocated_memory

Operator Description
[] Read and write to memory, index is per byte

memory_address

Property Name Description
number value The address
number int8 Reads the address as this type
number int16 Reads the address as this type
number int32 Reads the address as this type
number int64 Reads the address as this type
number uint8 Reads the address as this type
number uint16 Reads the address as this type
number uint32 Reads the address as this type
number uint64 Reads the address as this type
number float Reads the address as this type
number double Reads the address as this type
bool bool Reads the address as this type
string str Reads the address as this type
vec2 vec2 Reads the address as this type
vec3 vec3 Reads the address as this type
scr_vec3 scr_vec3 Reads the address as this type
number as_int8 Casts the address to this type
number as_int16 Casts the address to this type
number as_int32 Casts the address to this type
number as_int64 Casts the address to this type
number as_uint8 Casts the address to this type
number as_uint16 Casts the address to this type
number as_uint32 Casts the address to this type
number as_uint64 Casts the address to this type
number as_float Casts the address to this type
number as_double Casts the address to this type
bool as_bool Casts the address to this type
string as_str Casts the address to this type
vec2 as_vec2 Casts the address to this type
vec3 as_vec3 Casts the address to this type
scr_vec3 as_scr_vec3 Casts the address to this type
Return Type Name Description
memory_address memory_address(number address) Constructs a memory_address
memory_address add(number offset) Adds an offset to the address and returns the new memory_address
memory_address sub(number offset) Subtracts an offset from the address and returns the new memory_address
memory_address nop(number count) Writes count NOP instructions at the address.
memory_address rip(number opsize, number instsize) Extracts data from an instruction at the address using opsize and instsize

Examples

-- Get the extra content crc hash
local extra_content = memory.scan('48 8B 0D ? ? ? ? 33 D2 E8 ? ? ? ? 45 33 C0 48 8D 4C')
if extra_content.value ~= 0 then
  local manager = extra_content:rip(3, 7).uint64
  local get_crc = extra_content:add(9):rip(1, 5)

  local crc = memory.call(get_crc.value, manager, 0).as_int32
  print('CRC hash: ', crc)
end