Fix smooth switching from Vulkan to GL

This commit is contained in:
Henrik Rydgård 2024-05-23 14:37:12 +02:00
parent 740219a65b
commit 9a93a478d1
4 changed files with 18 additions and 8 deletions

View File

@ -1502,7 +1502,7 @@ void NativeShutdown() {
ShutdownWebServer();
#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
#if PPSSPP_PLATFORM(ANDROID)
System_ExitApp();
#endif

View File

@ -11,7 +11,7 @@
@property (strong, nonatomic) id<PPSSPPViewController> viewController;
- (void)restart;
- (void)restart:(const char *)args;
- (BOOL)launchPPSSPP:(int)argc argv:(char**)argv;
@end

View File

@ -86,6 +86,9 @@
argv[argc++] = (char*)string;
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAudioSessionInterruption:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMediaServicesWereReset:) name:AVAudioSessionMediaServicesWereResetNotification object:nil];
return [self launchPPSSPP:argc argv:argv];
}
@ -113,9 +116,6 @@
[self.window makeKeyAndVisible];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAudioSessionInterruption:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMediaServicesWereReset:) name:AVAudioSessionMediaServicesWereResetNotification object:nil];
return YES;
}
@ -123,9 +123,19 @@
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)restart {
- (void)restart:(const char*)restartArgs {
INFO_LOG(G3D, "Restart requested: %s", restartArgs);
[self.viewController willResignActive];
self.viewController = nil;
// App was requested to restart, probably.
INFO_LOG(G3D, "Restart requested");
INFO_LOG(G3D, "viewController nilled");
NativeShutdown();
// TODO: Ignoring the command line for now.
// Hoping that overwriting the viewController works as expected...
[self launchPPSSPP:0 argv:nullptr];
}
-(void) applicationWillResignActive:(UIApplication *)application {

View File

@ -393,7 +393,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
switch (type) {
case SystemRequestType::RESTART_APP:
dispatch_async(dispatch_get_main_queue(), ^{
[(AppDelegate *)[[UIApplication sharedApplication] delegate] restart];
[(AppDelegate *)[[UIApplication sharedApplication] delegate] restart:param1.c_str()];
});
break;