From 1fc43b4ea2358230a50a8625ebac680d85ae6080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 21 Aug 2021 23:44:02 +0200 Subject: [PATCH 1/3] Android: Remove the old limitation of 3 registered input devices. --- .../src/org/ppsspp/ppsspp/NativeActivity.java | 42 +++++-------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index ef46b87ae8..cd03716ae3 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -108,10 +108,7 @@ public abstract class NativeActivity extends Activity { // Allow for multiple connected gamepads but just consider them the same for now. // Actually this is not entirely true, see the code. - private InputDeviceState inputPlayerA; - private InputDeviceState inputPlayerB; - private InputDeviceState inputPlayerC; - private String inputPlayerADesc; + private ArrayList inputPlayers; private PowerSaveModeReceiver mPowerSaveModeReceiver = null; private SizeManager sizeManager = null; @@ -918,35 +915,18 @@ public abstract class NativeActivity extends Activity { if (device == null) { return null; } - if (inputPlayerA == null) { - inputPlayerADesc = getInputDesc(device); - Log.i(TAG, "Input player A registered: desc = " + inputPlayerADesc); - inputPlayerA = new InputDeviceState(device); + + for (InputDeviceState input : inputPlayers) { + if (input.getDevice() == device) { + return input; + } } - if (inputPlayerA.getDevice() == device) { - return inputPlayerA; - } - - if (inputPlayerB == null) { - Log.i(TAG, "Input player B registered: desc = " + getInputDesc(device)); - inputPlayerB = new InputDeviceState(device); - } - - if (inputPlayerB.getDevice() == device) { - return inputPlayerB; - } - - if (inputPlayerC == null) { - Log.i(TAG, "Input player C registered"); - inputPlayerC = new InputDeviceState(device); - } - - if (inputPlayerC.getDevice() == device) { - return inputPlayerC; - } - - return inputPlayerA; + // None was found, just add and return it. + InputDeviceState state = new InputDeviceState(device); + inputPlayers.add(state); + Log.i(TAG, "Input player registered: desc = " + getInputDesc(device)); + return state; } public boolean IsXperiaPlay() { From c151b7858bc82f0233b029e9a10afa0a83e30629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 22 Aug 2021 00:12:47 +0200 Subject: [PATCH 2/3] Bugfix --- android/src/org/ppsspp/ppsspp/NativeActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index cd03716ae3..6808ce1161 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -108,7 +108,7 @@ public abstract class NativeActivity extends Activity { // Allow for multiple connected gamepads but just consider them the same for now. // Actually this is not entirely true, see the code. - private ArrayList inputPlayers; + private ArrayList inputPlayers = new ArrayList(); private PowerSaveModeReceiver mPowerSaveModeReceiver = null; private SizeManager sizeManager = null; From c8081f7f449d78822fd1f8c57477ee4bfa4c514b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 22 Aug 2021 00:13:01 +0200 Subject: [PATCH 3/3] Fix navigating the analog stick calibration screen with just a gamepad --- UI/ControlMappingScreen.cpp | 8 +++++--- UI/ControlMappingScreen.h | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 5e83b869de..574e795ddd 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -579,15 +579,17 @@ void AnalogSetupScreen::update() { } bool AnalogSetupScreen::key(const KeyInput &key) { - // Allow testing auto-rotation + bool retval = UIScreen::key(key); + + // Allow testing auto-rotation. If it collides with UI keys, too bad. bool pauseTrigger = false; mapper_.Key(key, &pauseTrigger); if (UI::IsEscapeKey(key)) { TriggerFinish(DR_BACK); - return true; + return retval; } - return true; + return retval; } bool AnalogSetupScreen::axis(const AxisInput &axis) { diff --git a/UI/ControlMappingScreen.h b/UI/ControlMappingScreen.h index c8dc1adbe5..025d4bc40c 100644 --- a/UI/ControlMappingScreen.h +++ b/UI/ControlMappingScreen.h @@ -44,7 +44,6 @@ private: UI::EventReturn OnDefaultMapping(UI::EventParams ¶ms); UI::EventReturn OnClearMapping(UI::EventParams ¶ms); UI::EventReturn OnAutoConfigure(UI::EventParams ¶ms); - UI::EventReturn OnTestAnalogs(UI::EventParams ¶ms); virtual void dialogFinished(const Screen *dialog, DialogResult result) override;