diff options
Diffstat (limited to '')
32 files changed, 470 insertions, 58 deletions
diff --git a/src/core/hle/service/am/am_types.h b/src/core/hle/service/am/am_types.h index d47028b80..a2b852b12 100644 --- a/src/core/hle/service/am/am_types.h +++ b/src/core/hle/service/am/am_types.h | |||
| @@ -162,6 +162,13 @@ struct CommonArguments { | |||
| 162 | }; | 162 | }; |
| 163 | static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size."); | 163 | static_assert(sizeof(CommonArguments) == 0x20, "CommonArguments has incorrect size."); |
| 164 | 164 | ||
| 165 | struct AppletIdentityInfo { | ||
| 166 | AppletId applet_id; | ||
| 167 | INSERT_PADDING_BYTES(0x4); | ||
| 168 | u64 application_id; | ||
| 169 | }; | ||
| 170 | static_assert(sizeof(AppletIdentityInfo) == 0x10, "AppletIdentityInfo has incorrect size."); | ||
| 171 | |||
| 165 | using AppletResourceUserId = u64; | 172 | using AppletResourceUserId = u64; |
| 166 | using ProgramId = u64; | 173 | using ProgramId = u64; |
| 167 | 174 | ||
diff --git a/src/core/hle/service/am/applet.h b/src/core/hle/service/am/applet.h index 65bfbc250..bce6f9050 100644 --- a/src/core/hle/service/am/applet.h +++ b/src/core/hle/service/am/applet.h | |||
| @@ -49,6 +49,9 @@ struct Applet { | |||
| 49 | s32 previous_program_index{-1}; | 49 | s32 previous_program_index{-1}; |
| 50 | ScreenshotPermission previous_screenshot_permission{ScreenshotPermission::Enable}; | 50 | ScreenshotPermission previous_screenshot_permission{ScreenshotPermission::Enable}; |
| 51 | 51 | ||
| 52 | // TODO: some fields above can be AppletIdentityInfo | ||
| 53 | AppletIdentityInfo screen_shot_identity; | ||
| 54 | |||
| 52 | // hid state | 55 | // hid state |
| 53 | HidRegistration hid_registration; | 56 | HidRegistration hid_registration; |
| 54 | 57 | ||
diff --git a/src/core/hle/service/am/applet_common_functions.cpp b/src/core/hle/service/am/applet_common_functions.cpp index a5c54ce87..130614ae5 100644 --- a/src/core/hle/service/am/applet_common_functions.cpp +++ b/src/core/hle/service/am/applet_common_functions.cpp | |||
| @@ -31,6 +31,7 @@ IAppletCommonFunctions::IAppletCommonFunctions(Core::System& system_, | |||
| 31 | {90, nullptr, "OpenNamedChannelAsParent"}, | 31 | {90, nullptr, "OpenNamedChannelAsParent"}, |
| 32 | {91, nullptr, "OpenNamedChannelAsChild"}, | 32 | {91, nullptr, "OpenNamedChannelAsChild"}, |
| 33 | {100, nullptr, "SetApplicationCoreUsageMode"}, | 33 | {100, nullptr, "SetApplicationCoreUsageMode"}, |
| 34 | {300, &IAppletCommonFunctions::GetCurrentApplicationId, "GetCurrentApplicationId"}, | ||
| 34 | }; | 35 | }; |
| 35 | // clang-format on | 36 | // clang-format on |
| 36 | 37 | ||
| @@ -51,4 +52,12 @@ void IAppletCommonFunctions::SetCpuBoostRequestPriority(HLERequestContext& ctx) | |||
| 51 | rb.Push(ResultSuccess); | 52 | rb.Push(ResultSuccess); |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 55 | void IAppletCommonFunctions::GetCurrentApplicationId(HLERequestContext& ctx) { | ||
| 56 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 57 | |||
| 58 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 59 | rb.Push(ResultSuccess); | ||
| 60 | rb.Push<u64>(system.GetApplicationProcessProgramID() & ~0xFFFULL); | ||
| 61 | } | ||
| 62 | |||
| 54 | } // namespace Service::AM | 63 | } // namespace Service::AM |
diff --git a/src/core/hle/service/am/applet_common_functions.h b/src/core/hle/service/am/applet_common_functions.h index 229555669..b86adf5cb 100644 --- a/src/core/hle/service/am/applet_common_functions.h +++ b/src/core/hle/service/am/applet_common_functions.h | |||
| @@ -16,6 +16,7 @@ public: | |||
| 16 | 16 | ||
| 17 | private: | 17 | private: |
| 18 | void SetCpuBoostRequestPriority(HLERequestContext& ctx); | 18 | void SetCpuBoostRequestPriority(HLERequestContext& ctx); |
| 19 | void GetCurrentApplicationId(HLERequestContext& ctx); | ||
| 19 | 20 | ||
| 20 | const std::shared_ptr<Applet> applet; | 21 | const std::shared_ptr<Applet> applet; |
| 21 | }; | 22 | }; |
diff --git a/src/core/hle/service/am/application_proxy.cpp b/src/core/hle/service/am/application_proxy.cpp index 99e97f4bc..a6fd6d37f 100644 --- a/src/core/hle/service/am/application_proxy.cpp +++ b/src/core/hle/service/am/application_proxy.cpp | |||
| @@ -53,7 +53,7 @@ void IApplicationProxy::GetDisplayController(HLERequestContext& ctx) { | |||
| 53 | 53 | ||
| 54 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 54 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 55 | rb.Push(ResultSuccess); | 55 | rb.Push(ResultSuccess); |
| 56 | rb.PushIpcInterface<IDisplayController>(system); | 56 | rb.PushIpcInterface<IDisplayController>(system, applet); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | void IApplicationProxy::GetProcessWindingController(HLERequestContext& ctx) { | 59 | void IApplicationProxy::GetProcessWindingController(HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/am/common_state_getter.cpp b/src/core/hle/service/am/common_state_getter.cpp index 77f3fd868..937ac0beb 100644 --- a/src/core/hle/service/am/common_state_getter.cpp +++ b/src/core/hle/service/am/common_state_getter.cpp | |||
| @@ -60,7 +60,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Ap | |||
| 60 | {91, nullptr, "GetCurrentPerformanceConfiguration"}, | 60 | {91, nullptr, "GetCurrentPerformanceConfiguration"}, |
| 61 | {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"}, | 61 | {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"}, |
| 62 | {110, nullptr, "OpenMyGpuErrorHandler"}, | 62 | {110, nullptr, "OpenMyGpuErrorHandler"}, |
| 63 | {120, nullptr, "GetAppletLaunchedHistory"}, | 63 | {120, &ICommonStateGetter::GetAppletLaunchedHistory, "GetAppletLaunchedHistory"}, |
| 64 | {200, nullptr, "GetOperationModeSystemInfo"}, | 64 | {200, nullptr, "GetOperationModeSystemInfo"}, |
| 65 | {300, &ICommonStateGetter::GetSettingsPlatformRegion, "GetSettingsPlatformRegion"}, | 65 | {300, &ICommonStateGetter::GetSettingsPlatformRegion, "GetSettingsPlatformRegion"}, |
| 66 | {400, nullptr, "ActivateMigrationService"}, | 66 | {400, nullptr, "ActivateMigrationService"}, |
| @@ -271,6 +271,27 @@ void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(HLERequestContext& | |||
| 271 | rb.Push(ResultSuccess); | 271 | rb.Push(ResultSuccess); |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | void ICommonStateGetter::GetAppletLaunchedHistory(HLERequestContext& ctx) { | ||
| 275 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 276 | |||
| 277 | std::shared_ptr<Applet> current_applet = applet; | ||
| 278 | std::vector<AppletId> result; | ||
| 279 | |||
| 280 | const size_t count = ctx.GetWriteBufferNumElements<AppletId>(); | ||
| 281 | size_t i; | ||
| 282 | |||
| 283 | for (i = 0; i < count && current_applet != nullptr; i++) { | ||
| 284 | result.push_back(current_applet->applet_id); | ||
| 285 | current_applet = current_applet->caller_applet.lock(); | ||
| 286 | } | ||
| 287 | |||
| 288 | ctx.WriteBuffer(result); | ||
| 289 | |||
| 290 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 291 | rb.Push(ResultSuccess); | ||
| 292 | rb.Push(static_cast<u32>(i)); | ||
| 293 | } | ||
| 294 | |||
| 274 | void ICommonStateGetter::GetSettingsPlatformRegion(HLERequestContext& ctx) { | 295 | void ICommonStateGetter::GetSettingsPlatformRegion(HLERequestContext& ctx) { |
| 275 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 296 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 276 | 297 | ||
diff --git a/src/core/hle/service/am/common_state_getter.h b/src/core/hle/service/am/common_state_getter.h index 643ca4dc5..bf652790c 100644 --- a/src/core/hle/service/am/common_state_getter.h +++ b/src/core/hle/service/am/common_state_getter.h | |||
| @@ -67,6 +67,7 @@ private: | |||
| 67 | void SetCpuBoostMode(HLERequestContext& ctx); | 67 | void SetCpuBoostMode(HLERequestContext& ctx); |
| 68 | void GetBuiltInDisplayType(HLERequestContext& ctx); | 68 | void GetBuiltInDisplayType(HLERequestContext& ctx); |
| 69 | void PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx); | 69 | void PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx); |
| 70 | void GetAppletLaunchedHistory(HLERequestContext& ctx); | ||
| 70 | void GetSettingsPlatformRegion(HLERequestContext& ctx); | 71 | void GetSettingsPlatformRegion(HLERequestContext& ctx); |
| 71 | void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(HLERequestContext& ctx); | 72 | void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(HLERequestContext& ctx); |
| 72 | 73 | ||
diff --git a/src/core/hle/service/am/display_controller.cpp b/src/core/hle/service/am/display_controller.cpp index d4d3d60e7..4d6858348 100644 --- a/src/core/hle/service/am/display_controller.cpp +++ b/src/core/hle/service/am/display_controller.cpp | |||
| @@ -1,13 +1,23 @@ | |||
| 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 "core/hle/service/am/applet.h" | ||
| 4 | #include "core/hle/service/am/display_controller.h" | 5 | #include "core/hle/service/am/display_controller.h" |
| 5 | #include "core/hle/service/ipc_helpers.h" | 6 | #include "core/hle/service/ipc_helpers.h" |
| 6 | 7 | ||
| 7 | namespace Service::AM { | 8 | namespace Service::AM { |
| 8 | 9 | ||
| 9 | IDisplayController::IDisplayController(Core::System& system_) | 10 | namespace { |
| 10 | : ServiceFramework{system_, "IDisplayController"} { | 11 | struct OutputParameters { |
| 12 | bool was_written; | ||
| 13 | s32 fbshare_layer_index; | ||
| 14 | }; | ||
| 15 | |||
| 16 | static_assert(sizeof(OutputParameters) == 8, "OutputParameters has wrong size"); | ||
| 17 | } // namespace | ||
| 18 | |||
| 19 | IDisplayController::IDisplayController(Core::System& system_, std::shared_ptr<Applet> applet_) | ||
| 20 | : ServiceFramework{system_, "IDisplayController"}, applet(std::move(applet_)) { | ||
| 11 | // clang-format off | 21 | // clang-format off |
| 12 | static const FunctionInfo functions[] = { | 22 | static const FunctionInfo functions[] = { |
| 13 | {0, nullptr, "GetLastForegroundCaptureImage"}, | 23 | {0, nullptr, "GetLastForegroundCaptureImage"}, |
| @@ -31,8 +41,8 @@ IDisplayController::IDisplayController(Core::System& system_) | |||
| 31 | {18, nullptr, "AcquireCallerAppletCaptureBufferEx"}, | 41 | {18, nullptr, "AcquireCallerAppletCaptureBufferEx"}, |
| 32 | {20, nullptr, "ClearCaptureBuffer"}, | 42 | {20, nullptr, "ClearCaptureBuffer"}, |
| 33 | {21, nullptr, "ClearAppletTransitionBuffer"}, | 43 | {21, nullptr, "ClearAppletTransitionBuffer"}, |
| 34 | {22, nullptr, "AcquireLastApplicationCaptureSharedBuffer"}, | 44 | {22, &IDisplayController::AcquireLastApplicationCaptureSharedBuffer, "AcquireLastApplicationCaptureSharedBuffer"}, |
| 35 | {23, nullptr, "ReleaseLastApplicationCaptureSharedBuffer"}, | 45 | {23, &IDisplayController::ReleaseLastApplicationCaptureSharedBuffer, "ReleaseLastApplicationCaptureSharedBuffer"}, |
| 36 | {24, &IDisplayController::AcquireLastForegroundCaptureSharedBuffer, "AcquireLastForegroundCaptureSharedBuffer"}, | 46 | {24, &IDisplayController::AcquireLastForegroundCaptureSharedBuffer, "AcquireLastForegroundCaptureSharedBuffer"}, |
| 37 | {25, &IDisplayController::ReleaseLastForegroundCaptureSharedBuffer, "ReleaseLastForegroundCaptureSharedBuffer"}, | 47 | {25, &IDisplayController::ReleaseLastForegroundCaptureSharedBuffer, "ReleaseLastForegroundCaptureSharedBuffer"}, |
| 38 | {26, &IDisplayController::AcquireCallerAppletCaptureSharedBuffer, "AcquireCallerAppletCaptureSharedBuffer"}, | 48 | {26, &IDisplayController::AcquireCallerAppletCaptureSharedBuffer, "AcquireCallerAppletCaptureSharedBuffer"}, |
| @@ -49,10 +59,13 @@ IDisplayController::~IDisplayController() = default; | |||
| 49 | void IDisplayController::GetCallerAppletCaptureImageEx(HLERequestContext& ctx) { | 59 | void IDisplayController::GetCallerAppletCaptureImageEx(HLERequestContext& ctx) { |
| 50 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 60 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 51 | 61 | ||
| 62 | OutputParameters params{}; | ||
| 63 | const auto res = applet->system_buffer_manager.WriteAppletCaptureBuffer( | ||
| 64 | ¶ms.was_written, ¶ms.fbshare_layer_index); | ||
| 65 | |||
| 52 | IPC::ResponseBuilder rb{ctx, 4}; | 66 | IPC::ResponseBuilder rb{ctx, 4}; |
| 53 | rb.Push(ResultSuccess); | 67 | rb.Push(res); |
| 54 | rb.Push(1u); | 68 | rb.PushRaw(params); |
| 55 | rb.Push(1); | ||
| 56 | } | 69 | } |
| 57 | 70 | ||
| 58 | void IDisplayController::TakeScreenShotOfOwnLayer(HLERequestContext& ctx) { | 71 | void IDisplayController::TakeScreenShotOfOwnLayer(HLERequestContext& ctx) { |
| @@ -62,13 +75,35 @@ void IDisplayController::TakeScreenShotOfOwnLayer(HLERequestContext& ctx) { | |||
| 62 | rb.Push(ResultSuccess); | 75 | rb.Push(ResultSuccess); |
| 63 | } | 76 | } |
| 64 | 77 | ||
| 65 | void IDisplayController::AcquireLastForegroundCaptureSharedBuffer(HLERequestContext& ctx) { | 78 | void IDisplayController::AcquireLastApplicationCaptureSharedBuffer(HLERequestContext& ctx) { |
| 66 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 79 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 67 | 80 | ||
| 81 | OutputParameters params{}; | ||
| 82 | const auto res = applet->system_buffer_manager.WriteAppletCaptureBuffer( | ||
| 83 | ¶ms.was_written, ¶ms.fbshare_layer_index); | ||
| 84 | |||
| 68 | IPC::ResponseBuilder rb{ctx, 4}; | 85 | IPC::ResponseBuilder rb{ctx, 4}; |
| 86 | rb.Push(res); | ||
| 87 | rb.PushRaw(params); | ||
| 88 | } | ||
| 89 | |||
| 90 | void IDisplayController::ReleaseLastApplicationCaptureSharedBuffer(HLERequestContext& ctx) { | ||
| 91 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 92 | |||
| 93 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 69 | rb.Push(ResultSuccess); | 94 | rb.Push(ResultSuccess); |
| 70 | rb.Push(1U); | 95 | } |
| 71 | rb.Push(1); | 96 | |
| 97 | void IDisplayController::AcquireLastForegroundCaptureSharedBuffer(HLERequestContext& ctx) { | ||
| 98 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 99 | |||
| 100 | OutputParameters params{}; | ||
| 101 | const auto res = applet->system_buffer_manager.WriteAppletCaptureBuffer( | ||
| 102 | ¶ms.was_written, ¶ms.fbshare_layer_index); | ||
| 103 | |||
| 104 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 105 | rb.Push(res); | ||
| 106 | rb.PushRaw(params); | ||
| 72 | } | 107 | } |
| 73 | 108 | ||
| 74 | void IDisplayController::ReleaseLastForegroundCaptureSharedBuffer(HLERequestContext& ctx) { | 109 | void IDisplayController::ReleaseLastForegroundCaptureSharedBuffer(HLERequestContext& ctx) { |
| @@ -81,10 +116,13 @@ void IDisplayController::ReleaseLastForegroundCaptureSharedBuffer(HLERequestCont | |||
| 81 | void IDisplayController::AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx) { | 116 | void IDisplayController::AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx) { |
| 82 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 117 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 83 | 118 | ||
| 119 | OutputParameters params{}; | ||
| 120 | const auto res = applet->system_buffer_manager.WriteAppletCaptureBuffer( | ||
| 121 | ¶ms.was_written, ¶ms.fbshare_layer_index); | ||
| 122 | |||
| 84 | IPC::ResponseBuilder rb{ctx, 4}; | 123 | IPC::ResponseBuilder rb{ctx, 4}; |
| 85 | rb.Push(ResultSuccess); | 124 | rb.Push(res); |
| 86 | rb.Push(1U); | 125 | rb.PushRaw(params); |
| 87 | rb.Push(1); | ||
| 88 | } | 126 | } |
| 89 | 127 | ||
| 90 | void IDisplayController::ReleaseCallerAppletCaptureSharedBuffer(HLERequestContext& ctx) { | 128 | void IDisplayController::ReleaseCallerAppletCaptureSharedBuffer(HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/am/display_controller.h b/src/core/hle/service/am/display_controller.h index 32f819294..75172580c 100644 --- a/src/core/hle/service/am/display_controller.h +++ b/src/core/hle/service/am/display_controller.h | |||
| @@ -7,9 +7,11 @@ | |||
| 7 | 7 | ||
| 8 | namespace Service::AM { | 8 | namespace Service::AM { |
| 9 | 9 | ||
| 10 | struct Applet; | ||
| 11 | |||
| 10 | class IDisplayController final : public ServiceFramework<IDisplayController> { | 12 | class IDisplayController final : public ServiceFramework<IDisplayController> { |
| 11 | public: | 13 | public: |
| 12 | explicit IDisplayController(Core::System& system_); | 14 | explicit IDisplayController(Core::System& system_, std::shared_ptr<Applet> applet_); |
| 13 | ~IDisplayController() override; | 15 | ~IDisplayController() override; |
| 14 | 16 | ||
| 15 | private: | 17 | private: |
| @@ -19,6 +21,10 @@ private: | |||
| 19 | void ReleaseLastForegroundCaptureSharedBuffer(HLERequestContext& ctx); | 21 | void ReleaseLastForegroundCaptureSharedBuffer(HLERequestContext& ctx); |
| 20 | void AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx); | 22 | void AcquireCallerAppletCaptureSharedBuffer(HLERequestContext& ctx); |
| 21 | void ReleaseCallerAppletCaptureSharedBuffer(HLERequestContext& ctx); | 23 | void ReleaseCallerAppletCaptureSharedBuffer(HLERequestContext& ctx); |
| 24 | void AcquireLastApplicationCaptureSharedBuffer(HLERequestContext& ctx); | ||
| 25 | void ReleaseLastApplicationCaptureSharedBuffer(HLERequestContext& ctx); | ||
| 26 | |||
| 27 | const std::shared_ptr<Applet> applet; | ||
| 22 | }; | 28 | }; |
| 23 | 29 | ||
| 24 | } // namespace Service::AM | 30 | } // namespace Service::AM |
diff --git a/src/core/hle/service/am/hid_registration.cpp b/src/core/hle/service/am/hid_registration.cpp index b9426f7b6..8ed49bac1 100644 --- a/src/core/hle/service/am/hid_registration.cpp +++ b/src/core/hle/service/am/hid_registration.cpp | |||
| @@ -26,4 +26,10 @@ HidRegistration::~HidRegistration() { | |||
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | void HidRegistration::EnableAppletToGetInput(bool enable) { | ||
| 30 | if (m_process.IsInitialized()) { | ||
| 31 | m_hid_server->GetResourceManager()->EnableInput(m_process.GetProcessId(), enable); | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 29 | } // namespace Service::AM | 35 | } // namespace Service::AM |
diff --git a/src/core/hle/service/am/hid_registration.h b/src/core/hle/service/am/hid_registration.h index 8a732349c..67cd84961 100644 --- a/src/core/hle/service/am/hid_registration.h +++ b/src/core/hle/service/am/hid_registration.h | |||
| @@ -22,6 +22,8 @@ public: | |||
| 22 | explicit HidRegistration(Core::System& system, Process& process); | 22 | explicit HidRegistration(Core::System& system, Process& process); |
| 23 | ~HidRegistration(); | 23 | ~HidRegistration(); |
| 24 | 24 | ||
| 25 | void EnableAppletToGetInput(bool enable); | ||
| 26 | |||
| 25 | private: | 27 | private: |
| 26 | Process& m_process; | 28 | Process& m_process; |
| 27 | std::shared_ptr<Service::HID::IHidServer> m_hid_server; | 29 | std::shared_ptr<Service::HID::IHidServer> m_hid_server; |
diff --git a/src/core/hle/service/am/library_applet_creator.cpp b/src/core/hle/service/am/library_applet_creator.cpp index e69764670..47bab7528 100644 --- a/src/core/hle/service/am/library_applet_creator.cpp +++ b/src/core/hle/service/am/library_applet_creator.cpp | |||
| @@ -84,10 +84,29 @@ AppletProgramId AppletIdToProgramId(AppletId applet_id) { | |||
| 84 | applet->type = AppletType::LibraryApplet; | 84 | applet->type = AppletType::LibraryApplet; |
| 85 | applet->library_applet_mode = mode; | 85 | applet->library_applet_mode = mode; |
| 86 | 86 | ||
| 87 | // Library applet should be foreground | 87 | // Set focus state |
| 88 | applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground); | 88 | switch (mode) { |
| 89 | applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); | 89 | case LibraryAppletMode::AllForeground: |
| 90 | applet->focus_state = FocusState::InFocus; | 90 | case LibraryAppletMode::NoUI: |
| 91 | applet->focus_state = FocusState::InFocus; | ||
| 92 | applet->hid_registration.EnableAppletToGetInput(true); | ||
| 93 | applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground); | ||
| 94 | applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); | ||
| 95 | break; | ||
| 96 | case LibraryAppletMode::AllForegroundInitiallyHidden: | ||
| 97 | applet->system_buffer_manager.SetWindowVisibility(false); | ||
| 98 | applet->focus_state = FocusState::NotInFocus; | ||
| 99 | applet->hid_registration.EnableAppletToGetInput(false); | ||
| 100 | applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); | ||
| 101 | break; | ||
| 102 | case LibraryAppletMode::Background: | ||
| 103 | case LibraryAppletMode::BackgroundIndirectDisplay: | ||
| 104 | default: | ||
| 105 | applet->focus_state = FocusState::Background; | ||
| 106 | applet->hid_registration.EnableAppletToGetInput(true); | ||
| 107 | applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); | ||
| 108 | break; | ||
| 109 | } | ||
| 91 | 110 | ||
| 92 | auto broker = std::make_shared<AppletDataBroker>(system); | 111 | auto broker = std::make_shared<AppletDataBroker>(system); |
| 93 | applet->caller_applet = caller_applet; | 112 | applet->caller_applet = caller_applet; |
diff --git a/src/core/hle/service/am/library_applet_proxy.cpp b/src/core/hle/service/am/library_applet_proxy.cpp index 1d88dd78c..d6108fba3 100644 --- a/src/core/hle/service/am/library_applet_proxy.cpp +++ b/src/core/hle/service/am/library_applet_proxy.cpp | |||
| @@ -81,7 +81,7 @@ void ILibraryAppletProxy::GetDisplayController(HLERequestContext& ctx) { | |||
| 81 | 81 | ||
| 82 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 82 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 83 | rb.Push(ResultSuccess); | 83 | rb.Push(ResultSuccess); |
| 84 | rb.PushIpcInterface<IDisplayController>(system); | 84 | rb.PushIpcInterface<IDisplayController>(system, applet); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | void ILibraryAppletProxy::GetProcessWindingController(HLERequestContext& ctx) { | 87 | void ILibraryAppletProxy::GetProcessWindingController(HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/am/library_applet_self_accessor.cpp b/src/core/hle/service/am/library_applet_self_accessor.cpp index bc66bcb6b..b560f580b 100644 --- a/src/core/hle/service/am/library_applet_self_accessor.cpp +++ b/src/core/hle/service/am/library_applet_self_accessor.cpp | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #include "common/scope_exit.h" | 4 | #include "common/scope_exit.h" |
| 5 | #include "core/core_timing.h" | 5 | #include "core/core_timing.h" |
| 6 | #include "core/file_sys/control_metadata.h" | ||
| 7 | #include "core/file_sys/patch_manager.h" | ||
| 8 | #include "core/file_sys/registered_cache.h" | ||
| 6 | #include "core/hle/service/acc/profile_manager.h" | 9 | #include "core/hle/service/acc/profile_manager.h" |
| 7 | #include "core/hle/service/am/am_results.h" | 10 | #include "core/hle/service/am/am_results.h" |
| 8 | #include "core/hle/service/am/applet_data_broker.h" | 11 | #include "core/hle/service/am/applet_data_broker.h" |
| @@ -15,25 +18,20 @@ | |||
| 15 | #include "core/hle/service/am/library_applet_self_accessor.h" | 18 | #include "core/hle/service/am/library_applet_self_accessor.h" |
| 16 | #include "core/hle/service/am/storage.h" | 19 | #include "core/hle/service/am/storage.h" |
| 17 | #include "core/hle/service/ipc_helpers.h" | 20 | #include "core/hle/service/ipc_helpers.h" |
| 21 | #include "core/hle/service/ns/ns.h" | ||
| 22 | #include "core/hle/service/sm/sm.h" | ||
| 18 | #include "hid_core/hid_types.h" | 23 | #include "hid_core/hid_types.h" |
| 19 | 24 | ||
| 20 | namespace Service::AM { | 25 | namespace Service::AM { |
| 21 | 26 | ||
| 22 | namespace { | 27 | namespace { |
| 23 | 28 | ||
| 24 | struct AppletIdentityInfo { | ||
| 25 | AppletId applet_id; | ||
| 26 | INSERT_PADDING_BYTES(0x4); | ||
| 27 | u64 application_id; | ||
| 28 | }; | ||
| 29 | static_assert(sizeof(AppletIdentityInfo) == 0x10, "AppletIdentityInfo has incorrect size."); | ||
| 30 | |||
| 31 | AppletIdentityInfo GetCallerIdentity(std::shared_ptr<Applet> applet) { | 29 | AppletIdentityInfo GetCallerIdentity(std::shared_ptr<Applet> applet) { |
| 32 | if (const auto caller_applet = applet->caller_applet.lock(); caller_applet) { | 30 | if (const auto caller_applet = applet->caller_applet.lock(); caller_applet) { |
| 33 | // TODO: is this actually the application ID? | 31 | // TODO: is this actually the application ID? |
| 34 | return { | 32 | return { |
| 35 | .applet_id = applet->applet_id, | 33 | .applet_id = caller_applet->applet_id, |
| 36 | .application_id = applet->program_id, | 34 | .application_id = caller_applet->program_id, |
| 37 | }; | 35 | }; |
| 38 | } else { | 36 | } else { |
| 39 | return { | 37 | return { |
| @@ -60,7 +58,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_, | |||
| 60 | {10, &ILibraryAppletSelfAccessor::ExitProcessAndReturn, "ExitProcessAndReturn"}, | 58 | {10, &ILibraryAppletSelfAccessor::ExitProcessAndReturn, "ExitProcessAndReturn"}, |
| 61 | {11, &ILibraryAppletSelfAccessor::GetLibraryAppletInfo, "GetLibraryAppletInfo"}, | 59 | {11, &ILibraryAppletSelfAccessor::GetLibraryAppletInfo, "GetLibraryAppletInfo"}, |
| 62 | {12, &ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo, "GetMainAppletIdentityInfo"}, | 60 | {12, &ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo, "GetMainAppletIdentityInfo"}, |
| 63 | {13, nullptr, "CanUseApplicationCore"}, | 61 | {13, &ILibraryAppletSelfAccessor::CanUseApplicationCore, "CanUseApplicationCore"}, |
| 64 | {14, &ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo, "GetCallerAppletIdentityInfo"}, | 62 | {14, &ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo, "GetCallerAppletIdentityInfo"}, |
| 65 | {15, nullptr, "GetMainAppletApplicationControlProperty"}, | 63 | {15, nullptr, "GetMainAppletApplicationControlProperty"}, |
| 66 | {16, nullptr, "GetMainAppletStorageId"}, | 64 | {16, nullptr, "GetMainAppletStorageId"}, |
| @@ -74,8 +72,8 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_, | |||
| 74 | {40, nullptr, "GetIndirectLayerProducerHandle"}, | 72 | {40, nullptr, "GetIndirectLayerProducerHandle"}, |
| 75 | {50, nullptr, "ReportVisibleError"}, | 73 | {50, nullptr, "ReportVisibleError"}, |
| 76 | {51, nullptr, "ReportVisibleErrorWithErrorContext"}, | 74 | {51, nullptr, "ReportVisibleErrorWithErrorContext"}, |
| 77 | {60, nullptr, "GetMainAppletApplicationDesiredLanguage"}, | 75 | {60, &ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage, "GetMainAppletApplicationDesiredLanguage"}, |
| 78 | {70, nullptr, "GetCurrentApplicationId"}, | 76 | {70, &ILibraryAppletSelfAccessor::GetCurrentApplicationId, "GetCurrentApplicationId"}, |
| 79 | {80, nullptr, "RequestExitToSelf"}, | 77 | {80, nullptr, "RequestExitToSelf"}, |
| 80 | {90, nullptr, "CreateApplicationAndPushAndRequestToLaunch"}, | 78 | {90, nullptr, "CreateApplicationAndPushAndRequestToLaunch"}, |
| 81 | {100, nullptr, "CreateGameMovieTrimmer"}, | 79 | {100, nullptr, "CreateGameMovieTrimmer"}, |
| @@ -86,6 +84,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_, | |||
| 86 | {130, nullptr, "GetGpuErrorDetectedSystemEvent"}, | 84 | {130, nullptr, "GetGpuErrorDetectedSystemEvent"}, |
| 87 | {140, nullptr, "SetApplicationMemoryReservation"}, | 85 | {140, nullptr, "SetApplicationMemoryReservation"}, |
| 88 | {150, &ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually, "ShouldSetGpuTimeSliceManually"}, | 86 | {150, &ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually, "ShouldSetGpuTimeSliceManually"}, |
| 87 | {160, &ILibraryAppletSelfAccessor::Cmd160, "Cmd160"}, | ||
| 89 | }; | 88 | }; |
| 90 | // clang-format on | 89 | // clang-format on |
| 91 | RegisterHandlers(functions); | 90 | RegisterHandlers(functions); |
| @@ -202,6 +201,15 @@ void ILibraryAppletSelfAccessor::GetMainAppletIdentityInfo(HLERequestContext& ct | |||
| 202 | rb.PushRaw(applet_info); | 201 | rb.PushRaw(applet_info); |
| 203 | } | 202 | } |
| 204 | 203 | ||
| 204 | void ILibraryAppletSelfAccessor::CanUseApplicationCore(HLERequestContext& ctx) { | ||
| 205 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 206 | |||
| 207 | // TODO: This appears to read the NPDM from state and check the core mask of the applet. | ||
| 208 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 209 | rb.Push(ResultSuccess); | ||
| 210 | rb.Push<u8>(0); | ||
| 211 | } | ||
| 212 | |||
| 205 | void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& ctx) { | 213 | void ILibraryAppletSelfAccessor::GetCallerAppletIdentityInfo(HLERequestContext& ctx) { |
| 206 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 214 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 207 | 215 | ||
| @@ -218,6 +226,80 @@ void ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout(HLERequestContext& c | |||
| 218 | rb.Push<u32>(0); | 226 | rb.Push<u32>(0); |
| 219 | } | 227 | } |
| 220 | 228 | ||
| 229 | void ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage(HLERequestContext& ctx) { | ||
| 230 | // FIXME: this is copied from IApplicationFunctions::GetDesiredLanguage | ||
| 231 | auto identity = GetCallerIdentity(applet); | ||
| 232 | |||
| 233 | // TODO(bunnei): This should be configurable | ||
| 234 | LOG_DEBUG(Service_AM, "called"); | ||
| 235 | |||
| 236 | // Get supported languages from NACP, if possible | ||
| 237 | // Default to 0 (all languages supported) | ||
| 238 | u32 supported_languages = 0; | ||
| 239 | |||
| 240 | const auto res = [this, identity] { | ||
| 241 | const FileSys::PatchManager pm{identity.application_id, system.GetFileSystemController(), | ||
| 242 | system.GetContentProvider()}; | ||
| 243 | auto metadata = pm.GetControlMetadata(); | ||
| 244 | if (metadata.first != nullptr) { | ||
| 245 | return metadata; | ||
| 246 | } | ||
| 247 | |||
| 248 | const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(identity.application_id), | ||
| 249 | system.GetFileSystemController(), | ||
| 250 | system.GetContentProvider()}; | ||
| 251 | return pm_update.GetControlMetadata(); | ||
| 252 | }(); | ||
| 253 | |||
| 254 | if (res.first != nullptr) { | ||
| 255 | supported_languages = res.first->GetSupportedLanguages(); | ||
| 256 | } | ||
| 257 | |||
| 258 | // Call IApplicationManagerInterface implementation. | ||
| 259 | auto& service_manager = system.ServiceManager(); | ||
| 260 | auto ns_am2 = service_manager.GetService<NS::NS>("ns:am2"); | ||
| 261 | auto app_man = ns_am2->GetApplicationManagerInterface(); | ||
| 262 | |||
| 263 | // Get desired application language | ||
| 264 | u8 desired_language{}; | ||
| 265 | const auto res_lang = | ||
| 266 | app_man->GetApplicationDesiredLanguage(&desired_language, supported_languages); | ||
| 267 | if (res_lang != ResultSuccess) { | ||
| 268 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 269 | rb.Push(res_lang); | ||
| 270 | return; | ||
| 271 | } | ||
| 272 | |||
| 273 | // Convert to settings language code. | ||
| 274 | u64 language_code{}; | ||
| 275 | const auto res_code = | ||
| 276 | app_man->ConvertApplicationLanguageToLanguageCode(&language_code, desired_language); | ||
| 277 | if (res_code != ResultSuccess) { | ||
| 278 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 279 | rb.Push(res_code); | ||
| 280 | return; | ||
| 281 | } | ||
| 282 | |||
| 283 | LOG_DEBUG(Service_AM, "got desired_language={:016X}", language_code); | ||
| 284 | |||
| 285 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 286 | rb.Push(ResultSuccess); | ||
| 287 | rb.Push(language_code); | ||
| 288 | } | ||
| 289 | |||
| 290 | void ILibraryAppletSelfAccessor::GetCurrentApplicationId(HLERequestContext& ctx) { | ||
| 291 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 292 | |||
| 293 | u64 application_id = 0; | ||
| 294 | if (auto caller_applet = applet->caller_applet.lock(); caller_applet) { | ||
| 295 | application_id = caller_applet->program_id; | ||
| 296 | } | ||
| 297 | |||
| 298 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 299 | rb.Push(ResultSuccess); | ||
| 300 | rb.Push(application_id); | ||
| 301 | } | ||
| 302 | |||
| 221 | void ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers(HLERequestContext& ctx) { | 303 | void ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers(HLERequestContext& ctx) { |
| 222 | const Service::Account::ProfileManager manager{}; | 304 | const Service::Account::ProfileManager manager{}; |
| 223 | bool is_empty{true}; | 305 | bool is_empty{true}; |
| @@ -245,4 +327,12 @@ void ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually(HLERequestContext | |||
| 245 | rb.Push<u8>(0); | 327 | rb.Push<u8>(0); |
| 246 | } | 328 | } |
| 247 | 329 | ||
| 330 | void ILibraryAppletSelfAccessor::Cmd160(HLERequestContext& ctx) { | ||
| 331 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 332 | |||
| 333 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 334 | rb.Push(ResultSuccess); | ||
| 335 | rb.Push<u64>(0); | ||
| 336 | } | ||
| 337 | |||
| 248 | } // namespace Service::AM | 338 | } // namespace Service::AM |
diff --git a/src/core/hle/service/am/library_applet_self_accessor.h b/src/core/hle/service/am/library_applet_self_accessor.h index 596cea0df..8717a989a 100644 --- a/src/core/hle/service/am/library_applet_self_accessor.h +++ b/src/core/hle/service/am/library_applet_self_accessor.h | |||
| @@ -27,11 +27,15 @@ private: | |||
| 27 | void GetPopInteractiveInDataEvent(HLERequestContext& ctx); | 27 | void GetPopInteractiveInDataEvent(HLERequestContext& ctx); |
| 28 | void GetLibraryAppletInfo(HLERequestContext& ctx); | 28 | void GetLibraryAppletInfo(HLERequestContext& ctx); |
| 29 | void GetMainAppletIdentityInfo(HLERequestContext& ctx); | 29 | void GetMainAppletIdentityInfo(HLERequestContext& ctx); |
| 30 | void CanUseApplicationCore(HLERequestContext& ctx); | ||
| 30 | void ExitProcessAndReturn(HLERequestContext& ctx); | 31 | void ExitProcessAndReturn(HLERequestContext& ctx); |
| 31 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); | 32 | void GetCallerAppletIdentityInfo(HLERequestContext& ctx); |
| 32 | void GetDesirableKeyboardLayout(HLERequestContext& ctx); | 33 | void GetDesirableKeyboardLayout(HLERequestContext& ctx); |
| 34 | void GetMainAppletApplicationDesiredLanguage(HLERequestContext& ctx); | ||
| 35 | void GetCurrentApplicationId(HLERequestContext& ctx); | ||
| 33 | void GetMainAppletAvailableUsers(HLERequestContext& ctx); | 36 | void GetMainAppletAvailableUsers(HLERequestContext& ctx); |
| 34 | void ShouldSetGpuTimeSliceManually(HLERequestContext& ctx); | 37 | void ShouldSetGpuTimeSliceManually(HLERequestContext& ctx); |
| 38 | void Cmd160(HLERequestContext& ctx); | ||
| 35 | 39 | ||
| 36 | const std::shared_ptr<Applet> applet; | 40 | const std::shared_ptr<Applet> applet; |
| 37 | const std::shared_ptr<AppletDataBroker> broker; | 41 | const std::shared_ptr<AppletDataBroker> broker; |
diff --git a/src/core/hle/service/am/self_controller.cpp b/src/core/hle/service/am/self_controller.cpp index 3ac967b4d..0289f5cf1 100644 --- a/src/core/hle/service/am/self_controller.cpp +++ b/src/core/hle/service/am/self_controller.cpp | |||
| @@ -30,7 +30,7 @@ ISelfController::ISelfController(Core::System& system_, std::shared_ptr<Applet> | |||
| 30 | {12, &ISelfController::SetPerformanceModeChangedNotification, "SetPerformanceModeChangedNotification"}, | 30 | {12, &ISelfController::SetPerformanceModeChangedNotification, "SetPerformanceModeChangedNotification"}, |
| 31 | {13, &ISelfController::SetFocusHandlingMode, "SetFocusHandlingMode"}, | 31 | {13, &ISelfController::SetFocusHandlingMode, "SetFocusHandlingMode"}, |
| 32 | {14, &ISelfController::SetRestartMessageEnabled, "SetRestartMessageEnabled"}, | 32 | {14, &ISelfController::SetRestartMessageEnabled, "SetRestartMessageEnabled"}, |
| 33 | {15, nullptr, "SetScreenShotAppletIdentityInfo"}, | 33 | {15, &ISelfController::SetScreenShotAppletIdentityInfo, "SetScreenShotAppletIdentityInfo"}, |
| 34 | {16, &ISelfController::SetOutOfFocusSuspendingEnabled, "SetOutOfFocusSuspendingEnabled"}, | 34 | {16, &ISelfController::SetOutOfFocusSuspendingEnabled, "SetOutOfFocusSuspendingEnabled"}, |
| 35 | {17, nullptr, "SetControllerFirmwareUpdateSection"}, | 35 | {17, nullptr, "SetControllerFirmwareUpdateSection"}, |
| 36 | {18, nullptr, "SetRequiresCaptureButtonShortPressedMessage"}, | 36 | {18, nullptr, "SetRequiresCaptureButtonShortPressedMessage"}, |
| @@ -207,6 +207,17 @@ void ISelfController::SetRestartMessageEnabled(HLERequestContext& ctx) { | |||
| 207 | rb.Push(ResultSuccess); | 207 | rb.Push(ResultSuccess); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | void ISelfController::SetScreenShotAppletIdentityInfo(HLERequestContext& ctx) { | ||
| 211 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 212 | |||
| 213 | IPC::RequestParser rp{ctx}; | ||
| 214 | std::scoped_lock lk{applet->lock}; | ||
| 215 | applet->screen_shot_identity = rp.PopRaw<AppletIdentityInfo>(); | ||
| 216 | |||
| 217 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 218 | rb.Push(ResultSuccess); | ||
| 219 | } | ||
| 220 | |||
| 210 | void ISelfController::SetOutOfFocusSuspendingEnabled(HLERequestContext& ctx) { | 221 | void ISelfController::SetOutOfFocusSuspendingEnabled(HLERequestContext& ctx) { |
| 211 | IPC::RequestParser rp{ctx}; | 222 | IPC::RequestParser rp{ctx}; |
| 212 | 223 | ||
diff --git a/src/core/hle/service/am/self_controller.h b/src/core/hle/service/am/self_controller.h index 6e6975264..a63bc2e74 100644 --- a/src/core/hle/service/am/self_controller.h +++ b/src/core/hle/service/am/self_controller.h | |||
| @@ -28,6 +28,7 @@ private: | |||
| 28 | void SetPerformanceModeChangedNotification(HLERequestContext& ctx); | 28 | void SetPerformanceModeChangedNotification(HLERequestContext& ctx); |
| 29 | void SetFocusHandlingMode(HLERequestContext& ctx); | 29 | void SetFocusHandlingMode(HLERequestContext& ctx); |
| 30 | void SetRestartMessageEnabled(HLERequestContext& ctx); | 30 | void SetRestartMessageEnabled(HLERequestContext& ctx); |
| 31 | void SetScreenShotAppletIdentityInfo(HLERequestContext& ctx); | ||
| 31 | void SetOutOfFocusSuspendingEnabled(HLERequestContext& ctx); | 32 | void SetOutOfFocusSuspendingEnabled(HLERequestContext& ctx); |
| 32 | void SetAlbumImageOrientation(HLERequestContext& ctx); | 33 | void SetAlbumImageOrientation(HLERequestContext& ctx); |
| 33 | void IsSystemBufferSharingEnabled(HLERequestContext& ctx); | 34 | void IsSystemBufferSharingEnabled(HLERequestContext& ctx); |
diff --git a/src/core/hle/service/am/system_applet_proxy.cpp b/src/core/hle/service/am/system_applet_proxy.cpp index e3013271b..38643408e 100644 --- a/src/core/hle/service/am/system_applet_proxy.cpp +++ b/src/core/hle/service/am/system_applet_proxy.cpp | |||
| @@ -82,7 +82,7 @@ void ISystemAppletProxy::GetDisplayController(HLERequestContext& ctx) { | |||
| 82 | 82 | ||
| 83 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 83 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 84 | rb.Push(ResultSuccess); | 84 | rb.Push(ResultSuccess); |
| 85 | rb.PushIpcInterface<IDisplayController>(system); | 85 | rb.PushIpcInterface<IDisplayController>(system, applet); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | void ISystemAppletProxy::GetLibraryAppletCreator(HLERequestContext& ctx) { | 88 | void ISystemAppletProxy::GetLibraryAppletCreator(HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/am/system_buffer_manager.cpp b/src/core/hle/service/am/system_buffer_manager.cpp index 7211ef488..60a9afc9d 100644 --- a/src/core/hle/service/am/system_buffer_manager.cpp +++ b/src/core/hle/service/am/system_buffer_manager.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include "core/hle/service/am/system_buffer_manager.h" | 4 | #include "core/hle/service/am/system_buffer_manager.h" |
| 5 | #include "core/hle/service/nvnflinger/fb_share_buffer_manager.h" | 5 | #include "core/hle/service/nvnflinger/fb_share_buffer_manager.h" |
| 6 | #include "core/hle/service/nvnflinger/nvnflinger.h" | 6 | #include "core/hle/service/nvnflinger/nvnflinger.h" |
| 7 | #include "core/hle/service/vi/vi_results.h" | ||
| 7 | 8 | ||
| 8 | namespace Service::AM { | 9 | namespace Service::AM { |
| 9 | 10 | ||
| @@ -41,9 +42,28 @@ bool SystemBufferManager::Initialize(Nvnflinger::Nvnflinger* nvnflinger, Kernel: | |||
| 41 | 42 | ||
| 42 | if (res.IsSuccess()) { | 43 | if (res.IsSuccess()) { |
| 43 | m_buffer_sharing_enabled = true; | 44 | m_buffer_sharing_enabled = true; |
| 45 | m_nvnflinger->SetLayerVisibility(m_system_shared_layer_id, m_visible); | ||
| 44 | } | 46 | } |
| 45 | 47 | ||
| 46 | return m_buffer_sharing_enabled; | 48 | return m_buffer_sharing_enabled; |
| 47 | } | 49 | } |
| 48 | 50 | ||
| 51 | void SystemBufferManager::SetWindowVisibility(bool visible) { | ||
| 52 | if (m_visible == visible) { | ||
| 53 | return; | ||
| 54 | } | ||
| 55 | |||
| 56 | m_visible = visible; | ||
| 57 | |||
| 58 | if (m_nvnflinger) { | ||
| 59 | m_nvnflinger->SetLayerVisibility(m_system_shared_layer_id, m_visible); | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | Result SystemBufferManager::WriteAppletCaptureBuffer(bool* out_was_written, | ||
| 64 | s32* out_fbshare_layer_index) { | ||
| 65 | // TODO | ||
| 66 | R_SUCCEED(); | ||
| 67 | } | ||
| 68 | |||
| 49 | } // namespace Service::AM | 69 | } // namespace Service::AM |
diff --git a/src/core/hle/service/am/system_buffer_manager.h b/src/core/hle/service/am/system_buffer_manager.h index c60d73416..98c3cf055 100644 --- a/src/core/hle/service/am/system_buffer_manager.h +++ b/src/core/hle/service/am/system_buffer_manager.h | |||
| @@ -18,6 +18,8 @@ namespace Service::Nvnflinger { | |||
| 18 | class Nvnflinger; | 18 | class Nvnflinger; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | union Result; | ||
| 22 | |||
| 21 | namespace Service::AM { | 23 | namespace Service::AM { |
| 22 | 24 | ||
| 23 | class SystemBufferManager { | 25 | class SystemBufferManager { |
| @@ -33,10 +35,15 @@ public: | |||
| 33 | *out_system_shared_layer_id = m_system_shared_layer_id; | 35 | *out_system_shared_layer_id = m_system_shared_layer_id; |
| 34 | } | 36 | } |
| 35 | 37 | ||
| 38 | void SetWindowVisibility(bool visible); | ||
| 39 | |||
| 40 | Result WriteAppletCaptureBuffer(bool* out_was_written, s32* out_fbshare_layer_index); | ||
| 41 | |||
| 36 | private: | 42 | private: |
| 37 | Kernel::KProcess* m_process{}; | 43 | Kernel::KProcess* m_process{}; |
| 38 | Nvnflinger::Nvnflinger* m_nvnflinger{}; | 44 | Nvnflinger::Nvnflinger* m_nvnflinger{}; |
| 39 | bool m_buffer_sharing_enabled{}; | 45 | bool m_buffer_sharing_enabled{}; |
| 46 | bool m_visible{true}; | ||
| 40 | u64 m_system_shared_buffer_id{}; | 47 | u64 m_system_shared_buffer_id{}; |
| 41 | u64 m_system_shared_layer_id{}; | 48 | u64 m_system_shared_layer_id{}; |
| 42 | }; | 49 | }; |
diff --git a/src/core/hle/service/am/window_controller.cpp b/src/core/hle/service/am/window_controller.cpp index 430ca180b..f00957f83 100644 --- a/src/core/hle/service/am/window_controller.cpp +++ b/src/core/hle/service/am/window_controller.cpp | |||
| @@ -17,8 +17,8 @@ IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Appl | |||
| 17 | {10, &IWindowController::AcquireForegroundRights, "AcquireForegroundRights"}, | 17 | {10, &IWindowController::AcquireForegroundRights, "AcquireForegroundRights"}, |
| 18 | {11, nullptr, "ReleaseForegroundRights"}, | 18 | {11, nullptr, "ReleaseForegroundRights"}, |
| 19 | {12, nullptr, "RejectToChangeIntoBackground"}, | 19 | {12, nullptr, "RejectToChangeIntoBackground"}, |
| 20 | {20, nullptr, "SetAppletWindowVisibility"}, | 20 | {20, &IWindowController::SetAppletWindowVisibility, "SetAppletWindowVisibility"}, |
| 21 | {21, nullptr, "SetAppletGpuTimeSlice"}, | 21 | {21, &IWindowController::SetAppletGpuTimeSlice, "SetAppletGpuTimeSlice"}, |
| 22 | }; | 22 | }; |
| 23 | // clang-format on | 23 | // clang-format on |
| 24 | 24 | ||
| @@ -52,4 +52,35 @@ void IWindowController::AcquireForegroundRights(HLERequestContext& ctx) { | |||
| 52 | rb.Push(ResultSuccess); | 52 | rb.Push(ResultSuccess); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | void IWindowController::SetAppletWindowVisibility(HLERequestContext& ctx) { | ||
| 56 | LOG_INFO(Service_AM, "called"); | ||
| 57 | |||
| 58 | IPC::RequestParser rp{ctx}; | ||
| 59 | const bool visible = rp.Pop<bool>(); | ||
| 60 | |||
| 61 | applet->system_buffer_manager.SetWindowVisibility(visible); | ||
| 62 | applet->hid_registration.EnableAppletToGetInput(visible); | ||
| 63 | |||
| 64 | if (visible) { | ||
| 65 | applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::ChangeIntoForeground); | ||
| 66 | applet->focus_state = FocusState::InFocus; | ||
| 67 | } else { | ||
| 68 | applet->focus_state = FocusState::NotInFocus; | ||
| 69 | } | ||
| 70 | applet->message_queue.PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); | ||
| 71 | |||
| 72 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 73 | rb.Push(ResultSuccess); | ||
| 74 | } | ||
| 75 | |||
| 76 | void IWindowController::SetAppletGpuTimeSlice(HLERequestContext& ctx) { | ||
| 77 | IPC::RequestParser rp{ctx}; | ||
| 78 | const auto time_slice = rp.Pop<s64>(); | ||
| 79 | |||
| 80 | LOG_WARNING(Service_AM, "(STUBBED) called, time_slice={}", time_slice); | ||
| 81 | |||
| 82 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 83 | rb.Push(ResultSuccess); | ||
| 84 | } | ||
| 85 | |||
| 55 | } // namespace Service::AM | 86 | } // namespace Service::AM |
diff --git a/src/core/hle/service/am/window_controller.h b/src/core/hle/service/am/window_controller.h index d97f93737..a28219abe 100644 --- a/src/core/hle/service/am/window_controller.h +++ b/src/core/hle/service/am/window_controller.h | |||
| @@ -18,6 +18,8 @@ private: | |||
| 18 | void GetAppletResourceUserId(HLERequestContext& ctx); | 18 | void GetAppletResourceUserId(HLERequestContext& ctx); |
| 19 | void GetAppletResourceUserIdOfCallerApplet(HLERequestContext& ctx); | 19 | void GetAppletResourceUserIdOfCallerApplet(HLERequestContext& ctx); |
| 20 | void AcquireForegroundRights(HLERequestContext& ctx); | 20 | void AcquireForegroundRights(HLERequestContext& ctx); |
| 21 | void SetAppletWindowVisibility(HLERequestContext& ctx); | ||
| 22 | void SetAppletGpuTimeSlice(HLERequestContext& ctx); | ||
| 21 | 23 | ||
| 22 | const std::shared_ptr<Applet> applet; | 24 | const std::shared_ptr<Applet> applet; |
| 23 | }; | 25 | }; |
diff --git a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp index 2be72b021..5fe534c73 100644 --- a/src/core/hle/service/filesystem/fsp/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp/fsp_srv.cpp | |||
| @@ -15,11 +15,13 @@ | |||
| 15 | #include "common/settings.h" | 15 | #include "common/settings.h" |
| 16 | #include "common/string_util.h" | 16 | #include "common/string_util.h" |
| 17 | #include "core/core.h" | 17 | #include "core/core.h" |
| 18 | #include "core/file_sys/content_archive.h" | ||
| 18 | #include "core/file_sys/errors.h" | 19 | #include "core/file_sys/errors.h" |
| 19 | #include "core/file_sys/fs_directory.h" | 20 | #include "core/file_sys/fs_directory.h" |
| 20 | #include "core/file_sys/fs_filesystem.h" | 21 | #include "core/file_sys/fs_filesystem.h" |
| 21 | #include "core/file_sys/nca_metadata.h" | 22 | #include "core/file_sys/nca_metadata.h" |
| 22 | #include "core/file_sys/patch_manager.h" | 23 | #include "core/file_sys/patch_manager.h" |
| 24 | #include "core/file_sys/romfs.h" | ||
| 23 | #include "core/file_sys/romfs_factory.h" | 25 | #include "core/file_sys/romfs_factory.h" |
| 24 | #include "core/file_sys/savedata_factory.h" | 26 | #include "core/file_sys/savedata_factory.h" |
| 25 | #include "core/file_sys/system_archive/system_archive.h" | 27 | #include "core/file_sys/system_archive/system_archive.h" |
| @@ -33,18 +35,20 @@ | |||
| 33 | #include "core/hle/service/filesystem/save_data_controller.h" | 35 | #include "core/hle/service/filesystem/save_data_controller.h" |
| 34 | #include "core/hle/service/hle_ipc.h" | 36 | #include "core/hle/service/hle_ipc.h" |
| 35 | #include "core/hle/service/ipc_helpers.h" | 37 | #include "core/hle/service/ipc_helpers.h" |
| 38 | #include "core/loader/loader.h" | ||
| 36 | #include "core/reporter.h" | 39 | #include "core/reporter.h" |
| 37 | 40 | ||
| 38 | namespace Service::FileSystem { | 41 | namespace Service::FileSystem { |
| 39 | enum class FileSystemType : u8 { | 42 | enum class FileSystemProxyType : u8 { |
| 40 | Invalid0 = 0, | 43 | Code = 0, |
| 41 | Invalid1 = 1, | 44 | Rom = 1, |
| 42 | Logo = 2, | 45 | Logo = 2, |
| 43 | ContentControl = 3, | 46 | Control = 3, |
| 44 | ContentManual = 4, | 47 | Manual = 4, |
| 45 | ContentMeta = 5, | 48 | Meta = 5, |
| 46 | ContentData = 6, | 49 | Data = 6, |
| 47 | ApplicationPackage = 7, | 50 | Package = 7, |
| 51 | RegisteredUpdate = 8, | ||
| 48 | }; | 52 | }; |
| 49 | 53 | ||
| 50 | class ISaveDataInfoReader final : public ServiceFramework<ISaveDataInfoReader> { | 54 | class ISaveDataInfoReader final : public ServiceFramework<ISaveDataInfoReader> { |
| @@ -357,12 +361,30 @@ void FSP_SRV::SetCurrentProcess(HLERequestContext& ctx) { | |||
| 357 | void FSP_SRV::OpenFileSystemWithPatch(HLERequestContext& ctx) { | 361 | void FSP_SRV::OpenFileSystemWithPatch(HLERequestContext& ctx) { |
| 358 | IPC::RequestParser rp{ctx}; | 362 | IPC::RequestParser rp{ctx}; |
| 359 | 363 | ||
| 360 | const auto type = rp.PopRaw<FileSystemType>(); | 364 | struct InputParameters { |
| 361 | const auto title_id = rp.PopRaw<u64>(); | 365 | FileSystemProxyType type; |
| 362 | LOG_WARNING(Service_FS, "(STUBBED) called with type={}, title_id={:016X}", type, title_id); | 366 | u64 program_id; |
| 367 | }; | ||
| 368 | static_assert(sizeof(InputParameters) == 0x10, "InputParameters has wrong size"); | ||
| 369 | |||
| 370 | const auto params = rp.PopRaw<InputParameters>(); | ||
| 371 | LOG_ERROR(Service_FS, "(STUBBED) called with type={}, program_id={:016X}", params.type, | ||
| 372 | params.program_id); | ||
| 373 | |||
| 374 | // FIXME: many issues with this | ||
| 375 | ASSERT(params.type == FileSystemProxyType::Manual); | ||
| 376 | const auto manual_romfs = romfs_controller->OpenPatchedRomFS( | ||
| 377 | params.program_id, FileSys::ContentRecordType::HtmlDocument); | ||
| 363 | 378 | ||
| 364 | IPC::ResponseBuilder rb{ctx, 2, 0, 0}; | 379 | ASSERT(manual_romfs != nullptr); |
| 365 | rb.Push(ResultUnknown); | 380 | |
| 381 | const auto extracted_romfs = FileSys::ExtractRomFS(manual_romfs); | ||
| 382 | ASSERT(extracted_romfs != nullptr); | ||
| 383 | |||
| 384 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 385 | rb.Push(ResultSuccess); | ||
| 386 | rb.PushIpcInterface<IFileSystem>(system, extracted_romfs, | ||
| 387 | SizeGetter::FromStorageId(fsc, FileSys::StorageId::NandUser)); | ||
| 366 | } | 388 | } |
| 367 | 389 | ||
| 368 | void FSP_SRV::OpenSdCardFileSystem(HLERequestContext& ctx) { | 390 | void FSP_SRV::OpenSdCardFileSystem(HLERequestContext& ctx) { |
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 22dc55a6d..8e3224f73 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp | |||
| @@ -185,7 +185,7 @@ public: | |||
| 185 | {3, &IRequest::Cancel, "Cancel"}, | 185 | {3, &IRequest::Cancel, "Cancel"}, |
| 186 | {4, &IRequest::Submit, "Submit"}, | 186 | {4, &IRequest::Submit, "Submit"}, |
| 187 | {5, nullptr, "SetRequirement"}, | 187 | {5, nullptr, "SetRequirement"}, |
| 188 | {6, nullptr, "SetRequirementPreset"}, | 188 | {6, &IRequest::SetRequirementPreset, "SetRequirementPreset"}, |
| 189 | {8, nullptr, "SetPriority"}, | 189 | {8, nullptr, "SetPriority"}, |
| 190 | {9, nullptr, "SetNetworkProfileId"}, | 190 | {9, nullptr, "SetNetworkProfileId"}, |
| 191 | {10, nullptr, "SetRejectable"}, | 191 | {10, nullptr, "SetRejectable"}, |
| @@ -237,6 +237,16 @@ private: | |||
| 237 | rb.PushEnum(state); | 237 | rb.PushEnum(state); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | void SetRequirementPreset(HLERequestContext& ctx) { | ||
| 241 | IPC::RequestParser rp{ctx}; | ||
| 242 | const auto param_1 = rp.Pop<u32>(); | ||
| 243 | |||
| 244 | LOG_WARNING(Service_NIFM, "(STUBBED) called, param_1={}", param_1); | ||
| 245 | |||
| 246 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 247 | rb.Push(ResultSuccess); | ||
| 248 | } | ||
| 249 | |||
| 240 | void GetResult(HLERequestContext& ctx) { | 250 | void GetResult(HLERequestContext& ctx) { |
| 241 | LOG_DEBUG(Service_NIFM, "(STUBBED) called"); | 251 | LOG_DEBUG(Service_NIFM, "(STUBBED) called"); |
| 242 | 252 | ||
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 2258ee609..19c3ff01b 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "common/logging/log.h" | 4 | #include "common/logging/log.h" |
| 5 | #include "common/settings.h" | 5 | #include "common/settings.h" |
| 6 | #include "core/arm/debug.h" | ||
| 6 | #include "core/core.h" | 7 | #include "core/core.h" |
| 7 | #include "core/file_sys/control_metadata.h" | 8 | #include "core/file_sys/control_metadata.h" |
| 8 | #include "core/file_sys/patch_manager.h" | 9 | #include "core/file_sys/patch_manager.h" |
| @@ -544,8 +545,8 @@ IDocumentInterface::IDocumentInterface(Core::System& system_) | |||
| 544 | // clang-format off | 545 | // clang-format off |
| 545 | static const FunctionInfo functions[] = { | 546 | static const FunctionInfo functions[] = { |
| 546 | {21, nullptr, "GetApplicationContentPath"}, | 547 | {21, nullptr, "GetApplicationContentPath"}, |
| 547 | {23, nullptr, "ResolveApplicationContentPath"}, | 548 | {23, &IDocumentInterface::ResolveApplicationContentPath, "ResolveApplicationContentPath"}, |
| 548 | {93, nullptr, "GetRunningApplicationProgramId"}, | 549 | {92, &IDocumentInterface::GetRunningApplicationProgramId, "GetRunningApplicationProgramId"}, |
| 549 | }; | 550 | }; |
| 550 | // clang-format on | 551 | // clang-format on |
| 551 | 552 | ||
| @@ -554,6 +555,32 @@ IDocumentInterface::IDocumentInterface(Core::System& system_) | |||
| 554 | 555 | ||
| 555 | IDocumentInterface::~IDocumentInterface() = default; | 556 | IDocumentInterface::~IDocumentInterface() = default; |
| 556 | 557 | ||
| 558 | void IDocumentInterface::ResolveApplicationContentPath(HLERequestContext& ctx) { | ||
| 559 | struct ContentPath { | ||
| 560 | u8 file_system_proxy_type; | ||
| 561 | u64 program_id; | ||
| 562 | }; | ||
| 563 | static_assert(sizeof(ContentPath) == 0x10, "ContentPath has wrong size"); | ||
| 564 | |||
| 565 | IPC::RequestParser rp{ctx}; | ||
| 566 | auto content_path = rp.PopRaw<ContentPath>(); | ||
| 567 | LOG_WARNING(Service_NS, "(STUBBED) called, file_system_proxy_type={}, program_id={:016X}", | ||
| 568 | content_path.file_system_proxy_type, content_path.program_id); | ||
| 569 | |||
| 570 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 571 | rb.Push(ResultSuccess); | ||
| 572 | } | ||
| 573 | |||
| 574 | void IDocumentInterface::GetRunningApplicationProgramId(HLERequestContext& ctx) { | ||
| 575 | IPC::RequestParser rp{ctx}; | ||
| 576 | const auto caller_program_id = rp.PopRaw<u64>(); | ||
| 577 | LOG_WARNING(Service_NS, "(STUBBED) called, caller_program_id={:016X}", caller_program_id); | ||
| 578 | |||
| 579 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 580 | rb.Push(ResultSuccess); | ||
| 581 | rb.Push<u64>(system.GetApplicationProcessProgramID()); | ||
| 582 | } | ||
| 583 | |||
| 557 | IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) | 584 | IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) |
| 558 | : ServiceFramework{system_, "IDownloadTaskInterface"} { | 585 | : ServiceFramework{system_, "IDownloadTaskInterface"} { |
| 559 | // clang-format off | 586 | // clang-format off |
| @@ -613,6 +640,40 @@ IFactoryResetInterface::IFactoryResetInterface(Core::System& system_) | |||
| 613 | 640 | ||
| 614 | IFactoryResetInterface::~IFactoryResetInterface() = default; | 641 | IFactoryResetInterface::~IFactoryResetInterface() = default; |
| 615 | 642 | ||
| 643 | IReadOnlyApplicationRecordInterface::IReadOnlyApplicationRecordInterface(Core::System& system_) | ||
| 644 | : ServiceFramework{system_, "IReadOnlyApplicationRecordInterface"} { | ||
| 645 | static const FunctionInfo functions[] = { | ||
| 646 | {0, &IReadOnlyApplicationRecordInterface::HasApplicationRecord, "HasApplicationRecord"}, | ||
| 647 | {1, nullptr, "NotifyApplicationFailure"}, | ||
| 648 | {2, &IReadOnlyApplicationRecordInterface::IsDataCorruptedResult, "IsDataCorruptedResult"}, | ||
| 649 | }; | ||
| 650 | // clang-format on | ||
| 651 | |||
| 652 | RegisterHandlers(functions); | ||
| 653 | } | ||
| 654 | |||
| 655 | IReadOnlyApplicationRecordInterface::~IReadOnlyApplicationRecordInterface() = default; | ||
| 656 | |||
| 657 | void IReadOnlyApplicationRecordInterface::HasApplicationRecord(HLERequestContext& ctx) { | ||
| 658 | IPC::RequestParser rp{ctx}; | ||
| 659 | const u64 program_id = rp.PopRaw<u64>(); | ||
| 660 | LOG_WARNING(Service_NS, "(STUBBED) called, program_id={:X}", program_id); | ||
| 661 | |||
| 662 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 663 | rb.Push(ResultSuccess); | ||
| 664 | rb.Push<u8>(1); | ||
| 665 | } | ||
| 666 | |||
| 667 | void IReadOnlyApplicationRecordInterface::IsDataCorruptedResult(HLERequestContext& ctx) { | ||
| 668 | IPC::RequestParser rp{ctx}; | ||
| 669 | const auto result = rp.PopRaw<Result>(); | ||
| 670 | LOG_WARNING(Service_NS, "(STUBBED) called, result={:#x}", result.GetInnerValue()); | ||
| 671 | |||
| 672 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 673 | rb.Push(ResultSuccess); | ||
| 674 | rb.Push<u8>(0); | ||
| 675 | } | ||
| 676 | |||
| 616 | IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterface( | 677 | IReadOnlyApplicationControlDataInterface::IReadOnlyApplicationControlDataInterface( |
| 617 | Core::System& system_) | 678 | Core::System& system_) |
| 618 | : ServiceFramework{system_, "IReadOnlyApplicationControlDataInterface"} { | 679 | : ServiceFramework{system_, "IReadOnlyApplicationControlDataInterface"} { |
| @@ -663,7 +724,7 @@ NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name | |||
| 663 | static const FunctionInfo functions[] = { | 724 | static const FunctionInfo functions[] = { |
| 664 | {7988, nullptr, "GetDynamicRightsInterface"}, | 725 | {7988, nullptr, "GetDynamicRightsInterface"}, |
| 665 | {7989, &NS::PushInterface<IReadOnlyApplicationControlDataInterface>, "GetReadOnlyApplicationControlDataInterface"}, | 726 | {7989, &NS::PushInterface<IReadOnlyApplicationControlDataInterface>, "GetReadOnlyApplicationControlDataInterface"}, |
| 666 | {7991, nullptr, "GetReadOnlyApplicationRecordInterface"}, | 727 | {7991, &NS::PushInterface<IReadOnlyApplicationRecordInterface>, "GetReadOnlyApplicationRecordInterface"}, |
| 667 | {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, | 728 | {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, |
| 668 | {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, | 729 | {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, |
| 669 | {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"}, | 730 | {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"}, |
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 34d2a45dc..9ee306ef9 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h | |||
| @@ -58,6 +58,10 @@ class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { | |||
| 58 | public: | 58 | public: |
| 59 | explicit IDocumentInterface(Core::System& system_); | 59 | explicit IDocumentInterface(Core::System& system_); |
| 60 | ~IDocumentInterface() override; | 60 | ~IDocumentInterface() override; |
| 61 | |||
| 62 | private: | ||
| 63 | void ResolveApplicationContentPath(HLERequestContext& ctx); | ||
| 64 | void GetRunningApplicationProgramId(HLERequestContext& ctx); | ||
| 61 | }; | 65 | }; |
| 62 | 66 | ||
| 63 | class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { | 67 | class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { |
| @@ -78,6 +82,17 @@ public: | |||
| 78 | ~IFactoryResetInterface() override; | 82 | ~IFactoryResetInterface() override; |
| 79 | }; | 83 | }; |
| 80 | 84 | ||
| 85 | class IReadOnlyApplicationRecordInterface final | ||
| 86 | : public ServiceFramework<IReadOnlyApplicationRecordInterface> { | ||
| 87 | public: | ||
| 88 | explicit IReadOnlyApplicationRecordInterface(Core::System& system_); | ||
| 89 | ~IReadOnlyApplicationRecordInterface() override; | ||
| 90 | |||
| 91 | private: | ||
| 92 | void HasApplicationRecord(HLERequestContext& ctx); | ||
| 93 | void IsDataCorruptedResult(HLERequestContext& ctx); | ||
| 94 | }; | ||
| 95 | |||
| 81 | class IReadOnlyApplicationControlDataInterface final | 96 | class IReadOnlyApplicationControlDataInterface final |
| 82 | : public ServiceFramework<IReadOnlyApplicationControlDataInterface> { | 97 | : public ServiceFramework<IReadOnlyApplicationControlDataInterface> { |
| 83 | public: | 98 | public: |
diff --git a/src/core/hle/service/nvnflinger/nvnflinger.cpp b/src/core/hle/service/nvnflinger/nvnflinger.cpp index 71d6fdb0c..51133853c 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.cpp +++ b/src/core/hle/service/nvnflinger/nvnflinger.cpp | |||
| @@ -198,6 +198,16 @@ bool Nvnflinger::CloseLayer(u64 layer_id) { | |||
| 198 | return false; | 198 | return false; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | void Nvnflinger::SetLayerVisibility(u64 layer_id, bool visible) { | ||
| 202 | const auto lock_guard = Lock(); | ||
| 203 | |||
| 204 | for (auto& display : displays) { | ||
| 205 | if (auto* layer = display.FindLayer(layer_id); layer) { | ||
| 206 | layer->SetVisibility(visible); | ||
| 207 | } | ||
| 208 | } | ||
| 209 | } | ||
| 210 | |||
| 201 | void Nvnflinger::DestroyLayer(u64 layer_id) { | 211 | void Nvnflinger::DestroyLayer(u64 layer_id) { |
| 202 | const auto lock_guard = Lock(); | 212 | const auto lock_guard = Lock(); |
| 203 | 213 | ||
diff --git a/src/core/hle/service/nvnflinger/nvnflinger.h b/src/core/hle/service/nvnflinger/nvnflinger.h index a60e0ae6b..369439142 100644 --- a/src/core/hle/service/nvnflinger/nvnflinger.h +++ b/src/core/hle/service/nvnflinger/nvnflinger.h | |||
| @@ -79,6 +79,9 @@ public: | |||
| 79 | /// Closes a layer on all displays for the given layer ID. | 79 | /// Closes a layer on all displays for the given layer ID. |
| 80 | bool CloseLayer(u64 layer_id); | 80 | bool CloseLayer(u64 layer_id); |
| 81 | 81 | ||
| 82 | /// Makes a layer visible on all displays for the given layer ID. | ||
| 83 | void SetLayerVisibility(u64 layer_id, bool visible); | ||
| 84 | |||
| 82 | /// Destroys the given layer ID. | 85 | /// Destroys the given layer ID. |
| 83 | void DestroyLayer(u64 layer_id); | 86 | void DestroyLayer(u64 layer_id); |
| 84 | 87 | ||
diff --git a/src/core/hle/service/vi/display/vi_display.cpp b/src/core/hle/service/vi/display/vi_display.cpp index 725311c53..dab1905cc 100644 --- a/src/core/hle/service/vi/display/vi_display.cpp +++ b/src/core/hle/service/vi/display/vi_display.cpp | |||
| @@ -53,7 +53,7 @@ Display::~Display() { | |||
| 53 | Layer& Display::GetLayer(std::size_t index) { | 53 | Layer& Display::GetLayer(std::size_t index) { |
| 54 | size_t i = 0; | 54 | size_t i = 0; |
| 55 | for (auto& layer : layers) { | 55 | for (auto& layer : layers) { |
| 56 | if (!layer->IsOpen()) { | 56 | if (!layer->IsOpen() || !layer->IsVisible()) { |
| 57 | continue; | 57 | continue; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| @@ -68,7 +68,7 @@ Layer& Display::GetLayer(std::size_t index) { | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | size_t Display::GetNumLayers() const { | 70 | size_t Display::GetNumLayers() const { |
| 71 | return std::ranges::count_if(layers, [](auto& l) { return l->IsOpen(); }); | 71 | return std::ranges::count_if(layers, [](auto& l) { return l->IsOpen() && l->IsVisible(); }); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | Kernel::KReadableEvent* Display::GetVSyncEvent() { | 74 | Kernel::KReadableEvent* Display::GetVSyncEvent() { |
diff --git a/src/core/hle/service/vi/layer/vi_layer.cpp b/src/core/hle/service/vi/layer/vi_layer.cpp index 04e52a23b..493bd6e9e 100644 --- a/src/core/hle/service/vi/layer/vi_layer.cpp +++ b/src/core/hle/service/vi/layer/vi_layer.cpp | |||
| @@ -9,7 +9,7 @@ Layer::Layer(u64 layer_id_, u32 binder_id_, android::BufferQueueCore& core_, | |||
| 9 | android::BufferQueueProducer& binder_, | 9 | android::BufferQueueProducer& binder_, |
| 10 | std::shared_ptr<android::BufferItemConsumer>&& consumer_) | 10 | std::shared_ptr<android::BufferItemConsumer>&& consumer_) |
| 11 | : layer_id{layer_id_}, binder_id{binder_id_}, core{core_}, binder{binder_}, | 11 | : layer_id{layer_id_}, binder_id{binder_id_}, core{core_}, binder{binder_}, |
| 12 | consumer{std::move(consumer_)}, open{false} {} | 12 | consumer{std::move(consumer_)}, open{false}, visible{true} {} |
| 13 | 13 | ||
| 14 | Layer::~Layer() = default; | 14 | Layer::~Layer() = default; |
| 15 | 15 | ||
diff --git a/src/core/hle/service/vi/layer/vi_layer.h b/src/core/hle/service/vi/layer/vi_layer.h index f95e2dc71..b4b031ee7 100644 --- a/src/core/hle/service/vi/layer/vi_layer.h +++ b/src/core/hle/service/vi/layer/vi_layer.h | |||
| @@ -72,6 +72,14 @@ public: | |||
| 72 | return core; | 72 | return core; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | bool IsVisible() const { | ||
| 76 | return visible; | ||
| 77 | } | ||
| 78 | |||
| 79 | void SetVisibility(bool v) { | ||
| 80 | visible = v; | ||
| 81 | } | ||
| 82 | |||
| 75 | bool IsOpen() const { | 83 | bool IsOpen() const { |
| 76 | return open; | 84 | return open; |
| 77 | } | 85 | } |
| @@ -91,6 +99,7 @@ private: | |||
| 91 | android::BufferQueueProducer& binder; | 99 | android::BufferQueueProducer& binder; |
| 92 | std::shared_ptr<android::BufferItemConsumer> consumer; | 100 | std::shared_ptr<android::BufferItemConsumer> consumer; |
| 93 | bool open; | 101 | bool open; |
| 102 | bool visible; | ||
| 94 | }; | 103 | }; |
| 95 | 104 | ||
| 96 | } // namespace Service::VI | 105 | } // namespace Service::VI |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 4e5c4da53..303d84a1f 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -4931,7 +4931,10 @@ void GMainWindow::changeEvent(QEvent* event) { | |||
| 4931 | } | 4931 | } |
| 4932 | 4932 | ||
| 4933 | Service::AM::FrontendAppletParameters GMainWindow::ApplicationAppletParameters() { | 4933 | Service::AM::FrontendAppletParameters GMainWindow::ApplicationAppletParameters() { |
| 4934 | return Service::AM::FrontendAppletParameters{}; | 4934 | return Service::AM::FrontendAppletParameters{ |
| 4935 | .applet_id = Service::AM::AppletId::Application, | ||
| 4936 | .applet_type = Service::AM::AppletType::Application, | ||
| 4937 | }; | ||
| 4935 | } | 4938 | } |
| 4936 | 4939 | ||
| 4937 | Service::AM::FrontendAppletParameters GMainWindow::LibraryAppletParameters( | 4940 | Service::AM::FrontendAppletParameters GMainWindow::LibraryAppletParameters( |