From 6b0a56d5d66032c4d150c76c2b6a537930a5c5fa Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 1 Aug 2025 02:53:02 -0500 Subject: [PATCH] Squashed 'deps/nostalgia/' changes from e38b85b4..31b39982 31b39982 [keel] Fix AssetRef to call incRef on initial creation of ref, not just copy 5476417b [nostalgia] Add release notes for d2025.07.0 e03be694 Merge commit 'b67b95767b7bfcd5f618ebc8e14ddbc83edcbe36' 490c0368 [nostalgia/gfx] Add lists for file extensions a24fc407 [ox/std] Fix MSVC build git-subtree-dir: deps/nostalgia git-subtree-split: 31b39982c5ead87da1727bc1f561b945e4d1e5fb --- deps/ox/src/ox/std/stringliteral.hpp | 2 +- release-notes.md | 6 ++++++ .../gfx/include/nostalgia/gfx/consts.hpp | 21 ++++++++++++++++++- .../keel/include/keel/assetmanager.hpp | 3 +++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/deps/ox/src/ox/std/stringliteral.hpp b/deps/ox/src/ox/std/stringliteral.hpp index f78b946..adf4127 100644 --- a/deps/ox/src/ox/std/stringliteral.hpp +++ b/deps/ox/src/ox/std/stringliteral.hpp @@ -19,7 +19,7 @@ namespace ox { */ class StringLiteral: public detail::BaseStringView { public: - consteval StringLiteral() noexcept = default; + constexpr StringLiteral() noexcept = default; constexpr StringLiteral(StringLiteral const &sv) noexcept = default; diff --git a/release-notes.md b/release-notes.md index 43a2a13..41b4281 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,3 +1,9 @@ +# d2025.07.0 + +* Add sub-command for exporting TileSheets as PNG files. +* Add 'Reload Project' menu item under File. +* Fix opening a project to mark an unopenable file as closed in the config file on startup. + # d2025.06.0 * Add ability to remember recent projects in config diff --git a/src/nostalgia/modules/gfx/include/nostalgia/gfx/consts.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/consts.hpp index 887c7cc..1b4bfe0 100644 --- a/src/nostalgia/modules/gfx/include/nostalgia/gfx/consts.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/consts.hpp @@ -21,9 +21,28 @@ constexpr ox::Array FileExts_TileSheet{ FileExt_ng, }; +constexpr ox::Array FileExts_Palette{ + FileExt_npal, +}; + [[nodiscard]] constexpr bool isTileSheet(ox::StringViewCR path) noexcept { - return endsWith(path, FileExt_nts) || endsWith(path, FileExt_ng); + return ox::any_of( + FileExts_TileSheet.begin(), + FileExts_TileSheet.end(), + [path](ox::StringLiteral const &ext) { + return endsWith(path, ext); + }); +} + +[[nodiscard]] +constexpr bool isPalette(ox::StringViewCR path) noexcept { + return ox::any_of( + FileExts_Palette.begin(), + FileExts_Palette.end(), + [path](ox::StringLiteral const &ext) { + return endsWith(path, ext); + }); } } diff --git a/src/olympic/keel/include/keel/assetmanager.hpp b/src/olympic/keel/include/keel/assetmanager.hpp index 62cda92..2719e45 100644 --- a/src/olympic/keel/include/keel/assetmanager.hpp +++ b/src/olympic/keel/include/keel/assetmanager.hpp @@ -64,11 +64,13 @@ class AssetContainer { protected: constexpr void incRefs() const noexcept { + oxAssert(m_references < ox::MaxValue, "reference count exceeds maximum"); ++m_references; } constexpr void decRefs() const noexcept { --m_references; + oxAssert(m_references >= 0, "negative references"); } [[nodiscard]] @@ -162,6 +164,7 @@ template constexpr AssetRef::AssetRef(AssetContainer const*c) noexcept: m_ctr(c) { if (m_ctr) { m_ctr->updated.connect(this, &AssetRef::emitUpdated); + m_ctr->incRefs(); } }