class
Cradare2::DSL::Memory
- Cradare2::DSL::Memory
- Reference
- Object
Overview
DSL for memory inspection, reading, writing, and byte pattern searching.
Defined in:
cradare2/dsl/memory.crConstructors
Instance Method Summary
-
#hexdiff(address1 : Address, address2 : Address, size : Int32 = 64) : String
Compares memory between two addresses and returns diff output.
-
#hexdump(address : Address | Nil = nil, size : Int32 = 64) : String
Returns formatted hexdump text for human inspection.
-
#read(address : Address, size : Int32) : Bytes
Reads raw bytes from address as a Crystal
Bytesslice. -
#read_bytes(address : Address, size : Int32) : Bytes
Alias for
#read. -
#read_cstring(address : Address, max_len : Int32 = 256) : String
Reads a null-terminated UTF-8 C-string from memory with fallback to byte search.
-
#read_f32(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Float32
Reads floating-point numbers.
-
#read_f32_array(address : Address, count : Int32, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Array(Float32)
Reads an array of 32-bit IEEE 754 floating point numbers.
- #read_f64(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Float64
-
#read_hex(address : Address, size : Int32) : String
Reads bytes formatted as a continuous hex string.
- #read_i128(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Int128
- #read_i16(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Int16
- #read_i32(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Int32
- #read_i64(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Int64
-
#read_i8(address : Address) : Int8
Reads signed integers of various bit widths.
-
#read_pointer32_array(address : Address, count : Int32, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Array(UInt32)
Reads an array of 32-bit pointers (ideal for 32-bit targets like PS2 MIPS).
-
#read_pointer_array(address : Address, count : Int32) : Array(UInt64)
Reads an array of 64-bit pointers (ideal for vtables, dispatch tables, and StringName literals).
-
#read_qword(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : UInt128
Alias for read_u128.
-
#read_string(address : Address, max_len : Int32 | Nil = nil) : String
Reads a null-terminated C string from memory address.
-
#read_u128(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : UInt128
Reads a 128-bit unsigned integer (Emotion Engine QWORD).
- #read_u16(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : UInt16
- #read_u32(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : UInt32
-
#read_u32_array(address : Address, count : Int32, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Array(UInt32)
Reads an array of 32-bit unsigned integers.
- #read_u64(address : Address, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : UInt64
-
#read_u64_array(address : Address, count : Int32, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Array(UInt64)
Reads an array of 64-bit unsigned integers.
-
#read_u8(address : Address) : UInt8
Reads unsigned integers of various bit widths.
-
#read_u8_array(address : Address, count : Int32) : Array(UInt8)
Reads an array of 8-bit unsigned integers.
-
#search_bytes(bytes : Bytes) : Array(UInt64)
Searches memory for a byte pattern (e.g.
-
#search_hex(hex_pattern : String) : Array(UInt64)
Searches memory for a hex string pattern, allowing optional spaces (e.g.
-
#search_string(query : String) : Array(UInt64)
Searches memory for a string query.
-
#write(address : Address, bytes : Bytes) : self
Writes a slice of bytes to the given address using
wx. -
#write_hex(address : Address, hex : String) : self
Writes hex characters directly (e.g.
- #write_i128(address : Address, value : Int128, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : self
- #write_i16(address : Address, value : Int16) : self
- #write_i32(address : Address, value : Int32) : self
- #write_i64(address : Address, value : Int64) : self
- #write_i8(address : Address, value : Int8) : self
-
#write_qword(address : Address, value : UInt128, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : self
Alias for write_u128.
-
#write_string(address : Address, string : String) : self
Writes a string to the given address.
-
#write_u128(address : Address, value : UInt128, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : self
Writes a 128-bit unsigned integer (Emotion Engine QWORD).
-
#write_u16(address : Address, value : UInt16) : self
Writes a 16-bit unsigned integer.
-
#write_u32(address : Address, value : UInt32) : self
Writes a 32-bit integer.
-
#write_u64(address : Address, value : UInt64) : self
Writes a 64-bit integer.
-
#write_u8(address : Address, value : UInt8) : self
Writes an 8-bit unsigned integer.
Constructor Detail
Instance Method Detail
Compares memory between two addresses and returns diff output.
Returns formatted hexdump text for human inspection.
Reads raw bytes from address as a Crystal Bytes slice.
Reads a null-terminated UTF-8 C-string from memory with fallback to byte search.
Reads floating-point numbers.
Reads an array of 32-bit IEEE 754 floating point numbers.
Reads bytes formatted as a continuous hex string.
Reads an array of 32-bit pointers (ideal for 32-bit targets like PS2 MIPS).
Reads an array of 64-bit pointers (ideal for vtables, dispatch tables, and StringName literals).
Alias for read_u128.
Reads a null-terminated C string from memory address.
Reads a 128-bit unsigned integer (Emotion Engine QWORD).
Reads an array of 32-bit unsigned integers.
Reads an array of 64-bit unsigned integers.
Reads unsigned integers of various bit widths.
Reads an array of 8-bit unsigned integers.
Searches memory for a byte pattern (e.g. Bytes[0x48, 0x89]).
Searches memory for a hex string pattern, allowing optional spaces (e.g. "48 89 5c 24").
Writes a slice of bytes to the given address using wx.
Writes hex characters directly (e.g. "909090" for NOPs).
Alias for write_u128.
Writes a string to the given address.
Writes a 128-bit unsigned integer (Emotion Engine QWORD).
Writes a 16-bit unsigned integer.
Writes an 8-bit unsigned integer.