diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2022-12-06 17:26:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 17:26:53 +0100 |
commit | d8534ea140a0e07fa010fe58fae068ed926c1dbc (patch) | |
tree | 176afc9e7d481b7b48f5a61a21b5184bf33cef62 /src/core | |
parent | Merge pull request #9389 from lioncash/emumove (diff) | |
parent | applets/controller: Use aliases for callbacks (diff) | |
download | yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.gz yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.bz2 yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.lz yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.xz yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.zst yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/frontend/applets/controller.cpp | 2 | ||||
-rw-r--r-- | src/core/frontend/applets/controller.h | 6 | ||||
-rw-r--r-- | src/core/frontend/applets/error.cpp | 6 | ||||
-rw-r--r-- | src/core/frontend/applets/error.h | 14 | ||||
-rw-r--r-- | src/core/frontend/applets/mii_edit.cpp | 2 | ||||
-rw-r--r-- | src/core/frontend/applets/mii_edit.h | 6 | ||||
-rw-r--r-- | src/core/frontend/applets/profile_select.cpp | 3 | ||||
-rw-r--r-- | src/core/frontend/applets/profile_select.h | 6 | ||||
-rw-r--r-- | src/core/frontend/applets/software_keyboard.cpp | 5 | ||||
-rw-r--r-- | src/core/frontend/applets/software_keyboard.h | 32 | ||||
-rw-r--r-- | src/core/frontend/applets/web_browser.cpp | 11 | ||||
-rw-r--r-- | src/core/frontend/applets/web_browser.h | 24 |
12 files changed, 59 insertions, 58 deletions
diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp index 6c230f619..52919484e 100644 --- a/src/core/frontend/applets/controller.cpp +++ b/src/core/frontend/applets/controller.cpp @@ -16,7 +16,7 @@ DefaultControllerApplet::DefaultControllerApplet(HID::HIDCore& hid_core_) : hid_ DefaultControllerApplet::~DefaultControllerApplet() = default; -void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callback, +void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callback, const ControllerParameters& parameters) const { LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!"); diff --git a/src/core/frontend/applets/controller.h b/src/core/frontend/applets/controller.h index 71698df74..adb2feefd 100644 --- a/src/core/frontend/applets/controller.h +++ b/src/core/frontend/applets/controller.h @@ -36,9 +36,11 @@ struct ControllerParameters { class ControllerApplet { public: + using ReconfigureCallback = std::function<void()>; + virtual ~ControllerApplet(); - virtual void ReconfigureControllers(std::function<void()> callback, + virtual void ReconfigureControllers(ReconfigureCallback callback, const ControllerParameters& parameters) const = 0; }; @@ -47,7 +49,7 @@ public: explicit DefaultControllerApplet(HID::HIDCore& hid_core_); ~DefaultControllerApplet() override; - void ReconfigureControllers(std::function<void()> callback, + void ReconfigureControllers(ReconfigureCallback callback, const ControllerParameters& parameters) const override; private: diff --git a/src/core/frontend/applets/error.cpp b/src/core/frontend/applets/error.cpp index f8b961098..69c2b2b4d 100644 --- a/src/core/frontend/applets/error.cpp +++ b/src/core/frontend/applets/error.cpp @@ -8,13 +8,13 @@ namespace Core::Frontend { ErrorApplet::~ErrorApplet() = default; -void DefaultErrorApplet::ShowError(Result error, std::function<void()> finished) const { +void DefaultErrorApplet::ShowError(Result error, FinishedCallback finished) const { LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", error.module.Value(), error.description.Value(), error.raw); } void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::seconds time, - std::function<void()> finished) const { + FinishedCallback finished) const { LOG_CRITICAL( Service_Fatal, "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", @@ -23,7 +23,7 @@ void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::secon void DefaultErrorApplet::ShowCustomErrorText(Result error, std::string main_text, std::string detail_text, - std::function<void()> finished) const { + FinishedCallback finished) const { LOG_CRITICAL(Service_Fatal, "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", error.module.Value(), error.description.Value(), error.raw); diff --git a/src/core/frontend/applets/error.h b/src/core/frontend/applets/error.h index f378f8805..884f2f653 100644 --- a/src/core/frontend/applets/error.h +++ b/src/core/frontend/applets/error.h @@ -12,25 +12,27 @@ namespace Core::Frontend { class ErrorApplet { public: + using FinishedCallback = std::function<void()>; + virtual ~ErrorApplet(); - virtual void ShowError(Result error, std::function<void()> finished) const = 0; + virtual void ShowError(Result error, FinishedCallback finished) const = 0; virtual void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, - std::function<void()> finished) const = 0; + FinishedCallback finished) const = 0; virtual void ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text, - std::function<void()> finished) const = 0; + FinishedCallback finished) const = 0; }; class DefaultErrorApplet final : public ErrorApplet { public: - void ShowError(Result error, std::function<void()> finished) const override; + void ShowError(Result error, FinishedCallback finished) const override; void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, - std::function<void()> finished) const override; + FinishedCallback finished) const override; void ShowCustomErrorText(Result error, std::string main_text, std::string detail_text, - std::function<void()> finished) const override; + FinishedCallback finished) const override; }; } // namespace Core::Frontend diff --git a/src/core/frontend/applets/mii_edit.cpp b/src/core/frontend/applets/mii_edit.cpp index d37b5368a..bc8c57067 100644 --- a/src/core/frontend/applets/mii_edit.cpp +++ b/src/core/frontend/applets/mii_edit.cpp @@ -8,7 +8,7 @@ namespace Core::Frontend { MiiEditApplet::~MiiEditApplet() = default; -void DefaultMiiEditApplet::ShowMiiEdit(const std::function<void()>& callback) const { +void DefaultMiiEditApplet::ShowMiiEdit(const MiiEditCallback& callback) const { LOG_WARNING(Service_AM, "(STUBBED) called"); callback(); diff --git a/src/core/frontend/applets/mii_edit.h b/src/core/frontend/applets/mii_edit.h index 58fa2039b..d828f06ec 100644 --- a/src/core/frontend/applets/mii_edit.h +++ b/src/core/frontend/applets/mii_edit.h @@ -9,14 +9,16 @@ namespace Core::Frontend { class MiiEditApplet { public: + using MiiEditCallback = std::function<void()>; + virtual ~MiiEditApplet(); - virtual void ShowMiiEdit(const std::function<void()>& callback) const = 0; + virtual void ShowMiiEdit(const MiiEditCallback& callback) const = 0; }; class DefaultMiiEditApplet final : public MiiEditApplet { public: - void ShowMiiEdit(const std::function<void()>& callback) const override; + void ShowMiiEdit(const MiiEditCallback& callback) const override; }; } // namespace Core::Frontend diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index d11fbce0a..da4cfbf87 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp @@ -9,8 +9,7 @@ namespace Core::Frontend { ProfileSelectApplet::~ProfileSelectApplet() = default; -void DefaultProfileSelectApplet::SelectProfile( - std::function<void(std::optional<Common::UUID>)> callback) const { +void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const { Service::Account::ProfileManager manager; callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); diff --git a/src/core/frontend/applets/profile_select.h b/src/core/frontend/applets/profile_select.h index 8d6ee5279..138429533 100644 --- a/src/core/frontend/applets/profile_select.h +++ b/src/core/frontend/applets/profile_select.h @@ -11,14 +11,16 @@ namespace Core::Frontend { class ProfileSelectApplet { public: + using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>; + virtual ~ProfileSelectApplet(); - virtual void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const = 0; + virtual void SelectProfile(SelectProfileCallback callback) const = 0; }; class DefaultProfileSelectApplet final : public ProfileSelectApplet { public: - void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const override; + void SelectProfile(SelectProfileCallback callback) const override; }; } // namespace Core::Frontend diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp index 020c7fa5e..a3720f4d7 100644 --- a/src/core/frontend/applets/software_keyboard.cpp +++ b/src/core/frontend/applets/software_keyboard.cpp @@ -15,10 +15,7 @@ DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default; void DefaultSoftwareKeyboardApplet::InitializeKeyboard( bool is_inline, KeyboardInitializeParameters initialize_parameters, - std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback_, - std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback_) { + SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) { if (is_inline) { LOG_WARNING( Service_AM, diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h index 094d1e713..8aef103d3 100644 --- a/src/core/frontend/applets/software_keyboard.h +++ b/src/core/frontend/applets/software_keyboard.h @@ -54,14 +54,17 @@ struct InlineTextParameters { class SoftwareKeyboardApplet { public: + using SubmitInlineCallback = + std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>; + using SubmitNormalCallback = + std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>; + virtual ~SoftwareKeyboardApplet(); - virtual void InitializeKeyboard( - bool is_inline, KeyboardInitializeParameters initialize_parameters, - std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback_, - std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback_) = 0; + virtual void InitializeKeyboard(bool is_inline, + KeyboardInitializeParameters initialize_parameters, + SubmitNormalCallback submit_normal_callback_, + SubmitInlineCallback submit_inline_callback_) = 0; virtual void ShowNormalKeyboard() const = 0; @@ -81,12 +84,9 @@ class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet { public: ~DefaultSoftwareKeyboardApplet() override; - void InitializeKeyboard( - bool is_inline, KeyboardInitializeParameters initialize_parameters, - std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback_, - std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback_) override; + void InitializeKeyboard(bool is_inline, KeyboardInitializeParameters initialize_parameters, + SubmitNormalCallback submit_normal_callback_, + SubmitInlineCallback submit_inline_callback_) override; void ShowNormalKeyboard() const override; @@ -105,12 +105,10 @@ private: void SubmitNormalText(std::u16string text) const; void SubmitInlineText(std::u16string_view text) const; - KeyboardInitializeParameters parameters; + KeyboardInitializeParameters parameters{}; - mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback; - mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback; + mutable SubmitNormalCallback submit_normal_callback; + mutable SubmitInlineCallback submit_inline_callback; }; } // namespace Core::Frontend diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 27c7086be..b09cb7102 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp @@ -10,18 +10,17 @@ WebBrowserApplet::~WebBrowserApplet() = default; DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; -void DefaultWebBrowserApplet::OpenLocalWebPage( - const std::string& local_url, std::function<void()> extract_romfs_callback, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { +void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url, + ExtractROMFSCallback extract_romfs_callback, + OpenWebPageCallback callback) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", local_url); callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); } -void DefaultWebBrowserApplet::OpenExternalWebPage( - const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { +void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_url, + OpenWebPageCallback callback) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", external_url); diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 1411274f8..4f72284ad 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h @@ -11,29 +11,29 @@ namespace Core::Frontend { class WebBrowserApplet { public: + using ExtractROMFSCallback = std::function<void()>; + using OpenWebPageCallback = + std::function<void(Service::AM::Applets::WebExitReason, std::string)>; + virtual ~WebBrowserApplet(); - virtual void OpenLocalWebPage( - const std::string& local_url, std::function<void()> extract_romfs_callback, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; + virtual void OpenLocalWebPage(const std::string& local_url, + ExtractROMFSCallback extract_romfs_callback, + OpenWebPageCallback callback) const = 0; - virtual void OpenExternalWebPage( - const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; + virtual void OpenExternalWebPage(const std::string& external_url, + OpenWebPageCallback callback) const = 0; }; class DefaultWebBrowserApplet final : public WebBrowserApplet { public: ~DefaultWebBrowserApplet() override; - void OpenLocalWebPage(const std::string& local_url, - std::function<void()> extract_romfs_callback, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback) const override; + void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback, + OpenWebPageCallback callback) const override; void OpenExternalWebPage(const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback) const override; + OpenWebPageCallback callback) const override; }; } // namespace Core::Frontend |