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

Function rcntEndGate

pcsx2/Counters.cpp:849–885  ·  view source on GitHub ↗

mode - 0 means hblank signal, 8 means vblank signal.

Source from the content-addressed store, hash-verified

847
848// mode - 0 means hblank signal, 8 means vblank signal.
849static __fi void rcntEndGate(bool isVblank, u64 sCycle)
850{
851 for (int i = 0; i < 4; i++)
852 {
853 if (!counters[i].mode.EnableGate)
854 continue;
855
856 if ((!!counters[i].mode.GateSource) != isVblank)
857 continue;
858
859 switch (counters[i].mode.GateMode)
860 {
861 case 0x0: //Count When Signal is low (V_RENDER ONLY)
862 counters[i].startCycle = sCycle & ~((u64)counters[i].rate - 1);
863
864 EECNT_LOG("EE Counter[%d] %s EndGate Type0, count = %x", i,
865 isVblank ? "vblank" : "hblank", counters[i].count);
866 break;
867
868 case 0x1: // Reset on Vsync start
869 // This is the vsync end so do nothing
870 break;
871
872 case 0x2: // Reset on Vsync end
873 case 0x3: // Reset on Vsync start and end
874 rcntSyncCounter(i);
875 EECNT_LOG("EE Counter[%d] %s EndGate Type%d, count = %x", i,
876 isVblank ? "vblank" : "hblank", counters[i].mode.GateMode, counters[i].count);
877 counters[i].count = 0;
878 counters[i].target &= 0xffff;
879 counters[i].startCycle = sCycle & ~(static_cast<u64>(counters[i].rate - 1));
880 break;
881 }
882 }
883 // Note: No need to set counters here. They'll get set when control returns to
884 // rcntUpdate, since we're being called from there anyway.
885}
886
887static __fi void rcntWmode(int index, u32 value)
888{

Callers 2

VSyncEndFunction · 0.85
rcntUpdate_hScanlineFunction · 0.85

Calls 1

rcntSyncCounterFunction · 0.85

Tested by

no test coverage detected