[nostalgia] Split part of Core out into Foundation, add module system
This commit is contained in:
@@ -16,6 +16,7 @@ target_link_libraries(
|
||||
nostalgia-studio
|
||||
OxClArgs
|
||||
OxLogConn
|
||||
NostalgiaAppModules
|
||||
NostalgiaStudio
|
||||
NostalgiaCore-Studio
|
||||
)
|
||||
|
@@ -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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -13,8 +13,8 @@ namespace nostalgia {
|
||||
[[maybe_unused]] // GCC warns about the existence of this "unused" constexpr list in a header file...
|
||||
constexpr auto BuiltinModules = {
|
||||
[] {
|
||||
return ox::make_unique<core::Module>();
|
||||
return ox::make_unique<core::StudioModule>();
|
||||
},
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,13 @@
|
||||
/*
|
||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/logconn/logconn.hpp>
|
||||
|
||||
#include <ox/std/trace.hpp>
|
||||
|
||||
#include <nostalgia/appmodules/appmodules.hpp>
|
||||
#include <nostalgia/core/core.hpp>
|
||||
#include <nostalgia/foundation/media.hpp>
|
||||
|
||||
#include "lib/context.hpp"
|
||||
#include "studioapp.hpp"
|
||||
@@ -55,18 +56,10 @@ static ox::Error run(ox::UniquePtr<ox::FileSystem> fs) noexcept {
|
||||
|
||||
static ox::Error run(int argc, const char **argv) noexcept {
|
||||
ox::trace::init();
|
||||
#ifdef DEBUG
|
||||
ox::LoggerConn loggerConn;
|
||||
const auto loggerErr = loggerConn.initConn("Nostalgia Studio");
|
||||
if (loggerErr) {
|
||||
oxErrf("Could not connect to logger: {}\n", toStr(loggerErr));
|
||||
} else {
|
||||
ox::trace::setLogger(&loggerConn);
|
||||
}
|
||||
#endif
|
||||
loadModules();
|
||||
if (argc >= 2) {
|
||||
const auto path = argv[1];
|
||||
oxRequireM(fs, core::loadRomFs(path));
|
||||
oxRequireM(fs, foundation::loadRomFs(path));
|
||||
return run(std::move(fs));
|
||||
} else {
|
||||
return run(ox::UniquePtr<ox::FileSystem>(nullptr));
|
||||
@@ -76,6 +69,15 @@ static ox::Error run(int argc, const char **argv) noexcept {
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv) {
|
||||
#ifdef DEBUG
|
||||
ox::LoggerConn loggerConn;
|
||||
const auto loggerErr = loggerConn.initConn("Nostalgia Studio");
|
||||
if (loggerErr) {
|
||||
oxErrf("Could not connect to logger: {}\n", toStr(loggerErr));
|
||||
} else {
|
||||
ox::trace::setLogger(&loggerConn);
|
||||
}
|
||||
#endif
|
||||
const auto err = nostalgia::run(argc, argv);
|
||||
oxAssert(err, "Something went wrong...");
|
||||
return static_cast<int>(err);
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include <imgui.h>
|
||||
|
||||
#include <nostalgia/core/core.hpp>
|
||||
#include <nostalgia/foundation/media.hpp>
|
||||
|
||||
#include "lib/configio.hpp"
|
||||
#include "builtinmodules.hpp"
|
||||
@@ -284,7 +285,7 @@ void StudioUI::save() noexcept {
|
||||
}
|
||||
|
||||
ox::Error StudioUI::openProject(ox::CRStringView path) noexcept {
|
||||
oxRequireM(fs, core::loadRomFs(path));
|
||||
oxRequireM(fs, foundation::loadRomFs(path));
|
||||
m_ctx->rom = std::move(fs);
|
||||
core::setWindowTitle(m_ctx, ox::sfmt("Nostalgia Studio - {}", path));
|
||||
m_project = ox::make_unique<studio::Project>(m_ctx->rom.get(), path);
|
||||
|
Reference in New Issue
Block a user