From f028bdeb20d3dfff907c5e9563691df65353b82a Mon Sep 17 00:00:00 2001 From: Will Xyen Date: Sun, 2 Aug 2020 23:03:04 -0700 Subject: [PATCH] iidxhook-util: allow setting specified ICCA emulation version --- src/main/iidxhook-util/acio.c | 16 ++++++++++++++++ src/main/iidxhook-util/acio.h | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/src/main/iidxhook-util/acio.c b/src/main/iidxhook-util/acio.c index df34606..7b5b442 100644 --- a/src/main/iidxhook-util/acio.c +++ b/src/main/iidxhook-util/acio.c @@ -30,6 +30,16 @@ static struct ac_io_emu iidxhook_util_acio_emu; static struct ac_io_emu_icca iidxhook_util_acio_emu_icca[2]; +static bool iidxhook_util_icca_override_version; +static enum ac_io_emu_icca_version iidxhook_util_icca_override_version_value; + + +void iidxhook_util_acio_override_version(enum ac_io_emu_icca_version version) +{ + iidxhook_util_icca_override_version = true; + iidxhook_util_icca_override_version_value = version; +} + void iidxhook_util_acio_init(bool legacy_mode) { uint8_t i; @@ -43,6 +53,12 @@ void iidxhook_util_acio_init(bool legacy_mode) for (i = 0; i < lengthof(iidxhook_util_acio_emu_icca); i++) { ac_io_emu_icca_init( &iidxhook_util_acio_emu_icca[i], &iidxhook_util_acio_emu, i); + if (iidxhook_util_icca_override_version) { + ac_io_emu_icca_set_version( + &iidxhook_util_acio_emu_icca[i], + iidxhook_util_icca_override_version_value + ); + } } rs232_hook_add_fd(iidxhook_util_acio_emu.fd); diff --git a/src/main/iidxhook-util/acio.h b/src/main/iidxhook-util/acio.h index bfcd900..1a7d204 100644 --- a/src/main/iidxhook-util/acio.h +++ b/src/main/iidxhook-util/acio.h @@ -5,6 +5,7 @@ #include +#include "acioemu/icca.h" #include "hook/iohook.h" /** @@ -19,6 +20,12 @@ */ void iidxhook_util_acio_init(bool legacy_mode); + +/** + * Use the specified ICCA emulation version + */ +void iidxhook_util_acio_override_version(enum ac_io_emu_icca_version version); + /** * Cleanup the ACIO emulation layer. */