Files
ox/src/nostalgia/player/main.cpp
T

43 lines
1.1 KiB
C++

/*
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
*/
#include <ox/logconn/logconn.hpp>
#include <keel/media.hpp>
#include <nostalgia/modules/keelmodules.hpp>
#include "app.hpp"
static ox::Error run(int argc, const char **argv) noexcept {
ox::trace::init();
#ifdef OX_USE_STDLIB
// GBA doesn't need the modules and calling this doubles the size of the
// binary.
nostalgia::registerKeelModules();
#endif
if (argc < 2) {
oxErr("Please provide path to project directory or OxFS file.\n");
return OxError(1);
}
const auto path = argv[1];
oxRequireM(fs, keel::loadRomFs(path));
return run(std::move(fs));
}
int main(int argc, const char **argv) {
#ifdef DEBUG
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);
}
#endif
const auto err = run(argc, argv);
oxAssert(err, "Something went wrong...");
return static_cast<int>(err);
}