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

Function rcntUpdate_vSync

pcsx2/Counters.cpp:587–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585#endif
586
587__fi void rcntUpdate_vSync()
588{
589 if (!cpuTestCycle(vsyncCounter.startCycle, vsyncCounter.deltaCycles))
590 return;
591
592 if (vsyncCounter.Mode == MODE_VBLANK)
593 {
594 vsyncCounter.startCycle += vSyncInfo.Blank;
595 vsyncCounter.deltaCycles = vSyncInfo.Render;
596
597 VSyncEnd(vsyncCounter.startCycle);
598
599 vsyncCounter.Mode = MODE_VRENDER; // VSYNC END - Render begin
600 }
601 else if (vsyncCounter.Mode == MODE_GSBLANK) // GS CSR Swap and interrupt
602 {
603 GSVSync();
604
605 vsyncCounter.Mode = MODE_VBLANK;
606 // Don't set the start cycle, makes it easier to calculate the correct Vsync End time
607 vsyncCounter.deltaCycles = vSyncInfo.Blank;
608 }
609 else // VSYNC Start
610 {
611 vsyncCounter.startCycle += vSyncInfo.Render;
612 vsyncCounter.deltaCycles = vSyncInfo.GSBlank;
613
614 VSyncStart(vsyncCounter.startCycle);
615
616 vsyncCounter.Mode = MODE_GSBLANK;
617
618 // Accumulate hsync rounding errors:
619 hsyncCounter.deltaCycles += vSyncInfo.hSyncError;
620
621#ifdef VSYNC_DEBUG
622 vblankinc++;
623 if (vblankinc > 1)
624 {
625 if (hsc != vSyncInfo.hScanlinesPerFrame)
626 Console.WriteLn(" ** vSync > Abnormal Scanline Count: %d", hsc);
627 hsc = 0;
628 vblankinc = 0;
629 }
630#endif
631 }
632}
633
634__fi void rcntUpdate_hScanline()
635{

Callers 1

rcntUpdateFunction · 0.85

Calls 5

cpuTestCycleFunction · 0.85
VSyncEndFunction · 0.85
GSVSyncFunction · 0.85
VSyncStartFunction · 0.85
WriteLnMethod · 0.45

Tested by

no test coverage detected