From 7fb7d3c218b41777da5959f1ea56ed504f7203f5 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 6 Jul 2019 12:13:34 -0700 Subject: am: Implement GetAccumulatedSuspendedTickValue --- src/core/hle/service/am/am.cpp | 25 ++++++++++++++++++------- src/core/hle/service/am/am.h | 1 + 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'src/core/hle/service/am') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 33cebb48b..aef494476 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -270,7 +270,7 @@ ISelfController::ISelfController(std::shared_ptr nvflinger {70, nullptr, "ReportMultimediaError"}, {71, nullptr, "GetCurrentIlluminanceEx"}, {80, nullptr, "SetWirelessPriorityMode"}, - {90, nullptr, "GetAccumulatedSuspendedTickValue"}, + {90, &ISelfController::GetAccumulatedSuspendedTickValue, "GetAccumulatedSuspendedTickValue"}, {91, &ISelfController::GetAccumulatedSuspendedTickChangedEvent, "GetAccumulatedSuspendedTickChangedEvent"}, {100, nullptr, "SetAlbumImageTakenNotificationEnabled"}, {1000, nullptr, "GetDebugStorageChannel"}, @@ -283,10 +283,13 @@ ISelfController::ISelfController(std::shared_ptr nvflinger launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, "ISelfController:LaunchableEvent"); - // TODO(ogniK): Figure out where, when and why this event gets signalled + // 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, Kernel::ResetType::Manual, "ISelfController:AccumulatedSuspendedTickChangedEvent"); - accumulated_suspended_tick_changed_event.writable->Signal(); // Is signalled on creation + accumulated_suspended_tick_changed_event.writable->Signal(); } ISelfController::~ISelfController() = default; @@ -449,11 +452,19 @@ void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& c rb.Push(idle_time_detection_extension); } +void ISelfController::GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called."); + + // This command returns the total number of system ticks since ISelfController creation + // where the game was suspended. Since Yuzu doesn't implement game suspension, this command + // can just always return 0 ticks. + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(RESULT_SUCCESS); + rb.Push(0); +} + void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx) { - // The implementation of this function is fine as is, the reason we're labelling it as stubbed - // is because we're currently unsure when and where accumulated_suspended_tick_changed_event is - // actually signalled for the time being. - LOG_WARNING(Service_AM, "(STUBBED) called"); + LOG_DEBUG(Service_AM, "called."); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(RESULT_SUCCESS); diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 4ea609d23..49ff20959 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -133,6 +133,7 @@ private: void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx); void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); + void GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx); void GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx); std::shared_ptr nvflinger; -- cgit v1.2.3 From 36259c01c2f18ee43a5b444908e087366890e775 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 6 Jul 2019 13:52:05 -0700 Subject: clang-format fixes --- src/core/hle/service/am/am.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/core/hle/service/am') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index aef494476..eced38001 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -283,10 +283,11 @@ ISelfController::ISelfController(std::shared_ptr nvflinger launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, "ISelfController:LaunchableEvent"); - // 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. + // 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, Kernel::ResetType::Manual, "ISelfController:AccumulatedSuspendedTickChangedEvent"); accumulated_suspended_tick_changed_event.writable->Signal(); -- cgit v1.2.3