Functins used to directly transfer data between mod memory and the Python interpreter, using appropriate Python types. More...
Functions | |
| REPY_Handle | REPY_MemcpyToBytes (void *src, REPY_u32 len, REPY_bool reverse) |
| Create a Python bytes object from a chunk of mod memory. | |
| REPY_Handle | REPY_MemcpyToByteArray (void *src, REPY_u32 len, REPY_bool reverse) |
| Create a Python bytearray object from a chunk of mod memory. | |
| REPY_u32 | REPY_MemcpyFromBuffer (void *dst, REPY_u32 len, REPY_bool reverse, REPY_Handle buffer) |
| Copy the content of a Python object supporting buffer protocol (such as bytes and bytearray) into mod memory. | |
| void * | REPY_AllocAndCopyBuffer (REPY_bool reverse, REPY_Handle buffer, REPY_u32 *write_size) |
| Copy the content of a Python object supporting buffer protocol into mod memory, automatically allocating the space for it with recomp_alloc. | |
Functins used to directly transfer data between mod memory and the Python interpreter, using appropriate Python types.
| void * REPY_AllocAndCopyBuffer | ( | REPY_bool | reverse, |
| REPY_Handle | buffer, | ||
| REPY_u32 * | write_size ) |
Copy the content of a Python object supporting buffer protocol into mod memory, automatically allocating the space for it with recomp_alloc.
The binary data from the buffer will be copied exactly as is, NULL bytes and all. No additional NULL bytes will be added to the end of the data.
Failure to free the void* returned by this function with recomp_free will result in a memory leak.
Behavior with Python types other than bytearray is undefined, and may change between versions.
| reverse | Set to false to copy normally, or true to reverse the byte order of the data being copied. |
| buffer | The Python buffer object to copy from. |
| write_size | A pointer to a u32, where the number of bytes copied can be written to. Can be NULL. |
| REPY_u32 REPY_MemcpyFromBuffer | ( | void * | dst, |
| REPY_u32 | len, | ||
| REPY_bool | reverse, | ||
| REPY_Handle | buffer ) |
Copy the content of a Python object supporting buffer protocol (such as bytes and bytearray) into mod memory.
The binary data from the buffer will be copied exactly as is, NULL bytes and all. No additional NULL bytes will be added to the end of the data.
If the Python buffer object is smaller than len, then the remainder of destination will be untouched. If the bytearray object is larger than len, then copying will terminate when len is reached. Use the return value to get how many bytes were actually copied.
| dst | The beginning of the memory region to write to. |
| len | The size of the destination region to copy, in bytes. |
| reverse | Set to false to copy normally, or true to reverse the byte order of the data being copied. |
| buffer | The Python buffer object to copy from. |
| REPY_Handle REPY_MemcpyToByteArray | ( | void * | src, |
| REPY_u32 | len, | ||
| REPY_bool | reverse ) |
Create a Python bytearray object from a chunk of mod memory.
This function copies the entire src region exactly as is, NULL-terminators and all.
| src | The beginning of the memory region to copy. |
| len | The size of the region to copy, in bytes. |
| reverse | Set to false to copy normally, or true to reverse the byte order of the memory being copied. |
| REPY_Handle REPY_MemcpyToBytes | ( | void * | src, |
| REPY_u32 | len, | ||
| REPY_bool | reverse ) |
Create a Python bytes object from a chunk of mod memory.
This function copies the entire src region exactly as is, NULL-terminators and all.
| src | The beginning of the memory region to copy. |
| len | The size of the region to copy, in bytes. |
| reverse | Set to false to copy normally, or true to reverse the byte order of the memory being copied. |