diff options
Diffstat (limited to '')
25 files changed, 617 insertions, 420 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 22999c942..a2375508a 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -11,9 +11,9 @@ #include "core/file_sys/patch_manager.h" #include "core/file_sys/registered_cache.h" #include "core/file_sys/savedata_factory.h" -#include "core/hle/ipc_helpers.h" #include "core/hle/kernel/k_event.h" #include "core/hle/kernel/k_transfer_memory.h" +#include "core/hle/result.h" #include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applet_ae.h" @@ -24,24 +24,25 @@ #include "core/hle/service/am/idle.h" #include "core/hle/service/am/omm.h" #include "core/hle/service/am/spsm.h" -#include "core/hle/service/am/tcap.h" #include "core/hle/service/apm/apm_controller.h" #include "core/hle/service/apm/apm_interface.h" #include "core/hle/service/bcat/backend/backend.h" #include "core/hle/service/caps/caps.h" #include "core/hle/service/filesystem/filesystem.h" +#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/ns/ns.h" -#include "core/hle/service/nvflinger/nvflinger.h" +#include "core/hle/service/nvnflinger/nvnflinger.h" #include "core/hle/service/pm/pm.h" +#include "core/hle/service/server_manager.h" #include "core/hle/service/sm/sm.h" #include "core/hle/service/vi/vi.h" #include "core/memory.h" namespace Service::AM { -constexpr Result ERR_NO_DATA_IN_CHANNEL{ErrorModule::AM, 2}; -constexpr Result ERR_NO_MESSAGES{ErrorModule::AM, 3}; -constexpr Result ERR_SIZE_OUT_OF_BOUNDS{ErrorModule::AM, 503}; +constexpr Result ResultNoDataInChannel{ErrorModule::AM, 2}; +constexpr Result ResultNoMessages{ErrorModule::AM, 3}; +constexpr Result ResultInvalidOffset{ErrorModule::AM, 503}; enum class LaunchParameterKind : u32 { ApplicationSpecific = 1, @@ -78,8 +79,8 @@ IWindowController::IWindowController(Core::System& system_) IWindowController::~IWindowController() = default; -void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) { - const u64 process_id = system.CurrentProcess()->GetProcessID(); +void IWindowController::GetAppletResourceUserId(HLERequestContext& ctx) { + const u64 process_id = system.ApplicationProcess()->GetProcessId(); LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id); @@ -88,7 +89,7 @@ void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) rb.Push<u64>(process_id); } -void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx) { +void IWindowController::AcquireForegroundRights(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); @@ -111,7 +112,7 @@ IAudioController::IAudioController(Core::System& system_) IAudioController::~IAudioController() = default; -void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) { +void IAudioController::SetExpectedMasterVolume(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const float main_applet_volume_tmp = rp.Pop<float>(); const float library_applet_volume_tmp = rp.Pop<float>(); @@ -128,21 +129,21 @@ void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void IAudioController::GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { +void IAudioController::GetMainAppletExpectedMasterVolume(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called. main_applet_volume={}", main_applet_volume); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); rb.Push(main_applet_volume); } -void IAudioController::GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx) { +void IAudioController::GetLibraryAppletExpectedMasterVolume(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called. library_applet_volume={}", library_applet_volume); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); rb.Push(library_applet_volume); } -void IAudioController::ChangeMainAppletMasterVolume(Kernel::HLERequestContext& ctx) { +void IAudioController::ChangeMainAppletMasterVolume(HLERequestContext& ctx) { struct Parameters { float volume; s64 fade_time_ns; @@ -162,7 +163,7 @@ void IAudioController::ChangeMainAppletMasterVolume(Kernel::HLERequestContext& c rb.Push(ResultSuccess); } -void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) { +void IAudioController::SetTransparentAudioRate(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const float transparent_volume_rate_tmp = rp.Pop<float>(); @@ -227,6 +228,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_) {30, nullptr, "RequestLaunchApplicationWithUserAndArgumentForDebug"}, {31, nullptr, "RequestLaunchApplicationByApplicationLaunchInfoForDebug"}, {40, nullptr, "GetAppletResourceUsageInfo"}, + {50, nullptr, "AddSystemProgramIdAndAppletIdForDebug"}, + {51, nullptr, "AddOperationConfirmedLibraryAppletIdForDebug"}, {100, nullptr, "SetCpuBoostModeForApplet"}, {101, nullptr, "CancelCpuBoostModeForApplet"}, {110, nullptr, "PushToAppletBoundChannelForDebug"}, @@ -238,6 +241,8 @@ IDebugFunctions::IDebugFunctions(Core::System& system_) {131, nullptr, "FriendInvitationClearApplicationParameter"}, {132, nullptr, "FriendInvitationPushApplicationParameter"}, {140, nullptr, "RestrictPowerOperationForSecureLaunchModeForDebug"}, + {200, nullptr, "CreateFloatingLibraryAppletAccepterForDebug"}, + {300, nullptr, "TerminateAllRunningApplicationsForDebug"}, {900, nullptr, "GetGrcProcessLaunchedSystemEvent"}, }; // clang-format on @@ -247,10 +252,9 @@ IDebugFunctions::IDebugFunctions(Core::System& system_) IDebugFunctions::~IDebugFunctions() = default; -ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nvflinger_) - : ServiceFramework{system_, "ISelfController"}, nvflinger{nvflinger_}, service_context{ - system, - "ISelfController"} { +ISelfController::ISelfController(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger_) + : ServiceFramework{system_, "ISelfController"}, nvnflinger{nvnflinger_}, + service_context{system, "ISelfController"} { // clang-format off static const FunctionInfo functions[] = { {0, &ISelfController::Exit, "Exit"}, @@ -324,7 +328,7 @@ ISelfController::~ISelfController() { service_context.CloseEvent(accumulated_suspended_tick_changed_event); } -void ISelfController::Exit(Kernel::HLERequestContext& ctx) { +void ISelfController::Exit(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2}; @@ -333,7 +337,7 @@ void ISelfController::Exit(Kernel::HLERequestContext& ctx) { system.Exit(); } -void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { +void ISelfController::LockExit(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); system.SetExitLock(true); @@ -342,7 +346,7 @@ void ISelfController::LockExit(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { +void ISelfController::UnlockExit(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); system.SetExitLock(false); @@ -351,7 +355,7 @@ void ISelfController::UnlockExit(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) { +void ISelfController::EnterFatalSection(HLERequestContext& ctx) { ++num_fatal_sections_entered; LOG_DEBUG(Service_AM, "called. Num fatal sections entered: {}", num_fatal_sections_entered); @@ -359,7 +363,7 @@ void ISelfController::EnterFatalSection(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) { +void ISelfController::LeaveFatalSection(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called."); // Entry and exit of fatal sections must be balanced. @@ -375,7 +379,7 @@ void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { +void ISelfController::GetLibraryAppletLaunchableEvent(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); launchable_event->Signal(); @@ -385,7 +389,7 @@ void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& rb.PushCopyObjects(launchable_event->GetReadableEvent()); } -void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { +void ISelfController::SetScreenShotPermission(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto permission = rp.PopEnum<ScreenshotPermission>(); LOG_DEBUG(Service_AM, "called, permission={}", permission); @@ -396,7 +400,7 @@ void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) { +void ISelfController::SetOperationModeChangedNotification(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; bool flag = rp.Pop<bool>(); @@ -406,7 +410,7 @@ void ISelfController::SetOperationModeChangedNotification(Kernel::HLERequestCont rb.Push(ResultSuccess); } -void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) { +void ISelfController::SetPerformanceModeChangedNotification(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; bool flag = rp.Pop<bool>(); @@ -416,7 +420,7 @@ void ISelfController::SetPerformanceModeChangedNotification(Kernel::HLERequestCo rb.Push(ResultSuccess); } -void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { +void ISelfController::SetFocusHandlingMode(HLERequestContext& ctx) { // Takes 3 input u8s with each field located immediately after the previous // u8, these are bool flags. No output. IPC::RequestParser rp{ctx}; @@ -435,14 +439,14 @@ void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ISelfController::SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) { +void ISelfController::SetRestartMessageEnabled(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) { +void ISelfController::SetOutOfFocusSuspendingEnabled(HLERequestContext& ctx) { // Takes 3 input u8s with each field located immediately after the previous // u8, these are bool flags. No output. IPC::RequestParser rp{ctx}; @@ -454,27 +458,27 @@ void ISelfController::SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& rb.Push(ResultSuccess); } -void ISelfController::SetAlbumImageOrientation(Kernel::HLERequestContext& ctx) { +void ISelfController::SetAlbumImageOrientation(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx) { +void ISelfController::CreateManagedDisplayLayer(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); // TODO(Subv): Find out how AM determines the display to use, for now just // create the layer in the Default display. - const auto display_id = nvflinger.OpenDisplay("Default"); - const auto layer_id = nvflinger.CreateLayer(*display_id); + const auto display_id = nvnflinger.OpenDisplay("Default"); + const auto layer_id = nvnflinger.CreateLayer(*display_id); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); rb.Push(*layer_id); } -void ISelfController::CreateManagedDisplaySeparableLayer(Kernel::HLERequestContext& ctx) { +void ISelfController::CreateManagedDisplaySeparableLayer(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); // TODO(Subv): Find out how AM determines the display to use, for now just @@ -484,22 +488,22 @@ void ISelfController::CreateManagedDisplaySeparableLayer(Kernel::HLERequestConte // Outputting 1 layer id instead of the expected 2 has not been observed to cause any adverse // side effects. // TODO: Support multiple layers - const auto display_id = nvflinger.OpenDisplay("Default"); - const auto layer_id = nvflinger.CreateLayer(*display_id); + const auto display_id = nvnflinger.OpenDisplay("Default"); + const auto layer_id = nvnflinger.CreateLayer(*display_id); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); rb.Push(*layer_id); } -void ISelfController::SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx) { +void ISelfController::SetHandlesRequestToDisplay(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void ISelfController::SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) { +void ISelfController::SetIdleTimeDetectionExtension(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; idle_time_detection_extension = rp.Pop<u32>(); LOG_WARNING(Service_AM, "(STUBBED) called idle_time_detection_extension={}", @@ -509,7 +513,7 @@ void ISelfController::SetIdleTimeDetectionExtension(Kernel::HLERequestContext& c rb.Push(ResultSuccess); } -void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx) { +void ISelfController::GetIdleTimeDetectionExtension(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -517,14 +521,14 @@ void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& c rb.Push<u32>(idle_time_detection_extension); } -void ISelfController::ReportUserIsActive(Kernel::HLERequestContext& ctx) { +void ISelfController::ReportUserIsActive(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void ISelfController::SetAutoSleepDisabled(Kernel::HLERequestContext& ctx) { +void ISelfController::SetAutoSleepDisabled(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; is_auto_sleep_disabled = rp.Pop<bool>(); @@ -544,7 +548,7 @@ void ISelfController::SetAutoSleepDisabled(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ISelfController::IsAutoSleepDisabled(Kernel::HLERequestContext& ctx) { +void ISelfController::IsAutoSleepDisabled(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called."); IPC::ResponseBuilder rb{ctx, 3}; @@ -552,7 +556,7 @@ void ISelfController::IsAutoSleepDisabled(Kernel::HLERequestContext& ctx) { rb.Push(is_auto_sleep_disabled); } -void ISelfController::GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx) { +void ISelfController::GetAccumulatedSuspendedTickValue(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called."); // This command returns the total number of system ticks since ISelfController creation @@ -563,7 +567,7 @@ void ISelfController::GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext rb.Push<u64>(0); } -void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx) { +void ISelfController::GetAccumulatedSuspendedTickChangedEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called."); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -571,7 +575,7 @@ void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequest rb.PushCopyObjects(accumulated_suspended_tick_changed_event->GetReadableEvent()); } -void ISelfController::SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestContext& ctx) { +void ISelfController::SetAlbumImageTakenNotificationEnabled(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; // This service call sets an internal flag whether a notification is shown when an image is @@ -586,7 +590,7 @@ void ISelfController::SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestCo rb.Push(ResultSuccess); } -void ISelfController::SaveCurrentScreenshot(Kernel::HLERequestContext& ctx) { +void ISelfController::SaveCurrentScreenshot(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto album_report_option = rp.PopEnum<Capture::AlbumReportOption>(); @@ -597,7 +601,7 @@ void ISelfController::SaveCurrentScreenshot(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ISelfController::SetRecordVolumeMuted(Kernel::HLERequestContext& ctx) { +void ISelfController::SetRecordVolumeMuted(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto is_record_volume_muted = rp.Pop<bool>(); @@ -731,7 +735,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, ICommonStateGetter::~ICommonStateGetter() = default; -void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::GetBootMode(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -739,7 +743,7 @@ void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) { rb.Push<u8>(static_cast<u8>(Service::PM::SystemBootMode::Normal)); // Normal boot mode } -void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::GetEventHandle(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -747,7 +751,7 @@ void ICommonStateGetter::GetEventHandle(Kernel::HLERequestContext& ctx) { rb.PushCopyObjects(msg_queue->GetMessageReceiveEvent()); } -void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::ReceiveMessage(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); const auto message = msg_queue->PopMessage(); @@ -755,7 +759,7 @@ void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { if (message == AppletMessageQueue::AppletMessage::None) { LOG_ERROR(Service_AM, "Message queue is empty"); - rb.Push(ERR_NO_MESSAGES); + rb.Push(AM::ResultNoMessages); rb.PushEnum<AppletMessageQueue::AppletMessage>(message); return; } @@ -764,7 +768,7 @@ void ICommonStateGetter::ReceiveMessage(Kernel::HLERequestContext& ctx) { rb.PushEnum<AppletMessageQueue::AppletMessage>(message); } -void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::GetCurrentFocusState(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -772,7 +776,7 @@ void ICommonStateGetter::GetCurrentFocusState(Kernel::HLERequestContext& ctx) { rb.Push(static_cast<u8>(FocusState::InFocus)); } -void ICommonStateGetter::IsVrModeEnabled(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::IsVrModeEnabled(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -780,7 +784,7 @@ void ICommonStateGetter::IsVrModeEnabled(Kernel::HLERequestContext& ctx) { rb.Push(vr_mode_state); } -void ICommonStateGetter::SetVrModeEnabled(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::SetVrModeEnabled(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; vr_mode_state = rp.Pop<bool>(); @@ -790,7 +794,7 @@ void ICommonStateGetter::SetVrModeEnabled(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::SetLcdBacklighOffEnabled(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto is_lcd_backlight_off_enabled = rp.Pop<bool>(); @@ -801,21 +805,21 @@ void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx rb.Push(ResultSuccess); } -void ICommonStateGetter::BeginVrModeEx(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::BeginVrModeEx(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void ICommonStateGetter::EndVrModeEx(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::EndVrModeEx(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -823,7 +827,7 @@ void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLEReque rb.PushCopyObjects(msg_queue->GetOperationModeChangedEvent()); } -void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::GetDefaultDisplayResolution(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 4}; @@ -838,7 +842,7 @@ void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext& } } -void ICommonStateGetter::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::SetCpuBoostMode(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called, forwarding to APM:SYS"); const auto& sm = system.ServiceManager(); @@ -848,7 +852,7 @@ void ICommonStateGetter::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { apm_sys->SetCpuBoostMode(ctx); } -void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto system_button{rp.PopEnum<SystemButtonType>()}; @@ -859,7 +863,7 @@ void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(Kernel::HLERequest } void ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled( - Kernel::HLERequestContext& ctx) { + HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; @@ -907,7 +911,7 @@ void IStorage::Register() { IStorage::~IStorage() = default; -void IStorage::Open(Kernel::HLERequestContext& ctx) { +void IStorage::Open(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -916,7 +920,7 @@ void IStorage::Open(Kernel::HLERequestContext& ctx) { rb.PushIpcInterface<IStorageAccessor>(system, *this); } -void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::GetOperationMode(HLERequestContext& ctx) { const bool use_docked_mode{Settings::values.use_docked_mode.GetValue()}; LOG_DEBUG(Service_AM, "called, use_docked_mode={}", use_docked_mode); @@ -925,7 +929,7 @@ void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { rb.Push(static_cast<u8>(use_docked_mode ? OperationMode::Docked : OperationMode::Handheld)); } -void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { +void ICommonStateGetter::GetPerformanceMode(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -942,7 +946,7 @@ public: {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"}, {1, &ILibraryAppletAccessor::IsCompleted, "IsCompleted"}, {10, &ILibraryAppletAccessor::Start, "Start"}, - {20, nullptr, "RequestExit"}, + {20, &ILibraryAppletAccessor::RequestExit, "RequestExit"}, {25, nullptr, "Terminate"}, {30, &ILibraryAppletAccessor::GetResult, "GetResult"}, {50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, @@ -965,7 +969,7 @@ public: } private: - void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) { + void GetAppletStateChangedEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -973,7 +977,7 @@ private: rb.PushCopyObjects(applet->GetBroker().GetStateChangedEvent()); } - void IsCompleted(Kernel::HLERequestContext& ctx) { + void IsCompleted(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -981,21 +985,21 @@ private: rb.Push<u32>(applet->TransactionComplete()); } - void GetResult(Kernel::HLERequestContext& ctx) { + void GetResult(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(applet->GetStatus()); } - void PresetLibraryAppletGpuTimeSliceZero(Kernel::HLERequestContext& ctx) { + void PresetLibraryAppletGpuTimeSliceZero(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } - void Start(Kernel::HLERequestContext& ctx) { + void Start(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); ASSERT(applet != nullptr); @@ -1007,7 +1011,16 @@ private: rb.Push(ResultSuccess); } - void PushInData(Kernel::HLERequestContext& ctx) { + void RequestExit(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + ASSERT(applet != nullptr); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(applet->RequestExit()); + } + + void PushInData(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::RequestParser rp{ctx}; @@ -1017,7 +1030,7 @@ private: rb.Push(ResultSuccess); } - void PopOutData(Kernel::HLERequestContext& ctx) { + void PopOutData(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); auto storage = applet->GetBroker().PopNormalDataToGame(); @@ -1025,7 +1038,7 @@ private: LOG_DEBUG(Service_AM, "storage is a nullptr. There is no data in the current normal channel"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NO_DATA_IN_CHANNEL); + rb.Push(AM::ResultNoDataInChannel); return; } @@ -1034,7 +1047,7 @@ private: rb.PushIpcInterface<IStorage>(std::move(storage)); } - void PushInteractiveInData(Kernel::HLERequestContext& ctx) { + void PushInteractiveInData(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::RequestParser rp{ctx}; @@ -1048,7 +1061,7 @@ private: rb.Push(ResultSuccess); } - void PopInteractiveOutData(Kernel::HLERequestContext& ctx) { + void PopInteractiveOutData(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); auto storage = applet->GetBroker().PopInteractiveDataToGame(); @@ -1056,7 +1069,7 @@ private: LOG_DEBUG(Service_AM, "storage is a nullptr. There is no data in the current interactive channel"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NO_DATA_IN_CHANNEL); + rb.Push(AM::ResultNoDataInChannel); return; } @@ -1065,7 +1078,7 @@ private: rb.PushIpcInterface<IStorage>(std::move(storage)); } - void GetPopOutDataEvent(Kernel::HLERequestContext& ctx) { + void GetPopOutDataEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -1073,7 +1086,7 @@ private: rb.PushCopyObjects(applet->GetBroker().GetNormalDataEvent()); } - void GetPopInteractiveOutDataEvent(Kernel::HLERequestContext& ctx) { + void GetPopInteractiveOutDataEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -1081,7 +1094,7 @@ private: rb.PushCopyObjects(applet->GetBroker().GetInteractiveDataEvent()); } - void GetIndirectLayerConsumerHandle(Kernel::HLERequestContext& ctx) { + void GetIndirectLayerConsumerHandle(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); // We require a non-zero handle to be valid. Using 0xdeadbeef allows us to trace if this is @@ -1111,7 +1124,7 @@ IStorageAccessor::IStorageAccessor(Core::System& system_, IStorage& backing_) IStorageAccessor::~IStorageAccessor() = default; -void IStorageAccessor::GetSize(Kernel::HLERequestContext& ctx) { +void IStorageAccessor::GetSize(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 4}; @@ -1120,11 +1133,11 @@ void IStorageAccessor::GetSize(Kernel::HLERequestContext& ctx) { rb.Push(static_cast<u64>(backing.GetSize())); } -void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { +void IStorageAccessor::Write(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 offset{rp.Pop<u64>()}; - const std::vector<u8> data{ctx.ReadBuffer()}; + const auto data{ctx.ReadBuffer()}; const std::size_t size{std::min<u64>(data.size(), backing.GetSize() - offset)}; LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size); @@ -1135,7 +1148,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { backing.GetSize(), size, offset); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_SIZE_OUT_OF_BOUNDS); + rb.Push(AM::ResultInvalidOffset); return; } @@ -1145,7 +1158,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { +void IStorageAccessor::Read(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 offset{rp.Pop<u64>()}; @@ -1158,7 +1171,7 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { backing.GetSize(), size, offset); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_SIZE_OUT_OF_BOUNDS); + rb.Push(AM::ResultInvalidOffset); return; } @@ -1183,7 +1196,7 @@ ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_) ILibraryAppletCreator::~ILibraryAppletCreator() = default; -void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) { +void ILibraryAppletCreator::CreateLibraryApplet(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto applet_id = rp.PopRaw<Applets::AppletId>(); @@ -1209,7 +1222,7 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet); } -void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { +void ILibraryAppletCreator::CreateStorage(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s64 size{rp.Pop<s64>()}; @@ -1230,7 +1243,7 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { rb.PushIpcInterface<IStorage>(system, std::move(buffer)); } -void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) { +void ILibraryAppletCreator::CreateTransferMemoryStorage(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; struct Parameters { @@ -1252,7 +1265,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex } auto transfer_mem = - system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle); + system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle); if (transfer_mem.IsNull()) { LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); @@ -1261,16 +1274,16 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex return; } - const u8* const mem_begin = system.Memory().GetPointer(transfer_mem->GetSourceAddress()); - const u8* const mem_end = mem_begin + transfer_mem->GetSize(); - std::vector<u8> memory{mem_begin, mem_end}; + std::vector<u8> memory(transfer_mem->GetSize()); + system.ApplicationMemory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), + memory.size()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); rb.PushIpcInterface<IStorage>(system, std::move(memory)); } -void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) { +void ILibraryAppletCreator::CreateHandleStorage(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s64 size{rp.Pop<s64>()}; @@ -1286,7 +1299,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) } auto transfer_mem = - system.CurrentProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle); + system.ApplicationProcess()->GetHandleTable().GetObject<Kernel::KTransferMemory>(handle); if (transfer_mem.IsNull()) { LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); @@ -1295,9 +1308,9 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) return; } - const u8* const mem_begin = system.Memory().GetPointer(transfer_mem->GetSourceAddress()); - const u8* const mem_end = mem_begin + transfer_mem->GetSize(); - std::vector<u8> memory{mem_begin, mem_end}; + std::vector<u8> memory(transfer_mem->GetSize()); + system.ApplicationMemory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), + memory.size()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -1323,7 +1336,7 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_) {24, nullptr, "GetLaunchStorageInfoForDebug"}, {25, &IApplicationFunctions::ExtendSaveData, "ExtendSaveData"}, {26, &IApplicationFunctions::GetSaveDataSize, "GetSaveDataSize"}, - {27, nullptr, "CreateCacheStorage"}, + {27, &IApplicationFunctions::CreateCacheStorage, "CreateCacheStorage"}, {28, nullptr, "GetSaveDataSizeMax"}, {29, nullptr, "GetCacheStorageMax"}, {30, &IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed, "BeginBlockingHomeButtonShortAndLongPressed"}, @@ -1393,29 +1406,28 @@ IApplicationFunctions::~IApplicationFunctions() { service_context.CloseEvent(health_warning_disappeared_system_event); } -void IApplicationFunctions::EnableApplicationCrashReport(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::EnableApplicationCrashReport(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer( - Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::InitializeApplicationCopyrightFrameBuffer(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::SetApplicationCopyrightImage(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::SetApplicationCopyrightImage(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::SetApplicationCopyrightVisibility(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::SetApplicationCopyrightVisibility(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto is_visible = rp.Pop<bool>(); @@ -1425,37 +1437,35 @@ void IApplicationFunctions::SetApplicationCopyrightVisibility(Kernel::HLERequest rb.Push(ResultSuccess); } -void IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed( - Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::BeginBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed( - Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::EndBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::BeginBlockingHomeButton(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::BeginBlockingHomeButton(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::EndBlockingHomeButton(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::EndBlockingHomeButton(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::PopLaunchParameter(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto kind = rp.PopEnum<LaunchParameterKind>(); @@ -1465,11 +1475,12 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { const auto backend = BCAT::CreateBackendFromSettings(system, [this](u64 tid) { return system.GetFileSystemController().GetBCATDirectory(tid); }); - const auto build_id_full = system.GetCurrentProcessBuildID(); + const auto build_id_full = system.GetApplicationProcessBuildID(); u64 build_id{}; std::memcpy(&build_id, build_id_full.data(), sizeof(u64)); - auto data = backend->GetLaunchParameter({system.GetCurrentProcessProgramID(), build_id}); + auto data = + backend->GetLaunchParameter({system.GetApplicationProcessProgramID(), build_id}); if (data.has_value()) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -1503,25 +1514,24 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { LOG_ERROR(Service_AM, "Attempted to load launch parameter but none was found!"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NO_DATA_IN_CHANNEL); + rb.Push(AM::ResultNoDataInChannel); } -void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest( - Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::EnsureSaveData(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; u128 user_id = rp.PopRaw<u128>(); LOG_DEBUG(Service_AM, "called, uid={:016X}{:016X}", user_id[1], user_id[0]); FileSys::SaveDataAttribute attribute{}; - attribute.title_id = system.GetCurrentProcessProgramID(); + attribute.title_id = system.GetApplicationProcessProgramID(); attribute.user_id = user_id; attribute.type = FileSys::SaveDataType::SaveData; const auto res = system.GetFileSystemController().CreateSaveData( @@ -1532,7 +1542,7 @@ void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { rb.Push<u64>(0); } -void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::SetTerminateResult(HLERequestContext& ctx) { // Takes an input u32 Result, no output. // For example, in some cases official apps use this with error 0x2A2 then // uses svcBreak. @@ -1545,13 +1555,13 @@ void IApplicationFunctions::SetTerminateResult(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::GetDisplayVersion(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); std::array<u8, 0x10> version_string{}; const auto res = [this] { - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), system.GetContentProvider()}; @@ -1570,7 +1580,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { const auto& version = res.first->GetVersionString(); std::copy(version.begin(), version.end(), version_string.begin()); } else { - constexpr char default_version[]{"1.0.0"}; + static constexpr char default_version[]{"1.0.0"}; std::memcpy(version_string.data(), default_version, sizeof(default_version)); } @@ -1579,7 +1589,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { rb.PushRaw(version_string); } -void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::GetDesiredLanguage(HLERequestContext& ctx) { // TODO(bunnei): This should be configurable LOG_DEBUG(Service_AM, "called"); @@ -1588,7 +1598,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { u32 supported_languages = 0; const auto res = [this] { - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), system.GetContentProvider()}; @@ -1635,7 +1645,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { rb.Push(*res_code); } -void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::IsGamePlayRecordingSupported(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); constexpr bool gameplay_recording_supported = false; @@ -1645,21 +1655,21 @@ void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestConte rb.Push(gameplay_recording_supported); } -void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::InitializeGamePlayRecording(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::SetGamePlayRecordingState(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::SetGamePlayRecordingState(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::NotifyRunning(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -1667,7 +1677,7 @@ void IApplicationFunctions::NotifyRunning(Kernel::HLERequestContext& ctx) { rb.Push<u8>(0); // Unknown, seems to be ignored by official processes } -void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::GetPseudoDeviceId(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 6}; @@ -1678,7 +1688,7 @@ void IApplicationFunctions::GetPseudoDeviceId(Kernel::HLERequestContext& ctx) { rb.Push<u64>(0); } -void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::ExtendSaveData(HLERequestContext& ctx) { struct Parameters { FileSys::SaveDataType type; u128 user_id; @@ -1696,7 +1706,8 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) { static_cast<u8>(type), user_id[1], user_id[0], new_normal_size, new_journal_size); system.GetFileSystemController().WriteSaveDataSize( - type, system.GetCurrentProcessProgramID(), user_id, {new_normal_size, new_journal_size}); + type, system.GetApplicationProcessProgramID(), user_id, + {new_normal_size, new_journal_size}); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); @@ -1706,7 +1717,7 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) { rb.Push<u64>(0); } -void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::GetSaveDataSize(HLERequestContext& ctx) { struct Parameters { FileSys::SaveDataType type; u128 user_id; @@ -1720,7 +1731,7 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) { user_id[0]); const auto size = system.GetFileSystemController().ReadSaveDataSize( - type, system.GetCurrentProcessProgramID(), user_id); + type, system.GetApplicationProcessProgramID(), user_id); IPC::ResponseBuilder rb{ctx, 6}; rb.Push(ResultSuccess); @@ -1728,7 +1739,37 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) { rb.Push(size.journal); } -void IApplicationFunctions::QueryApplicationPlayStatistics(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::CreateCacheStorage(HLERequestContext& ctx) { + struct InputParameters { + u16 index; + s64 size; + s64 journal_size; + }; + static_assert(sizeof(InputParameters) == 24); + + struct OutputParameters { + u32 storage_target; + u64 required_size; + }; + static_assert(sizeof(OutputParameters) == 16); + + IPC::RequestParser rp{ctx}; + const auto params = rp.PopRaw<InputParameters>(); + + LOG_WARNING(Service_AM, "(STUBBED) called with index={}, size={:#x}, journal_size={:#x}", + params.index, params.size, params.journal_size); + + const OutputParameters resp{ + .storage_target = 1, + .required_size = 0, + }; + + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(ResultSuccess); + rb.PushRaw(resp); +} + +void IApplicationFunctions::QueryApplicationPlayStatistics(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -1736,7 +1777,7 @@ void IApplicationFunctions::QueryApplicationPlayStatistics(Kernel::HLERequestCon rb.Push<u32>(0); } -void IApplicationFunctions::QueryApplicationPlayStatisticsByUid(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::QueryApplicationPlayStatisticsByUid(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -1744,7 +1785,7 @@ void IApplicationFunctions::QueryApplicationPlayStatisticsByUid(Kernel::HLEReque rb.Push<u32>(0); } -void IApplicationFunctions::ExecuteProgram(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::ExecuteProgram(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::RequestParser rp{ctx}; @@ -1758,21 +1799,21 @@ void IApplicationFunctions::ExecuteProgram(Kernel::HLERequestContext& ctx) { system.ExecuteProgram(program_index); } -void IApplicationFunctions::ClearUserChannel(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::ClearUserChannel(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::UnpopToUserChannel(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::UnpopToUserChannel(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IApplicationFunctions::GetPreviousProgramIndex(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::GetPreviousProgramIndex(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -1780,7 +1821,7 @@ void IApplicationFunctions::GetPreviousProgramIndex(Kernel::HLERequestContext& c rb.Push<s32>(previous_program_index); } -void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -1788,7 +1829,7 @@ void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(Kernel::HLERequestCon rb.PushCopyObjects(gpu_error_detected_event->GetReadableEvent()); } -void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -1796,15 +1837,14 @@ void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(Kernel::HLERe rb.PushCopyObjects(friend_invitation_storage_channel_event->GetReadableEvent()); } -void IApplicationFunctions::TryPopFromFriendInvitationStorageChannel( - Kernel::HLERequestContext& ctx) { - LOG_WARNING(Service_AM, "(STUBBED) called"); +void IApplicationFunctions::TryPopFromFriendInvitationStorageChannel(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ERR_NO_DATA_IN_CHANNEL); + rb.Push(AM::ResultNoDataInChannel); } -void IApplicationFunctions::GetNotificationStorageChannelEvent(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::GetNotificationStorageChannelEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -1812,7 +1852,7 @@ void IApplicationFunctions::GetNotificationStorageChannelEvent(Kernel::HLEReques rb.PushCopyObjects(notification_storage_channel_event->GetReadableEvent()); } -void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; @@ -1820,25 +1860,28 @@ void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(Kernel::HLERe rb.PushCopyObjects(health_warning_disappeared_system_event->GetReadableEvent()); } -void IApplicationFunctions::PrepareForJit(Kernel::HLERequestContext& ctx) { +void IApplicationFunctions::PrepareForJit(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger, - Core::System& system) { +void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system) { auto message_queue = std::make_shared<AppletMessageQueue>(system); // Needed on game boot message_queue->PushMessage(AppletMessageQueue::AppletMessage::FocusStateChanged); - std::make_shared<AppletAE>(nvflinger, message_queue, system)->InstallAsService(service_manager); - std::make_shared<AppletOE>(nvflinger, message_queue, system)->InstallAsService(service_manager); - std::make_shared<IdleSys>(system)->InstallAsService(service_manager); - std::make_shared<OMM>(system)->InstallAsService(service_manager); - std::make_shared<SPSM>(system)->InstallAsService(service_manager); - std::make_shared<TCAP>(system)->InstallAsService(service_manager); + auto server_manager = std::make_unique<ServerManager>(system); + + server_manager->RegisterNamedService( + "appletAE", std::make_shared<AppletAE>(nvnflinger, message_queue, system)); + server_manager->RegisterNamedService( + "appletOE", std::make_shared<AppletOE>(nvnflinger, message_queue, system)); + server_manager->RegisterNamedService("idle:sys", std::make_shared<IdleSys>(system)); + server_manager->RegisterNamedService("omm", std::make_shared<OMM>(system)); + server_manager->RegisterNamedService("spsm", std::make_shared<SPSM>(system)); + ServerManager::RunServer(std::move(server_manager)); } IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) @@ -1855,6 +1898,8 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) {31, nullptr, "GetWriterLockAccessorEx"}, {40, nullptr, "IsSleepEnabled"}, {41, nullptr, "IsRebootEnabled"}, + {50, nullptr, "LaunchSystemApplet"}, + {51, nullptr, "LaunchStarter"}, {100, nullptr, "PopRequestLaunchApplicationForDebug"}, {110, nullptr, "IsForceTerminateApplicationDisabledForDebug"}, {200, nullptr, "LaunchDevMenu"}, @@ -1872,14 +1917,14 @@ IHomeMenuFunctions::~IHomeMenuFunctions() { service_context.CloseEvent(pop_from_general_channel_event); } -void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) { +void IHomeMenuFunctions::RequestToGetForeground(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx) { +void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 1}; diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index a0fbfcfc5..d4fd163da 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -12,11 +12,12 @@ namespace Kernel { class KernelCore; +class KReadableEvent; class KTransferMemory; } // namespace Kernel -namespace Service::NVFlinger { -class NVFlinger; +namespace Service::Nvnflinger { +class Nvnflinger; } namespace Service::AM { @@ -109,8 +110,8 @@ public: ~IWindowController() override; private: - void GetAppletResourceUserId(Kernel::HLERequestContext& ctx); - void AcquireForegroundRights(Kernel::HLERequestContext& ctx); + void GetAppletResourceUserId(HLERequestContext& ctx); + void AcquireForegroundRights(HLERequestContext& ctx); }; class IAudioController final : public ServiceFramework<IAudioController> { @@ -119,11 +120,11 @@ public: ~IAudioController() override; private: - void SetExpectedMasterVolume(Kernel::HLERequestContext& ctx); - void GetMainAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx); - void GetLibraryAppletExpectedMasterVolume(Kernel::HLERequestContext& ctx); - void ChangeMainAppletMasterVolume(Kernel::HLERequestContext& ctx); - void SetTransparentAudioRate(Kernel::HLERequestContext& ctx); + void SetExpectedMasterVolume(HLERequestContext& ctx); + void GetMainAppletExpectedMasterVolume(HLERequestContext& ctx); + void GetLibraryAppletExpectedMasterVolume(HLERequestContext& ctx); + void ChangeMainAppletMasterVolume(HLERequestContext& ctx); + void SetTransparentAudioRate(HLERequestContext& ctx); static constexpr float min_allowed_volume = 0.0f; static constexpr float max_allowed_volume = 1.0f; @@ -153,36 +154,36 @@ public: class ISelfController final : public ServiceFramework<ISelfController> { public: - explicit ISelfController(Core::System& system_, NVFlinger::NVFlinger& nvflinger_); + explicit ISelfController(Core::System& system_, Nvnflinger::Nvnflinger& nvnflinger_); ~ISelfController() override; private: - void Exit(Kernel::HLERequestContext& ctx); - void LockExit(Kernel::HLERequestContext& ctx); - void UnlockExit(Kernel::HLERequestContext& ctx); - void EnterFatalSection(Kernel::HLERequestContext& ctx); - void LeaveFatalSection(Kernel::HLERequestContext& ctx); - void GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx); - void SetScreenShotPermission(Kernel::HLERequestContext& ctx); - void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx); - void SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx); - void SetFocusHandlingMode(Kernel::HLERequestContext& ctx); - void SetRestartMessageEnabled(Kernel::HLERequestContext& ctx); - void SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx); - void SetAlbumImageOrientation(Kernel::HLERequestContext& ctx); - void CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx); - void CreateManagedDisplaySeparableLayer(Kernel::HLERequestContext& ctx); - void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx); - void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); - void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); - void ReportUserIsActive(Kernel::HLERequestContext& ctx); - void SetAutoSleepDisabled(Kernel::HLERequestContext& ctx); - void IsAutoSleepDisabled(Kernel::HLERequestContext& ctx); - void GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx); - void GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx); - void SetAlbumImageTakenNotificationEnabled(Kernel::HLERequestContext& ctx); - void SaveCurrentScreenshot(Kernel::HLERequestContext& ctx); - void SetRecordVolumeMuted(Kernel::HLERequestContext& ctx); + void Exit(HLERequestContext& ctx); + void LockExit(HLERequestContext& ctx); + void UnlockExit(HLERequestContext& ctx); + void EnterFatalSection(HLERequestContext& ctx); + void LeaveFatalSection(HLERequestContext& ctx); + void GetLibraryAppletLaunchableEvent(HLERequestContext& ctx); + void SetScreenShotPermission(HLERequestContext& ctx); + void SetOperationModeChangedNotification(HLERequestContext& ctx); + void SetPerformanceModeChangedNotification(HLERequestContext& ctx); + void SetFocusHandlingMode(HLERequestContext& ctx); + void SetRestartMessageEnabled(HLERequestContext& ctx); + void SetOutOfFocusSuspendingEnabled(HLERequestContext& ctx); + void SetAlbumImageOrientation(HLERequestContext& ctx); + void CreateManagedDisplayLayer(HLERequestContext& ctx); + void CreateManagedDisplaySeparableLayer(HLERequestContext& ctx); + void SetHandlesRequestToDisplay(HLERequestContext& ctx); + void SetIdleTimeDetectionExtension(HLERequestContext& ctx); + void GetIdleTimeDetectionExtension(HLERequestContext& ctx); + void ReportUserIsActive(HLERequestContext& ctx); + void SetAutoSleepDisabled(HLERequestContext& ctx); + void IsAutoSleepDisabled(HLERequestContext& ctx); + void GetAccumulatedSuspendedTickValue(HLERequestContext& ctx); + void GetAccumulatedSuspendedTickChangedEvent(HLERequestContext& ctx); + void SetAlbumImageTakenNotificationEnabled(HLERequestContext& ctx); + void SaveCurrentScreenshot(HLERequestContext& ctx); + void SetRecordVolumeMuted(HLERequestContext& ctx); enum class ScreenshotPermission : u32 { Inherit = 0, @@ -190,7 +191,7 @@ private: Disable = 2, }; - NVFlinger::NVFlinger& nvflinger; + Nvnflinger::Nvnflinger& nvnflinger; KernelHelpers::ServiceContext service_context; @@ -235,22 +236,22 @@ private: CaptureButtonLongPressing, }; - void GetEventHandle(Kernel::HLERequestContext& ctx); - void ReceiveMessage(Kernel::HLERequestContext& ctx); - void GetCurrentFocusState(Kernel::HLERequestContext& ctx); - void GetDefaultDisplayResolutionChangeEvent(Kernel::HLERequestContext& ctx); - void GetOperationMode(Kernel::HLERequestContext& ctx); - void GetPerformanceMode(Kernel::HLERequestContext& ctx); - void GetBootMode(Kernel::HLERequestContext& ctx); - void IsVrModeEnabled(Kernel::HLERequestContext& ctx); - void SetVrModeEnabled(Kernel::HLERequestContext& ctx); - void SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx); - void BeginVrModeEx(Kernel::HLERequestContext& ctx); - void EndVrModeEx(Kernel::HLERequestContext& ctx); - void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx); - void SetCpuBoostMode(Kernel::HLERequestContext& ctx); - void PerformSystemButtonPressingIfInFocus(Kernel::HLERequestContext& ctx); - void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(Kernel::HLERequestContext& ctx); + void GetEventHandle(HLERequestContext& ctx); + void ReceiveMessage(HLERequestContext& ctx); + void GetCurrentFocusState(HLERequestContext& ctx); + void GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx); + void GetOperationMode(HLERequestContext& ctx); + void GetPerformanceMode(HLERequestContext& ctx); + void GetBootMode(HLERequestContext& ctx); + void IsVrModeEnabled(HLERequestContext& ctx); + void SetVrModeEnabled(HLERequestContext& ctx); + void SetLcdBacklighOffEnabled(HLERequestContext& ctx); + void BeginVrModeEx(HLERequestContext& ctx); + void EndVrModeEx(HLERequestContext& ctx); + void GetDefaultDisplayResolution(HLERequestContext& ctx); + void SetCpuBoostMode(HLERequestContext& ctx); + void PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx); + void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(HLERequestContext& ctx); std::shared_ptr<AppletMessageQueue> msg_queue; bool vr_mode_state{}; @@ -283,7 +284,7 @@ public: private: void Register(); - void Open(Kernel::HLERequestContext& ctx); + void Open(HLERequestContext& ctx); std::shared_ptr<IStorageImpl> impl; }; @@ -294,9 +295,9 @@ public: ~IStorageAccessor() override; private: - void GetSize(Kernel::HLERequestContext& ctx); - void Write(Kernel::HLERequestContext& ctx); - void Read(Kernel::HLERequestContext& ctx); + void GetSize(HLERequestContext& ctx); + void Write(HLERequestContext& ctx); + void Read(HLERequestContext& ctx); IStorage& backing; }; @@ -307,10 +308,10 @@ public: ~ILibraryAppletCreator() override; private: - void CreateLibraryApplet(Kernel::HLERequestContext& ctx); - void CreateStorage(Kernel::HLERequestContext& ctx); - void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx); - void CreateHandleStorage(Kernel::HLERequestContext& ctx); + void CreateLibraryApplet(HLERequestContext& ctx); + void CreateStorage(HLERequestContext& ctx); + void CreateTransferMemoryStorage(HLERequestContext& ctx); + void CreateHandleStorage(HLERequestContext& ctx); }; class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { @@ -319,39 +320,40 @@ public: ~IApplicationFunctions() override; private: - void PopLaunchParameter(Kernel::HLERequestContext& ctx); - void CreateApplicationAndRequestToStartForQuest(Kernel::HLERequestContext& ctx); - void EnsureSaveData(Kernel::HLERequestContext& ctx); - void SetTerminateResult(Kernel::HLERequestContext& ctx); - void GetDisplayVersion(Kernel::HLERequestContext& ctx); - void GetDesiredLanguage(Kernel::HLERequestContext& ctx); - void IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx); - void InitializeGamePlayRecording(Kernel::HLERequestContext& ctx); - void SetGamePlayRecordingState(Kernel::HLERequestContext& ctx); - void NotifyRunning(Kernel::HLERequestContext& ctx); - void GetPseudoDeviceId(Kernel::HLERequestContext& ctx); - void ExtendSaveData(Kernel::HLERequestContext& ctx); - void GetSaveDataSize(Kernel::HLERequestContext& ctx); - void BeginBlockingHomeButtonShortAndLongPressed(Kernel::HLERequestContext& ctx); - void EndBlockingHomeButtonShortAndLongPressed(Kernel::HLERequestContext& ctx); - void BeginBlockingHomeButton(Kernel::HLERequestContext& ctx); - void EndBlockingHomeButton(Kernel::HLERequestContext& ctx); - void EnableApplicationCrashReport(Kernel::HLERequestContext& ctx); - void InitializeApplicationCopyrightFrameBuffer(Kernel::HLERequestContext& ctx); - void SetApplicationCopyrightImage(Kernel::HLERequestContext& ctx); - void SetApplicationCopyrightVisibility(Kernel::HLERequestContext& ctx); - void QueryApplicationPlayStatistics(Kernel::HLERequestContext& ctx); - void QueryApplicationPlayStatisticsByUid(Kernel::HLERequestContext& ctx); - void ExecuteProgram(Kernel::HLERequestContext& ctx); - void ClearUserChannel(Kernel::HLERequestContext& ctx); - void UnpopToUserChannel(Kernel::HLERequestContext& ctx); - void GetPreviousProgramIndex(Kernel::HLERequestContext& ctx); - void GetGpuErrorDetectedSystemEvent(Kernel::HLERequestContext& ctx); - void GetFriendInvitationStorageChannelEvent(Kernel::HLERequestContext& ctx); - void TryPopFromFriendInvitationStorageChannel(Kernel::HLERequestContext& ctx); - void GetNotificationStorageChannelEvent(Kernel::HLERequestContext& ctx); - void GetHealthWarningDisappearedSystemEvent(Kernel::HLERequestContext& ctx); - void PrepareForJit(Kernel::HLERequestContext& ctx); + void PopLaunchParameter(HLERequestContext& ctx); + void CreateApplicationAndRequestToStartForQuest(HLERequestContext& ctx); + void EnsureSaveData(HLERequestContext& ctx); + void SetTerminateResult(HLERequestContext& ctx); + void GetDisplayVersion(HLERequestContext& ctx); + void GetDesiredLanguage(HLERequestContext& ctx); + void IsGamePlayRecordingSupported(HLERequestContext& ctx); + void InitializeGamePlayRecording(HLERequestContext& ctx); + void SetGamePlayRecordingState(HLERequestContext& ctx); + void NotifyRunning(HLERequestContext& ctx); + void GetPseudoDeviceId(HLERequestContext& ctx); + void ExtendSaveData(HLERequestContext& ctx); + void GetSaveDataSize(HLERequestContext& ctx); + void CreateCacheStorage(HLERequestContext& ctx); + void BeginBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx); + void EndBlockingHomeButtonShortAndLongPressed(HLERequestContext& ctx); + void BeginBlockingHomeButton(HLERequestContext& ctx); + void EndBlockingHomeButton(HLERequestContext& ctx); + void EnableApplicationCrashReport(HLERequestContext& ctx); + void InitializeApplicationCopyrightFrameBuffer(HLERequestContext& ctx); + void SetApplicationCopyrightImage(HLERequestContext& ctx); + void SetApplicationCopyrightVisibility(HLERequestContext& ctx); + void QueryApplicationPlayStatistics(HLERequestContext& ctx); + void QueryApplicationPlayStatisticsByUid(HLERequestContext& ctx); + void ExecuteProgram(HLERequestContext& ctx); + void ClearUserChannel(HLERequestContext& ctx); + void UnpopToUserChannel(HLERequestContext& ctx); + void GetPreviousProgramIndex(HLERequestContext& ctx); + void GetGpuErrorDetectedSystemEvent(HLERequestContext& ctx); + void GetFriendInvitationStorageChannelEvent(HLERequestContext& ctx); + void TryPopFromFriendInvitationStorageChannel(HLERequestContext& ctx); + void GetNotificationStorageChannelEvent(HLERequestContext& ctx); + void GetHealthWarningDisappearedSystemEvent(HLERequestContext& ctx); + void PrepareForJit(HLERequestContext& ctx); KernelHelpers::ServiceContext service_context; @@ -370,8 +372,8 @@ public: ~IHomeMenuFunctions() override; private: - void RequestToGetForeground(Kernel::HLERequestContext& ctx); - void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx); + void RequestToGetForeground(HLERequestContext& ctx); + void GetPopFromGeneralChannelEvent(HLERequestContext& ctx); KernelHelpers::ServiceContext service_context; @@ -396,8 +398,6 @@ public: ~IProcessWindingController() override; }; -/// Registers all AM services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger, - Core::System& system); +void LoopProcess(Nvnflinger::Nvnflinger& nvnflinger, Core::System& system); } // namespace Service::AM diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index d7719da35..2764f7ceb 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp @@ -3,20 +3,20 @@ #include "common/logging/log.h" #include "core/core.h" -#include "core/hle/ipc_helpers.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applet_ae.h" -#include "core/hle/service/nvflinger/nvflinger.h" +#include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/nvnflinger/nvnflinger.h" namespace Service::AM { class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { public: - explicit ILibraryAppletProxy(NVFlinger::NVFlinger& nvflinger_, + explicit ILibraryAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_) - : ServiceFramework{system_, "ILibraryAppletProxy"}, nvflinger{nvflinger_}, - msg_queue{std::move(msg_queue_)} { + : ServiceFramework{system_, "ILibraryAppletProxy"}, + nvnflinger{nvnflinger_}, msg_queue{std::move(msg_queue_)} { // clang-format off static const FunctionInfo functions[] = { {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, @@ -36,7 +36,7 @@ public: } private: - void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { + void GetCommonStateGetter(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -44,15 +44,15 @@ private: rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue); } - void GetSelfController(Kernel::HLERequestContext& ctx) { + void GetSelfController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface<ISelfController>(system, nvflinger); + rb.PushIpcInterface<ISelfController>(system, nvnflinger); } - void GetWindowController(Kernel::HLERequestContext& ctx) { + void GetWindowController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -60,7 +60,7 @@ private: rb.PushIpcInterface<IWindowController>(system); } - void GetAudioController(Kernel::HLERequestContext& ctx) { + void GetAudioController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -68,7 +68,7 @@ private: rb.PushIpcInterface<IAudioController>(system); } - void GetDisplayController(Kernel::HLERequestContext& ctx) { + void GetDisplayController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -76,7 +76,7 @@ private: rb.PushIpcInterface<IDisplayController>(system); } - void GetProcessWindingController(Kernel::HLERequestContext& ctx) { + void GetProcessWindingController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -84,7 +84,7 @@ private: rb.PushIpcInterface<IProcessWindingController>(system); } - void GetDebugFunctions(Kernel::HLERequestContext& ctx) { + void GetDebugFunctions(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -92,7 +92,7 @@ private: rb.PushIpcInterface<IDebugFunctions>(system); } - void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { + void GetLibraryAppletCreator(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -100,7 +100,7 @@ private: rb.PushIpcInterface<ILibraryAppletCreator>(system); } - void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { + void GetApplicationFunctions(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -108,17 +108,17 @@ private: rb.PushIpcInterface<IApplicationFunctions>(system); } - NVFlinger::NVFlinger& nvflinger; + Nvnflinger::Nvnflinger& nvnflinger; std::shared_ptr<AppletMessageQueue> msg_queue; }; class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> { public: - explicit ISystemAppletProxy(NVFlinger::NVFlinger& nvflinger_, + explicit ISystemAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_) - : ServiceFramework{system_, "ISystemAppletProxy"}, nvflinger{nvflinger_}, - msg_queue{std::move(msg_queue_)} { + : ServiceFramework{system_, "ISystemAppletProxy"}, + nvnflinger{nvnflinger_}, msg_queue{std::move(msg_queue_)} { // clang-format off static const FunctionInfo functions[] = { {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, @@ -140,7 +140,7 @@ public: } private: - void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { + void GetCommonStateGetter(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -148,15 +148,15 @@ private: rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue); } - void GetSelfController(Kernel::HLERequestContext& ctx) { + void GetSelfController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface<ISelfController>(system, nvflinger); + rb.PushIpcInterface<ISelfController>(system, nvnflinger); } - void GetWindowController(Kernel::HLERequestContext& ctx) { + void GetWindowController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -164,7 +164,7 @@ private: rb.PushIpcInterface<IWindowController>(system); } - void GetAudioController(Kernel::HLERequestContext& ctx) { + void GetAudioController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -172,7 +172,7 @@ private: rb.PushIpcInterface<IAudioController>(system); } - void GetDisplayController(Kernel::HLERequestContext& ctx) { + void GetDisplayController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -180,7 +180,7 @@ private: rb.PushIpcInterface<IDisplayController>(system); } - void GetDebugFunctions(Kernel::HLERequestContext& ctx) { + void GetDebugFunctions(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -188,7 +188,7 @@ private: rb.PushIpcInterface<IDebugFunctions>(system); } - void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { + void GetLibraryAppletCreator(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -196,7 +196,7 @@ private: rb.PushIpcInterface<ILibraryAppletCreator>(system); } - void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) { + void GetHomeMenuFunctions(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -204,7 +204,7 @@ private: rb.PushIpcInterface<IHomeMenuFunctions>(system); } - void GetGlobalStateController(Kernel::HLERequestContext& ctx) { + void GetGlobalStateController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -212,7 +212,7 @@ private: rb.PushIpcInterface<IGlobalStateController>(system); } - void GetApplicationCreator(Kernel::HLERequestContext& ctx) { + void GetApplicationCreator(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -220,38 +220,38 @@ private: rb.PushIpcInterface<IApplicationCreator>(system); } - NVFlinger::NVFlinger& nvflinger; + Nvnflinger::Nvnflinger& nvnflinger; std::shared_ptr<AppletMessageQueue> msg_queue; }; -void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) { +void AppletAE::OpenSystemAppletProxy(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface<ISystemAppletProxy>(nvflinger, msg_queue, system); + rb.PushIpcInterface<ISystemAppletProxy>(nvnflinger, msg_queue, system); } -void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) { +void AppletAE::OpenLibraryAppletProxy(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system); + rb.PushIpcInterface<ILibraryAppletProxy>(nvnflinger, msg_queue, system); } -void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) { +void AppletAE::OpenLibraryAppletProxyOld(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger, msg_queue, system); + rb.PushIpcInterface<ILibraryAppletProxy>(nvnflinger, msg_queue, system); } -AppletAE::AppletAE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_, - Core::System& system_) - : ServiceFramework{system_, "appletAE"}, nvflinger{nvflinger_}, msg_queue{ - std::move(msg_queue_)} { +AppletAE::AppletAE(Nvnflinger::Nvnflinger& nvnflinger_, + std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_) + : ServiceFramework{system_, "appletAE"}, nvnflinger{nvnflinger_}, msg_queue{ + std::move(msg_queue_)} { // clang-format off static const FunctionInfo functions[] = { {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"}, diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h index 2147976a6..538ce2903 100644 --- a/src/core/hle/service/am/applet_ae.h +++ b/src/core/hle/service/am/applet_ae.h @@ -12,8 +12,8 @@ namespace FileSystem { class FileSystemController; } -namespace NVFlinger { -class NVFlinger; +namespace Nvnflinger { +class Nvnflinger; } namespace AM { @@ -22,18 +22,18 @@ class AppletMessageQueue; class AppletAE final : public ServiceFramework<AppletAE> { public: - explicit AppletAE(NVFlinger::NVFlinger& nvflinger_, + explicit AppletAE(Nvnflinger::Nvnflinger& nvnflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_); ~AppletAE() override; const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; private: - void OpenSystemAppletProxy(Kernel::HLERequestContext& ctx); - void OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx); - void OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx); + void OpenSystemAppletProxy(HLERequestContext& ctx); + void OpenLibraryAppletProxy(HLERequestContext& ctx); + void OpenLibraryAppletProxyOld(HLERequestContext& ctx); - NVFlinger::NVFlinger& nvflinger; + Nvnflinger::Nvnflinger& nvnflinger; std::shared_ptr<AppletMessageQueue> msg_queue; }; diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp index 00fc4202c..d6c565d85 100644 --- a/src/core/hle/service/am/applet_oe.cpp +++ b/src/core/hle/service/am/applet_oe.cpp @@ -2,20 +2,20 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "common/logging/log.h" -#include "core/hle/ipc_helpers.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applet_oe.h" -#include "core/hle/service/nvflinger/nvflinger.h" +#include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/nvnflinger/nvnflinger.h" namespace Service::AM { class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { public: - explicit IApplicationProxy(NVFlinger::NVFlinger& nvflinger_, + explicit IApplicationProxy(Nvnflinger::Nvnflinger& nvnflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_) - : ServiceFramework{system_, "IApplicationProxy"}, nvflinger{nvflinger_}, - msg_queue{std::move(msg_queue_)} { + : ServiceFramework{system_, "IApplicationProxy"}, + nvnflinger{nvnflinger_}, msg_queue{std::move(msg_queue_)} { // clang-format off static const FunctionInfo functions[] = { {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, @@ -34,7 +34,7 @@ public: } private: - void GetAudioController(Kernel::HLERequestContext& ctx) { + void GetAudioController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -42,7 +42,7 @@ private: rb.PushIpcInterface<IAudioController>(system); } - void GetDisplayController(Kernel::HLERequestContext& ctx) { + void GetDisplayController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -50,7 +50,7 @@ private: rb.PushIpcInterface<IDisplayController>(system); } - void GetDebugFunctions(Kernel::HLERequestContext& ctx) { + void GetDebugFunctions(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -58,7 +58,7 @@ private: rb.PushIpcInterface<IDebugFunctions>(system); } - void GetWindowController(Kernel::HLERequestContext& ctx) { + void GetWindowController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -66,15 +66,15 @@ private: rb.PushIpcInterface<IWindowController>(system); } - void GetSelfController(Kernel::HLERequestContext& ctx) { + void GetSelfController(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface<ISelfController>(system, nvflinger); + rb.PushIpcInterface<ISelfController>(system, nvnflinger); } - void GetCommonStateGetter(Kernel::HLERequestContext& ctx) { + void GetCommonStateGetter(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -82,7 +82,7 @@ private: rb.PushIpcInterface<ICommonStateGetter>(system, msg_queue); } - void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { + void GetLibraryAppletCreator(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -90,7 +90,7 @@ private: rb.PushIpcInterface<ILibraryAppletCreator>(system); } - void GetApplicationFunctions(Kernel::HLERequestContext& ctx) { + void GetApplicationFunctions(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -98,22 +98,22 @@ private: rb.PushIpcInterface<IApplicationFunctions>(system); } - NVFlinger::NVFlinger& nvflinger; + Nvnflinger::Nvnflinger& nvnflinger; std::shared_ptr<AppletMessageQueue> msg_queue; }; -void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { +void AppletOE::OpenApplicationProxy(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); - rb.PushIpcInterface<IApplicationProxy>(nvflinger, msg_queue, system); + rb.PushIpcInterface<IApplicationProxy>(nvnflinger, msg_queue, system); } -AppletOE::AppletOE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_, - Core::System& system_) - : ServiceFramework{system_, "appletOE"}, nvflinger{nvflinger_}, msg_queue{ - std::move(msg_queue_)} { +AppletOE::AppletOE(Nvnflinger::Nvnflinger& nvnflinger_, + std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_) + : ServiceFramework{system_, "appletOE"}, nvnflinger{nvnflinger_}, msg_queue{ + std::move(msg_queue_)} { static const FunctionInfo functions[] = { {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"}, }; diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h index 8fea249f1..39eccc4ab 100644 --- a/src/core/hle/service/am/applet_oe.h +++ b/src/core/hle/service/am/applet_oe.h @@ -12,8 +12,8 @@ namespace FileSystem { class FileSystemController; } -namespace NVFlinger { -class NVFlinger; +namespace Nvnflinger { +class Nvnflinger; } namespace AM { @@ -22,16 +22,16 @@ class AppletMessageQueue; class AppletOE final : public ServiceFramework<AppletOE> { public: - explicit AppletOE(NVFlinger::NVFlinger& nvflinger_, + explicit AppletOE(Nvnflinger::Nvnflinger& nvnflinger_, std::shared_ptr<AppletMessageQueue> msg_queue_, Core::System& system_); ~AppletOE() override; const std::shared_ptr<AppletMessageQueue>& GetMessageQueue() const; private: - void OpenApplicationProxy(Kernel::HLERequestContext& ctx); + void OpenApplicationProxy(HLERequestContext& ctx); - NVFlinger::NVFlinger& nvflinger; + Nvnflinger::Nvnflinger& nvnflinger; std::shared_ptr<AppletMessageQueue> msg_queue; }; diff --git a/src/core/hle/service/am/applets/applet_cabinet.cpp b/src/core/hle/service/am/applets/applet_cabinet.cpp index d0969b0f1..19ed184e8 100644 --- a/src/core/hle/service/am/applets/applet_cabinet.cpp +++ b/src/core/hle/service/am/applets/applet_cabinet.cpp @@ -11,7 +11,7 @@ #include "core/hle/service/am/am.h" #include "core/hle/service/am/applets/applet_cabinet.h" #include "core/hle/service/mii/mii_manager.h" -#include "core/hle/service/nfp/nfp_device.h" +#include "core/hle/service/nfc/common/device.h" namespace Service::AM::Applets { @@ -72,10 +72,10 @@ void Cabinet::Execute() { // TODO: listen on all controllers if (nfp_device == nullptr) { - nfp_device = std::make_shared<Service::NFP::NfpDevice>( + nfp_device = std::make_shared<Service::NFC::NfcDevice>( system.HIDCore().GetFirstNpadId(), system, service_context, availability_change_event); nfp_device->Initialize(); - nfp_device->StartDetection(Service::NFP::TagProtocol::All); + nfp_device->StartDetection(Service::NFC::NfcProtocol::All); } const Core::Frontend::CabinetParameters parameters{ @@ -106,20 +106,22 @@ void Cabinet::DisplayCompleted(bool apply_changes, std::string_view amiibo_name) Cancel(); } - if (nfp_device->GetCurrentState() != Service::NFP::DeviceState::TagFound && - nfp_device->GetCurrentState() != Service::NFP::DeviceState::TagMounted) { + if (nfp_device->GetCurrentState() != Service::NFC::DeviceState::TagFound && + nfp_device->GetCurrentState() != Service::NFC::DeviceState::TagMounted) { Cancel(); } - if (nfp_device->GetCurrentState() == Service::NFP::DeviceState::TagFound) { - nfp_device->Mount(Service::NFP::MountTarget::All); + if (nfp_device->GetCurrentState() == Service::NFC::DeviceState::TagFound) { + nfp_device->Mount(Service::NFP::ModelType::Amiibo, Service::NFP::MountTarget::All); } switch (applet_input_common.applet_mode) { case Service::NFP::CabinetMode::StartNicknameAndOwnerSettings: { - Service::NFP::AmiiboName name{}; - std::memcpy(name.data(), amiibo_name.data(), std::min(amiibo_name.size(), name.size() - 1)); - nfp_device->SetNicknameAndOwner(name); + Service::NFP::RegisterInfoPrivate register_info{}; + std::memcpy(register_info.amiibo_name.data(), amiibo_name.data(), + std::min(amiibo_name.size(), register_info.amiibo_name.size() - 1)); + + nfp_device->SetRegisterInfoPrivate(register_info); break; } case Service::NFP::CabinetMode::StartGameDataEraser: @@ -129,7 +131,7 @@ void Cabinet::DisplayCompleted(bool apply_changes, std::string_view amiibo_name) nfp_device->RestoreAmiibo(); break; case Service::NFP::CabinetMode::StartFormatter: - nfp_device->DeleteAllData(); + nfp_device->Format(); break; default: UNIMPLEMENTED_MSG("Unknown CabinetMode={}", applet_input_common.applet_mode); @@ -174,4 +176,9 @@ void Cabinet::Cancel() { broker.SignalStateChanged(); } +Result Cabinet::RequestExit() { + frontend.Close(); + R_SUCCEED(); +} + } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/applet_cabinet.h b/src/core/hle/service/am/applets/applet_cabinet.h index 84197a807..b56427021 100644 --- a/src/core/hle/service/am/applets/applet_cabinet.h +++ b/src/core/hle/service/am/applets/applet_cabinet.h @@ -19,8 +19,8 @@ namespace Core { class System; } // namespace Core -namespace Service::NFP { -class NfpDevice; +namespace Service::NFC { +class NfcDevice; } namespace Service::AM::Applets { @@ -89,13 +89,14 @@ public: void Execute() override; void DisplayCompleted(bool apply_changes, std::string_view amiibo_name); void Cancel(); + Result RequestExit() override; private: const Core::Frontend::CabinetApplet& frontend; Core::System& system; bool is_complete{false}; - std::shared_ptr<Service::NFP::NfpDevice> nfp_device; + std::shared_ptr<Service::NFC::NfcDevice> nfp_device; Kernel::KEvent* availability_change_event; KernelHelpers::ServiceContext service_context; StartParamForAmiiboSettings applet_input_common{}; diff --git a/src/core/hle/service/am/applets/applet_controller.cpp b/src/core/hle/service/am/applets/applet_controller.cpp index b418031de..9840d2547 100644 --- a/src/core/hle/service/am/applets/applet_controller.cpp +++ b/src/core/hle/service/am/applets/applet_controller.cpp @@ -19,10 +19,9 @@ namespace Service::AM::Applets { -// This error code (0x183ACA) is thrown when the applet fails to initialize. -[[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3101{ErrorModule::HID, 3101}; -// This error code (0x183CCA) is thrown when the u32 result in ControllerSupportResultInfo is 2. -[[maybe_unused]] constexpr Result ERR_CONTROLLER_APPLET_3102{ErrorModule::HID, 3102}; +[[maybe_unused]] constexpr Result ResultControllerSupportCanceled{ErrorModule::HID, 3101}; +[[maybe_unused]] constexpr Result ResultControllerSupportNotSupportedNpadStyle{ErrorModule::HID, + 3102}; static Core::Frontend::ControllerParameters ConvertToFrontendParameters( ControllerSupportArgPrivate private_arg, ControllerSupportArgHeader header, bool enable_text, @@ -225,7 +224,8 @@ void Controller::Execute() { parameters.allow_dual_joycons, parameters.allow_left_joycon, parameters.allow_right_joycon); - frontend.ReconfigureControllers([this] { ConfigurationComplete(); }, parameters); + frontend.ReconfigureControllers( + [this](bool is_success) { ConfigurationComplete(is_success); }, parameters); break; } case ControllerSupportMode::ShowControllerStrapGuide: @@ -233,16 +233,16 @@ void Controller::Execute() { case ControllerSupportMode::ShowControllerKeyRemappingForSystem: UNIMPLEMENTED_MSG("ControllerSupportMode={} is not implemented", controller_private_arg.mode); - ConfigurationComplete(); + ConfigurationComplete(true); break; default: { - ConfigurationComplete(); + ConfigurationComplete(true); break; } } } -void Controller::ConfigurationComplete() { +void Controller::ConfigurationComplete(bool is_success) { ControllerSupportResultInfo result_info{}; // If enable_single_mode is enabled, player_count is 1 regardless of any other parameters. @@ -251,7 +251,8 @@ void Controller::ConfigurationComplete() { result_info.selected_id = static_cast<u32>(system.HIDCore().GetFirstNpadId()); - result_info.result = 0; + result_info.result = + is_success ? ControllerSupportResult::Success : ControllerSupportResult::Cancel; LOG_DEBUG(Service_HID, "Result Info: player_count={}, selected_id={}, result={}", result_info.player_count, result_info.selected_id, result_info.result); @@ -263,4 +264,9 @@ void Controller::ConfigurationComplete() { broker.SignalStateChanged(); } +Result Controller::RequestExit() { + frontend.Close(); + R_SUCCEED(); +} + } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/applet_controller.h b/src/core/hle/service/am/applets/applet_controller.h index 1f9adec65..f6c64f633 100644 --- a/src/core/hle/service/am/applets/applet_controller.h +++ b/src/core/hle/service/am/applets/applet_controller.h @@ -48,6 +48,11 @@ enum class ControllerSupportCaller : u8 { MaxControllerSupportCaller, }; +enum class ControllerSupportResult : u32 { + Success = 0, + Cancel = 2, +}; + struct ControllerSupportArgPrivate { u32 arg_private_size{}; u32 arg_size{}; @@ -112,7 +117,7 @@ struct ControllerSupportResultInfo { s8 player_count{}; INSERT_PADDING_BYTES(3); u32 selected_id{}; - u32 result{}; + ControllerSupportResult result{}; }; static_assert(sizeof(ControllerSupportResultInfo) == 0xC, "ControllerSupportResultInfo has incorrect size."); @@ -129,8 +134,9 @@ public: Result GetStatus() const override; void ExecuteInteractive() override; void Execute() override; + Result RequestExit() override; - void ConfigurationComplete(); + void ConfigurationComplete(bool is_success); private: const Core::Frontend::ControllerApplet& frontend; diff --git a/src/core/hle/service/am/applets/applet_error.cpp b/src/core/hle/service/am/applets/applet_error.cpp index bae0d99a6..b46ea840c 100644 --- a/src/core/hle/service/am/applets/applet_error.cpp +++ b/src/core/hle/service/am/applets/applet_error.cpp @@ -166,7 +166,7 @@ void Error::Execute() { } const auto callback = [this] { DisplayCompleted(); }; - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); const auto& reporter{system.GetReporter()}; switch (mode) { @@ -209,4 +209,9 @@ void Error::DisplayCompleted() { broker.SignalStateChanged(); } +Result Error::RequestExit() { + frontend.Close(); + R_SUCCEED(); +} + } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/applet_error.h b/src/core/hle/service/am/applets/applet_error.h index d78d6f1d1..d822a32bb 100644 --- a/src/core/hle/service/am/applets/applet_error.h +++ b/src/core/hle/service/am/applets/applet_error.h @@ -34,6 +34,7 @@ public: Result GetStatus() const override; void ExecuteInteractive() override; void Execute() override; + Result RequestExit() override; void DisplayCompleted(); 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 e50acdaf6..8b352020e 100644 --- a/src/core/hle/service/am/applets/applet_general_backend.cpp +++ b/src/core/hle/service/am/applets/applet_general_backend.cpp @@ -150,6 +150,11 @@ void Auth::AuthFinished(bool is_successful) { broker.SignalStateChanged(); } +Result Auth::RequestExit() { + frontend.Close(); + R_SUCCEED(); +} + PhotoViewer::PhotoViewer(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::PhotoViewerApplet& frontend_) : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} @@ -186,7 +191,7 @@ void PhotoViewer::Execute() { const auto callback = [this] { ViewFinished(); }; switch (mode) { case PhotoViewerAppletMode::CurrentApp: - frontend.ShowPhotosForApplication(system.GetCurrentProcessProgramID(), callback); + frontend.ShowPhotosForApplication(system.GetApplicationProcessProgramID(), callback); break; case PhotoViewerAppletMode::AllApps: frontend.ShowAllPhotos(callback); @@ -202,6 +207,11 @@ void PhotoViewer::ViewFinished() { broker.SignalStateChanged(); } +Result PhotoViewer::RequestExit() { + frontend.Close(); + R_SUCCEED(); +} + StubApplet::StubApplet(Core::System& system_, AppletId id_, LibraryAppletMode applet_mode_) : Applet{system_, applet_mode_}, id{id_}, system{system_} {} @@ -250,4 +260,9 @@ void StubApplet::Execute() { broker.SignalStateChanged(); } +Result StubApplet::RequestExit() { + // Nothing to do. + R_SUCCEED(); +} + } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/applet_general_backend.h b/src/core/hle/service/am/applets/applet_general_backend.h index a9f2535a2..34ecaebb9 100644 --- a/src/core/hle/service/am/applets/applet_general_backend.h +++ b/src/core/hle/service/am/applets/applet_general_backend.h @@ -28,6 +28,7 @@ public: Result GetStatus() const override; void ExecuteInteractive() override; void Execute() override; + Result RequestExit() override; void AuthFinished(bool is_successful = true); @@ -59,6 +60,7 @@ public: Result GetStatus() const override; void ExecuteInteractive() override; void Execute() override; + Result RequestExit() override; void ViewFinished(); @@ -80,6 +82,7 @@ public: Result GetStatus() const override; void ExecuteInteractive() override; void Execute() override; + Result RequestExit() override; private: AppletId id; diff --git a/src/core/hle/service/am/applets/applet_mii_edit.cpp b/src/core/hle/service/am/applets/applet_mii_edit.cpp index ae80ef506..d1f652c09 100644 --- a/src/core/hle/service/am/applets/applet_mii_edit.cpp +++ b/src/core/hle/service/am/applets/applet_mii_edit.cpp @@ -135,4 +135,9 @@ void MiiEdit::MiiEditOutputForCharInfoEditing(MiiEditResult result, broker.SignalStateChanged(); } +Result MiiEdit::RequestExit() { + frontend.Close(); + R_SUCCEED(); +} + } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/applet_mii_edit.h b/src/core/hle/service/am/applets/applet_mii_edit.h index d18dd3cf5..3f46fae1b 100644 --- a/src/core/hle/service/am/applets/applet_mii_edit.h +++ b/src/core/hle/service/am/applets/applet_mii_edit.h @@ -25,6 +25,7 @@ public: Result GetStatus() const override; void ExecuteInteractive() override; void Execute() override; + Result RequestExit() override; void MiiEditOutput(MiiEditResult result, s32 index); diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp index c738db028..89cb323e9 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/applets/applet_profile_select.cpp @@ -7,13 +7,12 @@ #include "common/string_util.h" #include "core/core.h" #include "core/frontend/applets/profile_select.h" +#include "core/hle/service/acc/errors.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applets/applet_profile_select.h" namespace Service::AM::Applets { -constexpr Result ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1}; - ProfileSelect::ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_, const Core::Frontend::ProfileSelectApplet& frontend_) : Applet{system_, applet_mode_}, frontend{frontend_}, system{system_} {} @@ -26,13 +25,29 @@ void ProfileSelect::Initialize() { final_data.clear(); Applet::Initialize(); + profile_select_version = ProfileSelectAppletVersion{common_args.library_version}; const auto user_config_storage = broker.PopNormalDataToApplet(); ASSERT(user_config_storage != nullptr); const auto& user_config = user_config_storage->GetData(); - ASSERT(user_config.size() >= sizeof(UserSelectionConfig)); - std::memcpy(&config, user_config.data(), sizeof(UserSelectionConfig)); + LOG_INFO(Service_AM, "Initializing Profile Select Applet with version={}", + profile_select_version); + + switch (profile_select_version) { + case ProfileSelectAppletVersion::Version1: + ASSERT(user_config.size() == sizeof(UiSettingsV1)); + std::memcpy(&config_old, user_config.data(), sizeof(UiSettingsV1)); + break; + case ProfileSelectAppletVersion::Version2: + case ProfileSelectAppletVersion::Version3: + ASSERT(user_config.size() == sizeof(UiSettings)); + std::memcpy(&config, user_config.data(), sizeof(UiSettings)); + break; + default: + UNIMPLEMENTED_MSG("Unknown profile_select_version = {}", profile_select_version); + break; + } } bool ProfileSelect::TransactionComplete() const { @@ -53,25 +68,56 @@ void ProfileSelect::Execute() { return; } - frontend.SelectProfile([this](std::optional<Common::UUID> uuid) { SelectionComplete(uuid); }); + Core::Frontend::ProfileSelectParameters parameters{}; + + switch (profile_select_version) { + case ProfileSelectAppletVersion::Version1: + parameters = { + .mode = config_old.mode, + .invalid_uid_list = config_old.invalid_uid_list, + .display_options = config_old.display_options, + .purpose = UserSelectionPurpose::General, + }; + break; + case ProfileSelectAppletVersion::Version2: + case ProfileSelectAppletVersion::Version3: + parameters = { + .mode = config.mode, + .invalid_uid_list = config.invalid_uid_list, + .display_options = config.display_options, + .purpose = config.purpose, + }; + break; + default: + UNIMPLEMENTED_MSG("Unknown profile_select_version = {}", profile_select_version); + break; + } + + frontend.SelectProfile([this](std::optional<Common::UUID> uuid) { SelectionComplete(uuid); }, + parameters); } void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { - UserSelectionOutput output{}; + UiReturnArg output{}; if (uuid.has_value() && uuid->IsValid()) { output.result = 0; output.uuid_selected = *uuid; } else { - status = ERR_USER_CANCELLED_SELECTION; - output.result = ERR_USER_CANCELLED_SELECTION.raw; + status = Account::ResultCancelledByUser; + output.result = Account::ResultCancelledByUser.raw; output.uuid_selected = Common::InvalidUUID; } - final_data = std::vector<u8>(sizeof(UserSelectionOutput)); + final_data = std::vector<u8>(sizeof(UiReturnArg)); std::memcpy(final_data.data(), &output, final_data.size()); broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::move(final_data))); broker.SignalStateChanged(); } +Result ProfileSelect::RequestExit() { + frontend.Close(); + R_SUCCEED(); +} + } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/applet_profile_select.h b/src/core/hle/service/am/applets/applet_profile_select.h index b77f1d205..369f9250f 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.h +++ b/src/core/hle/service/am/applets/applet_profile_select.h @@ -16,19 +16,100 @@ class System; namespace Service::AM::Applets { -struct UserSelectionConfig { - // TODO(DarkLordZach): RE this structure - // It seems to be flags and the like that determine the UI of the applet on the switch... from - // my research this is safe to ignore for now. - INSERT_PADDING_BYTES(0xA0); +enum class ProfileSelectAppletVersion : u32 { + Version1 = 0x1, // 1.0.0+ + Version2 = 0x10000, // 2.0.0+ + Version3 = 0x20000, // 6.0.0+ }; -static_assert(sizeof(UserSelectionConfig) == 0xA0, "UserSelectionConfig has incorrect size."); -struct UserSelectionOutput { +// This is nn::account::UiMode +enum class UiMode { + UserSelector, + UserCreator, + EnsureNetworkServiceAccountAvailable, + UserIconEditor, + UserNicknameEditor, + UserCreatorForStarter, + NintendoAccountAuthorizationRequestContext, + IntroduceExternalNetworkServiceAccount, + IntroduceExternalNetworkServiceAccountForRegistration, + NintendoAccountNnidLinker, + LicenseRequirementsForNetworkService, + LicenseRequirementsForNetworkServiceWithUserContextImpl, + UserCreatorForImmediateNaLoginTest, + UserQualificationPromoter, +}; + +// This is nn::account::UserSelectionPurpose +enum class UserSelectionPurpose { + General, + GameCardRegistration, + EShopLaunch, + EShopItemShow, + PicturePost, + NintendoAccountLinkage, + SettingsUpdate, + SaveDataDeletion, + UserMigration, + SaveDataTransfer, +}; + +// This is nn::account::NintendoAccountStartupDialogType +enum class NintendoAccountStartupDialogType { + LoginAndCreate, + Login, + Create, +}; + +// This is nn::account::UserSelectionSettingsForSystemService +struct UserSelectionSettingsForSystemService { + UserSelectionPurpose purpose; + bool enable_user_creation; + INSERT_PADDING_BYTES(0x3); +}; +static_assert(sizeof(UserSelectionSettingsForSystemService) == 0x8, + "UserSelectionSettingsForSystemService has incorrect size."); + +struct UiSettingsDisplayOptions { + bool is_network_service_account_required; + bool is_skip_enabled; + bool is_system_or_launcher; + bool is_registration_permitted; + bool show_skip_button; + bool aditional_select; + bool show_user_selector; + bool is_unqualified_user_selectable; +}; +static_assert(sizeof(UiSettingsDisplayOptions) == 0x8, + "UiSettingsDisplayOptions has incorrect size."); + +struct UiSettingsV1 { + UiMode mode; + INSERT_PADDING_BYTES(0x4); + std::array<Common::UUID, 8> invalid_uid_list; + u64 application_id; + UiSettingsDisplayOptions display_options; +}; +static_assert(sizeof(UiSettingsV1) == 0x98, "UiSettings has incorrect size."); + +// This is nn::account::UiSettings +struct UiSettings { + UiMode mode; + INSERT_PADDING_BYTES(0x4); + std::array<Common::UUID, 8> invalid_uid_list; + u64 application_id; + UiSettingsDisplayOptions display_options; + UserSelectionPurpose purpose; + INSERT_PADDING_BYTES(0x4); +}; +static_assert(sizeof(UiSettings) == 0xA0, "UiSettings has incorrect size."); + +// This is nn::account::UiReturnArg +struct UiReturnArg { u64 result; Common::UUID uuid_selected; }; -static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has incorrect size."); +static_assert(sizeof(UiReturnArg) == 0x18, "UiReturnArg has incorrect size."); class ProfileSelect final : public Applet { public: @@ -42,13 +123,17 @@ public: Result GetStatus() const override; void ExecuteInteractive() override; void Execute() override; + Result RequestExit() override; void SelectionComplete(std::optional<Common::UUID> uuid); private: const Core::Frontend::ProfileSelectApplet& frontend; - UserSelectionConfig config; + UiSettings config; + UiSettingsV1 config_old; + ProfileSelectAppletVersion profile_select_version; + bool complete = false; Result status = ResultSuccess; std::vector<u8> final_data; diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.cpp b/src/core/hle/service/am/applets/applet_software_keyboard.cpp index c18236045..4145bb84f 100644 --- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp +++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp @@ -770,6 +770,11 @@ void SoftwareKeyboard::ExitKeyboard() { broker.SignalStateChanged(); } +Result SoftwareKeyboard::RequestExit() { + frontend.Close(); + R_SUCCEED(); +} + // Inline Software Keyboard Requests void SoftwareKeyboard::RequestFinalize(const std::vector<u8>& request_data) { diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.h b/src/core/hle/service/am/applets/applet_software_keyboard.h index b01b31c98..2e919811b 100644 --- a/src/core/hle/service/am/applets/applet_software_keyboard.h +++ b/src/core/hle/service/am/applets/applet_software_keyboard.h @@ -31,6 +31,7 @@ public: Result GetStatus() const override; void ExecuteInteractive() override; void Execute() override; + Result RequestExit() override; /** * Submits the input text to the application. diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp index 14aa6f69e..2accf7898 100644 --- a/src/core/hle/service/am/applets/applet_web_browser.cpp +++ b/src/core/hle/service/am/applets/applet_web_browser.cpp @@ -363,6 +363,11 @@ void WebBrowser::WebBrowserExit(WebExitReason exit_reason, std::string last_url) broker.SignalStateChanged(); } +Result WebBrowser::RequestExit() { + frontend.Close(); + R_SUCCEED(); +} + bool WebBrowser::InputTLVExistsInMap(WebArgInputTLVType input_tlv_type) const { return web_arg_input_tlv_map.find(input_tlv_type) != web_arg_input_tlv_map.end(); } @@ -393,7 +398,7 @@ void WebBrowser::InitializeOffline() { switch (document_kind) { case DocumentKind::OfflineHtmlPage: default: - title_id = system.GetCurrentProcessProgramID(); + title_id = system.GetApplicationProcessProgramID(); nca_type = FileSys::ContentRecordType::HtmlDocument; additional_paths = "html-document"; break; diff --git a/src/core/hle/service/am/applets/applet_web_browser.h b/src/core/hle/service/am/applets/applet_web_browser.h index fd727fac8..99fe18659 100644 --- a/src/core/hle/service/am/applets/applet_web_browser.h +++ b/src/core/hle/service/am/applets/applet_web_browser.h @@ -35,6 +35,7 @@ public: Result GetStatus() const override; void ExecuteInteractive() override; void Execute() override; + Result RequestExit() override; void ExtractOfflineRomFS(); diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h index a22eb62a8..12f374199 100644 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/applets/applets.h @@ -142,6 +142,7 @@ public: virtual Result GetStatus() const = 0; virtual void ExecuteInteractive() = 0; virtual void Execute() = 0; + virtual Result RequestExit() = 0; AppletDataBroker& GetBroker() { return broker; diff --git a/src/core/hle/service/am/tcap.cpp b/src/core/hle/service/am/tcap.cpp deleted file mode 100644 index 818420e22..000000000 --- a/src/core/hle/service/am/tcap.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "core/hle/service/am/tcap.h" - -namespace Service::AM { - -TCAP::TCAP(Core::System& system_) : ServiceFramework{system_, "tcap"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetContinuousHighSkinTemperatureEvent"}, - {1, nullptr, "SetOperationMode"}, - {2, nullptr, "LoadAndApplySettings"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -TCAP::~TCAP() = default; - -} // namespace Service::AM diff --git a/src/core/hle/service/am/tcap.h b/src/core/hle/service/am/tcap.h deleted file mode 100644 index 6b2148c29..000000000 --- a/src/core/hle/service/am/tcap.h +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "core/hle/service/service.h" - -namespace Core { -class System; -} - -namespace Service::AM { - -class TCAP final : public ServiceFramework<TCAP> { -public: - explicit TCAP(Core::System& system_); - ~TCAP() override; -}; - -} // namespace Service::AM |