2026-11-30 22:31:51 +02:00
|
|
|
#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"
|
2026-12-01 09:19:20 +02:00
|
|
|
<< " --modern Start in Modern HDR lighting visual mode\n"
|
2026-11-30 22:31:51 +02:00
|
|
|
<< " --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"
|
2026-12-01 09:19:20 +02:00
|
|
|
<< " --screenshot <path.ppm> Save final smoke frame as RGB PPM\n"
|
2026-12-01 09:38:10 +02:00
|
|
|
<< " --menu <main|track|vehicle|options> Open specific menu screen on launch\n"
|
2026-11-30 22:31:51 +02:00
|
|
|
<< " --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;
|
2026-12-01 09:19:20 +02:00
|
|
|
} else if (std::strcmp(argv[i], "--modern") == 0) {
|
|
|
|
|
opts.force_modern = true;
|
2026-11-30 22:31:51 +02:00
|
|
|
} 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]);
|
2026-12-01 09:19:20 +02:00
|
|
|
} else if (std::strcmp(argv[i], "--screenshot") == 0 && i + 1 < argc) {
|
|
|
|
|
opts.screenshot_path = argv[++i];
|
2026-12-01 09:38:10 +02:00
|
|
|
} else if (std::strcmp(argv[i], "--menu") == 0 && i + 1 < argc) {
|
|
|
|
|
opts.smoke_menu = argv[++i];
|
2026-11-30 22:31:51 +02:00
|
|
|
} 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;
|
|
|
|
|
}
|