mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-18 06:31:05 +00:00
Add support for the pause button
This commit is contained in:
@@ -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