From d0e1dd84966422923662691a2721a57f77f052ed Mon Sep 17 00:00:00 2001 From: concubidated Date: Sat, 29 Nov 2025 20:50:16 -0800 Subject: [PATCH 1/3] io: update lxio to work with new product id --- src/main/io/lxio/defs.h | 3 ++- src/main/io/lxio/device.c | 7 ++++++- src/main/ptapi/io/piuio/lxio/lxio.c | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/io/lxio/defs.h b/src/main/io/lxio/defs.h index c3b8ec1..8b30bd7 100644 --- a/src/main/io/lxio/defs.h +++ b/src/main/io/lxio/defs.h @@ -2,7 +2,8 @@ #define LXIO_DRV_DEFS_H #define LXIO_VID 0x0D2F -#define LXIO_PID 0x1020 +static const int LXIO_PID[] = { 0x1040, 0x1020 }; +#define LXIO_PID_COUNT (sizeof(LXIO_PID) / sizeof(LXIO_PID[0])) #define LXIO_DRV_USB_REQ_TIMEOUT 10000 diff --git a/src/main/io/lxio/device.c b/src/main/io/lxio/device.c index 2ed1998..c224938 100644 --- a/src/main/io/lxio/device.c +++ b/src/main/io/lxio/device.c @@ -16,7 +16,12 @@ bool lxio_drv_device_open(void) return true; } - lxio_drv_device_handle = io_usb_open(LXIO_VID, LXIO_PID, 1, 0); + for( int p = 0; p < LXIO_PID_COUNT; ++p ) { + lxio_drv_device_handle = io_usb_open(LXIO_VID, LXIO_PID[p], 1, 0); + if( lxio_drv_device_handle ) { + break; + } + } return lxio_drv_device_handle; } diff --git a/src/main/ptapi/io/piuio/lxio/lxio.c b/src/main/ptapi/io/piuio/lxio/lxio.c index 9c2f3c8..f58438a 100644 --- a/src/main/ptapi/io/piuio/lxio/lxio.c +++ b/src/main/ptapi/io/piuio/lxio/lxio.c @@ -79,6 +79,11 @@ void convert_output_to_lxio() lxio_light_state_buffer[1] |= (1 << 2); } + /* enable usb inhibitor and coins, always on */ + lxio_light_state_buffer[3] |= (1 << 4); + lxio_light_state_buffer[3] |= (1 << 5); + lxio_light_state_buffer[3] |= (1 << 6); + /* Halogens */ if (ptapi_piuio_cab_out.halo_r1) { From a64971c8deec019b2b3dad853b2d79c11cf3e171 Mon Sep 17 00:00:00 2001 From: concubidated Date: Sat, 29 Nov 2025 20:51:15 -0800 Subject: [PATCH 2/3] nxa/nx2: fix crash when net_profile.machine_id is empty --- src/main/hook/nx2/options.c | 8 +++----- src/main/hook/nxa/options.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/hook/nx2/options.c b/src/main/hook/nx2/options.c index 25a1110..1345e4c 100644 --- a/src/main/hook/nx2/options.c +++ b/src/main/hook/nx2/options.c @@ -240,11 +240,9 @@ bool nx2hook_options_init( options_opt, NX2HOOK_OPTIONS_STR_PATCH_HOOK_MAIN_LOOP_X11_INPUT_HANDLER); options->patch.net.server = util_options_get_str( options_opt, NX2HOOK_OPTIONS_STR_PATCH_NET_PROFILE_SERVER); - options->patch.net.machine_id = strtoull( - util_options_get_str( - options_opt, NX2HOOK_OPTIONS_STR_PATCH_NET_PROFILE_MACHINE_ID), - NULL, - 16); + const char *machine_id_str = util_options_get_str( + options_opt, NX2HOOK_OPTIONS_STR_PATCH_NET_PROFILE_MACHINE_ID); + options->patch.net.machine_id = machine_id_str ? strtoull(machine_id_str, NULL, 16) : 0; options->patch.net.verbose_log_output = util_options_get_bool( options_opt, NX2HOOK_OPTIONS_STR_PATCH_NET_PROFILE_VERBOSE_LOG_OUTPUT); options->patch.net.cert_dir_path = util_options_get_str( diff --git a/src/main/hook/nxa/options.c b/src/main/hook/nxa/options.c index b908daf..d65702d 100644 --- a/src/main/hook/nxa/options.c +++ b/src/main/hook/nxa/options.c @@ -238,11 +238,9 @@ bool nxahook_options_init( options_opt, NXAHOOK_OPTIONS_STR_PATCH_HOOK_MAIN_LOOP_X11_INPUT_HANDLER); options->patch.net.server = util_options_get_str( options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_SERVER); - options->patch.net.machine_id = strtoull( - util_options_get_str( - options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_MACHINE_ID), - NULL, - 16); + const char *machine_id_str = util_options_get_str( + options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_MACHINE_ID); + options->patch.net.machine_id = machine_id_str ? strtoull(machine_id_str, NULL, 16) : 0; options->patch.net.verbose_log_output = util_options_get_bool( options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_VERBOSE_LOG_OUTPUT); options->patch.net.cert_dir_path = util_options_get_str( From aa9021990773d0fc94b13307c107a440e5e11efa Mon Sep 17 00:00:00 2001 From: concubidated Date: Sun, 30 Nov 2025 13:37:19 -0800 Subject: [PATCH 3/3] lxio: increment coin counter --- src/main/ptapi/io/piuio/lxio/lxio.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/ptapi/io/piuio/lxio/lxio.c b/src/main/ptapi/io/piuio/lxio/lxio.c index f58438a..b506720 100644 --- a/src/main/ptapi/io/piuio/lxio/lxio.c +++ b/src/main/ptapi/io/piuio/lxio/lxio.c @@ -79,10 +79,15 @@ void convert_output_to_lxio() lxio_light_state_buffer[1] |= (1 << 2); } + /* coin counter 1 */ + if(ptapi_piuio_sys.coin) { + lxio_light_state_buffer[3] |= (1 << 3); + } + /* enable usb inhibitor and coins, always on */ - lxio_light_state_buffer[3] |= (1 << 4); - lxio_light_state_buffer[3] |= (1 << 5); - lxio_light_state_buffer[3] |= (1 << 6); + lxio_light_state_buffer[3] |= (1 << 4); // usb enable + lxio_light_state_buffer[3] |= (1 << 5); // coin1 + lxio_light_state_buffer[3] |= (1 << 6); // coin2 /* Halogens */