From e6e6f4fbe14e6bd3551301fe5988a857846684f5 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Thu, 1 Oct 2020 11:58:47 +0800 Subject: [PATCH 1/5] Add descriptions for camera and microphone usage on macos Starting from macOS 10.14, users need to grant permissions for applications to use media capture (camera and microphone). The application *must* provide a description in its Info.plist or it will be terminated due to privacy violation upon attempting to initialize camera/microphone. Ideally these two strings should be translated, but since this is not really compatible with Qt's localization system and likely requires separate configuration, I'm currently not that interested in messing with it. --- src/citra_qt/Info.plist | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/citra_qt/Info.plist b/src/citra_qt/Info.plist index 7d46b39d1..87fc9c246 100644 --- a/src/citra_qt/Info.plist +++ b/src/citra_qt/Info.plist @@ -36,5 +36,9 @@ NSApplication NSHighResolutionCapable True + NSCameraUsageDescription + This app requires camera access to emulate the 3DS's cameras. + NSMicrophoneUsageDescription + This app requires microphone access to emulate the 3DS's microphone. From 940ec70f13830dd9feea75fd5ff2900007e5cd1e Mon Sep 17 00:00:00 2001 From: Vitor Kiguchi Date: Thu, 13 May 2021 02:41:12 -0300 Subject: [PATCH 2/5] Apple: request authorization for camera usage --- CMakeLists.txt | 3 +- src/citra_qt/CMakeLists.txt | 4 + src/citra_qt/camera/qt_multimedia_camera.cpp | 8 ++ .../configuration/configure_camera.cpp | 12 ++- src/citra_qt/usage_authorization.h | 12 +++ src/citra_qt/usage_authorization.mm | 79 +++++++++++++++++++ 6 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 src/citra_qt/usage_authorization.h create mode 100644 src/citra_qt/usage_authorization.mm diff --git a/CMakeLists.txt b/CMakeLists.txt index af8caa7fe..58172fa7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -244,7 +244,8 @@ endif() if (APPLE) # Umbrella framework for everything GUI-related find_library(COCOA_LIBRARY Cocoa) - set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) + find_library(AVFOUNDATION_LIBRARY AVFoundation) + set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) elseif (WIN32) # WSAPoll and SHGetKnownFolderPath (AppData/Roaming) didn't exist before WinNT 6.x (Vista) add_definitions(-D_WIN32_WINNT=0x0600 -DWINVER=0x0600) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 4f64f7be6..868c68e4a 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -236,6 +236,10 @@ if (APPLE) target_sources(citra-qt PRIVATE ${MACOSX_ICON}) set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE TRUE) set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) + target_sources(citra-qt PRIVATE + usage_authorization.h + usage_authorization.mm + ) elseif(WIN32) # compile as a win32 gui application instead of a console application target_link_libraries(citra-qt PRIVATE Qt5::WinMain) diff --git a/src/citra_qt/camera/qt_multimedia_camera.cpp b/src/citra_qt/camera/qt_multimedia_camera.cpp index f7c3b14d8..dd932cae0 100644 --- a/src/citra_qt/camera/qt_multimedia_camera.cpp +++ b/src/citra_qt/camera/qt_multimedia_camera.cpp @@ -9,6 +9,7 @@ #include #include "citra_qt/camera/qt_multimedia_camera.h" #include "citra_qt/main.h" +#include "citra_qt/usage_authorization.h" namespace Camera { @@ -187,6 +188,13 @@ void QtMultimediaCameraHandler::StopCamera() { } void QtMultimediaCameraHandler::StartCamera() { +#if defined(__APPLE__) + bool authorized = AppleAuthorization::CheckAuthorizationForCamera(); + if (!authorized) { + LOG_ERROR(Service_CAM, "Unable to start camera due to lack of authorization"); + return; + } +#endif camera->setViewfinderSettings(settings); camera->start(); started = true; diff --git a/src/citra_qt/configuration/configure_camera.cpp b/src/citra_qt/configuration/configure_camera.cpp index c11dbca62..d84cac4f2 100644 --- a/src/citra_qt/configuration/configure_camera.cpp +++ b/src/citra_qt/configuration/configure_camera.cpp @@ -17,6 +17,10 @@ #include "core/settings.h" #include "ui_configure_camera.h" +#if defined(__APPLE__) +#include "citra_qt/usage_authorization.h" +#endif + const std::array ConfigureCamera::Implementations = { "blank", /* Blank */ "image", /* Image */ @@ -46,9 +50,15 @@ ConfigureCamera::~ConfigureCamera() { void ConfigureCamera::ConnectEvents() { connect(ui->image_source, - static_cast(&QComboBox::currentIndexChanged), this, [this] { + static_cast(&QComboBox::currentIndexChanged), this, + [this](int index) { StopPreviewing(); UpdateImageSourceUI(); +#if defined(__APPLE__) + if (index == 2) { + AppleAuthorization::CheckAuthorizationForCamera(); + } +#endif }); connect(ui->camera_selection, static_cast(&QComboBox::currentIndexChanged), this, [this] { diff --git a/src/citra_qt/usage_authorization.h b/src/citra_qt/usage_authorization.h new file mode 100644 index 000000000..e9be685b6 --- /dev/null +++ b/src/citra_qt/usage_authorization.h @@ -0,0 +1,12 @@ +// Copyright 2020 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +namespace AppleAuthorization { + +bool CheckAuthorizationForCamera(); +bool CheckAuthorizationForAudio(); + +} // namespace AppleAuthorization diff --git a/src/citra_qt/usage_authorization.mm b/src/citra_qt/usage_authorization.mm new file mode 100644 index 000000000..e9afb0748 --- /dev/null +++ b/src/citra_qt/usage_authorization.mm @@ -0,0 +1,79 @@ +// Copyright 2020 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#import + +#include "citra_qt/usage_authorization.h" +#include "common/logging/log.h" + +namespace AppleAuthorization { + +static bool authorized = false; + +enum class AuthMediaType { + Camera, + Microphone +}; + +// Based on https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos +void CheckAuthorization(AuthMediaType type) { + if (@available(macOS 10.14, *)) { + NSString *media_type; + if(type == AuthMediaType::Camera) { + media_type = AVMediaTypeVideo; + } + else { + media_type = AVMediaTypeAudio; + } + + // Request permission to access the camera and microphone. + switch ([AVCaptureDevice authorizationStatusForMediaType:media_type]) { + case AVAuthorizationStatusAuthorized: + // The user has previously granted access to the camera. + authorized = true; + break; + case AVAuthorizationStatusNotDetermined: + { + // The app hasn't yet asked the user for camera access. + [AVCaptureDevice requestAccessForMediaType:media_type completionHandler:^(BOOL) { + authorized = true; + }]; + if(type == AuthMediaType::Camera) { + LOG_INFO(Frontend, "Camera access requested."); + } + break; + } + case AVAuthorizationStatusDenied: + { + // The user has previously denied access. + authorized = false; + if(type == AuthMediaType::Camera) { + LOG_WARNING(Frontend, "Camera access denied. To change this you may modify the macos system settings for Citra at 'System Preferences -> Security & Privacy -> Camera'"); + } + return; + } + case AVAuthorizationStatusRestricted: + { + // The user can't grant access due to restrictions. + authorized = false; + return; + } + } + } + else { + authorized = true; + } +} + +bool CheckAuthorizationForCamera() { + CheckAuthorization(AuthMediaType::Camera); + return authorized; +} + +bool CheckAuthorizationForMicrophone() { + CheckAuthorization(AuthMediaType::Microphone); + return authorized; +} + +} //AppleAuthorization From d5a4988f9ef2a56396e4ebc6d897cf4d2546675e Mon Sep 17 00:00:00 2001 From: Vitor Kiguchi Date: Mon, 10 Jan 2022 13:52:39 +0100 Subject: [PATCH 3/5] clang format: add objective c++ formatting --- CMakeLists.txt | 6 +-- src/.clang-format | 84 +++++++++++++++++++++++++++++ src/citra_qt/usage_authorization.mm | 79 +++++++++++++-------------- 3 files changed, 125 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58172fa7b..583311da8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -291,15 +291,15 @@ if (CLANG_FORMAT) set(CCOMMENT "Running clang format against all the .h and .cpp files in src/") if (WIN32) add_custom_target(clang-format - COMMAND powershell.exe -Command "Get-ChildItem '${SRCS}/*' -Include *.cpp,*.h -Recurse | Foreach {&'${CLANG_FORMAT}' -i $_.fullname}" + COMMAND powershell.exe -Command "Get-ChildItem '${SRCS}/*' -Include *.cpp,*.h,*.mm -Recurse | Foreach {&'${CLANG_FORMAT}' -i $_.fullname}" COMMENT ${CCOMMENT}) elseif(MINGW) add_custom_target(clang-format - COMMAND find `cygpath -u ${SRCS}` -iname *.h -o -iname *.cpp | xargs `cygpath -u ${CLANG_FORMAT}` -i + COMMAND find `cygpath -u ${SRCS}` -iname *.h -o -iname *.cpp -o -iname *.mm | xargs `cygpath -u ${CLANG_FORMAT}` -i COMMENT ${CCOMMENT}) else() add_custom_target(clang-format - COMMAND find ${SRCS} -iname *.h -o -iname *.cpp | xargs ${CLANG_FORMAT} -i + COMMAND find ${SRCS} -iname *.h -o -iname *.cpp -o -iname *.mm | xargs ${CLANG_FORMAT} -i COMMENT ${CCOMMENT}) endif() unset(SRCS) diff --git a/src/.clang-format b/src/.clang-format index bf8872643..b7d6b4aba 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -169,4 +169,88 @@ SpacesInParentheses: false SpacesInSquareBrackets: false TabWidth: 4 UseTab: Never +--- +Language: ObjC +# BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: false +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: true +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +ColumnLimit: 100 +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +IncludeCategories: + - Regex: '^\<[^Q][^/.>]*\>' + Priority: -2 + - Regex: '^\<' + Priority: -1 + - Regex: '^\"' + Priority: 0 +IndentCaseLabels: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 150 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +TabWidth: 4 +UseTab: Never ... diff --git a/src/citra_qt/usage_authorization.mm b/src/citra_qt/usage_authorization.mm index e9afb0748..6da39e8e8 100644 --- a/src/citra_qt/usage_authorization.mm +++ b/src/citra_qt/usage_authorization.mm @@ -11,57 +11,54 @@ namespace AppleAuthorization { static bool authorized = false; -enum class AuthMediaType { - Camera, - Microphone -}; +enum class AuthMediaType { Camera, Microphone }; -// Based on https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos +// Based on +// https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos void CheckAuthorization(AuthMediaType type) { if (@available(macOS 10.14, *)) { - NSString *media_type; - if(type == AuthMediaType::Camera) { + NSString* media_type; + if (type == AuthMediaType::Camera) { media_type = AVMediaTypeVideo; - } - else { + } else { media_type = AVMediaTypeAudio; } // Request permission to access the camera and microphone. switch ([AVCaptureDevice authorizationStatusForMediaType:media_type]) { - case AVAuthorizationStatusAuthorized: - // The user has previously granted access to the camera. - authorized = true; - break; - case AVAuthorizationStatusNotDetermined: - { - // The app hasn't yet asked the user for camera access. - [AVCaptureDevice requestAccessForMediaType:media_type completionHandler:^(BOOL) { - authorized = true; - }]; - if(type == AuthMediaType::Camera) { - LOG_INFO(Frontend, "Camera access requested."); - } - break; - } - case AVAuthorizationStatusDenied: - { - // The user has previously denied access. - authorized = false; - if(type == AuthMediaType::Camera) { - LOG_WARNING(Frontend, "Camera access denied. To change this you may modify the macos system settings for Citra at 'System Preferences -> Security & Privacy -> Camera'"); - } - return; - } - case AVAuthorizationStatusRestricted: - { - // The user can't grant access due to restrictions. - authorized = false; - return; + case AVAuthorizationStatusAuthorized: + // The user has previously granted access to the camera. + authorized = true; + break; + case AVAuthorizationStatusNotDetermined: { + // The app hasn't yet asked the user for camera access. + [AVCaptureDevice requestAccessForMediaType:media_type + completionHandler:^(BOOL) { + authorized = true; + }]; + if (type == AuthMediaType::Camera) { + LOG_INFO(Frontend, "Camera access requested."); } + break; } - } - else { + case AVAuthorizationStatusDenied: { + // The user has previously denied access. + authorized = false; + if (type == AuthMediaType::Camera) { + LOG_WARNING( + Frontend, + "Camera access denied. To change this you may modify the macos system settings " + "for Citra at 'System Preferences -> Security & Privacy -> Camera'"); + } + return; + } + case AVAuthorizationStatusRestricted: { + // The user can't grant access due to restrictions. + authorized = false; + return; + } + } + } else { authorized = true; } } @@ -76,4 +73,4 @@ bool CheckAuthorizationForMicrophone() { return authorized; } -} //AppleAuthorization +} // AppleAuthorization From 7bbc94d4282bcfa14772d657fd67620b40bb7d03 Mon Sep 17 00:00:00 2001 From: Vitor Kiguchi Date: Mon, 10 Jan 2022 14:38:49 +0100 Subject: [PATCH 4/5] macos: request permission for microphone usage --- src/citra_qt/configuration/configure_audio.cpp | 9 +++++++++ src/citra_qt/usage_authorization.h | 2 +- src/citra_qt/usage_authorization.mm | 13 +++++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/citra_qt/configuration/configure_audio.cpp b/src/citra_qt/configuration/configure_audio.cpp index 40d2ae759..e9452923d 100644 --- a/src/citra_qt/configuration/configure_audio.cpp +++ b/src/citra_qt/configuration/configure_audio.cpp @@ -15,6 +15,10 @@ #include "core/settings.h" #include "ui_configure_audio.h" +#if defined(__APPLE__) +#include "citra_qt/usage_authorization.h" +#endif + constexpr int DEFAULT_INPUT_DEVICE_INDEX = 0; ConfigureAudio::ConfigureAudio(QWidget* parent) @@ -148,6 +152,11 @@ void ConfigureAudio::UpdateAudioOutputDevices(int sink_index) { } void ConfigureAudio::UpdateAudioInputDevices(int index) { +#if defined(__APPLE__) + if (index == 1) { + AppleAuthorization::CheckAuthorizationForMicrophone(); + } +#endif if (Settings::values.mic_input_device != Frontend::Mic::default_device_name) { ui->input_device_combo_box->setCurrentText( QString::fromStdString(Settings::values.mic_input_device)); diff --git a/src/citra_qt/usage_authorization.h b/src/citra_qt/usage_authorization.h index e9be685b6..c9292d1f9 100644 --- a/src/citra_qt/usage_authorization.h +++ b/src/citra_qt/usage_authorization.h @@ -7,6 +7,6 @@ namespace AppleAuthorization { bool CheckAuthorizationForCamera(); -bool CheckAuthorizationForAudio(); +bool CheckAuthorizationForMicrophone(); } // namespace AppleAuthorization diff --git a/src/citra_qt/usage_authorization.mm b/src/citra_qt/usage_authorization.mm index 6da39e8e8..5b4506f1e 100644 --- a/src/citra_qt/usage_authorization.mm +++ b/src/citra_qt/usage_authorization.mm @@ -38,6 +38,8 @@ void CheckAuthorization(AuthMediaType type) { }]; if (type == AuthMediaType::Camera) { LOG_INFO(Frontend, "Camera access requested."); + } else { // AuthMediaType::Microphone + LOG_INFO(Frontend, "Microphone access requested."); } break; } @@ -45,10 +47,13 @@ void CheckAuthorization(AuthMediaType type) { // The user has previously denied access. authorized = false; if (type == AuthMediaType::Camera) { - LOG_WARNING( - Frontend, - "Camera access denied. To change this you may modify the macos system settings " - "for Citra at 'System Preferences -> Security & Privacy -> Camera'"); + LOG_WARNING(Frontend, "Camera access denied. To change this you may modify the " + "macOS system permission settings " + "for Citra at 'System Preferences -> Security & Privacy'"); + } else { // AuthMediaType::Microphone + LOG_WARNING(Frontend, "Microphone access denied. To change this you may modify the " + "macOS system permission settings " + "for Citra at 'System Preferences -> Security & Privacy'"); } return; } From 8b0a6b9d5e6241e364733cac1c6f338b9901c277 Mon Sep 17 00:00:00 2001 From: Vitor Kiguchi Date: Mon, 10 Jan 2022 15:30:41 +0100 Subject: [PATCH 5/5] macos permission: address review comments --- src/citra_qt/CMakeLists.txt | 4 ++-- src/citra_qt/camera/qt_multimedia_camera.cpp | 8 +++++--- src/citra_qt/configuration/configure_audio.cpp | 2 +- src/citra_qt/configuration/configure_camera.cpp | 2 +- .../{usage_authorization.h => macos_authorization.h} | 0 .../{usage_authorization.mm => macos_authorization.mm} | 6 +++--- 6 files changed, 12 insertions(+), 10 deletions(-) rename src/citra_qt/{usage_authorization.h => macos_authorization.h} (100%) rename src/citra_qt/{usage_authorization.mm => macos_authorization.mm} (94%) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 868c68e4a..025c817e6 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -237,8 +237,8 @@ if (APPLE) set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE TRUE) set_target_properties(citra-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) target_sources(citra-qt PRIVATE - usage_authorization.h - usage_authorization.mm + macos_authorization.h + macos_authorization.mm ) elseif(WIN32) # compile as a win32 gui application instead of a console application diff --git a/src/citra_qt/camera/qt_multimedia_camera.cpp b/src/citra_qt/camera/qt_multimedia_camera.cpp index dd932cae0..00ba03afb 100644 --- a/src/citra_qt/camera/qt_multimedia_camera.cpp +++ b/src/citra_qt/camera/qt_multimedia_camera.cpp @@ -9,7 +9,10 @@ #include #include "citra_qt/camera/qt_multimedia_camera.h" #include "citra_qt/main.h" -#include "citra_qt/usage_authorization.h" + +#if defined(__APPLE__) +#include "citra_qt/macos_authorization.h" +#endif namespace Camera { @@ -189,8 +192,7 @@ void QtMultimediaCameraHandler::StopCamera() { void QtMultimediaCameraHandler::StartCamera() { #if defined(__APPLE__) - bool authorized = AppleAuthorization::CheckAuthorizationForCamera(); - if (!authorized) { + if (!AppleAuthorization::CheckAuthorizationForCamera()) { LOG_ERROR(Service_CAM, "Unable to start camera due to lack of authorization"); return; } diff --git a/src/citra_qt/configuration/configure_audio.cpp b/src/citra_qt/configuration/configure_audio.cpp index e9452923d..7e9dba159 100644 --- a/src/citra_qt/configuration/configure_audio.cpp +++ b/src/citra_qt/configuration/configure_audio.cpp @@ -16,7 +16,7 @@ #include "ui_configure_audio.h" #if defined(__APPLE__) -#include "citra_qt/usage_authorization.h" +#include "citra_qt/macos_authorization.h" #endif constexpr int DEFAULT_INPUT_DEVICE_INDEX = 0; diff --git a/src/citra_qt/configuration/configure_camera.cpp b/src/citra_qt/configuration/configure_camera.cpp index d84cac4f2..a89dc3151 100644 --- a/src/citra_qt/configuration/configure_camera.cpp +++ b/src/citra_qt/configuration/configure_camera.cpp @@ -18,7 +18,7 @@ #include "ui_configure_camera.h" #if defined(__APPLE__) -#include "citra_qt/usage_authorization.h" +#include "citra_qt/macos_authorization.h" #endif const std::array ConfigureCamera::Implementations = { diff --git a/src/citra_qt/usage_authorization.h b/src/citra_qt/macos_authorization.h similarity index 100% rename from src/citra_qt/usage_authorization.h rename to src/citra_qt/macos_authorization.h diff --git a/src/citra_qt/usage_authorization.mm b/src/citra_qt/macos_authorization.mm similarity index 94% rename from src/citra_qt/usage_authorization.mm rename to src/citra_qt/macos_authorization.mm index 5b4506f1e..165c35107 100644 --- a/src/citra_qt/usage_authorization.mm +++ b/src/citra_qt/macos_authorization.mm @@ -4,7 +4,7 @@ #import -#include "citra_qt/usage_authorization.h" +#include "citra_qt/macos_authorization.h" #include "common/logging/log.h" namespace AppleAuthorization { @@ -33,8 +33,8 @@ void CheckAuthorization(AuthMediaType type) { case AVAuthorizationStatusNotDetermined: { // The app hasn't yet asked the user for camera access. [AVCaptureDevice requestAccessForMediaType:media_type - completionHandler:^(BOOL) { - authorized = true; + completionHandler:^(BOOL granted) { + authorized = granted; }]; if (type == AuthMediaType::Camera) { LOG_INFO(Frontend, "Camera access requested.");