mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-10-27 14:30:11 +00:00
Add support for the pause button
This commit is contained in:
1 parent
9e8903402b
commit
3178f87707
1 file changed
+13
@@ -26,6 +26,19 @@ static NSLock *controllerStreamLock;
|
|||||||
|
|
||||||
if (controller != NULL) {
|
if (controller != NULL) {
|
||||||
NSLog(@"Controller connected!");
|
NSLog(@"Controller connected!");
|
||||||
|
controller.controllerPausedHandler = ^(GCController *controller) {
|
||||||
|
// We call LiSendControllerEvent while holding a lock to prevent
|
||||||
|
// multiple simultaneous calls since this function isn't thread safe.
|
||||||
|
[controllerStreamLock lock];
|
||||||
|
LiSendControllerEvent(PLAY_FLAG, 0, 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
// Pause for 100 ms
|
||||||
|
usleep(100 * 1000);
|
||||||
|
|
||||||
|
LiSendControllerEvent(0, 0, 0, 0, 0, 0, 0);
|
||||||
|
[controllerStreamLock unlock];
|
||||||
|
};
|
||||||
|
|
||||||
if (controller.extendedGamepad != NULL) {
|
if (controller.extendedGamepad != NULL) {
|
||||||
controller.extendedGamepad.valueChangedHandler = ^(GCExtendedGamepad *gamepad, GCControllerElement *element) {
|
controller.extendedGamepad.valueChangedHandler = ^(GCExtendedGamepad *gamepad, GCControllerElement *element) {
|
||||||
short buttonFlags;
|
short buttonFlags;
|
||||||
|
|||||||
Reference in new issue
Block a user