MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / intUpdateCPUCycles

Function intUpdateCPUCycles

pcsx2/Interpreter.cpp:29–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27void intEventTest();
28
29void intUpdateCPUCycles()
30{
31 const bool lowcycles = (cpuBlockCycles <= 40);
32 const s8 cyclerate = EmuConfig.Speedhacks.EECycleRate;
33 u32 scale_cycles = 0;
34
35 if (cyclerate == 0 || lowcycles || cyclerate < -99 || cyclerate > 3)
36 scale_cycles = cpuBlockCycles >> 3;
37
38 else if (cyclerate > 1)
39 scale_cycles = cpuBlockCycles >> (2 + cyclerate);
40
41 else if (cyclerate == 1)
42 scale_cycles = (cpuBlockCycles >> 3) / 1.3f; // Adds a mild 30% increase in clockspeed for value 1.
43
44 else if (cyclerate == -1) // the mildest value.
45 // These values were manually tuned to yield mild speedup with high compatibility
46 scale_cycles = (cpuBlockCycles <= 80 || cpuBlockCycles > 168 ? 5 : 7) * cpuBlockCycles / 32;
47
48 else
49 scale_cycles = ((5 + (-2 * (cyclerate + 1))) * cpuBlockCycles) >> 5;
50
51 // Ensure block cycle count is never less than 1.
52 cpuRegs.cycle += (scale_cycles < 1) ? 1 : scale_cycles;
53
54 if (cyclerate > 1)
55 {
56 cpuBlockCycles &= (0x1 << (cyclerate + 2)) - 1;
57 }
58 else
59 {
60 cpuBlockCycles &= 0x7;
61 }
62}
63
64// These macros are used to assemble the repassembler functions
65

Callers 9

_doBranch_sharedFunction · 0.85
doBranchFunction · 0.85
intDoBranchFunction · 0.85
_vu0runFunction · 0.85
LBFunction · 0.85
LBUFunction · 0.85
LHFunction · 0.85
LHUFunction · 0.85
LWFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected