mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 02:53:05 +00:00
Implement rumble support
This commit is contained in:
parent
422e703c2f
commit
10e0a262f7
@ -10,4 +10,6 @@ public interface NvConnectionListener {
|
||||
|
||||
void displayMessage(String message);
|
||||
void displayTransientMessage(String message);
|
||||
|
||||
void rumble(short controllerNumber, short lowFreqMotor, short highFreqMotor);
|
||||
}
|
||||
|
@ -156,6 +156,12 @@ public class MoonBridge {
|
||||
}
|
||||
}
|
||||
|
||||
public static void bridgeClRumble(short controllerNumber, short lowFreqMotor, short highFreqMotor) {
|
||||
if (connectionListener != null) {
|
||||
connectionListener.rumble(controllerNumber, lowFreqMotor, highFreqMotor);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupBridge(VideoDecoderRenderer videoRenderer, AudioRenderer audioRenderer, NvConnectionListener connectionListener) {
|
||||
MoonBridge.videoRenderer = videoRenderer;
|
||||
MoonBridge.audioRenderer = audioRenderer;
|
||||
|
@ -34,6 +34,7 @@ static jmethodID BridgeClConnectionStartedMethod;
|
||||
static jmethodID BridgeClConnectionTerminatedMethod;
|
||||
static jmethodID BridgeClDisplayMessageMethod;
|
||||
static jmethodID BridgeClDisplayTransientMessageMethod;
|
||||
static jmethodID BridgeClRumbleMethod;
|
||||
static jbyteArray DecodedFrameBuffer;
|
||||
static jbyteArray DecodedAudioBuffer;
|
||||
|
||||
@ -94,6 +95,7 @@ Java_com_limelight_nvstream_jni_MoonBridge_init(JNIEnv *env, jclass clazz) {
|
||||
BridgeClConnectionTerminatedMethod = (*env)->GetStaticMethodID(env, clazz, "bridgeClConnectionTerminated", "(J)V");
|
||||
BridgeClDisplayMessageMethod = (*env)->GetStaticMethodID(env, clazz, "bridgeClDisplayMessage", "(Ljava/lang/String;)V");
|
||||
BridgeClDisplayTransientMessageMethod = (*env)->GetStaticMethodID(env, clazz, "bridgeClDisplayTransientMessage", "(Ljava/lang/String;)V");
|
||||
BridgeClRumbleMethod = (*env)->GetStaticMethodID(env, clazz, "bridgeClRumble", "(SSS)V");
|
||||
}
|
||||
|
||||
int BridgeDrSetup(int videoFormat, int width, int height, int redrawRate, void* context, int drFlags) {
|
||||
@ -363,6 +365,16 @@ void BridgeClDisplayTransientMessage(const char* message) {
|
||||
(*env)->CallStaticVoidMethod(env, GlobalBridgeClass, BridgeClDisplayTransientMessageMethod, (*env)->NewStringUTF(env, message));
|
||||
}
|
||||
|
||||
void BridgeClRumble(short controllerNumber, short lowFreqMotor, short highFreqMotor) {
|
||||
JNIEnv* env = GetThreadEnv();
|
||||
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
return;
|
||||
}
|
||||
|
||||
(*env)->CallStaticVoidMethod(env, GlobalBridgeClass, BridgeClRumbleMethod, controllerNumber, lowFreqMotor, highFreqMotor);
|
||||
}
|
||||
|
||||
void BridgeClLogMessage(const char* format, ...) {
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
@ -395,6 +407,7 @@ static CONNECTION_LISTENER_CALLBACKS BridgeConnListenerCallbacks = {
|
||||
.displayMessage = BridgeClDisplayMessage,
|
||||
.displayTransientMessage = BridgeClDisplayTransientMessage,
|
||||
.logMessage = BridgeClLogMessage,
|
||||
.rumble = BridgeClRumble
|
||||
};
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit eb6bfe020538d57ec2781c65f450409f32e56515
|
||||
Subproject commit 83d7f675a7e49cea371561b74cd0d3672b64e9f9
|
Loading…
x
Reference in New Issue
Block a user