Skip to content

Commit

Permalink
Fully replace about window
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Feb 1, 2025
1 parent 1de2240 commit 61c6d3d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 138 deletions.
103 changes: 0 additions & 103 deletions soh/soh/AboutWindow.cpp

This file was deleted.

20 changes: 0 additions & 20 deletions soh/soh/AboutWindow.h

This file was deleted.

4 changes: 0 additions & 4 deletions soh/soh/SohGui/SohGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ namespace SohGui {
std::shared_ptr<SohModalWindow> mModalWindow;
std::shared_ptr<Notification::Window> mNotificationWindow;
std::shared_ptr<TimeDisplayWindow> mTimeDisplayWindow;
std::shared_ptr<AboutWindow> mAboutWindow;

void SetupGuiElements() {
auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui();
Expand Down Expand Up @@ -227,8 +226,6 @@ namespace SohGui {
mNotificationWindow->Show();
mTimeDisplayWindow = std::make_shared<TimeDisplayWindow>(CVAR_WINDOW("AdditionalTimers"), "Additional Timers");
gui->AddGuiWindow(mTimeDisplayWindow);
mAboutWindow = std::make_shared<AboutWindow>(CVAR_WINDOW("About"), "About");
gui->AddGuiWindow(mAboutWindow);
}

void Destroy() {
Expand Down Expand Up @@ -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<void()> button1callback, std::function<void()> button2callback) {
Expand Down
1 change: 0 additions & 1 deletion soh/soh/SohGui/SohGui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions soh/soh/SohGui/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -178,15 +177,8 @@ void DrawMenuBarIcon() {
}
}

extern std::shared_ptr<AboutWindow> mAboutWindow;

void DrawShipMenu() {
if (ImGui::BeginMenu("Ship")) {
if (mAboutWindow) {
if (ImGui::MenuItem("About...")) {
mAboutWindow->Show();
}
}

UIWidgets::Spacer(0);

Expand Down
40 changes: 38 additions & 2 deletions soh/soh/SohGui/SohMenuSettings.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "SohMenu.h"
#include "soh/Notification/Notification.h"

#include <soh/GameVersions.h>
#include "soh/ResourceManagerHelpers.h"

extern "C" {
#include "include/z64audio.h"
Expand All @@ -12,11 +13,42 @@ namespace SohGui {
extern std::shared_ptr<SohMenu> 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 };

Expand All @@ -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"))
Expand Down

0 comments on commit 61c6d3d

Please sign in to comment.