mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-05 17:14:22 -04:00
ams: centralize system thread definitions
This commit is contained in:
parent
d77fe98203
commit
3da0cda4ae
32 changed files with 254 additions and 40 deletions
|
@ -29,9 +29,6 @@ namespace ams::dmnt::cheat::impl {
|
|||
class CheatProcessManager {
|
||||
private:
|
||||
static constexpr size_t ThreadStackSize = 0x4000;
|
||||
static constexpr s32 DetectThreadPriority = 11;
|
||||
static constexpr s32 VirtualMachineThreadPriority = 20;
|
||||
static constexpr s32 DebugEventsThreadPriority = -1;
|
||||
private:
|
||||
os::Mutex cheat_lock;
|
||||
os::Event debug_events_event; /* Autoclear. */
|
||||
|
@ -200,9 +197,12 @@ namespace ams::dmnt::cheat::impl {
|
|||
}
|
||||
|
||||
/* Spawn application detection thread, spawn cheat vm thread. */
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(this->detect_thread), DetectLaunchThread, this, this->detect_thread_stack, ThreadStackSize, DetectThreadPriority));
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(this->vm_thread), VirtualMachineThread, this, this->vm_thread_stack, ThreadStackSize, VirtualMachineThreadPriority));
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(this->debug_events_thread), DebugEventsThread, this, this->debug_events_thread_stack, ThreadStackSize, DebugEventsThreadPriority));
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(this->detect_thread), DetectLaunchThread, this, this->detect_thread_stack, ThreadStackSize, AMS_GET_SYSTEM_THREAD_PRIORITY(dmnt, CheatDetect)));
|
||||
os::SetThreadNamePointer(std::addressof(this->detect_thread), AMS_GET_SYSTEM_THREAD_NAME(dmnt, CheatDetect));
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(this->vm_thread), VirtualMachineThread, this, this->vm_thread_stack, ThreadStackSize, AMS_GET_SYSTEM_THREAD_PRIORITY(dmnt, CheatVirtualMachine)));
|
||||
os::SetThreadNamePointer(std::addressof(this->vm_thread), AMS_GET_SYSTEM_THREAD_NAME(dmnt, CheatVirtualMachine));
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(this->debug_events_thread), DebugEventsThread, this, this->debug_events_thread_stack, ThreadStackSize, AMS_GET_SYSTEM_THREAD_PRIORITY(dmnt, CheatDebugEvents)));
|
||||
os::SetThreadNamePointer(std::addressof(this->debug_events_thread), AMS_GET_SYSTEM_THREAD_NAME(dmnt, CheatDebugEvents));
|
||||
|
||||
/* Start threads. */
|
||||
os::StartThread(std::addressof(this->detect_thread));
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace ams::dmnt::cheat::impl {
|
|||
public:
|
||||
static constexpr size_t NumCores = 4;
|
||||
static constexpr size_t ThreadStackSize = os::MemoryPageSize;
|
||||
static constexpr s32 ThreadPriority = -3;
|
||||
private:
|
||||
std::array<uintptr_t, NumCores> message_queue_buffers;
|
||||
std::array<os::MessageQueue, NumCores> message_queues;
|
||||
|
@ -103,7 +102,8 @@ namespace ams::dmnt::cheat::impl {
|
|||
{
|
||||
for (size_t i = 0; i < NumCores; i++) {
|
||||
/* Create thread. */
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(this->threads[i]), PerCoreThreadFunction, this, this->thread_stacks[i], ThreadStackSize, ThreadPriority, i));
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(this->threads[i]), PerCoreThreadFunction, this, this->thread_stacks[i], ThreadStackSize, AMS_GET_SYSTEM_THREAD_PRIORITY(dmnt, MultiCoreEventManager), i));
|
||||
os::SetThreadNamePointer(std::addressof(this->threads[i]), AMS_GET_SYSTEM_THREAD_NAME(dmnt, MultiCoreEventManager));
|
||||
|
||||
/* Set core mask. */
|
||||
os::SetThreadCoreMask(std::addressof(this->threads[i]), i, (1u << i));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue