don't try to "fix" y axis in touchpad (it should just match the mouse convention), add touchpad button to default controls for nds/3ds touch

note that touchpad axes aren't put in default controls, can't actually have multiple axes bound at the same time
This commit is contained in:
CasualPokePlayer 2025-01-07 02:11:10 -08:00
parent cf1c2a9d7e
commit 24a4b47adf
2 changed files with 7 additions and 5 deletions

View File

@ -129,7 +129,7 @@
"ZR": "R, J1 B8, X1 RightTrigger", "ZR": "R, J1 B8, X1 RightTrigger",
"Select": "Space, J1 B9, X1 Back", "Select": "Space, J1 B9, X1 Back",
"Start": "Enter, J1 B10, X1 Start", "Start": "Enter, J1 B10, X1 Start",
"Touch": "WMouse L", "Touch": "WMouse L, X1 Touchpad",
"Tilt": "WMouse R", "Tilt": "WMouse R",
}, },
"NDS Controller": { "NDS Controller": {
@ -145,7 +145,7 @@
"R": "E, J1 B6, X1 RightShoulder", "R": "E, J1 B6, X1 RightShoulder",
"Select": "Space, J1 B9, X1 Back", "Select": "Space, J1 B9, X1 Back",
"Start": "Enter, J1 B10, X1 Start", "Start": "Enter, J1 B10, X1 Start",
"Touch": "WMouse L", "Touch": "WMouse L, X1 Touchpad",
"Microphone": "M" "Microphone": "M"
}, },
"Atari 2600 Basic Controller": { "Atari 2600 Basic Controller": {

View File

@ -294,7 +294,9 @@ namespace BizHawk.Bizware.Input
("RightTrigger", Conv(SDL_GameControllerGetAxis(Opaque, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_TRIGGERRIGHT))) ("RightTrigger", Conv(SDL_GameControllerGetAxis(Opaque, SDL_GameControllerAxis.SDL_CONTROLLER_AXIS_TRIGGERRIGHT)))
]; ];
static int TouchConv(float num) => (int)((num * 2.0f - 1.0f) * 10000.0f); // note: this mimics the mouse conversion in MainForm
// also, don't try to "correct" the Y axis here, -/+ for u/d is how mouse does it, so that should be used here
static int TouchConv(float num) => (int)((num * 20000) - 10000);
var numTouchpads = SDL_GameControllerGetNumTouchpads(Opaque); var numTouchpads = SDL_GameControllerGetNumTouchpads(Opaque);
if (numTouchpads == 1) if (numTouchpads == 1)
{ {
@ -305,7 +307,7 @@ namespace BizHawk.Bizware.Input
if (state != 0) if (state != 0)
{ {
values.Add(("TouchpadX", TouchConv(x))); values.Add(("TouchpadX", TouchConv(x)));
values.Add(("TouchpadY", -TouchConv(y))); values.Add(("TouchpadY", TouchConv(y)));
} }
else else
{ {
@ -321,7 +323,7 @@ namespace BizHawk.Bizware.Input
if (state != 0) if (state != 0)
{ {
values.Add(($"Touchpad{i}X", TouchConv(x))); values.Add(($"Touchpad{i}X", TouchConv(x)));
values.Add(($"Touchpad{i}Y", -TouchConv(y))); values.Add(($"Touchpad{i}Y", TouchConv(y)));
} }
else else
{ {