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

Function _doBranch_shared

pcsx2/Interpreter.cpp:219–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219static __fi void _doBranch_shared(u32 tar)
220{
221 branch2 = cpuRegs.branch = 1;
222 execI();
223
224 // branch being 0 means an exception was thrown, since only the exception
225 // handler should ever clear it.
226
227 if( cpuRegs.branch != 0 )
228 {
229 if (Cpu == &intCpu)
230 {
231 if (intLastBranchTo == tar && EmuConfig.Speedhacks.WaitLoop)
232 {
233 intUpdateCPUCycles();
234 bool can_skip = true;
235 if (tar != 0x81fc0)
236 {
237 if ((cpuRegs.pc - tar) < (4 * 10))
238 {
239 for (u32 i = tar; i < cpuRegs.pc; i += 4)
240 {
241 if (PSM(i) != 0)
242 {
243 can_skip = false;
244 break;
245 }
246 }
247 }
248 else
249 can_skip = false;
250 }
251
252 if (can_skip)
253 {
254 if (static_cast<s64>(cpuRegs.nextEventCycle - cpuRegs.cycle) > 0)
255 cpuRegs.cycle = cpuRegs.nextEventCycle;
256 else
257 cpuRegs.nextEventCycle = cpuRegs.cycle;
258 }
259 }
260 }
261 intLastBranchTo = tar;
262 cpuRegs.pc = tar;
263 cpuRegs.branch = 0;
264 }
265}
266
267static void doBranch( u32 target )
268{

Callers 2

doBranchFunction · 0.85
intDoBranchFunction · 0.85

Calls 2

intUpdateCPUCyclesFunction · 0.85
execIFunction · 0.70

Tested by

no test coverage detected