diff options
Diffstat (limited to 'src/core/frontend')
-rw-r--r-- | src/core/frontend/applets/mii_edit.cpp | 18 | ||||
-rw-r--r-- | src/core/frontend/applets/mii_edit.h | 23 | ||||
-rw-r--r-- | src/core/frontend/emu_window.h | 11 |
3 files changed, 51 insertions, 1 deletions
diff --git a/src/core/frontend/applets/mii_edit.cpp b/src/core/frontend/applets/mii_edit.cpp new file mode 100644 index 000000000..fadb5fb15 --- /dev/null +++ b/src/core/frontend/applets/mii_edit.cpp @@ -0,0 +1,18 @@ +// Copyright 2022 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/frontend/applets/mii_edit.h" + +namespace Core::Frontend { + +MiiEditApplet::~MiiEditApplet() = default; + +void DefaultMiiEditApplet::ShowMiiEdit(const std::function<void()>& callback) const { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + callback(); +} + +} // namespace Core::Frontend diff --git a/src/core/frontend/applets/mii_edit.h b/src/core/frontend/applets/mii_edit.h new file mode 100644 index 000000000..cca0e931d --- /dev/null +++ b/src/core/frontend/applets/mii_edit.h @@ -0,0 +1,23 @@ +// Copyright 2022 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <functional> + +namespace Core::Frontend { + +class MiiEditApplet { +public: + virtual ~MiiEditApplet(); + + virtual void ShowMiiEdit(const std::function<void()>& callback) const = 0; +}; + +class DefaultMiiEditApplet final : public MiiEditApplet { +public: + void ShowMiiEdit(const std::function<void()>& callback) const override; +}; + +} // namespace Core::Frontend diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h index e413a520a..b3bffecb2 100644 --- a/src/core/frontend/emu_window.h +++ b/src/core/frontend/emu_window.h @@ -42,11 +42,20 @@ public: context.MakeCurrent(); } ~Scoped() { - context.DoneCurrent(); + 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 |