From 42352715a4a5aee7114b0a28d487f45c4bfe91ce Mon Sep 17 00:00:00 2001 From: Brucio Date: Sat, 2 May 2026 17:19:21 -0400 Subject: [PATCH] fix: drive feature IsCore() from CORE marker file --- CMakeLists.txt | 12 ++++++++++++ cmake/FeatureVersions.h.in | 7 +++++++ src/Feature.h | 11 +++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 318820a7de..9358a184f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,6 +225,17 @@ foreach(FEATURE_PATH ${FEATURE_CONFIG_FILES}) "Feature config file '${FEATURE_PATH}' is empty or contains only whitespace. Skipping version detection for this feature." ) endif() + + # Detect core features by checking for the CORE marker file in the + # feature root (features//CORE). FEATURE_PATH is + # features//Shaders/Features/.ini, so the feature + # root is three directories up. + get_filename_component(_FEATURE_DIR "${FEATURE_PATH}" DIRECTORY) + get_filename_component(_FEATURE_DIR "${_FEATURE_DIR}" DIRECTORY) + get_filename_component(_FEATURE_DIR "${_FEATURE_DIR}" DIRECTORY) + if(EXISTS "${_FEATURE_DIR}/CORE") + list(APPEND FEATURE_CORE_NAMES "\t\t\"${FEATURE}\"sv") + endif() endforeach() set_property( @@ -234,6 +245,7 @@ set_property( ) string(REPLACE ";" ",\n" FEATURE_VERSIONS "${FEATURE_VERSIONS}") +string(REPLACE ";" ",\n" FEATURE_CORE_NAMES "${FEATURE_CORE_NAMES}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FeatureVersions.h.in diff --git a/cmake/FeatureVersions.h.in b/cmake/FeatureVersions.h.in index eb61d73fb1..dd38b5cb45 100644 --- a/cmake/FeatureVersions.h.in +++ b/cmake/FeatureVersions.h.in @@ -1,5 +1,7 @@ #pragma once +#include + namespace FeatureVersions { using namespace std::literals::string_view_literals; @@ -8,4 +10,9 @@ namespace FeatureVersions { @FEATURE_VERSIONS@ }; + + static const std::unordered_set FEATURE_CORE_NAMES + { +@FEATURE_CORE_NAMES@ + }; } diff --git a/src/Feature.h b/src/Feature.h index 96433bb64d..3667391bad 100644 --- a/src/Feature.h +++ b/src/Feature.h @@ -56,10 +56,13 @@ struct Feature /** * Whether the feature is a CORE feature * This will place it under "Core Features" in UI - * Also need to create a file named "CORE" in the root of the feature folder - * if it should be merged into main cs zip file + * If "CORE" file is present in the root of the feature folder, + * it will be merged into main cs zip file and automatically considered core */ - virtual bool IsCore() const { return false; } + virtual bool IsCore() const + { + return FeatureVersions::FEATURE_CORE_NAMES.contains(const_cast(this)->GetShortName()); + } /** * Get the category for UI grouping (e.g., "Terrain", "Lighting", "Characters", etc.) @@ -243,4 +246,4 @@ struct Feature } } } -}; \ No newline at end of file +};