diff --git a/Natives/LauncherPreferencesViewController.m b/Natives/LauncherPreferencesViewController.m index fe4d4ecb..ef0039dd 100644 --- a/Natives/LauncherPreferencesViewController.m +++ b/Natives/LauncherPreferencesViewController.m @@ -215,6 +215,11 @@ @"icon": @"speaker.zzz", @"type": self.typeSwitch }, + @{@"key": @"allow_microphone", + @"hasDetail": @YES, + @"icon": @"mic", + @"type": self.typeSwitch + }, ], @[ // Control settings @{@"icon": @"gamecontroller"}, @@ -399,6 +404,12 @@ if (self.navigationController == nil) { self.tableView.alpha = 0.9; } + if (NSProcessInfo.processInfo.isMacCatalystApp) { + UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeClose]; + closeButton.frame = CGRectOffset(closeButton.frame, 10, 10); + [closeButton addTarget:self action:@selector(actionClose) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:closeButton]; + } } - (void)viewWillDisappear:(BOOL)animated { @@ -408,6 +419,10 @@ } } +- (void)actionClose { + [self dismissViewControllerAnimated:YES completion:nil]; +} + #pragma mark UITableView - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { diff --git a/Natives/PLPreferences.m b/Natives/PLPreferences.m index b7be3d52..7b5e7efd 100644 --- a/Natives/PLPreferences.m +++ b/Natives/PLPreferences.m @@ -24,7 +24,8 @@ @"performance_hud": @NO, @"fullscreen_airplay": @YES, @"silence_other_audio": @NO, - @"silence_with_switch": @NO + @"silence_with_switch": @NO, + @"allow_microphone": @NO }.mutableCopy, @"control": @{ @"default_ctrl": @"default.json", diff --git a/Natives/SurfaceViewController.m b/Natives/SurfaceViewController.m index f26428f9..29e0cd58 100644 --- a/Natives/SurfaceViewController.m +++ b/Natives/SurfaceViewController.m @@ -292,11 +292,13 @@ static GameSurfaceView* pojavWindow; NSError *sessionError = nil; AVAudioSessionCategory category; AVAudioSessionCategoryOptions options = 0; - if(getPrefBool(@"video.silence_with_switch")) { + if(getPrefBool(@"video.allow_microphone")) { + category = AVAudioSessionCategoryPlayAndRecord; + options |= AVAudioSessionCategoryOptionAllowAirPlay | AVAudioSessionCategoryOptionAllowBluetoothA2DP | AVAudioSessionCategoryOptionDefaultToSpeaker; + } else if(getPrefBool(@"video.silence_with_switch")) { category = AVAudioSessionCategorySoloAmbient; } else { - category = AVAudioSessionCategoryPlayAndRecord; - options |= AVAudioSessionCategoryOptionAllowAirPlay | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionAllowBluetoothA2DP | AVAudioSessionCategoryOptionDefaultToSpeaker; + category = AVAudioSessionCategoryPlayback; } if(!getPrefBool(@"video.silence_other_audio")) { options |= AVAudioSessionCategoryOptionMixWithOthers; diff --git a/Natives/resources/en.lproj/Localizable.strings b/Natives/resources/en.lproj/Localizable.strings index 0e41ea61..299aa90f 100644 --- a/Natives/resources/en.lproj/Localizable.strings +++ b/Natives/resources/en.lproj/Localizable.strings @@ -196,8 +196,10 @@ "preference.detail.fullscreen_airplay" = "Allows presenting fullscreen game window on the external display rather than mirroring everything on screen."; "preference.title.silence_other_audio" = "Pause audio when game opens"; "preference.detail.silence_other_audio" = "Enable to allow PojavLauncher to pause audio from other apps, such as Music, when launching the game."; -"preference.title.silence_with_switch" = "Disable audio with silent switch and deny microphone input"; -"preference.detail.silence_with_switch" = "Enable to disable audio when Silent Mode is on, and deny microphone input. Headphones and external speakers are not affected."; +"preference.title.silence_with_switch" = "Disable audio with silent switch"; +"preference.detail.silence_with_switch" = "Enable to disable audio when Silent Mode is on. Headphones and external speakers are not affected."; +"preference.title.allow_microphone" = "Allow microphone input"; +"preference.detail.allow_microphone" = "Enable this only if you are using voice chat mod. Silent switch option will be ignored, and audio quality from other apps will be affected."; "preference.title.default_gamepad_ctrl" = "Controller configuration"; "preference.title.hardware_hide" = "Hide controls when hardware is connected"; "preference.detail.hardware_hide" = "Enable the behaviour of automatically disabling the on-screen control overlay when a mouse or game controller is connected.";