Compare commits
7 Commits
release-d2
...
d2e30b4cfd
| Author | SHA1 | Date | |
|---|---|---|---|
| d2e30b4cfd | |||
| 7a8680610d | |||
| 1986619f65 | |||
| c410c8e897 | |||
| 2a286a64ca | |||
| cc4da3a4c4 | |||
| 1bc050026f |
2
deps/buildcore/scripts/util.py
vendored
2
deps/buildcore/scripts/util.py
vendored
@@ -35,4 +35,6 @@ def get_arch() -> str:
|
|||||||
arch = platform.machine().lower()
|
arch = platform.machine().lower()
|
||||||
if arch == 'amd64':
|
if arch == 'amd64':
|
||||||
arch = 'x86_64'
|
arch = 'x86_64'
|
||||||
|
elif arch == 'aarch64':
|
||||||
|
arch = 'arm64'
|
||||||
return arch
|
return arch
|
||||||
|
|||||||
14
deps/nfde/CMakeLists.txt
vendored
14
deps/nfde/CMakeLists.txt
vendored
@@ -10,11 +10,7 @@ if(NOT DEFINED BUILD_SHARED_LIBS)
|
|||||||
option(BUILD_SHARED_LIBS "Build a shared library instead of static" OFF)
|
option(BUILD_SHARED_LIBS "Build a shared library instead of static" OFF)
|
||||||
endif()
|
endif()
|
||||||
option(NFD_BUILD_TESTS "Build tests for nfd" ${nfd_ROOT_PROJECT})
|
option(NFD_BUILD_TESTS "Build tests for nfd" ${nfd_ROOT_PROJECT})
|
||||||
# DrinkingTea: begin
|
option(NFD_INSTALL "Generate install target for nfd" ${nfd_ROOT_PROJECT})
|
||||||
if(NOT DEFINED NFD_INSTALL)
|
|
||||||
option(NFD_INSTALL "Generate install target for nfd" ${nfd_ROOT_PROJECT})
|
|
||||||
endif()
|
|
||||||
# DrinkingTea: end
|
|
||||||
|
|
||||||
set(nfd_PLATFORM Undefined)
|
set(nfd_PLATFORM Undefined)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
@@ -25,9 +21,7 @@ elseif(UNIX AND NOT APPLE)
|
|||||||
set(nfd_PLATFORM PLATFORM_UNIX)
|
set(nfd_PLATFORM PLATFORM_UNIX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# DrinkingTea: begin
|
message("nfd Platform: ${nfd_PLATFORM}")
|
||||||
#message("nfd Platform: ${nfd_PLATFORM}")
|
|
||||||
# DrinkingTea: end
|
|
||||||
|
|
||||||
set(nfd_COMPILER Undefined)
|
set(nfd_COMPILER Undefined)
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
|
||||||
@@ -39,9 +33,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "C
|
|||||||
set(nfd_COMPILER COMPILER_GNU)
|
set(nfd_COMPILER COMPILER_GNU)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# DrinkingTea: begin
|
message("nfd Compiler: ${nfd_COMPILER}")
|
||||||
#message("nfd Compiler: ${nfd_COMPILER}")
|
|
||||||
# DrinkingTea: end
|
|
||||||
|
|
||||||
# Use latest C++ by default (should be the best one), but let user override it
|
# Use latest C++ by default (should be the best one), but let user override it
|
||||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||||
|
|||||||
2
deps/ox/src/ox/std/reader.cpp
vendored
2
deps/ox/src/ox/std/reader.cpp
vendored
@@ -32,7 +32,7 @@ ox::Result<char> StreamReader::peek() const noexcept {
|
|||||||
try {
|
try {
|
||||||
char c{};
|
char c{};
|
||||||
m_strm.get(c);
|
m_strm.get(c);
|
||||||
auto const ok = c != EOF;
|
auto const ok = c != static_cast<char>(EOF);
|
||||||
if (ok && m_strm.unget()) [[unlikely]] {
|
if (ok && m_strm.unget()) [[unlikely]] {
|
||||||
return ox::Error(1, "Unable to unget character");
|
return ox::Error(1, "Unable to unget character");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"length" : 4,
|
"length" : 4,
|
||||||
"primitiveType" : 1,
|
"primitiveType" : 1,
|
||||||
"typeName" : "B.int32"
|
"typeName" : "B.int32"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"length" : 1,
|
"length" : 1,
|
||||||
"primitiveType" : 1,
|
"primitiveType" : 1,
|
||||||
"typeName" : "B.int8"
|
"typeName" : "B.int8"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||||
"primitiveType" : 4,
|
"primitiveType" : 4,
|
||||||
"typeName" : "B.string"
|
"typeName" : "B.string"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||||
"length" : 2,
|
"length" : 2,
|
||||||
"typeName" : "B.uint16"
|
"typeName" : "B.uint16"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||||
"length" : 8,
|
"length" : 8,
|
||||||
"typeName" : "B.uint64"
|
"typeName" : "B.uint64"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
||||||
"length" : 1,
|
"length" : 1,
|
||||||
"typeName" : "B.uint8"
|
"typeName" : "B.uint8"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.CompactPalette",
|
"typeName" : "net.drinkingtea.nostalgia.core.CompactPalette",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.CompactTileSheet",
|
"typeName" : "net.drinkingtea.nostalgia.core.CompactTileSheet",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,4 +36,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.NostalgiaGraphic",
|
"typeName" : "net.drinkingtea.nostalgia.core.NostalgiaGraphic",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette.ColorInfo",
|
"typeName" : "net.drinkingtea.nostalgia.core.Palette.ColorInfo",
|
||||||
"typeVersion" : 3
|
"typeVersion" : 3
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette.PalettePage",
|
"typeName" : "net.drinkingtea.nostalgia.core.Palette.PalettePage",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
||||||
"typeVersion" : 2
|
"typeVersion" : 2
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,4 +31,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
||||||
"typeVersion" : 3
|
"typeVersion" : 3
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,4 +28,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
"typeName" : "net.drinkingtea.nostalgia.core.Palette",
|
||||||
"typeVersion" : 4
|
"typeVersion" : 4
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.PaletteColor",
|
"typeName" : "net.drinkingtea.nostalgia.core.PaletteColor",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
||||||
"typeVersion" : 3
|
"typeVersion" : 3
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,4 +43,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet.SubSheet",
|
||||||
"typeVersion" : 4
|
"typeVersion" : 4
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
||||||
"typeVersion" : 2
|
"typeVersion" : 2
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
||||||
"typeVersion" : 3
|
"typeVersion" : 3
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
"typeName" : "net.drinkingtea.nostalgia.core.TileSheet",
|
||||||
"typeVersion" : 4
|
"typeVersion" : 4
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,4 +38,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.scene.SceneDoc",
|
"typeName" : "net.drinkingtea.nostalgia.scene.SceneDoc",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,4 +85,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.scene.SceneStatic",
|
"typeName" : "net.drinkingtea.nostalgia.scene.SceneStatic",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.nostalgia.scene.TileDoc",
|
"typeName" : "net.drinkingtea.nostalgia.scene.TileDoc",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"8"
|
"8"
|
||||||
],
|
],
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 6,
|
"primitiveType" : 6,
|
||||||
"typeName" : "net.drinkingtea.ox.FileAddress.Data",
|
"typeName" : "net.drinkingtea.ox.FileAddress.Data",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ O1;net.drinkingtea.ox.TypeDescriptor;1;{
|
|||||||
"primitiveType" : 5,
|
"primitiveType" : 5,
|
||||||
"typeName" : "net.drinkingtea.ox.FileAddress",
|
"typeName" : "net.drinkingtea.ox.FileAddress",
|
||||||
"typeVersion" : 1
|
"typeVersion" : 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ static void testKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool d
|
|||||||
static ox::Error runTest(turbine::Context &tctx) {
|
static ox::Error runTest(turbine::Context &tctx) {
|
||||||
constexpr ox::StringView TileSheetAddr{"/TileSheets/Charset.ng"};
|
constexpr ox::StringView TileSheetAddr{"/TileSheets/Charset.ng"};
|
||||||
constexpr ox::StringView PaletteAddr{"/Palettes/Chester.npal"};
|
constexpr ox::StringView PaletteAddr{"/Palettes/Chester.npal"};
|
||||||
OX_REQUIRE_M(cctx, core::init(tctx));
|
oxRequireM(cctx, core::init(tctx));
|
||||||
turbine::setApplicationData(tctx, cctx.get());
|
turbine::setApplicationData(tctx, cctx.get());
|
||||||
OX_REQUIRE(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
|
oxRequire(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
|
||||||
OX_RETURN_ERROR(core::loadSpriteTileSheet(*cctx, TileSheetAddr));
|
oxReturnError(core::loadSpriteTileSheet(*cctx, TileSheetAddr));
|
||||||
OX_RETURN_ERROR(core::loadSpritePalette(*cctx, PaletteAddr));
|
oxReturnError(core::loadSpritePalette(*cctx, PaletteAddr));
|
||||||
OX_RETURN_ERROR(core::initConsole(*cctx));
|
oxReturnError(core::initConsole(*cctx));
|
||||||
core::puts(*cctx, 10, 9, "DOPENESS!!!");
|
core::puts(*cctx, 10, 9, "DOPENESS!!!");
|
||||||
turbine::setUpdateHandler(tctx, testUpdateHandler);
|
turbine::setUpdateHandler(tctx, testUpdateHandler);
|
||||||
turbine::setKeyEventHandler(tctx, testKeyEventHandler);
|
turbine::setKeyEventHandler(tctx, testKeyEventHandler);
|
||||||
@@ -85,9 +85,9 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) {
|
|||||||
// this should make the screen display 'ABCDB', with the A being upside down
|
// this should make the screen display 'ABCDB', with the A being upside down
|
||||||
// and the first B being backwards
|
// and the first B being backwards
|
||||||
constexpr ox::StringView PaletteAddr{"/Palettes/Charset.npal"};
|
constexpr ox::StringView PaletteAddr{"/Palettes/Charset.npal"};
|
||||||
OX_REQUIRE_M(cctx, core::init(tctx));
|
oxRequireM(cctx, core::init(tctx));
|
||||||
turbine::setApplicationData(tctx, cctx.get());
|
turbine::setApplicationData(tctx, cctx.get());
|
||||||
OX_REQUIRE(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
|
oxRequire(tsStat, turbine::rom(tctx)->stat(PaletteAddr));
|
||||||
core::TileSheetSet const set{
|
core::TileSheetSet const set{
|
||||||
.bpp = 4,
|
.bpp = 4,
|
||||||
.entries = {
|
.entries = {
|
||||||
@@ -98,11 +98,11 @@ static ox::Error runTileSheetSetTest(turbine::Context &tctx) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
constexpr auto bgPalBank = 1;
|
constexpr auto bgPalBank = 1;
|
||||||
OX_RETURN_ERROR(core::loadBgTileSheet(*cctx, 0, set));
|
oxReturnError(core::loadBgTileSheet(*cctx, 0, set));
|
||||||
OX_RETURN_ERROR(core::loadSpriteTileSheet(*cctx, set));
|
oxReturnError(core::loadSpriteTileSheet(*cctx, set));
|
||||||
OX_RETURN_ERROR(core::loadBgPalette(*cctx, bgPalBank, PaletteAddr));
|
oxReturnError(core::loadBgPalette(*cctx, bgPalBank, PaletteAddr));
|
||||||
OX_RETURN_ERROR(core::loadBgPalette(*cctx, 0, PaletteAddr));
|
oxReturnError(core::loadBgPalette(*cctx, 0, PaletteAddr));
|
||||||
OX_RETURN_ERROR(core::loadSpritePalette(*cctx, PaletteAddr));
|
oxReturnError(core::loadSpritePalette(*cctx, PaletteAddr));
|
||||||
core::setBgStatus(*cctx, 0, true);
|
core::setBgStatus(*cctx, 0, true);
|
||||||
core::setBgTile(*cctx, 0, 10, 9, { .tileIdx = 1, .palBank = bgPalBank, .flipX = 0, .flipY = 1 });
|
core::setBgTile(*cctx, 0, 10, 9, { .tileIdx = 1, .palBank = bgPalBank, .flipX = 0, .flipY = 1 });
|
||||||
core::setBgTile(*cctx, 0, 11, 9, { .tileIdx = 2, .palBank = bgPalBank, .flipX = 1, .flipY = 0 });
|
core::setBgTile(*cctx, 0, 11, 9, { .tileIdx = 2, .palBank = bgPalBank, .flipX = 1, .flipY = 0 });
|
||||||
@@ -148,12 +148,12 @@ static void sceneKeyEventHandler(turbine::Context &tctx, turbine::Key key, bool
|
|||||||
[[maybe_unused]]
|
[[maybe_unused]]
|
||||||
static ox::Error runScene(turbine::Context &tctx) {
|
static ox::Error runScene(turbine::Context &tctx) {
|
||||||
constexpr ox::StringView SceneAddr{"/Scenes/Chester.nscn"};
|
constexpr ox::StringView SceneAddr{"/Scenes/Chester.nscn"};
|
||||||
OX_REQUIRE_M(cctx, core::init(tctx));
|
oxRequireM(cctx, core::init(tctx));
|
||||||
OX_REQUIRE(scn, keel::readObj<scene::SceneStatic>(keelCtx(tctx), SceneAddr));
|
oxRequire(scn, keel::readObj<scene::SceneStatic>(keelCtx(tctx), SceneAddr));
|
||||||
turbine::setUpdateHandler(tctx, sceneUpdateHandler);
|
turbine::setUpdateHandler(tctx, sceneUpdateHandler);
|
||||||
turbine::setKeyEventHandler(tctx, sceneKeyEventHandler);
|
turbine::setKeyEventHandler(tctx, sceneKeyEventHandler);
|
||||||
scene::Scene const scene(*scn);
|
scene::Scene const scene(*scn);
|
||||||
OX_RETURN_ERROR(scene.setupDisplay(*cctx));
|
oxReturnError(scene.setupDisplay(*cctx));
|
||||||
return turbine::run(tctx);
|
return turbine::run(tctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ ox::Error run(
|
|||||||
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];
|
auto const path = args[1];
|
||||||
OX_REQUIRE_M(fs, keel::loadRomFs(path));
|
oxRequireM(fs, keel::loadRomFs(path));
|
||||||
OX_REQUIRE_M(tctx, turbine::init(std::move(fs), project));
|
oxRequireM(tctx, turbine::init(std::move(fs), project));
|
||||||
return runTileSheetSetTest(*tctx);
|
return runTileSheetSetTest(*tctx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ target_link_libraries(
|
|||||||
|
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
NostalgiaStudio PUBLIC
|
NostalgiaStudio PUBLIC
|
||||||
OLYMPIC_APP_VERSION="d2024.12.0"
|
OLYMPIC_APP_VERSION="dev build"
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::FileAddress const
|
|||||||
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::StringViewCR path) noexcept;
|
ox::Result<std::size_t> getPreloadAddr(keel::Context &ctx, ox::StringViewCR path) noexcept;
|
||||||
|
|
||||||
|
|
||||||
void createUuidMapping(Context &ctx, ox::StringViewCR filePath, ox::UUID const&uuid) noexcept;
|
void createUuidMapping(Context &ctx, ox::StringView filePath, ox::UUID const&uuid) noexcept;
|
||||||
|
|
||||||
ox::Error buildUuidMap(Context &ctx) noexcept;
|
ox::Error buildUuidMap(Context &ctx) noexcept;
|
||||||
|
|
||||||
@@ -41,17 +41,17 @@ ox::Result<ox::UUID> pathToUuid(Context &ctx, ox::StringViewCR path) noexcept;
|
|||||||
|
|
||||||
ox::Result<ox::UUID> getUuid(Context &ctx, ox::FileAddress const&fileAddr) noexcept;
|
ox::Result<ox::UUID> getUuid(Context &ctx, ox::FileAddress const&fileAddr) noexcept;
|
||||||
|
|
||||||
ox::Result<ox::UUID> getUuid(Context &ctx, ox::StringViewCR path) noexcept;
|
ox::Result<ox::UUID> getUuid(Context &ctx, ox::StringView path) noexcept;
|
||||||
|
|
||||||
ox::Result<ox::CStringView> getPath(Context &ctx, ox::FileAddress const&fileAddr) noexcept;
|
ox::Result<ox::CStringView> getPath(Context &ctx, ox::FileAddress const&fileAddr) noexcept;
|
||||||
|
|
||||||
ox::Result<ox::CStringView> getPath(Context &ctx, ox::CStringViewCR fileId) noexcept;
|
ox::Result<ox::CStringView> getPath(Context &ctx, ox::CStringView fileId) noexcept;
|
||||||
|
|
||||||
constexpr ox::Result<ox::UUID> uuidUrlToUuid(ox::StringViewCR uuidUrl) noexcept {
|
constexpr ox::Result<ox::UUID> uuidUrlToUuid(ox::StringView uuidUrl) noexcept {
|
||||||
return ox::UUID::fromString(substr(uuidUrl, 7));
|
return ox::UUID::fromString(substr(uuidUrl, 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Result<ox::CStringView> uuidUrlToPath(Context &ctx, ox::StringViewCR uuid) noexcept;
|
ox::Result<ox::CStringView> uuidUrlToPath(Context &ctx, ox::StringView uuid) noexcept;
|
||||||
|
|
||||||
ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::StringViewCR uuid) noexcept;
|
ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::StringViewCR uuid) noexcept;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::UUID const&uuid) noexce
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr auto makeLoader(Context &ctx) {
|
constexpr auto makeLoader(Context &ctx) {
|
||||||
return [&ctx](ox::StringViewCR assetId) -> ox::Result<T> {
|
return [&ctx](ox::StringView assetId) -> ox::Result<T> {
|
||||||
OX_REQUIRE(p, ctx.uuidToPath.at(assetId));
|
OX_REQUIRE(p, ctx.uuidToPath.at(assetId));
|
||||||
OX_REQUIRE(buff, ctx.rom->read(*p));
|
OX_REQUIRE(buff, ctx.rom->read(*p));
|
||||||
auto [obj, err] = readAsset<T>(buff);
|
auto [obj, err] = readAsset<T>(buff);
|
||||||
@@ -80,34 +80,27 @@ constexpr auto makeLoader(Context &ctx) {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
ox::Result<keel::AssetRef<T>> readObjFile(
|
ox::Result<keel::AssetRef<T>> readObjFile(
|
||||||
keel::Context &ctx,
|
keel::Context &ctx,
|
||||||
ox::StringViewCR assetId,
|
ox::StringView assetId,
|
||||||
bool const forceLoad) noexcept {
|
bool forceLoad) noexcept {
|
||||||
static constexpr auto load = [](
|
|
||||||
keel::Context &ctx,
|
|
||||||
ox::StringViewCR assetId,
|
|
||||||
bool forceLoad) -> ox::Result<keel::AssetRef<T>> {
|
|
||||||
if (forceLoad) {
|
|
||||||
ctx.assetManager.initTypeManager<T>(detail::makeLoader<T>, ctx);
|
|
||||||
return ctx.assetManager.loadAsset<T>(assetId);
|
|
||||||
} else {
|
|
||||||
auto [cached, err] = ctx.assetManager.getAsset<T>(assetId);
|
|
||||||
if (err) {
|
|
||||||
ctx.assetManager.initTypeManager<T>(detail::makeLoader<T>, ctx);
|
|
||||||
OX_RETURN_ERROR(ctx.assetManager.loadAsset<T>(assetId).moveTo(cached));
|
|
||||||
}
|
|
||||||
return cached;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if (beginsWith(assetId, "uuid://")) {
|
if (beginsWith(assetId, "uuid://")) {
|
||||||
return load(ctx, substr(assetId, 7), forceLoad);
|
assetId = substr(assetId, 7);
|
||||||
} else {
|
} else {
|
||||||
auto const [uuid, uuidErr] = getUuid(ctx, assetId);
|
auto const [uuid, uuidErr] = getUuid(ctx, assetId);
|
||||||
if (!uuidErr) {
|
if (!uuidErr) {
|
||||||
return load(ctx, uuid.toString(), forceLoad);
|
assetId = uuid.toString();
|
||||||
} else {
|
|
||||||
return load(ctx, assetId, forceLoad);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (forceLoad) {
|
||||||
|
ctx.assetManager.initTypeManager<T>(detail::makeLoader<T>, ctx);
|
||||||
|
return ctx.assetManager.loadAsset<T>(assetId);
|
||||||
|
} else {
|
||||||
|
auto [cached, err] = ctx.assetManager.getAsset<T>(assetId);
|
||||||
|
if (err) {
|
||||||
|
ctx.assetManager.initTypeManager<T>(detail::makeLoader<T>, ctx);
|
||||||
|
OX_RETURN_ERROR(ctx.assetManager.loadAsset<T>(assetId).moveTo(cached));
|
||||||
|
}
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -126,7 +119,7 @@ ox::Result<keel::AssetRef<T>> readObjNoCache(
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ox::Error reloadAsset(keel::Context &ctx, ox::StringViewCR assetId) noexcept;
|
ox::Error reloadAsset(keel::Context &ctx, ox::StringView assetId) noexcept;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ox::Result<keel::AssetRef<T>> readObj(
|
ox::Result<keel::AssetRef<T>> readObj(
|
||||||
@@ -170,7 +163,7 @@ ox::Error writeObj(
|
|||||||
|
|
||||||
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs) noexcept;
|
ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs) noexcept;
|
||||||
|
|
||||||
ox::Result<ox::UPtr<ox::FileSystem>> loadRomFs(ox::StringViewCR path) noexcept;
|
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(ox::StringViewCR path) noexcept;
|
||||||
|
|
||||||
ox::Result<char*> loadRom(ox::StringViewCR path = "") noexcept;
|
ox::Result<char*> loadRom(ox::StringViewCR path = "") noexcept;
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ static void clearUuidMap(Context &ctx) noexcept {
|
|||||||
ctx.pathToUuid.clear();
|
ctx.pathToUuid.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void createUuidMapping(Context &ctx, ox::StringViewCR filePath, ox::UUID const&uuid) noexcept {
|
void createUuidMapping(Context &ctx, ox::StringView filePath, ox::UUID const&uuid) noexcept {
|
||||||
ctx.pathToUuid[filePath] = uuid;
|
ctx.pathToUuid[filePath] = uuid;
|
||||||
ctx.uuidToPath[uuid.toString()] = filePath;
|
ctx.uuidToPath[uuid.toString()] = filePath;
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ ox::Result<ox::UUID> getUuid(Context &ctx, ox::FileAddress const&fileAddr) noexc
|
|||||||
return getUuid(ctx, path);
|
return getUuid(ctx, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Result<ox::UUID> getUuid(Context &ctx, ox::StringViewCR path) noexcept {
|
ox::Result<ox::UUID> getUuid(Context &ctx, ox::StringView path) noexcept {
|
||||||
if (beginsWith(path, "uuid://")) {
|
if (beginsWith(path, "uuid://")) {
|
||||||
auto const uuid = substr(path, 7);
|
auto const uuid = substr(path, 7);
|
||||||
return ox::UUID::fromString(uuid);
|
return ox::UUID::fromString(uuid);
|
||||||
@@ -112,7 +112,7 @@ ox::Result<ox::CStringView> getPath(Context &ctx, ox::FileAddress const&fileAddr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Result<ox::CStringView> getPath(Context &ctx, ox::CStringViewCR fileId) noexcept {
|
ox::Result<ox::CStringView> getPath(Context &ctx, ox::CStringView fileId) noexcept {
|
||||||
if (beginsWith(fileId, "uuid://")) {
|
if (beginsWith(fileId, "uuid://")) {
|
||||||
auto const uuid = substr(fileId, 7);
|
auto const uuid = substr(fileId, 7);
|
||||||
#ifndef OX_BARE_METAL
|
#ifndef OX_BARE_METAL
|
||||||
@@ -126,9 +126,10 @@ ox::Result<ox::CStringView> getPath(Context &ctx, ox::CStringViewCR fileId) noex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Result<ox::CStringView> uuidUrlToPath(Context &ctx, ox::StringViewCR uuid) noexcept {
|
ox::Result<ox::CStringView> uuidUrlToPath(Context &ctx, ox::StringView uuid) noexcept {
|
||||||
|
uuid = substr(uuid, 7);
|
||||||
#ifndef OX_BARE_METAL
|
#ifndef OX_BARE_METAL
|
||||||
OX_REQUIRE_M(out, ctx.uuidToPath.at(substr(uuid, 7)));
|
OX_REQUIRE_M(out, ctx.uuidToPath.at(uuid));
|
||||||
return ox::CStringView(*out);
|
return ox::CStringView(*out);
|
||||||
#else
|
#else
|
||||||
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
return ox::Error(1, "UUID to path conversion not supported on this platform");
|
||||||
@@ -153,18 +154,19 @@ ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::UUID const&uuid) noexce
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error reloadAsset(keel::Context &ctx, ox::StringViewCR assetId) noexcept {
|
ox::Error reloadAsset(keel::Context &ctx, ox::StringView assetId) noexcept {
|
||||||
ox::UUIDStr uuidStr;
|
ox::UUIDStr uuidStr;
|
||||||
if (beginsWith(assetId, "uuid://")) {
|
if (beginsWith(assetId, "uuid://")) {
|
||||||
return ctx.assetManager.reloadAsset(substr(assetId, 7));
|
assetId = substr(assetId, 7);
|
||||||
|
OX_REQUIRE(p, keel::uuidToPath(ctx, assetId));
|
||||||
} else {
|
} else {
|
||||||
auto const [uuid, uuidErr] = getUuid(ctx, assetId);
|
auto const [uuid, uuidErr] = getUuid(ctx, assetId);
|
||||||
if (!uuidErr) {
|
if (!uuidErr) {
|
||||||
return ctx.assetManager.reloadAsset(uuidStr);
|
uuidStr = uuid.toString();
|
||||||
} else {
|
assetId = uuidStr;
|
||||||
return ctx.assetManager.reloadAsset(assetId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ctx.assetManager.reloadAsset(assetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -236,7 +238,7 @@ ox::Error setRomFs(Context &ctx, ox::UPtr<ox::FileSystem> &&fs) noexcept {
|
|||||||
return buildUuidMap(ctx);
|
return buildUuidMap(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Result<ox::UPtr<ox::FileSystem>> loadRomFs(ox::StringViewCR path) noexcept {
|
ox::Result<ox::UniquePtr<ox::FileSystem>> loadRomFs(ox::StringViewCR path) noexcept {
|
||||||
auto const lastDot = ox::lastIndexOf(path, '.');
|
auto const lastDot = ox::lastIndexOf(path, '.');
|
||||||
if (!lastDot.error && substr(path, lastDot.value) == ".oxfs") {
|
if (!lastDot.error && substr(path, lastDot.value) == ".oxfs") {
|
||||||
OX_REQUIRE(rom, loadRom(path));
|
OX_REQUIRE(rom, loadRom(path));
|
||||||
|
|||||||
Reference in New Issue
Block a user