[nostalgia] Split part of Core out into Foundation, add module system

This commit is contained in:
2023-02-03 00:41:24 -06:00
parent 83589287bc
commit 7868b0678f
50 changed files with 742 additions and 470 deletions
+1
View File
@@ -5,6 +5,7 @@ target_link_libraries(
OxClArgs
OxLogConn
NostalgiaPack
NostalgiaAppModules
)
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT WIN32)
+3 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <fstream>
@@ -8,6 +8,7 @@
#include <ox/fs/fs.hpp>
#include <ox/logconn/logconn.hpp>
#include <nostalgia/appmodules/appmodules.hpp>
#include <nostalgia/core/typestore.hpp>
#include "pack/pack.hpp"
@@ -43,6 +44,7 @@ static ox::Result<ox::Buffer> readFileBuff(ox::CRStringView path) noexcept {
}
static ox::Error run(const ox::ClArgs &args) noexcept {
loadModules();
const auto argSrc = args.getString("src", "");
const auto argRomBin = args.getString("rom-bin", "");
if (argSrc == "") {
+1
View File
@@ -7,6 +7,7 @@ add_library(
target_link_libraries(
NostalgiaPack PUBLIC
NostalgiaCore-Headless
NostalgiaFoundation
OxPreloader
)
+4 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/claw/read.hpp>
@@ -8,9 +8,9 @@
#include <ox/model/modelvalue.hpp>
#include <nostalgia/core/gfx.hpp>
#include <nostalgia/core/media.hpp>
#include <nostalgia/core/typeconv.hpp>
#include <nostalgia/core/typestore.hpp>
#include <nostalgia/foundation/media.hpp>
#include "pack.hpp"
@@ -64,7 +64,7 @@ static ox::Error doTransformations(core::TypeStore *ts, ox::FileSystem *dest, ox
oxRequire(s, dest->stat(filePath));
oxRequireM(buff, dest->read(s.inode));
if (endsWith(filePath, ".ng")) {
oxReturnError(core::convertBuffToBuff<core::CompactTileSheet>(buff, ox::ClawFormat::Metal).moveTo(&buff));
oxReturnError(foundation::convertBuffToBuff<core::CompactTileSheet>(nullptr, buff, ox::ClawFormat::Metal).moveTo(&buff));
}
oxRequireM(obj, ox::readClaw(ts, buff));
// do transformations
@@ -153,7 +153,7 @@ static ox::Error preloadObj(core::TypeStore *ts, ox::FileSystem *romFs, GbaPrelo
const auto err = ox::preload<GbaPlatSpec, decltype(obj)>(pl, &obj);
oxReturnError(pl->endAlloc());
oxReturnError(err);
const core::PreloadPtr p{.preloadAddr = static_cast<uint32_t>(a)};
const foundation::PreloadPtr p{.preloadAddr = static_cast<uint32_t>(a)};
oxReturnError(ox::writeMC(&p).moveTo(&buff));
} else {
// strip the Claw header (it is not needed after preloading) and write back out to dest fs
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/preloader/preloader.hpp>