diff --git a/soh/soh/Enhancements/mod_menu.cpp b/soh/soh/Enhancements/mod_menu.cpp index 82b05ba9f..1e288d7ce 100644 --- a/soh/soh/Enhancements/mod_menu.cpp +++ b/soh/soh/Enhancements/mod_menu.cpp @@ -1,10 +1,12 @@ #include "mod_menu.h" #include "utils/StringHelper.h" #include +#include "soh/SohGui/SohGui.hpp" #include "soh/OTRGlobals.h" #include "soh/resource/type/Skeleton.h" #include #include + extern "C" void gfx_texture_cache_clear(); std::shared_ptr GetArchiveManager() { @@ -17,6 +19,9 @@ std::map modFiles; #define CVAR_ENABLED_MODS_DEFAULT "" #define CVAR_ENABLED_MODS_VALUE CVarGetString(CVAR_ENABLED_MODS_NAME, CVAR_ENABLED_MODS_DEFAULT) +// "|" was chosen as the separator due to +// it being an invalid character in NTFS +// and being rarely used in ext4 #define SEPARATOR "|" void SaveEnabledModsCVarValue() { @@ -129,7 +134,7 @@ void DrawEnabledMods() { } for (std::string file : enabledMods) { - if (ImGui::ArrowButton(file.c_str(), ImGuiDir_Left)) { + if (UIWidgets::StateButton(file.c_str(), ICON_FA_ARROW_LEFT, ImVec2(25, 25), UIWidgets::ButtonOptions().Color(THEME_COLOR))) { modFiles[file] = false; GetArchiveManager()->RemoveArchive(file); AfterModChange(); @@ -146,7 +151,7 @@ void DrawDisabledMods() { } for (std::string file : disabledMods) { - if (ImGui::ArrowButton(file.c_str(), ImGuiDir_Right)) { + if (UIWidgets::StateButton(file.c_str(), ICON_FA_ARROW_RIGHT, ImVec2(25, 25), UIWidgets::ButtonOptions().Color(THEME_COLOR))) { modFiles[file] = true; GetArchiveManager()->AddArchive(file); AfterModChange(); @@ -156,7 +161,9 @@ void DrawDisabledMods() { } void ModMenuWindow::DrawElement() { - if (ImGui::Button("Update")) { + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); + + if (UIWidgets::Button("Update", UIWidgets::ButtonOptions().Size(ImVec2(250.0f, 0.0f)).Color(THEME_COLOR))) { UpdateModFiles(); } @@ -186,6 +193,8 @@ void ModMenuWindow::DrawElement() { ImGui::EndTable(); } + + ImGui::EndDisabled(); } void ModMenuWindow::InitElement() { diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 0b78892d4..9bfd62511 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -1758,6 +1758,14 @@ void SohMenu::AddMenuEnhancements() { .CVar(timer.timeEnable) .Callback([](WidgetInfo& info) { TimeDisplayUpdateDisplayOptions(); }); } + + // Mod Menu + path.sidebarName = "Mod Menu"; + AddSidebarEntry("Enhancements", path.sidebarName, 1); + AddWidget(path, "Toggle Mod Menu Window", WIDGET_WINDOW_BUTTON) + .CVar(CVAR_WINDOW("ModMenu")) + .WindowName("Mod Menu") + .Options(WindowButtonOptions().Tooltip("Enables the separate Mod Menu Window.")); } } // namespace SohGui