From 28e0607522ea46cfbced8cb9d86cf3ec7bcbce36 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sun, 10 Apr 2016 00:10:56 +1200 Subject: [PATCH] Fix Metroid: Other M During boot of Other M, there is momentarily a period when VICallback's cycles late is larger than GetTicksPerHalfLine(). Because GetTicksPerHalfLine() returns a u32 and c++'s weird type promotion rules, cycleslate gets promoted from a s32 to a u32 and the result of the substraction is a really large u32. Before ScheduleEvent accuracy improvements, ScheduleEvent took a s32, so the result got cast back to the small negitave we expect. But it now takes a s64 and the u32 to s64 conversion gives us a really large number (around two seconds) and Other M times out while waiting for something. --- Source/Core/Core/HW/SystemTimers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp index e900e33762..a46110775d 100644 --- a/Source/Core/Core/HW/SystemTimers.cpp +++ b/Source/Core/Core/HW/SystemTimers.cpp @@ -118,7 +118,7 @@ static void IPC_HLE_UpdateCallback(u64 userdata, int cyclesLate) static void VICallback(u64 userdata, int cyclesLate) { VideoInterface::Update(); - CoreTiming::ScheduleEvent(VideoInterface::GetTicksPerHalfLine() - cyclesLate, et_VI); + CoreTiming::ScheduleEvent(s64(VideoInterface::GetTicksPerHalfLine()) - cyclesLate, et_VI); } static void DecrementerCallback(u64 userdata, int cyclesLate)