diff --git a/deps/nostalgia/Makefile b/deps/nostalgia/Makefile index 7f1fb98..4994411 100644 --- a/deps/nostalgia/Makefile +++ b/deps/nostalgia/Makefile @@ -17,6 +17,10 @@ PROJECT_PLAYER=./build/${BC_VAR_CURRENT_BUILD}/bin/${BC_VAR_PROJECT_NAME_CAP} pkg-gba: build ${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/pkg-gba.py sample_project ${BC_VAR_PROJECT_NAME_CAP} +.PHONY: pkg-mac +pkg-mac: install + ${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/pkg-dmg.py + .PHONY: generate-studio-rsrc generate-studio-rsrc: ${BC_CMD_ENVRUN} ${BC_PY3} ./util/scripts/file-to-cpp.py --rsrc src/olympic/studio/applib/src/rsrc.json diff --git a/deps/nostalgia/deps/ox/src/ox/std/span.hpp b/deps/nostalgia/deps/ox/src/ox/std/span.hpp index 7b83626..871dd88 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/span.hpp +++ b/deps/nostalgia/deps/ox/src/ox/std/span.hpp @@ -146,12 +146,7 @@ class Span { return iterator(m_items, MaxValue, m_size); } - constexpr T &operator[](std::size_t i) noexcept { - boundsCheck(__FILE__, __LINE__, i, size(), "Span access overflow"); - return m_items[i]; - } - - constexpr T const&operator[](std::size_t i) const noexcept { + constexpr T &operator[](std::size_t i) const noexcept { boundsCheck(__FILE__, __LINE__, i, size(), "Span access overflow"); return m_items[i]; } diff --git a/deps/nostalgia/deps/ox/src/ox/std/string.hpp b/deps/nostalgia/deps/ox/src/ox/std/string.hpp index 55913f2..1dcb284 100644 --- a/deps/nostalgia/deps/ox/src/ox/std/string.hpp +++ b/deps/nostalgia/deps/ox/src/ox/std/string.hpp @@ -213,22 +213,22 @@ class BasicString { [[nodiscard]] constexpr const char *c_str() const noexcept { - return static_cast(m_buff.data()); + return m_buff.data(); } [[nodiscard]] - inline explicit operator const char*() const { + constexpr explicit operator const char*() const { return c_str(); } #if __has_include() [[nodiscard]] - inline std::string toStdString() const { + std::string toStdString() const { return c_str(); } [[nodiscard]] - inline explicit operator std::string() const { + explicit operator std::string() const { return c_str(); } #endif diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/B.int32;0 b/deps/nostalgia/project/.nostalgia/type_descriptors/B.int32;0 deleted file mode 100644 index c584116..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/B.int32;0 +++ /dev/null @@ -1,5 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "length" : 4, - "primitiveType" : 1, - "typeName" : "B.int32" -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/B.int8;0 b/deps/nostalgia/project/.nostalgia/type_descriptors/B.int8;0 deleted file mode 100644 index 2019e3c..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/B.int8;0 +++ /dev/null @@ -1,5 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "length" : 1, - "primitiveType" : 1, - "typeName" : "B.int8" -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/B.string;0 b/deps/nostalgia/project/.nostalgia/type_descriptors/B.string;0 deleted file mode 100644 index a6e483b..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/B.string;0 +++ /dev/null @@ -1,4 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "primitiveType" : 4, - "typeName" : "B.string" -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/B.uint16;0 b/deps/nostalgia/project/.nostalgia/type_descriptors/B.uint16;0 deleted file mode 100644 index e6addc3..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/B.uint16;0 +++ /dev/null @@ -1,4 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "length" : 2, - "typeName" : "B.uint16" -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/B.uint64;0 b/deps/nostalgia/project/.nostalgia/type_descriptors/B.uint64;0 deleted file mode 100644 index 78dfe05..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/B.uint64;0 +++ /dev/null @@ -1,4 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "length" : 8, - "typeName" : "B.uint64" -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/B.uint8;0 b/deps/nostalgia/project/.nostalgia/type_descriptors/B.uint8;0 deleted file mode 100644 index f7bad11..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/B.uint8;0 +++ /dev/null @@ -1,4 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "length" : 1, - "typeName" : "B.uint8" -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.NostalgiaGraphic;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.NostalgiaGraphic;1 deleted file mode 100644 index 2684c4f..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.NostalgiaGraphic;1 +++ /dev/null @@ -1,39 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "bpp", - "typeId" : "B.int8;0" - }, - { - "fieldName" : "rows", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "columns", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "defaultPalette", - "typeId" : "net.drinkingtea.ox.FileAddress;1" - }, - { - "fieldName" : "pal", - "typeId" : "net.drinkingtea.nostalgia.core.Palette;1" - }, - { - "fieldName" : "pixels", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint8;0" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.NostalgiaGraphic", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette.ColorInfo;3 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette.ColorInfo;3 deleted file mode 100644 index a149b43..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette.ColorInfo;3 +++ /dev/null @@ -1,12 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "name", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.Palette.ColorInfo", - "typeVersion" : 3 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette.PalettePage;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette.PalettePage;1 deleted file mode 100644 index 0135632..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette.PalettePage;1 +++ /dev/null @@ -1,23 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "name", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "colors", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.core.PaletteColor;1" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.Palette.PalettePage", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;1 deleted file mode 100644 index 5bcee5a..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;1 +++ /dev/null @@ -1,19 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "colors", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint16;0" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.Palette", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;2 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;2 deleted file mode 100644 index 93fbc82..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;2 +++ /dev/null @@ -1,23 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "pages", - "subscriptLevels" : 2, - "subscriptStack" : - [ - { - "subscriptType" : 4 - }, - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint16;0" - } - ], - "preloadable" : true, - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.Palette", - "typeVersion" : 2 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;3 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;3 deleted file mode 100644 index 3438dc0..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;3 +++ /dev/null @@ -1,34 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "colorInfo", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.core.Palette.ColorInfo;3" - }, - { - "fieldName" : "pages", - "subscriptLevels" : 2, - "subscriptStack" : - [ - { - "subscriptType" : 4 - }, - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint16;0" - } - ], - "preloadable" : true, - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.Palette", - "typeVersion" : 3 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;4 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;4 deleted file mode 100644 index 668216e..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.Palette;4 +++ /dev/null @@ -1,31 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "colorNames", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "pages", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.core.Palette.PalettePage;1" - } - ], - "preloadable" : true, - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.Palette", - "typeVersion" : 4 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.PaletteColor;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.PaletteColor;1 deleted file mode 100644 index d9d6aac..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.PaletteColor;1 +++ /dev/null @@ -1,24 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "r", - "typeId" : "B.uint8;0" - }, - { - "fieldName" : "g", - "typeId" : "B.uint8;0" - }, - { - "fieldName" : "b", - "typeId" : "B.uint8;0" - }, - { - "fieldName" : "a", - "typeId" : "B.uint8;0" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.PaletteColor", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet.SubSheet;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet.SubSheet;1 deleted file mode 100644 index b32cb2b..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet.SubSheet;1 +++ /dev/null @@ -1,42 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "name", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "rows", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "columns", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "subsheets", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;1" - }, - { - "fieldName" : "pixels", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint8;0" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet.SubSheet;3 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet.SubSheet;3 deleted file mode 100644 index 26bf5d6..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet.SubSheet;3 +++ /dev/null @@ -1,42 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "name", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "rows", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "columns", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "subsheets", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;3" - }, - { - "fieldName" : "pixels", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint8;0" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet", - "typeVersion" : 3 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet.SubSheet;4 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet.SubSheet;4 deleted file mode 100644 index 78d1d7b..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet.SubSheet;4 +++ /dev/null @@ -1,46 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "id", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "name", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "rows", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "columns", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "subsheets", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;4" - }, - { - "fieldName" : "pixels", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint8;0" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet", - "typeVersion" : 4 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;2 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;2 deleted file mode 100644 index 4d55e8e..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;2 +++ /dev/null @@ -1,20 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "bpp", - "typeId" : "B.int8;0" - }, - { - "fieldName" : "defaultPalette", - "typeId" : "net.drinkingtea.ox.FileAddress;1" - }, - { - "fieldName" : "subsheet", - "typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;1" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.TileSheet", - "typeVersion" : 2 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;3 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;3 deleted file mode 100644 index 75c7523..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;3 +++ /dev/null @@ -1,24 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "bpp", - "typeId" : "B.int8;0" - }, - { - "fieldName" : "idIt", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "defaultPalette", - "typeId" : "net.drinkingtea.ox.FileAddress;1" - }, - { - "fieldName" : "subsheet", - "typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;3" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.TileSheet", - "typeVersion" : 3 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;4 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;4 deleted file mode 100644 index 4acb515..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.core.TileSheet;4 +++ /dev/null @@ -1,24 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "bpp", - "typeId" : "B.int8;0" - }, - { - "fieldName" : "idIt", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "defaultPalette", - "typeId" : "net.drinkingtea.ox.FileAddress;1" - }, - { - "fieldName" : "subsheet", - "typeId" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet;4" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.core.TileSheet", - "typeVersion" : 4 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactPalette;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactPalette;1 deleted file mode 100644 index ef34e1e..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactPalette;1 +++ /dev/null @@ -1,23 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "pages", - "subscriptLevels" : 2, - "subscriptStack" : - [ - { - "subscriptType" : 4 - }, - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint16;0" - } - ], - "preloadable" : true, - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.gfx.CompactPalette", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactTileSheet;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactTileSheet;1 deleted file mode 100644 index 277efdd..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.CompactTileSheet;1 +++ /dev/null @@ -1,28 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "bpp", - "typeId" : "B.int8;0" - }, - { - "fieldName" : "defaultPalette", - "typeId" : "net.drinkingtea.ox.FileAddress;1" - }, - { - "fieldName" : "pixels", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint8;0" - } - ], - "preloadable" : true, - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.gfx.CompactTileSheet", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette.PalettePage;2 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette.PalettePage;2 deleted file mode 100644 index 5b26ee3..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette.PalettePage;2 +++ /dev/null @@ -1,23 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "name", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "colors", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.gfx.PaletteColor;2" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.gfx.Palette.PalettePage", - "typeVersion" : 2 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette;5 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette;5 deleted file mode 100644 index 797c7ce..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.Palette;5 +++ /dev/null @@ -1,31 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "colorNames", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "pages", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.gfx.Palette.PalettePage;2" - } - ], - "preloadable" : true, - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.gfx.Palette", - "typeVersion" : 5 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.PaletteColor;2 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.PaletteColor;2 deleted file mode 100644 index 24ca751..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.PaletteColor;2 +++ /dev/null @@ -1,24 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "r", - "typeId" : "B.uint8;0" - }, - { - "fieldName" : "g", - "typeId" : "B.uint8;0" - }, - { - "fieldName" : "b", - "typeId" : "B.uint8;0" - }, - { - "fieldName" : "a", - "typeId" : "B.uint8;0" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.gfx.PaletteColor", - "typeVersion" : 2 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5 deleted file mode 100644 index 03740cf..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5 +++ /dev/null @@ -1,46 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "id", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "name", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "rows", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "columns", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "subsheets", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5" - }, - { - "fieldName" : "pixels", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint8;0" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet", - "typeVersion" : 5 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet;5 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet;5 deleted file mode 100644 index a789389..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.gfx.TileSheet;5 +++ /dev/null @@ -1,24 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "bpp", - "typeId" : "B.int8;0" - }, - { - "fieldName" : "idIt", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "defaultPalette", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "subsheet", - "typeId" : "net.drinkingtea.nostalgia.gfx.TileSheet.SubSheet;5" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.gfx.TileSheet", - "typeVersion" : 5 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneDoc;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneDoc;1 deleted file mode 100644 index f1fa0e3..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneDoc;1 +++ /dev/null @@ -1,41 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "tilesheet", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "palettes", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "tiles", - "subscriptLevels" : 3, - "subscriptStack" : - [ - { - "subscriptType" : 4 - }, - { - "subscriptType" : 4 - }, - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.nostalgia.scene.TileDoc;1" - } - ], - "preloadable" : true, - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.scene.SceneDoc", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneStatic;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneStatic;1 deleted file mode 100644 index 0927645..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.SceneStatic;1 +++ /dev/null @@ -1,88 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "tilesheet", - "typeId" : "net.drinkingtea.ox.FileAddress;1" - }, - { - "fieldName" : "palettes", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "net.drinkingtea.ox.FileAddress;1" - }, - { - "fieldName" : "columns", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint16;0" - }, - { - "fieldName" : "rows", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint16;0" - }, - { - "fieldName" : "tileMapIdx", - "subscriptLevels" : 2, - "subscriptStack" : - [ - { - "subscriptType" : 4 - }, - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint16;0" - }, - { - "fieldName" : "tileType", - "subscriptLevels" : 2, - "subscriptStack" : - [ - { - "subscriptType" : 4 - }, - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint8;0" - }, - { - "fieldName" : "layerAttachments", - "subscriptLevels" : 2, - "subscriptStack" : - [ - { - "subscriptType" : 4 - }, - { - "subscriptType" : 4 - } - ], - "typeId" : "B.uint8;0" - } - ], - "preloadable" : true, - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.scene.SceneStatic", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.TileDoc;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.TileDoc;1 deleted file mode 100644 index 5a7fa3d..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.nostalgia.scene.TileDoc;1 +++ /dev/null @@ -1,33 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "subsheet_id", - "typeId" : "B.int32;0" - }, - { - "fieldName" : "subsheet_path", - "typeId" : "net.drinkingtea.ox.BasicString#8#;1" - }, - { - "fieldName" : "type", - "typeId" : "B.uint8;0" - }, - { - "fieldName" : "layer_attachments", - "subscriptLevels" : 1, - "subscriptStack" : - [ - { - "length" : 4, - "subscriptType" : 3 - } - ], - "typeId" : "B.uint8;0" - } - ], - "preloadable" : true, - "primitiveType" : 5, - "typeName" : "net.drinkingtea.nostalgia.scene.TileDoc", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.BasicString#8#;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.BasicString#8#;1 deleted file mode 100644 index e267752..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.BasicString#8#;1 +++ /dev/null @@ -1,9 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "primitiveType" : 4, - "typeName" : "net.drinkingtea.ox.BasicString", - "typeParams" : - [ - "8" - ], - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress.Data;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress.Data;1 deleted file mode 100644 index 32e1824..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress.Data;1 +++ /dev/null @@ -1,20 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "path", - "typeId" : "B.string" - }, - { - "fieldName" : "constPath", - "typeId" : "B.string" - }, - { - "fieldName" : "inode", - "typeId" : "B.uint64;0" - } - ], - "primitiveType" : 6, - "typeName" : "net.drinkingtea.ox.FileAddress.Data", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress;1 b/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress;1 deleted file mode 100644 index e30b37b..0000000 --- a/deps/nostalgia/project/.nostalgia/type_descriptors/net.drinkingtea.ox.FileAddress;1 +++ /dev/null @@ -1,16 +0,0 @@ -O1;net.drinkingtea.ox.TypeDescriptor;1;{ - "fieldList" : - [ - { - "fieldName" : "type", - "typeId" : "B.int8;0" - }, - { - "fieldName" : "data", - "typeId" : "net.drinkingtea.ox.FileAddress.Data" - } - ], - "primitiveType" : 5, - "typeName" : "net.drinkingtea.ox.FileAddress", - "typeVersion" : 1 -} \ No newline at end of file diff --git a/deps/nostalgia/release-notes.md b/deps/nostalgia/release-notes.md index aff723e..0312e2f 100644 --- a/deps/nostalgia/release-notes.md +++ b/deps/nostalgia/release-notes.md @@ -1,14 +1,24 @@ +# d2025.06.0 + +* PaletteEditor: Add RGB key shortcuts for focusing color channels + # d2025.05.0 * Add app icon for both window and file +* Change application font to Roboto Medium * Closing application will now confirm with user if any files have unsaved changes. -* Fix selection clearing in TileSheet editor to work when clicking outside - image. -* Fix color number key range in PalettEditor. Previously, pressing A caused the +* UUID duplicates will now be reported when opening a project. +* Deleting a directory now closes files in that directory. +* Delete key now initiates deletion of selected directory. +* Remove ability to re-order tabs. There were bugs associated with that. +* Mac: Menu bar shortcuts now say Cmd instead of Ctrl. +* TileSheetEditor: Fix selection clearing to work when clicking outside image. +* TileSheetEditor: Fix Delete Tile functionality, which was completely broken +* TileSheetEditor: Fix Insert Tile functionality, which was completely broken +* PaletteEditor: Fix color number key range. Previously, pressing A caused the editor to jump to the last color. -* UUID duplicates will now be reported when opening a project -* PalettEditor: page rename will now take effect upon pressing enter if the +* PaletteEditor: Page rename will now take effect upon pressing enter if the text input has focus # d2025.02.1 diff --git a/deps/nostalgia/sample_project/Scenes/Chester.nscn b/deps/nostalgia/sample_project/Scenes/Chester.nscn deleted file mode 100644 index be7f542..0000000 Binary files a/deps/nostalgia/sample_project/Scenes/Chester.nscn and /dev/null differ diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp index 2850bb8..3736d23 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/include/nostalgia/gfx/gfx.hpp @@ -223,7 +223,7 @@ bool bgStatus(Context &ctx, unsigned bg) noexcept; void setBgStatus(Context &ctx, unsigned bg, bool status) noexcept; -void setBgCbb(Context &ctx, unsigned bgIdx, unsigned cbb) noexcept; +void setBgCbb(Context &ctx, unsigned bgIdx, unsigned cbbIdx) noexcept; void setBgPriority(Context &ctx, uint_t bgIdx, uint_t priority) noexcept; @@ -231,10 +231,10 @@ void hideSprite(Context &ctx, unsigned) noexcept; void showSprite(Context &ctx, unsigned) noexcept; -void setSprite(Context &c, uint_t idx, Sprite const&s) noexcept; +void setSprite(Context &ctx, uint_t idx, Sprite const&sprite) noexcept; [[nodiscard]] -uint_t spriteCount(Context &ctx) noexcept; +uint_t spriteCount(Context const &ctx) noexcept; ox::Error initConsole(Context &ctx) noexcept; diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/gba/context.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/gba/context.cpp index fd9c110..d3a358d 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/gba/context.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/gba/context.cpp @@ -22,7 +22,7 @@ ox::Error initGfx(Context &ctx, InitParams const&) noexcept; ox::Result> init(turbine::Context &tctx, InitParams const¶ms) noexcept { auto ctx = ox::make_unique(tctx); OX_RETURN_ERROR(initGfx(*ctx, params)); - return ox::UPtr(std::move(ctx)); + return ctx; } keel::Context &keelCtx(Context &ctx) noexcept { diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/gba/gfx.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/gba/gfx.cpp index 65b9ca7..e9f33f9 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/gba/gfx.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/gba/gfx.cpp @@ -36,9 +36,9 @@ ox::Error initGfx(Context&, InitParams const&) noexcept { ox::Error loadBgPalette( Context&, - size_t palBank, + size_t const palBank, CompactPalette const&palette, - size_t page) noexcept { + size_t const page) noexcept { if (palette.pages.empty()) { return {}; } @@ -52,7 +52,7 @@ ox::Error loadBgPalette( ox::Error loadSpritePalette( Context&, CompactPalette const&palette, - size_t page) noexcept { + size_t const page) noexcept { if (palette.pages.empty()) { return {}; } @@ -133,7 +133,7 @@ ox::Error loadBgTileSheet( ox::Error loadBgTileSheet( Context &ctx, - unsigned cbb, + unsigned const cbb, CompactTileSheet const&ts, ox::Optional const&paletteBank) noexcept { auto const cnt = (ts.pixels.size() * PixelsPerTile) / (1 + (ts.bpp == 4)); @@ -184,7 +184,7 @@ static void setSpritesBpp(unsigned const bpp) noexcept { ox::Error loadSpriteTileSheet( Context &ctx, CompactTileSheet const&ts, - bool loadDefaultPalette) noexcept { + bool const loadDefaultPalette) noexcept { for (size_t i = 0; i < ts.pixels.size(); i += 2) { uint16_t v = ts.pixels[i]; v |= static_cast(ts.pixels[i + 1] << 8); @@ -206,7 +206,8 @@ ox::Error loadSpriteTileSheet( return {}; } -void setBgTile(Context &ctx, uint_t bgIdx, int column, int row, BgTile const&tile) noexcept { +void setBgTile( + Context &ctx, uint_t const bgIdx, int const column, int const row, BgTile const&tile) noexcept { auto const tileIdx = static_cast(row * tileColumns(ctx) + column); // see Tonc 9.3 MEM_BG_MAP[bgIdx][tileIdx] = @@ -216,7 +217,7 @@ void setBgTile(Context &ctx, uint_t bgIdx, int column, int row, BgTile const&til static_cast(tile.palBank << 0xc); } -void clearBg(Context &ctx, uint_t bgIdx) noexcept { +void clearBg(Context &ctx, uint_t const bgIdx) noexcept { memset(MEM_BG_MAP[bgIdx].data(), 0, static_cast(tileRows(ctx) * tileColumns(ctx))); } @@ -224,39 +225,39 @@ uint8_t bgStatus(Context&) noexcept { return (REG_DISPCTL >> 8u) & 0b1111u; } -void setBgStatus(Context&, uint32_t status) noexcept { +void setBgStatus(Context&, uint32_t const status) noexcept { constexpr auto BgStatus = 8; REG_DISPCTL = (REG_DISPCTL & ~0b111100000000u) | status << BgStatus; } -bool bgStatus(Context&, unsigned bg) noexcept { +bool bgStatus(Context&, unsigned const bg) noexcept { return (REG_DISPCTL >> (8 + bg)) & 1; } -void setBgStatus(Context&, unsigned bg, bool status) noexcept { +void setBgStatus(Context&, unsigned const bg, bool const status) noexcept { constexpr auto Bg0Status = 8; const auto mask = static_cast(status) << (Bg0Status + bg); REG_DISPCTL = REG_DISPCTL | ((REG_DISPCTL & ~mask) | mask); } -void setBgBpp(Context&, unsigned bgIdx, unsigned bpp) noexcept { +void setBgBpp(Context&, unsigned const bgIdx, unsigned const bpp) noexcept { auto &bgCtl = regBgCtl(bgIdx); teagba::bgSetBpp(bgCtl, bpp); } -void setBgCbb(Context &ctx, unsigned bgIdx, unsigned cbb) noexcept { +void setBgCbb(Context &ctx, unsigned const bgIdx, unsigned const cbbIdx) noexcept { auto &bgCtl = regBgCtl(bgIdx); - const auto &cbbData = ctx.cbbData[cbb]; + const auto &cbbData = ctx.cbbData[cbbIdx]; teagba::bgSetBpp(bgCtl, cbbData.bpp); - teagba::bgSetCbb(bgCtl, cbb); + teagba::bgSetCbb(bgCtl, cbbIdx); } -void setBgPriority(Context&, uint_t bgIdx, uint_t priority) noexcept { +void setBgPriority(Context&, uint_t const bgIdx, uint_t const priority) noexcept { auto &bgCtl = regBgCtl(bgIdx); bgCtl = (bgCtl & 0b1111'1111'1111'1100u) | (priority & 0b11); } -void hideSprite(Context&, unsigned idx) noexcept { +void hideSprite(Context&, unsigned const idx) noexcept { //oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow"); teagba::addSpriteUpdate({ .attr0 = uint16_t{0b11 << 8}, @@ -264,7 +265,7 @@ void hideSprite(Context&, unsigned idx) noexcept { }); } -void showSprite(Context&, unsigned idx) noexcept { +void showSprite(Context&, unsigned const idx) noexcept { //oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow"); teagba::addSpriteUpdate({ .attr0 = 0, @@ -272,7 +273,7 @@ void showSprite(Context&, unsigned idx) noexcept { }); } -void setSprite(Context&, uint_t idx, Sprite const&s) noexcept { +void setSprite(Context&, uint_t const idx, Sprite const&s) noexcept { //oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow"); uint16_t const eightBpp = s.bpp == 8; teagba::addSpriteUpdate({ @@ -293,7 +294,7 @@ void setSprite(Context&, uint_t idx, Sprite const&s) noexcept { }); } -uint_t spriteCount(Context&) noexcept { +uint_t spriteCount(Context const&) noexcept { return SpriteCount; } diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/opengl/context.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/opengl/context.cpp index 7c6e2da..3bb6486 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/opengl/context.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/opengl/context.cpp @@ -26,7 +26,7 @@ Context::~Context() noexcept { ox::Result> init(turbine::Context &tctx, InitParams const¶ms) noexcept { auto ctx = ox::make_unique(tctx, params); OX_RETURN_ERROR(initGfx(*ctx, params)); - return ox::UPtr(ctx.release()); + return ctx; } keel::Context &keelCtx(Context &ctx) noexcept { diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/opengl/gfx.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/opengl/gfx.cpp index e6e26d4..efbe686 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/opengl/gfx.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/opengl/gfx.cpp @@ -28,7 +28,7 @@ static constexpr auto PriorityScale = 0.01f; Drawer::Drawer(Context &ctx) noexcept: m_ctx(ctx) {} void Drawer::draw(turbine::Context &tctx) noexcept { - gfx::gl::draw(m_ctx, turbine::getScreenSize(tctx)); + gl::draw(m_ctx, turbine::getScreenSize(tctx)); } static constexpr ox::CStringView bgvshadTmpl = R"glsl( @@ -106,7 +106,7 @@ static constexpr ox::CStringView spritefshadTmpl = R"glsl( })glsl"; [[nodiscard]] -static constexpr auto bgVertexRow(uint_t x, uint_t y) noexcept { +static constexpr auto bgVertexRow(uint_t const x, uint_t const y) noexcept { return y * TileRows + x; } @@ -183,7 +183,7 @@ static void setTileBufferObject( ox::spancpy(ebo, elms); } -static void initSpriteBufferObjects(Context &ctx, glutils::BufferSet &bs) noexcept { +static void initSpriteBufferObjects(Context const &ctx, glutils::BufferSet &bs) noexcept { for (auto i = 0u; i < ctx.spriteCount; ++i) { auto const vbo = ox::Span{bs.vertices} + i * static_cast(SpriteVertexVboLength); @@ -256,7 +256,7 @@ static void initSpritesBufferset(Context &ctx) noexcept { } static void initBackgroundBufferset( - GLuint shader, + GLuint const shader, glutils::BufferSet &bs) noexcept { // vao bs.vao = glutils::generateVertexArrayObject(); @@ -290,8 +290,8 @@ static void initBackgroundBufferset( } static glutils::GLTexture createTexture( - GLsizei w, - GLsizei h, + GLsizei const w, + GLsizei const h, void const*pixels) noexcept { GLuint texId = 0; glGenTextures(1, &texId); @@ -375,10 +375,10 @@ static void drawSprites(Context &ctx, ox::Size const&renderSz) noexcept { static void loadPalette( ox::Array &palette, - size_t palOffset, - GLuint shaderPgrm, + size_t const palOffset, + GLuint const shaderPgrm, CompactPalette const&pal, - size_t page = 0) noexcept { + size_t const page = 0) noexcept { static constexpr std::size_t ColorCnt = 256; for (auto i = palOffset; auto const c : pal.pages[page]) { palette[i++] = redf(c); @@ -523,14 +523,18 @@ static ox::Result normalizeTileSheet( pixels[i * 2 + 1] = ts.pixels[i] >> 4; } } - return TileSheetData{std::move(pixels), width, height}; + return TileSheetData{ + .pixels = std::move(pixels), + .width = width, + .height = height + }; } ox::Error loadBgPalette( Context &ctx, - size_t palBank, + size_t const palBank, CompactPalette const&palette, - size_t page) noexcept { + size_t const page) noexcept { renderer::loadPalette(ctx.bgPalette, palBank * 16 * 4, ctx.bgShader, palette, page); return {}; } @@ -538,14 +542,14 @@ ox::Error loadBgPalette( ox::Error loadSpritePalette( Context &ctx, CompactPalette const&palette, - size_t page) noexcept { + size_t const page) noexcept { ox::Array pal; renderer::loadPalette(pal, 0, ctx.spriteShader, palette, page); return {}; } static ox::Result buildSetTsd( - Context &ctx, + Context const &ctx, TileSheetSet const&set) noexcept { auto &kctx = keelCtx(ctx.turbineCtx); TileSheetData setTsd; @@ -567,7 +571,7 @@ static ox::Result buildSetTsd( static void copyPixels( CompactTileSheet const&ts, - ox::Span dst, + ox::Span const dst, size_t const srcPxIdx, size_t const pxlCnt) noexcept { size_t idx{}; @@ -624,7 +628,7 @@ ox::Error loadBgTileSheet( ox::Error loadBgTileSheet( Context &ctx, - uint_t cbb, + uint_t const cbb, CompactTileSheet const&ts, ox::Optional const&paletteBank) noexcept { auto const bytesPerTile = static_cast(PixelsPerTile / (1 + (ts.bpp == 4))); @@ -638,7 +642,7 @@ ox::Error loadBgTileSheet( ox::Error loadBgTileSheet( Context &ctx, - unsigned cbb, + unsigned const cbb, TileSheetSet const&set) noexcept { OX_REQUIRE(setTsd, buildSetTsd(ctx, set)); ctx.cbbs[cbb].tex = renderer::createTexture(setTsd.width, setTsd.height, setTsd.pixels.data()); @@ -648,7 +652,7 @@ ox::Error loadBgTileSheet( ox::Error loadSpriteTileSheet( Context &ctx, CompactTileSheet const&ts, - bool loadDefaultPalette) noexcept { + bool const loadDefaultPalette) noexcept { OX_REQUIRE(tsd, normalizeTileSheet(ts)); oxTracef("nostalgia.gfx.gl", "loadSpriteTexture: { w: {}, h: {} }", tsd.width, tsd.height); ctx.spriteBlocks.tex = renderer::createTexture(tsd.width, tsd.height, tsd.pixels.data()); @@ -668,9 +672,9 @@ ox::Error loadSpriteTileSheet( void setBgTile( Context &ctx, - uint_t bgIdx, - int column, - int row, + uint_t const bgIdx, + int const column, + int const row, BgTile const&tile) noexcept { oxTracef( "nostalgia.gfx.setBgTile", @@ -698,7 +702,7 @@ void setBgTile( cbb.updated = true; } -void clearBg(Context &ctx, uint_t bgIdx) noexcept { +void clearBg(Context &ctx, uint_t const bgIdx) noexcept { auto &cbb = ctx.cbbs[static_cast(bgIdx)]; initBackgroundBufferObjects(cbb); cbb.updated = true; @@ -714,61 +718,59 @@ uint8_t bgStatus(Context &ctx) noexcept { return out; } -void setBgStatus(Context &ctx, uint32_t status) noexcept { +void setBgStatus(Context &ctx, uint32_t const status) noexcept { for (uint_t i = 0; i < ctx.cbbs.size(); ++i) { ctx.backgrounds[i].enabled = (status >> i) & 1; } } -bool bgStatus(Context &ctx, uint_t bg) noexcept { +bool bgStatus(Context &ctx, uint_t const bg) noexcept { return ctx.backgrounds[bg].enabled; } -void setBgStatus(Context&ctx, uint_t bg, bool status) noexcept { +void setBgStatus(Context&ctx, uint_t const bg, bool const status) noexcept { ctx.backgrounds[bg].enabled = status; } -void setBgBpp(Context&, unsigned, unsigned) noexcept {} - -void setBgCbb(Context &ctx, uint_t bgIdx, uint_t cbbIdx) noexcept { +void setBgCbb(Context &ctx, uint_t const bgIdx, uint_t const cbbIdx) noexcept { auto &bg = ctx.backgrounds[bgIdx]; bg.cbbIdx = cbbIdx; } -void setBgPriority(Context &ctx, uint_t bgIdx, uint_t priority) noexcept { +void setBgPriority(Context &ctx, uint_t const bgIdx, uint_t const priority) noexcept { auto &bg = ctx.backgrounds[bgIdx]; bg.priority = static_cast(priority & 0b11); } -void hideSprite(Context &ctx, uint_t idx) noexcept { +void hideSprite(Context &ctx, uint_t const idx) noexcept { auto &s = ctx.spriteStates[idx]; s.enabled = false; renderer::setSprite(ctx, idx, s); } -void showSprite(Context &ctx, uint_t idx) noexcept { +void showSprite(Context &ctx, uint_t const idx) noexcept { auto &s = ctx.spriteStates[idx]; s.enabled = true; renderer::setSprite(ctx, idx, s); } -void setSprite(Context &ctx, uint_t idx, Sprite const&sprite) noexcept { +void setSprite(Context &ctx, uint_t const idx, Sprite const&sprite) noexcept { auto &s = ctx.spriteStates[idx]; s = sprite; renderer::setSprite(ctx, idx, s); } -uint_t spriteCount(Context &ctx) noexcept { +uint_t spriteCount(Context const &ctx) noexcept { return ctx.spriteCount; } namespace gl { -ox::Size drawSize(int scale) noexcept { +ox::Size drawSize(int const scale) noexcept { return {240 * scale, 160 * scale}; } -void draw(gfx::Context &ctx, ox::Size const&renderSz) noexcept { +void draw(Context &ctx, ox::Size const&renderSz) noexcept { glViewport(0, 0, renderSz.width, renderSz.height); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); @@ -783,7 +785,7 @@ void draw(gfx::Context &ctx, ox::Size const&renderSz) noexcept { glDisable(GL_BLEND); } -void draw(gfx::Context &ctx, int scale) noexcept { +void draw(Context &ctx, int const scale) noexcept { draw(ctx, drawSize(scale)); } diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp index 756c747..8b2847f 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -118,12 +118,12 @@ void PaletteEditorImGui::navigateTo(ox::StringViewCR arg) noexcept { } } -void PaletteEditorImGui::drawColumnLeftAlign(ox::CStringView txt) noexcept { +void PaletteEditorImGui::drawColumnLeftAlign(ox::CStringViewCR txt) noexcept { ImGui::TableNextColumn(); ImGui::Text("%s", txt.c_str()); } -void PaletteEditorImGui::drawColumn(ox::CStringView txt) noexcept { +void PaletteEditorImGui::drawColumn(ox::CStringViewCR txt) noexcept { ImGui::TableNextColumn(); ImGui::SetCursorPosX( ImGui::GetCursorPosX() + ImGui::GetColumnWidth() - ImGui::CalcTextSize(txt.data()).x); @@ -143,7 +143,15 @@ void PaletteEditorImGui::numShortcuts(size_t &val, size_t const sizeRange) noexc } } -void PaletteEditorImGui::colorInput(ox::CStringView label, int &v, bool &inputFocused) noexcept { +void PaletteEditorImGui::colorInput( + ox::CStringViewCR label, + int &v, + bool &inputFocused, + FocusCmd const colorChannel) noexcept { + if (colorChannel == m_focusCmd) [[unlikely]] { + ImGui::SetKeyboardFocusHere(); + m_focusCmd = FocusCmd::None; + } ImGui::InputInt(label.c_str(), &v, 1, 5); inputFocused = inputFocused || ImGui::IsItemFocused(); v = ox::max(v, 0); @@ -296,9 +304,9 @@ void PaletteEditorImGui::drawColorEditor() noexcept { "Name", m_pal.colorNames[m_selectedColorRow]); bool inputFocused = ImGui::IsItemFocused(); ImGui::Separator(); - colorInput("Red", r, inputFocused); - colorInput("Green", g, inputFocused); - colorInput("Blue", b, inputFocused); + colorInput("Red", r, inputFocused, FocusCmd::Red); + colorInput("Green", g, inputFocused, FocusCmd::Green); + colorInput("Blue", b, inputFocused, FocusCmd::Blue); if (ig::PushButton("Apply to all pages", {-1, ig::BtnSz.y})) { std::ignore = pushCommand( m_pal, m_page, m_selectedColorRow); @@ -309,6 +317,15 @@ void PaletteEditorImGui::drawColorEditor() noexcept { } else { numShortcuts(m_page, m_pal.pages.size()); } + if (ImGui::IsKeyDown(ImGuiKey_R)) { + m_focusCmd = FocusCmd::Red; + } + if (ImGui::IsKeyDown(ImGuiKey_G)) { + m_focusCmd = FocusCmd::Green; + } + if (ImGui::IsKeyDown(ImGuiKey_B)) { + m_focusCmd = FocusCmd::Blue; + } } auto const newColor = color16(r, g, b, a); if (c != newColor) { @@ -320,7 +337,7 @@ void PaletteEditorImGui::drawColorEditor() noexcept { } } -ox::Error PaletteEditorImGui::renamePage(ox::StringView name) noexcept { +ox::Error PaletteEditorImGui::renamePage(ox::StringViewCR name) noexcept { return pushCommand(m_pal, m_page, name); } diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp index 5fed246..cba95ff 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/paletteeditor/paletteeditor-imgui.hpp @@ -36,6 +36,13 @@ class PaletteEditorImGui: public studio::Editor { Palette m_pal; size_t m_selectedColorRow = 0; size_t m_page = 0; + enum class FocusCmd { + None, + Red, + Green, + Blue, + }; + FocusCmd m_focusCmd; public: PaletteEditorImGui(studio::Context &sctx, ox::StringParam path); @@ -48,9 +55,9 @@ class PaletteEditorImGui: public studio::Editor { void navigateTo(ox::StringViewCR arg) noexcept override; private: - static void drawColumnLeftAlign(ox::CStringView txt) noexcept; + static void drawColumnLeftAlign(ox::CStringViewCR txt) noexcept; - static void drawColumn(ox::CStringView txt) noexcept; + static void drawColumn(ox::CStringViewCR txt) noexcept; static void drawColumn(ox::Integer_c auto i) noexcept { drawColumn(ox::intToStr(i)); @@ -58,7 +65,7 @@ class PaletteEditorImGui: public studio::Editor { static void numShortcuts(size_t &val, size_t sizeRange) noexcept; - static void colorInput(ox::CStringView label, int &v, bool &inputFocused) noexcept; + void colorInput(ox::CStringViewCR label, int &v, bool &inputFocused, FocusCmd colorChannel) noexcept; void drawColorsEditor() noexcept; @@ -66,7 +73,7 @@ class PaletteEditorImGui: public studio::Editor { void drawColorEditor() noexcept; - ox::Error renamePage(ox::StringView name) noexcept; + ox::Error renamePage(ox::StringViewCR name) noexcept; ox::Error handleCommand(studio::UndoCommand const*) noexcept; }; diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp index e7cf50a..9940b18 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/deletetilescommand.cpp @@ -8,14 +8,14 @@ namespace nostalgia::gfx { -gfx::DeleteTilesCommand::DeleteTilesCommand( +DeleteTilesCommand::DeleteTilesCommand( TileSheet &img, TileSheet::SubSheetIdx idx, - std::size_t tileIdx, - std::size_t tileCnt) noexcept: + std::size_t const tileIdx, + std::size_t const tileCnt) noexcept: m_img(img), m_idx(std::move(idx)) { - const unsigned bytesPerTile = m_img.bpp == 4 ? PixelsPerTile / 2 : PixelsPerTile; + constexpr unsigned bytesPerTile = PixelsPerTile; m_deletePos = tileIdx * bytesPerTile; m_deleteSz = tileCnt * bytesPerTile; m_deletedPixels.resize(m_deleteSz); @@ -28,16 +28,20 @@ gfx::DeleteTilesCommand::DeleteTilesCommand( } } -ox::Error gfx::DeleteTilesCommand::redo() noexcept { +ox::Error DeleteTilesCommand::redo() noexcept { auto &s = getSubSheet(m_img, m_idx); auto &p = s.pixels; - auto srcPos = m_deletePos + m_deleteSz; - auto const src = &p[srcPos]; + auto const srcPos = m_deletePos + m_deleteSz; auto const dst1 = &p[m_deletePos]; auto const dst2 = &p[(p.size() - m_deleteSz)]; OX_ALLOW_UNSAFE_BUFFERS_BEGIN - ox::memmove(dst1, src, p.size() - srcPos); - ox::memset(dst2, 0, m_deleteSz * sizeof(decltype(p[0]))); + if (srcPos < p.size()) { + auto const src = &p[srcPos]; + ox::memmove(dst1, src, p.size() - srcPos); + ox::memset(dst2, 0, m_deleteSz * sizeof(decltype(p[0]))); + } else { + ox::memset(dst1, 0, p.size() - m_deletePos); + } OX_ALLOW_UNSAFE_BUFFERS_END return {}; } @@ -46,11 +50,14 @@ ox::Error DeleteTilesCommand::undo() noexcept { auto &s = getSubSheet(m_img, m_idx); auto &p = s.pixels; auto const src = &p[m_deletePos]; - auto const dst1 = &p[m_deletePos + m_deleteSz]; - auto const dst2 = src; auto const sz = p.size() - m_deletePos - m_deleteSz; + auto const srcPos = m_deletePos + m_deleteSz; OX_ALLOW_UNSAFE_BUFFERS_BEGIN - ox::memmove(dst1, src, sz); + if (srcPos < p.size()) { + auto const dst1 = &p[m_deletePos + m_deleteSz]; + ox::memmove(dst1, src, sz); + } + auto const dst2 = src; ox::memcpy(dst2, m_deletedPixels.data(), m_deletedPixels.size()); OX_ALLOW_UNSAFE_BUFFERS_END return {}; diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp index 9b86187..7bc7fd0 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/inserttilescommand.cpp @@ -9,20 +9,19 @@ namespace nostalgia::gfx { InsertTilesCommand::InsertTilesCommand( TileSheet &img, TileSheet::SubSheetIdx idx, - std::size_t tileIdx, - std::size_t tileCnt) noexcept: - m_img(img), - m_idx(std::move(idx)) { - const unsigned bytesPerTile = m_img.bpp == 4 ? PixelsPerTile / 2 : PixelsPerTile; - m_insertPos = tileIdx * bytesPerTile; - m_insertCnt = tileCnt * bytesPerTile; + std::size_t const tileIdx, + std::size_t const tileCnt) noexcept: + m_img{img}, + m_idx{std::move(idx)} { + m_insertPos = tileIdx * PixelsPerTile; + m_insertCnt = tileCnt * PixelsPerTile; m_deletedPixels.resize(m_insertCnt); // copy pixels to be erased { auto &s = getSubSheet(m_img, m_idx); auto &p = s.pixels; - auto dst = m_deletedPixels.begin(); - auto src = p.begin() + p.size() - m_insertCnt; + auto const dst = m_deletedPixels.begin(); + auto const src = p.begin() + p.size() - m_insertCnt; ox::copy_n(src, m_insertCnt, dst); } } @@ -32,7 +31,7 @@ OX_ALLOW_UNSAFE_BUFFERS_BEGIN ox::Error InsertTilesCommand::redo() noexcept { auto &s = getSubSheet(m_img, m_idx); auto &p = s.pixels; - auto dstPos = m_insertPos + m_insertCnt; + auto const dstPos = m_insertPos + m_insertCnt; auto const src = &p[m_insertPos]; if (dstPos < p.size()) { auto const dst = &p[dstPos]; diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp index d8a6d2d..2da6338 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/palettechangecommand.cpp @@ -6,14 +6,14 @@ namespace nostalgia::gfx { -gfx::PaletteChangeCommand::PaletteChangeCommand( +PaletteChangeCommand::PaletteChangeCommand( TileSheet::SubSheetIdx idx, TileSheet &img, ox::StringViewCR newPalette) noexcept: - m_img(img), - m_idx(std::move(idx)), - m_oldPalette(m_img.defaultPalette), - m_newPalette(ox::sfmt>("uuid://{}", newPalette)) { + m_img{img}, + m_idx{std::move(idx)}, + m_oldPalette{m_img.defaultPalette}, + m_newPalette{ox::sfmt>("uuid://{}", newPalette)} { } ox::Error PaletteChangeCommand::redo() noexcept { diff --git a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp index 03df825..9d084e3 100644 --- a/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp +++ b/deps/nostalgia/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/updatesubsheetcommand.cpp @@ -6,7 +6,7 @@ namespace nostalgia::gfx { -gfx::UpdateSubSheetCommand::UpdateSubSheetCommand( +UpdateSubSheetCommand::UpdateSubSheetCommand( TileSheet &img, TileSheet::SubSheetIdx idx, ox::StringParam name, diff --git a/deps/nostalgia/src/olympic/keel/include/keel/context.hpp b/deps/nostalgia/src/olympic/keel/include/keel/context.hpp index 73e8087..1b3202c 100644 --- a/deps/nostalgia/src/olympic/keel/include/keel/context.hpp +++ b/deps/nostalgia/src/olympic/keel/include/keel/context.hpp @@ -12,8 +12,6 @@ namespace keel { -class Context; - class Context { public: ox::UPtr rom; diff --git a/deps/nostalgia/src/olympic/keel/src/CMakeLists.txt b/deps/nostalgia/src/olympic/keel/src/CMakeLists.txt index 0e5872e..8ef7a85 100644 --- a/deps/nostalgia/src/olympic/keel/src/CMakeLists.txt +++ b/deps/nostalgia/src/olympic/keel/src/CMakeLists.txt @@ -28,7 +28,7 @@ install( DIRECTORY ../include/keel DESTINATION - include/keel + include ) install( @@ -60,4 +60,11 @@ if(TURBINE_BUILD_TYPE STREQUAL "Native") OxClaw OxLogConn ) + install( + TARGETS + KeelPack-AppLib + DESTINATION + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) endif() diff --git a/deps/nostalgia/src/olympic/keel/src/media.cpp b/deps/nostalgia/src/olympic/keel/src/media.cpp index 2ff7150..0c5b831 100644 --- a/deps/nostalgia/src/olympic/keel/src/media.cpp +++ b/deps/nostalgia/src/olympic/keel/src/media.cpp @@ -182,7 +182,7 @@ ox::Result uuidToPath(Context &ctx, ox::UUID const&uuid) noexce #endif } -ox::Error reloadAsset(keel::Context &ctx, ox::StringViewCR assetId) noexcept { +ox::Error reloadAsset(Context &ctx, ox::StringViewCR assetId) noexcept { if (beginsWith(assetId, "uuid://")) { return ctx.assetManager.reloadAsset(substr(assetId, 7)); } else { diff --git a/deps/nostalgia/src/olympic/studio/applib/src/aboutpopup.cpp b/deps/nostalgia/src/olympic/studio/applib/src/aboutpopup.cpp index 98f8264..65844bf 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/aboutpopup.cpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/aboutpopup.cpp @@ -13,20 +13,9 @@ extern ox::String appVersion; namespace studio { -AboutPopup::AboutPopup(turbine::Context &ctx) noexcept { - m_text = ox::sfmt("{} - {}", keelCtx(ctx).appName, olympic::appVersion); -} - -void AboutPopup::open() noexcept { - m_stage = Stage::Opening; -} - -void AboutPopup::close() noexcept { - m_stage = Stage::Closed; -} - -bool AboutPopup::isOpen() const noexcept { - return m_stage == Stage::Open; +AboutPopup::AboutPopup(turbine::Context &ctx) noexcept: + Popup("About"), + m_text{sfmt("{} - {}", keelCtx(ctx).appName, olympic::appVersion)} { } void AboutPopup::draw(Context &sctx) noexcept { @@ -47,7 +36,7 @@ void AboutPopup::draw(Context &sctx) noexcept { ig::centerNextWindow(sctx.tctx); auto open = true; if (ImGui::BeginPopupModal("About", &open, modalFlags)) { - ImGui::Text("%s", m_text.c_str()); + ImGui::Text("%s\n\nBuild date: %s", m_text.c_str(), __DATE__); ImGui::NewLine(); ImGui::Dummy({148.0f, 0.0f}); ImGui::SameLine(); diff --git a/deps/nostalgia/src/olympic/studio/applib/src/aboutpopup.hpp b/deps/nostalgia/src/olympic/studio/applib/src/aboutpopup.hpp index ea735e6..94cd332 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/aboutpopup.hpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/aboutpopup.hpp @@ -13,29 +13,14 @@ namespace studio { -class AboutPopup: public studio::Popup { - public: - enum class Stage { - Closed, - Opening, - Open, - }; - +class AboutPopup final: public ig::Popup { private: - Stage m_stage = Stage::Closed; - ox::String m_text; + ox::String const m_text; public: explicit AboutPopup(turbine::Context &ctx) noexcept; - void open() noexcept override; - - void close() noexcept override; - - [[nodiscard]] - bool isOpen() const noexcept override; - - void draw(studio::Context &sctx) noexcept override; + void draw(Context &sctx) noexcept override; }; diff --git a/deps/nostalgia/src/olympic/studio/applib/src/studioui.cpp b/deps/nostalgia/src/olympic/studio/applib/src/studioui.cpp index 1782fa6..b617f0e 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/studioui.cpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/studioui.cpp @@ -65,10 +65,7 @@ OX_MODEL_END() StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexcept: m_sctx{*this, ctx}, m_tctx{ctx}, - m_projectDataDir{std::move(projectDataDir)}, - m_projectExplorer{keelCtx(m_tctx)}, - m_newProject{m_projectDataDir}, - m_aboutPopup{m_tctx} { + m_projectDataDir{std::move(projectDataDir)} { { ImFontConfig fontCfg; fontCfg.FontDataOwnedByAtlas = false; @@ -255,7 +252,7 @@ void StudioUI::drawMenu() noexcept { void StudioUI::drawTabBar() noexcept { auto const viewport = ImGui::GetContentRegionAvail(); ImGui::BeginChild("TabWindow##MainWindow##Studio", ImVec2(viewport.x, viewport.y)); - constexpr auto tabBarFlags = ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_TabListPopupButton; + constexpr auto tabBarFlags = ImGuiTabBarFlags_TabListPopupButton; if (ImGui::BeginTabBar("TabBar##TabWindow##MainWindow##Studio", tabBarFlags)) { drawTabs(); ImGui::EndTabBar(); @@ -478,6 +475,18 @@ ox::Error StudioUI::handleMoveFile(ox::StringViewCR oldPath, ox::StringViewCR ne return m_projectExplorer.refreshProjectTreeModel(); } +ox::Error StudioUI::handleDeleteDir(ox::StringViewCR path) noexcept { + auto const p = sfmt("{}/", path); + for (auto &e : m_editors) { + if (beginsWith(e->itemPath(), p)) { + oxLogError(closeFile(path)); + m_closeActiveTab = true; + break; + } + } + return m_projectExplorer.refreshProjectTreeModel(); +} + ox::Error StudioUI::handleDeleteFile(ox::StringViewCR path) noexcept { for (auto &e : m_editors) { if (path == e->itemPath()) { @@ -523,6 +532,7 @@ ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept { m_newDirDialog.newDir.connect(m_sctx.project, &Project::mkdir); m_project->dirAdded.connect(&m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel); m_project->fileAdded.connect(&m_projectExplorer, &ProjectExplorer::refreshProjectTreeModel); + m_project->dirDeleted.connect(this, &StudioUI::handleDeleteDir); m_project->fileDeleted.connect(this, &StudioUI::handleDeleteFile); m_project->fileMoved.connect(this, &StudioUI::handleMoveFile); m_openFiles.clear(); diff --git a/deps/nostalgia/src/olympic/studio/applib/src/studioui.hpp b/deps/nostalgia/src/olympic/studio/applib/src/studioui.hpp index 811dac2..ee9ee1b 100644 --- a/deps/nostalgia/src/olympic/studio/applib/src/studioui.hpp +++ b/deps/nostalgia/src/olympic/studio/applib/src/studioui.hpp @@ -36,7 +36,7 @@ class StudioUI: public ox::SignalHandler { TaskRunner m_taskRunner; ox::Vector> m_editors; ox::HashMap m_editorMakers; - ProjectExplorer m_projectExplorer; + ProjectExplorer m_projectExplorer{keelCtx(m_tctx)}; ox::Vector m_openFiles; BaseEditor *m_activeEditorOnLastDraw = nullptr; BaseEditor *m_activeEditor = nullptr; @@ -45,6 +45,7 @@ class StudioUI: public ox::SignalHandler { ox::Vector> m_queuedMoves; ox::Vector> m_queuedDirMoves; NewMenu m_newMenu{keelCtx(m_tctx)}; + AboutPopup m_aboutPopup{m_tctx}; DeleteConfirmation m_deleteConfirmation; NewDir m_newDirDialog; ig::QuestionPopup m_closeFileConfirm{"Close File?", "This file has unsaved changes. Close?"}; @@ -55,8 +56,7 @@ class StudioUI: public ox::SignalHandler { ig::MessagePopup m_messagePopup{"Message", ""}; MakeCopyPopup m_copyFilePopup; RenameFile m_renameFile; - NewProject m_newProject; - AboutPopup m_aboutPopup; + NewProject m_newProject{m_projectDataDir}; ox::Array const m_widgets { &m_closeFileConfirm, &m_closeAppConfirm, @@ -126,6 +126,8 @@ class StudioUI: public ox::SignalHandler { ox::Error handleMoveFile(ox::StringViewCR oldPath, ox::StringViewCR newPath, ox::UUID const&id) noexcept; + ox::Error handleDeleteDir(ox::StringViewCR path) noexcept; + ox::Error handleDeleteFile(ox::StringViewCR path) noexcept; ox::Error createOpenProject(ox::StringViewCR path) noexcept; diff --git a/deps/nostalgia/src/olympic/studio/modlib/include/studio/project.hpp b/deps/nostalgia/src/olympic/studio/modlib/include/studio/project.hpp index 73b0e2b..204f67e 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/include/studio/project.hpp +++ b/deps/nostalgia/src/olympic/studio/modlib/include/studio/project.hpp @@ -23,6 +23,7 @@ enum class ProjectEvent { // FileRecognized is triggered for all matching files upon a new // subscription to a section of the project and upon the addition of a file. FileRecognized, + DirDeleted, FileDeleted, FileUpdated, FileMoved, @@ -134,6 +135,7 @@ class Project: public ox::SignalHandler { // file. ox::Signal fileRecognized; ox::Signal fileDeleted; + ox::Signal dirDeleted; ox::Signal fileUpdated; ox::Signal fileMoved; @@ -201,6 +203,9 @@ ox::Error Project::subscribe(ProjectEvent e, ox::SignalHandler *tgt, Functor &&s connect(this, &Project::fileRecognized, tgt, slot); break; } + case ProjectEvent::DirDeleted: + connect(this, &Project::dirDeleted, tgt, slot); + break; case ProjectEvent::FileDeleted: connect(this, &Project::fileDeleted, tgt, slot); break; diff --git a/deps/nostalgia/src/olympic/studio/modlib/src/CMakeLists.txt b/deps/nostalgia/src/olympic/studio/modlib/src/CMakeLists.txt index 22ff659..28bc274 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/src/CMakeLists.txt +++ b/deps/nostalgia/src/olympic/studio/modlib/src/CMakeLists.txt @@ -44,5 +44,5 @@ install( DIRECTORY ../include/studio DESTINATION - include/studio + include ) diff --git a/deps/nostalgia/src/olympic/studio/modlib/src/filetreemodel.cpp b/deps/nostalgia/src/olympic/studio/modlib/src/filetreemodel.cpp index b921f8d..a32e119 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/src/filetreemodel.cpp +++ b/deps/nostalgia/src/olympic/studio/modlib/src/filetreemodel.cpp @@ -93,6 +93,9 @@ void FileTreeModel::draw(turbine::Context &tctx) const noexcept { if (ImGui::IsItemActivated() || ImGui::IsItemClicked(1)) { m_explorer.setSelectedNode(this); } + if (ImGui::IsItemFocused() && ImGui::IsKeyPressed(ImGuiKey_Delete)) { + m_explorer.fileDeleted(m_fullPath); + } ig::IDStackItem const idStackItem{m_name}; m_explorer.drawDirContextMenu(m_fullPath); if (m_explorer.fileDraggable()) { diff --git a/deps/nostalgia/src/olympic/studio/modlib/src/project.cpp b/deps/nostalgia/src/olympic/studio/modlib/src/project.cpp index 9220d74..f5801b3 100644 --- a/deps/nostalgia/src/olympic/studio/modlib/src/project.cpp +++ b/deps/nostalgia/src/olympic/studio/modlib/src/project.cpp @@ -145,7 +145,7 @@ ox::Error Project::deleteItem(ox::StringViewCR path) noexcept { } auto const err = m_fs.remove(path); if (!err) { - fileDeleted.emit(path); + dirDeleted.emit(path); } return err; } else { diff --git a/deps/nostalgia/src/olympic/turbine/src/CMakeLists.txt b/deps/nostalgia/src/olympic/turbine/src/CMakeLists.txt index 33a7d92..5b0f91b 100644 --- a/deps/nostalgia/src/olympic/turbine/src/CMakeLists.txt +++ b/deps/nostalgia/src/olympic/turbine/src/CMakeLists.txt @@ -38,7 +38,7 @@ install( DIRECTORY ../include/turbine DESTINATION - include/turbine + include ) install( diff --git a/deps/nostalgia/util/scripts/pkg-dmg.py b/deps/nostalgia/util/scripts/pkg-dmg.py new file mode 100755 index 0000000..d006912 --- /dev/null +++ b/deps/nostalgia/util/scripts/pkg-dmg.py @@ -0,0 +1,37 @@ +#! /usr/bin/env python3 + +import os +import shutil +import subprocess +import sys + +def rm(path: str): + file_exists = os.path.exists(path) + is_link = os.path.islink(path) + is_dir = os.path.isdir(path) + if (file_exists or is_link) and not is_dir: + os.remove(path) + elif os.path.isdir(path): + shutil.rmtree(path) + + +def mkdir_p(path: str): + if not os.path.exists(path): + os.mkdir(path) + + +def run(args: list[str]): + if subprocess.run(args).returncode != 0: + sys.exit(1) + + + +dmg_dir = 'dist/darwin-arm64-release/NostalgiaStudio' +dmg = f'{dmg_dir}.dmg' +rm(dmg) +rm(dmg_dir) +mkdir_p(dmg_dir) +shutil.copytree('dist/darwin-arm64-release/NostalgiaStudio.app', f'{dmg_dir}/NostalgiaStudio.app') +os.symlink('/Applications', f'{dmg_dir}/Applications') +run(['hdiutil', 'create', '-srcfolder', dmg_dir, dmg]) +rm(dmg_dir)