mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
iOS/tvOS: minor performance tweaks (#16882)
- it's ok to sleep in the foreground - ios always has focus, otherwise it's not running - don't keep reparsing strings
This commit is contained in:
parent
a759e60148
commit
833bf2e616
@ -771,8 +771,8 @@ void *cocoa_screen_get_chosen(void)
|
|||||||
bool cocoa_has_focus(void *data)
|
bool cocoa_has_focus(void *data)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_COCOATOUCH)
|
#if defined(HAVE_COCOATOUCH)
|
||||||
return ([[UIApplication sharedApplication] applicationState]
|
/* if we are running, we are foregrounded */
|
||||||
== UIApplicationStateActive);
|
return true;
|
||||||
#else
|
#else
|
||||||
return [NSApp isActive];
|
return [NSApp isActive];
|
||||||
#endif
|
#endif
|
||||||
|
@ -186,12 +186,18 @@ apple_frontend_settings_t apple_frontend_settings;
|
|||||||
|
|
||||||
void get_ios_version(int *major, int *minor)
|
void get_ios_version(int *major, int *minor)
|
||||||
{
|
{
|
||||||
NSArray *decomposed_os_version = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
|
static int savedMajor, savedMinor;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
|
||||||
if (major && decomposed_os_version.count > 0)
|
dispatch_once(&onceToken, ^ {
|
||||||
*major = (int)[decomposed_os_version[0] integerValue];
|
NSArray *decomposed_os_version = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
|
||||||
if (minor && decomposed_os_version.count > 1)
|
if (decomposed_os_version.count > 0)
|
||||||
*minor = (int)[decomposed_os_version[1] integerValue];
|
savedMajor = (int)[decomposed_os_version[0] integerValue];
|
||||||
|
if (decomposed_os_version.count > 1)
|
||||||
|
savedMinor = (int)[decomposed_os_version[1] integerValue];
|
||||||
|
});
|
||||||
|
if (major) *major = savedMajor;
|
||||||
|
if (minor) *minor = savedMinor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Input helpers: This is kept here because it needs ObjC */
|
/* Input helpers: This is kept here because it needs ObjC */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user