|
|
@ -30,12 +30,14 @@ static void tas_recorder_init(void) { |
|
|
|
memset(buf, 0, sizeof(buf)); |
|
|
|
fwrite(buf, 1, sizeof(buf), fout); |
|
|
|
atexit(tas_recorder_close); |
|
|
|
counter = 0; |
|
|
|
} |
|
|
|
|
|
|
|
static void tas_recorder_read(OSContPad *pad) { |
|
|
|
if (fout == NULL) { |
|
|
|
return; |
|
|
|
} |
|
|
|
counter += 4; |
|
|
|
|
|
|
|
uint8_t bytes[4] = {0}; |
|
|
|
int button1 = pad->button; |
|
|
@ -45,6 +47,8 @@ static void tas_recorder_read(OSContPad *pad) { |
|
|
|
bytes[2] = pad->stick_x; |
|
|
|
bytes[3] = pad->stick_y; |
|
|
|
fwrite(bytes, 1, 4, fout); |
|
|
|
|
|
|
|
printf("[tas_recorder] %08x: %04x %02x%02x\n", (counter + OFFSET), pad->button, bytes[2], bytes[3]); |
|
|
|
} |
|
|
|
|
|
|
|
struct ControllerAPI controller_tas_recorder = { |
|
|
|