Commit Graph
5 Commits
Author SHA1 Message Date
LibretroAdmin 61a2bcbed7 apple: iOS and tvOS reach their newer APIs by selector too
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.
2026-10-07 06:55:20 +02:00
LibretroAdmin c8280e76c5 (Apple) Replace all @available checks with cached runtime version checks
@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.
2026-09-16 17:34:16 +02:00
Eric Warmenhoven cd574f7f33 tvOS: Add WebDAV server for adding files more easily (#17135)
Also update to latest (last) version of GCDWebServer.
2024-10-29 21:07:47 -07:00
Eric Warmenhoven b557bc9523 Fixing compiler warnings (#17001) 2024-09-14 13:11:20 -07:00
Yoshi Sugawara a18512375b Support for tvOS
- 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
2019-01-29 10:13:46 -10:00