From 7f4b231c9767bc48d75411ee1e423c739a540673 Mon Sep 17 00:00:00 2001 From: Dniel97 Date: Fri, 4 Oct 2024 16:01:56 +0200 Subject: [PATCH] Add individual air keyboard buttons --- {aimeio => aimeio_brokenithm}/aimeio.c | 0 {aimeio => aimeio_brokenithm}/aimeio.def | 0 aimeio_brokenithm/meson.build | 14 +++++++++ {chuniio => chuniio_brokenithm}/chuniio.c | 34 ++++++++++++++------- {chuniio => chuniio_brokenithm}/chuniio.def | 0 chuniio_brokenithm/meson.build | 14 +++++++++ 6 files changed, 51 insertions(+), 11 deletions(-) rename {aimeio => aimeio_brokenithm}/aimeio.c (100%) rename {aimeio => aimeio_brokenithm}/aimeio.def (100%) create mode 100644 aimeio_brokenithm/meson.build rename {chuniio => chuniio_brokenithm}/chuniio.c (86%) rename {chuniio => chuniio_brokenithm}/chuniio.def (100%) create mode 100644 chuniio_brokenithm/meson.build diff --git a/aimeio/aimeio.c b/aimeio_brokenithm/aimeio.c similarity index 100% rename from aimeio/aimeio.c rename to aimeio_brokenithm/aimeio.c diff --git a/aimeio/aimeio.def b/aimeio_brokenithm/aimeio.def similarity index 100% rename from aimeio/aimeio.def rename to aimeio_brokenithm/aimeio.def diff --git a/aimeio_brokenithm/meson.build b/aimeio_brokenithm/meson.build new file mode 100644 index 0000000..987c12d --- /dev/null +++ b/aimeio_brokenithm/meson.build @@ -0,0 +1,14 @@ +shared_library( + 'aime_brokenithm', + name_prefix : '', + vs_module_defs : 'aimeio.def', + include_directories : inc, + implicit_include_directories : false, + link_with : [ + aimeio_lib, + ], + + sources : [ + 'aimeio.c', + ], +) diff --git a/chuniio/chuniio.c b/chuniio_brokenithm/chuniio.c similarity index 86% rename from chuniio/chuniio.c rename to chuniio_brokenithm/chuniio.c index 79c0f1e..7025d5a 100644 --- a/chuniio/chuniio.c +++ b/chuniio_brokenithm/chuniio.c @@ -102,19 +102,31 @@ void chuni_io_jvs_poll(uint8_t *opbtn, uint8_t *beams) *opbtn |= CHUNI_IO_OPBTN_SERVICE; /* Service */ } - if (GetAsyncKeyState(chuni_io_cfg.vk_ir_emu)) { - if (chuni_io_hand_pos < 6) { - chuni_io_hand_pos++; + if (chuni_io_cfg.vk_ir_emu) { + // Use emulated AIR + if (GetAsyncKeyState(chuni_io_cfg.vk_ir_emu)) { + if (chuni_io_hand_pos < 6) { + chuni_io_hand_pos++; + } + } else { + if (chuni_io_hand_pos > 0) { + chuni_io_hand_pos--; + } + } + + for (i = 0 ; i < 6 ; i++) { + if (chuni_io_hand_pos > i) { + *beams |= (1 << i); + } } } else { - if (chuni_io_hand_pos > 0) { - chuni_io_hand_pos--; - } - } - - for (i = 0 ; i < 6 ; i++) { - if (chuni_io_hand_pos > i) { - *beams |= (1 << i); + // Use actual AIR + for (i = 0; i < 6; i++) { + if(GetAsyncKeyState(chuni_io_cfg.vk_ir[i]) & 0x8000) { + *beams |= (1 << i); + } else { + *beams &= ~(1 << i); + } } } diff --git a/chuniio/chuniio.def b/chuniio_brokenithm/chuniio.def similarity index 100% rename from chuniio/chuniio.def rename to chuniio_brokenithm/chuniio.def diff --git a/chuniio_brokenithm/meson.build b/chuniio_brokenithm/meson.build new file mode 100644 index 0000000..8a6d36a --- /dev/null +++ b/chuniio_brokenithm/meson.build @@ -0,0 +1,14 @@ +shared_library( + 'brokenithm', + name_prefix : '', + vs_module_defs : 'chuniio.def', + include_directories : inc, + implicit_include_directories : false, + link_with : [ + chuniio_lib, + ], + + sources : [ + 'chuniio.c', + ], +)