mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-25 21:04:40 +00:00
(iOS) Use the nuclear option for life-cycle management.
This should fix hangs caused by incoming calls or launching siri, but will cause more driver reinits than before
This commit is contained in:
parent
8656b04492
commit
fe08806aa5
@ -189,17 +189,6 @@ static float g_screen_scale = 1.0f;
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)suspend
|
|
||||||
{
|
|
||||||
g_view.context = nil;
|
|
||||||
[EAGLContext setCurrentContext:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)resume
|
|
||||||
{
|
|
||||||
g_view.context = g_context;
|
|
||||||
[EAGLContext setCurrentContext:g_context];
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -232,13 +221,6 @@ bool apple_init_game_view()
|
|||||||
void apple_destroy_game_view()
|
void apple_destroy_game_view()
|
||||||
{
|
{
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
// Clear the view, otherwise the last frame from this game will be displayed
|
|
||||||
// briefly on the next game.
|
|
||||||
[g_view bindDrawable];
|
|
||||||
glClearColor(0, 0, 0, 1);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
[g_view display];
|
|
||||||
|
|
||||||
glFinish();
|
glFinish();
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
|
@ -39,9 +39,6 @@ extern id<RetroArch_Platform> apple_platform;
|
|||||||
+ (RAGameView*)get;
|
+ (RAGameView*)get;
|
||||||
- (void)openPauseMenu;
|
- (void)openPauseMenu;
|
||||||
- (void)closePauseMenu;
|
- (void)closePauseMenu;
|
||||||
|
|
||||||
- (void)suspend;
|
|
||||||
- (void)resume;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate, UINavigationControllerDelegate, RetroArch_Platform>
|
@interface RetroArch_iOS : UINavigationController<UIApplicationDelegate, UINavigationControllerDelegate, RetroArch_Platform>
|
||||||
|
@ -83,6 +83,18 @@ static void event_reload_config(void* userdata)
|
|||||||
init_drivers();
|
init_drivers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pthread_mutex_t stasis_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
|
static void event_stasis(void* userdata)
|
||||||
|
{
|
||||||
|
// HACK: uninit_drivers is the nuclear option; uninit_audio would be better but will
|
||||||
|
// crash when resuming.
|
||||||
|
uninit_drivers();
|
||||||
|
pthread_mutex_lock(&stasis_mutex);
|
||||||
|
pthread_mutex_unlock(&stasis_mutex);
|
||||||
|
init_drivers();
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark EMULATION
|
#pragma mark EMULATION
|
||||||
static pthread_t apple_retro_thread;
|
static pthread_t apple_retro_thread;
|
||||||
static bool apple_is_paused;
|
static bool apple_is_paused;
|
||||||
@ -258,14 +270,19 @@ int main(int argc, char *argv[])
|
|||||||
apple_display_alert(@"No libretro cores were found. You will not be able to play any games.", 0);
|
apple_display_alert(@"No libretro cores were found. You will not be able to play any games.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillEnterForeground:(UIApplication *)application
|
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||||
{
|
{
|
||||||
[RAGameView.get resume];
|
if (apple_is_running)
|
||||||
|
pthread_mutex_unlock(&stasis_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidEnterBackground:(UIApplication *)application
|
- (void)applicationWillResignActive:(UIApplication *)application
|
||||||
{
|
{
|
||||||
[RAGameView.get suspend];
|
if (apple_is_running)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&stasis_mutex);
|
||||||
|
apple_frontend_post_event(event_stasis, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UINavigationControllerDelegate
|
// UINavigationControllerDelegate
|
||||||
|
Loading…
x
Reference in New Issue
Block a user