Skip to content

Commit

Permalink
Gyro Yaw Axis Mode Automation!
Browse files Browse the repository at this point in the history
Described hacky gyro yaw axis mode automation script fix.
  • Loading branch information
Faith Lain Void committed Oct 14, 2021
1 parent 6a51286 commit a866d1c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile.nx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
APP_TITLE := OpenArenaNX
APP_AUTHOR := faithvoid
APP_VERSION := 0.7.6
APP_VERSION := 0.7.7

TARGET := OpenArenaNX
BUILD := build
Expand Down
25 changes: 14 additions & 11 deletions code/sdl/sdl_input_nx.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static cvar_t *in_gyromouse_yaw_axis = NULL; // 0 = .y is yaw, 1 = .z is yaw
static cvar_t *in_gyromouse_debug = NULL;
static HidSixAxisSensorHandle sixaxis_handles[4];
static PadState pad;
static s32 prev_touchcount=0;

static cvar_t *in_joystick = NULL;
static cvar_t *in_joystickThreshold = NULL;
Expand Down Expand Up @@ -1271,17 +1272,6 @@ static void IN_ProcessEvents( void )
Cvar_SetValue( "r_customheight", height );
Cvar_Set( "r_mode", "-1" );

// WIP Quick and dirty yaw axis fix.

if (HidNpadIdType_Handheld)
{
Cvar_Set( "in_gyromouse_yaw_axis", "0" );
}
else
{
Cvar_Set( "in_gyromouse_yaw_axis", "1" );
}


// Wait until user stops dragging for 1 second, so
// we aren't constantly recreating the GL context while
Expand Down Expand Up @@ -1351,6 +1341,18 @@ void IN_ProcessGyro( void )
if (attrib & HidNpadJoyAssignmentMode_Dual)
hidGetSixAxisSensorStates(sixaxis_handles[2,3], &sixaxis, 1);

// I'm surprised this works. I feel like it shouldn't since it looks too simple, but it works somehow so I'm not touching this any more than I have to. tl;dr this checks if you're in handheld mode or not and automatically switches yaw axis mode between roll (0) and yaw (1) - faithvoid

if (padIsHandheld(&pad))
{
Cvar_Set( "in_gyromouse_yaw_axis", "0" );
}
else
{
Cvar_Set( "in_gyromouse_yaw_axis", "1" );
}




if ( in_gyromouse_debug->integer ) {
Expand Down Expand Up @@ -1393,6 +1395,7 @@ void IN_ShutdownGyro( void )
hidStopSixAxisSensor(sixaxis_handles[3]);
}


/*
===============
IN_Frame
Expand Down

0 comments on commit a866d1c

Please sign in to comment.