git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit fe2c868d6c4b922a3cc4989093a3f8e47e06953d
parent 150f0fcad40d2e26361bf482df7d80a4a5876aa5
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sat, 23 Nov 2024 21:03:34 +0200

Fix iOS 11/12 builds

Diffstat:
MiOS/GBViewController.m16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m @@ -218,6 +218,18 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp) ((__bridge void(^)(id))context)(change[NSKeyValueChangeNewKey]); } +- (NSArray<NSNumber *> *)zoomFactorsForDevice:(AVCaptureDevice *)device +{ + if (@available(iOS 13.0, *)) { + return device.virtualDeviceSwitchOverVideoZoomFactors; + } + double factor = device.dualCameraSwitchOverVideoZoomFactor; + if (factor == 1.0) { + return @[]; + } + return @[@(factor)]; +} + - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { _window = [[UIWindow alloc] init]; @@ -308,7 +320,7 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp) for (AVCaptureDevice *device in cameraDiscoverySession.devices) { if ([device position] == AVCaptureDevicePositionBack) { if (!_backCaptureDevice || - _backCaptureDevice.virtualDeviceSwitchOverVideoZoomFactors.count < device.virtualDeviceSwitchOverVideoZoomFactors.count) { + [self zoomFactorsForDevice:_backCaptureDevice].count < [self zoomFactorsForDevice:device].count) { _backCaptureDevice = device; } } @@ -317,7 +329,7 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp) } } - _zoomLevels = _backCaptureDevice.virtualDeviceSwitchOverVideoZoomFactors.mutableCopy; + _zoomLevels = [self zoomFactorsForDevice:_backCaptureDevice].mutableCopy; [_zoomLevels insertObject:@1 atIndex:0]; if (_zoomLevels.count == 3 && _zoomLevels[2].doubleValue > 5.5 && _zoomLevels[1].doubleValue < 3.5) { [_zoomLevels insertObject:@4 atIndex:2];

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.