iOS: Fix threading issue with launch-url

This commit is contained in:
Henrik Rydgård
2024-05-20 15:38:04 +02:00
parent 612f879e4a
commit 8756a2100e
2 changed files with 15 additions and 3 deletions
+5 -3
View File
@@ -197,7 +197,7 @@ extern float g_safeInsetBottom;
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
view.drawableStencilFormat = GLKViewDrawableStencilFormat8;
[EAGLContext setCurrentContext:self.context];
self.preferredFramesPerSecond = 60;
self.preferredFramesPerSecond = 60; // NOTE: We don't yet take advantage of 120hz screens
[[DisplayManager shared] updateResolution:[UIScreen mainScreen]];
@@ -239,7 +239,6 @@ extern float g_safeInsetBottom;
NativeFrame(graphicsContext);
}
INFO_LOG(SYSTEM, "Emulation thread shutting down\n");
NativeShutdownGraphics();
@@ -752,7 +751,10 @@ void stopLocation() {
void System_LaunchUrl(LaunchUrlType urlType, char const* url)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithCString:url encoding:NSStringEncodingConversionAllowLossy]]];
NSURL *nsUrl = [NSURL URLWithString:[NSString stringWithCString:url encoding:NSStringEncodingConversionAllowLossy]];
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] openURL:nsUrl] options:@{} completionHandler:nil];
});
}
void bindDefaultFBO()
+10
View File
@@ -437,6 +437,16 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
[sharedViewController shareText:text];
return true;
}
/*
// Not 100% sure the threading is right
case SystemRequestType::COPY_TO_CLIPBOARD:
{
@autoreleasepool {
[UIPasteboard generalPasteboard].string = @(param1.c_str());
return 0;
}
}
*/
case SystemRequestType::SET_KEEP_SCREEN_BRIGHT:
dispatch_async(dispatch_get_main_queue(), ^{
INFO_LOG(SYSTEM, "SET_KEEP_SCREEN_BRIGHT: %d", (int)param3);