libstrat: namespace hossynch.hpp
This commit is contained in:
@@ -31,14 +31,14 @@ namespace sts::dmnt::cheat::impl {
|
||||
/* Manager class. */
|
||||
class CheatProcessManager {
|
||||
private:
|
||||
HosMutex cheat_lock;
|
||||
HosSignal debug_events_signal;
|
||||
HosThread detect_thread, debug_events_thread;
|
||||
os::Mutex cheat_lock;
|
||||
os::Event debug_events_event; /* Autoclear. */
|
||||
os::Thread detect_thread, debug_events_thread;
|
||||
IEvent *cheat_process_event;
|
||||
Handle cheat_process_debug_handle = INVALID_HANDLE;
|
||||
CheatProcessMetadata cheat_process_metadata = {};
|
||||
|
||||
HosThread vm_thread;
|
||||
os::Thread vm_thread;
|
||||
bool needs_reload_vm = false;
|
||||
CheatVirtualMachine cheat_vm;
|
||||
|
||||
@@ -546,7 +546,7 @@ namespace sts::dmnt::cheat::impl {
|
||||
CheatProcessManager *this_ptr = reinterpret_cast<CheatProcessManager *>(_this);
|
||||
while (true) {
|
||||
/* Atomically wait (and clear) signal for new process. */
|
||||
this_ptr->debug_events_signal.Wait(true);
|
||||
this_ptr->debug_events_event.Wait();
|
||||
while (true) {
|
||||
while (R_SUCCEEDED(svcWaitSynchronizationSingle(this_ptr->GetCheatProcessHandle(), U64_MAX))) {
|
||||
std::scoped_lock lk(this_ptr->cheat_lock);
|
||||
@@ -707,7 +707,7 @@ namespace sts::dmnt::cheat::impl {
|
||||
}
|
||||
|
||||
/* Signal to the debug events thread. */
|
||||
this->debug_events_signal.Signal();
|
||||
this->debug_events_event.Signal();
|
||||
|
||||
/* Signal to our fans. */
|
||||
this->cheat_process_event->Signal();
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace sts::dmnt::cheat::impl {
|
||||
public:
|
||||
static constexpr size_t NumCores = 4;
|
||||
private:
|
||||
HosMessageQueue message_queues[NumCores];
|
||||
HosThread threads[NumCores];
|
||||
HosSignal continued_signal;
|
||||
std::array<os::MessageQueue, NumCores> message_queues;
|
||||
std::array<os::Thread, NumCores> threads;
|
||||
os::Event continued_event;
|
||||
private:
|
||||
static void PerCoreThreadFunction(void *_this) {
|
||||
/* This thread will wait on the appropriate message queue. */
|
||||
@@ -80,16 +80,15 @@ namespace sts::dmnt::cheat::impl {
|
||||
}
|
||||
|
||||
void WaitContinued() {
|
||||
this->continued_signal.Wait();
|
||||
this->continued_signal.Reset();
|
||||
this->continued_event.Wait();
|
||||
}
|
||||
|
||||
void SignalContinued() {
|
||||
this->continued_signal.Signal();
|
||||
this->continued_event.Signal();
|
||||
}
|
||||
|
||||
public:
|
||||
DebugEventsManager() : message_queues{HosMessageQueue(1), HosMessageQueue(1), HosMessageQueue(1), HosMessageQueue(1)} {
|
||||
DebugEventsManager() : message_queues{os::MessageQueue(1), os::MessageQueue(1), os::MessageQueue(1), os::MessageQueue(1)} {
|
||||
for (size_t i = 0; i < NumCores; i++) {
|
||||
/* Create thread. */
|
||||
R_ASSERT(this->threads[i].Initialize(&DebugEventsManager::PerCoreThreadFunction, reinterpret_cast<void *>(this), 0x1000, 24, i));
|
||||
|
||||
Reference in New Issue
Block a user