mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-27 09:04:22 +01:00
applets: Pass in the LibraryAppletMode each applet's constructor
This commit is contained in:
parent
0f40c8c634
commit
d1e40dd244
@ -1135,13 +1135,13 @@ ILibraryAppletCreator::~ILibraryAppletCreator() = default;
|
||||
void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto applet_id = rp.PopRaw<Applets::AppletId>();
|
||||
const auto applet_mode = rp.PopRaw<u32>();
|
||||
const auto applet_mode = rp.PopRaw<Applets::LibraryAppletMode>();
|
||||
|
||||
LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}", applet_id,
|
||||
applet_mode);
|
||||
|
||||
const auto& applet_manager{system.GetAppletManager()};
|
||||
const auto applet = applet_manager.GetApplet(applet_id);
|
||||
const auto applet = applet_manager.GetApplet(applet_id, applet_mode);
|
||||
|
||||
if (applet == nullptr) {
|
||||
LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id);
|
||||
|
@ -241,31 +241,31 @@ void AppletManager::ClearAll() {
|
||||
frontend = {};
|
||||
}
|
||||
|
||||
std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id) const {
|
||||
std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id, LibraryAppletMode mode) const {
|
||||
switch (id) {
|
||||
case AppletId::Auth:
|
||||
return std::make_shared<Auth>(system, *frontend.parental_controls);
|
||||
return std::make_shared<Auth>(system, mode, *frontend.parental_controls);
|
||||
case AppletId::Controller:
|
||||
return std::make_shared<Controller>(system, *frontend.controller);
|
||||
return std::make_shared<Controller>(system, mode, *frontend.controller);
|
||||
case AppletId::Error:
|
||||
return std::make_shared<Error>(system, *frontend.error);
|
||||
return std::make_shared<Error>(system, mode, *frontend.error);
|
||||
case AppletId::ProfileSelect:
|
||||
return std::make_shared<ProfileSelect>(system, *frontend.profile_select);
|
||||
return std::make_shared<ProfileSelect>(system, mode, *frontend.profile_select);
|
||||
case AppletId::SoftwareKeyboard:
|
||||
return std::make_shared<SoftwareKeyboard>(system, *frontend.software_keyboard);
|
||||
return std::make_shared<SoftwareKeyboard>(system, mode, *frontend.software_keyboard);
|
||||
case AppletId::Web:
|
||||
case AppletId::Shop:
|
||||
case AppletId::OfflineWeb:
|
||||
case AppletId::LoginShare:
|
||||
case AppletId::WebAuth:
|
||||
return std::make_shared<WebBrowser>(system, *frontend.web_browser);
|
||||
return std::make_shared<WebBrowser>(system, mode, *frontend.web_browser);
|
||||
case AppletId::PhotoViewer:
|
||||
return std::make_shared<PhotoViewer>(system, *frontend.photo_viewer);
|
||||
return std::make_shared<PhotoViewer>(system, mode, *frontend.photo_viewer);
|
||||
default:
|
||||
UNIMPLEMENTED_MSG(
|
||||
"No backend implementation exists for applet_id={:02X}! Falling back to stub applet.",
|
||||
static_cast<u8>(id));
|
||||
return std::make_shared<StubApplet>(system, id);
|
||||
return std::make_shared<StubApplet>(system, id, mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,14 @@ enum class AppletId : u32 {
|
||||
MyPage = 0x1A,
|
||||
};
|
||||
|
||||
enum class LibraryAppletMode : u32 {
|
||||
AllForeground = 0,
|
||||
Background = 1,
|
||||
NoUI = 2,
|
||||
BackgroundIndirectDisplay = 3,
|
||||
AllForegroundInitiallyHidden = 4,
|
||||
};
|
||||
|
||||
class AppletDataBroker final {
|
||||
public:
|
||||
explicit AppletDataBroker(Kernel::KernelCore& kernel_);
|
||||
@ -200,7 +208,7 @@ public:
|
||||
void SetDefaultAppletsIfMissing();
|
||||
void ClearAll();
|
||||
|
||||
std::shared_ptr<Applet> GetApplet(AppletId id) const;
|
||||
std::shared_ptr<Applet> GetApplet(AppletId id, LibraryAppletMode mode) const;
|
||||
|
||||
private:
|
||||
AppletFrontendSet frontend;
|
||||
|
@ -45,8 +45,9 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters(
|
||||
};
|
||||
}
|
||||
|
||||
Controller::Controller(Core::System& system_, const Core::Frontend::ControllerApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
|
||||
Controller::Controller(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::ControllerApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
|
||||
|
||||
Controller::~Controller() = default;
|
||||
|
||||
|
@ -106,7 +106,8 @@ static_assert(sizeof(ControllerSupportResultInfo) == 0xC,
|
||||
|
||||
class Controller final : public Applet {
|
||||
public:
|
||||
explicit Controller(Core::System& system_, const Core::Frontend::ControllerApplet& frontend_);
|
||||
explicit Controller(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::ControllerApplet& frontend_);
|
||||
~Controller() override;
|
||||
|
||||
void Initialize() override;
|
||||
@ -119,6 +120,7 @@ public:
|
||||
void ConfigurationComplete();
|
||||
|
||||
private:
|
||||
LibraryAppletMode applet_mode;
|
||||
const Core::Frontend::ControllerApplet& frontend;
|
||||
Core::System& system;
|
||||
|
||||
|
@ -86,8 +86,9 @@ ResultCode Decode64BitError(u64 error) {
|
||||
|
||||
} // Anonymous namespace
|
||||
|
||||
Error::Error(Core::System& system_, const Core::Frontend::ErrorApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
|
||||
Error::Error(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::ErrorApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
|
||||
|
||||
Error::~Error() = default;
|
||||
|
||||
|
@ -25,7 +25,8 @@ enum class ErrorAppletMode : u8 {
|
||||
|
||||
class Error final : public Applet {
|
||||
public:
|
||||
explicit Error(Core::System& system_, const Core::Frontend::ErrorApplet& frontend_);
|
||||
explicit Error(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::ErrorApplet& frontend_);
|
||||
~Error() override;
|
||||
|
||||
void Initialize() override;
|
||||
@ -40,6 +41,7 @@ public:
|
||||
private:
|
||||
union ErrorArguments;
|
||||
|
||||
LibraryAppletMode applet_mode;
|
||||
const Core::Frontend::ErrorApplet& frontend;
|
||||
ResultCode error_code = RESULT_SUCCESS;
|
||||
ErrorAppletMode mode = ErrorAppletMode::ShowError;
|
||||
|
@ -37,8 +37,9 @@ static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix)
|
||||
}
|
||||
}
|
||||
|
||||
Auth::Auth(Core::System& system_, Core::Frontend::ParentalControlsApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
|
||||
Auth::Auth(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
Core::Frontend::ParentalControlsApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
|
||||
|
||||
Auth::~Auth() = default;
|
||||
|
||||
@ -152,8 +153,9 @@ void Auth::AuthFinished(bool is_successful) {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
PhotoViewer::PhotoViewer(Core::System& system_, const Core::Frontend::PhotoViewerApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
|
||||
PhotoViewer::PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::PhotoViewerApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
|
||||
|
||||
PhotoViewer::~PhotoViewer() = default;
|
||||
|
||||
@ -202,8 +204,8 @@ void PhotoViewer::ViewFinished() {
|
||||
broker.SignalStateChanged();
|
||||
}
|
||||
|
||||
StubApplet::StubApplet(Core::System& system_, AppletId id_)
|
||||
: Applet{system_.Kernel()}, id{id_}, system{system_} {}
|
||||
StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_)
|
||||
: Applet{system_.Kernel()}, id{id_}, applet_mode{applet_mode_}, system{system_} {}
|
||||
|
||||
StubApplet::~StubApplet() = default;
|
||||
|
||||
|
@ -20,7 +20,8 @@ enum class AuthAppletType : u32 {
|
||||
|
||||
class Auth final : public Applet {
|
||||
public:
|
||||
explicit Auth(Core::System& system_, Core::Frontend::ParentalControlsApplet& frontend_);
|
||||
explicit Auth(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
Core::Frontend::ParentalControlsApplet& frontend_);
|
||||
~Auth() override;
|
||||
|
||||
void Initialize() override;
|
||||
@ -32,6 +33,7 @@ public:
|
||||
void AuthFinished(bool is_successful = true);
|
||||
|
||||
private:
|
||||
LibraryAppletMode applet_mode;
|
||||
Core::Frontend::ParentalControlsApplet& frontend;
|
||||
Core::System& system;
|
||||
bool complete = false;
|
||||
@ -50,7 +52,8 @@ enum class PhotoViewerAppletMode : u8 {
|
||||
|
||||
class PhotoViewer final : public Applet {
|
||||
public:
|
||||
explicit PhotoViewer(Core::System& system_, const Core::Frontend::PhotoViewerApplet& frontend_);
|
||||
explicit PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::PhotoViewerApplet& frontend_);
|
||||
~PhotoViewer() override;
|
||||
|
||||
void Initialize() override;
|
||||
@ -62,6 +65,7 @@ public:
|
||||
void ViewFinished();
|
||||
|
||||
private:
|
||||
LibraryAppletMode applet_mode;
|
||||
const Core::Frontend::PhotoViewerApplet& frontend;
|
||||
bool complete = false;
|
||||
PhotoViewerAppletMode mode = PhotoViewerAppletMode::CurrentApp;
|
||||
@ -70,7 +74,7 @@ private:
|
||||
|
||||
class StubApplet final : public Applet {
|
||||
public:
|
||||
explicit StubApplet(Core::System& system_, AppletId id_);
|
||||
explicit StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_);
|
||||
~StubApplet() override;
|
||||
|
||||
void Initialize() override;
|
||||
@ -82,6 +86,7 @@ public:
|
||||
|
||||
private:
|
||||
AppletId id;
|
||||
LibraryAppletMode applet_mode;
|
||||
Core::System& system;
|
||||
};
|
||||
|
||||
|
@ -15,9 +15,9 @@ namespace Service::AM::Applets {
|
||||
|
||||
constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1};
|
||||
|
||||
ProfileSelect::ProfileSelect(Core::System& system_,
|
||||
ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::ProfileSelectApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {}
|
||||
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend{frontend_}, system{system_} {}
|
||||
|
||||
ProfileSelect::~ProfileSelect() = default;
|
||||
|
||||
|
@ -33,7 +33,7 @@ static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has inco
|
||||
|
||||
class ProfileSelect final : public Applet {
|
||||
public:
|
||||
explicit ProfileSelect(Core::System& system_,
|
||||
explicit ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::ProfileSelectApplet& frontend_);
|
||||
~ProfileSelect() override;
|
||||
|
||||
@ -47,6 +47,7 @@ public:
|
||||
void SelectionComplete(std::optional<Common::UUID> uuid);
|
||||
|
||||
private:
|
||||
LibraryAppletMode applet_mode;
|
||||
const Core::Frontend::ProfileSelectApplet& frontend;
|
||||
|
||||
UserSelectionConfig config;
|
||||
|
@ -208,8 +208,9 @@ void ExtractSharedFonts(Core::System& system) {
|
||||
|
||||
} // namespace
|
||||
|
||||
WebBrowser::WebBrowser(Core::System& system_, const Core::Frontend::WebBrowserApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, frontend(frontend_), system{system_} {}
|
||||
WebBrowser::WebBrowser(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::WebBrowserApplet& frontend_)
|
||||
: Applet{system_.Kernel()}, applet_mode{applet_mode_}, frontend(frontend_), system{system_} {}
|
||||
|
||||
WebBrowser::~WebBrowser() = default;
|
||||
|
||||
|
@ -25,7 +25,8 @@ namespace Service::AM::Applets {
|
||||
|
||||
class WebBrowser final : public Applet {
|
||||
public:
|
||||
WebBrowser(Core::System& system_, const Core::Frontend::WebBrowserApplet& frontend_);
|
||||
WebBrowser(Core::System& system_, LibraryAppletMode applet_mode_,
|
||||
const Core::Frontend::WebBrowserApplet& frontend_);
|
||||
|
||||
~WebBrowser() override;
|
||||
|
||||
@ -63,6 +64,7 @@ private:
|
||||
void ExecuteWifi();
|
||||
void ExecuteLobby();
|
||||
|
||||
LibraryAppletMode applet_mode;
|
||||
const Core::Frontend::WebBrowserApplet& frontend;
|
||||
|
||||
bool complete{false};
|
||||
|
Loading…
Reference in New Issue
Block a user