hle: kernel: Migrate KReadableEvent and KWritableEvent to KAutoObject.
This commit is contained in:
parent
eba3bb9d21
commit
2e8d6fe9a0
35 changed files with 219 additions and 204 deletions
|
@ -320,7 +320,7 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv
|
|||
Kernel::KAutoObject::Create(std::addressof(accumulated_suspended_tick_changed_event));
|
||||
accumulated_suspended_tick_changed_event.Initialize(
|
||||
"ISelfController:AccumulatedSuspendedTickChangedEvent");
|
||||
accumulated_suspended_tick_changed_event.GetWritableEvent()->Signal();
|
||||
accumulated_suspended_tick_changed_event.GetWritableEvent().Signal();
|
||||
}
|
||||
|
||||
ISelfController::~ISelfController() = default;
|
||||
|
@ -379,7 +379,7 @@ void ISelfController::LeaveFatalSection(Kernel::HLERequestContext& ctx) {
|
|||
void ISelfController::GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
||||
|
||||
launchable_event.GetWritableEvent()->Signal();
|
||||
launchable_event.GetWritableEvent().Signal();
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
@ -592,28 +592,28 @@ AppletMessageQueue::AppletMessageQueue(Kernel::KernelCore& kernel)
|
|||
|
||||
AppletMessageQueue::~AppletMessageQueue() = default;
|
||||
|
||||
Kernel::KReadableEvent* AppletMessageQueue::GetMessageReceiveEvent() const {
|
||||
return on_new_message.GetReadableEvent().get();
|
||||
Kernel::KReadableEvent& AppletMessageQueue::GetMessageReceiveEvent() {
|
||||
return on_new_message.GetReadableEvent();
|
||||
}
|
||||
|
||||
Kernel::KReadableEvent* AppletMessageQueue::GetOperationModeChangedEvent() const {
|
||||
return on_operation_mode_changed.GetReadableEvent().get();
|
||||
Kernel::KReadableEvent& AppletMessageQueue::GetOperationModeChangedEvent() {
|
||||
return on_operation_mode_changed.GetReadableEvent();
|
||||
}
|
||||
|
||||
void AppletMessageQueue::PushMessage(AppletMessage msg) {
|
||||
messages.push(msg);
|
||||
on_new_message.GetWritableEvent()->Signal();
|
||||
on_new_message.GetWritableEvent().Signal();
|
||||
}
|
||||
|
||||
AppletMessageQueue::AppletMessage AppletMessageQueue::PopMessage() {
|
||||
if (messages.empty()) {
|
||||
on_new_message.GetWritableEvent()->Clear();
|
||||
on_new_message.GetWritableEvent().Clear();
|
||||
return AppletMessage::NoMessage;
|
||||
}
|
||||
auto msg = messages.front();
|
||||
messages.pop();
|
||||
if (messages.empty()) {
|
||||
on_new_message.GetWritableEvent()->Clear();
|
||||
on_new_message.GetWritableEvent().Clear();
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ void AppletMessageQueue::FocusStateChanged() {
|
|||
void AppletMessageQueue::OperationModeChanged() {
|
||||
PushMessage(AppletMessage::OperationModeChanged);
|
||||
PushMessage(AppletMessage::PerformanceModeChanged);
|
||||
on_operation_mode_changed.GetWritableEvent()->Signal();
|
||||
on_operation_mode_changed.GetWritableEvent().Signal();
|
||||
}
|
||||
|
||||
ICommonStateGetter::ICommonStateGetter(Core::System& system_,
|
||||
|
@ -930,11 +930,9 @@ private:
|
|||
void GetAppletStateChangedEvent(Kernel::HLERequestContext& ctx) {
|
||||
LOG_DEBUG(Service_AM, "called");
|
||||
|
||||
const auto event = applet->GetBroker().GetStateChangedEvent();
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushCopyObjects(event);
|
||||
rb.PushCopyObjects(applet->GetBroker().GetStateChangedEvent());
|
||||
}
|
||||
|
||||
void IsCompleted(Kernel::HLERequestContext& ctx) {
|
||||
|
|
|
@ -56,8 +56,8 @@ public:
|
|||
explicit AppletMessageQueue(Kernel::KernelCore& kernel);
|
||||
~AppletMessageQueue();
|
||||
|
||||
Kernel::KReadableEvent* GetMessageReceiveEvent() const;
|
||||
Kernel::KReadableEvent* GetOperationModeChangedEvent() const;
|
||||
Kernel::KReadableEvent& GetMessageReceiveEvent();
|
||||
Kernel::KReadableEvent& GetOperationModeChangedEvent();
|
||||
void PushMessage(AppletMessage msg);
|
||||
AppletMessage PopMessage();
|
||||
std::size_t GetMessageCount() const;
|
||||
|
|
|
@ -66,7 +66,7 @@ std::shared_ptr<IStorage> AppletDataBroker::PopNormalDataToGame() {
|
|||
|
||||
auto out = std::move(out_channel.front());
|
||||
out_channel.pop_front();
|
||||
pop_out_data_event.GetWritableEvent()->Clear();
|
||||
pop_out_data_event.GetWritableEvent().Clear();
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,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.GetWritableEvent()->Clear();
|
||||
pop_interactive_out_data_event.GetWritableEvent().Clear();
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,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.GetWritableEvent()->Signal();
|
||||
pop_out_data_event.GetWritableEvent().Signal();
|
||||
}
|
||||
|
||||
void AppletDataBroker::PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& storage) {
|
||||
|
@ -113,11 +113,11 @@ 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.GetWritableEvent()->Signal();
|
||||
pop_interactive_out_data_event.GetWritableEvent().Signal();
|
||||
}
|
||||
|
||||
void AppletDataBroker::SignalStateChanged() {
|
||||
state_changed_event.GetWritableEvent()->Signal();
|
||||
state_changed_event.GetWritableEvent().Signal();
|
||||
|
||||
switch (applet_mode) {
|
||||
case LibraryAppletMode::AllForeground:
|
||||
|
@ -141,16 +141,16 @@ void AppletDataBroker::SignalStateChanged() {
|
|||
}
|
||||
}
|
||||
|
||||
Kernel::KReadableEvent* AppletDataBroker::GetNormalDataEvent() const {
|
||||
return pop_out_data_event.GetReadableEvent().get();
|
||||
Kernel::KReadableEvent& AppletDataBroker::GetNormalDataEvent() {
|
||||
return pop_out_data_event.GetReadableEvent();
|
||||
}
|
||||
|
||||
Kernel::KReadableEvent* AppletDataBroker::GetInteractiveDataEvent() const {
|
||||
return pop_interactive_out_data_event.GetReadableEvent().get();
|
||||
Kernel::KReadableEvent& AppletDataBroker::GetInteractiveDataEvent() {
|
||||
return pop_interactive_out_data_event.GetReadableEvent();
|
||||
}
|
||||
|
||||
Kernel::KReadableEvent* AppletDataBroker::GetStateChangedEvent() const {
|
||||
return state_changed_event.GetReadableEvent().get();
|
||||
Kernel::KReadableEvent& AppletDataBroker::GetStateChangedEvent() {
|
||||
return state_changed_event.GetReadableEvent();
|
||||
}
|
||||
|
||||
Applet::Applet(Core::System& system_, LibraryAppletMode applet_mode_)
|
||||
|
|
|
@ -96,11 +96,11 @@ public:
|
|||
void PushInteractiveDataFromGame(std::shared_ptr<IStorage>&& storage);
|
||||
void PushInteractiveDataFromApplet(std::shared_ptr<IStorage>&& storage);
|
||||
|
||||
void SignalStateChanged() const;
|
||||
void SignalStateChanged();
|
||||
|
||||
Kernel::KReadableEvent* GetNormalDataEvent() const;
|
||||
Kernel::KReadableEvent* GetInteractiveDataEvent() const;
|
||||
Kernel::KReadableEvent* GetStateChangedEvent() const;
|
||||
Kernel::KReadableEvent& GetNormalDataEvent();
|
||||
Kernel::KReadableEvent& GetInteractiveDataEvent();
|
||||
Kernel::KReadableEvent& GetStateChangedEvent();
|
||||
|
||||
private:
|
||||
Core::System& system;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue