mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +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)
|
||||
{
|
||||
#if defined(HAVE_COCOATOUCH)
|
||||
return ([[UIApplication sharedApplication] applicationState]
|
||||
== UIApplicationStateActive);
|
||||
/* if we are running, we are foregrounded */
|
||||
return true;
|
||||
#else
|
||||
return [NSApp isActive];
|
||||
#endif
|
||||
|
@ -186,12 +186,18 @@ apple_frontend_settings_t apple_frontend_settings;
|
||||
|
||||
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)
|
||||
*major = (int)[decomposed_os_version[0] integerValue];
|
||||
if (minor && decomposed_os_version.count > 1)
|
||||
*minor = (int)[decomposed_os_version[1] integerValue];
|
||||
dispatch_once(&onceToken, ^ {
|
||||
NSArray *decomposed_os_version = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
|
||||
if (decomposed_os_version.count > 0)
|
||||
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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user