mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-01 19:54:15 +01:00
Start KThread
TID from 1 rather than 0
HOS's TIDs are one-based rather than zero-based, certain titles such as Pokémon Arceus, Naruto Shippuden: Ultimate Ninja Storm 3, Splatoon 3, etc. use the TID being zero as a sentinel value but as we assigned this ID to our first thread prior it broke this logic which has now been fixed by this commit as it now matches HOS behavior.
This commit is contained in:
parent
bab659587f
commit
7a3d2e4a26
@ -75,7 +75,8 @@ namespace skyline::kernel::type {
|
|||||||
mainThreadStack = std::make_shared<KPrivateMemory>(state, 0, span<u8>{state.process->memory.stack.data(), state.process->npdm.meta.mainThreadStackSize}, memory::Permission{true, true, false}, memory::states::Stack);
|
mainThreadStack = std::make_shared<KPrivateMemory>(state, 0, span<u8>{state.process->memory.stack.data(), state.process->npdm.meta.mainThreadStackSize}, memory::Permission{true, true, false}, memory::states::Stack);
|
||||||
stackTop = mainThreadStack->guest.end().base();
|
stackTop = mainThreadStack->guest.end().base();
|
||||||
}
|
}
|
||||||
auto thread{NewHandle<KThread>(this, threads.size(), entry, argument, stackTop, priority ? *priority : state.process->npdm.meta.mainThreadPriority, idealCore ? *idealCore : state.process->npdm.meta.idealCore).item};
|
size_t tid{threads.size() + 1}; //!< The first thread is HOS-1 rather than HOS-0, this is to match the HOS kernel's behaviour
|
||||||
|
auto thread{NewHandle<KThread>(this, tid, entry, argument, stackTop, priority ? *priority : state.process->npdm.meta.mainThreadPriority, idealCore ? *idealCore : state.process->npdm.meta.idealCore).item};
|
||||||
threads.push_back(thread);
|
threads.push_back(thread);
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user