Small Tweak

This commit is contained in:
TheBrokenRail 2025-02-15 15:22:03 -05:00
parent 0a0c3cebb3
commit f40a7c3545
2 changed files with 10 additions and 7 deletions

View File

@ -23,12 +23,12 @@ struct copy_array {
if (arr == nullptr) {
length = 0;
}
this->size = length * sizeof(T);
this->data = arr;
size = length * sizeof(T);
data = arr;
}
explicit copy_array(const char *str) {
this->size = str != nullptr ? (strlen(str) + 1) : 0;
this->data = str;
size = str != nullptr ? (strlen(str) + 1) : 0;
data = str;
}
uint32_t size;
const void *data;

View File

@ -18,11 +18,13 @@ __attribute__((visibility("internal"))) void _add_handler(unsigned char id, hand
// Arguments
struct TrampolineArguments {
// Constructor
explicit TrampolineArguments(const unsigned char *args) {
this->raw_args = args;
this->position = 0;
raw_args = args;
position = 0;
}
// Read Next Value
template <typename T>
T next() {
block_pointer(T);
@ -30,6 +32,7 @@ struct TrampolineArguments {
raw_args += sizeof(T);
return ret;
}
// Read Next Array
template <typename T>
const T *next_arr(uint32_t *length = nullptr) {
block_pointer(T);
@ -37,7 +40,7 @@ struct TrampolineArguments {
if (length != nullptr) {
*length = size / sizeof(T);
}
static bool just_read_pointer = getenv(MCPI_USE_PIPE_TRAMPOLINE_ENV) == nullptr;
static bool just_read_pointer = !is_trampoline_pipe_based();
if (size == 0) {
return nullptr;
} else if (just_read_pointer) {