Files
ppsspp/ios/Controls.h
Henrik RydgårdandClaude Opus 5.5 61ea2710bd iOS: Lift stuck touches when the scene resigns active
Pulling down Control Center starts a touch on our view that UIKit
doesn't always end or cancel. The tracker kept that slot down forever,
and touch input stopped working until the app was restarted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-22 12:25:42 +02:00

45 lines
1.5 KiB
Objective-C

#pragma once
#include <string_view>
#include "ppsspp_config.h"
#import <GameController/GameController.h>
#if !PPSSPP_PLATFORM(TVOS)
#import <CoreMotion/CoreMotion.h>
#endif
#include "Common/Input/InputState.h"
// Code extracted from ViewController.mm, in order to modularize
// and share it between multiple view controllers.
bool InitController(GCController *controller);
void ShutdownController(GCController *controller);
// Returns false unless the controller is a Siri Remote (a micro gamepad profile, no extended one and no B button).
bool InitSiriRemote(GCController *controller);
struct TouchTracker {
public:
void Began(NSSet *touches, UIView *view);
void Moved(NSSet *touches, UIView *view);
void Ended(NSSet *touches, UIView *view);
void Cancelled(NSSet *touches, UIView *view);
// Lifts every touch still down. UIKit doesn't always end the touches that pull down Control Center.
void CancelAll();
private:
void SendTouchEvent(CGPoint point, UIView *view, int code, int pointerId);
int ToTouchID(UITouch *uiTouch, bool allowAllocate);
UITouch *touches_[10]{};
};
#if !PPSSPP_PLATFORM(TVOS)
void ProcessAccelerometerData(CMAccelerometerData *accData);
void ProcessGyroData(CMGyroData *gyroData);
#endif
InputKeyCode HIDUsageToInputKeyCode(UIKeyboardHIDUsage usage);
void KeyboardPressesBegan(NSSet<UIPress *> *presses, UIPressesEvent *event);
void KeyboardPressesEnded(NSSet<UIPress *> *presses, UIPressesEvent *event);
void SendKeyboardChars(std::string_view str);