mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-24 21:56:53 +01:00
Close config menu if "release foreground" message is detected
This commit is contained in:
parent
f1a33df12d
commit
be24d2c67a
@ -15,3 +15,5 @@ std::vector<void *> gAllocatedAddresses;
|
||||
bool gNotificationModuleLoaded = false;
|
||||
|
||||
OSThread *gOnlyAcceptFromThread = nullptr;
|
||||
|
||||
bool gConfigMenuShouldClose = false;
|
@ -28,3 +28,5 @@ extern std::vector<void *> gAllocatedAddresses;
|
||||
extern bool gNotificationModuleLoaded;
|
||||
|
||||
extern OSThread *gOnlyAcceptFromThread;
|
||||
|
||||
extern bool gConfigMenuShouldClose;
|
@ -44,6 +44,18 @@ DECL_FUNCTION(void, GX2SetDRCBuffer, void *buffer, uint32_t buffer_size, uint32_
|
||||
|
||||
static uint32_t lastData0 = 0;
|
||||
|
||||
|
||||
DECL_FUNCTION(BOOL, OSSendMessage, OSMessageQueue *queue, OSMessage *message, OSMessageFlags flags) {
|
||||
if (sConfigMenuOpened && queue == OSGetSystemMessageQueue()) {
|
||||
if (message != nullptr) {
|
||||
if (message->args[0] == 0xfacebacc) { // Release foreground
|
||||
gConfigMenuShouldClose = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return real_OSSendMessage(queue, message, flags);
|
||||
}
|
||||
|
||||
DECL_FUNCTION(uint32_t, OSReceiveMessage, OSMessageQueue *queue, OSMessage *message, uint32_t flags) {
|
||||
uint32_t res = real_OSReceiveMessage(queue, message, flags);
|
||||
if (queue == OSGetSystemMessageQueue()) {
|
||||
@ -197,6 +209,7 @@ function_replacement_data_t method_hooks_static[] __attribute__((section(".data"
|
||||
REPLACE_FUNCTION(GX2SwapScanBuffers, LIBRARY_GX2, GX2SwapScanBuffers),
|
||||
REPLACE_FUNCTION(GX2SetTVBuffer, LIBRARY_GX2, GX2SetTVBuffer),
|
||||
REPLACE_FUNCTION(GX2SetDRCBuffer, LIBRARY_GX2, GX2SetDRCBuffer),
|
||||
REPLACE_FUNCTION(OSSendMessage, LIBRARY_COREINIT, OSSendMessage),
|
||||
REPLACE_FUNCTION(OSReceiveMessage, LIBRARY_COREINIT, OSReceiveMessage),
|
||||
REPLACE_FUNCTION(OSReleaseForeground, LIBRARY_COREINIT, OSReleaseForeground),
|
||||
REPLACE_FUNCTION(VPADRead, LIBRARY_VPAD, VPADRead),
|
||||
|
@ -139,6 +139,10 @@ void ConfigUtils::displayMenu() {
|
||||
|
||||
gOnlyAcceptFromThread = OSGetCurrentThread();
|
||||
while (true) {
|
||||
if (gConfigMenuShouldClose) {
|
||||
gConfigMenuShouldClose = false;
|
||||
break;
|
||||
}
|
||||
baseInput.reset();
|
||||
if (vpadInput.update(1280, 720)) {
|
||||
baseInput.combine(vpadInput);
|
||||
@ -186,7 +190,6 @@ void ConfigUtils::displayMenu() {
|
||||
OSSleepTicks(OSMicrosecondsToTicks(16000 - diffTime));
|
||||
}
|
||||
}
|
||||
gOnlyAcceptFromThread = nullptr;
|
||||
|
||||
for (const auto &plugin : gLoadedPlugins) {
|
||||
const auto configData = plugin.getConfigData();
|
||||
@ -205,6 +208,7 @@ void ConfigUtils::displayMenu() {
|
||||
#define __SetDCPitchReg ((void (*)(uint32_t, uint32_t))(0x101C400 + 0x1e714))
|
||||
|
||||
void ConfigUtils::openConfigMenu() {
|
||||
gOnlyAcceptFromThread = OSGetCurrentThread();
|
||||
bool wasHomeButtonMenuEnabled = OSIsHomeButtonMenuEnabled();
|
||||
|
||||
OSScreenInit();
|
||||
@ -302,6 +306,7 @@ error_exit:
|
||||
if (!skipScreen1Free && screenbuffer1) {
|
||||
MEMFreeToMappedMemory(screenbuffer1);
|
||||
}
|
||||
gOnlyAcceptFromThread = nullptr;
|
||||
}
|
||||
|
||||
void ConfigUtils::renderBasicScreen(std::string_view text) {
|
||||
|
Loading…
Reference in New Issue
Block a user