![]() |
JaffarPlus
High-performance best-first search optimizer for tool-assisted speedruns
|
A named, typed reference to a value stored at a memory address. More...
#include <property.hpp>
Public Types | |
| enum | datatype_t { dt_uint8 , dt_uint16 , dt_uint32 , dt_uint64 , dt_int8 , dt_int16 , dt_int32 , dt_int64 , dt_bool , dt_float32 , dt_float64 } |
| The interpretation of the bytes at the property's memory address. More... | |
| enum | endianness_t { little , big } |
| The byte order of the value stored at the property's memory address. More... | |
Public Member Functions | |
| Property ()=delete | |
| Default construction is disabled; a property requires a name, pointer, datatype and endianness. | |
| Property (const std::string &name, void *const pointer, const datatype_t datatype, endianness_t endianness) | |
| Constructs a property describing a value in memory. | |
| size_t | getSize () const |
| Returns the size in bytes of the property's value. | |
| template<typename T > | |
| T | getValue () const |
Reads the property's value at its memory address as type T, applying endianness conversion. | |
| datatype_t | getDatatype () const |
| Returns the property's datatype. | |
| std::string | getName () const |
| Returns the property's name. | |
| jaffarCommon::hash::hash_t | getNameHash () const |
| Returns the hash of the property's name. | |
| void * | getPointer () const |
| Returns the raw pointer to the property's value in memory. | |
Static Public Member Functions | |
| static endianness_t | parseEndiannessName (const std::string &endiannessName) |
| Maps a configuration endianness string to its endianness_t value. | |
| static datatype_t | parseDatatypeName (const std::string &datatypeName) |
| Maps a configuration datatype string to its datatype_t value. | |
| static size_t | getDatatypeSize (const datatype_t datatype) |
| Returns the size in bytes of a given datatype. | |
Private Attributes | |
| const std::string | _name |
| Identifying name of the property. | |
| void *const | _pointer |
| Pointer to the property's value in game memory. | |
| const datatype_t | _datatype |
| How the bytes at _pointer are interpreted. | |
| const endianness_t | _endianness |
| Byte order of the value at _pointer. | |
| const jaffarCommon::hash::hash_t | _nameHash |
| Precomputed hash of _name for fast lookup. | |
A named, typed reference to a value stored at a memory address.
A property pairs a name with a raw pointer into game memory, a datatype describing how the bytes at that address are interpreted, and an endianness describing their byte order. Conditions and other engine components read the live value through getValue.
Definition at line 24 of file property.hpp.
The interpretation of the bytes at the property's memory address.
Definition at line 28 of file property.hpp.
The byte order of the value stored at the property's memory address.
| Enumerator | |
|---|---|
| little | Little endian byte order (config endianness "Little"). |
| big | Big endian byte order (config endianness "Big"). |
Definition at line 44 of file property.hpp.
|
inline |
Constructs a property describing a value in memory.
| name | Identifying name for the property; also hashed for fast lookup. |
| pointer | Pointer to the bytes in game memory this property refers to. |
| datatype | How the bytes at pointer are interpreted. |
| endianness | Byte order of the value at pointer. |
Definition at line 60 of file property.hpp.
|
inline |
Returns the property's datatype.
Definition at line 186 of file property.hpp.
|
inlinestatic |
Returns the size in bytes of a given datatype.
| datatype | The datatype to measure. |
datatype. | A | logic error if the datatype is not recognized. |
Definition at line 114 of file property.hpp.
|
inline |
Returns the property's name.
Definition at line 188 of file property.hpp.
|
inline |
Returns the hash of the property's name.
Definition at line 190 of file property.hpp.
|
inline |
Returns the raw pointer to the property's value in memory.
Definition at line 192 of file property.hpp.
|
inline |
Returns the size in bytes of the property's value.
Definition at line 69 of file property.hpp.
|
inline |
Reads the property's value at its memory address as type T, applying endianness conversion.
When the property is little endian the bytes are returned as-is. When it is big endian the bytes are reversed into the returned value.
| T | The type to read the value as; its size must match the property's datatype size. |
T. | A | logic error if sizeof(T) does not match the property's datatype size. |
Definition at line 144 of file property.hpp.
|
inlinestatic |
Maps a configuration datatype string to its datatype_t value.
| datatypeName | The datatype token from the config (e.g. "UINT8", "INT32", "BOOL", "FLOAT64"). |
| A | logic error if the token is not recognized. |
Definition at line 91 of file property.hpp.
|
inlinestatic |
Maps a configuration endianness string to its endianness_t value.
| endiannessName | The endianness token from the config ("Little" or "Big"). |
| A | logic error if the token is not recognized. |
Definition at line 77 of file property.hpp.
|
private |
How the bytes at _pointer are interpreted.
Definition at line 197 of file property.hpp.
|
private |
Byte order of the value at _pointer.
Definition at line 198 of file property.hpp.
|
private |
Identifying name of the property.
Definition at line 195 of file property.hpp.
|
private |
Precomputed hash of _name for fast lookup.
Definition at line 199 of file property.hpp.
|
private |
Pointer to the property's value in game memory.
Definition at line 196 of file property.hpp.