diff options
| author | 2019-03-11 19:33:18 -0400 | |
|---|---|---|
| committer | 2019-04-17 11:35:24 -0400 | |
| commit | 6cea62b756fd32f54fca62a945e79f2ce44752bc (patch) | |
| tree | 00390481ab527e2aa34fa9f1323254d71e85fb4f /src | |
| parent | applets: Add AppletManager class to control lifetime (diff) | |
| download | yuzu-6cea62b756fd32f54fca62a945e79f2ce44752bc.tar.gz yuzu-6cea62b756fd32f54fca62a945e79f2ce44752bc.tar.xz yuzu-6cea62b756fd32f54fca62a945e79f2ce44752bc.zip | |
am: Delegate applet creation to AppletManager
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 1aa4ce1ac..26a665bfd 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include "core/hle/service/am/applets/applets.h" | 22 | #include "core/hle/service/am/applets/applets.h" |
| 23 | #include "core/hle/service/am/applets/profile_select.h" | 23 | #include "core/hle/service/am/applets/profile_select.h" |
| 24 | #include "core/hle/service/am/applets/software_keyboard.h" | 24 | #include "core/hle/service/am/applets/software_keyboard.h" |
| 25 | #include "core/hle/service/am/applets/stub_applet.h" | ||
| 26 | #include "core/hle/service/am/applets/web_browser.h" | 25 | #include "core/hle/service/am/applets/web_browser.h" |
| 27 | #include "core/hle/service/am/idle.h" | 26 | #include "core/hle/service/am/idle.h" |
| 28 | #include "core/hle/service/am/omm.h" | 27 | #include "core/hle/service/am/omm.h" |
| @@ -42,12 +41,6 @@ constexpr ResultCode ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 0x2}; | |||
| 42 | constexpr ResultCode ERR_NO_MESSAGES{ErrorModule::AM, 0x3}; | 41 | constexpr ResultCode ERR_NO_MESSAGES{ErrorModule::AM, 0x3}; |
| 43 | constexpr ResultCode ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 0x1F7}; | 42 | constexpr ResultCode ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 0x1F7}; |
| 44 | 43 | ||
| 45 | enum class AppletId : u32 { | ||
| 46 | ProfileSelect = 0x10, | ||
| 47 | SoftwareKeyboard = 0x11, | ||
| 48 | LibAppletOff = 0x17, | ||
| 49 | }; | ||
| 50 | |||
| 51 | constexpr u32 POP_LAUNCH_PARAMETER_MAGIC = 0xC79497CA; | 44 | constexpr u32 POP_LAUNCH_PARAMETER_MAGIC = 0xC79497CA; |
| 52 | 45 | ||
| 53 | struct LaunchParameters { | 46 | struct LaunchParameters { |
| @@ -886,30 +879,16 @@ ILibraryAppletCreator::ILibraryAppletCreator() : ServiceFramework("ILibraryApple | |||
| 886 | 879 | ||
| 887 | ILibraryAppletCreator::~ILibraryAppletCreator() = default; | 880 | ILibraryAppletCreator::~ILibraryAppletCreator() = default; |
| 888 | 881 | ||
| 889 | static std::shared_ptr<Applets::Applet> GetAppletFromId(AppletId id) { | ||
| 890 | switch (id) { | ||
| 891 | case AppletId::ProfileSelect: | ||
| 892 | return std::make_shared<Applets::ProfileSelect>(); | ||
| 893 | case AppletId::SoftwareKeyboard: | ||
| 894 | return std::make_shared<Applets::SoftwareKeyboard>(); | ||
| 895 | case AppletId::LibAppletOff: | ||
| 896 | return std::make_shared<Applets::WebBrowser>(); | ||
| 897 | default: | ||
| 898 | LOG_ERROR(Service_AM, "Unimplemented AppletId [{:08X}]! -- Falling back to stub!", | ||
| 899 | static_cast<u32>(id)); | ||
| 900 | return std::make_shared<Applets::StubApplet>(); | ||
| 901 | } | ||
| 902 | } | ||
| 903 | |||
| 904 | void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) { | 882 | void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) { |
| 905 | IPC::RequestParser rp{ctx}; | 883 | IPC::RequestParser rp{ctx}; |
| 906 | const auto applet_id = rp.PopRaw<AppletId>(); | 884 | const auto applet_id = rp.PopRaw<Applets::AppletId>(); |
| 907 | const auto applet_mode = rp.PopRaw<u32>(); | 885 | const auto applet_mode = rp.PopRaw<u32>(); |
| 908 | 886 | ||
| 909 | LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}", | 887 | LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}", |
| 910 | static_cast<u32>(applet_id), applet_mode); | 888 | static_cast<u32>(applet_id), applet_mode); |
| 911 | 889 | ||
| 912 | const auto applet = GetAppletFromId(applet_id); | 890 | const auto& applet_manager{Core::System::GetInstance().GetAppletManager()}; |
| 891 | const auto applet = applet_manager.GetApplet(applet_id); | ||
| 913 | 892 | ||
| 914 | if (applet == nullptr) { | 893 | if (applet == nullptr) { |
| 915 | LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", static_cast<u32>(applet_id)); | 894 | LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", static_cast<u32>(applet_id)); |