Don't return right analog inputs while input is disabled. (#47)

* Don't return right analog inputs while input is disabled.

* Update comment.
This commit is contained in:
Darío
2026-01-05 22:01:09 -03:00
committed by GitHub
parent d14ff94d6d
commit e91aa09cb3
5 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ bool recomp_analog_camera_allowed() {
void recomp_analog_camera_get(f32 *x, f32 *y) {
float input_x, input_y;
s32 inverted_x, inverted_y;
recomp_get_camera_inputs(&input_x, &input_y);
recomp_get_right_analog_inputs(&input_x, &input_y);
recomp_get_analog_inverted_axes(&inverted_x, &inverted_y);
*x = input_x * (inverted_x ? 1.0f : -1.0f);
*y = input_y * (inverted_y ? -1.0f : 1.0f);
+1 -1
View File
@@ -24,7 +24,7 @@ DECLARE_FUNC(s32, recomp_get_analog_cam_enabled);
DECLARE_FUNC(void, recomp_get_analog_inverted_axes, s32* x, s32* y);
DECLARE_FUNC(void, recomp_get_flying_and_swimming_inverted_axes, s32* x, s32* y);
DECLARE_FUNC(void, recomp_get_first_person_inverted_axes, s32* x, s32* y);
DECLARE_FUNC(void, recomp_get_camera_inputs, float* x, float* y);
DECLARE_FUNC(void, recomp_get_right_analog_inputs, float* x, float* y);
DECLARE_FUNC(void, recomp_set_right_analog_suppressed, s32 suppressed);
#endif
+1 -1
View File
@@ -40,7 +40,7 @@ recomp_xxh3 = 0x8F00008C;
recomp_get_bgm_volume = 0x8F000090;
sinf_recomp = 0x8F000094;
__cosf_recomp = 0x8F000098;
recomp_get_camera_inputs = 0x8F00009C;
recomp_get_right_analog_inputs = 0x8F00009C;
recomp_get_analog_cam_enabled = 0x8F0000A0;
recomp_get_analog_inverted_axes = 0x8F0000A4;
recomp_set_right_analog_suppressed = 0x8F0000A8;
+8 -1
View File
@@ -194,10 +194,17 @@ extern "C" void recomp_get_note_saving_enabled(uint8_t* rdram, recomp_context* c
_return<s32>(ctx, banjo::get_note_saving_mode() == banjo::NoteSavingMode::On);
}
extern "C" void recomp_get_camera_inputs(uint8_t* rdram, recomp_context* ctx) {
extern "C" void recomp_get_right_analog_inputs(uint8_t* rdram, recomp_context* ctx) {
float* x_out = _arg<0, float*>(rdram, ctx);
float* y_out = _arg<1, float*>(rdram, ctx);
// Don't return right analog inputs while game input is disabled.
if (recompinput::game_input_disabled()) {
*x_out = 0.0f;
*y_out = 0.0f;
return;
}
// TODO expose this in the menu
constexpr float radial_deadzone = 0.05f;
+1 -1
View File
@@ -650,7 +650,7 @@ int main(int argc, char** argv) {
REGISTER_FUNC(recomp_get_target_framerate);
REGISTER_FUNC(recomp_get_cutscene_aspect_ratio);
REGISTER_FUNC(recomp_get_analog_cam_enabled);
REGISTER_FUNC(recomp_get_camera_inputs);
REGISTER_FUNC(recomp_get_right_analog_inputs);
REGISTER_FUNC(recomp_get_bgm_volume);
// REGISTER_FUNC(recomp_get_gyro_deltas);
// REGISTER_FUNC(recomp_get_mouse_deltas);