diff --git a/soh/soh/AboutWindow.cpp b/soh/soh/AboutWindow.cpp deleted file mode 100644 index e5d51300cba..00000000000 --- a/soh/soh/AboutWindow.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "AboutWindow.h" -#include -#include -#include "soh/ResourceManagerHelpers.h" - -extern "C" { -#include "variables.h" -} - -AboutWindow::~AboutWindow() { - SPDLOG_TRACE("destruct about window"); -} - -void AboutWindow::InitElement() { - mIsTaggedVersion = gGitCommitTag[0] != 0; - - strncpy(mGitCommitHashTruncated, (char*)gGitCommitHash, 7); - mGitCommitHashTruncated[7] = 0; -} - -void AboutWindow::Draw() { - if (!IsVisible()) { - return; - } - - ImGuiWindowFlags windowFlags = ImGuiWindowFlags_AlwaysAutoResize | - ImGuiWindowFlags_NoResize | - ImGuiWindowFlags_NoDocking | - ImGuiWindowFlags_NoScrollWithMouse | - ImGuiWindowFlags_NoScrollbar; - - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(16 * ImGui::GetIO().FontGlobalScale, 8 * ImGui::GetIO().FontGlobalScale)); - - if (!ImGui::Begin(GetName().c_str(), &mIsVisible, windowFlags)) { - ImGui::End(); - } else { - DrawElement(); - ImGui::End(); - } - - ImGui::PopStyleVar(); - - // Sync up the IsVisible flag if it was changed by ImGui - SyncVisibilityConsoleVariable(); -} - -const char* AboutWindow::GetGameVersionString(uint32_t index) { - uint32_t gameVersion = ResourceMgr_GetGameVersion(index); - switch (gameVersion) { - case OOT_NTSC_US_10: - return "NTSC-U 1.0"; - case OOT_NTSC_US_11: - return "NTSC-U 1.1"; - case OOT_NTSC_US_12: - return "NTSC-U 1.2"; - case OOT_PAL_10: - return "PAL 1.0"; - case OOT_PAL_11: - return "PAL 1.1"; - case OOT_PAL_GC: - return "PAL GC"; - case OOT_PAL_MQ: - return "PAL MQ"; - case OOT_PAL_GC_DBG1: - case OOT_PAL_GC_DBG2: - return "PAL GC-D"; - case OOT_PAL_GC_MQ_DBG: - return "PAL MQ-D"; - case OOT_IQUE_CN: - return "IQUE CN"; - case OOT_IQUE_TW: - return "IQUE TW"; - default: - return "UNKNOWN"; - } -} - -void AboutWindow::DrawElement() { - // The icon is already padded - adjust for that - ImVec2 cursorPos = ImGui::GetCursorScreenPos(); - cursorPos.x -= 16 * ImGui::GetIO().FontGlobalScale; - ImGui::SetCursorScreenPos(cursorPos); - - ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon"), ImVec2(64.0f * ImGui::GetIO().FontGlobalScale, 64.0f * ImGui::GetIO().FontGlobalScale)); - - ImGui::SameLine(); - - ImGui::BeginGroup(); - ImGui::Text("Ship of Harkinian"); - if (mIsTaggedVersion) { - ImGui::Text("%s", gBuildVersion); - } else { - ImGui::Text("%s", gGitBranch); - ImGui::Text("%s", mGitCommitHashTruncated); - } - ImGui::EndGroup(); - - ImGui::Dummy(ImVec2(0, 2 * ImGui::GetIO().FontGlobalScale)); - ImGui::Text("Game Archives:"); - for (uint32_t i = 0; i < ResourceMgr_GetNumGameVersions(); i++) { - ImGui::BulletText(GetGameVersionString(i)); - } -} diff --git a/soh/soh/AboutWindow.h b/soh/soh/AboutWindow.h deleted file mode 100644 index 5a731fdc171..00000000000 --- a/soh/soh/AboutWindow.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include - -class AboutWindow : public Ship::GuiWindow { - public: - using GuiWindow::GuiWindow; - ~AboutWindow(); - - private: - void InitElement() override; - void Draw() override; - void DrawElement() override; - void UpdateElement() override {}; - - const char* GetGameVersionString(uint32_t index); - - bool mIsTaggedVersion; - char mGitCommitHashTruncated[8]; -}; diff --git a/soh/soh/SohGui/SohGui.cpp b/soh/soh/SohGui/SohGui.cpp index 684195612a2..ae058353f06 100644 --- a/soh/soh/SohGui/SohGui.cpp +++ b/soh/soh/SohGui/SohGui.cpp @@ -136,7 +136,6 @@ namespace SohGui { std::shared_ptr mModalWindow; std::shared_ptr mNotificationWindow; std::shared_ptr mTimeDisplayWindow; - std::shared_ptr mAboutWindow; void SetupGuiElements() { auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui(); @@ -227,8 +226,6 @@ namespace SohGui { mNotificationWindow->Show(); mTimeDisplayWindow = std::make_shared(CVAR_WINDOW("AdditionalTimers"), "Additional Timers"); gui->AddGuiWindow(mTimeDisplayWindow); - mAboutWindow = std::make_shared(CVAR_WINDOW("About"), "About"); - gui->AddGuiWindow(mAboutWindow); } void Destroy() { @@ -265,7 +262,6 @@ namespace SohGui { mTimeSplitWindow = nullptr; mPlandomizerWindow = nullptr; mTimeDisplayWindow = nullptr; - mAboutWindow = nullptr; } void RegisterPopup(std::string title, std::string message, std::string button1, std::string button2, std::function button1callback, std::function button2callback) { diff --git a/soh/soh/SohGui/SohGui.hpp b/soh/soh/SohGui/SohGui.hpp index 4544c13e9e0..a1bbacd7301 100644 --- a/soh/soh/SohGui/SohGui.hpp +++ b/soh/soh/SohGui/SohGui.hpp @@ -26,7 +26,6 @@ #include "soh/Enhancements/randomizer/randomizer_settings_window.h" #include "soh/Enhancements/timesplits/TimeSplits.h" #include "soh/Enhancements/randomizer/Plandomizer.h" -#include "soh/AboutWindow.h" #include "SohModals.h" #ifdef __cplusplus diff --git a/soh/soh/SohGui/SohMenuBar.cpp b/soh/soh/SohGui/SohMenuBar.cpp index e5e52c71d17..82da3132cde 100644 --- a/soh/soh/SohGui/SohMenuBar.cpp +++ b/soh/soh/SohGui/SohMenuBar.cpp @@ -44,7 +44,6 @@ #include "soh/Enhancements/timesplits/TimeSplits.h" #include "soh/Enhancements/randomizer/Plandomizer.h" #include "soh/Enhancements/TimeDisplay/TimeDisplay.h" -#include "soh/AboutWindow.h" // FA icons are kind of wonky, if they worked how I expected them to the "+ 2.0f" wouldn't be needed, but // they don't work how I expect them to so I added that because it looked good when I eyeballed it @@ -178,15 +177,8 @@ void DrawMenuBarIcon() { } } -extern std::shared_ptr mAboutWindow; - void DrawShipMenu() { if (ImGui::BeginMenu("Ship")) { - if (mAboutWindow) { - if (ImGui::MenuItem("About...")) { - mAboutWindow->Show(); - } - } UIWidgets::Spacer(0); diff --git a/soh/soh/SohGui/SohMenuSettings.cpp b/soh/soh/SohGui/SohMenuSettings.cpp index fa76fc72568..20cd4454b15 100644 --- a/soh/soh/SohGui/SohMenuSettings.cpp +++ b/soh/soh/SohGui/SohMenuSettings.cpp @@ -1,6 +1,7 @@ #include "SohMenu.h" #include "soh/Notification/Notification.h" - +#include +#include "soh/ResourceManagerHelpers.h" extern "C" { #include "include/z64audio.h" @@ -12,11 +13,42 @@ namespace SohGui { extern std::shared_ptr mSohMenu; using namespace UIWidgets2; +const char* GetGameVersionString(uint32_t index) { + uint32_t gameVersion = ResourceMgr_GetGameVersion(index); + switch (gameVersion) { + case OOT_NTSC_US_10: + return "NTSC-U 1.0"; + case OOT_NTSC_US_11: + return "NTSC-U 1.1"; + case OOT_NTSC_US_12: + return "NTSC-U 1.2"; + case OOT_PAL_10: + return "PAL 1.0"; + case OOT_PAL_11: + return "PAL 1.1"; + case OOT_PAL_GC: + return "PAL GC"; + case OOT_PAL_MQ: + return "PAL MQ"; + case OOT_PAL_GC_DBG1: + case OOT_PAL_GC_DBG2: + return "PAL GC-D"; + case OOT_PAL_GC_MQ_DBG: + return "PAL MQ-D"; + case OOT_IQUE_CN: + return "IQUE CN"; + case OOT_IQUE_TW: + return "IQUE TW"; + default: + return "UNKNOWN"; + } +} + void SohMenu::AddMenuSettings() { // Add Settings Menu AddMenuEntry("Settings", CVAR_SETTING("Menu.SettingsSidebarSection")); - // General + // General - About AddSidebarEntry("Settings", "General", 3); WidgetPath path = { "Settings", "General", SECTION_COLUMN_1 }; @@ -31,7 +63,11 @@ void SohMenu::AddMenuSettings() { AddWidget(path, gGitCommitHash, WIDGET_TEXT).PreFunc([](WidgetInfo& info) { info.isHidden = (gGitCommitTag[0] != 0); }); + for (uint32_t i = 0; i < ResourceMgr_GetNumGameVersions(); i++) { + AddWidget(path, GetGameVersionString(i), WIDGET_TEXT); + } + // General - Settings AddWidget(path, "Settings", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Menu Theme", WIDGET_CVAR_COMBOBOX) .CVar(CVAR_SETTING("Menu.Theme"))