Implement widget search exclusion.

Exclude all external windows from the search.
This commit is contained in:
Malkierian 2025-07-01 19:45:43 -07:00
commit 36014bb347
6 changed files with 80 additions and 37 deletions

View file

@ -195,7 +195,8 @@ uint32_t Menu::DrawSearchResults(std::string& menuSearchText) {
auto& column = sidebar.columnWidgets.at(i);
for (auto& info : column) {
if (info.type == WIDGET_SEARCH || info.type == WIDGET_SEPARATOR ||
info.type == WIDGET_SEPARATOR_TEXT || info.isHidden) {
info.type == WIDGET_SEPARATOR_TEXT || info.isHidden ||
info.hideInSearch) {
continue;
}
const char* tooltip = info.options->tooltip;

View file

@ -111,11 +111,13 @@ struct WidgetInfo {
bool isHidden = false;
bool sameLine = false;
bool raceDisable = true;
bool hideInSearch = false;
WidgetInfo& CVar(const char* cVar_) {
cVar = cVar_;
return *this;
}
WidgetInfo& Options(OptionsVariant options_) {
switch (type) {
case WIDGET_AUDIO_BACKEND:
@ -155,48 +157,63 @@ struct WidgetInfo {
}
return *this;
}
WidgetInfo& Options(std::shared_ptr<UIWidgets::WidgetOptions> options_) {
options = options_;
return *this;
}
WidgetInfo& Callback(WidgetFunc callback_) {
callback = callback_;
return *this;
}
WidgetInfo& PreFunc(WidgetFunc preFunc_) {
preFunc = preFunc_;
return *this;
}
WidgetInfo& PostFunc(WidgetFunc postFunc_) {
postFunc = postFunc_;
return *this;
}
WidgetInfo& WindowName(const char* windowName_) {
windowName = windowName_;
return *this;
}
WidgetInfo& ValuePointer(std::variant<bool*, int32_t*, float*> valuePointer_) {
valuePointer = valuePointer_;
return *this;
}
WidgetInfo& SameLine(bool sameLine_) {
sameLine = sameLine_;
return *this;
}
WidgetInfo& CustomFunction(WidgetFunc customFunction_) {
customFunction = customFunction_;
return *this;
}
WidgetInfo& RaceDisable(bool disable) {
raceDisable = disable;
return *this;
}
WidgetInfo& HideInSearch(bool hide) {
hideInSearch = hide;
return *this;
}
void ResetDisables() {
isHidden = false;
options->disabled = false;
options->disabledTooltip = "";
activeDisables.clear();
}
WidgetInfo& Options(std::shared_ptr<UIWidgets::WidgetOptions> options_) {
options = options_;
return *this;
}
WidgetInfo& Callback(WidgetFunc callback_) {
callback = callback_;
return *this;
}
WidgetInfo& PreFunc(WidgetFunc preFunc_) {
preFunc = preFunc_;
return *this;
}
WidgetInfo& PostFunc(WidgetFunc postFunc_) {
postFunc = postFunc_;
return *this;
}
WidgetInfo& WindowName(const char* windowName_) {
windowName = windowName_;
return *this;
}
WidgetInfo& ValuePointer(std::variant<bool*, int32_t*, float*> valuePointer_) {
valuePointer = valuePointer_;
return *this;
}
WidgetInfo& SameLine(bool sameLine_) {
sameLine = sameLine_;
return *this;
}
WidgetInfo& CustomFunction(WidgetFunc customFunction_) {
customFunction = customFunction_;
return *this;
}
WidgetInfo& RaceDisable(bool disable) {
raceDisable = disable;
return *this;
}
};
struct WidgetPath {

View file

@ -124,6 +124,7 @@ void SohMenu::AddMenuDevTools() {
.CVar(CVAR_WINDOW("SohStats"))
.RaceDisable(false)
.WindowName("Stats##Soh")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Stats Window."));
// Console
@ -132,6 +133,7 @@ void SohMenu::AddMenuDevTools() {
AddWidget(path, "Popout Console", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("SohConsole"))
.WindowName("Console##SoH")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Console Window."));
// Save Editor
@ -140,6 +142,7 @@ void SohMenu::AddMenuDevTools() {
AddWidget(path, "Popout Save Editor", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("SaveEditor"))
.WindowName("Save Editor")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Save Editor Window."));
// Hook Debugger
@ -148,6 +151,7 @@ void SohMenu::AddMenuDevTools() {
AddWidget(path, "Popout Hook Debugger", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("HookDebugger"))
.WindowName("Hook Debugger")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Hook Debugger Window."));
// Collision Viewer
@ -156,6 +160,7 @@ void SohMenu::AddMenuDevTools() {
AddWidget(path, "Popout Collision Viewer", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("CollisionViewer"))
.WindowName("Collision Viewer")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Collision Viewer Window."));
// Actor Viewer
@ -164,6 +169,7 @@ void SohMenu::AddMenuDevTools() {
AddWidget(path, "Popout Actor Viewer", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("ActorViewer"))
.WindowName("Actor Viewer")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Actor Viewer Window."));
// Display List Viewer
@ -172,6 +178,7 @@ void SohMenu::AddMenuDevTools() {
AddWidget(path, "Popout Display List Viewer", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("DisplayListViewer"))
.WindowName("Display List Viewer")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Display List Viewer Window."));
// Value Viewer
@ -180,6 +187,7 @@ void SohMenu::AddMenuDevTools() {
AddWidget(path, "Popout Value Viewer", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("ValueViewer"))
.WindowName("Value Viewer")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Value Viewer Window."));
// Message Viewer
@ -188,6 +196,7 @@ void SohMenu::AddMenuDevTools() {
AddWidget(path, "Popout Message Viewer", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("MessageViewer"))
.WindowName("Message Viewer")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Message Viewer Window."));
// Gfx Debugger
@ -196,6 +205,7 @@ void SohMenu::AddMenuDevTools() {
AddWidget(path, "Popout Gfx Debugger", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("SohGfxDebugger"))
.WindowName("GfxDebugger##SoH")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Gfx Debugger Window."));
}

View file

@ -1826,6 +1826,7 @@ void SohMenu::AddMenuEnhancements() {
.CVar(CVAR_WINDOW("CosmeticsEditor"))
.RaceDisable(false)
.WindowName("Cosmetics Editor")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Cosmetics Editor Window."));
// Audio Editor
@ -1835,6 +1836,7 @@ void SohMenu::AddMenuEnhancements() {
.CVar(CVAR_WINDOW("AudioEditor"))
.RaceDisable(false)
.WindowName("Audio Editor")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Audio Editor Window."));
// Gameplay Stats
@ -1844,6 +1846,7 @@ void SohMenu::AddMenuEnhancements() {
.CVar(CVAR_WINDOW("GameplayStats"))
.RaceDisable(false)
.WindowName("Gameplay Stats")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Gameplay Stats Window."));
// Time Splits
@ -1853,6 +1856,7 @@ void SohMenu::AddMenuEnhancements() {
.CVar(CVAR_WINDOW("TimeSplits"))
.RaceDisable(false)
.WindowName("Time Splits")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Time Splits Window."));
// Timers

View file

@ -22,6 +22,7 @@ void SohMenu::AddMenuRandomizer() {
AddWidget(path, "Popout Randomizer Settings Window", WIDGET_WINDOW_BUTTON)
.CVar(CVAR_WINDOW("RandomizerSettings"))
.WindowName("Randomizer Settings")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Randomizer Settings Window."));
// Enhancements
@ -104,6 +105,7 @@ void SohMenu::AddMenuRandomizer() {
.CVar(CVAR_WINDOW("PlandomizerEditor"))
.RaceDisable(false)
.WindowName("Plandomizer Editor")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Randomizer Settings Window."));
// Item Tracker
@ -115,6 +117,7 @@ void SohMenu::AddMenuRandomizer() {
.CVar(CVAR_WINDOW("ItemTracker"))
.RaceDisable(false)
.WindowName("Item Tracker")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Toggles the Item Tracker.").EmbedWindow(false));
AddWidget(path, "Item Tracker Settings", WIDGET_SEPARATOR_TEXT);
@ -122,6 +125,7 @@ void SohMenu::AddMenuRandomizer() {
.CVar(CVAR_WINDOW("ItemTrackerSettings"))
.RaceDisable(false)
.WindowName("Item Tracker Settings")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Item Tracker Settings Window."));
// Entrance Tracker
@ -133,6 +137,7 @@ void SohMenu::AddMenuRandomizer() {
.CVar(CVAR_WINDOW("EntranceTracker"))
.RaceDisable(false)
.WindowName("Entrance Tracker")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Toggles the Entrance Tracker.").EmbedWindow(false));
AddWidget(path, "Entrance Tracker Settings", WIDGET_SEPARATOR_TEXT);
@ -140,6 +145,7 @@ void SohMenu::AddMenuRandomizer() {
.CVar(CVAR_WINDOW("EntranceTrackerSettings"))
.RaceDisable(false)
.WindowName("Entrance Tracker Settings")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Entrance Tracker Settings Window."));
// Check Tracker
@ -151,6 +157,7 @@ void SohMenu::AddMenuRandomizer() {
.CVar(CVAR_WINDOW("CheckTracker"))
.RaceDisable(false)
.WindowName("Check Tracker")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Toggles the Check Tracker.").EmbedWindow(false));
AddWidget(path, "Check Tracker Settings", WIDGET_SEPARATOR_TEXT);
@ -158,6 +165,7 @@ void SohMenu::AddMenuRandomizer() {
.CVar(CVAR_WINDOW("CheckTrackerSettings"))
.RaceDisable(false)
.WindowName("Check Tracker Settings")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Check Tracker Settings Window."));
}

View file

@ -416,6 +416,7 @@ void SohMenu::AddMenuSettings() {
.CVar(CVAR_WINDOW("ControllerConfiguration"))
.RaceDisable(false)
.WindowName("Configure Controller")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Bindings Window."));
// Input Viewer
@ -426,6 +427,7 @@ void SohMenu::AddMenuSettings() {
.CVar(CVAR_WINDOW("InputViewer"))
.RaceDisable(false)
.WindowName("Input Viewer")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Toggles the Input Viewer.").EmbedWindow(false));
AddWidget(path, "Input Viewer Settings", WIDGET_SEPARATOR_TEXT);
@ -433,6 +435,7 @@ void SohMenu::AddMenuSettings() {
.CVar(CVAR_WINDOW("InputViewerSettings"))
.RaceDisable(false)
.WindowName("Input Viewer Settings")
.HideInSearch(true)
.Options(WindowButtonOptions().Tooltip("Enables the separate Input Viewer Settings Window."));
// Notifications