| 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 | { |
no test coverage detected