MCPcopy Create free account
hub / github.com/clementgallet/libTAS / U5_JobQueue_ScheduleGroup

Function U5_JobQueue_ScheduleGroup

src/library/UnityHacks.cpp:505–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503}
504
505static JobGroupID U5_JobQueue_ScheduleGroup(JobQueue *t, JobGroup* x, int y)
506{
507 LOG(LL_TRACE, LCF_HACKS, "U5_JobQueue_ScheduleGroup called with JobGroup %p and priority %d", x, y);
508
509 /* Return value is 16 bytes (accross registers RDX:RAX), so we need to use
510 * a 16-byte struct to recover it. */
511 JobGroupID j = orig::U5_JobQueue_ScheduleGroup(t, x, y);
512 LOG(LL_DEBUG, LCF_HACKS, " returns JobGroup %p and JobGroup tag %d", j.group, j.tag);
513
514 if (Global::shared_config.game_specific_sync & SharedConfig::GC_SYNC_UNITY_JOBS) {
515 /* Try waiting for the job */
516 if (orig::U5_JobQueue_HasJobGroupIDCompleted) {
517
518 bool has_completed = false;
519 for (int i = 0; i < 100; i++) {
520 if (orig::U5_JobQueue_HasJobGroupIDCompleted(t, j.group, j.tag)) {
521 has_completed = true;
522 break;
523 }
524 NATIVECALL(usleep(100));
525 }
526 if (!has_completed)
527 LOG(LL_WARN, LCF_HACKS, " We could not wait for job group %p/%d to finish...", j.group, j.tag);
528 }
529
530 // if (orig::U5_JobQueue_WaitForJobGroup)
531 // orig::U5_JobQueue_WaitForJobGroup(t, j.group, j.tag, true);
532 // else if (orig::U5_JobQueue_WaitForJobGroupID)
533 // orig::U5_JobQueue_WaitForJobGroupID(t, j.group, j.tag);
534 }
535
536 return j;
537}
538
539static JobGroupID U5_JobQueue_ScheduleJobMultipleDependencies(JobQueue *t, void* func, void* arg, JobGroupID* x, int y)
540{

Callers

nothing calls this directly

Calls 2

usleepFunction · 0.85

Tested by

no test coverage detected