MCPcopy Create free account
hub / github.com/doldecomp/mkdd / waitForTick

Function waitForTick

libs/JSystem/JFramework/JFWDisplay.cpp:379–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379void waitForTick(u32 p1, u16 p2) {
380 if (p1 != 0) {
381 static s64 nextTick = OSGetTime();
382 s64 time = OSGetTime();
383 while (time < nextTick) {
384 JFWDisplay::getManager()->threadSleep((nextTick - time));
385 time = OSGetTime();
386 }
387 nextTick = time + p1;
388 }
389 else {
390 static u32 nextCount = VIGetRetraceCount();
391 u32 uVar1 = (p2 == 0) ? 1 : p2;
392 OSMessage msg;
393 do {
394 if (!OSReceiveMessage(JUTVideo::getManager()->getMessageQueue(), &msg, OS_MESSAGE_BLOCK)) {
395 msg = 0;
396 }
397 } while (((int)msg - (int)nextCount) < 0);
398 nextCount = (int)msg + uVar1;
399 }
400}
401
402void JFWThreadAlarmHandler(OSAlarm *p_alarm, OSContext *p_ctx) {
403 JFWAlarm *alarm = static_cast<JFWAlarm *>(p_alarm);

Callers 2

beginRenderMethod · 0.85
waitBlankingMethod · 0.85

Calls 5

OSGetTimeFunction · 0.85
VIGetRetraceCountFunction · 0.85
OSReceiveMessageFunction · 0.85
threadSleepMethod · 0.80
getMessageQueueMethod · 0.80

Tested by

no test coverage detected