2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

time: Fix CalculateSpanBetween implementation

CalculateSpanBetween 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.

Partially fixes Super Smash Bros. Ultimate's Spirit Board
This commit is contained in:
Morph 2021-03-10 11:15:05 -05:00
parent daf5c5060b
commit 87cfe5b1da

View file

@ -341,12 +341,18 @@ void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser(
void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) { void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_Time, "called"); LOG_DEBUG(Service_Time, "called");
IPC::RequestParser rp{ctx}; Clock::ClockSnapshot snapshot_a;
const auto snapshot_a = rp.PopRaw<Clock::ClockSnapshot>(); Clock::ClockSnapshot snapshot_b;
const auto snapshot_b = rp.PopRaw<Clock::ClockSnapshot>();
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));
Clock::TimeSpanType time_span_type{}; Clock::TimeSpanType time_span_type{};
s64 span{}; s64 span{};
if (const ResultCode result{snapshot_a.steady_clock_time_point.GetSpanBetween( if (const ResultCode result{snapshot_a.steady_clock_time_point.GetSpanBetween(
snapshot_b.steady_clock_time_point, span)}; snapshot_b.steady_clock_time_point, span)};
result != RESULT_SUCCESS) { result != RESULT_SUCCESS) {