66 lines
2.8 KiB
C++
66 lines
2.8 KiB
C++
#include "core/log.hpp"
|
|||
|
|
#include "game/game_app.hpp"
|
||
|
|
|
||
|
|
#include <cstdlib>
|
||
|
|
#include <cstring>
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
using namespace top_octane;
|
||
|
|
|
||
|
|
namespace {
|
||
|
|
|
||
|
|
void print_usage(const char* argv0) {
|
||
|
|
std::cout << "Top-Octane (Modern Cross-Platform SDL2 + OpenGL 3.3 Port of Hi-Octane)\n"
|
||
|
|
<< "Usage: " << argv0 << " [options]\n"
|
||
|
|
<< " --data-dir <path> Path to read-only assets folder (default: ./data)\n"
|
||
|
|
<< " --track <1..6> Launch straight into race on track 1..6\n"
|
||
|
|
<< " --track-viewer <1..6> Open interactive 3D track viewer for track 1..6\n"
|
||
|
|
<< " --classic Start in 4:3 Classic palette visual mode\n"
|
||
|
|
<< " --fullscreen Start in borderless fullscreen\n"
|
||
|
|
<< " --music-backend <opl3|sf|custom> Select music synth backend\n"
|
||
|
|
<< " --skip-intro Skip INTRO.DAT movie\n"
|
||
|
|
<< " --smoke-test <frames> Render N frames and exit cleanly\n"
|
||
|
|
<< " --help Show this help\n";
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace
|
||
|
|
|
||
|
|
int main(int argc, char** argv) {
|
||
|
|
game::LaunchOptions opts;
|
||
|
|
for (int i = 1; i < argc; ++i) {
|
||
|
|
if (std::strcmp(argv[i], "--help") == 0 || std::strcmp(argv[i], "-h") == 0) {
|
||
|
|
print_usage(argv[0]);
|
||
|
|
return 0;
|
||
|
|
} else if (std::strcmp(argv[i], "--data-dir") == 0 && i + 1 < argc) {
|
||
|
|
opts.data_dir = argv[++i];
|
||
|
|
} else if (std::strcmp(argv[i], "--track") == 0 && i + 1 < argc) {
|
||
|
|
opts.start_track = std::atoi(argv[++i]);
|
||
|
|
} else if (std::strcmp(argv[i], "--track-viewer") == 0 && i + 1 < argc) {
|
||
|
|
opts.start_track = std::atoi(argv[++i]);
|
||
|
|
opts.track_viewer = true;
|
||
|
|
} else if (std::strcmp(argv[i], "--classic") == 0) {
|
||
|
|
opts.force_classic = true;
|
||
|
|
} else if (std::strcmp(argv[i], "--fullscreen") == 0) {
|
||
|
|
opts.force_fullscreen = true;
|
||
|
|
} else if (std::strcmp(argv[i], "--music-backend") == 0 && i + 1 < argc) {
|
||
|
|
const char* b = argv[++i];
|
||
|
|
if (std::strcmp(b, "opl3") == 0) opts.force_backend = 0;
|
||
|
|
else if (std::strcmp(b, "sf") == 0 || std::strcmp(b, "soundfont") == 0) opts.force_backend = 1;
|
||
|
|
else if (std::strcmp(b, "custom") == 0) opts.force_backend = 2;
|
||
|
|
} else if (std::strcmp(argv[i], "--skip-intro") == 0) {
|
||
|
|
opts.skip_intro = true;
|
||
|
|
} else if (std::strcmp(argv[i], "--smoke-test") == 0 && i + 1 < argc) {
|
||
|
|
opts.smoke_test_frames = std::atoi(argv[++i]);
|
||
|
|
} else {
|
||
|
|
LOG_WARN("Unknown argument: %s", argv[i]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
game::GameApp app;
|
||
|
|
if (!app.init(opts)) {
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
int rc = app.run();
|
||
|
|
app.shutdown();
|
||
|
|
return rc;
|
||
|
|
}
|