From 4e94c925686cdda4b1ac777045dd7a17c7dc0329 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 20 Feb 2025 20:11:03 -0600 Subject: [PATCH] Squashed 'deps/nostalgia/' changes from 2a8e3c2d..26fc5565 26fc5565 [nostalgia/gfx] Make dangling reference warning suppressions check for GCC 13 388541ce [nostalgia/player] Cleanup 6c194667 [nostalgia] Fix NostalgiaGfx lib name, stub out sound package 62d0579f [ox/fs] Restructure stat error handling to make easier to debug 202595b2 [keel] Fix loading assets by path cb21ff3f Merge commit 'a6b9657268eb3fe139b0c22df27c2cb2efc0013c' 8459d3ba Merge commit 'c42adc290cd8a27d01bb6d9877032dd2c963a4b7' 8d04af69 Merge commit 'ab760b064fd6a302bad13274e0e02b2b2c957b67' 6c34198f Merge commit '897a59cdad66e593fd45eece9414d8414fa7f1ae' f63c5816 [studio] Add filepickerpopup.hpp to studio.hpp git-subtree-dir: deps/nostalgia git-subtree-split: 26fc5565e86e09c6c51a615683fd9003816a24ac --- .../ox/src/ox/fs/filesystem/passthroughfs.cpp | 4 +- src/nostalgia/modules/CMakeLists.txt | 6 ++- .../gfx/include/nostalgia/gfx/tilesheet.hpp | 4 +- src/nostalgia/modules/gfx/src/CMakeLists.txt | 8 ++-- .../modules/gfx/src/gba/CMakeLists.txt | 8 ++-- .../modules/gfx/src/keel/CMakeLists.txt | 8 ++-- .../modules/gfx/src/opengl/CMakeLists.txt | 4 +- .../modules/gfx/src/studio/CMakeLists.txt | 16 +++---- .../src/studio/paletteeditor/CMakeLists.txt | 2 +- .../paletteeditor/commands/CMakeLists.txt | 2 +- .../src/studio/tilesheeteditor/CMakeLists.txt | 6 +-- .../tilesheeteditor/commands/CMakeLists.txt | 2 +- .../tilesheeteditor/tilesheeteditormodel.cpp | 5 +- src/nostalgia/modules/gfx/src/tilesheet.cpp | 8 ++-- src/nostalgia/modules/gfx/test/CMakeLists.txt | 8 ++-- .../modules/scene/src/CMakeLists.txt | 2 +- src/nostalgia/modules/sound/CMakeLists.txt | 12 +++++ .../sound/include/nostalgia/sound/sound.hpp | 8 ++++ .../modules/sound/src/CMakeLists.txt | 27 +++++++++++ .../modules/sound/src/keel/CMakeLists.txt | 19 ++++++++ .../modules/sound/src/keel/keelmodule.cpp | 46 +++++++++++++++++++ .../modules/sound/src/keel/typeconv.cpp | 9 ++++ .../modules/sound/src/keel/typeconv.hpp | 15 ++++++ src/nostalgia/modules/sound/src/sound.cpp | 6 +++ .../modules/sound/src/studio/CMakeLists.txt | 17 +++++++ .../modules/sound/src/studio/studiomodule.cpp | 27 +++++++++++ .../modules/sound/test/CMakeLists.txt | 10 ++++ src/nostalgia/modules/sound/test/tests.cpp | 26 +++++++++++ src/nostalgia/player/app.cpp | 5 +- src/olympic/keel/include/keel/media.hpp | 14 ++++-- .../studio/modlib/include/studio/studio.hpp | 1 + 31 files changed, 282 insertions(+), 53 deletions(-) create mode 100644 src/nostalgia/modules/sound/CMakeLists.txt create mode 100644 src/nostalgia/modules/sound/include/nostalgia/sound/sound.hpp create mode 100644 src/nostalgia/modules/sound/src/CMakeLists.txt create mode 100644 src/nostalgia/modules/sound/src/keel/CMakeLists.txt create mode 100644 src/nostalgia/modules/sound/src/keel/keelmodule.cpp create mode 100644 src/nostalgia/modules/sound/src/keel/typeconv.cpp create mode 100644 src/nostalgia/modules/sound/src/keel/typeconv.hpp create mode 100644 src/nostalgia/modules/sound/src/sound.cpp create mode 100644 src/nostalgia/modules/sound/src/studio/CMakeLists.txt create mode 100644 src/nostalgia/modules/sound/src/studio/studiomodule.cpp create mode 100644 src/nostalgia/modules/sound/test/CMakeLists.txt create mode 100644 src/nostalgia/modules/sound/test/tests.cpp diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp index fbf960b..d6f3cf9 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp @@ -93,7 +93,9 @@ Result PassThroughFS::statPath(StringViewCR path) const noexcept { oxTracef("ox.fs.PassThroughFS.statInode", "{} {}", ec.message(), path); const uint64_t size = type == FileType::Directory ? 0 : std::filesystem::file_size(p, ec); oxTracef("ox.fs.PassThroughFS.statInode.size", "{} {}", path, size); - OX_RETURN_ERROR(ox::Error(static_cast(ec.value()), "PassThroughFS: stat failed")); + if (auto err = ec.value()) { + return ox::Error{static_cast(err), "PassThroughFS: stat failed"}; + } return FileStat{0, 0, size, type}; } diff --git a/src/nostalgia/modules/CMakeLists.txt b/src/nostalgia/modules/CMakeLists.txt index dc91125..2a26b34 100644 --- a/src/nostalgia/modules/CMakeLists.txt +++ b/src/nostalgia/modules/CMakeLists.txt @@ -1,6 +1,7 @@ # module dir list add_subdirectory(gfx) +add_subdirectory(sound) add_subdirectory(scene) # module libraries @@ -13,7 +14,7 @@ add_library( target_link_libraries( NostalgiaKeelModules PUBLIC Keel - NostalgiaCore-Keel + NostalgiaGfx-Keel NostalgiaScene-Keel ) install( @@ -32,7 +33,8 @@ if(NOSTALGIA_BUILD_STUDIO) target_link_libraries( NostalgiaStudioModules PUBLIC StudioAppLib - NostalgiaCore-Studio-ImGui + NostalgiaGfx-Studio-ImGui + NostalgiaSound-Studio-ImGui NostalgiaScene-Studio ) install( diff --git a/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp b/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp index 8a6bdab..f1b6031 100644 --- a/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp +++ b/src/nostalgia/modules/gfx/include/nostalgia/gfx/tilesheet.hpp @@ -449,7 +449,7 @@ TileSheet::SubSheet &getSubSheet( std::size_t idxIt, TileSheet::SubSheet &pSubsheet) noexcept; -#if defined(__GNUC__) && __GNUC__ >= 14 +#if defined(__GNUC__) && __GNUC__ >= 13 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif @@ -458,7 +458,7 @@ TileSheet::SubSheet const&getSubSheet(TileSheet const&ts, ox::SpanView [[nodiscard]] TileSheet::SubSheet &getSubSheet(TileSheet &ts, ox::SpanView const &idx) noexcept; -#if defined(__GNUC__) && __GNUC__ >= 14 +#if defined(__GNUC__) && __GNUC__ >= 13 #pragma GCC diagnostic pop #endif diff --git a/src/nostalgia/modules/gfx/src/CMakeLists.txt b/src/nostalgia/modules/gfx/src/CMakeLists.txt index 0410ad7..20630a7 100644 --- a/src/nostalgia/modules/gfx/src/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/src/CMakeLists.txt @@ -1,5 +1,5 @@ add_library( - NostalgiaCore + NostalgiaGfx gfx.cpp tilesheet.cpp ) @@ -10,12 +10,12 @@ if(NOT BUILDCORE_TARGET STREQUAL "gba") endif() target_include_directories( - NostalgiaCore PUBLIC + NostalgiaGfx PUBLIC ../include ) target_link_libraries( - NostalgiaCore PUBLIC + NostalgiaGfx PUBLIC Turbine ) @@ -26,7 +26,7 @@ endif() install( TARGETS - NostalgiaCore + NostalgiaGfx DESTINATION LIBRARY DESTINATION lib ARCHIVE DESTINATION lib diff --git a/src/nostalgia/modules/gfx/src/gba/CMakeLists.txt b/src/nostalgia/modules/gfx/src/gba/CMakeLists.txt index d155288..24c64c5 100644 --- a/src/nostalgia/modules/gfx/src/gba/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/src/gba/CMakeLists.txt @@ -1,15 +1,15 @@ add_library( - NostalgiaCore-GBA OBJECT + NostalgiaGfx-GBA OBJECT context.cpp gfx.cpp panic.cpp ) target_include_directories( - NostalgiaCore-GBA PUBLIC + NostalgiaGfx-GBA PUBLIC ../../include ) target_link_libraries( - NostalgiaCore-GBA PUBLIC + NostalgiaGfx-GBA PUBLIC TeaGBA Keel Turbine @@ -17,5 +17,5 @@ target_link_libraries( if(BUILDCORE_TARGET STREQUAL "gba") set_source_files_properties(gfx.cpp PROPERTIES COMPILE_FLAGS -marm) - target_link_libraries(NostalgiaCore PUBLIC NostalgiaCore-GBA) + target_link_libraries(NostalgiaGfx PUBLIC NostalgiaGfx-GBA) endif() diff --git a/src/nostalgia/modules/gfx/src/keel/CMakeLists.txt b/src/nostalgia/modules/gfx/src/keel/CMakeLists.txt index 5a0d66c..4e6b2f6 100644 --- a/src/nostalgia/modules/gfx/src/keel/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/src/keel/CMakeLists.txt @@ -1,18 +1,18 @@ add_library( - NostalgiaCore-Keel + NostalgiaGfx-Keel keelmodule.cpp typeconv.cpp ) target_link_libraries( - NostalgiaCore-Keel PUBLIC + NostalgiaGfx-Keel PUBLIC Keel - NostalgiaCore + NostalgiaGfx ) install( TARGETS - NostalgiaCore-Keel + NostalgiaGfx-Keel DESTINATION LIBRARY DESTINATION lib ARCHIVE DESTINATION lib diff --git a/src/nostalgia/modules/gfx/src/opengl/CMakeLists.txt b/src/nostalgia/modules/gfx/src/opengl/CMakeLists.txt index 48a0e7f..f3a72af 100644 --- a/src/nostalgia/modules/gfx/src/opengl/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/src/opengl/CMakeLists.txt @@ -1,9 +1,9 @@ target_sources( - NostalgiaCore PRIVATE + NostalgiaGfx PRIVATE context.cpp gfx.cpp ) target_link_libraries( - NostalgiaCore PUBLIC + NostalgiaGfx PUBLIC GlUtils ) diff --git a/src/nostalgia/modules/gfx/src/studio/CMakeLists.txt b/src/nostalgia/modules/gfx/src/studio/CMakeLists.txt index 8c5e958..75c008c 100644 --- a/src/nostalgia/modules/gfx/src/studio/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/src/studio/CMakeLists.txt @@ -1,25 +1,25 @@ -add_library(NostalgiaCore-Studio) +add_library(NostalgiaGfx-Studio) add_library( - NostalgiaCore-Studio-ImGui + NostalgiaGfx-Studio-ImGui studiomodule.cpp ) target_link_libraries( - NostalgiaCore-Studio PUBLIC - NostalgiaCore + NostalgiaGfx-Studio PUBLIC + NostalgiaGfx Studio ) target_link_libraries( - NostalgiaCore-Studio-ImGui PUBLIC - NostalgiaCore-Studio + NostalgiaGfx-Studio-ImGui PUBLIC + NostalgiaGfx-Studio ) install( TARGETS - NostalgiaCore-Studio-ImGui - NostalgiaCore-Studio + NostalgiaGfx-Studio-ImGui + NostalgiaGfx-Studio LIBRARY DESTINATION ${NOSTALGIA_DIST_MODULE} ) diff --git a/src/nostalgia/modules/gfx/src/studio/paletteeditor/CMakeLists.txt b/src/nostalgia/modules/gfx/src/studio/paletteeditor/CMakeLists.txt index 25e3a79..58f9edb 100644 --- a/src/nostalgia/modules/gfx/src/studio/paletteeditor/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources( - NostalgiaCore-Studio-ImGui PRIVATE + NostalgiaGfx-Studio-ImGui PRIVATE paletteeditor-imgui.cpp ) diff --git a/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/CMakeLists.txt b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/CMakeLists.txt index 42c4cd5..017c821 100644 --- a/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/src/studio/paletteeditor/commands/CMakeLists.txt @@ -1,6 +1,6 @@ target_sources( - NostalgiaCore-Studio PRIVATE + NostalgiaGfx-Studio PRIVATE addcolorcommand.cpp addpagecommand.cpp applycolorallpagescommand.cpp diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/CMakeLists.txt b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/CMakeLists.txt index 01d3e67..ef00ba2 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources( - NostalgiaCore-Studio PRIVATE + NostalgiaGfx-Studio PRIVATE tilesheeteditorview.cpp tilesheeteditormodel.cpp tilesheetpixelgrid.cpp @@ -7,12 +7,12 @@ target_sources( ) target_sources( - NostalgiaCore-Studio-ImGui PRIVATE + NostalgiaGfx-Studio-ImGui PRIVATE tilesheeteditor-imgui.cpp ) target_link_libraries( - NostalgiaCore-Studio-ImGui PUBLIC + NostalgiaGfx-Studio-ImGui PUBLIC lodepng ) diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/CMakeLists.txt b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/CMakeLists.txt index ee4fd9b..74976d5 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/commands/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources( - NostalgiaCore-Studio PRIVATE + NostalgiaGfx-Studio PRIVATE addsubsheetcommand.cpp cutpastecommand.cpp deletetilescommand.cpp diff --git a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp index d64fa94..80c6768 100644 --- a/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp +++ b/src/nostalgia/modules/gfx/src/studio/tilesheeteditor/tilesheeteditormodel.cpp @@ -18,14 +18,13 @@ #include "commands/drawcommand.hpp" #include "commands/flipcommand.hpp" #include "commands/inserttilescommand.hpp" +#include "commands/movesubsheetcommand.hpp" #include "commands/palettechangecommand.hpp" #include "commands/rmsubsheetcommand.hpp" +#include "commands/rotatecommand.hpp" #include "commands/updatesubsheetcommand.hpp" #include "tilesheeteditormodel.hpp" -#include "commands/movesubsheetcommand.hpp" -#include "commands/rotatecommand.hpp" - namespace nostalgia::gfx { // delete pixels of all non-leaf nodes diff --git a/src/nostalgia/modules/gfx/src/tilesheet.cpp b/src/nostalgia/modules/gfx/src/tilesheet.cpp index c67bcf1..d30e51a 100644 --- a/src/nostalgia/modules/gfx/src/tilesheet.cpp +++ b/src/nostalgia/modules/gfx/src/tilesheet.cpp @@ -187,7 +187,7 @@ TileSheet::SubSheetIdx validateSubSheetIdx(TileSheet const&ts, TileSheet::SubShe return validateSubSheetIdx(std::move(idx), 0, ts.subsheet); } -#if defined(__GNUC__) && __GNUC__ >= 14 +#if defined(__GNUC__) && __GNUC__ >= 13 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif @@ -204,7 +204,7 @@ static TileSheet::SubSheet const&getSubSheet( } return getSubSheet(idx, idxIt + 1, pSubsheet.subsheets[currentIdx]); } -#if defined(__GNUC__) && __GNUC__ >= 14 +#if defined(__GNUC__) && __GNUC__ >= 13 #pragma GCC diagnostic pop #endif @@ -218,7 +218,7 @@ TileSheet::SubSheet &getSubSheet( return getSubSheet(idx, idxIt + 1, pSubsheet.subsheets[idx[idxIt]]); } -#if defined(__GNUC__) && __GNUC__ >= 14 +#if defined(__GNUC__) && __GNUC__ >= 13 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif @@ -229,7 +229,7 @@ TileSheet::SubSheet const&getSubSheet(TileSheet const &ts, ox::SpanView const &idx) noexcept { return gfx::getSubSheet(idx, 0, ts.subsheet); } -#if defined(__GNUC__) && __GNUC__ >= 14 +#if defined(__GNUC__) && __GNUC__ >= 13 #pragma GCC diagnostic pop #endif diff --git a/src/nostalgia/modules/gfx/test/CMakeLists.txt b/src/nostalgia/modules/gfx/test/CMakeLists.txt index c9b56f0..bfcaf5d 100644 --- a/src/nostalgia/modules/gfx/test/CMakeLists.txt +++ b/src/nostalgia/modules/gfx/test/CMakeLists.txt @@ -1,11 +1,11 @@ add_executable( - NostalgiaCoreTest + NostalgiaGfxTest tests.cpp ) target_link_libraries( - NostalgiaCoreTest - NostalgiaCore + NostalgiaGfxTest + NostalgiaGfx ) -add_test("[NostalgiaCore] readWriteTileSheet" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/NostalgiaCoreTest readWriteTileSheet) +add_test("[NostalgiaGfx] readWriteTileSheet" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/NostalgiaGfxTest readWriteTileSheet) diff --git a/src/nostalgia/modules/scene/src/CMakeLists.txt b/src/nostalgia/modules/scene/src/CMakeLists.txt index 9f3197e..a8181e4 100644 --- a/src/nostalgia/modules/scene/src/CMakeLists.txt +++ b/src/nostalgia/modules/scene/src/CMakeLists.txt @@ -12,7 +12,7 @@ target_include_directories( target_link_libraries( NostalgiaScene PUBLIC - NostalgiaCore + NostalgiaGfx ) add_subdirectory(keel) diff --git a/src/nostalgia/modules/sound/CMakeLists.txt b/src/nostalgia/modules/sound/CMakeLists.txt new file mode 100644 index 0000000..f217730 --- /dev/null +++ b/src/nostalgia/modules/sound/CMakeLists.txt @@ -0,0 +1,12 @@ +add_subdirectory(src) + +if(NOT BUILDCORE_TARGET STREQUAL "gba") + add_subdirectory(test) +endif() + +install( + DIRECTORY + include/nostalgia + DESTINATION + include +) \ No newline at end of file diff --git a/src/nostalgia/modules/sound/include/nostalgia/sound/sound.hpp b/src/nostalgia/modules/sound/include/nostalgia/sound/sound.hpp new file mode 100644 index 0000000..90cc05a --- /dev/null +++ b/src/nostalgia/modules/sound/include/nostalgia/sound/sound.hpp @@ -0,0 +1,8 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#pragma once + +namespace nostalgia::sound { +} diff --git a/src/nostalgia/modules/sound/src/CMakeLists.txt b/src/nostalgia/modules/sound/src/CMakeLists.txt new file mode 100644 index 0000000..ca398db --- /dev/null +++ b/src/nostalgia/modules/sound/src/CMakeLists.txt @@ -0,0 +1,27 @@ +add_library( + NostalgiaSound + sound.cpp +) + +target_include_directories( + NostalgiaSound PUBLIC + ../include +) + +target_link_libraries( + NostalgiaSound PUBLIC + Turbine +) + +add_subdirectory(keel) +if(NOSTALGIA_BUILD_STUDIO) + add_subdirectory(studio) +endif() + +install( + TARGETS + NostalgiaSound + DESTINATION + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/src/nostalgia/modules/sound/src/keel/CMakeLists.txt b/src/nostalgia/modules/sound/src/keel/CMakeLists.txt new file mode 100644 index 0000000..448c074 --- /dev/null +++ b/src/nostalgia/modules/sound/src/keel/CMakeLists.txt @@ -0,0 +1,19 @@ +add_library( + NostalgiaSound-Keel + keelmodule.cpp + typeconv.cpp +) + +target_link_libraries( + NostalgiaSound-Keel PUBLIC + Keel + NostalgiaSound +) + +install( + TARGETS + NostalgiaSound-Keel + DESTINATION + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/src/nostalgia/modules/sound/src/keel/keelmodule.cpp b/src/nostalgia/modules/sound/src/keel/keelmodule.cpp new file mode 100644 index 0000000..c1cb6f6 --- /dev/null +++ b/src/nostalgia/modules/sound/src/keel/keelmodule.cpp @@ -0,0 +1,46 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#include + +#include + +#include "typeconv.hpp" + +namespace nostalgia::sound { + +static class: public keel::Module { + private: + + public: + [[nodiscard]] + ox::String id() const noexcept override { + return ox::String{"net.drinkingtea.nostalgia.sound"}; + } + + [[nodiscard]] + ox::Vector types() const noexcept final { + return { + }; + } + + [[nodiscard]] + ox::Vector converters() const noexcept final { + return { + }; + } + + [[nodiscard]] + ox::Vector packTransforms() const noexcept final { + return { + }; + } + +} const mod; + +keel::Module const*keelModule() noexcept { + return &mod; +} + +} diff --git a/src/nostalgia/modules/sound/src/keel/typeconv.cpp b/src/nostalgia/modules/sound/src/keel/typeconv.cpp new file mode 100644 index 0000000..ac5c368 --- /dev/null +++ b/src/nostalgia/modules/sound/src/keel/typeconv.cpp @@ -0,0 +1,9 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#include "typeconv.hpp" + +namespace nostalgia::sound { + +} diff --git a/src/nostalgia/modules/sound/src/keel/typeconv.hpp b/src/nostalgia/modules/sound/src/keel/typeconv.hpp new file mode 100644 index 0000000..3fe400f --- /dev/null +++ b/src/nostalgia/modules/sound/src/keel/typeconv.hpp @@ -0,0 +1,15 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#pragma once + +#include + +#include + +namespace nostalgia::sound { + +// Type converters + +} diff --git a/src/nostalgia/modules/sound/src/sound.cpp b/src/nostalgia/modules/sound/src/sound.cpp new file mode 100644 index 0000000..a2d5bbf --- /dev/null +++ b/src/nostalgia/modules/sound/src/sound.cpp @@ -0,0 +1,6 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +namespace nostalgia::sound { +} \ No newline at end of file diff --git a/src/nostalgia/modules/sound/src/studio/CMakeLists.txt b/src/nostalgia/modules/sound/src/studio/CMakeLists.txt new file mode 100644 index 0000000..dbf0f02 --- /dev/null +++ b/src/nostalgia/modules/sound/src/studio/CMakeLists.txt @@ -0,0 +1,17 @@ +add_library( + NostalgiaSound-Studio-ImGui + studiomodule.cpp +) + +target_link_libraries( + NostalgiaSound-Studio-ImGui PUBLIC + NostalgiaSound + Studio +) + +install( + TARGETS + NostalgiaSound-Studio-ImGui + LIBRARY DESTINATION + ${NOSTALGIA_DIST_MODULE} +) diff --git a/src/nostalgia/modules/sound/src/studio/studiomodule.cpp b/src/nostalgia/modules/sound/src/studio/studiomodule.cpp new file mode 100644 index 0000000..fe133a7 --- /dev/null +++ b/src/nostalgia/modules/sound/src/studio/studiomodule.cpp @@ -0,0 +1,27 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#include + +#include + +namespace nostalgia::gfx { + +static class: public studio::Module { + ox::Vector editors(studio::StudioContext&) const noexcept final { + return { + }; + } + + ox::Vector> itemMakers(studio::StudioContext&) const noexcept final { + ox::Vector> out; + return out; + } +} const mod; + +const studio::Module *studioModule() noexcept { + return &mod; +} + +} diff --git a/src/nostalgia/modules/sound/test/CMakeLists.txt b/src/nostalgia/modules/sound/test/CMakeLists.txt new file mode 100644 index 0000000..ee5afed --- /dev/null +++ b/src/nostalgia/modules/sound/test/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable( + NostalgiaSoundTest + tests.cpp +) + +target_link_libraries( + NostalgiaSoundTest + NostalgiaSound +) + diff --git a/src/nostalgia/modules/sound/test/tests.cpp b/src/nostalgia/modules/sound/test/tests.cpp new file mode 100644 index 0000000..bf35cd2 --- /dev/null +++ b/src/nostalgia/modules/sound/test/tests.cpp @@ -0,0 +1,26 @@ +/* + * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#undef NDEBUG + +#include +#include +#include + +static std::map tests = { +}; + +int main(int argc, const char **argv) { + int retval = -1; + if (argc > 0) { + auto const args = ox::Span{argv, static_cast(argc)}; + auto const testName = ox::StringView(args[1]); + if (tests.find(testName) != tests.end()) { + retval = static_cast(tests[testName]()); + } else { + retval = 1; + } + } + return retval; +} diff --git a/src/nostalgia/player/app.cpp b/src/nostalgia/player/app.cpp index 0b555dc..f192989 100644 --- a/src/nostalgia/player/app.cpp +++ b/src/nostalgia/player/app.cpp @@ -147,9 +147,8 @@ static void sceneKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool [[maybe_unused]] static ox::Error runScene(turbine::Context &tctx) { - constexpr ox::StringView SceneAddr{"/Scenes/Chester.nscn"}; OX_REQUIRE_M(cctx, gfx::init(tctx)); - OX_REQUIRE(scn, keel::readObj(keelCtx(tctx), SceneAddr)); + OX_REQUIRE(scn, keel::readObj(keelCtx(tctx), "/Scenes/Chester.nscn")); turbine::setUpdateHandler(tctx, sceneUpdateHandler); turbine::setKeyEventHandler(tctx, sceneKeyEventHandler); scene::Scene const scene(*scn); @@ -163,7 +162,7 @@ ox::Error run( [[maybe_unused]] ox::StringView projectDataDir, ox::SpanView args) noexcept { if (args.size() < 2) { - return ox::Error(1, "Please provide path to project directory or OxFS file."); + return ox::Error{1, "Please provide path to project directory or OxFS file."}; } auto const path = args[1]; OX_REQUIRE_M(fs, keel::loadRomFs(path)); diff --git a/src/olympic/keel/include/keel/media.hpp b/src/olympic/keel/include/keel/media.hpp index 7faa272..1b2040e 100644 --- a/src/olympic/keel/include/keel/media.hpp +++ b/src/olympic/keel/include/keel/media.hpp @@ -64,12 +64,16 @@ ox::Result uuidToPath(Context &ctx, ox::UUID const&uuid) noexce namespace detail { template constexpr auto makeLoader(Context &ctx) { - return [&ctx](ox::StringViewCR assetId) -> ox::Result { - auto const p = ctx.uuidToPath.at(assetId); - if (p.error) { - return ox::Error{1, "Asset ID not found"}; + return [&ctx](ox::StringView assetId) -> ox::Result { + if (!beginsWith(assetId, "/")) { + auto const p = ctx.uuidToPath.at(assetId); + if (p.error) { + oxErrf("Could not find asset: {}", assetId); + return ox::Error{1, "Asset ID not found"}; + } + assetId = *p.value; } - OX_REQUIRE(buff, ctx.rom->read(*p.value)); + OX_REQUIRE(buff, ctx.rom->read(assetId)); auto [obj, err] = readAsset(buff); if (err) { if (err != ox::Error_ClawTypeVersionMismatch && err != ox::Error_ClawTypeMismatch) { diff --git a/src/olympic/studio/modlib/include/studio/studio.hpp b/src/olympic/studio/modlib/include/studio/studio.hpp index b9c20e4..f27a107 100644 --- a/src/olympic/studio/modlib/include/studio/studio.hpp +++ b/src/olympic/studio/modlib/include/studio/studio.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include