mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 12:19:19 +02:00
Enable --eu7v2-bake from the main binary: parallel module pool, bounded-RAM spool flush, streaming terrain triangles, flat include/model parsing, and eu7v2 emit/load with optional verify. Large placement .scm files emit lean PLCE records and bake referenced .inc modules separately for reuse. - CLI: --eu7v2-bake, --eu7v2-verify, --eu7v2-mem-limit-gb, --eu7v2-threads, --eu7v2-max-parse; wire max_threads through to the bake parser - eu7v2 v2 records: PLCE placements, runtime emitter/loader, batch verify - Parallel bake pool with session cache; drop heavy-serial parse gate in spool mode; parse concurrency matches thread count - Streaming terrain: batched parallel parse+bake, scan/bake pipeline, shape spool with persistent buffered I/O and flush-before-read - Parallel flat-file streaming for models/includes; pack/model spool for low-memory incremental flush - Optional 50 GB private-bytes guard during headless bake Braniewo_szeroki: 160 modules, verify PASS, ~34s bake (nmt100 ~17s vs ~190s serial baseline). Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
|
|
namespace scene::eu7::bake_parser {
|
|
|
|
[[nodiscard]] bool
|
|
bake_scenario_tree(
|
|
std::string const &TextScenarioPath,
|
|
unsigned MaxThreads,
|
|
std::string &ErrorOut );
|
|
|
|
// Result of a headless text -> eu7v2 bake (and optional roundtrip verify).
|
|
struct Eu7v2BakeReport {
|
|
bool baked { false }; // bake tree completed without throwing
|
|
bool verify_requested { false };
|
|
bool verify_ok { true }; // all per-module record counts matched
|
|
std::size_t module_count { 0 };
|
|
std::size_t model_count { 0 };
|
|
std::string root_binary_path; // emitted root .eu7v2
|
|
std::string error;
|
|
};
|
|
|
|
// Bakes the whole text scenery tree directly into .eu7v2 modules (no legacy
|
|
// .eu7). When Verify is set each emitted module is reloaded and its record
|
|
// counts are compared against the source RuntimeModule, with a PASS/FAIL
|
|
// report printed to stdout. This is the headless consistency guard.
|
|
// MemLimitGb: abort when process private memory exceeds this (0 = no limit).
|
|
// Default 50 when called from headless CLI.
|
|
// MaxConcurrentParses: cap parallel parseFile/processScene (0 = auto: 1 with MemLimitGb spool).
|
|
// MaxThreads 0 with spool = 1 (serial module bake); use --eu7v2-threads N to override.
|
|
[[nodiscard]] Eu7v2BakeReport
|
|
bake_scenario_tree_eu7v2(
|
|
std::string const &TextScenarioPath,
|
|
unsigned MaxThreads,
|
|
bool Verify,
|
|
unsigned MemLimitGb = 50u,
|
|
unsigned MaxConcurrentParses = 0u,
|
|
unsigned HeavyParseThresholdMb = 0u );
|
|
|
|
} // namespace scene::eu7::bake_parser
|