MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / __VIRetraceHandler

Function __VIRetraceHandler

src/dolphin/src/vi/vi.c:127–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127static void __VIRetraceHandler(__OSInterrupt interrupt, OSContext* context)
128{
129 OSContext exceptionContext;
130 u16 viReg;
131 u32 inter = 0;
132
133 viReg = __VIRegs[VI_DISP_INT_0];
134 if (viReg & 0x8000)
135 {
136 __VIRegs[VI_DISP_INT_0] = (u16)(viReg & ~0x8000);
137 inter |= 1;
138 }
139
140 viReg = __VIRegs[VI_DISP_INT_1];
141 if (viReg & 0x8000)
142 {
143 __VIRegs[VI_DISP_INT_1] = (u16)(viReg & ~0x8000);
144 inter |= 2;
145 }
146
147 viReg = __VIRegs[VI_DISP_INT_2];
148 if (viReg & 0x8000)
149 {
150 __VIRegs[VI_DISP_INT_2] = (u16)(viReg & ~0x8000);
151 inter |= 4;
152 }
153
154 viReg = __VIRegs[VI_DISP_INT_3];
155 if (viReg & 0x8000)
156 {
157 __VIRegs[VI_DISP_INT_3] = (u16)(viReg & ~0x8000);
158 inter |= 8;
159 }
160
161 if ((inter & 4) || (inter & 8))
162 {
163 OSClearContext(&exceptionContext);
164 OSSetCurrentContext(&exceptionContext);
165 if (PositionCallback)
166 {
167 s16 x, y;
168 __VIGetCurrentPosition(&x, &y);
169 (*PositionCallback)(x, y);
170 }
171 OSClearContext(&exceptionContext);
172 OSSetCurrentContext(context);
173 return;
174 }
175
176 retraceCount++;
177
178 OSClearContext(&exceptionContext);
179 OSSetCurrentContext(&exceptionContext);
180 if (PreCB)
181 {
182 (*PreCB)(retraceCount);
183 }
184

Callers

nothing calls this directly

Calls 4

__VIGetCurrentPositionFunction · 0.85
VISetRegsFunction · 0.85
SIRefreshSamplingRateFunction · 0.85
OSWakeupThreadFunction · 0.85

Tested by

no test coverage detected