aboutsummaryrefslogtreecommitdiff
path: root/src/core/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/frontend')
-rw-r--r--src/core/frontend/applets/applet.h14
-rw-r--r--src/core/frontend/applets/cabinet.cpp4
-rw-r--r--src/core/frontend/applets/cabinet.h14
-rw-r--r--src/core/frontend/applets/controller.cpp4
-rw-r--r--src/core/frontend/applets/controller.h6
-rw-r--r--src/core/frontend/applets/error.cpp2
-rw-r--r--src/core/frontend/applets/error.h4
-rw-r--r--src/core/frontend/applets/general_frontend.cpp4
-rw-r--r--src/core/frontend/applets/general_frontend.h8
-rw-r--r--src/core/frontend/applets/mii_edit.cpp2
-rw-r--r--src/core/frontend/applets/mii_edit.h5
-rw-r--r--src/core/frontend/applets/profile_select.cpp5
-rw-r--r--src/core/frontend/applets/profile_select.h19
-rw-r--r--src/core/frontend/applets/software_keyboard.cpp2
-rw-r--r--src/core/frontend/applets/software_keyboard.h5
-rw-r--r--src/core/frontend/applets/web_browser.cpp2
-rw-r--r--src/core/frontend/applets/web_browser.h5
-rw-r--r--src/core/frontend/emu_window.cpp2
-rw-r--r--src/core/frontend/emu_window.h50
-rw-r--r--src/core/frontend/graphics_context.h62
20 files changed, 151 insertions, 68 deletions
diff --git a/src/core/frontend/applets/applet.h b/src/core/frontend/applets/applet.h
new file mode 100644
index 000000000..77fffe306
--- /dev/null
+++ b/src/core/frontend/applets/applet.h
@@ -0,0 +1,14 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+namespace Core::Frontend {
+
+class Applet {
+public:
+ virtual ~Applet() = default;
+ virtual void Close() const = 0;
+};
+
+} // namespace Core::Frontend
diff --git a/src/core/frontend/applets/cabinet.cpp b/src/core/frontend/applets/cabinet.cpp
index 26c7fefe3..c33ce248b 100644
--- a/src/core/frontend/applets/cabinet.cpp
+++ b/src/core/frontend/applets/cabinet.cpp
@@ -10,9 +10,11 @@ namespace Core::Frontend {
CabinetApplet::~CabinetApplet() = default;
+void DefaultCabinetApplet::Close() const {}
+
void DefaultCabinetApplet::ShowCabinetApplet(
const CabinetCallback& callback, const CabinetParameters& parameters,
- std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const {
+ std::shared_ptr<Service::NFC::NfcDevice> nfp_device) const {
LOG_WARNING(Service_AM, "(STUBBED) called");
callback(false, {});
}
diff --git a/src/core/frontend/applets/cabinet.h b/src/core/frontend/applets/cabinet.h
index c28a235c1..af3fc6c3d 100644
--- a/src/core/frontend/applets/cabinet.h
+++ b/src/core/frontend/applets/cabinet.h
@@ -4,11 +4,12 @@
#pragma once
#include <functional>
+#include "core/frontend/applets/applet.h"
#include "core/hle/service/nfp/nfp_types.h"
-namespace Service::NFP {
-class NfpDevice;
-} // namespace Service::NFP
+namespace Service::NFC {
+class NfcDevice;
+} // namespace Service::NFC
namespace Core::Frontend {
@@ -20,18 +21,19 @@ struct CabinetParameters {
using CabinetCallback = std::function<void(bool, const std::string&)>;
-class CabinetApplet {
+class CabinetApplet : public Applet {
public:
virtual ~CabinetApplet();
virtual void ShowCabinetApplet(const CabinetCallback& callback,
const CabinetParameters& parameters,
- std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const = 0;
+ std::shared_ptr<Service::NFC::NfcDevice> nfp_device) const = 0;
};
class DefaultCabinetApplet final : public CabinetApplet {
public:
+ void Close() const override;
void ShowCabinetApplet(const CabinetCallback& callback, const CabinetParameters& parameters,
- std::shared_ptr<Service::NFP::NfpDevice> nfp_device) const override;
+ std::shared_ptr<Service::NFC::NfcDevice> nfp_device) const override;
};
} // namespace Core::Frontend
diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp
index 52919484e..3300d4f79 100644
--- a/src/core/frontend/applets/controller.cpp
+++ b/src/core/frontend/applets/controller.cpp
@@ -16,6 +16,8 @@ DefaultControllerApplet::DefaultControllerApplet(HID::HIDCore& hid_core_) : hid_
DefaultControllerApplet::~DefaultControllerApplet() = default;
+void DefaultControllerApplet::Close() const {}
+
void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callback,
const ControllerParameters& parameters) const {
LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!");
@@ -69,7 +71,7 @@ void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callbac
}
}
- callback();
+ callback(true);
}
} // namespace Core::Frontend
diff --git a/src/core/frontend/applets/controller.h b/src/core/frontend/applets/controller.h
index adb2feefd..19a2db6bf 100644
--- a/src/core/frontend/applets/controller.h
+++ b/src/core/frontend/applets/controller.h
@@ -7,6 +7,7 @@
#include <vector>
#include "common/common_types.h"
+#include "core/frontend/applets/applet.h"
namespace Core::HID {
class HIDCore;
@@ -34,9 +35,9 @@ struct ControllerParameters {
bool allow_gamecube_controller{};
};
-class ControllerApplet {
+class ControllerApplet : public Applet {
public:
- using ReconfigureCallback = std::function<void()>;
+ using ReconfigureCallback = std::function<void(bool)>;
virtual ~ControllerApplet();
@@ -49,6 +50,7 @@ public:
explicit DefaultControllerApplet(HID::HIDCore& hid_core_);
~DefaultControllerApplet() override;
+ void Close() const override;
void ReconfigureControllers(ReconfigureCallback callback,
const ControllerParameters& parameters) const override;
diff --git a/src/core/frontend/applets/error.cpp b/src/core/frontend/applets/error.cpp
index 69c2b2b4d..2e6f7a3d9 100644
--- a/src/core/frontend/applets/error.cpp
+++ b/src/core/frontend/applets/error.cpp
@@ -8,6 +8,8 @@ namespace Core::Frontend {
ErrorApplet::~ErrorApplet() = default;
+void DefaultErrorApplet::Close() 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);
diff --git a/src/core/frontend/applets/error.h b/src/core/frontend/applets/error.h
index 884f2f653..3a12196ce 100644
--- a/src/core/frontend/applets/error.h
+++ b/src/core/frontend/applets/error.h
@@ -6,11 +6,12 @@
#include <chrono>
#include <functional>
+#include "core/frontend/applets/applet.h"
#include "core/hle/result.h"
namespace Core::Frontend {
-class ErrorApplet {
+class ErrorApplet : public Applet {
public:
using FinishedCallback = std::function<void()>;
@@ -28,6 +29,7 @@ public:
class DefaultErrorApplet final : public ErrorApplet {
public:
+ void Close() const override;
void ShowError(Result error, FinishedCallback finished) const override;
void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
FinishedCallback finished) const override;
diff --git a/src/core/frontend/applets/general_frontend.cpp b/src/core/frontend/applets/general_frontend.cpp
index 29a00fb6f..b4b213a31 100644
--- a/src/core/frontend/applets/general_frontend.cpp
+++ b/src/core/frontend/applets/general_frontend.cpp
@@ -10,6 +10,8 @@ ParentalControlsApplet::~ParentalControlsApplet() = default;
DefaultParentalControlsApplet::~DefaultParentalControlsApplet() = default;
+void DefaultParentalControlsApplet::Close() const {}
+
void DefaultParentalControlsApplet::VerifyPIN(std::function<void(bool)> finished,
bool suspend_future_verification_temporarily) {
LOG_INFO(Service_AM,
@@ -39,6 +41,8 @@ PhotoViewerApplet::~PhotoViewerApplet() = default;
DefaultPhotoViewerApplet::~DefaultPhotoViewerApplet() = default;
+void DefaultPhotoViewerApplet::Close() const {}
+
void DefaultPhotoViewerApplet::ShowPhotosForApplication(u64 title_id,
std::function<void()> finished) const {
LOG_INFO(Service_AM,
diff --git a/src/core/frontend/applets/general_frontend.h b/src/core/frontend/applets/general_frontend.h
index cbec8b4ad..319838ac7 100644
--- a/src/core/frontend/applets/general_frontend.h
+++ b/src/core/frontend/applets/general_frontend.h
@@ -6,9 +6,11 @@
#include <functional>
#include "common/common_types.h"
+#include "core/frontend/applets/applet.h"
+
namespace Core::Frontend {
-class ParentalControlsApplet {
+class ParentalControlsApplet : public Applet {
public:
virtual ~ParentalControlsApplet();
@@ -33,6 +35,7 @@ class DefaultParentalControlsApplet final : public ParentalControlsApplet {
public:
~DefaultParentalControlsApplet() override;
+ void Close() const override;
void VerifyPIN(std::function<void(bool)> finished,
bool suspend_future_verification_temporarily) override;
void VerifyPINForSettings(std::function<void(bool)> finished) override;
@@ -40,7 +43,7 @@ public:
void ChangePIN(std::function<void()> finished) override;
};
-class PhotoViewerApplet {
+class PhotoViewerApplet : public Applet {
public:
virtual ~PhotoViewerApplet();
@@ -52,6 +55,7 @@ class DefaultPhotoViewerApplet final : public PhotoViewerApplet {
public:
~DefaultPhotoViewerApplet() override;
+ void Close() const override;
void ShowPhotosForApplication(u64 title_id, std::function<void()> finished) const override;
void ShowAllPhotos(std::function<void()> finished) const override;
};
diff --git a/src/core/frontend/applets/mii_edit.cpp b/src/core/frontend/applets/mii_edit.cpp
index bc8c57067..2988c3e72 100644
--- a/src/core/frontend/applets/mii_edit.cpp
+++ b/src/core/frontend/applets/mii_edit.cpp
@@ -8,6 +8,8 @@ namespace Core::Frontend {
MiiEditApplet::~MiiEditApplet() = default;
+void DefaultMiiEditApplet::Close() const {}
+
void DefaultMiiEditApplet::ShowMiiEdit(const MiiEditCallback& callback) const {
LOG_WARNING(Service_AM, "(STUBBED) called");
diff --git a/src/core/frontend/applets/mii_edit.h b/src/core/frontend/applets/mii_edit.h
index d828f06ec..9d86ee658 100644
--- a/src/core/frontend/applets/mii_edit.h
+++ b/src/core/frontend/applets/mii_edit.h
@@ -5,9 +5,11 @@
#include <functional>
+#include "core/frontend/applets/applet.h"
+
namespace Core::Frontend {
-class MiiEditApplet {
+class MiiEditApplet : public Applet {
public:
using MiiEditCallback = std::function<void()>;
@@ -18,6 +20,7 @@ public:
class DefaultMiiEditApplet final : public MiiEditApplet {
public:
+ void Close() const override;
void ShowMiiEdit(const MiiEditCallback& callback) const override;
};
diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp
index da4cfbf87..c18f17a36 100644
--- a/src/core/frontend/applets/profile_select.cpp
+++ b/src/core/frontend/applets/profile_select.cpp
@@ -9,7 +9,10 @@ namespace Core::Frontend {
ProfileSelectApplet::~ProfileSelectApplet() = default;
-void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const {
+void DefaultProfileSelectApplet::Close() const {}
+
+void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback,
+ const ProfileSelectParameters& parameters) 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 138429533..92e2737ea 100644
--- a/src/core/frontend/applets/profile_select.h
+++ b/src/core/frontend/applets/profile_select.h
@@ -5,22 +5,35 @@
#include <functional>
#include <optional>
+
#include "common/uuid.h"
+#include "core/frontend/applets/applet.h"
+#include "core/hle/service/am/applets/applet_profile_select.h"
namespace Core::Frontend {
-class ProfileSelectApplet {
+struct ProfileSelectParameters {
+ Service::AM::Applets::UiMode mode;
+ std::array<Common::UUID, 8> invalid_uid_list;
+ Service::AM::Applets::UiSettingsDisplayOptions display_options;
+ Service::AM::Applets::UserSelectionPurpose purpose;
+};
+
+class ProfileSelectApplet : public Applet {
public:
using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>;
virtual ~ProfileSelectApplet();
- virtual void SelectProfile(SelectProfileCallback callback) const = 0;
+ virtual void SelectProfile(SelectProfileCallback callback,
+ const ProfileSelectParameters& parameters) const = 0;
};
class DefaultProfileSelectApplet final : public ProfileSelectApplet {
public:
- void SelectProfile(SelectProfileCallback callback) const override;
+ void Close() const override;
+ void SelectProfile(SelectProfileCallback callback,
+ const ProfileSelectParameters& parameters) const override;
};
} // namespace Core::Frontend
diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp
index a3720f4d7..7655d215b 100644
--- a/src/core/frontend/applets/software_keyboard.cpp
+++ b/src/core/frontend/applets/software_keyboard.cpp
@@ -13,6 +13,8 @@ SoftwareKeyboardApplet::~SoftwareKeyboardApplet() = default;
DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default;
+void DefaultSoftwareKeyboardApplet::Close() const {}
+
void DefaultSoftwareKeyboardApplet::InitializeKeyboard(
bool is_inline, KeyboardInitializeParameters initialize_parameters,
SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) {
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h
index 8aef103d3..8ed96da24 100644
--- a/src/core/frontend/applets/software_keyboard.h
+++ b/src/core/frontend/applets/software_keyboard.h
@@ -7,6 +7,7 @@
#include "common/common_types.h"
+#include "core/frontend/applets/applet.h"
#include "core/hle/service/am/applets/applet_software_keyboard_types.h"
namespace Core::Frontend {
@@ -52,7 +53,7 @@ struct InlineTextParameters {
s32 cursor_position;
};
-class SoftwareKeyboardApplet {
+class SoftwareKeyboardApplet : public Applet {
public:
using SubmitInlineCallback =
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>;
@@ -84,6 +85,8 @@ class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
public:
~DefaultSoftwareKeyboardApplet() override;
+ void Close() const override;
+
void InitializeKeyboard(bool is_inline, KeyboardInitializeParameters initialize_parameters,
SubmitNormalCallback submit_normal_callback_,
SubmitInlineCallback submit_inline_callback_) override;
diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp
index b09cb7102..6e703ef06 100644
--- a/src/core/frontend/applets/web_browser.cpp
+++ b/src/core/frontend/applets/web_browser.cpp
@@ -10,6 +10,8 @@ WebBrowserApplet::~WebBrowserApplet() = default;
DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default;
+void DefaultWebBrowserApplet::Close() const {}
+
void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url,
ExtractROMFSCallback extract_romfs_callback,
OpenWebPageCallback callback) const {
diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h
index 4f72284ad..178bbdd3f 100644
--- a/src/core/frontend/applets/web_browser.h
+++ b/src/core/frontend/applets/web_browser.h
@@ -5,11 +5,12 @@
#include <functional>
+#include "core/frontend/applets/applet.h"
#include "core/hle/service/am/applets/applet_web_browser_types.h"
namespace Core::Frontend {
-class WebBrowserApplet {
+class WebBrowserApplet : public Applet {
public:
using ExtractROMFSCallback = std::function<void()>;
using OpenWebPageCallback =
@@ -29,6 +30,8 @@ class DefaultWebBrowserApplet final : public WebBrowserApplet {
public:
~DefaultWebBrowserApplet() override;
+ void Close() const override;
+
void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback,
OpenWebPageCallback callback) const override;
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 1be2dccb0..d1f1ca8c9 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -6,8 +6,6 @@
namespace Core::Frontend {
-GraphicsContext::~GraphicsContext() = default;
-
EmuWindow::EmuWindow() {
// TODO: Find a better place to set this.
config.min_client_area_size =
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index cf85ba29e..a72df034e 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -5,11 +5,14 @@
#include <memory>
#include <utility>
+
#include "common/common_types.h"
#include "core/frontend/framebuffer_layout.h"
namespace Core::Frontend {
+class GraphicsContext;
+
/// Information for the Graphics Backends signifying what type of screen pointer is in
/// WindowInformation
enum class WindowSystemType {
@@ -22,51 +25,6 @@ enum class WindowSystemType {
};
/**
- * Represents a drawing context that supports graphics operations.
- */
-class GraphicsContext {
-public:
- virtual ~GraphicsContext();
-
- /// Inform the driver to swap the front/back buffers and present the current image
- virtual void SwapBuffers() {}
-
- /// Makes the graphics context current for the caller thread
- virtual void MakeCurrent() {}
-
- /// Releases (dunno if this is the "right" word) the context from the caller thread
- virtual void DoneCurrent() {}
-
- class Scoped {
- public:
- [[nodiscard]] explicit Scoped(GraphicsContext& context_) : context(context_) {
- context.MakeCurrent();
- }
- ~Scoped() {
- if (active) {
- context.DoneCurrent();
- }
- }
-
- /// In the event that context was destroyed before the Scoped is destroyed, this provides a
- /// mechanism to prevent calling a destroyed object's method during the deconstructor
- void Cancel() {
- active = false;
- }
-
- private:
- GraphicsContext& context;
- bool active{true};
- };
-
- /// Calls MakeCurrent on the context and calls DoneCurrent when the scope for the returned value
- /// ends
- [[nodiscard]] Scoped Acquire() {
- return Scoped{*this};
- }
-};
-
-/**
* Abstraction class used to provide an interface between emulation code and the frontend
* (e.g. SDL, QGLWidget, GLFW, etc...).
*
@@ -205,7 +163,7 @@ protected:
}
/**
- * Converts a screen postion into the equivalent touchscreen position.
+ * Converts a screen position into the equivalent touchscreen position.
*/
std::pair<f32, f32> MapToTouchScreen(u32 framebuffer_x, u32 framebuffer_y) const;
diff --git a/src/core/frontend/graphics_context.h b/src/core/frontend/graphics_context.h
new file mode 100644
index 000000000..7554c1583
--- /dev/null
+++ b/src/core/frontend/graphics_context.h
@@ -0,0 +1,62 @@
+// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <memory>
+
+#include "common/dynamic_library.h"
+
+namespace Core::Frontend {
+
+/**
+ * Represents a drawing context that supports graphics operations.
+ */
+class GraphicsContext {
+public:
+ virtual ~GraphicsContext() = default;
+
+ /// Inform the driver to swap the front/back buffers and present the current image
+ virtual void SwapBuffers() {}
+
+ /// Makes the graphics context current for the caller thread
+ virtual void MakeCurrent() {}
+
+ /// Releases (dunno if this is the "right" word) the context from the caller thread
+ virtual void DoneCurrent() {}
+
+ /// Gets the GPU driver library (used by Android only)
+ virtual std::shared_ptr<Common::DynamicLibrary> GetDriverLibrary() {
+ return {};
+ }
+
+ class Scoped {
+ public:
+ [[nodiscard]] explicit Scoped(GraphicsContext& context_) : context(context_) {
+ context.MakeCurrent();
+ }
+ ~Scoped() {
+ if (active) {
+ context.DoneCurrent();
+ }
+ }
+
+ /// In the event that context was destroyed before the Scoped is destroyed, this provides a
+ /// mechanism to prevent calling a destroyed object's method during the deconstructor
+ void Cancel() {
+ active = false;
+ }
+
+ private:
+ GraphicsContext& context;
+ bool active{true};
+ };
+
+ /// Calls MakeCurrent on the context and calls DoneCurrent when the scope for the returned value
+ /// ends
+ [[nodiscard]] Scoped Acquire() {
+ return Scoped{*this};
+ }
+};
+
+} // namespace Core::Frontend