[keel,nostalgia,turbine] Cleanup

This commit is contained in:
2023-11-23 01:46:11 -06:00
parent a84a829769
commit b946e428ad
30 changed files with 120 additions and 122 deletions
+1 -2
View File
@@ -33,7 +33,6 @@ static void keyEventHandler(turbine::Context &tctx, turbine::Key key, bool down)
}
ox::Error run(ox::UniquePtr<ox::FileSystem> &&fs) noexcept {
oxTraceInitHook();
oxRequireM(tctx, turbine::init(std::move(fs), "Nostalgia"));
oxRequireM(cctx, core::init(tctx.get()));
constexpr ox::FileAddress SceneAddr("/Scenes/Chester.nscn");
@@ -41,6 +40,6 @@ ox::Error run(ox::UniquePtr<ox::FileSystem> &&fs) noexcept {
turbine::setUpdateHandler(*tctx, updateHandler);
turbine::setKeyEventHandler(*tctx, keyEventHandler);
s_scene.emplace(*scn);
oxReturnError(s_scene->setupDisplay(cctx.get()));
oxReturnError(s_scene->setupDisplay(*cctx));
return turbine::run(*tctx);
}
+13 -10
View File
@@ -2,6 +2,7 @@
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/logconn/def.hpp>
#include <ox/logconn/logconn.hpp>
#include <keel/media.hpp>
@@ -11,8 +12,7 @@
#include "app.hpp"
static ox::Error run(int argc, const char **argv) noexcept {
ox::trace::init();
#ifdef OX_USE_STDLIB
#ifndef OX_BARE_METAL
// GBA doesn't need the modules and calling this doubles the size of the
// binary.
nostalgia::registerKeelModules();
@@ -33,16 +33,19 @@ int WinMain() {
#else
int main(int argc, const char **argv) {
#endif
#if defined(DEBUG) && !defined(OX_BARE_METAL)
ox::LoggerConn loggerConn;
const auto loggerErr = loggerConn.initConn("Nostalgia Player");
if (loggerErr) {
oxErrf("Could not connect to logger: {} ({}:{})\n", toStr(loggerErr), loggerErr.file, loggerErr.line);
} else {
ox::trace::setLogger(&loggerConn);
OX_INIT_DEBUG_LOGGER(loggerConn, "Nostalgia Player")
ox::Error err;
#ifdef __cpp_exceptions
try {
err = run(argc, argv);
} catch (ox::Exception const&ex) {
err = ex.toError();
} catch (...) {
err = OxError(1, "Non-Ox exception");
}
#else
err = run(argc, argv);
#endif
const auto err = run(argc, argv);
oxAssert(err, "Something went wrong...");
return static_cast<int>(err);
}