Enable bundled AMMC tools and document decoder simulation

This commit is contained in:
larssand
2026-09-02 21:13:49 +02:00
parent 9aeb638211
commit f2ba4b3c7b
14 changed files with 123 additions and 29 deletions

View File

@@ -62,26 +62,52 @@ if (process.platform === "win32") {
console.log(`[verify] AMMC Windows runtime: ${ammcDir}`);
}
if (process.platform === "linux" && process.arch === "x64") {
const ammcPath = path.join(root, "AMMC", "linux_x86-64", "ammc-amb");
const requiredGlibc = "2.39";
if (!fs.existsSync(ammcPath)) {
warn(`Bundled Linux AMMC binary is missing: ${ammcPath}`);
} else {
try {
fs.accessSync(ammcPath, fs.constants.X_OK);
} catch {
warn(`Bundled Linux AMMC is not executable. Run: chmod +x AMMC/linux_x86-64/ammc-amb`);
}
function verifyUnixAmmcExecutables(directory, executableNames, runtimeLabel) {
const missingFiles = [];
const nonExecutableFiles = [];
const glibcVersion = process.report?.getReport?.().header?.glibcVersionRuntime || "";
if (!glibcVersion) {
warn(`Could not detect the host GLIBC version. The bundled Linux AMMC requires GLIBC ${requiredGlibc} or newer.`);
} else if (compareVersions(glibcVersion, requiredGlibc) < 0) {
warn(`Host GLIBC ${glibcVersion} is too old for the bundled Linux AMMC (requires >= ${requiredGlibc}). RC RaceCore can still run, but use a compatible AMMC build or a newer Linux distribution. Do not replace the system GLIBC manually.`);
} else {
console.log(`[verify] AMMC Linux runtime: ${ammcPath} (GLIBC ${glibcVersion}, requires >= ${requiredGlibc})`);
for (const executableName of executableNames) {
const executablePath = path.join(directory, executableName);
if (!fs.existsSync(executablePath)) {
missingFiles.push(executableName);
continue;
}
try {
fs.accessSync(executablePath, fs.constants.X_OK);
} catch {
nonExecutableFiles.push(executableName);
}
}
if (missingFiles.length > 0) {
warn(`Bundled ${runtimeLabel} tools are missing: ${missingFiles.join(", ")}`);
}
if (nonExecutableFiles.length > 0) {
warn(`Bundled ${runtimeLabel} tools are not executable: ${nonExecutableFiles.join(", ")}. Run: chmod +x ${path.relative(root, directory)}/ammc-*`);
}
return missingFiles.length === 0 && nonExecutableFiles.length === 0;
}
if (process.platform === "linux" && process.arch === "x64") {
const ammcDir = path.join(root, "AMMC", "linux_x86-64");
const executableNames = ["ammc-amb", "ammc-prochip", "ammc-sim", "ammc-vostok", "ammc-x2"];
const requiredGlibc = "2.39";
const runtimeReady = verifyUnixAmmcExecutables(ammcDir, executableNames, "Linux AMMC");
const glibcVersion = process.report?.getReport?.().header?.glibcVersionRuntime || "";
if (!glibcVersion) {
warn(`Could not detect the host GLIBC version. The bundled Linux AMMC tools require GLIBC ${requiredGlibc} or newer.`);
} else if (compareVersions(glibcVersion, requiredGlibc) < 0) {
warn(`Host GLIBC ${glibcVersion} is too old for the bundled Linux AMMC tools (requires >= ${requiredGlibc}). RC RaceCore can still run, but use a compatible AMMC build or a newer Linux distribution. Do not replace the system GLIBC manually.`);
} else if (runtimeReady) {
console.log(`[verify] AMMC Linux runtime: ${ammcDir} (all tools executable; GLIBC ${glibcVersion}, requires >= ${requiredGlibc})`);
}
}
if (process.platform === "darwin" && process.arch === "arm64") {
const ammcDir = path.join(root, "AMMC", "apple_m");
const executableNames = ["ammc-amb", "ammc-prochip", "ammc-sim", "ammc-vostok"];
if (verifyUnixAmmcExecutables(ammcDir, executableNames, "Apple Silicon AMMC")) {
console.log(`[verify] AMMC Apple Silicon runtime: ${ammcDir} (all tools executable)`);
}
}