Compare commits

...

6 Commits

Author SHA1 Message Date
6a0f57994c Merge commit '6b0a56d5d66032c4d150c76c2b6a537930a5c5fa'
All checks were successful
Build / build (push) Successful in 1m31s
2025-08-01 02:53:02 -05:00
6b0a56d5d6 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
2025-08-01 02:53:02 -05:00
3aac345637 Merge commit 'b67b95767b7bfcd5f618ebc8e14ddbc83edcbe36'
All checks were successful
Build / build (push) Successful in 1m30s
2025-07-31 00:41:06 -05:00
b67b95767b Squashed 'deps/nostalgia/' changes from f7c3c02c..e38b85b4
e38b85b4 [studio] Eliminate redundant serialization and deserialization

git-subtree-dir: deps/nostalgia
git-subtree-split: e38b85b4f4134af04b9b71caddcd2268f425f5df
2025-07-31 00:41:06 -05:00
8aea7c2ecf [nostalgia/gfx] Add lists for file extensions
All checks were successful
Build / build (push) Successful in 1m31s
2025-07-31 00:39:55 -05:00
e9a7fb1ec8 [ox/std] Fix MSVC build
Some checks failed
Build / build (push) Has been cancelled
2025-07-31 00:38:26 -05:00
5 changed files with 32 additions and 5 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -21,9 +21,28 @@ constexpr ox::Array<ox::StringLiteral, 2> FileExts_TileSheet{
FileExt_ng,
};
constexpr ox::Array<ox::StringLiteral, 2> 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);
});
}
}

View File

@@ -64,11 +64,13 @@ class AssetContainer {
protected:
constexpr void incRefs() const noexcept {
oxAssert(m_references < ox::MaxValue<decltype(m_references)>, "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<typename T>
constexpr AssetRef<T>::AssetRef(AssetContainer<T> const*c) noexcept: m_ctr(c) {
if (m_ctr) {
m_ctr->updated.connect(this, &AssetRef::emitUpdated);
m_ctr->incRefs();
}
}

View File

@@ -185,14 +185,13 @@ ox::Error Project::writeObj(ox::StringViewCR path, T const &obj) noexcept {
template<typename T>
ox::Result<T> Project::loadObj(ox::StringViewCR path) const noexcept {
OX_REQUIRE_M(buff, loadBuff(path));
OX_REQUIRE(buff, loadBuff(path));
if constexpr(ox::is_same_v<T, ox::ModelObject>) {
return keel::readAsset(m_typeStore, buff);
} else {
OX_REQUIRE(typeId, keel::readAssetTypeId(buff));
if (typeId != ox::ModelTypeId_v<T>) {
OX_REQUIRE(ah, keel::readAssetHeader(buff));
OX_RETURN_ERROR(keel::convertBuffToBuff<T>(m_kctx, buff, ah.clawHdr.fmt).moveTo(buff));
return keel::convert<T>(m_kctx, buff);
}
return keel::readAsset<T>(buff);
}