mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-17 00:10:31 +02:00
The safe area insets were converted to pixels with UIScreen.scale, but the display size with nativeScale. The two differ on the Plus models and the minis, so the insets were off by up to 15% there. Both use the window scene's nativeScale now. Touch positions were truncated to integers before being multiplied by the screen scale, putting them on a grid about 3 dp apart. Convert straight from points to dp, by the view size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.5 KiB
Objective-C
51 lines
1.5 KiB
Objective-C
#pragma once
|
|
|
|
#include <map>
|
|
#include <string_view>
|
|
|
|
#import <GameController/GameController.h>
|
|
#import <CoreMotion/CoreMotion.h>
|
|
|
|
#include "iCade/iCadeState.h"
|
|
#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);
|
|
|
|
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);
|
|
private:
|
|
void SendTouchEvent(CGPoint point, UIView *view, int code, int pointerId);
|
|
int ToTouchID(UITouch *uiTouch, bool allowAllocate);
|
|
UITouch *touches_[10]{};
|
|
};
|
|
|
|
// Can probably get rid of this, but let's keep it for now.
|
|
struct ICadeTracker {
|
|
public:
|
|
void ButtonDown(iCadeState button);
|
|
void ButtonUp(iCadeState button);
|
|
void InitKeyMap();
|
|
private:
|
|
bool simulateAnalog = false;
|
|
bool iCadeConnectNotified = false;
|
|
|
|
std::map<uint16_t, InputKeyCode> iCadeToKeyMap;
|
|
|
|
double lastSelectPress = 0.0f;
|
|
double lastStartPress = 0.0f;
|
|
};
|
|
|
|
void ProcessAccelerometerData(CMAccelerometerData *accData);
|
|
InputKeyCode HIDUsageToInputKeyCode(UIKeyboardHIDUsage usage);
|
|
|
|
void KeyboardPressesBegan(NSSet<UIPress *> *presses, UIPressesEvent *event);
|
|
void KeyboardPressesEnded(NSSet<UIPress *> *presses, UIPressesEvent *event);
|
|
void SendKeyboardChars(std::string_view str); |