The iOS and tvOS paths take the same treatment as macOS, down to an iOS
12 floor and with deprecations reported: the UIKit, GameController,
MetricKit, AVFoundation and CoreLocation calls above the floor go
through the apple_runtime.h sends behind their OS checks, enum values
newer than the floor are compared by value, and the display link's
frame-rate range is set and read by selector on every platform without
an SDK gate. apple_runtime.h gains a 9-16 byte struct getter and
-init sends whose casts carry the init family's ownership.
Code that uses a framework throughout - the keypress and device
haptics, camera authorization, speech - moves into classes carrying
its availability, so it calls the framework directly, and is reached
by selector through a class looked up once. Deprecated calls with a
successor on every floor take it; the rest are sent by selector. The
iOS display link and GCDWebServer's lastModifiedDate declare their
ownership, and the iOS display link's rate read is guarded for systems
before iOS 10.3.
@available has two problems for RetroArch's range of targets:
1. It needs a clang new enough to know the syntax, so the ancient
toolchains building the legacy iOS/macOS targets cannot compile
any file that uses it.
2. It lowers to a call to __isPlatformVersionAtLeast() every time
it is evaluated, including in per-frame and per-input paths.
Introduce apple_runtime.h with apple_runtime_available(mac, ios,
tvos), a drop-in replacement that resolves the running OS version
exactly once per process and caches it in a static int; after
warm-up every check is a single load and integer compare, cheaper
than @available. Platforms the original check did not list are
passed as 0, preserving @available's semantics of returning true
on unlisted platforms.
The version is read from UIDevice systemVersion on iOS/tvOS (never
shimmed, works on any version), and on macOS from the
kern.osproductversion sysctl - which reports the real OS version
even for binaries linked against pre-11.0 SDKs, where the
NSProcessInfo APIs (and @available's own plist source) are subject
to the 10.16 compatibility shim - with an
operatingSystemVersionString fallback for pre-10.13.4 systems.
This also fixes the broken iOS 9 / iOS 6 CI builds: cocoa_common.m
used UIWindowScene.effectiveGeometry, an iOS 16 API that older SDKs
(e.g. iPhoneOS 14.2) do not declare at all, so @available could not
save compilation. That call chain is now resolved entirely at
runtime via objc_msgSend (identical cost to a compiled property
access), with the capability probe cached in a static.
All 84 live @available sites across 13 files are converted.
Behavior on every OS version is unchanged: the same paths are taken
at the same version thresholds. Swift #available sites are
untouched; Swift enforces availability at compile time and those
files only build on modern toolchains.
Existing compile-time SDK gates (e.g. around NSWorkspace
isVoiceOverEnabled and the Metal HDR blocks) are kept, since they
guard symbol declarations, not runtime dispatch; comments updated
accordingly.
- add tvOS target
- support code signing tvOS cores by adding an argument to the code signing cores script
- use NSCachesDirectory for the documents directory
- add some mfi controller handling logic to set non-game controllers to the last index to avoid interfering with operation
- autodetect mfi controller for apple tv on startup - added autodetect to hid joypad
- added a webserver to transfer files for tvOS
- xcode: clean up project, remove unused folders
- remove HAVE_MATERIALUI setting for tvos build, make it use XMB as default
- added retroarch app icon courtesy of @MrJs
- added auto-detect of mfi controller for apple tv