Avoid reusing uids for kernel objects.

This makes logs easier to read: a uid is an X is an X.  Usually.
Still sequential, and if it runs out, falls back.
This commit is contained in:
Unknown W. Brackets committed 2013-03-31 22:29:44 -07:00
1 parent 086fd24edb
commit 0547d291e3
2 files changed
+6

No files matched your search

+5
View File
@@ -368,12 +368,16 @@ u32 sceKernelIcacheClearAll()
KernelObjectPool::KernelObjectPool()
{
memset(occupied, 0, sizeof(bool)*maxCount);
nextID = 16;
}
SceUID KernelObjectPool::Create(KernelObject *obj, int rangeBottom, int rangeTop)
{
if (rangeTop > maxCount)
rangeTop = maxCount;
if (nextID >= rangeBottom && nextID < rangeTop)
rangeBottom = nextID++;
for (int i = rangeBottom; i < rangeTop; i++)
{
if (!occupied[i])
@@ -462,6 +466,7 @@ void KernelObjectPool::DoState(PointerWrap &p)
kernelObjects.Clear();
}
p.Do(nextID);
p.DoArray(occupied, maxCount);
for (int i = 0; i < maxCount; ++i)
{
+1
View File
@@ -435,6 +435,7 @@ private:
};
KernelObject *pool[maxCount];
bool occupied[maxCount];
int nextID;
};
extern KernelObjectPool kernelObjects;