forked from Dniel97/segatools
Add j_printf spike flavor
This commit is contained in:
parent
51e4eca7dd
commit
25a1898747
17
util/spike.c
17
util/spike.c
@ -26,6 +26,17 @@ static void spike_fn_fputs(const char *msg)
|
||||
OutputDebugStringA(msg);
|
||||
}
|
||||
|
||||
static void spike_fn_printf(const char *fmt, ...)
|
||||
{
|
||||
char line[512];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsprintf_s(line, _countof(line), fmt, ap);
|
||||
strcat(line, "\n");
|
||||
OutputDebugStringA(line);
|
||||
}
|
||||
|
||||
static void spike_fn_vprintf(
|
||||
const char *proc,
|
||||
int line_no,
|
||||
@ -167,6 +178,12 @@ void spike_hook_init(const char *path)
|
||||
spike_insert_jmp((ptrdiff_t) rva, spike_fn_vwprintf);
|
||||
}
|
||||
|
||||
match = sscanf(line, "j_printf %i", &rva);
|
||||
|
||||
if (match == 1) {
|
||||
spike_insert_jmp((ptrdiff_t) rva, spike_fn_printf);
|
||||
}
|
||||
|
||||
match = sscanf(line, "j_puts %i", &rva);
|
||||
|
||||
if (match == 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user