diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/am/library_applet_creator.cpp | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/src/core/hle/service/am/library_applet_creator.cpp b/src/core/hle/service/am/library_applet_creator.cpp index ee646bea5..a883a021e 100644 --- a/src/core/hle/service/am/library_applet_creator.cpp +++ b/src/core/hle/service/am/library_applet_creator.cpp | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "common/settings.h" | ||
| 4 | #include "core/hle/kernel/k_transfer_memory.h" | 5 | #include "core/hle/kernel/k_transfer_memory.h" |
| 5 | #include "core/hle/service/am/applet_data_broker.h" | 6 | #include "core/hle/service/am/applet_data_broker.h" |
| 6 | #include "core/hle/service/am/applet_manager.h" | 7 | #include "core/hle/service/am/applet_manager.h" |
| @@ -16,6 +17,34 @@ namespace Service::AM { | |||
| 16 | 17 | ||
| 17 | namespace { | 18 | namespace { |
| 18 | 19 | ||
| 20 | bool ShouldCreateGuestApplet(AppletId applet_id) { | ||
| 21 | #define X(Name, name) \ | ||
| 22 | if (applet_id == AppletId::Name && \ | ||
| 23 | Settings::values.name##_applet_mode.GetValue() != Settings::AppletMode::LLE) { \ | ||
| 24 | return false; \ | ||
| 25 | } | ||
| 26 | |||
| 27 | X(Cabinet, cabinet) | ||
| 28 | X(Controller, controller) | ||
| 29 | X(DataErase, data_erase) | ||
| 30 | X(Error, error) | ||
| 31 | X(NetConnect, net_connect) | ||
| 32 | X(ProfileSelect, player_select) | ||
| 33 | X(SoftwareKeyboard, swkbd) | ||
| 34 | X(MiiEdit, mii_edit) | ||
| 35 | X(Web, web) | ||
| 36 | X(Shop, shop) | ||
| 37 | X(PhotoViewer, photo_viewer) | ||
| 38 | X(OfflineWeb, offline_web) | ||
| 39 | X(LoginShare, login_share) | ||
| 40 | X(WebAuth, wifi_web_auth) | ||
| 41 | X(MyPage, my_page) | ||
| 42 | |||
| 43 | #undef X | ||
| 44 | |||
| 45 | return true; | ||
| 46 | } | ||
| 47 | |||
| 19 | AppletProgramId AppletIdToProgramId(AppletId applet_id) { | 48 | AppletProgramId AppletIdToProgramId(AppletId applet_id) { |
| 20 | switch (applet_id) { | 49 | switch (applet_id) { |
| 21 | case AppletId::OverlayDisplay: | 50 | case AppletId::OverlayDisplay: |
| @@ -63,9 +92,10 @@ AppletProgramId AppletIdToProgramId(AppletId applet_id) { | |||
| 63 | } | 92 | } |
| 64 | } | 93 | } |
| 65 | 94 | ||
| 66 | [[maybe_unused]] std::shared_ptr<ILibraryAppletAccessor> CreateGuestApplet( | 95 | std::shared_ptr<ILibraryAppletAccessor> CreateGuestApplet(Core::System& system, |
| 67 | Core::System& system, std::shared_ptr<Applet> caller_applet, AppletId applet_id, | 96 | std::shared_ptr<Applet> caller_applet, |
| 68 | LibraryAppletMode mode) { | 97 | AppletId applet_id, |
| 98 | LibraryAppletMode mode) { | ||
| 69 | const auto program_id = static_cast<u64>(AppletIdToProgramId(applet_id)); | 99 | const auto program_id = static_cast<u64>(AppletIdToProgramId(applet_id)); |
| 70 | if (program_id == 0) { | 100 | if (program_id == 0) { |
| 71 | // Unknown applet | 101 | // Unknown applet |
| @@ -117,9 +147,10 @@ AppletProgramId AppletIdToProgramId(AppletId applet_id) { | |||
| 117 | return std::make_shared<ILibraryAppletAccessor>(system, broker, applet); | 147 | return std::make_shared<ILibraryAppletAccessor>(system, broker, applet); |
| 118 | } | 148 | } |
| 119 | 149 | ||
| 120 | [[maybe_unused]] std::shared_ptr<ILibraryAppletAccessor> CreateFrontendApplet( | 150 | std::shared_ptr<ILibraryAppletAccessor> CreateFrontendApplet(Core::System& system, |
| 121 | Core::System& system, std::shared_ptr<Applet> caller_applet, AppletId applet_id, | 151 | std::shared_ptr<Applet> caller_applet, |
| 122 | LibraryAppletMode mode) { | 152 | AppletId applet_id, |
| 153 | LibraryAppletMode mode) { | ||
| 123 | const auto program_id = static_cast<u64>(AppletIdToProgramId(applet_id)); | 154 | const auto program_id = static_cast<u64>(AppletIdToProgramId(applet_id)); |
| 124 | 155 | ||
| 125 | auto process = std::make_unique<Process>(system); | 156 | auto process = std::make_unique<Process>(system); |
| @@ -163,7 +194,13 @@ void ILibraryAppletCreator::CreateLibraryApplet(HLERequestContext& ctx) { | |||
| 163 | LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}", applet_id, | 194 | LOG_DEBUG(Service_AM, "called with applet_id={:08X}, applet_mode={:08X}", applet_id, |
| 164 | applet_mode); | 195 | applet_mode); |
| 165 | 196 | ||
| 166 | auto library_applet = CreateFrontendApplet(system, applet, applet_id, applet_mode); | 197 | std::shared_ptr<ILibraryAppletAccessor> library_applet; |
| 198 | if (ShouldCreateGuestApplet(applet_id)) { | ||
| 199 | library_applet = CreateGuestApplet(system, applet, applet_id, applet_mode); | ||
| 200 | } | ||
| 201 | if (!library_applet) { | ||
| 202 | library_applet = CreateFrontendApplet(system, applet, applet_id, applet_mode); | ||
| 203 | } | ||
| 167 | if (!library_applet) { | 204 | if (!library_applet) { |
| 168 | LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); | 205 | LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); |
| 169 | 206 | ||