mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #12782 from Florin9doi/ios_notch
[iOS] Notch support
This commit is contained in:
commit
a1ebc35c63
3 changed files with 41 additions and 8 deletions
|
@ -86,11 +86,11 @@ matrix:
|
||||||
env: PPSSPP_BUILD_TYPE=Linux
|
env: PPSSPP_BUILD_TYPE=Linux
|
||||||
LIBRETRO=TRUE
|
LIBRETRO=TRUE
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8.3
|
osx_image: xcode9
|
||||||
compiler: "clang"
|
compiler: "clang"
|
||||||
env: PPSSPP_BUILD_TYPE=macOS
|
env: PPSSPP_BUILD_TYPE=macOS
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8.3
|
osx_image: xcode9
|
||||||
compiler: "clang"
|
compiler: "clang"
|
||||||
env: PPSSPP_BUILD_TYPE=iOS
|
env: PPSSPP_BUILD_TYPE=iOS
|
||||||
- os: windows
|
- os: windows
|
||||||
|
|
|
@ -148,6 +148,18 @@ static LocationHelper *locationHelper;
|
||||||
- (void)subtleVolume:(SubtleVolume *)volumeView didChange:(CGFloat)value {
|
- (void)subtleVolume:(SubtleVolume *)volumeView didChange:(CGFloat)value {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)viewSafeAreaInsetsDidChange {
|
||||||
|
if (@available(iOS 11.0, *)) {
|
||||||
|
[super viewSafeAreaInsetsDidChange];
|
||||||
|
char safeArea[100];
|
||||||
|
// we use 0.0f instead of safeAreaInsets.bottom because the bottom overlay isn't disturbing (for now)
|
||||||
|
snprintf(safeArea, sizeof(safeArea), "%f:%f:%f:%f",
|
||||||
|
self.view.safeAreaInsets.left, self.view.safeAreaInsets.right,
|
||||||
|
self.view.safeAreaInsets.top, 0.0f);
|
||||||
|
System_SendMessage("safe_insets", safeArea);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
[[DisplayManager shared] setupDisplayListener];
|
[[DisplayManager shared] setupDisplayListener];
|
||||||
|
|
21
ios/main.mm
21
ios/main.mm
|
@ -46,6 +46,11 @@ void *exception_handler(void *argument) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float g_safeInsetLeft = 0.0;
|
||||||
|
static float g_safeInsetRight = 0.0;
|
||||||
|
static float g_safeInsetTop = 0.0;
|
||||||
|
static float g_safeInsetBottom = 0.0;
|
||||||
|
|
||||||
|
|
||||||
std::string System_GetProperty(SystemProperty prop) {
|
std::string System_GetProperty(SystemProperty prop) {
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
|
@ -73,6 +78,14 @@ float System_GetPropertyFloat(SystemProperty prop) {
|
||||||
switch (prop) {
|
switch (prop) {
|
||||||
case SYSPROP_DISPLAY_REFRESH_RATE:
|
case SYSPROP_DISPLAY_REFRESH_RATE:
|
||||||
return 60.f;
|
return 60.f;
|
||||||
|
case SYSPROP_DISPLAY_SAFE_INSET_LEFT:
|
||||||
|
return g_safeInsetLeft;
|
||||||
|
case SYSPROP_DISPLAY_SAFE_INSET_RIGHT:
|
||||||
|
return g_safeInsetRight;
|
||||||
|
case SYSPROP_DISPLAY_SAFE_INSET_TOP:
|
||||||
|
return g_safeInsetTop;
|
||||||
|
case SYSPROP_DISPLAY_SAFE_INSET_BOTTOM:
|
||||||
|
return g_safeInsetBottom;
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -116,6 +129,14 @@ void System_SendMessage(const char *command, const char *parameter) {
|
||||||
} else if (!strcmp(parameter, "close")) {
|
} else if (!strcmp(parameter, "close")) {
|
||||||
stopLocation();
|
stopLocation();
|
||||||
}
|
}
|
||||||
|
} else if (!strcmp(command, "safe_insets")) {
|
||||||
|
float left, right, top, bottom;
|
||||||
|
if (4 == sscanf(parameter, "%f:%f:%f:%f", &left, &right, &top, &bottom)) {
|
||||||
|
g_safeInsetLeft = left;
|
||||||
|
g_safeInsetRight = right;
|
||||||
|
g_safeInsetTop = top;
|
||||||
|
g_safeInsetBottom = bottom;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue