Merge pull request #15006 from Sintendo/mfspr-movsx

Jit64: mfspr - Sign-extend slice_length
This commit is contained in:
Jordan Woyak
2026-11-14 14:57:32 -06:00
committed by GitHub

View File

@@ -333,20 +333,16 @@ void Jit64::mfspr(UGeckoInstruction inst)
CVTSI2SS(XMM0, PPCSTATE(downcount));
MULSS(XMM0, MDisp(rcx, offsetof(CoreTiming::Globals, last_OC_factor_inverted)));
CVTSS2SI(rdx, R(XMM0)); // RDX is downcount scaled by the overclocking factor
MOV(32, rax, MDisp(rcx, offsetof(CoreTiming::Globals, slice_length)));
MOVSX(64, 32, rax, MDisp(rcx, offsetof(CoreTiming::Globals, slice_length)));
SUB(64, rax, rdx); // cycles since the last CoreTiming::Advance() event is (slicelength -
// Scaled_downcount)
ADD(64, rax, MDisp(rcx, offsetof(CoreTiming::Globals, global_timer)));
SUB(64, rax, MDisp(rcx, offsetof(CoreTiming::Globals, fake_TB_start_ticks)));
// It might seem convenient to correct the timer for the block position here for even more
// accurate
// timing, but as of currently, this can break games. If we end up reading a time *after* the
// time
// at which an interrupt was supposed to occur, e.g. because we're 100 cycles into a block with
// only
// 50 downcount remaining, some games don't function correctly, such as Karaoke Party
// Revolution,
// which won't get past the loading screen.
// accurate timing, but as of currently, this can break games. If we end up reading a time
// *after* the time at which an interrupt was supposed to occur, e.g. because we're 100 cycles
// into a block with only 50 downcount remaining, some games don't function correctly, such as
// Karaoke Party Revolution, which won't get past the loading screen.
// if (js.downcountAmount)
// ADD(64, rax, Imm32(js.downcountAmount));