From d025ca0d901d2cc1f276bf87d804f9c7947689fe Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Thu, 4 May 2023 06:31:52 +0200 Subject: [PATCH 1/2] TWEAK: Rupee dash duplication (#2815) * TWEAK: Rupee dash duplication Rupee dash was duplicated while being moved over the EXTRA MODES, so this fixes the duplication and put it only there * Update soh/soh/GameMenuBar.cpp --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> --- soh/soh/GameMenuBar.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index b7a8f6619..01dfd388e 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -717,14 +717,6 @@ namespace GameMenuBar { ImGui::EndMenu(); } - UIWidgets::Spacer(0); - - UIWidgets::PaddedEnhancementCheckbox("Rupee Dash Mode", "gRupeeDash", true, false); - UIWidgets::Tooltip("Rupees reduced over time, Link suffers damage when the count hits 0."); - UIWidgets::PaddedEnhancementSliderInt("Rupee Dash Interval: %d", "##DashInterval", "gDashInterval", 3, 5, "", 5, true, true, false, - !CVarGetInteger("gRupeeDash", 0), "This option is disabled because \"Rupee Dash Mode\" is turned off"); - UIWidgets::Tooltip("Interval between Rupee reduction in Rupee Dash Mode"); - ImGui::EndMenu(); } From c3ba15ed57c7e238312f763e8390fbe424ecf27a Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 4 May 2023 00:35:56 -0400 Subject: [PATCH 2/2] fix: don't crash when changing margins (#2828) for some reason we were getting garbage data in cvarNameMargins when doing things the `const char *` way. i wasn't able to figure out why that was getting garbage but this makes it so we don't get garbage in there Co-authored-by: briaguya --- .../cosmetics/CosmeticsEditor.cpp | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 340b7331d..2bc1353e9 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -345,28 +345,26 @@ ImVec4 GetRandomValue(int MaximumPossible){ void SetMarginAll(const char* ButtonName, bool SetActivated) { if (ImGui::Button(ButtonName)) { - u8 arrayLength = sizeof(MarginCvarList) / sizeof(*MarginCvarList); //MarginCvarNonAnchor is an array that list every element that has No anchor by default, because if that the case this function will not touch it with pose type 0. u8 arrayLengthNonMargin = sizeof(MarginCvarNonAnchor) / sizeof(*MarginCvarNonAnchor); - for (u8 s = 0; s < arrayLength; s++) { - const char* cvarName = MarginCvarList[s]; - const char* cvarPosType = std::string(cvarName).append("PosType").c_str(); - const char* cvarNameMargins = std::string(cvarName).append("UseMargins").c_str(); - if (CVarGetInteger(cvarPosType,0) <= 2 && SetActivated) { //Our element is not Hidden or Non anchor + for (auto cvarName : MarginCvarList) { + std::string cvarPosType = std::string(cvarName).append("PosType"); + std::string cvarNameMargins = std::string(cvarName).append("UseMargins"); + if (CVarGetInteger(cvarPosType.c_str(),0) <= 2 && SetActivated) { //Our element is not Hidden or Non anchor for (int i = 0; i < arrayLengthNonMargin; i++){ - if ((strcmp(cvarName, MarginCvarNonAnchor[i]) == 0) && (CVarGetInteger(cvarPosType, 0) == 0)) { //Our element is both in original position and do not have anchor by default so we skip it. - CVarSetInteger(cvarNameMargins, false); //force set off + if ((strcmp(cvarName, MarginCvarNonAnchor[i]) == 0) && (CVarGetInteger(cvarPosType.c_str(), 0) == 0)) { //Our element is both in original position and do not have anchor by default so we skip it. + CVarSetInteger(cvarNameMargins.c_str(), false); //force set off } - else if ((strcmp(cvarName, MarginCvarNonAnchor[i]) == 0) && (CVarGetInteger(cvarPosType, 0) != 0)) { //Our element is not in original position regarless it has no anchor by default since player made it anchored we can toggle margins - CVarSetInteger(cvarNameMargins, SetActivated); + else if ((strcmp(cvarName, MarginCvarNonAnchor[i]) == 0) && (CVarGetInteger(cvarPosType.c_str(), 0) != 0)) { //Our element is not in original position regarless it has no anchor by default since player made it anchored we can toggle margins + CVarSetInteger(cvarNameMargins.c_str(), SetActivated); } else if (strcmp(cvarName, MarginCvarNonAnchor[i]) != 0) { //Our elements has an anchor by default so regarless of it's position right now that okay to toggle margins. - CVarSetInteger(cvarNameMargins, SetActivated); + CVarSetInteger(cvarNameMargins.c_str(), SetActivated); } } } else { //Since the user requested to turn all margin off no need to do any check there. - CVarSetInteger(cvarNameMargins, SetActivated); + CVarSetInteger(cvarNameMargins.c_str(), SetActivated); } } }