Index into a xahaud serialized array and return the location and length of an index
Parse a STArray pointed to by read_ptr
Find the array index specified by array_id
Return the byte offset and length of the serialized field within the STObject, if it is found
🚧Field ID encodingThe
sto_
apis accept afield_id
parameter encoded as follows:(type << 16U) + field
Thus type 1 field 2 would be0x10002U
.In the case of this array field ID is
array_id
.
C
C
📘hookmacro.h already contains the
SUB_OFFSET
andSUB_LENGTH
macros.
read_ptr
uint32_t
Pointer to the buffer containing the STArray
read_len
uint32_t
Length of STArray
array_id
uint32_t
The index of the entry within the STArray you are seeking. Starts from 0.
int64_t
The location of the field within the specified buffer:
- The high 32 bits are the offset location.
- The low 32 bits are the length.
If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.
TOO_SMALL
- Input buffer isn't large enough to possibly contain a valid STArray.
DOESNT_EXIST
- The searched for index isn't present in the supplied STArray.
PARSE_ERROR
- The supplied STArray is malformed or not an STArray.
Emplace a field into an existing STObject at its canonical placement
Parse an STObject S
(source object) pointed to by sread_ptr
Parse an STObject F
(to inject/emplace) pointed to by fread_ptr
Write a new STObject to write_ptr
which places F
into S
at the canonical position field_id
🚧Field ID encodingThe
sto_
apis accept afield_id
parameter encoded as follows:(type << 16U) + field
Thus type 1 field 2 would be0x10002U
.
C
C
write_ptr
uint32_t
The buffer to write the modified STObject to
write_len
uint32_t
The length of the output buffer
sread_ptr
uint32_t
The buffer to read the source STObject from
sread_len
uint32_t
The Length of the source object
fread_ptr
uint32_t
The buffer to read the field to be emplaced/injected from
fread_len
uint32_t
The length of the field to be emplaced/injected
field_id
uint32_t
The sf
code (location) to form the emplacement. If this already exists in the source object then the existing field is overriden. If it doesn't exist it is inserted.
int64_t
The number of bytes written to write_ptr
If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.
TOO_SMALL
- Output buffer must be at least as large as the source object + the injected field, even if the field is only being overriden.
TOO_BIG
- Field you are attempting to emplace is too large
PARSE_ERROR
- The supplied STObject is malformed or not an STObject.
Remove a field from an STObject
Parse an STObject pointed to by read_ptr
Write a new STObject to write_ptr
but without field_id
if it was present in the original object.
C
🚧Field ID encodingThe
sto_
apis accept afield_id
parameter encoded as follows:(type << 16U) + field
Thus type 1 field 2 would be0x10002U
.
C
📘Emplace equivalence
sto_erase
is the same assto_emplace
with0,0
forfield_ptr, field_len
parameters.
write_ptr
uint32_t
The buffer to write the modified STObject to
write_len
uint32_t
The length of the output buffer
read_ptr
uint32_t
The buffer to read the source STObject from
read_len
uint32_t
The Length of the source object
field_id
uint32_t
The sf
code (location) to erase
int64_t
The number of bytes written to write_ptr
If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.
TOO_SMALL
- Output buffer must be at least as large as the source object.
TOO_BIG
- Field you are attempting to erase from is too large
PARSE_ERROR
- The supplied STObject is malformed or not an STObject.
DOESNT_EXIST
- The specified field_id
isn't present in the STObject.
Validate an STObject
Parse an STObject pointed to by read_ptr
Return 1 if the serialization is valid, 0 otherwise.
C
C
read_ptr
uint32_t
The buffer to read the source STObject from
read_len
uint32_t
The Length of the source object
int64_t
1
if the STObject pointed to by read_ptr
is a valid STObject.
0
if it isn't.
If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.
Index into a xahaud serialized object and return the location and length of a subfield
Parse a STObject pointed to by read_ptr
Find the field specified by field_id
If the field is found, and:
It is an array, then return the start and length of the array including the leadin/leadout bytes, or
It is not an array, then return the start and length of the PAYLOAD of the field (excluding the leadin bytes).
🚧Field ID encodingThe
sto_
apis accept afield_id
parameter encoded as follows:(type << 16U) + field
Thus type 1 field 2 would be0x10002U
.
C
C
📘hookmacro.h already contains the
SUB_OFFSET
andSUB_LENGTH
macros.
read_ptr
uint32_t
Pointer to the buffer containing the STObject
read_len
uint32_t
Length of STObject
field_id
uint32_t
The sf
code of the field you are searching for.
To compute this manually take the serialized type
and shift it into the 16 highest bits of uint32_t, then take the field
and place it in the 16 lowest bits.
For example:
sfEmitNonce
has type
5 and field
11 thus its value is 0x050BU
int64_t
The location of the field within the specified buffer:
- The high 32 bits are the offset location.
- The low 32 bits are the length.
If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.
TOO_SMALL
- Input buffer isn't large enough to possibly contain a valid STObject.
DOESNT_EXIST
- The searched for field isn't present in the supplied STObject.
PARSE_ERROR
- The supplied STObject is malformed or not an STObject.