diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 47 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applet_cabinet.h | 11 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applet_general_backend.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applets.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applets.h | 49 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 7 |
7 files changed, 120 insertions, 17 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index e9bd04842..2f6503427 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 9 | #include "common/settings_enums.h" | 9 | #include "common/settings_enums.h" |
| 10 | #include "core/core.h" | 10 | #include "core/core.h" |
| 11 | #include "core/core_timing.h" | ||
| 11 | #include "core/file_sys/control_metadata.h" | 12 | #include "core/file_sys/control_metadata.h" |
| 12 | #include "core/file_sys/patch_manager.h" | 13 | #include "core/file_sys/patch_manager.h" |
| 13 | #include "core/file_sys/registered_cache.h" | 14 | #include "core/file_sys/registered_cache.h" |
| @@ -19,6 +20,7 @@ | |||
| 19 | #include "core/hle/service/am/am.h" | 20 | #include "core/hle/service/am/am.h" |
| 20 | #include "core/hle/service/am/applet_ae.h" | 21 | #include "core/hle/service/am/applet_ae.h" |
| 21 | #include "core/hle/service/am/applet_oe.h" | 22 | #include "core/hle/service/am/applet_oe.h" |
| 23 | #include "core/hle/service/am/applets/applet_cabinet.h" | ||
| 22 | #include "core/hle/service/am/applets/applet_mii_edit_types.h" | 24 | #include "core/hle/service/am/applets/applet_mii_edit_types.h" |
| 23 | #include "core/hle/service/am/applets/applet_profile_select.h" | 25 | #include "core/hle/service/am/applets/applet_profile_select.h" |
| 24 | #include "core/hle/service/am/applets/applet_web_browser.h" | 26 | #include "core/hle/service/am/applets/applet_web_browser.h" |
| @@ -1385,7 +1387,16 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) | |||
| 1385 | // clang-format on | 1387 | // clang-format on |
| 1386 | RegisterHandlers(functions); | 1388 | RegisterHandlers(functions); |
| 1387 | 1389 | ||
| 1388 | PushInShowMiiEditData(); | 1390 | switch (system.GetAppletManager().GetCurrentAppletId()) { |
| 1391 | case Applets::AppletId::Cabinet: | ||
| 1392 | PushInShowCabinetData(); | ||
| 1393 | break; | ||
| 1394 | case Applets::AppletId::MiiEdit: | ||
| 1395 | PushInShowMiiEditData(); | ||
| 1396 | break; | ||
| 1397 | default: | ||
| 1398 | break; | ||
| 1399 | } | ||
| 1389 | } | 1400 | } |
| 1390 | 1401 | ||
| 1391 | ILibraryAppletSelfAccessor::~ILibraryAppletSelfAccessor() = default; | 1402 | ILibraryAppletSelfAccessor::~ILibraryAppletSelfAccessor() = default; |
| @@ -1431,7 +1442,7 @@ void ILibraryAppletSelfAccessor::GetLibraryAppletInfo(HLERequestContext& ctx) { | |||
| 1431 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 1442 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 1432 | 1443 | ||
| 1433 | const LibraryAppletInfo applet_info{ | 1444 | const LibraryAppletInfo applet_info{ |
| 1434 | .applet_id = Applets::AppletId::MiiEdit, | 1445 | .applet_id = system.GetAppletManager().GetCurrentAppletId(), |
| 1435 | .library_applet_mode = Applets::LibraryAppletMode::AllForeground, | 1446 | .library_applet_mode = Applets::LibraryAppletMode::AllForeground, |
| 1436 | }; | 1447 | }; |
| 1437 | 1448 | ||
| @@ -1459,6 +1470,35 @@ void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& | |||
| 1459 | rb.PushRaw(applet_info); | 1470 | rb.PushRaw(applet_info); |
| 1460 | } | 1471 | } |
| 1461 | 1472 | ||
| 1473 | void ILibraryAppletSelfAccessor::PushInShowCabinetData() { | ||
| 1474 | const Applets::CommonArguments arguments{ | ||
| 1475 | .arguments_version = Applets::CommonArgumentVersion::Version3, | ||
| 1476 | .size = Applets::CommonArgumentSize::Version3, | ||
| 1477 | .library_version = static_cast<u32>(Applets::CabinetAppletVersion::Version1), | ||
| 1478 | .theme_color = Applets::ThemeColor::BasicBlack, | ||
| 1479 | .play_startup_sound = true, | ||
| 1480 | .system_tick = system.CoreTiming().GetClockTicks(), | ||
| 1481 | }; | ||
| 1482 | |||
| 1483 | const Applets::StartParamForAmiiboSettings amiibo_settings{ | ||
| 1484 | .param_1 = 0, | ||
| 1485 | .applet_mode = system.GetAppletManager().GetCabinetMode(), | ||
| 1486 | .flags = Applets::CabinetFlags::None, | ||
| 1487 | .amiibo_settings_1 = 0, | ||
| 1488 | .device_handle = 0, | ||
| 1489 | .tag_info{}, | ||
| 1490 | .register_info{}, | ||
| 1491 | .amiibo_settings_3{}, | ||
| 1492 | }; | ||
| 1493 | |||
| 1494 | std::vector<u8> argument_data(sizeof(arguments)); | ||
| 1495 | std::vector<u8> settings_data(sizeof(amiibo_settings)); | ||
| 1496 | std::memcpy(argument_data.data(), &arguments, sizeof(arguments)); | ||
| 1497 | std::memcpy(settings_data.data(), &amiibo_settings, sizeof(amiibo_settings)); | ||
| 1498 | queue_data.emplace_back(std::move(argument_data)); | ||
| 1499 | queue_data.emplace_back(std::move(settings_data)); | ||
| 1500 | } | ||
| 1501 | |||
| 1462 | void ILibraryAppletSelfAccessor::PushInShowMiiEditData() { | 1502 | void ILibraryAppletSelfAccessor::PushInShowMiiEditData() { |
| 1463 | struct MiiEditV3 { | 1503 | struct MiiEditV3 { |
| 1464 | Applets::MiiEditAppletInputCommon common; | 1504 | Applets::MiiEditAppletInputCommon common; |
| @@ -2238,7 +2278,7 @@ void IProcessWindingController::GetLaunchReason(HLERequestContext& ctx) { | |||
| 2238 | } | 2278 | } |
| 2239 | 2279 | ||
| 2240 | void IProcessWindingController::OpenCallingLibraryApplet(HLERequestContext& ctx) { | 2280 | void IProcessWindingController::OpenCallingLibraryApplet(HLERequestContext& ctx) { |
| 2241 | const auto applet_id = Applets::AppletId::MiiEdit; | 2281 | const auto applet_id = system.GetAppletManager().GetCurrentAppletId(); |
| 2242 | const auto applet_mode = Applets::LibraryAppletMode::AllForeground; | 2282 | const auto applet_mode = Applets::LibraryAppletMode::AllForeground; |
| 2243 | 2283 | ||
| 2244 | LOG_WARNING(Service_AM, "(STUBBED) called with applet_id={:08X}, applet_mode={:08X}", applet_id, | 2284 | LOG_WARNING(Service_AM, "(STUBBED) called with applet_id={:08X}, applet_mode={:08X}", applet_id, |
| @@ -2259,4 +2299,5 @@ void IProcessWindingController::OpenCallingLibraryApplet(HLERequestContext& ctx) | |||
| 2259 | rb.Push(ResultSuccess); | 2299 | rb.Push(ResultSuccess); |
| 2260 | rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet); | 2300 | rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet); |
| 2261 | } | 2301 | } |
| 2302 | |||
| 2262 | } // namespace Service::AM | 2303 | } // namespace Service::AM |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 5b97eb5e3..10b79188f 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -311,6 +311,7 @@ private: | |||
| 311 | void ExitProcessAndReturn(HLERequestContext& ctx); | 311 | void ExitProcessAndReturn(HLERequestContext& ctx); |
| 312 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); | 312 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); |
| 313 | 313 | ||
| 314 | void PushInShowCabinetData(); | ||
| 314 | void PushInShowMiiEditData(); | 315 | void PushInShowMiiEditData(); |
| 315 | 316 | ||
| 316 | std::deque<std::vector<u8>> queue_data; | 317 | std::deque<std::vector<u8>> queue_data; |
diff --git a/src/core/hle/service/am/applets/applet_cabinet.h b/src/core/hle/service/am/applets/applet_cabinet.h index b56427021..f498796f7 100644 --- a/src/core/hle/service/am/applets/applet_cabinet.h +++ b/src/core/hle/service/am/applets/applet_cabinet.h | |||
| @@ -29,6 +29,15 @@ enum class CabinetAppletVersion : u32 { | |||
| 29 | Version1 = 0x1, | 29 | Version1 = 0x1, |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | enum class CabinetFlags : u8 { | ||
| 33 | None = 0, | ||
| 34 | DeviceHandle = 1 << 0, | ||
| 35 | TagInfo = 1 << 1, | ||
| 36 | RegisterInfo = 1 << 2, | ||
| 37 | All = DeviceHandle | TagInfo | RegisterInfo, | ||
| 38 | }; | ||
| 39 | DECLARE_ENUM_FLAG_OPERATORS(CabinetFlags) | ||
| 40 | |||
| 32 | enum class CabinetResult : u8 { | 41 | enum class CabinetResult : u8 { |
| 33 | Cancel = 0, | 42 | Cancel = 0, |
| 34 | TagInfo = 1 << 1, | 43 | TagInfo = 1 << 1, |
| @@ -51,7 +60,7 @@ static_assert(sizeof(AmiiboSettingsStartParam) == 0x30, | |||
| 51 | struct StartParamForAmiiboSettings { | 60 | struct StartParamForAmiiboSettings { |
| 52 | u8 param_1; | 61 | u8 param_1; |
| 53 | Service::NFP::CabinetMode applet_mode; | 62 | Service::NFP::CabinetMode applet_mode; |
| 54 | u8 flags; | 63 | CabinetFlags flags; |
| 55 | u8 amiibo_settings_1; | 64 | u8 amiibo_settings_1; |
| 56 | u64 device_handle; | 65 | u64 device_handle; |
| 57 | Service::NFP::TagInfo tag_info; | 66 | Service::NFP::TagInfo tag_info; |
diff --git a/src/core/hle/service/am/applets/applet_general_backend.cpp b/src/core/hle/service/am/applets/applet_general_backend.cpp index 8b352020e..c0032f652 100644 --- a/src/core/hle/service/am/applets/applet_general_backend.cpp +++ b/src/core/hle/service/am/applets/applet_general_backend.cpp | |||
| @@ -223,9 +223,9 @@ void StubApplet::Initialize() { | |||
| 223 | 223 | ||
| 224 | const auto data = broker.PeekDataToAppletForDebug(); | 224 | const auto data = broker.PeekDataToAppletForDebug(); |
| 225 | system.GetReporter().SaveUnimplementedAppletReport( | 225 | system.GetReporter().SaveUnimplementedAppletReport( |
| 226 | static_cast<u32>(id), common_args.arguments_version, common_args.library_version, | 226 | static_cast<u32>(id), static_cast<u32>(common_args.arguments_version), |
| 227 | common_args.theme_color, common_args.play_startup_sound, common_args.system_tick, | 227 | common_args.library_version, static_cast<u32>(common_args.theme_color), |
| 228 | data.normal, data.interactive); | 228 | common_args.play_startup_sound, common_args.system_tick, data.normal, data.interactive); |
| 229 | 229 | ||
| 230 | LogCurrentStorage(broker, "Initialize"); | 230 | LogCurrentStorage(broker, "Initialize"); |
| 231 | } | 231 | } |
diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp index 10afbc2da..89d5434af 100644 --- a/src/core/hle/service/am/applets/applets.cpp +++ b/src/core/hle/service/am/applets/applets.cpp | |||
| @@ -199,6 +199,14 @@ const AppletFrontendSet& AppletManager::GetAppletFrontendSet() const { | |||
| 199 | return frontend; | 199 | return frontend; |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | NFP::CabinetMode AppletManager::GetCabinetMode() const { | ||
| 203 | return cabinet_mode; | ||
| 204 | } | ||
| 205 | |||
| 206 | AppletId AppletManager::GetCurrentAppletId() const { | ||
| 207 | return current_applet_id; | ||
| 208 | } | ||
| 209 | |||
| 202 | void AppletManager::SetAppletFrontendSet(AppletFrontendSet set) { | 210 | void AppletManager::SetAppletFrontendSet(AppletFrontendSet set) { |
| 203 | if (set.cabinet != nullptr) { | 211 | if (set.cabinet != nullptr) { |
| 204 | frontend.cabinet = std::move(set.cabinet); | 212 | frontend.cabinet = std::move(set.cabinet); |
| @@ -237,6 +245,14 @@ void AppletManager::SetAppletFrontendSet(AppletFrontendSet set) { | |||
| 237 | } | 245 | } |
| 238 | } | 246 | } |
| 239 | 247 | ||
| 248 | void AppletManager::SetCabinetMode(NFP::CabinetMode mode) { | ||
| 249 | cabinet_mode = mode; | ||
| 250 | } | ||
| 251 | |||
| 252 | void AppletManager::SetCurrentAppletId(AppletId applet_id) { | ||
| 253 | current_applet_id = applet_id; | ||
| 254 | } | ||
| 255 | |||
| 240 | void AppletManager::SetDefaultAppletFrontendSet() { | 256 | void AppletManager::SetDefaultAppletFrontendSet() { |
| 241 | ClearAll(); | 257 | ClearAll(); |
| 242 | SetDefaultAppletsIfMissing(); | 258 | SetDefaultAppletsIfMissing(); |
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h index 12f374199..f02bbc450 100644 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/applets/applets.h | |||
| @@ -34,6 +34,10 @@ class KEvent; | |||
| 34 | class KReadableEvent; | 34 | class KReadableEvent; |
| 35 | } // namespace Kernel | 35 | } // namespace Kernel |
| 36 | 36 | ||
| 37 | namespace Service::NFP { | ||
| 38 | enum class CabinetMode : u8; | ||
| 39 | } // namespace Service::NFP | ||
| 40 | |||
| 37 | namespace Service::AM { | 41 | namespace Service::AM { |
| 38 | 42 | ||
| 39 | class IStorage; | 43 | class IStorage; |
| @@ -41,6 +45,8 @@ class IStorage; | |||
| 41 | namespace Applets { | 45 | namespace Applets { |
| 42 | 46 | ||
| 43 | enum class AppletId : u32 { | 47 | enum class AppletId : u32 { |
| 48 | None = 0x00, | ||
| 49 | Application = 0x01, | ||
| 44 | OverlayDisplay = 0x02, | 50 | OverlayDisplay = 0x02, |
| 45 | QLaunch = 0x03, | 51 | QLaunch = 0x03, |
| 46 | Starter = 0x04, | 52 | Starter = 0x04, |
| @@ -71,6 +77,32 @@ enum class LibraryAppletMode : u32 { | |||
| 71 | AllForegroundInitiallyHidden = 4, | 77 | AllForegroundInitiallyHidden = 4, |
| 72 | }; | 78 | }; |
| 73 | 79 | ||
| 80 | enum class CommonArgumentVersion : u32 { | ||
| 81 | Version0, | ||
| 82 | Version1, | ||
| 83 | Version2, | ||
| 84 | Version3, | ||
| 85 | }; | ||
| 86 | |||
| 87 | enum class CommonArgumentSize : u32 { | ||
| 88 | Version3 = 0x20, | ||
| 89 | }; | ||
| 90 | |||
| 91 | enum class ThemeColor : u32 { | ||
| 92 | BasicWhite = 0, | ||
| 93 | BasicBlack = 3, | ||
| 94 | }; | ||
| 95 | |||
| 96 | struct CommonArguments { | ||
| 97 | CommonArgumentVersion arguments_version; | ||
| 98 | CommonArgumentSize size; | ||
| 99 | u32 library_version; | ||
| 100 | ThemeColor theme_color; | ||
| 101 | bool play_startup_sound; | ||
| 102 | u64_le system_tick; | ||
| 103 | }; | ||
| 104 | static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size."); | ||
| 105 | |||
| 74 | class AppletDataBroker final { | 106 | class AppletDataBroker final { |
| 75 | public: | 107 | public: |
| 76 | explicit AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_); | 108 | explicit AppletDataBroker(Core::System& system_, LibraryAppletMode applet_mode_); |
| @@ -161,16 +193,6 @@ public: | |||
| 161 | } | 193 | } |
| 162 | 194 | ||
| 163 | protected: | 195 | protected: |
| 164 | struct CommonArguments { | ||
| 165 | u32_le arguments_version; | ||
| 166 | u32_le size; | ||
| 167 | u32_le library_version; | ||
| 168 | u32_le theme_color; | ||
| 169 | bool play_startup_sound; | ||
| 170 | u64_le system_tick; | ||
| 171 | }; | ||
| 172 | static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size."); | ||
| 173 | |||
| 174 | CommonArguments common_args{}; | 196 | CommonArguments common_args{}; |
| 175 | AppletDataBroker broker; | 197 | AppletDataBroker broker; |
| 176 | LibraryAppletMode applet_mode; | 198 | LibraryAppletMode applet_mode; |
| @@ -219,8 +241,12 @@ public: | |||
| 219 | ~AppletManager(); | 241 | ~AppletManager(); |
| 220 | 242 | ||
| 221 | const AppletFrontendSet& GetAppletFrontendSet() const; | 243 | const AppletFrontendSet& GetAppletFrontendSet() const; |
| 244 | NFP::CabinetMode GetCabinetMode() const; | ||
| 245 | AppletId GetCurrentAppletId() const; | ||
| 222 | 246 | ||
| 223 | void SetAppletFrontendSet(AppletFrontendSet set); | 247 | void SetAppletFrontendSet(AppletFrontendSet set); |
| 248 | void SetCabinetMode(NFP::CabinetMode mode); | ||
| 249 | void SetCurrentAppletId(AppletId applet_id); | ||
| 224 | void SetDefaultAppletFrontendSet(); | 250 | void SetDefaultAppletFrontendSet(); |
| 225 | void SetDefaultAppletsIfMissing(); | 251 | void SetDefaultAppletsIfMissing(); |
| 226 | void ClearAll(); | 252 | void ClearAll(); |
| @@ -228,6 +254,9 @@ public: | |||
| 228 | std::shared_ptr<Applet> GetApplet(AppletId id, LibraryAppletMode mode) const; | 254 | std::shared_ptr<Applet> GetApplet(AppletId id, LibraryAppletMode mode) const; |
| 229 | 255 | ||
| 230 | private: | 256 | private: |
| 257 | AppletId current_applet_id{}; | ||
| 258 | NFP::CabinetMode cabinet_mode{}; | ||
| 259 | |||
| 231 | AppletFrontendSet frontend; | 260 | AppletFrontendSet frontend; |
| 232 | Core::System& system; | 261 | Core::System& system; |
| 233 | }; | 262 | }; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 0879d6168..ec27361d5 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2122,6 +2122,8 @@ void GMainWindow::OnEmulationStopped() { | |||
| 2122 | OnTasStateChanged(); | 2122 | OnTasStateChanged(); |
| 2123 | render_window->FinalizeCamera(); | 2123 | render_window->FinalizeCamera(); |
| 2124 | 2124 | ||
| 2125 | system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::None); | ||
| 2126 | |||
| 2125 | // Enable all controllers | 2127 | // Enable all controllers |
| 2126 | system->HIDCore().SetSupportedStyleTag({Core::HID::NpadStyleSet::All}); | 2128 | system->HIDCore().SetSupportedStyleTag({Core::HID::NpadStyleSet::All}); |
| 2127 | 2129 | ||
| @@ -4169,6 +4171,9 @@ void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { | |||
| 4169 | return; | 4171 | return; |
| 4170 | } | 4172 | } |
| 4171 | 4173 | ||
| 4174 | system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::Cabinet); | ||
| 4175 | system->GetAppletManager().SetCabinetMode(mode); | ||
| 4176 | |||
| 4172 | const auto filename = QString::fromStdString(cabinet_nca->GetFullPath()); | 4177 | const auto filename = QString::fromStdString(cabinet_nca->GetFullPath()); |
| 4173 | UISettings::values.roms_path = QFileInfo(filename).path(); | 4178 | UISettings::values.roms_path = QFileInfo(filename).path(); |
| 4174 | BootGame(filename); | 4179 | BootGame(filename); |
| @@ -4190,6 +4195,8 @@ void GMainWindow::OnMiiEdit() { | |||
| 4190 | return; | 4195 | return; |
| 4191 | } | 4196 | } |
| 4192 | 4197 | ||
| 4198 | system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::MiiEdit); | ||
| 4199 | |||
| 4193 | const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath())); | 4200 | const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath())); |
| 4194 | UISettings::values.roms_path = QFileInfo(filename).path(); | 4201 | UISettings::values.roms_path = QFileInfo(filename).path(); |
| 4195 | BootGame(filename); | 4202 | BootGame(filename); |