From 139a240ed3424509eddbbef52f79292d4692a08c Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Sun, 2 Jun 2024 22:32:19 -0400 Subject: [PATCH] [Graphics] Disable Black Bar Letterboxes (#590) * Black Bars be gone * Move it to draw/apply functions Updates in real time now * Added return instead * added space * Update mm/2s2h/Enhancements/Enhancements.cpp * Update mm/2s2h/Enhancements/Enhancements.cpp --------- Co-authored-by: Garrett Cox --- mm/2s2h/BenGui/BenMenuBar.cpp | 5 +++++ mm/2s2h/Enhancements/Enhancements.cpp | 3 +++ mm/2s2h/Enhancements/Enhancements.h | 1 + mm/2s2h/Enhancements/GameInteractor/GameInteractor.h | 1 + mm/2s2h/Enhancements/Graphics/DisableBlackBars.cpp | 11 +++++++++++ mm/2s2h/Enhancements/Graphics/DisableBlackBars.h | 6 ++++++ mm/src/code/z_shrink_window.c | 5 +++++ mm/src/code/z_view.c | 5 +++++ 8 files changed, 37 insertions(+) create mode 100644 mm/2s2h/Enhancements/Graphics/DisableBlackBars.cpp create mode 100644 mm/2s2h/Enhancements/Graphics/DisableBlackBars.h diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp index af1bcc826..f1f09cb4b 100644 --- a/mm/2s2h/BenGui/BenMenuBar.cpp +++ b/mm/2s2h/BenGui/BenMenuBar.cpp @@ -523,6 +523,11 @@ void DrawEnhancementsMenu() { "model and texture on the boot logo start screen" }); UIWidgets::CVarCheckbox("Bow Reticle", "gEnhancements.Graphics.BowReticle", { .tooltip = "Gives the bow a reticle when you draw an arrow" }); + UIWidgets::CVarCheckbox( + "Disable Black Bar Letterboxes", "gEnhancements.Graphics.DisableBlackBars", + { .tooltip = "Disables Black Bar Letterboxes during cutscenes and Z-targeting\nNote: there may be " + "minor visual glitches that were covered up by the black bars\nPlease disable this " + "setting before reporting a bug" }); ImGui::EndMenu(); } diff --git a/mm/2s2h/Enhancements/Enhancements.cpp b/mm/2s2h/Enhancements/Enhancements.cpp index 6896637ce..fe213e977 100644 --- a/mm/2s2h/Enhancements/Enhancements.cpp +++ b/mm/2s2h/Enhancements/Enhancements.cpp @@ -23,6 +23,9 @@ void InitEnhancements() { // Equipment RegisterSkipMagicArrowEquip(); + // Graphics + RegisterDisableBlackBars(); + // Masks RegisterFastTransformation(); RegisterFierceDeityAnywhere(); diff --git a/mm/2s2h/Enhancements/Enhancements.h b/mm/2s2h/Enhancements/Enhancements.h index b4be56a95..3461bda91 100644 --- a/mm/2s2h/Enhancements/Enhancements.h +++ b/mm/2s2h/Enhancements/Enhancements.h @@ -24,6 +24,7 @@ #include "PlayerMovement/ClimbSpeed.h" #include "Songs/EnableSunsSong.h" #include "Saving/SavingEnhancements.h" +#include "Graphics/DisableBlackBars.h" #include "Modes/TimeMovesWhenYouMove.h" enum AlwaysWinDoggyRaceOptions { diff --git a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h index 873f5bf61..fe10c1f29 100644 --- a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h +++ b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h @@ -52,6 +52,7 @@ typedef enum { GI_VB_TATL_INTERUPT_MSG6, GI_VB_ITEM_BE_RESTRICTED, GI_VB_FLIP_HOP_VARIABLE, + GI_VB_DISABLE_LETTERBOX, GI_VB_CLOCK_TOWER_OPENING_CONSIDER_THIS_FIRST_CYCLE, } GIVanillaBehavior; diff --git a/mm/2s2h/Enhancements/Graphics/DisableBlackBars.cpp b/mm/2s2h/Enhancements/Graphics/DisableBlackBars.cpp new file mode 100644 index 000000000..21466d732 --- /dev/null +++ b/mm/2s2h/Enhancements/Graphics/DisableBlackBars.cpp @@ -0,0 +1,11 @@ +#include +#include "Enhancements/GameInteractor/GameInteractor.h" +#include "DisableBlackBars.h" + +void RegisterDisableBlackBars() { + REGISTER_VB_SHOULD(GI_VB_DISABLE_LETTERBOX, { + if (CVarGetInteger("gEnhancements.Graphics.DisableBlackBars", 0)) { + *should = true; + } + }); +} diff --git a/mm/2s2h/Enhancements/Graphics/DisableBlackBars.h b/mm/2s2h/Enhancements/Graphics/DisableBlackBars.h new file mode 100644 index 000000000..fc5be3b3c --- /dev/null +++ b/mm/2s2h/Enhancements/Graphics/DisableBlackBars.h @@ -0,0 +1,6 @@ +#ifndef GRAPHICS_DISABLE_BLACK_BARS_H +#define GRAPHICS_DISABLE_BLACK_BARS_H + +void RegisterDisableBlackBars(); + +#endif // GRAPHICS_DISABLE_BLACK_BARS_H diff --git a/mm/src/code/z_shrink_window.c b/mm/src/code/z_shrink_window.c index a1e651d01..bca613366 100644 --- a/mm/src/code/z_shrink_window.c +++ b/mm/src/code/z_shrink_window.c @@ -7,6 +7,7 @@ #include "global.h" #include "z64shrink_window.h" #include +#include "Enhancements/GameInteractor/GameInteractor.h" #include "BenPort.h" @@ -79,6 +80,10 @@ void ShrinkWindow_Draw(GraphicsContext* gfxCtx) { s8 letterboxSize = sShrinkWindowPtr->letterboxSize; s8 pillarboxSize = sShrinkWindowPtr->pillarboxSize; + if (GameInteractor_Should(GI_VB_DISABLE_LETTERBOX, false, NULL)) { + return; + } + if (letterboxSize > 0) { OPEN_DISPS(gfxCtx); diff --git a/mm/src/code/z_view.c b/mm/src/code/z_view.c index 352e3c975..1e01a9cbc 100644 --- a/mm/src/code/z_view.c +++ b/mm/src/code/z_view.c @@ -2,6 +2,7 @@ #include "z64shrink_window.h" #include "z64view.h" #include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h" +#include "Enhancements/GameInteractor/GameInteractor.h" s32 View_ApplyPerspective(View* view); s32 View_ApplyOrtho(View* view); @@ -159,6 +160,10 @@ void View_ApplyLetterbox(View* view) { s32 lrx; s32 lry; + if (GameInteractor_Should(GI_VB_DISABLE_LETTERBOX, false, NULL)) { + return; + } + OPEN_DISPS(view->gfxCtx); letterboxY = ShrinkWindow_Letterbox_GetSize();