From d633cb9838b0b78b07b591f7d4ccf19df1997f73 Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Sun, 9 Jan 2022 12:30:31 -0500 Subject: [PATCH] switched uint8_t -> bool in input, no pressure sense --- mercuryhook/touch.c | 8 ++++---- mercuryio/mercuryio.c | 12 ++++++------ mercuryio/mercuryio.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mercuryhook/touch.c b/mercuryhook/touch.c index 8ec616a..a26bd31 100644 --- a/mercuryhook/touch.c +++ b/mercuryhook/touch.c @@ -36,7 +36,7 @@ static HRESULT touch_handle_get_unit_board_ver(const struct touch_req *req); static HRESULT touch_handle_mystery1(const struct touch_req *req); static HRESULT touch_handle_mystery2(const struct touch_req *req); static HRESULT touch_handle_start_auto_scan(const struct touch_req *req); -static void touch_res_auto_scan(const uint8_t *state); +static void touch_res_auto_scan(const bool *state); uint8_t input_frame_count_0 = 0x7b; uint8_t input_frame_count_1 = 0x7b; @@ -409,18 +409,18 @@ static HRESULT touch_handle_start_auto_scan(const struct touch_req *req) return hr; } -static void touch_res_auto_scan(const uint8_t *state) +static void touch_res_auto_scan(const bool *state) { struct touch_input_frame frame0; //struct touch_input_frame frame1; - uint8_t data1[24] = { 0 }; + uint8_t data[24] = { 0 }; uint8_t data2[9] = { 0x0d, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 }; frame0.cmd = 0x81; frame0.count = input_frame_count_0++; input_frame_count_0 %= 0x7f; // for now return no data - memcpy(frame0.data1, data1, sizeof(data1)); + memcpy(frame0.data1, data, sizeof(data)); memcpy(frame0.data2, data2, sizeof(data2)); frame0.checksum = 0; frame0.checksum = calc_checksum(&frame0, sizeof(frame0)); diff --git a/mercuryio/mercuryio.c b/mercuryio/mercuryio.c index 3d4a735..75ee77d 100644 --- a/mercuryio/mercuryio.c +++ b/mercuryio/mercuryio.c @@ -89,21 +89,21 @@ void mercury_io_touch_start(mercury_io_touch_callback_t callback) static unsigned int __stdcall mercury_io_touch_thread_proc(void *ctx) { mercury_io_touch_callback_t callback; - uint8_t pressure[240]; + bool cellPressed[240]; size_t i; callback = ctx; while (!mercury_io_touch_stop_flag) { - for (i = 0 ; i < _countof(pressure) ; i++) { - if (GetAsyncKeyState(mercury_io_cfg.vk_cell[i]) & 0x8000) { - pressure[i] = 128; + for (i = 0 ; i < _countof(cellPressed) ; i++) { + if (GetAsyncKeyState(mercury_io_cfg.vk_cell[i])) { + cellPressed[i] = true; } else { - pressure[i] = 0; + cellPressed[i] = false; } } - callback(pressure); + callback(cellPressed); Sleep(1); } diff --git a/mercuryio/mercuryio.h b/mercuryio/mercuryio.h index 6f32989..4b36dee 100644 --- a/mercuryio/mercuryio.h +++ b/mercuryio/mercuryio.h @@ -14,7 +14,7 @@ enum { MERCURY_IO_GAMEBTN_VOL_DOWN = 0x02, }; -typedef void (*mercury_io_touch_callback_t)(const uint8_t *state); +typedef void (*mercury_io_touch_callback_t)(const bool *state); /* Get the version of the Wacca IO API that this DLL supports. This function should return a positive 16-bit integer, where the high byte is the major version and the low byte is the minor version (as defined by the