From ece58f84f25a67ffc1d743288ff38c9a7244f298 Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Thu, 9 Jun 2022 16:43:14 +0200 Subject: [PATCH 1/5] Fix: SohImGui behavior and cleanup - FIX: Once Save Editor / Collision Viewer are closed, set their values back to 0 so they don't automatically open once we click on Developer Tools - FIX: Same kind of fixes for every cosmetics editor - FIX: Typo "gCosmticsEditor" to "gCosmeticEditor" - TWEAK: Cleanup of useless stylizing options on Cosmetics --- libultraship/libultraship/SohImGuiImpl.cpp | 20 +++++++++---------- soh/soh/Enhancements/debugger/colViewer.cpp | 2 ++ .../Enhancements/debugger/debugSaveEditor.cpp | 2 ++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index f6e41fb6ee6..f7e7e4bb7d4 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -1011,7 +1011,7 @@ namespace SohImGui { } if (ImGui::BeginMenu("Cosmetics")) { - EnhancementCheckbox("Cosmetics editor", "gCosmticsEditor"); + EnhancementCheckbox("Cosmetics editor", "gCosmeticEditor"); Tooltip("Edit Navi and Link's Tunics color."); EnhancementCheckbox("HUD Margins editor", "gUseMargins"); EnhancementRadioButton("N64 interface", "gHudColors", 0); @@ -1068,7 +1068,7 @@ namespace SohImGui { if (CVar_GetS32("gSkipLogoTitle",0)) { EnhancementSliderInt("Loading %d", "##SaveFileID", "gSaveFileID", 0, 4, ""); } - ImGui::Separator(); + ImGui::Separator(); EnhancementCheckbox("Stats", "gStatsEnabled"); Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on"); EnhancementCheckbox("Console", "gConsoleEnabled"); @@ -1079,15 +1079,16 @@ namespace SohImGui { } bool Margins_isOpen = CVar_GetS32("gUseMargins", 0); - bool Cosmetics_isOpen = CVar_GetS32("gCosmticsEditor", 0); + bool Cosmetics_isOpen = CVar_GetS32("gCosmeticEditor", 0); bool Interface_isOpen = CVar_GetS32("gColorsEditor", 0); if (Margins_isOpen) { if (!Margins_isOpen) { + CVar_SetS32("gHUDMargins", 0); return; } - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); - ImGui::Begin("Margins Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); + ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); + ImGui::Begin("Margins Editor", &Margins_isOpen, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Margins Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Interface margins")) { EnhancementCheckbox("Use margins", "gHUDMargins"); @@ -1100,14 +1101,14 @@ namespace SohImGui { } ImGui::EndTabBar(); } - ImGui::PopStyleColor(); ImGui::End(); } if (Cosmetics_isOpen) { if (!Cosmetics_isOpen) { + CVar_SetS32("gCosmeticEditor", 0); return; } - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + ImGui::SetNextWindowSize(ImVec2(500, 627), ImGuiCond_FirstUseEver); ImGui::Begin("Cosmetics Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Cosmetics Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Navi")) { @@ -1146,14 +1147,14 @@ namespace SohImGui { } ImGui::EndTabBar(); } - ImGui::PopStyleColor(); ImGui::End(); } if (Interface_isOpen) { if (!Interface_isOpen) { + CVar_SetS32("gColorsEditor", 0); return; } - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + ImGui::SetNextWindowSize(ImVec2(215, 627), ImGuiCond_FirstUseEver); ImGui::Begin("Interface Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Interface Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Hearts")) { @@ -1194,7 +1195,6 @@ namespace SohImGui { } ImGui::EndTabBar(); } - ImGui::PopStyleColor(); ImGui::End(); } diff --git a/soh/soh/Enhancements/debugger/colViewer.cpp b/soh/soh/Enhancements/debugger/colViewer.cpp index f5c283aac98..14378d2cc4f 100644 --- a/soh/soh/Enhancements/debugger/colViewer.cpp +++ b/soh/soh/Enhancements/debugger/colViewer.cpp @@ -12,6 +12,7 @@ extern "C" { #include "variables.h" #include "functions.h" #include "macros.h" +#include extern GlobalContext* gGlobalCtx; } @@ -94,6 +95,7 @@ void DrawColorPicker(const std::string& name, uint32_t& color) { // Draws the ImGui window for the collision viewer void DrawColViewerWindow(bool& open) { if (!open) { + CVar_SetS32("gCollisionViewerEnabled", 0); return; } diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index a0d27f70fab..11684f1cbaa 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -17,6 +17,7 @@ extern GlobalContext* gGlobalCtx; #include "textures/icon_item_static/icon_item_static.h" #include "textures/icon_item_24_static/icon_item_24_static.h" +#include } typedef struct { @@ -1544,6 +1545,7 @@ void DrawPlayerTab() { void DrawSaveEditor(bool& open) { if (!open) { + CVar_SetS32("gSaveEditorEnabled", 0); return; } From 8c565fa4a2699b335ab3939c40f86a3a5e30d75f Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Thu, 9 Jun 2022 16:47:37 +0200 Subject: [PATCH 2/5] TWEAK: Reset a pointer that I edited for some testing --- libultraship/libultraship/SohImGuiImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index f7e7e4bb7d4..d391585cc67 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -1088,7 +1088,7 @@ namespace SohImGui { return; } ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); - ImGui::Begin("Margins Editor", &Margins_isOpen, ImGuiWindowFlags_NoFocusOnAppearing); + ImGui::Begin("Margins Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Margins Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Interface margins")) { EnhancementCheckbox("Use margins", "gHUDMargins"); From e1392515eda32ec70b26eceb1ee93d0be693f7bc Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Thu, 9 Jun 2022 16:49:31 +0200 Subject: [PATCH 3/5] FIX: Typo from Assignable tunic / boots tooltip --- libultraship/libultraship/SohImGuiImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index d391585cc67..81c115caaa4 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -861,7 +861,7 @@ namespace SohImGui { Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble"); EnhancementCheckbox("Faster Block Push", "gFasterBlockPush"); EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots"); - Tooltip("Allows equiping the tunic and boots to c-buttons"); + Tooltip("Allows equipping the tunic and boots to c-buttons"); EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood"); Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask"); EnhancementCheckbox("Fast Chests", "gFastChests"); From 5d541f8a9483f724b42dd98f8173202fef2df7aa Mon Sep 17 00:00:00 2001 From: briaguya Date: Fri, 10 Jun 2022 10:23:21 -0400 Subject: [PATCH 4/5] move cvar.h includes out of extern c block --- soh/soh/Enhancements/debugger/colViewer.cpp | 2 +- soh/soh/Enhancements/debugger/debugSaveEditor.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/debugger/colViewer.cpp b/soh/soh/Enhancements/debugger/colViewer.cpp index 14378d2cc4f..40dc90201d0 100644 --- a/soh/soh/Enhancements/debugger/colViewer.cpp +++ b/soh/soh/Enhancements/debugger/colViewer.cpp @@ -6,13 +6,13 @@ #include #include #include +#include extern "C" { #include #include "variables.h" #include "functions.h" #include "macros.h" -#include extern GlobalContext* gGlobalCtx; } diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index 11684f1cbaa..9f18cc4509f 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -7,6 +7,7 @@ #include #include #include +#include extern "C" { #include @@ -17,9 +18,9 @@ extern GlobalContext* gGlobalCtx; #include "textures/icon_item_static/icon_item_static.h" #include "textures/icon_item_24_static/icon_item_24_static.h" -#include } + typedef struct { uint32_t id; std::string name; From 5c49fb4bb662c5c6152cc7e4954c51358c5cbc49 Mon Sep 17 00:00:00 2001 From: briaguya Date: Fri, 10 Jun 2022 10:24:26 -0400 Subject: [PATCH 5/5] remove extra line --- soh/soh/Enhancements/debugger/debugSaveEditor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index 9f18cc4509f..d243ce49a48 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -20,7 +20,6 @@ extern GlobalContext* gGlobalCtx; #include "textures/icon_item_24_static/icon_item_24_static.h" } - typedef struct { uint32_t id; std::string name;