From 6e70df5827d4abac5bfb58192e711fa3cabefab6 Mon Sep 17 00:00:00 2001 From: James Smith Date: Fri, 9 Oct 2026 10:55:02 -0700 Subject: [PATCH] Add a n64_controller_set_origin command --- include/joybus/target/n64_controller.h | 10 ++++++++++ src/target/n64_controller.c | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/include/joybus/target/n64_controller.h b/include/joybus/target/n64_controller.h index 27c72b9..f10e395 100644 --- a/include/joybus/target/n64_controller.h +++ b/include/joybus/target/n64_controller.h @@ -100,4 +100,14 @@ void joybus_target_n64_controller_detach_pak(struct joybus_target_n64_controller * @param controller the controller to calibrate */ void joybus_target_n64_controller_calibrate(struct joybus_target_n64_controller *controller); + +/** + * Set the stick origin the console's reads are relative to. + * + * @param controller the controller to set the origin of + * @param stick_x the stick X position at rest + * @param stick_y the stick Y position at rest + */ +void joybus_target_n64_controller_set_origin(struct joybus_target_n64_controller *controller, int8_t stick_x, + int8_t stick_y); /** @} */ diff --git a/src/target/n64_controller.c b/src/target/n64_controller.c index 7945874..d0b5096 100644 --- a/src/target/n64_controller.c +++ b/src/target/n64_controller.c @@ -302,3 +302,10 @@ void joybus_target_n64_controller_calibrate(struct joybus_target_n64_controller { n64_controller_recalibrate(controller); } + +void joybus_target_n64_controller_set_origin(struct joybus_target_n64_controller *controller, int8_t stick_x, + int8_t stick_y) +{ + controller->origin.stick_x = stick_x; + controller->origin.stick_y = stick_y; +}