Complete Classic BMH and FLTD installation imports (by Codex)

This commit is contained in:
Codex committed 2026-10-18 10:07:38 +02:00
1 parent 65b087c1d0
commit 3a021fc160
32 files changed
+2297 -203

No files matched your search

+27 -7
View File
@@ -9,7 +9,7 @@
int main(int argc, char** argv) {
try {
const auto args = bmh::launch::utf8_arguments(argc, argv);
std::filesystem::path source, destination;
std::filesystem::path source, destination, validate_path;
bmh::obw::Options options;
bool directory = false;
for (size_t i = 1; i < args.size(); ++i) {
@@ -17,11 +17,14 @@ int main(int argc, char** argv) {
if (arg == "--help" || arg == "-h") {
std::cout << "OpenBMH installation-to-OBW converter\n"
"Usage: openbmh_import --data DIR_OR_EXE --output WORLD.obw\n"
" --start-date YYYY-07-01 [--title TEXT] [--directory]\n\n"
"Reads BMH.EXE/M3D.MAN/TEXTD.BLK or FLTD.EXE/M3E.MAN/TEXTE.BLK.\n"
" --start-date YYYY-07-01 [--mod BMH-classic|FLTD-classic]\n"
" [--title TEXT] [--directory] [--database-only]\n"
" openbmh_import --validate WORLD.obw_OR_DIRECTORY\n\n"
"Imports a complete BMH or Football Limited installation, including media.\n"
"--directory writes an unpacked world instead of a ZIP archive.\n"
"Existing destinations are never overwritten. Imported content stays local.\n"
"Conversion profile only: no game loading, FBM saves or graphics yet.\n";
"--database-only explicitly selects the old partial development export.\n"
"Classic content targets the 0.2 adapter; 0.1 cannot load OBW. No FBM conversion.\n";
return 0;
}
if (arg == "--version") {
@@ -29,13 +32,29 @@ int main(int argc, char** argv) {
return 0;
}
if (arg == "--directory") { directory = true; continue; }
if (arg != "--data" && arg != "--output" && arg != "--start-date" && arg != "--title")
if (arg == "--database-only") { options.database_only = true; continue; }
if (arg != "--data" && arg != "--output" && arg != "--start-date" && arg != "--title" &&
arg != "--mod" && arg != "--validate")
throw std::runtime_error("unknown option: " + arg);
if (++i == args.size()) throw std::runtime_error("missing value for " + arg);
if (arg == "--data") source = bmh::launch::path_from_utf8(args[i]);
if (arg == "--output") destination = bmh::launch::path_from_utf8(args[i]);
if (arg == "--start-date") options.start_date = args[i];
if (arg == "--title") options.title = args[i];
if (arg == "--mod") {
options.mod = args[i];
if (options.mod == "FTDL-classic" || options.mod == "FTLD-classic") options.mod = "FLTD-classic";
if (options.mod != "BMH-classic" && options.mod != "FLTD-classic")
throw std::runtime_error("--mod must be BMH-classic or FLTD-classic");
}
if (arg == "--validate") validate_path = bmh::launch::path_from_utf8(args[i]);
}
if (!validate_path.empty()) {
if (!source.empty() || !destination.empty() || !options.start_date.empty() || !options.mod.empty() || directory || options.database_only)
throw std::runtime_error("--validate cannot be combined with conversion options");
const auto documents = bmh::obw::read(validate_path);
std::cout << "Valid OBW content: " << documents.size() << " entries; no engine runtime test implied.\n";
return 0;
}
if (source.empty() || destination.empty() || options.start_date.empty())
throw std::runtime_error("--data, --output and --start-date are required; see --help");
@@ -45,8 +64,9 @@ int main(int argc, char** argv) {
bmh::obw::write(documents, destination, directory);
std::cout << "Converted " << documents.size() << " documents to "
<< bmh::launch::path_to_utf8(destination) << "\n"
<< "Profile: legacy-database-v1; content_license: local-import-only.\n"
<< "See x-legacy/import-report.json for coverage and remaining mappings.\n";
<< "Profile: " << (options.database_only ? "legacy-database-v1 (partial)" : "classic-installation-v1 (complete Classic content)")
<< "; content_license: local-import-only.\n"
<< "See manifest.json and x-legacy/import-report.json. 0.2 runtime integration is separate.\n";
return 0;
} catch (const std::exception& error) {
std::cerr << "openbmh_import: " << error.what() << '\n';