repy_api.mem.byteswapped: This module provides easy reading and writing of data inside N64Recompiled memory. More...
| int | repy_api.mem.byteswapped.read_u8 (int ptr) |
| Read an unsigned, 8-bit integer from recompiled memory and cast it as a Python int type. | |
| repy_api.mem.byteswapped.write_u8 (int ptr, int value) | |
| Write a Python int object to recompiled memory as an unsigned 8-bit integer. | |
| int | repy_api.mem.byteswapped.read_u16 (int ptr) |
| Read an unsigned, 16-bit integer from recompiled memory and cast it as a Python int type. | |
| repy_api.mem.byteswapped.write_u16 (int ptr, int value) | |
| Write a Python int object to recompiled memory as an unsigned 16-bit integer. | |
| int | repy_api.mem.byteswapped.read_u32 (int ptr) |
| Read an unsigned, 32-bit integer from recompiled memory and cast it as a Python int type. | |
| repy_api.mem.byteswapped.write_u32 (int ptr, int value) | |
| Write a Python int object to recompiled memory as an unsigned 32-bit integer. | |
| int | repy_api.mem.byteswapped.read_u64 (int ptr) |
| Read an unsigned, 64-bit integer from recompiled memory and cast it as a Python int type. | |
| repy_api.mem.byteswapped.write_u64 (int ptr, int value) | |
| Write a Python int object to recompiled memory as an unsigned 32-bit integer. | |
| int | repy_api.mem.byteswapped.read_s8 (int ptr) |
| Read a signed, 8-bit integer from recompiled memory and cast it as a Python int type. | |
| repy_api.mem.byteswapped.write_s8 (int ptr, int value) | |
| Write a Python int object to recompiled memory as a signed 8-bit integer. | |
| int | repy_api.mem.byteswapped.read_s16 (int ptr) |
| Read a signed, 16-bit integer from recompiled memory and cast it as a Python int type. | |
| repy_api.mem.byteswapped.write_s16 (int ptr, int value) | |
| Write a Python int object to recompiled memory as a signed 16-bit integer. | |
| int | repy_api.mem.byteswapped.read_s32 (int ptr) |
| Read a signed, 32-bit integer from recompiled memory and cast it as a Python int type. | |
| repy_api.mem.byteswapped.write_s32 (int ptr, int value) | |
| Write a Python int object to recompiled memory as a signed 32-bit integer. | |
| int | repy_api.mem.byteswapped.read_s64 (int ptr) |
| Read a signed, 64-bit integer from recompiled memory and cast it as a Python int type. | |
| repy_api.mem.byteswapped.write_s64 (int ptr, int value) | |
| Write a Python int object to recompiled memory as a signed 64-bit integer. | |
| float | repy_api.mem.byteswapped.read_f32 (int ptr) |
| Read a 32-bit floating point value from recompiled memory and cast it as a Python float type. | |
| repy_api.mem.byteswapped.write_f32 (int ptr, float value) | |
| Write a Python float object to recompiled memory as a 32-bit floating point value. | |
| float | repy_api.mem.byteswapped.read_f64 (int ptr) |
| Read a 64-bit floating point value from recompiled memory and cast it as a Python float type. | |
| repy_api.mem.byteswapped.write_f64 (int ptr, float value) | |
| Write a Python float object to recompiled memory as a 64-bit floating point value. | |
| str | repy_api.mem.byteswapped.read_char (int ptr) |
| Read a single character from recompiled memory and cast it to a Python str object. | |
| repy_api.mem.byteswapped.write_char (int ptr, str char) | |
| Write a single character represented by a str object to recompiled memory. | |
| bytes | repy_api.mem.byteswapped.read_byte_char (int ptr) |
| Read a single character from recompiled memory and cast it to a Python bytes object. | |
| repy_api.mem.byteswapped.write_byte_char (int ptr, bytes char) | |
| Write a single character represented by a bytes object to recompiled memory. | |
| str | repy_api.mem.byteswapped.read_str (int ptr) |
| Read a null-terminated string from recompiled memory and cast it as a Python str object. | |
| str | repy_api.mem.byteswapped.read_str_n (int ptr, int size) |
| Read a string from recompiled memory and cast it as a Python str object. | |
| repy_api.mem.byteswapped.write_str_n (int ptr, str data, int size) | |
| Write a Python str object to recompiled memory as a null-terminated string. | |
| bytes | repy_api.mem.byteswapped.read_byte_str (int ptr) |
| Read a null-terminated string from recompiled memory and cast it as a Python bytes object. | |
| bytes | repy_api.mem.byteswapped.read_byte_str_n (int ptr, int size) |
| Read a string from recompiled memory and cast it as a Python bytes object. | |
| repy_api.mem.byteswapped.write_byte_str_n (int ptr, str data, int size) | |
| Write a Python bytes object to recompiled memory as a null-terminated string. | |
| bytes | repy_api.mem.byteswapped.read_bytes_n (int ptr, int size, bool reverse=False) |
| read a region of recompiled memory of size bytes into the Python interpreter as a bytes object. | |
| bytearray | repy_api.mem.byteswapped.read_bytearray_n (int ptr, int size, bool reverse=False) |
| read a region of recompiled memory of size bytes into the Python interpreter as a bytearray object. | |
| repy_api.mem.byteswapped.write_buffer_n (int ptr, Buffer data, int size, bool reverse=False) | |
| Write data from a Python buffer into recompiled memory. |
repy_api.mem.byteswapped: This module provides easy reading and writing of data inside N64Recompiled memory.
Due to the N64 being a big-endian system and most modern machines being little-endian (and more importantly the optimizations that N64Recompiled makes to compensate for this difference, which are beyond the scope of this article), recompiled memory can often appear garbled on the native side, and byteswapping is often necessary when moving data in and out.
The function in this module handle all of that for you, swapping bytes while data is being copied to and from recompiled memory, ensuring that N64Recompiled and Python have the same data in the format they expect. This 'copy and swap' is implemented in C++ for maximum performance. That being said, these are still copy operations. If you need to manipulate recompiled memory directly, look at repy_api.mem.raw.
Note that these functions can only be called from threads created by N64Recompiled. Attempting to call them from other threads (such as threads created with threading.Thread) will throw a RuntimeError. \
| bytes repy_api.mem.byteswapped.read_byte_char | ( | int | ptr | ) |
Read a single character from recompiled memory and cast it to a Python bytes object.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| bytes repy_api.mem.byteswapped.read_byte_str | ( | int | ptr | ) |
Read a null-terminated string from recompiled memory and cast it as a Python bytes object.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| bytes repy_api.mem.byteswapped.read_byte_str_n | ( | int | ptr, |
| int | size ) |
Read a string from recompiled memory and cast it as a Python bytes object.
Ends with null-termination or when size is reached.
| ptr | The mod memory address to read from. |
| size | The maximum size of the memory to read. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| bytearray repy_api.mem.byteswapped.read_bytearray_n | ( | int | ptr, |
| int | size, | ||
| bool | reverse = False ) |
read a region of recompiled memory of size bytes into the Python interpreter as a bytearray object.
Unlike read_byte_str and read_byte_str_n, this function copies the memory region exactly as it is, null bytes and all.
| ptr | The mod memory address to read from. |
| size | The size of the memory to read. |
| reverse | If True, mirrors the memory being read. Defaults to False |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| bytes repy_api.mem.byteswapped.read_bytes_n | ( | int | ptr, |
| int | size, | ||
| bool | reverse = False ) |
read a region of recompiled memory of size bytes into the Python interpreter as a bytes object.
Unlike read_byte_str and read_byte_str_n, this function copies the memory region exactly as it is, null bytes and all.
| ptr | The mod memory address to read from. |
| size | The size of the memory to read. |
| reverse | If True, mirrors the memory being read. Defaults to False. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| str repy_api.mem.byteswapped.read_char | ( | int | ptr | ) |
Read a single character from recompiled memory and cast it to a Python str object.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| float repy_api.mem.byteswapped.read_f32 | ( | int | ptr | ) |
Read a 32-bit floating point value from recompiled memory and cast it as a Python float type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| float repy_api.mem.byteswapped.read_f64 | ( | int | ptr | ) |
Read a 64-bit floating point value from recompiled memory and cast it as a Python float type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| int repy_api.mem.byteswapped.read_s16 | ( | int | ptr | ) |
Read a signed, 16-bit integer from recompiled memory and cast it as a Python int type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| int repy_api.mem.byteswapped.read_s32 | ( | int | ptr | ) |
Read a signed, 32-bit integer from recompiled memory and cast it as a Python int type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| int repy_api.mem.byteswapped.read_s64 | ( | int | ptr | ) |
Read a signed, 64-bit integer from recompiled memory and cast it as a Python int type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| int repy_api.mem.byteswapped.read_s8 | ( | int | ptr | ) |
Read a signed, 8-bit integer from recompiled memory and cast it as a Python int type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| str repy_api.mem.byteswapped.read_str | ( | int | ptr | ) |
Read a null-terminated string from recompiled memory and cast it as a Python str object.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| str repy_api.mem.byteswapped.read_str_n | ( | int | ptr, |
| int | size ) |
Read a string from recompiled memory and cast it as a Python str object.
Ends with null-termination or when size is reached.
| ptr | The mod memory address to read from. |
| size | The maximum size of the memory to read. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| int repy_api.mem.byteswapped.read_u16 | ( | int | ptr | ) |
Read an unsigned, 16-bit integer from recompiled memory and cast it as a Python int type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| int repy_api.mem.byteswapped.read_u32 | ( | int | ptr | ) |
Read an unsigned, 32-bit integer from recompiled memory and cast it as a Python int type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| int repy_api.mem.byteswapped.read_u64 | ( | int | ptr | ) |
Read an unsigned, 64-bit integer from recompiled memory and cast it as a Python int type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| int repy_api.mem.byteswapped.read_u8 | ( | int | ptr | ) |
Read an unsigned, 8-bit integer from recompiled memory and cast it as a Python int type.
| ptr | The mod memory address to read from. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_buffer_n | ( | int | ptr, |
| Buffer | data, | ||
| int | size, | ||
| bool | reverse = False ) |
Write data from a Python buffer into recompiled memory.
This function accepts not just bytes and bytearray objects, but any Python type that implements the Python buffer protocol, such as arrays from Python's array module.
If size is greater than the length of data, then writing will be truncated to fit size. If size is less than the length of data, then the remainder of the recompiled memory region will be untouched.
| ptr | The mod memory address to write to. |
| data | A Python bytes object to write to mod memory. |
| size | The maximum size of the memory to write. |
| reverse | If True, mirrors the memory being read. Defaults to False |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_byte_char | ( | int | ptr, |
| bytes | char ) |
Write a single character represented by a bytes object to recompiled memory.
| ptr | The mod memory address to write to. |
| char | The character to write, expressed as a bytes object. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| ValueError | if the length of char is greater than 1. |
| repy_api.mem.byteswapped.write_byte_str_n | ( | int | ptr, |
| str | data, | ||
| int | size ) |
Write a Python bytes object to recompiled memory as a null-terminated string.
If the bytes object is larger than size, or if the null byte is reached before the end of the bytes object, the content it will be truncated.
| ptr | The mod memory address to write to. |
| data | A Python bytes object to write to mod memory. |
| size | The maximum size of the memory to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_char | ( | int | ptr, |
| str | char ) |
Write a single character represented by a str object to recompiled memory.
| ptr | The mod memory address to write to. |
| char | The character to write, expressed as a str object. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| ValueError | if the length of char is greater than 1. |
| repy_api.mem.byteswapped.write_f32 | ( | int | ptr, |
| float | value ) |
Write a Python float object to recompiled memory as a 32-bit floating point value.
| ptr | The mod memory address to write to. |
| value | The floating point value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_f64 | ( | int | ptr, |
| float | value ) |
Write a Python float object to recompiled memory as a 64-bit floating point value.
| ptr | The mod memory address to write to. |
| value | The floating point value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_s16 | ( | int | ptr, |
| int | value ) |
Write a Python int object to recompiled memory as a signed 16-bit integer.
| ptr | The mod memory address to write to. |
| value | The integer value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_s32 | ( | int | ptr, |
| int | value ) |
Write a Python int object to recompiled memory as a signed 32-bit integer.
| ptr | The mod memory address to write to. |
| value | The integer value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_s64 | ( | int | ptr, |
| int | value ) |
Write a Python int object to recompiled memory as a signed 64-bit integer.
| ptr | The mod memory address to write to. |
| value | The integer value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_s8 | ( | int | ptr, |
| int | value ) |
Write a Python int object to recompiled memory as a signed 8-bit integer.
| ptr | The mod memory address to write to. |
| value | The integer value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_str_n | ( | int | ptr, |
| str | data, | ||
| int | size ) |
Write a Python str object to recompiled memory as a null-terminated string.
If the str object is larger than size, it will be truncated.
| ptr | The mod memory address to write to. |
| data | A Python str object to write to mod memory. |
| size | The maximum size of the memory to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_u16 | ( | int | ptr, |
| int | value ) |
Write a Python int object to recompiled memory as an unsigned 16-bit integer.
| ptr | The mod memory address to write to. |
| value | The integer value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_u32 | ( | int | ptr, |
| int | value ) |
Write a Python int object to recompiled memory as an unsigned 32-bit integer.
| ptr | The mod memory address to write to. |
| value | The integer value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_u64 | ( | int | ptr, |
| int | value ) |
Write a Python int object to recompiled memory as an unsigned 32-bit integer.
| ptr | The mod memory address to write to. |
| value | The integer value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |
| repy_api.mem.byteswapped.write_u8 | ( | int | ptr, |
| int | value ) |
Write a Python int object to recompiled memory as an unsigned 8-bit integer.
| ptr | The mod memory address to write to. |
| value | The integer value to write. |
| RuntimeError | if called from a thread not created by N64Recompiled. |