mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
Fix Ouya controller combos and bump the version to 2.2.1.2
This commit is contained in:
parent
01b35ccdd3
commit
5626e9663b
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.limelight"
|
package="com.limelight"
|
||||||
android:versionCode="14"
|
android:versionCode="16"
|
||||||
android:versionName="2.2.1" >
|
android:versionName="2.2.1.2" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="16"
|
android:minSdkVersion="16"
|
||||||
|
@ -20,11 +20,23 @@ public class ControllerHandler {
|
|||||||
private short leftStickY = 0x0000;
|
private short leftStickY = 0x0000;
|
||||||
private int emulatingButtonFlags = 0;
|
private int emulatingButtonFlags = 0;
|
||||||
|
|
||||||
|
// Used for OUYA bumper state tracking since they force all buttons
|
||||||
|
// up when the OUYA button goes down. We watch the last time we get
|
||||||
|
// a bumper up and compare that to our maximum delay when we receive
|
||||||
|
// a Start button press to see if we should activate one of our
|
||||||
|
// emulated button combos.
|
||||||
|
private long lastLbUpTime = 0;
|
||||||
|
private long lastRbUpTime = 0;
|
||||||
|
private static final int MAXIMUM_BUMPER_UP_DELAY_MS = 100;
|
||||||
|
|
||||||
private static final int MINIMUM_BUTTON_DOWN_TIME_MS = 5;
|
private static final int MINIMUM_BUTTON_DOWN_TIME_MS = 5;
|
||||||
|
|
||||||
private static final int EMULATING_SPECIAL = 0x1;
|
private static final int EMULATING_SPECIAL = 0x1;
|
||||||
private static final int EMULATING_SELECT = 0x2;
|
private static final int EMULATING_SELECT = 0x2;
|
||||||
|
|
||||||
|
private static final int EMULATED_SPECIAL_UP_DELAY_MS = 100;
|
||||||
|
private static final int EMULATED_SELECT_UP_DELAY_MS = 30;
|
||||||
|
|
||||||
private HashMap<String, ControllerMapping> mappings = new HashMap<String, ControllerMapping>();
|
private HashMap<String, ControllerMapping> mappings = new HashMap<String, ControllerMapping>();
|
||||||
|
|
||||||
private NvConnection conn;
|
private NvConnection conn;
|
||||||
@ -356,9 +368,11 @@ public class ControllerHandler {
|
|||||||
break;
|
break;
|
||||||
case KeyEvent.KEYCODE_BUTTON_L1:
|
case KeyEvent.KEYCODE_BUTTON_L1:
|
||||||
inputMap &= ~ControllerPacket.LB_FLAG;
|
inputMap &= ~ControllerPacket.LB_FLAG;
|
||||||
|
lastLbUpTime = SystemClock.uptimeMillis();
|
||||||
break;
|
break;
|
||||||
case KeyEvent.KEYCODE_BUTTON_R1:
|
case KeyEvent.KEYCODE_BUTTON_R1:
|
||||||
inputMap &= ~ControllerPacket.RB_FLAG;
|
inputMap &= ~ControllerPacket.RB_FLAG;
|
||||||
|
lastRbUpTime = SystemClock.uptimeMillis();
|
||||||
break;
|
break;
|
||||||
case KeyEvent.KEYCODE_BUTTON_THUMBL:
|
case KeyEvent.KEYCODE_BUTTON_THUMBL:
|
||||||
inputMap &= ~ControllerPacket.LS_CLK_FLAG;
|
inputMap &= ~ControllerPacket.LS_CLK_FLAG;
|
||||||
@ -386,19 +400,28 @@ public class ControllerHandler {
|
|||||||
inputMap &= ~ControllerPacket.BACK_FLAG;
|
inputMap &= ~ControllerPacket.BACK_FLAG;
|
||||||
|
|
||||||
emulatingButtonFlags &= ~ControllerHandler.EMULATING_SELECT;
|
emulatingButtonFlags &= ~ControllerHandler.EMULATING_SELECT;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(EMULATED_SELECT_UP_DELAY_MS);
|
||||||
|
} catch (InterruptedException e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we're emulating the special button
|
// Check if we're emulating the special button
|
||||||
if ((emulatingButtonFlags & ControllerHandler.EMULATING_SPECIAL) != 0)
|
if ((emulatingButtonFlags & ControllerHandler.EMULATING_SPECIAL) != 0)
|
||||||
{
|
{
|
||||||
// If either start or select is up, the special button comes up too
|
// If either start or select and RB is up, the special button comes up too
|
||||||
if ((inputMap & ControllerPacket.PLAY_FLAG) == 0 ||
|
if ((inputMap & ControllerPacket.PLAY_FLAG) == 0 ||
|
||||||
(inputMap & ControllerPacket.BACK_FLAG) == 0)
|
((inputMap & ControllerPacket.BACK_FLAG) == 0 &&
|
||||||
|
(inputMap & ControllerPacket.RB_FLAG) == 0))
|
||||||
{
|
{
|
||||||
inputMap &= ~ControllerPacket.SPECIAL_BUTTON_FLAG;
|
inputMap &= ~ControllerPacket.SPECIAL_BUTTON_FLAG;
|
||||||
|
|
||||||
emulatingButtonFlags &= ~ControllerHandler.EMULATING_SPECIAL;
|
emulatingButtonFlags &= ~ControllerHandler.EMULATING_SPECIAL;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(EMULATED_SPECIAL_UP_DELAY_MS);
|
||||||
|
} catch (InterruptedException e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,25 +501,22 @@ public class ControllerHandler {
|
|||||||
|
|
||||||
// Start+LB acts like select for controllers with one button
|
// Start+LB acts like select for controllers with one button
|
||||||
if ((inputMap & ControllerPacket.PLAY_FLAG) != 0 &&
|
if ((inputMap & ControllerPacket.PLAY_FLAG) != 0 &&
|
||||||
(inputMap & ControllerPacket.LB_FLAG) != 0)
|
((inputMap & ControllerPacket.LB_FLAG) != 0 ||
|
||||||
|
SystemClock.uptimeMillis() - lastLbUpTime <= MAXIMUM_BUMPER_UP_DELAY_MS))
|
||||||
{
|
{
|
||||||
inputMap &= ~(ControllerPacket.PLAY_FLAG | ControllerPacket.LB_FLAG);
|
inputMap &= ~(ControllerPacket.PLAY_FLAG | ControllerPacket.LB_FLAG);
|
||||||
inputMap |= ControllerPacket.BACK_FLAG;
|
inputMap |= ControllerPacket.BACK_FLAG;
|
||||||
|
|
||||||
// If RB is also pressed, keep the start button down
|
|
||||||
if ((inputMap & ControllerPacket.RB_FLAG) != 0)
|
|
||||||
{
|
|
||||||
inputMap |= ControllerPacket.PLAY_FLAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
emulatingButtonFlags |= ControllerHandler.EMULATING_SELECT;
|
emulatingButtonFlags |= ControllerHandler.EMULATING_SELECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We detect select+start as the special button combo
|
// We detect select+start or start+RB as the special button combo
|
||||||
if ((inputMap & ControllerPacket.BACK_FLAG) != 0 &&
|
if (((inputMap & ControllerPacket.RB_FLAG) != 0 ||
|
||||||
|
(SystemClock.uptimeMillis() - lastRbUpTime <= MAXIMUM_BUMPER_UP_DELAY_MS) ||
|
||||||
|
(inputMap & ControllerPacket.BACK_FLAG) != 0) &&
|
||||||
(inputMap & ControllerPacket.PLAY_FLAG) != 0)
|
(inputMap & ControllerPacket.PLAY_FLAG) != 0)
|
||||||
{
|
{
|
||||||
inputMap &= ~(ControllerPacket.BACK_FLAG | ControllerPacket.PLAY_FLAG);
|
inputMap &= ~(ControllerPacket.BACK_FLAG | ControllerPacket.PLAY_FLAG | ControllerPacket.RB_FLAG);
|
||||||
inputMap |= ControllerPacket.SPECIAL_BUTTON_FLAG;
|
inputMap |= ControllerPacket.SPECIAL_BUTTON_FLAG;
|
||||||
|
|
||||||
emulatingButtonFlags |= ControllerHandler.EMULATING_SPECIAL;
|
emulatingButtonFlags |= ControllerHandler.EMULATING_SPECIAL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user