iOS 14 の iPad Air 2 で動画を再生すると、画面の回転方向を正確に取得することができず(0 (unknown)が返る)、さらに誤って回転方向に UIInterfaceOrientationLandscapeLeft を設定してしまうバグがあったため、以下のように修正しました。iOS 版 SDKを差し替えて更新しました。
--- onscripter_ios/DataDownloader-old/MoviePlayer.m 2018-12-10 20:53:40.000000000 +0900 +++ onscripter_ios/DataDownloader-new/MoviePlayer.m 2021-08-19 12:00:43.000000000 +0900 @@ -19,9 +19,10 @@ uiwindow.rootViewController = self; [uiwindow makeKeyAndVisible]; - if ([[UIDevice currentDevice] orientation] != UIInterfaceOrientationLandscapeLeft && - [[UIDevice currentDevice] orientation] != UIInterfaceOrientationLandscapeRight) - [[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeLeft) forKey:@"orientation"]; + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; + if (orientation != UIInterfaceOrientationLandscapeLeft && + orientation != UIInterfaceOrientationLandscapeRight) + [[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeRight) forKey:@"orientation"]; player = [[AVPlayerViewController alloc] init]; player.showsPlaybackControls = false;
ひさびさに Mac で ONScripter をビルドして動作確認をしました。まず、Mac を macOS Big Sur 11.5.1, Xcode 12.5.1 にアップデートし、iOS 版 SDKと最新のONScripterを使用してビルドしたところ、iPad Air 2(iOS 14.7.1)の実機および Xcode 12.5.1 のシミュレータ(iPhone 12 Pro Max - iOS 14.5)で特に問題なく動作しました。
しかし、USE_SELECTOR を有効にして起動時にゲームを選択できるようにしたところ、選択画面が表示されなくなっていました。また、これは数年前からあった不具合ですが、起動時にゲーム選択画面がランドスケープではなくポートレートで起動してしまう問題がありました。ScriptSelector.m を以下のように修正して、ScriptSelector.view のサイズを明示的に設定し、また ViewController を addSubview ではなく rootViewController に指定したところ、どちらの問題も解決しました。
--- onscripter_ios-old/DataDownloader/ScriptSelector.m 2019-09-11 11:08:23.000000000 +0900 +++ onscripter_ios-new/DataDownloader/ScriptSelector.m 2021-08-15 16:11:57.400545132 +0900 @@ -13,7 +13,8 @@ } UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - [uiwindow addSubview:self.view]; + [self.view setFrame:CGRectMake(0, 0, uiwindow.frame.size.width, uiwindow.frame.size.height)]; + uiwindow.rootViewController = self; [uiwindow makeKeyAndVisible]; is_running = YES;
また、これも数年前からあった不具合ですが、起動時にゲーム画面がランドスケープではなくポートレートで起動してしまう問題がありました。SDL の SDL_uikitopengles.m を以下のように修正して、ViewController を addSubview で設定しないようにしたところ、この問題も解決しました。
--- onscripter_ios-old/SDL/src/video/uikit/SDL_uikitopengles.m 2012-10-28 18:08:43.000000000 +0900 +++ onscripter_ios-new/SDL/src/video/uikit/SDL_uikitopengles.m 2021-08-15 16:15:49.617991796 +0900 @@ -132,7 +132,8 @@ [view->viewcontroller setView:view]; [view->viewcontroller retain]; } - [uiwindow addSubview: view]; + // removed by Ogapee to enable screen orientation control (2021.8.15) + //[uiwindow addSubview: view]; // The view controller needs to be the root in order to control rotation on iOS 6.0 if (uiwindow.rootViewController == nil) {
また、IPHONEOS_DEPLOYMENT_TARGET を 8.0 から 9.0 に変更しました。これらの変更を反映させてiOS 版 SDK を更新しました。