diff --git a/src/api.c b/src/api.c index c0946b3..e449616 100644 --- a/src/api.c +++ b/src/api.c @@ -11,12 +11,6 @@ extern int dprintf(int stream, const char *format, ...); #endif -void api_get_data() { - static const char dat[] = "Hello, World !"; - - state->registers->eax = (long long)dat; -} - void api_put() { int mode = (int)state->STACK[state->STACK_IDX--]; // 1 for char, 2 for num if (mode != 1 && mode != 2) return; @@ -37,7 +31,7 @@ void api_put() { dprintf(f, "%c", c); //using printf and not write because of the buffer } else { - dprintf(f, "%d", state->STACK[state->STACK_IDX--]); + dprintf(f, "%lld", state->STACK[state->STACK_IDX--]); } } diff --git a/src/api.h b/src/api.h index ea7e96b..63967b8 100644 --- a/src/api.h +++ b/src/api.h @@ -1,13 +1,11 @@ #pragma once #include "instructions.h" -void api_get_data(); void api_put(); void api_getasynckeystate(); static const command_t api_map[] = { {.command = "put", .fptr = api_put}, - {.command = "get_data", .fptr = api_get_data}, {.command = "GetAsyncKeyState", .fptr = api_getasynckeystate}, {.command = NULL, .fptr = NULL} diff --git a/src/instructions.c b/src/instructions.c index a40c3c5..e673ca4 100644 --- a/src/instructions.c +++ b/src/instructions.c @@ -49,7 +49,7 @@ long long* get_reg(char* reg_char) { ++reg_char; for (int i = 0; i < state->num_arrays; i++) if (strcmp(state->ARRAYS_NAME[i], reg_char) == 0) - return &state->ARRAYS_VALUES[i]; + return (long long *)&state->ARRAYS_VALUES[i]; switch (reg_char[1]) { case '1' : return &state->registers->a1; @@ -81,7 +81,7 @@ long long get_value(char* arg) { if (is_reg(arg)) { if (arg[0] == '&') { - ret = get_reg(arg); + ret = (long long)get_reg(arg); } else if (arg[0] == '*') { ret = *(long long *)(*get_reg(arg)); diff --git a/tests/vgcore.12835 b/tests/vgcore.12835 new file mode 100644 index 0000000..d212fc5 Binary files /dev/null and b/tests/vgcore.12835 differ