Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "Features/Upscaling.h"
#include "Menu/AdvancedSettingsRenderer.h"
#include "Menu/FeatureListRenderer.h"
#include "Menu/HomePageRenderer.h"
#include "Menu/MenuHeaderRenderer.h"
#include "Menu/OverlayRenderer.h"
#include "Menu/SettingsTabRenderer.h"
Expand Down Expand Up @@ -122,6 +123,7 @@ Menu::~Menu()
uiIcons.loadSettings.Release();
uiIcons.clearCache.Release();
uiIcons.logo.Release();
uiIcons.discord.Release();
uiIcons.characters.Release();
uiIcons.grass.Release();
uiIcons.lighting.Release();
Expand All @@ -130,6 +132,7 @@ Menu::~Menu()
uiIcons.water.Release();
uiIcons.debug.Release();
uiIcons.materials.Release();
uiIcons.postProcessing.Release();

ImGui_ImplDX11_Shutdown();
ImGui_ImplWin32_Shutdown();
Expand Down Expand Up @@ -180,7 +183,8 @@ void Menu::Init()

fontSize = std::clamp(fontSize, ThemeManager::Constants::MIN_FONT_SIZE, ThemeManager::Constants::MAX_FONT_SIZE);

if (!imgui_io.Fonts->AddFontFromFileTTF("Data\\Interface\\CommunityShaders\\Fonts\\Jost-Regular.ttf",
auto fontPath = Util::PathHelpers::GetFontsPath() / "Jost-Regular.ttf";
if (!imgui_io.Fonts->AddFontFromFileTTF(fontPath.string().c_str(),
std::round(fontSize), &font_config)) {
logger::warn("Menu::Init() - Failed to load custom font. Using default font.");
imgui_io.Fonts->AddFontDefault();
Expand Down Expand Up @@ -593,7 +597,7 @@ void Menu::ProcessInputEvents(RE::InputEvent* const* a_events)

bool Menu::ShouldSwallowInput()
{
return IsEnabled;
return IsEnabled || HomePageRenderer::ShouldShowFirstTimeSetup();
}

void Menu::SelectFeatureMenu(const std::string& featureName)
Expand Down
3 changes: 3 additions & 0 deletions src/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ class Menu
UIIcon logo; // New logo icon
UIIcon search; // Search icon for search bars

// Social media/external link icons
UIIcon discord;

// Category icons
UIIcon characters;
UIIcon grass;
Expand Down
35 changes: 24 additions & 11 deletions src/Menu/FeatureListRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,23 @@
#include "FeatureIssues.h"
#include "Globals.h"
#include "Menu.h"
#include "Menu/HomePageRenderer.h"
#include "Menu/ThemeManager.h"
#include "SettingsOverrideManager.h"
#include "State.h"
#include "Util.h"

namespace
{
// Core built-in menu names that always appear first in the menu list
constexpr std::array<const char*, 4> CORE_MENU_NAMES = { "Home", "General", "Advanced", "Display" };

bool IsCoreMenu(const std::string& menuName)
{
return std::find(CORE_MENU_NAMES.begin(), CORE_MENU_NAMES.end(), menuName) != CORE_MENU_NAMES.end();
}
}
Comment on lines +19 to +28

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing <array> include to avoid compile error.

You introduced std::array in this block but didn’t include the header.

Apply this diff to add the include:

 #include <algorithm>
+#include <array>
 #include <filesystem>
 #include <format>
 #include <imgui.h>
 #include <ranges>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
namespace
{
// Core built-in menu names that always appear first in the menu list
constexpr std::array<const char*, 4> CORE_MENU_NAMES = { "Home", "General", "Advanced", "Display" };
bool IsCoreMenu(const std::string& menuName)
{
return std::find(CORE_MENU_NAMES.begin(), CORE_MENU_NAMES.end(), menuName) != CORE_MENU_NAMES.end();
}
}
#include <algorithm>
#include <array>
#include <filesystem>
#include <format>
#include <imgui.h>
#include <ranges>
🤖 Prompt for AI Agents
In src/Menu/FeatureListRenderer.cpp around lines 19 to 28, the code uses
std::array but the header <array> is not included which causes a compile error;
add a single line include for <array> near the other includes at the top of the
file (e.g., alongside existing standard headers) so the constexpr std::array
declaration and subsequent usage compile successfully.


void FeatureListRenderer::RenderFeatureList(
float footerHeight,
size_t& selectedMenu,
Expand Down Expand Up @@ -65,6 +77,7 @@ std::vector<FeatureListRenderer::MenuFuncInfo> FeatureListRenderer::BuildMenuLis
}

auto menuList = std::vector<MenuFuncInfo>{
BuiltInMenu{ "Home", []() { HomePageRenderer::RenderHomePage(); } },
BuiltInMenu{ "General", drawGeneralSettings },
BuiltInMenu{ "Advanced", drawAdvancedSettings }
}; // NOTE: The menu list is rebuilt every frame, so category expansion states
Expand Down Expand Up @@ -173,25 +186,25 @@ void FeatureListRenderer::RenderLeftColumn(
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4());
if (ImGui::BeginListBox("##MenusList", { -FLT_MIN, -FLT_MIN })) {
// Find where built-in menus end (General, Advanced)
size_t builtInMenuCount = 0;
// Find where core built-in menus end (Home, General, Advanced, Display)
size_t coreMenuCount = 0;
for (size_t i = 0; i < menuList.size(); i++) {
if (std::holds_alternative<BuiltInMenu>(menuList[i])) {
const BuiltInMenu& menu = std::get<BuiltInMenu>(menuList[i]);
if (menu.name == "General" || menu.name == "Advanced") {
builtInMenuCount++;
if (IsCoreMenu(menu.name)) {
coreMenuCount++;
}
}
}

// First render the built-in menus (General, Advanced)
size_t renderedBuiltIns = 0;
for (size_t i = 0; i < menuList.size() && renderedBuiltIns < 2; i++) {
// First render the core built-in menus (Home, General, Advanced, Display)
size_t renderedCoreMenus = 0;
for (size_t i = 0; i < menuList.size() && renderedCoreMenus < CORE_MENU_NAMES.size(); i++) {
if (std::holds_alternative<BuiltInMenu>(menuList[i])) {
const BuiltInMenu& menu = std::get<BuiltInMenu>(menuList[i]);
if (menu.name == "General" || menu.name == "Advanced") {
if (IsCoreMenu(menu.name)) {
std::visit(ListMenuVisitor{ i, selectedMenu, categoryExpansionStates }, menuList[i]);
renderedBuiltIns++;
renderedCoreMenus++;
}
}
}
Expand All @@ -200,11 +213,11 @@ void FeatureListRenderer::RenderLeftColumn(
Util::DrawSectionHeader("Features", true);
Util::DrawFeatureSearchBar(featureSearch);

// Then render the rest (features and categories, but skip already rendered built-ins)
// Then render the rest (features and categories, but skip already rendered core menus)
for (size_t i = 0; i < menuList.size(); i++) {
if (std::holds_alternative<BuiltInMenu>(menuList[i])) {
const BuiltInMenu& menu = std::get<BuiltInMenu>(menuList[i]);
if (menu.name == "General" || menu.name == "Advanced") {
if (IsCoreMenu(menu.name)) {
continue; // Skip, already rendered
}
}
Expand Down
Loading