Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

1.8 KB
Raw Blame
#!/usr/bin/env python3
"""Render compat/README.md (markdown table sorted by status) from compat/games.json."""
import json
import os

ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ORDER = ["platinum", "gold", "silver", "bronze", "borked", "untested"]


def cell(v):
    return "-" if v in (None, "") else str(v).replace("|", "\\|").replace("\n", " ")


def main():
    games = json.load(open(os.path.join(ROOT, "compat", "games.json")))
    games.sort(key=lambda g: (ORDER.index(g.get("status", "untested")), g["name"].lower()))
    counts = {s: sum(1 for g in games if g.get("status") == s) for s in ORDER}
    lines = [
        "# Compatibility list",
        "",
        "Generated by `scripts/compat-table.py` from `games.json`; do not edit by hand. "
        "These are results a maintainer checked (`scripts/np-test-game.sh <appid>`, or a *Game report* issue). "
        "Players' one-tap reports from the app are posted to "
        "[Compatibility reports](https://github.com/raymondchins/Bridgeplay/discussions/categories/compatibility-reports) "
        "and counted on [bridgeplay.dev/compatibility](https://bridgeplay.dev/compatibility).",
        "",
        " / ".join(f"{s}: {n}" for s, n in counts.items()),
        "",
        "| Game | AppID | Status | Tested on | Backend | Engine | API | Anti-cheat | Last tested | Fork commit | Notes |",
        "|---|---|---|---|---|---|---|---|---|---|---|",
    ]
    for g in games:
        lines.append("| " + " | ".join(cell(x) for x in (
            g["name"], g["appid"], g.get("status"), g.get("tested_on"), g.get("backend"), g.get("engine"), g.get("api"),
            g.get("anticheat"), g.get("last_tested"), g.get("fork_commit"), g.get("notes"))) + " |")
    open(os.path.join(ROOT, "compat", "README.md"), "w").write("\n".join(lines) + "\n")


if __name__ == "__main__":
    main()