diff --git a/source/patcher/hooks_patcher_static.cpp b/source/patcher/hooks_patcher_static.cpp index 7cce514..7d28c00 100644 --- a/source/patcher/hooks_patcher_static.cpp +++ b/source/patcher/hooks_patcher_static.cpp @@ -8,8 +8,10 @@ #include "plugin/SectionInfo.h" #include "utils/config/ConfigUtils.h" +#include #include #include +#include #include #include @@ -21,9 +23,11 @@ DECL_FUNCTION(void, GX2SwapScanBuffers, void) { if (sWantsToOpenConfigMenu && !gConfigMenuOpened) { gConfigMenuOpened = true; + OSMemoryBarrier(); ConfigUtils::openConfigMenu(); gConfigMenuOpened = false; sWantsToOpenConfigMenu = false; + OSMemoryBarrier(); } } @@ -89,6 +93,8 @@ DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buff if (gConfigMenuOpened) { // Ignore reading vpad input only from other threads if the config menu is opened if (OSGetCurrentThread() != gOnlyAcceptFromThread) { + while (gConfigMenuOpened) + OSSleepTicks(OSMillisecondsToTicks(10)); return 0; } } diff --git a/source/utils/config/ConfigUtils.cpp b/source/utils/config/ConfigUtils.cpp index c644203..5213b38 100644 --- a/source/utils/config/ConfigUtils.cpp +++ b/source/utils/config/ConfigUtils.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -165,6 +166,7 @@ void ConfigUtils::displayMenu() { bool skipFirstInput = true; gOnlyAcceptFromThread = OSGetCurrentThread(); + OSMemoryBarrier(); ConfigSubState subStateReturnValue = SUB_STATE_ERROR; while (true) { startTime = OSGetTime();