Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions source/patcher/hooks_patcher_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
#include "plugin/SectionInfo.h"
#include "utils/config/ConfigUtils.h"

#include <coreinit/cache.h>
#include <coreinit/core.h>
#include <coreinit/messagequeue.h>
#include <coreinit/time.h>
#include <coreinit/title.h>
#include <padscore/wpad.h>
#include <vpad/input.h>

Expand All @@ -21,9 +24,11 @@ DECL_FUNCTION(void, GX2SwapScanBuffers, void) {

if (sWantsToOpenConfigMenu && !gConfigMenuOpened) {
gConfigMenuOpened = true;
OSMemoryBarrier();
ConfigUtils::openConfigMenu();
gConfigMenuOpened = false;
sWantsToOpenConfigMenu = false;
OSMemoryBarrier();
}
}

Expand Down Expand Up @@ -89,6 +94,14 @@ 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) {
// Quick fix for Hyrule Warriors: block VPADRead() in non-rendering threads.
switch (OSGetTitleID()) {
case 0x00050000'1017CD00: // Hyrule Warriors JPN
case 0x00050000'1017D800: // Hyrule Warriors USA
case 0x00050000'1017D900: // Hyrule Warriors EUR
while (gConfigMenuOpened)
OSSleepTicks(OSMillisecondsToTicks(10));
}
return 0;
}
}
Expand Down
2 changes: 2 additions & 0 deletions source/utils/config/ConfigUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <wups/config.h>
#include <wups/hooks.h>

#include <coreinit/cache.h>
#include <coreinit/title.h>
#include <sysapp/launch.h>

Expand Down Expand Up @@ -166,6 +167,7 @@ void ConfigUtils::displayMenu() {

gOnlyAcceptFromThread = OSGetCurrentThread();
ConfigSubState subStateReturnValue = SUB_STATE_ERROR;
OSMemoryBarrier();
while (true) {
startTime = OSGetTime();
if (gConfigMenuShouldClose) {
Expand Down