summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArchez <Archez@users.noreply.github.com>2025-03-21 07:21:33 -0400
committerGitHub <noreply@github.com>2025-03-21 12:21:33 +0100
commit57bc5690e2843dcfd966e6dfcbbd65be956287e1 (patch)
treebda355dd553961ec22bf75101b86cfe095ebcc8c
parent985bf919457abeb1672eac1dcb621208ecd6ad2f (diff)
Mono dev tools (#5175)
* apply mono font to some dev tool windows * soh gui wrappers for gfxdebugger and console to set mono font * it can be just a little larger
-rw-r--r--soh/soh/Enhancements/debugger/debugSaveEditor.cpp4
-rw-r--r--soh/soh/Enhancements/debugger/dlViewer.cpp6
-rw-r--r--soh/soh/Enhancements/debugger/hookDebugger.cpp5
-rw-r--r--soh/soh/Enhancements/debugger/sohConsole.cpp30
-rw-r--r--soh/soh/Enhancements/debugger/sohConsole.h17
-rw-r--r--soh/soh/Enhancements/debugger/sohGfxDebugger.cpp16
-rw-r--r--soh/soh/Enhancements/debugger/sohGfxDebugger.h17
-rw-r--r--soh/soh/Enhancements/gameplaystats.cpp4
-rw-r--r--soh/soh/OTRGlobals.cpp1
-rw-r--r--soh/soh/OTRGlobals.h1
-rw-r--r--soh/soh/SohGui/SohGui.cpp12
-rw-r--r--soh/soh/SohGui/SohGui.hpp2
-rw-r--r--soh/soh/SohGui/SohMenuDevTools.cpp4
13 files changed, 109 insertions, 10 deletions
diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp
index 0e9bbc79a..96163f656 100644
--- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp
+++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp
@@ -1555,6 +1555,8 @@ void ResetBaseOptions() {
void SaveEditorWindow::DrawElement() {
PushStyleTabs(THEME_COLOR);
+ ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
+
if (ImGui::BeginTabBar("SaveContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
ResetBaseOptions();
if (ImGui::BeginTabItem("Info")) {
@@ -1594,6 +1596,8 @@ void SaveEditorWindow::DrawElement() {
ImGui::EndTabBar();
}
+
+ ImGui::PopFont();
PopStyleTabs();
}
diff --git a/soh/soh/Enhancements/debugger/dlViewer.cpp b/soh/soh/Enhancements/debugger/dlViewer.cpp
index a591cf948..27833058a 100644
--- a/soh/soh/Enhancements/debugger/dlViewer.cpp
+++ b/soh/soh/Enhancements/debugger/dlViewer.cpp
@@ -93,6 +93,8 @@ void PerformDisplayListSearch() {
void DLViewerWindow::DrawElement() {
// Debounce the search field as listing otr files is expensive
UIWidgets::PushStyleInput(THEME_COLOR);
+ ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
+
if (ImGui::InputText("Search Display Lists", searchString, ARRAY_COUNT(searchString))) {
doSearch = true;
searchDebounceFrames = 30;
@@ -121,6 +123,7 @@ void DLViewerWindow::DrawElement() {
UIWidgets::PopStyleCombobox();
if (activeDisplayList == "") {
+ ImGui::PopFont();
return;
}
@@ -326,8 +329,11 @@ void DLViewerWindow::DrawElement() {
}
} catch (const std::exception& e) {
ImGui::Text("Error displaying DL instructions.");
+ ImGui::PopFont();
return;
}
+
+ ImGui::PopFont();
}
void DLViewerWindow::InitElement() {
diff --git a/soh/soh/Enhancements/debugger/hookDebugger.cpp b/soh/soh/Enhancements/debugger/hookDebugger.cpp
index a9d6ca891..113862282 100644
--- a/soh/soh/Enhancements/debugger/hookDebugger.cpp
+++ b/soh/soh/Enhancements/debugger/hookDebugger.cpp
@@ -1,6 +1,7 @@
#include "hookDebugger.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/SohGui/UIWidgets.hpp"
+#include "soh/OTRGlobals.h"
#include <string>
#include <version>
@@ -82,12 +83,16 @@ void HookDebuggerWindow::DrawElement() {
"(\"__cpp_lib_source_location\" not defined in \"<version>\").");
#endif
+ ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
+
for (auto& [hookName, _] : hookData) {
if (ImGui::TreeNode(hookName)) {
DrawHookRegisteringInfos(hookName);
ImGui::TreePop();
}
}
+
+ ImGui::PopFont();
}
void HookDebuggerWindow::InitElement() {
diff --git a/soh/soh/Enhancements/debugger/sohConsole.cpp b/soh/soh/Enhancements/debugger/sohConsole.cpp
new file mode 100644
index 000000000..686152a1f
--- /dev/null
+++ b/soh/soh/Enhancements/debugger/sohConsole.cpp
@@ -0,0 +1,30 @@
+#include "sohConsole.h"
+#include "soh/OTRGlobals.h"
+#include "soh/SohGui/UIWidgets.hpp"
+#include "soh/SohGui/SohGui.hpp"
+
+void SohConsoleWindow::InitElement() {
+ ConsoleWindow::InitElement();
+}
+
+void SohConsoleWindow::UpdateElement() {
+ ConsoleWindow::UpdateElement();
+}
+
+void SohConsoleWindow::DrawElement() {
+ UIWidgets::PushStyleInput(THEME_COLOR);
+ // Small font (13) to match hardcoded width values in the LUS window.. set large font after below TODO addressed
+ ImGui::PushFont(OTRGlobals::Instance->fontMonoSmall);
+
+ // TODO: This can be removed after the LUS console window is designed better without hardcoding widths
+ ImGui::BeginChild("##Console Wrapper", ImVec2(0, 0), ImGuiChildFlags_None,
+ ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar |
+ ImGuiWindowFlags_NoScrollWithMouse);
+
+ ConsoleWindow::DrawElement();
+
+ ImGui::EndChild();
+
+ ImGui::PopFont();
+ UIWidgets::PopStyleInput();
+}
diff --git a/soh/soh/Enhancements/debugger/sohConsole.h b/soh/soh/Enhancements/debugger/sohConsole.h
new file mode 100644
index 000000000..db039625b
--- /dev/null
+++ b/soh/soh/Enhancements/debugger/sohConsole.h
@@ -0,0 +1,17 @@
+#ifndef SOH_CONSOLE_H
+#define SOH_CONSOLE_H
+
+#include "window/gui/GuiWindow.h"
+#include "window/gui/ConsoleWindow.h"
+
+class SohConsoleWindow : public Ship::ConsoleWindow {
+ public:
+ using ConsoleWindow::ConsoleWindow;
+
+ protected:
+ void InitElement() override;
+ void UpdateElement() override;
+ void DrawElement() override;
+};
+
+#endif // SOH_CONSOLE_H
diff --git a/soh/soh/Enhancements/debugger/sohGfxDebugger.cpp b/soh/soh/Enhancements/debugger/sohGfxDebugger.cpp
new file mode 100644
index 000000000..20b37ca93
--- /dev/null
+++ b/soh/soh/Enhancements/debugger/sohGfxDebugger.cpp
@@ -0,0 +1,16 @@
+#include "sohGfxDebugger.h"
+#include "soh/OTRGlobals.h"
+
+void SohGfxDebuggerWindow::InitElement() {
+ GfxDebuggerWindow::InitElement();
+}
+
+void SohGfxDebuggerWindow::UpdateElement() {
+ GfxDebuggerWindow::UpdateElement();
+}
+
+void SohGfxDebuggerWindow::DrawElement() {
+ ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
+ GfxDebuggerWindow::DrawElement();
+ ImGui::PopFont();
+}
diff --git a/soh/soh/Enhancements/debugger/sohGfxDebugger.h b/soh/soh/Enhancements/debugger/sohGfxDebugger.h
new file mode 100644
index 000000000..789173b88
--- /dev/null
+++ b/soh/soh/Enhancements/debugger/sohGfxDebugger.h
@@ -0,0 +1,17 @@
+#ifndef SOH_GFX_DEBUGGER_H
+#define SOH_GFX_DEBUGGER_H
+
+#include "window/gui/GuiWindow.h"
+#include "window/gui/GfxDebuggerWindow.h"
+
+class SohGfxDebuggerWindow : public LUS::GfxDebuggerWindow {
+ public:
+ using GfxDebuggerWindow::GfxDebuggerWindow;
+
+ protected:
+ void InitElement() override;
+ void UpdateElement() override;
+ void DrawElement() override;
+};
+
+#endif // SOH_GFX_DEBUGGER_H
diff --git a/soh/soh/Enhancements/gameplaystats.cpp b/soh/soh/Enhancements/gameplaystats.cpp
index af7807b3a..937e81ede 100644
--- a/soh/soh/Enhancements/gameplaystats.cpp
+++ b/soh/soh/Enhancements/gameplaystats.cpp
@@ -635,9 +635,11 @@ void DrawGameplayStatsOptionsTab() {
}
void GameplayStatsWindow::DrawElement() {
+ ImGui::PushFont(OTRGlobals::Instance->fontMonoLarger);
DrawGameplayStatsHeader();
UIWidgets::PushStyleTabs(THEME_COLOR);
+
if (ImGui::BeginTabBar("Stats", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("Timestamps")) {
DrawGameplayStatsTimestampsTab();
@@ -657,7 +659,9 @@ void GameplayStatsWindow::DrawElement() {
}
ImGui::EndTabBar();
}
+
UIWidgets::PopStyleTabs();
+ ImGui::PopFont();
ImGui::Text("Note: Gameplay stats are saved to the current file and will be\nlost if you quit without saving.");
}
diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp
index 5d2310e1b..a86c77524 100644
--- a/soh/soh/OTRGlobals.cpp
+++ b/soh/soh/OTRGlobals.cpp
@@ -401,6 +401,7 @@ OTRGlobals::OTRGlobals() {
previousImGuiScale = defaultImGuiScale;
+ fontMonoSmall = CreateFontWithSize(14.0f, "fonts/Inconsolata-Regular.ttf");
fontMono = CreateFontWithSize(16.0f, "fonts/Inconsolata-Regular.ttf");
fontMonoLarger = CreateFontWithSize(20.0f, "fonts/Inconsolata-Regular.ttf");
fontMonoLargest = CreateFontWithSize(24.0f, "fonts/Inconsolata-Regular.ttf");
diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h
index 0a8d6595e..2f20b0b15 100644
--- a/soh/soh/OTRGlobals.h
+++ b/soh/soh/OTRGlobals.h
@@ -54,6 +54,7 @@ class OTRGlobals {
ImFont* defaultFontLarger;
ImFont* defaultFontLargest;
+ ImFont* fontMonoSmall;
ImFont* fontStandard;
ImFont* fontStandardLarger;
ImFont* fontStandardLargest;
diff --git a/soh/soh/SohGui/SohGui.cpp b/soh/soh/SohGui/SohGui.cpp
index ef8e40e8c..56da5eba0 100644
--- a/soh/soh/SohGui/SohGui.cpp
+++ b/soh/soh/SohGui/SohGui.cpp
@@ -124,15 +124,11 @@ namespace SohGui {
SPDLOG_ERROR("Could not find stats window");
}
- mConsoleWindow = gui->GetGuiWindow("Console");
- if (mConsoleWindow == nullptr) {
- SPDLOG_ERROR("Could not find console window");
- }
+ mConsoleWindow = std::make_shared<SohConsoleWindow>(CVAR_WINDOW("Console"), "Console##SoH", ImVec2(820, 630));
+ gui->AddGuiWindow(mConsoleWindow);
- mGfxDebuggerWindow = gui->GetGuiWindow("Gfx Debugger");
- if (mGfxDebuggerWindow == nullptr) {
- SPDLOG_ERROR("Could not find Gfx Debugger window");
- }
+ mGfxDebuggerWindow = std::make_shared<SohGfxDebuggerWindow>(CVAR_WINDOW("GfxDebugger"), "GfxDebugger##SoH", ImVec2(820, 630));
+ gui->AddGuiWindow(mGfxDebuggerWindow);
mInputEditorWindow = gui->GetGuiWindow("Controller Configuration");
if (mInputEditorWindow == nullptr) {
diff --git a/soh/soh/SohGui/SohGui.hpp b/soh/soh/SohGui/SohGui.hpp
index f465d1d1b..35c93b353 100644
--- a/soh/soh/SohGui/SohGui.hpp
+++ b/soh/soh/SohGui/SohGui.hpp
@@ -18,6 +18,8 @@
#include "soh/Enhancements/debugger/debugSaveEditor.h"
#include "soh/Enhancements/debugger/hookDebugger.h"
#include "soh/Enhancements/debugger/dlViewer.h"
+#include "soh/Enhancements/debugger/sohConsole.h"
+#include "soh/Enhancements/debugger/sohGfxDebugger.h"
#include "soh/Enhancements/debugger/valueViewer.h"
#include "soh/Enhancements/gameplaystatswindow.h"
#include "soh/Enhancements/randomizer/randomizer_check_tracker.h"
diff --git a/soh/soh/SohGui/SohMenuDevTools.cpp b/soh/soh/SohGui/SohMenuDevTools.cpp
index 917635f34..53d866a8e 100644
--- a/soh/soh/SohGui/SohMenuDevTools.cpp
+++ b/soh/soh/SohGui/SohMenuDevTools.cpp
@@ -99,7 +99,7 @@ void SohMenu::AddMenuDevTools() {
AddSidebarEntry("Dev Tools", path.sidebarName, 1);
AddWidget(path, "Popout Console", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("Console"))
- .WindowName("Console")
+ .WindowName("Console##SoH")
.Options(WindowButtonOptions().Tooltip("Enables the separate Console Window."));
// Save Editor
@@ -163,7 +163,7 @@ void SohMenu::AddMenuDevTools() {
AddSidebarEntry("Dev Tools", path.sidebarName, 1);
AddWidget(path, "Popout Gfx Debugger", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("GfxDebugger"))
- .WindowName("GfxDebuggerWindow")
+ .WindowName("GfxDebugger##SoH")
.Options(WindowButtonOptions().Tooltip("Enables the separate Gfx Debugger Window."));
}