mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-06 07:56:07 +00:00
Plumb new Sunshine protocol extensions
This commit is contained in:
@@ -486,7 +486,7 @@ public class NvConnection {
|
||||
}
|
||||
|
||||
public void sendControllerInput(final short controllerNumber,
|
||||
final short activeGamepadMask, final short buttonFlags,
|
||||
final short activeGamepadMask, final int buttonFlags,
|
||||
final byte leftTrigger, final byte rightTrigger,
|
||||
final short leftStickX, final short leftStickY,
|
||||
final short rightStickX, final short rightStickY)
|
||||
@@ -496,18 +496,7 @@ public class NvConnection {
|
||||
leftTrigger, rightTrigger, leftStickX, leftStickY, rightStickX, rightStickY);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendControllerInput(final short buttonFlags,
|
||||
final byte leftTrigger, final byte rightTrigger,
|
||||
final short leftStickX, final short leftStickY,
|
||||
final short rightStickX, final short rightStickY)
|
||||
{
|
||||
if (!isMonkey) {
|
||||
MoonBridge.sendControllerInput(buttonFlags, leftTrigger, rightTrigger, leftStickX,
|
||||
leftStickY, rightStickX, rightStickY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendKeyboardInput(final short keyMap, final byte keyDirection, final byte modifier, final byte flags) {
|
||||
if (!isMonkey) {
|
||||
MoonBridge.sendKeyboardInput(keyMap, keyDirection, modifier, flags);
|
||||
@@ -538,6 +527,50 @@ public class NvConnection {
|
||||
}
|
||||
}
|
||||
|
||||
public int sendTouchEvent(byte eventType, int pointerId, float x, float y, float pressure) {
|
||||
if (!isMonkey) {
|
||||
return MoonBridge.sendTouchEvent(eventType, pointerId, x, y, pressure);
|
||||
}
|
||||
else {
|
||||
return MoonBridge.LI_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
public int sendPenEvent(byte eventType, byte toolType, byte penButtons, float x, float y,
|
||||
float pressure, short rotation, byte tiltX, byte tiltY) {
|
||||
if (!isMonkey) {
|
||||
return MoonBridge.sendPenEvent(eventType, toolType, penButtons, x, y, pressure, rotation, tiltX, tiltY);
|
||||
}
|
||||
else {
|
||||
return MoonBridge.LI_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
public int sendControllerArrivalEvent(byte controllerNumber, short activeGamepadMask, byte type,
|
||||
int supportedButtonFlags, short capabilities) {
|
||||
return MoonBridge.sendControllerArrivalEvent(controllerNumber, activeGamepadMask, type, supportedButtonFlags, capabilities);
|
||||
}
|
||||
|
||||
public int sendControllerTouchEvent(byte controllerNumber, byte eventType, int pointerId,
|
||||
float x, float y, float pressure) {
|
||||
if (!isMonkey) {
|
||||
return MoonBridge.sendControllerTouchEvent(controllerNumber, eventType, pointerId, x, y, pressure);
|
||||
}
|
||||
else {
|
||||
return MoonBridge.LI_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
public int sendControllerMotionEvent(byte controllerNumber, byte motionType,
|
||||
float x, float y, float z) {
|
||||
if (!isMonkey) {
|
||||
return MoonBridge.sendControllerMotionEvent(controllerNumber, motionType, x, y, z);
|
||||
}
|
||||
else {
|
||||
return MoonBridge.LI_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendUtf8Text(final String text) {
|
||||
if (!isMonkey) {
|
||||
MoonBridge.sendUtf8Text(text);
|
||||
|
||||
@@ -13,6 +13,9 @@ public interface NvConnectionListener {
|
||||
void displayTransientMessage(String message);
|
||||
|
||||
void rumble(short controllerNumber, short lowFreqMotor, short highFreqMotor);
|
||||
void rumbleTriggers(short controllerNumber, short leftTrigger, short rightTrigger);
|
||||
|
||||
void setHdrMode(boolean enabled, byte[] hdrMetadata);
|
||||
|
||||
void setMotionEventState(short controllerNumber, byte motionType, short reportRateHz);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
package com.limelight.nvstream.input;
|
||||
|
||||
public class ControllerPacket {
|
||||
public static final short A_FLAG = 0x1000;
|
||||
public static final short B_FLAG = 0x2000;
|
||||
public static final short X_FLAG = 0x4000;
|
||||
public static final short Y_FLAG = (short)0x8000;
|
||||
public static final short UP_FLAG = 0x0001;
|
||||
public static final short DOWN_FLAG = 0x0002;
|
||||
public static final short LEFT_FLAG = 0x0004;
|
||||
public static final short RIGHT_FLAG = 0x0008;
|
||||
public static final short LB_FLAG = 0x0100;
|
||||
public static final short RB_FLAG = 0x0200;
|
||||
public static final short PLAY_FLAG = 0x0010;
|
||||
public static final short BACK_FLAG = 0x0020;
|
||||
public static final short LS_CLK_FLAG = 0x0040;
|
||||
public static final short RS_CLK_FLAG = 0x0080;
|
||||
public static final short SPECIAL_BUTTON_FLAG = 0x0400;
|
||||
public static final int A_FLAG = 0x1000;
|
||||
public static final int B_FLAG = 0x2000;
|
||||
public static final int X_FLAG = 0x4000;
|
||||
public static final int Y_FLAG = 0x8000;
|
||||
public static final int UP_FLAG = 0x0001;
|
||||
public static final int DOWN_FLAG = 0x0002;
|
||||
public static final int LEFT_FLAG = 0x0004;
|
||||
public static final int RIGHT_FLAG = 0x0008;
|
||||
public static final int LB_FLAG = 0x0100;
|
||||
public static final int RB_FLAG = 0x0200;
|
||||
public static final int PLAY_FLAG = 0x0010;
|
||||
public static final int BACK_FLAG = 0x0020;
|
||||
public static final int LS_CLK_FLAG = 0x0040;
|
||||
public static final int RS_CLK_FLAG = 0x0080;
|
||||
public static final int SPECIAL_BUTTON_FLAG = 0x0400;
|
||||
|
||||
// Extended buttons (Sunshine only)
|
||||
public static final int PADDLE1_FLAG = 0x010000;
|
||||
public static final int PADDLE2_FLAG = 0x020000;
|
||||
public static final int PADDLE3_FLAG = 0x040000;
|
||||
public static final int PADDLE4_FLAG = 0x080000;
|
||||
public static final int TOUCHPAD_FLAG = 0x100000; // Touchpad buttons on Sony controllers
|
||||
public static final int MISC_FLAG = 0x200000; // Share/Mic/Capture/Mute buttons on various controllers
|
||||
}
|
||||
@@ -75,6 +75,39 @@ public class MoonBridge {
|
||||
|
||||
public static final byte SS_KBE_FLAG_NON_NORMALIZED = 0x01;
|
||||
|
||||
public static final int LI_ERR_UNSUPPORTED = -5501;
|
||||
|
||||
public static final byte LI_TOUCH_EVENT_HOVER = 0x00;
|
||||
public static final byte LI_TOUCH_EVENT_DOWN = 0x01;
|
||||
public static final byte LI_TOUCH_EVENT_UP = 0x02;
|
||||
public static final byte LI_TOUCH_EVENT_MOVE = 0x03;
|
||||
public static final byte LI_TOUCH_EVENT_CANCEL = 0x04;
|
||||
|
||||
public static final byte LI_TOOL_TYPE_PEN = 0x01;
|
||||
public static final byte LI_TOOL_TYPE_ERASER = 0x02;
|
||||
|
||||
public static final byte LI_PEN_BUTTON_PRIMARY = 0x01;
|
||||
public static final byte LI_PEN_BUTTON_SECONDARY = 0x02;
|
||||
public static final byte LI_PEN_BUTTON_TERTIARY = 0x04;
|
||||
|
||||
public static final byte LI_TILT_UNKNOWN = (byte)0xFF;
|
||||
public static final byte LI_ROT_UNKNOWN = (byte)0xFF;
|
||||
|
||||
public static final byte LI_CTYPE_UNKNOWN = 0x00;
|
||||
public static final byte LI_CTYPE_XBOX = 0x01;
|
||||
public static final byte LI_CTYPE_PS = 0x02;
|
||||
public static final byte LI_CTYPE_NINTENDO = 0x03;
|
||||
|
||||
public static final short LI_CCAP_ANALOG_TRIGGERS = 0x01;
|
||||
public static final short LI_CCAP_RUMBLE = 0x02;
|
||||
public static final short LI_CCAP_TRIGGER_RUMBLE = 0x04;
|
||||
public static final short LI_CCAP_TOUCHPAD = 0x08;
|
||||
public static final short LI_CCAP_ACCEL = 0x10;
|
||||
public static final short LI_CCAP_GYRO = 0x20;
|
||||
|
||||
public static final byte LI_MOTION_TYPE_ACCEL = 0x01;
|
||||
public static final byte LI_MOTION_TYPE_GYRO = 0x02;
|
||||
|
||||
private static AudioRenderer audioRenderer;
|
||||
private static VideoDecoderRenderer videoRenderer;
|
||||
private static NvConnectionListener connectionListener;
|
||||
@@ -259,6 +292,18 @@ public class MoonBridge {
|
||||
}
|
||||
}
|
||||
|
||||
public static void bridgeClRumbleTriggers(short controllerNumber, short leftTrigger, short rightTrigger) {
|
||||
if (connectionListener != null) {
|
||||
connectionListener.rumbleTriggers(controllerNumber, leftTrigger, rightTrigger);
|
||||
}
|
||||
}
|
||||
|
||||
public static void bridgeClSetMotionEventState(short controllerNumber, byte eventType, short sampleRateHz) {
|
||||
if (connectionListener != null) {
|
||||
connectionListener.setMotionEventState(controllerNumber, eventType, sampleRateHz);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupBridge(VideoDecoderRenderer videoRenderer, AudioRenderer audioRenderer, NvConnectionListener connectionListener) {
|
||||
MoonBridge.videoRenderer = videoRenderer;
|
||||
MoonBridge.audioRenderer = audioRenderer;
|
||||
@@ -297,15 +342,21 @@ public class MoonBridge {
|
||||
public static native void sendMouseButton(byte buttonEvent, byte mouseButton);
|
||||
|
||||
public static native void sendMultiControllerInput(short controllerNumber,
|
||||
short activeGamepadMask, short buttonFlags,
|
||||
short activeGamepadMask, int buttonFlags,
|
||||
byte leftTrigger, byte rightTrigger,
|
||||
short leftStickX, short leftStickY,
|
||||
short rightStickX, short rightStickY);
|
||||
|
||||
public static native void sendControllerInput(short buttonFlags,
|
||||
byte leftTrigger, byte rightTrigger,
|
||||
short leftStickX, short leftStickY,
|
||||
short rightStickX, short rightStickY);
|
||||
public static native int sendTouchEvent(byte eventType, int pointerId, float x, float y, float pressure);
|
||||
|
||||
public static native int sendPenEvent(byte eventType, byte toolType, byte penButtons, float x, float y,
|
||||
float pressure, short rotation, byte tiltX, byte tiltY);
|
||||
|
||||
public static native int sendControllerArrivalEvent(byte controllerNumber, short activeGamepadMask, byte type, int supportedButtonFlags, short capabilities);
|
||||
|
||||
public static native int sendControllerTouchEvent(byte controllerNumber, byte eventType, int pointerId, float x, float y, float pressure);
|
||||
|
||||
public static native int sendControllerMotionEvent(byte controllerNumber, byte motionType, float x, float y, float z);
|
||||
|
||||
public static native void sendKeyboardInput(short keyMap, byte keyDirection, byte modifier, byte flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user