diff options
Diffstat (limited to 'src/core/hle/service/am')
-rw-r--r-- | src/core/hle/service/am/am.cpp | 133 | ||||
-rw-r--r-- | src/core/hle/service/am/am.h | 26 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/applets.cpp | 40 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/applets.h | 18 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/controller.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/error.cpp | 10 | ||||
-rw-r--r-- | src/core/hle/service/am/applets/software_keyboard.cpp | 4 |
7 files changed, 151 insertions, 85 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index c9808060a..8e1fe9438 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -13,11 +13,12 @@ #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_readable_event.h" +#include "core/hle/kernel/k_writable_event.h" #include "core/hle/kernel/kernel.h" #include "core/hle/kernel/process.h" -#include "core/hle/kernel/readable_event.h" #include "core/hle/kernel/transfer_memory.h" -#include "core/hle/kernel/writable_event.h" #include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applet_ae.h" @@ -303,17 +304,18 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv RegisterHandlers(functions); auto& kernel = system.Kernel(); - launchable_event = - Kernel::WritableEvent::CreateEventPair(kernel, "ISelfController:LaunchableEvent"); + launchable_event = Kernel::KEvent::Create(kernel, "ISelfController:LaunchableEvent"); + launchable_event->Initialize(); // This event is created by AM on the first time GetAccumulatedSuspendedTickChangedEvent() is // called. Yuzu can just create it unconditionally, since it doesn't need to support multiple // ISelfControllers. The event is signaled on creation, and on transition from suspended -> not // suspended if the event has previously been created by a call to // GetAccumulatedSuspendedTickChangedEvent. - accumulated_suspended_tick_changed_event = Kernel::WritableEvent::CreateEventPair( - kernel, "ISelfController:AccumulatedSuspendedTickChangedEvent"); - accumulated_suspended_tick_changed_event.writable->Signal(); + accumulated_suspended_tick_changed_event = + Kernel::KEvent::Create(kernel, "ISelfController:AccumulatedSuspendedTickChangedEvent"); + accumulated_suspended_tick_changed_event->Initialize(); + accumulated_suspended_tick_changed_event->GetWritableEvent()->Signal(); } ISelfController::~ISelfController() = default; @@ -372,11 +374,11 @@ void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) { void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); - launchable_event.writable->Signal(); + launchable_event->GetWritableEvent()->Signal(); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(launchable_event.readable); + rb.PushCopyObjects(launchable_event->GetReadableEvent()); } void ISelfController::SetScreenShotPermission(Kernel::HLERequestContext& ctx) { @@ -555,41 +557,42 @@ void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequest IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(accumulated_suspended_tick_changed_event.readable); + rb.PushCopyObjects(accumulated_suspended_tick_changed_event->GetReadableEvent()); } AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel) { - on_new_message = - Kernel::WritableEvent::CreateEventPair(kernel, "AMMessageQueue:OnMessageReceived"); + on_new_message = Kernel::KEvent::Create(kernel, "AMMessageQueue:OnMessageReceived"); + on_new_message->Initialize(); on_operation_mode_changed = - Kernel::WritableEvent::CreateEventPair(kernel, "AMMessageQueue:OperationModeChanged"); + Kernel::KEvent::Create(kernel, "AMMessageQueue:OperationModeChanged"); + on_operation_mode_changed->Initialize(); } AppletMessageQueue::~AppletMessageQueue() = default; -const std::shared_ptr<Kernel::ReadableEvent>& AppletMessageQueue::GetMessageReceiveEvent() const { - return on_new_message.readable; +const std::shared_ptr<Kernel::KReadableEvent>& AppletMessageQueue::GetMessageReceiveEvent() const { + return on_new_message->GetReadableEvent(); } -const std::shared_ptr<Kernel::ReadableEvent>& AppletMessageQueue::GetOperationModeChangedEvent() +const std::shared_ptr<Kernel::KReadableEvent>& AppletMessageQueue::GetOperationModeChangedEvent() const { - return on_operation_mode_changed.readable; + return on_operation_mode_changed->GetReadableEvent(); } void AppletMessageQueue::PushMessage(AppletMessage msg) { messages.push(msg); - on_new_message.writable->Signal(); + on_new_message->GetWritableEvent()->Signal(); } AppletMessageQueue::AppletMessage AppletMessageQueue::PopMessage() { if (messages.empty()) { - on_new_message.writable->Clear(); + on_new_message->GetWritableEvent()->Clear(); return AppletMessage::NoMessage; } auto msg = messages.front(); messages.pop(); if (messages.empty()) { - on_new_message.writable->Clear(); + on_new_message->GetWritableEvent()->Clear(); } return msg; } @@ -601,7 +604,7 @@ std::size_t AppletMessageQueue::GetMessageCount() const { void AppletMessageQueue::OperationModeChanged() { PushMessage(AppletMessage::OperationModeChanged); PushMessage(AppletMessage::PerformanceModeChanged); - on_operation_mode_changed.writable->Signal(); + on_operation_mode_changed->GetWritableEvent()->Signal(); } void AppletMessageQueue::RequestExit() { @@ -635,7 +638,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, {50, &ICommonStateGetter::IsVrModeEnabled, "IsVrModeEnabled"}, {51, &ICommonStateGetter::SetVrModeEnabled, "SetVrModeEnabled"}, {52, &ICommonStateGetter::SetLcdBacklighOffEnabled, "SetLcdBacklighOffEnabled"}, - {53, nullptr, "BeginVrModeEx"}, + {53, &ICommonStateGetter::BeginVrModeEx, "BeginVrModeEx"}, {54, &ICommonStateGetter::EndVrModeEx, "EndVrModeEx"}, {55, nullptr, "IsInControllerFirmwareUpdateSection"}, {60, &ICommonStateGetter::GetDefaultDisplayResolution, "GetDefaultDisplayResolution"}, @@ -732,6 +735,13 @@ void ICommonStateGetter::SetLcdBacklighOffEnabled(Kernel::HLERequestContext& ctx rb.Push(RESULT_SUCCESS); } +void ICommonStateGetter::BeginVrModeEx(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); +} + void ICommonStateGetter::EndVrModeEx(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); @@ -856,7 +866,7 @@ public: {25, nullptr, "Terminate"}, {30, &ILibraryAppletAccessor::GetResult, "GetResult"}, {50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"}, - {60, nullptr, "PresetLibraryAppletGpuTimeSliceZero"}, + {60, &ILibraryAppletAccessor::PresetLibraryAppletGpuTimeSliceZero, "PresetLibraryAppletGpuTimeSliceZero"}, {100, &ILibraryAppletAccessor::PushInData, "PushInData"}, {101, &ILibraryAppletAccessor::PopOutData, "PopOutData"}, {102, nullptr, "PushExtraStorage"}, @@ -900,6 +910,13 @@ private: rb.Push(applet->GetStatus()); } + void PresetLibraryAppletGpuTimeSliceZero(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + } + void Start(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); @@ -1030,20 +1047,21 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { const u64 offset{rp.Pop<u64>()}; const std::vector<u8> data{ctx.ReadBuffer()}; + const std::size_t size{std::min(data.size(), backing.GetSize() - offset)}; - LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, data.size()); + LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size); - if (data.size() > backing.GetSize() - offset) { + if (offset > backing.GetSize()) { LOG_ERROR(Service_AM, "offset is out of bounds, backing_buffer_sz={}, data_size={}, offset={}", - backing.GetSize(), data.size(), offset); + backing.GetSize(), size, offset); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ERR_SIZE_OUT_OF_BOUNDS); return; } - std::memcpy(backing.GetData().data() + offset, data.data(), data.size()); + std::memcpy(backing.GetData().data() + offset, data.data(), size); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -1053,11 +1071,11 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 offset{rp.Pop<u64>()}; - const std::size_t size{ctx.GetWriteBufferSize()}; + const std::size_t size{std::min(ctx.GetWriteBufferSize(), backing.GetSize() - offset)}; LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size); - if (size > backing.GetSize() - offset) { + if (offset > backing.GetSize()) { LOG_ERROR(Service_AM, "offset is out of bounds, backing_buffer_sz={}, size={}, offset={}", backing.GetSize(), size, offset); @@ -1178,7 +1196,7 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_) {40, &IApplicationFunctions::NotifyRunning, "NotifyRunning"}, {50, &IApplicationFunctions::GetPseudoDeviceId, "GetPseudoDeviceId"}, {60, nullptr, "SetMediaPlaybackStateForApplication"}, - {65, nullptr, "IsGamePlayRecordingSupported"}, + {65, &IApplicationFunctions::IsGamePlayRecordingSupported, "IsGamePlayRecordingSupported"}, {66, &IApplicationFunctions::InitializeGamePlayRecording, "InitializeGamePlayRecording"}, {67, &IApplicationFunctions::SetGamePlayRecordingState, "SetGamePlayRecordingState"}, {68, nullptr, "RequestFlushGamePlayingMovieForDebug"}, @@ -1199,10 +1217,10 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_) {124, nullptr, "EnableApplicationAllThreadDumpOnCrash"}, {130, &IApplicationFunctions::GetGpuErrorDetectedSystemEvent, "GetGpuErrorDetectedSystemEvent"}, {140, &IApplicationFunctions::GetFriendInvitationStorageChannelEvent, "GetFriendInvitationStorageChannelEvent"}, - {141, nullptr, "TryPopFromFriendInvitationStorageChannel"}, + {141, &IApplicationFunctions::TryPopFromFriendInvitationStorageChannel, "TryPopFromFriendInvitationStorageChannel"}, {150, nullptr, "GetNotificationStorageChannelEvent"}, {151, nullptr, "TryPopFromNotificationStorageChannel"}, - {160, nullptr, "GetHealthWarningDisappearedSystemEvent"}, + {160, &IApplicationFunctions::GetHealthWarningDisappearedSystemEvent, "GetHealthWarningDisappearedSystemEvent"}, {170, nullptr, "SetHdcpAuthenticationActivated"}, {180, nullptr, "GetLaunchRequiredVersion"}, {181, nullptr, "UpgradeLaunchRequiredVersion"}, @@ -1215,11 +1233,15 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_) RegisterHandlers(functions); auto& kernel = system.Kernel(); - gpu_error_detected_event = Kernel::WritableEvent::CreateEventPair( - kernel, "IApplicationFunctions:GpuErrorDetectedSystemEvent"); - - friend_invitation_storage_channel_event = Kernel::WritableEvent::CreateEventPair( - kernel, "IApplicationFunctions:FriendInvitationStorageChannelEvent"); + gpu_error_detected_event = + Kernel::KEvent::Create(kernel, "IApplicationFunctions:GpuErrorDetectedSystemEvent"); + gpu_error_detected_event->Initialize(); + friend_invitation_storage_channel_event = + Kernel::KEvent::Create(kernel, "IApplicationFunctions:FriendInvitationStorageChannelEvent"); + friend_invitation_storage_channel_event->Initialize(); + health_warning_disappeared_system_event = + Kernel::KEvent::Create(kernel, "IApplicationFunctions:HealthWarningDisappearedSystemEvent"); + health_warning_disappeared_system_event->Initialize(); } IApplicationFunctions::~IApplicationFunctions() = default; @@ -1466,6 +1488,16 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { rb.Push(*res_code); } +void IApplicationFunctions::IsGamePlayRecordingSupported(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + constexpr bool gameplay_recording_supported = false; + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.Push(gameplay_recording_supported); +} + void IApplicationFunctions::InitializeGamePlayRecording(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); @@ -1606,7 +1638,7 @@ void IApplicationFunctions::GetGpuErrorDetectedSystemEvent(Kernel::HLERequestCon IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(gpu_error_detected_event.readable); + rb.PushCopyObjects(gpu_error_detected_event->GetReadableEvent()); } void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(Kernel::HLERequestContext& ctx) { @@ -1614,7 +1646,23 @@ void IApplicationFunctions::GetFriendInvitationStorageChannelEvent(Kernel::HLERe IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(friend_invitation_storage_channel_event.readable); + rb.PushCopyObjects(friend_invitation_storage_channel_event->GetReadableEvent()); +} + +void IApplicationFunctions::TryPopFromFriendInvitationStorageChannel( + Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ERR_NO_DATA_IN_CHANNEL); +} + +void IApplicationFunctions::GetHealthWarningDisappearedSystemEvent(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushCopyObjects(health_warning_disappeared_system_event->GetReadableEvent()); } void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger& nvflinger, @@ -1650,8 +1698,9 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) RegisterHandlers(functions); - pop_from_general_channel_event = Kernel::WritableEvent::CreateEventPair( - system.Kernel(), "IHomeMenuFunctions:PopFromGeneralChannelEvent"); + pop_from_general_channel_event = + Kernel::KEvent::Create(system.Kernel(), "IHomeMenuFunctions:PopFromGeneralChannelEvent"); + pop_from_general_channel_event->Initialize(); } IHomeMenuFunctions::~IHomeMenuFunctions() = default; @@ -1668,7 +1717,7 @@ void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); - rb.PushCopyObjects(pop_from_general_channel_event.readable); + rb.PushCopyObjects(pop_from_general_channel_event->GetReadableEvent()); } IGlobalStateController::IGlobalStateController(Core::System& system_) diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index f51aca1af..6911f0d6e 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -7,11 +7,12 @@ #include <chrono> #include <memory> #include <queue> -#include "core/hle/kernel/writable_event.h" + #include "core/hle/service/service.h" namespace Kernel { class KernelCore; +class KEvent; class TransferMemory; } // namespace Kernel @@ -55,8 +56,8 @@ public: explicit AppletMessageQueue(Kernel::KernelCore& kernel); ~AppletMessageQueue(); - const std::shared_ptr<Kernel::ReadableEvent>& GetMessageReceiveEvent() const; - const std::shared_ptr<Kernel::ReadableEvent>& GetOperationModeChangedEvent() const; + const std::shared_ptr<Kernel::KReadableEvent>& GetMessageReceiveEvent() const; + const std::shared_ptr<Kernel::KReadableEvent>& GetOperationModeChangedEvent() const; void PushMessage(AppletMessage msg); AppletMessage PopMessage(); std::size_t GetMessageCount() const; @@ -65,8 +66,8 @@ public: private: std::queue<AppletMessage> messages; - Kernel::EventPair on_new_message; - Kernel::EventPair on_operation_mode_changed; + std::shared_ptr<Kernel::KEvent> on_new_message; + std::shared_ptr<Kernel::KEvent> on_operation_mode_changed; }; class IWindowController final : public ServiceFramework<IWindowController> { @@ -153,8 +154,8 @@ private: }; NVFlinger::NVFlinger& nvflinger; - Kernel::EventPair launchable_event; - Kernel::EventPair accumulated_suspended_tick_changed_event; + std::shared_ptr<Kernel::KEvent> launchable_event; + std::shared_ptr<Kernel::KEvent> accumulated_suspended_tick_changed_event; u32 idle_time_detection_extension = 0; u64 num_fatal_sections_entered = 0; @@ -189,6 +190,7 @@ private: 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); @@ -265,6 +267,7 @@ private: 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); @@ -287,12 +290,15 @@ private: void GetPreviousProgramIndex(Kernel::HLERequestContext& ctx); void GetGpuErrorDetectedSystemEvent(Kernel::HLERequestContext& ctx); void GetFriendInvitationStorageChannelEvent(Kernel::HLERequestContext& ctx); + void TryPopFromFriendInvitationStorageChannel(Kernel::HLERequestContext& ctx); + void GetHealthWarningDisappearedSystemEvent(Kernel::HLERequestContext& ctx); bool launch_popped_application_specific = false; bool launch_popped_account_preselect = false; s32 previous_program_index{-1}; - Kernel::EventPair gpu_error_detected_event; - Kernel::EventPair friend_invitation_storage_channel_event; + std::shared_ptr<Kernel::KEvent> gpu_error_detected_event; + std::shared_ptr<Kernel::KEvent> friend_invitation_storage_channel_event; + std::shared_ptr<Kernel::KEvent> health_warning_disappeared_system_event; }; class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { @@ -304,7 +310,7 @@ private: void RequestToGetForeground(Kernel::HLERequestContext& ctx); void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx); - Kernel::EventPair pop_from_general_channel_event; + std::shared_ptr<Kernel::KEvent> pop_from_general_channel_event; }; class IGlobalStateController final : public ServiceFramework<IGlobalStateController> { diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp index 08676c3fc..e2f3b7563 100644 --- a/src/core/hle/service/am/applets/applets.cpp +++ b/src/core/hle/service/am/applets/applets.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include <cstring> + #include "common/assert.h" #include "core/core.h" #include "core/frontend/applets/controller.h" @@ -11,9 +12,10 @@ #include "core/frontend/applets/profile_select.h" #include "core/frontend/applets/software_keyboard.h" #include "core/frontend/applets/web_browser.h" -#include "core/hle/kernel/readable_event.h" +#include "core/hle/kernel/k_event.h" +#include "core/hle/kernel/k_readable_event.h" +#include "core/hle/kernel/k_writable_event.h" #include "core/hle/kernel/server_session.h" -#include "core/hle/kernel/writable_event.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applets/applets.h" #include "core/hle/service/am/applets/controller.h" @@ -27,11 +29,13 @@ namespace Service::AM::Applets { AppletDataBroker::AppletDataBroker(Kernel::KernelCore& kernel) { state_changed_event = - Kernel::WritableEvent::CreateEventPair(kernel, "ILibraryAppletAccessor:StateChangedEvent"); - pop_out_data_event = - Kernel::WritableEvent::CreateEventPair(kernel, "ILibraryAppletAccessor:PopDataOutEvent"); - pop_interactive_out_data_event = Kernel::WritableEvent::CreateEventPair( - kernel, "ILibraryAppletAccessor:PopInteractiveDataOutEvent"); + Kernel::KEvent::Create(kernel, "ILibraryAppletAccessor:StateChangedEvent"); + state_changed_event->Initialize(); + pop_out_data_event = Kernel::KEvent::Create(kernel, "ILibraryAppletAccessor:PopDataOutEvent"); + pop_out_data_event->Initialize(); + pop_interactive_out_data_event = + Kernel::KEvent::Create(kernel, "ILibraryAppletAccessor:PopInteractiveDataOutEvent"); + pop_interactive_out_data_event->Initialize(); } AppletDataBroker::~AppletDataBroker() = default; @@ -58,7 +62,7 @@ std::shared_ptr<IStorage> AppletDataBroker::PopNormalDataToGame() { auto out = std::move(out_channel.front()); out_channel.pop_front(); - pop_out_data_event.writable->Clear(); + pop_out_data_event->GetWritableEvent()->Clear(); return out; } @@ -77,7 +81,7 @@ std::shared_ptr<IStorage> AppletDataBroker::PopInteractiveDataToGame() { auto out = std::move(out_interactive_channel.front()); out_interactive_channel.pop_front(); - pop_interactive_out_data_event.writable->Clear(); + pop_interactive_out_data_event->GetWritableEvent()->Clear(); return out; } @@ -96,7 +100,7 @@ void AppletDataBroker::PushNormalDataFromGame(std::shared_ptr<IStorage>&& storag void AppletDataBroker::PushNormalDataFromApplet(std::shared_ptr<IStorage>&& storage) { out_channel.emplace_back(std::move(storage)); - pop_out_data_event.writable->Signal(); + pop_out_data_event->GetWritableEvent()->Signal(); } void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& storage) { @@ -105,23 +109,23 @@ void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& s void AppletDataBroker::PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&& storage) { out_interactive_channel.emplace_back(std::move(storage)); - pop_interactive_out_data_event.writable->Signal(); + pop_interactive_out_data_event->GetWritableEvent()->Signal(); } void AppletDataBroker::SignalStateChanged() const { - state_changed_event.writable->Signal(); + state_changed_event->GetWritableEvent()->Signal(); } -std::shared_ptr<Kernel::ReadableEvent> AppletDataBroker::GetNormalDataEvent() const { - return pop_out_data_event.readable; +std::shared_ptr<Kernel::KReadableEvent> AppletDataBroker::GetNormalDataEvent() const { + return pop_out_data_event->GetReadableEvent(); } -std::shared_ptr<Kernel::ReadableEvent> AppletDataBroker::GetInteractiveDataEvent() const { - return pop_interactive_out_data_event.readable; +std::shared_ptr<Kernel::KReadableEvent> AppletDataBroker::GetInteractiveDataEvent() const { + return pop_interactive_out_data_event->GetReadableEvent(); } -std::shared_ptr<Kernel::ReadableEvent> AppletDataBroker::GetStateChangedEvent() const { - return state_changed_event.readable; +std::shared_ptr<Kernel::KReadableEvent> AppletDataBroker::GetStateChangedEvent() const { + return state_changed_event->GetReadableEvent(); } Applet::Applet(Kernel::KernelCore& kernel_) : broker{kernel_} {} diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h index 4fd792c05..b9a006317 100644 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/applets/applets.h @@ -6,9 +6,9 @@ #include <memory> #include <queue> + #include "common/swap.h" #include "core/hle/kernel/object.h" -#include "core/hle/kernel/writable_event.h" union ResultCode; @@ -29,7 +29,9 @@ class WebBrowserApplet; namespace Kernel { class KernelCore; -} +class KEvent; +class KReadableEvent; +} // namespace Kernel namespace Service::AM { @@ -87,9 +89,9 @@ public: void SignalStateChanged() const; - std::shared_ptr<Kernel::ReadableEvent> GetNormalDataEvent() const; - std::shared_ptr<Kernel::ReadableEvent> GetInteractiveDataEvent() const; - std::shared_ptr<Kernel::ReadableEvent> GetStateChangedEvent() const; + std::shared_ptr<Kernel::KReadableEvent> GetNormalDataEvent() const; + std::shared_ptr<Kernel::KReadableEvent> GetInteractiveDataEvent() const; + std::shared_ptr<Kernel::KReadableEvent> GetStateChangedEvent() const; private: // Queues are named from applet's perspective @@ -106,13 +108,13 @@ private: // PopInteractiveDataToGame and PushInteractiveDataFromApplet std::deque<std::shared_ptr<IStorage>> out_interactive_channel; - Kernel::EventPair state_changed_event; + std::shared_ptr<Kernel::KEvent> state_changed_event; // Signaled on PushNormalDataFromApplet - Kernel::EventPair pop_out_data_event; + std::shared_ptr<Kernel::KEvent> pop_out_data_event; // Signaled on PushInteractiveDataFromApplet - Kernel::EventPair pop_interactive_out_data_event; + std::shared_ptr<Kernel::KEvent> pop_interactive_out_data_event; }; class Applet { diff --git a/src/core/hle/service/am/applets/controller.cpp b/src/core/hle/service/am/applets/controller.cpp index 7edfca64e..c2bfe698f 100644 --- a/src/core/hle/service/am/applets/controller.cpp +++ b/src/core/hle/service/am/applets/controller.cpp @@ -37,7 +37,7 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters( .border_colors = std::move(identification_colors), .enable_explain_text = enable_text, .explain_text = std::move(text), - .allow_pro_controller = npad_style_set.pro_controller == 1, + .allow_pro_controller = npad_style_set.fullkey == 1, .allow_handheld = npad_style_set.handheld == 1, .allow_dual_joycons = npad_style_set.joycon_dual == 1, .allow_left_joycon = npad_style_set.joycon_left == 1, @@ -211,7 +211,8 @@ void Controller::Execute() { case ControllerSupportMode::ShowControllerFirmwareUpdate: UNIMPLEMENTED_MSG("ControllerSupportMode={} is not implemented", controller_private_arg.mode); - [[fallthrough]]; + ConfigurationComplete(); + break; default: { ConfigurationComplete(); break; diff --git a/src/core/hle/service/am/applets/error.cpp b/src/core/hle/service/am/applets/error.cpp index d85505082..0c8b632e8 100644 --- a/src/core/hle/service/am/applets/error.cpp +++ b/src/core/hle/service/am/applets/error.cpp @@ -20,9 +20,9 @@ namespace Service::AM::Applets { struct ShowError { u8 mode; bool jump; - INSERT_UNION_PADDING_BYTES(4); + INSERT_PADDING_BYTES_NOINIT(4); bool use_64bit_error_code; - INSERT_UNION_PADDING_BYTES(1); + INSERT_PADDING_BYTES_NOINIT(1); u64 error_code_64; u32 error_code_32; }; @@ -32,7 +32,7 @@ static_assert(sizeof(ShowError) == 0x14, "ShowError has incorrect size."); struct ShowErrorRecord { u8 mode; bool jump; - INSERT_UNION_PADDING_BYTES(6); + INSERT_PADDING_BYTES_NOINIT(6); u64 error_code_64; u64 posix_time; }; @@ -41,7 +41,7 @@ static_assert(sizeof(ShowErrorRecord) == 0x18, "ShowErrorRecord has incorrect si struct SystemErrorArg { u8 mode; bool jump; - INSERT_UNION_PADDING_BYTES(6); + INSERT_PADDING_BYTES_NOINIT(6); u64 error_code_64; std::array<char, 8> language_code; std::array<char, 0x800> main_text; @@ -52,7 +52,7 @@ static_assert(sizeof(SystemErrorArg) == 0x1018, "SystemErrorArg has incorrect si struct ApplicationErrorArg { u8 mode; bool jump; - INSERT_UNION_PADDING_BYTES(6); + INSERT_PADDING_BYTES_NOINIT(6); u32 error_code; std::array<char, 8> language_code; std::array<char, 0x800> main_text; diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp index 3022438b1..79b209c6b 100644 --- a/src/core/hle/service/am/applets/software_keyboard.cpp +++ b/src/core/hle/service/am/applets/software_keyboard.cpp @@ -121,6 +121,10 @@ void SoftwareKeyboard::ExecuteInteractive() { std::memcpy(&request, data.data(), sizeof(Request)); switch (request) { + case Request::Finalize: + complete = true; + broker.SignalStateChanged(); + break; case Request::Calc: { broker.PushNormalDataFromApplet(std::make_shared<IStorage>(system, std::vector<u8>{1})); broker.SignalStateChanged(); |