From 28d3661a5cd98e3a1e7e18cda8cf9e4b0d2ae555 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 7 Apr 2021 23:34:14 -0400 Subject: [PATCH] service: time: Fix CalculateStandardUserSystemClockDifferenceByUser CalculateStandardUserSystemClockDifferenceByUser passes in the ClockSnapshots through 2 input buffers and not as raw arguments. Fix this by reading the 2 input buffers instead of popping raw arguments. --- src/core/hle/service/time/time.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 78543688f..f6ff39789 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -321,9 +321,14 @@ void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser( Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); - IPC::RequestParser rp{ctx}; - const auto snapshot_a = rp.PopRaw(); - const auto snapshot_b = rp.PopRaw(); + Clock::ClockSnapshot snapshot_a; + Clock::ClockSnapshot snapshot_b; + + const auto snapshot_a_data = ctx.ReadBuffer(0); + const auto snapshot_b_data = ctx.ReadBuffer(1); + + std::memcpy(&snapshot_a, snapshot_a_data.data(), sizeof(Clock::ClockSnapshot)); + std::memcpy(&snapshot_b, snapshot_b_data.data(), sizeof(Clock::ClockSnapshot)); auto time_span_type{Clock::TimeSpanType::FromSeconds(snapshot_b.user_context.offset - snapshot_a.user_context.offset)};