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

Function __GXShutdown

src/dolphin/src/gx/GXInit.c:140–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138#endif
139
140static int __GXShutdown(BOOL final)
141{
142 u32 reg;
143 u32 peCountNew;
144 OSTime timeNew;
145
146 static u32 peCount;
147 static OSTime time;
148 static u32 calledOnce;
149
150 if (!final)
151 {
152 if (!calledOnce)
153 {
154 peCount = __GXReadMEMCounterU32(0x28, 0x27);
155 time = OSGetTime();
156 calledOnce = 1;
157 return 0;
158 }
159
160 timeNew = OSGetTime();
161 peCountNew = __GXReadMEMCounterU32(0x28, 0x27);
162
163 if (timeNew - time < 10)
164 {
165 return 0;
166 }
167
168 if (peCountNew != peCount)
169 {
170 peCount = peCountNew;
171 time = timeNew;
172 return 0;
173 }
174 }
175 else
176 {
177 GXSetBreakPtCallback(NULL);
178 GXSetDrawSyncCallback(NULL);
179 GXSetDrawDoneCallback(NULL);
180
181 GX_WRITE_U32(0);
182 GX_WRITE_U32(0);
183 GX_WRITE_U32(0);
184 GX_WRITE_U32(0);
185 GX_WRITE_U32(0);
186 GX_WRITE_U32(0);
187 GX_WRITE_U32(0);
188 GX_WRITE_U32(0);
189
190 PPCSync();
191
192 reg = 0;
193 GX_SET_CP_REG(1, reg);
194
195 reg = 3;
196 GX_SET_CP_REG(2, reg);
197

Callers

nothing calls this directly

Calls 7

__GXReadMEMCounterU32Function · 0.85
OSGetTimeFunction · 0.85
GXSetBreakPtCallbackFunction · 0.85
GXSetDrawSyncCallbackFunction · 0.85
GXSetDrawDoneCallbackFunction · 0.85
PPCSyncFunction · 0.85
__GXAbortFunction · 0.85

Tested by

no test coverage detected