From ac3e01fa7534c8e49531092bc2ee84b14435965f Mon Sep 17 00:00:00 2001 From: Maschell Date: Thu, 26 Jan 2023 13:04:33 +0100 Subject: [PATCH] Only block the TV Menu if screenshots are mapped to the TV button. --- src/DRCAttachCallback.cpp | 10 +++++++++- src/config.cpp | 15 +++++++++++++++ src/main.cpp | 2 -- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/DRCAttachCallback.cpp b/src/DRCAttachCallback.cpp index 2414499..65e6533 100644 --- a/src/DRCAttachCallback.cpp +++ b/src/DRCAttachCallback.cpp @@ -47,7 +47,15 @@ WUPS_MUST_REPLACE(CCRCDCRegisterUVCAttachCallback, WUPS_LOADER_LIBRARY_NSYSCCR, void DRCAttachDetachCallback(CCRCDCCallbackData *data, void *context) { gBlockDRCScreenshots = !data->attached; - if (!data->attached) { + if (data->attached) { + if (gButtonCombo & VPAD_BUTTON_TV) { + DEBUG_FUNCTION_LINE("Block TV Menu"); + VPADSetTVMenuInvalid(data->chan, true); + } else { + DEBUG_FUNCTION_LINE("Unblock TV Menu"); + VPADSetTVMenuInvalid(data->chan, false); + } + } else { DEBUG_FUNCTION_LINE("Block DRC screenshots"); } OSMemoryBarrier(); diff --git a/src/config.cpp b/src/config.cpp index f2ffbb8..034fc70 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -83,6 +83,14 @@ void InitConfig() { } } + if (gButtonCombo & VPAD_BUTTON_TV) { + DEBUG_FUNCTION_LINE("Block TV Menu"); + VPADSetTVMenuInvalid(VPAD_CHAN_0, true); + } else { + DEBUG_FUNCTION_LINE("Unblock TV Menu"); + VPADSetTVMenuInvalid(VPAD_CHAN_0, false); + } + if (gOutputFormat >= 3) { gOutputFormat = IMAGE_OUTPUT_FORMAT_JPEG; } @@ -151,6 +159,13 @@ void buttonComboItemChanged(ConfigItemButtonCombo *item, uint32_t newValue) { DEBUG_FUNCTION_LINE("New value in %s changed: %d", item->configId, newValue); if (std::string_view(item->configId) == BUTTON_COMBO_CONFIG_STRING) { gButtonCombo = newValue; + if (gButtonCombo & VPAD_BUTTON_TV) { + DEBUG_FUNCTION_LINE("Block TV Menu"); + VPADSetTVMenuInvalid(VPAD_CHAN_0, true); + } else { + DEBUG_FUNCTION_LINE("Unblock TV Menu"); + VPADSetTVMenuInvalid(VPAD_CHAN_0, false); + } WUPS_StoreInt(nullptr, item->configId, (int32_t) gButtonCombo); } } diff --git a/src/main.cpp b/src/main.cpp index 96f5939..17c2b3d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,8 +49,6 @@ ON_APPLICATION_START() { ApplyGameSpecificPatches(); - VPADSetTVMenuInvalid(VPAD_CHAN_0, true); - InitDRCAttachCallbacks(); }