This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
addons:functions:memory [2017/04/21 22:35] atom0s created |
addons:functions:memory [2017/04/22 00:03] (current) atom0s |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ~~NOTOC~~ | ||
===== Memory Namespace ===== | ===== Memory Namespace ===== | ||
Line 5: | Line 4: | ||
You can access these functions via: | You can access these functions via: | ||
- | <code lua>ashita.memory.</code> | + | <sxh lua>ashita.memory.</sxh> |
---- | ---- | ||
Line 12: | Line 12: | ||
Obtains the base address of a module. | Obtains the base address of a module. | ||
- | <code lua>number ashita.memory.get_base(name);</code> | + | <sxh lua>number ashita.memory.get_base(name);</sxh> |
* **Parameters** | * **Parameters** | ||
* name - (string) The name of the module to obtain the base address of. | * name - (string) The name of the module to obtain the base address of. | ||
Line 23: | Line 23: | ||
Obtains the size of a module. | Obtains the size of a module. | ||
- | <code lua>number ashita.memory.get_size(name);</code> | + | <sxh lua>number ashita.memory.get_size(name);</sxh> |
* **Parameters** | * **Parameters** | ||
* name - (string) The name of the module to obtain the size of. | * name - (string) The name of the module to obtain the size of. | ||
Line 34: | Line 34: | ||
Unprotects an area of memory, setting its page access to 'PAGE_EXECUTE_READWRITE'. | Unprotects an area of memory, setting its page access to 'PAGE_EXECUTE_READWRITE'. | ||
- | <code lua>bool ashita.memory.unprotect(addr, size);</code> | + | <sxh lua>bool ashita.memory.unprotect(addr, size);</sxh> |
* **Parameters** | * **Parameters** | ||
* addr - (number) The starting address to unprotect. | * addr - (number) The starting address to unprotect. | ||
Line 47: | Line 47: | ||
Allocates an area of memory. | Allocates an area of memory. | ||
- | <code lua>number ashita.memory.alloc(size);</code> | + | <sxh lua>number ashita.memory.alloc(size);</sxh> |
* **Parameters** | * **Parameters** | ||
* size - (number) The size of data to allocate. | * size - (number) The size of data to allocate. | ||
Line 59: | Line 59: | ||
Deallocates an area of memory. | Deallocates an area of memory. | ||
- | <code lua>bool ashita.memory.dealloc(addr, size);</code> | + | <sxh lua>bool ashita.memory.dealloc(addr, size);</sxh> |
* **Parameters** | * **Parameters** | ||
* addr - (number) The base address of the memory to deallocate. | * addr - (number) The base address of the memory to deallocate. | ||
Line 71: | Line 71: | ||
Scans memory for a given pattern. | Scans memory for a given pattern. | ||
- | <code lua>number ashita.memory.find(baseAddress, size, pattern, offset, usage);</code> | + | <sxh lua>number ashita.memory.find(baseAddress, size, pattern, offset, usage);</sxh> |
* **Parameters** | * **Parameters** | ||
* baseAddress - (number) The base address of the memory to scan within. | * baseAddress - (number) The base address of the memory to scan within. | ||
Line 81: | Line 81: | ||
* number - The address where the pattern was found on success, 0 otherwise. | * number - The address where the pattern was found on success, 0 otherwise. | ||
- | <code lua>number ashita.memory.find(moduleName, size, pattern, offset, usage);</code> | + | <sxh lua>number ashita.memory.find(moduleName, size, pattern, offset, usage);</sxh> |
* **Parameters** | * **Parameters** | ||
* moduleName - (string) The name of the module to scan within. (Using this method of this function will use the base and size of the module automatically.) | * moduleName - (string) The name of the module to scan within. (Using this method of this function will use the base and size of the module automatically.) | ||
Line 93: | Line 93: | ||
---- | ---- | ||
==== ashita.memory.read_uint8 ==== | ==== ashita.memory.read_uint8 ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_uint8(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_uint16 ==== | ==== ashita.memory.read_uint16 ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_uint16(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_uint32 ==== | ==== ashita.memory.read_uint32 ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_uint32(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_uint64 ==== | ==== ashita.memory.read_uint64 ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_uint64(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_int8 ==== | ==== ashita.memory.read_int8 ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_int8(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_int16 ==== | ==== ashita.memory.read_int16 ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_int16(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_int32 ==== | ==== ashita.memory.read_int32 ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_int32(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_int64 ==== | ==== ashita.memory.read_int64 ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_int64(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_float ==== | ==== ashita.memory.read_float ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_float(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_double ==== | ==== ashita.memory.read_double ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_double(addr);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * **Returns** | ||
+ | * number - The value of the address, 0 on error. | ||
---- | ---- | ||
==== ashita.memory.read_array ==== | ==== ashita.memory.read_array ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_array(addr, size);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * size - (number) The size of data to read. | ||
+ | * **Returns** | ||
+ | * table - The values read from the given address, nil on error. | ||
---- | ---- | ||
==== ashita.memory.read_string ==== | ==== ashita.memory.read_string ==== | ||
+ | |||
+ | Reads a value from memory at the given address. | ||
+ | <sxh lua>number ashita.memory.read_string(addr, size);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to read the value of. | ||
+ | * size - (number) The size of the string to read. | ||
+ | * **Returns** | ||
+ | * string - The string read from the given address, nil on error. | ||
---- | ---- | ||
==== ashita.memory.write_uint8 ==== | ==== ashita.memory.write_uint8 ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_uint8(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_uint16 ==== | ==== ashita.memory.write_uint16 ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_uint16(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_uint32 ==== | ==== ashita.memory.write_uint32 ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_uint32(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_uint64 ==== | ==== ashita.memory.write_uint64 ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_uint64(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_int8 ==== | ==== ashita.memory.write_int8 ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_int8(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_int16 ==== | ==== ashita.memory.write_int16 ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_int16(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_int32 ==== | ==== ashita.memory.write_int32 ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_int32(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_int64 ==== | ==== ashita.memory.write_int64 ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_int64(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_float ==== | ==== ashita.memory.write_float ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_float(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_double ==== | ==== ashita.memory.write_double ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_double(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (number) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_array ==== | ==== ashita.memory.write_array ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_array(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (table) The array of data to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||
---- | ---- | ||
==== ashita.memory.write_string ==== | ==== ashita.memory.write_string ==== | ||
+ | |||
+ | Writes a value to memory at the given address. | ||
+ | <sxh lua>void ashita.memory.write_string(addr, value);</sxh> | ||
+ | * **Parameters** | ||
+ | * addr - (number) The address to write the value to. | ||
+ | * value - (string) The value to write to memory. | ||
+ | * **Returns** | ||
+ | * //Function does not return a value.// | ||