mirror of https://github.com/zeldaret/botw.git
ksys/act: Fix matching issues in BaseProcJobQue
This commit is contained in:
parent
d893fd5ead
commit
ce1b6900ab
|
@ -97023,8 +97023,8 @@ Address,Quality,Size,Name
|
|||
0x0000007101306960,O,000116,_ZN4ksys3act14BaseProcJobQue4initEPN4sead4HeapE
|
||||
0x00000071013069d4,O,000208,_ZN4ksys3act14BaseProcJobQue12pushJobQueueEPN4sead9WorkerMgrEPNS0_16BaseProcJobListsEiNS0_7JobTypeE
|
||||
0x0000007101306aa4,O,000516,_ZN4ksys3act14BaseProcJobQue8pushJobsEPN4sead11FixedSizeJQEPNS0_16BaseProcJobListsEibNS0_7JobTypeE
|
||||
0x0000007101306ca8,m,000288,_ZN4ksys3act14BaseProcJobQue13pushExtraJobsEPN4sead11FixedSizeJQEPNS0_16BaseProcJobListsEiNS0_7JobTypeE
|
||||
0x0000007101306dc8,W,000180,_ZN4ksys3act14BaseProcJobQue13pushExtraJobsEPN4sead11FixedSizeJQERKN3agl3utl14AtomicPtrArrayINS0_15BaseProcJobLinkEEE
|
||||
0x0000007101306ca8,O,000288,_ZN4ksys3act14BaseProcJobQue13pushExtraJobsEPN4sead11FixedSizeJQEPNS0_16BaseProcJobListsEiNS0_7JobTypeE
|
||||
0x0000007101306dc8,O,000180,_ZN4ksys3act14BaseProcJobQue13pushExtraJobsEPN4sead11FixedSizeJQERKN3agl3utl14AtomicPtrArrayINS0_15BaseProcJobLinkEEE
|
||||
0x0000007101306e7c,O,000028,_ZN4ksys3act11BaseProcJob6invokeEv
|
||||
0x0000007101306e98,O,000036,_ZN4ksys3act11BaseProcJobD0Ev
|
||||
0x0000007101306ebc,U,000080,
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -59,8 +59,8 @@ bool BaseProcJobQue::pushJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* lists,
|
|||
for (int i = 1; link && i <= rounds; ++i)
|
||||
link = static_cast<BaseProcJobLink*>(lists->getNextJob(link));
|
||||
|
||||
mPool[mFreeJobIdx].set(batch_head, rounds);
|
||||
queue->enque(&mPool[mFreeJobIdx]);
|
||||
mPool(mFreeJobIdx).set(batch_head, rounds);
|
||||
queue->enque(&mPool(mFreeJobIdx));
|
||||
num_remaining_jobs -= rounds;
|
||||
rounds = std::min(rounds, num_remaining_jobs);
|
||||
++mFreeJobIdx;
|
||||
|
@ -70,8 +70,8 @@ bool BaseProcJobQue::pushJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* lists,
|
|||
for (int i = 1; link && i <= num_remaining_jobs; ++i) {
|
||||
link->getProc()->onJobPush(type);
|
||||
if (!link->getProc()->shouldSkipJobPush(type)) {
|
||||
mPool[mFreeJobIdx].set(link, 1);
|
||||
queue->enque(&mPool[mFreeJobIdx]);
|
||||
mPool(mFreeJobIdx).set(link, 1);
|
||||
queue->enque(&mPool(mFreeJobIdx));
|
||||
++mFreeJobIdx;
|
||||
}
|
||||
link = static_cast<BaseProcJobLink*>(lists->getNextJob(link));
|
||||
|
@ -80,8 +80,6 @@ bool BaseProcJobQue::pushJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* lists,
|
|||
return true;
|
||||
}
|
||||
|
||||
// sxtw + madd -> smaddl
|
||||
#ifdef NON_MATCHING
|
||||
bool BaseProcJobQue::pushExtraJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* lists, int priority,
|
||||
JobType type) {
|
||||
const auto& list = lists->getList(priority);
|
||||
|
@ -91,21 +89,21 @@ bool BaseProcJobQue::pushExtraJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* l
|
|||
for (auto* link = static_cast<BaseProcJobLink*>(list.front()); link;
|
||||
link = static_cast<BaseProcJobLink*>(lists->getNextJob(link))) {
|
||||
const auto idx = mNumExtraJobs.increment();
|
||||
if (idx >= mPool.size())
|
||||
if (!isIndexValid(idx))
|
||||
return false;
|
||||
|
||||
link->getProc()->onJobPush(type);
|
||||
|
||||
BaseProcJob& job = mPool[idx];
|
||||
if (!link->getProc()->shouldSkipJobPush(type)) {
|
||||
mPool[idx].set(link, 1);
|
||||
if (!queue->enque(&mPool[idx]))
|
||||
job.set(link, 1);
|
||||
if (!queue->enque(&job))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool BaseProcJobQue::pushExtraJobs(sead::FixedSizeJQ* queue,
|
||||
const agl::utl::AtomicPtrArray<BaseProcJobLink>& links) {
|
||||
|
@ -114,7 +112,7 @@ bool BaseProcJobQue::pushExtraJobs(sead::FixedSizeJQ* queue,
|
|||
|
||||
for (auto it = links.begin(), end = links.end(); it != end; ++it) {
|
||||
const auto idx = mNumExtraJobs.increment();
|
||||
if (idx >= mPool.size())
|
||||
if (!isIndexValid(idx))
|
||||
return false;
|
||||
|
||||
mPool[idx].mJobLink = &*it;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <agl/Utils/aglAtomicPtrArray.h>
|
||||
#include <array>
|
||||
#include <basis/seadTypes.h>
|
||||
#include <container/seadSafeArray.h>
|
||||
#include <mc/seadJob.h>
|
||||
#include <mc/seadJobQueue.h>
|
||||
#include <thread/seadAtomic.h>
|
||||
|
@ -35,11 +36,12 @@ public:
|
|||
private:
|
||||
bool pushJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* lists, int priority,
|
||||
bool should_reset_job_idx, JobType type);
|
||||
bool isIndexValid(int idx) const { return u32(idx) < u32(mPool.size()); }
|
||||
|
||||
int mFreeJobIdx = 0;
|
||||
sead::FixedSizeJQ mJobQueue;
|
||||
std::array<BaseProcJob, 1200> mPool;
|
||||
sead::Atomic<u32> mNumExtraJobs = 0;
|
||||
sead::SafeArray<BaseProcJob, 1200> mPool;
|
||||
sead::Atomic<int> mNumExtraJobs = 0;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(BaseProcJobQue, 0xbc38);
|
||||
|
||||
|
|
Loading…
Reference in New Issue