diff --git a/.github/workflows/progress-comment.yml b/.github/workflows/progress-comment.yml
new file mode 100644
index 000000000..05568e459
--- /dev/null
+++ b/.github/workflows/progress-comment.yml
@@ -0,0 +1,42 @@
+name: Progress comment
+
+on:
+ workflow_run:
+ workflows: [Progress report]
+ types: [completed]
+
+permissions:
+ actions: read
+ pull-requests: write
+
+jobs:
+ comment:
+ if: github.event.workflow_run.conclusion == 'success'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/download-artifact@v8
+ with:
+ name: progress-report
+ run-id: ${{ github.event.workflow_run.id }}
+ github-token: ${{ github.token }}
+ - env:
+ GH_TOKEN: ${{ github.token }}
+ GH_REPO: ${{ github.repository }}
+ RUN_SHA: ${{ github.event.workflow_run.head_sha }}
+ run: |
+ pr=$(cat pr)
+ [[ $pr =~ ^[0-9]+$ ]] || exit 1
+ [ "$(gh pr view "$pr" --json headRefOid --jq .headRefOid)" = "$RUN_SHA" ] || exit 0
+ marker=''
+ id=$(gh api "repos/$GH_REPO/issues/$pr/comments" --paginate \
+ --jq ".[] | select(.user.login == \"github-actions[bot]\" and (.body | startswith(\"$marker\"))) | .id" | head -n1)
+ if [ -f report.md ]; then
+ printf '%s\n%s' "$marker" "$(cat report.md)" > body.md
+ if [ -n "$id" ]; then
+ gh api -X PATCH "repos/$GH_REPO/issues/comments/$id" -F body=@body.md > /dev/null
+ else
+ gh pr comment "$pr" --body-file body.md
+ fi
+ elif [ -n "$id" ]; then
+ gh api -X DELETE "repos/$GH_REPO/issues/comments/$id"
+ fi
diff --git a/.github/workflows/progress-report.yml b/.github/workflows/progress-report.yml
new file mode 100644
index 000000000..3fbf7361b
--- /dev/null
+++ b/.github/workflows/progress-report.yml
@@ -0,0 +1,34 @@
+name: Progress report
+
+on:
+ pull_request:
+
+permissions:
+ contents: read
+
+jobs:
+ report:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ fetch-depth: 2
+ - env:
+ PR: ${{ github.event.pull_request.number }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: |
+ out=$RUNNER_TEMP/out report=$RUNNER_TEMP/report
+ git worktree add --detach "$RUNNER_TEMP/base" HEAD^1
+ python3 tools/progress.py --root "$RUNNER_TEMP/base" "$out/base"
+ python3 tools/progress.py "$out/head"
+ mkdir "$report"
+ echo "$PR" > "$report/pr"
+ body=$(python3 tools/progress.py --compare "$out/base/progress.json" "$out/head/progress.json")
+ if [ -n "$body" ]; then
+ printf '### Progress report (%s → %s)\n\n%s\n' "$(git rev-parse --short HEAD^1)" "${HEAD_SHA::7}" "$body" > "$report/report.md"
+ cat "$report/report.md" >> "$GITHUB_STEP_SUMMARY"
+ fi
+ - uses: actions/upload-artifact@v7
+ with:
+ name: progress-report
+ path: ${{ runner.temp }}/report
diff --git a/.github/workflows/progress.yml b/.github/workflows/progress.yml
new file mode 100644
index 000000000..93e9f0600
--- /dev/null
+++ b/.github/workflows/progress.yml
@@ -0,0 +1,30 @@
+name: Progress
+
+on:
+ push:
+ branches: [main]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+concurrency:
+ group: pages
+ cancel-in-progress: false
+
+jobs:
+ progress:
+ runs-on: ubuntu-latest
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ steps:
+ - uses: actions/checkout@v7
+ - run: python3 tools/progress.py out
+ - uses: actions/upload-pages-artifact@v5
+ with:
+ path: out
+ - id: deployment
+ uses: actions/deploy-pages@v5
diff --git a/README.md b/README.md
index a98b5a96f..8a780366b 100644
--- a/README.md
+++ b/README.md
@@ -4,9 +4,11 @@ Tool for automatic executables porting to Linux and Windows.
Includes a [relinker](core/relinker) that converts executable to the target system's native format and implementations of [system prx libraries](core/libs/prx) suitable for dynamic linking. No emulation or separate runtime process.
-`relinker --to-intel` rewrites the Zen 2-only instructions a title may contain (EXTRQ, INSERTQ, MOVNTSS, MOVNTSD) at relink time, in place when an equal-length Intel encoding exists and otherwise through a jump to a generated stub section, so Intel hosts need no runtime emulation.
+[](https://boykopovar.github.io/AnyPS5/) [](https://boykopovar.github.io/AnyPS5/)
-By default the relinker also converts the title's own `sce_module`/`sce_modules` prx files into guest modules that take priority at link time (they require eager binding). A title whose `sce_module` ships its own `libc.prx`, such as Demon's Souls (PPSA01342), is relinked with `--skip-sce-module`: its libc would replace the project's [libc.prx](core/libs/prx/libc) (guest memory arena, heap, crash reporting) and imports kernel functions that are not implemented, so the executable fails to bind at startup.
+[](https://boykopovar.github.io/AnyPS5/)
+
+* System libraries: percentage of the functions known to the project so far (declared in [core/libs/prx](core/libs/prx)), not of every PS5 system function. The total grows as more functions are declared.
Releases will be published after the first full successful launch of at least one game.
diff --git a/tools/progress.py b/tools/progress.py
new file mode 100644
index 000000000..2af9611d1
--- /dev/null
+++ b/tools/progress.py
@@ -0,0 +1,298 @@
+import argparse
+import json
+import os
+import re
+from html import escape
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+PRX = ROOT / "core" / "libs" / "prx"
+OPCODES = ROOT / "core" / "shader" / "recompiler" / "RdnaDecoder" / "include" / "RdnaDecoder" / "RdnaOpcode.hpp"
+ISA = Path(__file__).resolve().parent / "rdna_isa.txt"
+SOURCE = f'https://github.com/{os.environ.get("GITHUB_REPOSITORY", "boykopovar/AnyPS5")}/blob/main'
+DEFINITION = re.compile(r"\bAPS5_VABI\s+(\w+)\s*\([^;{]*\)\s*(?:noexcept\s*)?\{")
+STUB = "NotImplemented_nid_no_patch"
+FLAT_SEGMENTS = ("GLOBAL_", "SCRATCH_")
+OPCODE_SENTINELS = {"Invalid", "Count", "Unknown", "Unsupported"}
+OPCODE_ALIASES = {
+ "TBufferLoadFormatX": "TBUFFER_LOAD_FORMAT_X",
+ "TBufferLoadFormatXyzw": "TBUFFER_LOAD_FORMAT_XYZW",
+ "ExpMrt": "EXP",
+ "ExpPos": "EXP",
+ "ExpParam": "EXP",
+ "VAddcU32": "V_ADD_CO_CI_U32",
+ "VMadMixloF16": "V_FMA_MIXLO_F16",
+ "VMadMixhiF16": "V_FMA_MIXHI_F16",
+}
+REPORT_ROWS = 100
+PANEL_WIDTH, GAP, MAP_HEIGHT, HEADER = 495, 10, 280, 30
+DONE_COLOR, TODO_COLOR, BORDER, TEXT = "#2ea043", "#1f6feb", "#0d1117", "#ffffff"
+
+
+def body_end(text, start):
+ depth = 0
+ for i in range(start, len(text)):
+ if text[i] == "{":
+ depth += 1
+ elif text[i] == "}":
+ depth -= 1
+ if depth == 0:
+ return i
+ return len(text)
+
+
+def scan_library(path):
+ done, todo = set(), set()
+ for source in path.rglob("*.cpp"):
+ text = source.read_text(errors="ignore")
+ for match in DEFINITION.finditer(text):
+ name = match.group(1)
+ if name.endswith("_nid_no_patch"):
+ continue
+ body = text[match.end() - 1:body_end(text, match.end() - 1)]
+ (todo if STUB in body else done).add(name)
+ todo -= done
+ return {"name": path.name, "label": path.name.removeprefix("libSce"), "done": len(done), "todo": len(todo),
+ "done_names": sorted(done), "todo_names": sorted(todo)}
+
+
+def summarize(groups):
+ done = sum(g["done"] for g in groups)
+ total = done + sum(g["todo"] for g in groups)
+ return {"done": done, "total": total, "percent": round(100 * done / total, 2) if total else 0, "groups": groups}
+
+
+def collect_libraries():
+ return summarize([scan_library(p) for p in sorted(PRX.iterdir()) if p.is_dir()])
+
+
+def camel(name):
+ return "".join(part.capitalize() for part in name.split("_"))
+
+
+def collect_shaders():
+ isa = {}
+ for line in ISA.read_text().splitlines():
+ if line and not line.startswith("#"):
+ name, encoding = line.split()
+ isa[name] = encoding
+ by_camel = {camel(name): name for name in isa}
+ enum = re.search(r"enum class RdnaOpcode[^{]*\{(.*?)\};", OPCODES.read_text(), re.S).group(1)
+ opcodes = [o for o in re.findall(r"^\s*([A-Z]\w*)\s*[,=]", enum, re.M) if o not in OPCODE_SENTINELS]
+ supported, extra = set(), []
+ for opcode in opcodes:
+ name = OPCODE_ALIASES.get(opcode) or by_camel.get(opcode)
+ if name in isa:
+ supported.add(name)
+ if name.startswith("FLAT_"):
+ supported.update(n for n in (s + name.removeprefix("FLAT_") for s in FLAT_SEGMENTS) if n in isa)
+ else:
+ extra.append(opcode)
+ groups = {}
+ for name, encoding in isa.items():
+ group = groups.setdefault(encoding, {"name": encoding, "label": encoding, "done": 0, "todo": 0,
+ "done_names": [], "todo_names": []})
+ state = "done" if name in supported else "todo"
+ group[state] += 1
+ group[f"{state}_names"].append(name)
+ result = summarize(sorted(groups.values(), key=lambda g: g["name"]))
+ result["extra"] = extra
+ return result
+
+
+def worst_ratio(row, side):
+ area = sum(row)
+ return max(max(side * side * r / area ** 2, area ** 2 / (side * side * r)) for r in row)
+
+
+def place(row, x, y, w, h, rects):
+ thickness = sum(row) / min(w, h)
+ offset = 0
+ for area in row:
+ length = area / thickness
+ if w >= h:
+ rects.append((x, y + offset, thickness, length))
+ else:
+ rects.append((x + offset, y, length, thickness))
+ offset += length
+ return (x + thickness, y, w - thickness, h) if w >= h else (x, y + thickness, w, h - thickness)
+
+
+def squarify(values, x, y, w, h):
+ total = sum(values)
+ areas = [v * w * h / total for v in values]
+ rects, row = [], []
+ while areas:
+ side = min(w, h)
+ if not row or worst_ratio(row + [areas[0]], side) <= worst_ratio(row, side):
+ row.append(areas.pop(0))
+ continue
+ x, y, w, h = place(row, x, y, w, h, rects)
+ row = []
+ if row:
+ place(row, x, y, w, h, rects)
+ return rects
+
+
+def cells(count, x, y, w, h):
+ if not count:
+ return []
+ rows = max(1, min(count, round((count * h / w) ** 0.5)))
+ result = []
+ for r in range(rows):
+ in_row = count // rows + (r < count % rows)
+ cw = w / in_row
+ result += [(x + c * cw, y + r * h / rows, cw, h / rows) for c in range(in_row)]
+ return result
+
+
+def rect(x, y, w, h, color, stroke=0.5):
+ return (f'')
+
+
+def text(x, y, value, size):
+ return (f'{escape(value)}')
+
+
+def treemap(title, data, left):
+ groups = sorted((g for g in data["groups"] if g["done"] + g["todo"]), key=lambda g: -(g["done"] + g["todo"]))
+ parts = [text(left + 4, 21, f'{title}: {data["percent"]}% ({data["done"]}/{data["total"]})', 16)]
+ for group, (x, y, w, h) in zip(groups, squarify([g["done"] + g["todo"] for g in groups], left, HEADER, PANEL_WIDTH, MAP_HEIGHT)):
+ total = group["done"] + group["todo"]
+ parts.append(f'{escape(group["name"])}: {group["done"]}/{total} ({100 * group["done"] / total:.0f}%)')
+ for i, cell in enumerate(cells(total, x + 1, y + 1, w - 2, h - 2)):
+ parts.append(rect(*cell, DONE_COLOR if i < group["done"] else TODO_COLOR))
+ parts.append(f'')
+ label = group["label"][:int((w - 10) / 7)]
+ if (label == group["label"] or len(label) >= 3) and h > 22:
+ parts.append(text(x + 5, y + 16, label, 12))
+ parts.append("")
+ return parts
+
+
+def render(libraries, shaders):
+ width, height = 2 * PANEL_WIDTH + GAP, HEADER + MAP_HEIGHT
+ parts = [f'")
+ return "\n".join(parts)
+
+
+def badge(label, data):
+ percent = data["percent"]
+ color = "#4c1" if percent >= 90 else "#97ca00" if percent >= 60 else "#dfb317" if percent >= 30 else "#fe7d37"
+ value = f"{percent}%"
+ left, right = 10 + 7 * len(label), 10 + 7 * len(value)
+ width = left + right
+ return (f'')
+
+
+def table(heading, column, data):
+ rows = [f"
{heading}
", "
",
+ f"
{column}
Implemented
Total
%
"]
+ for group in sorted(data["groups"], key=lambda g: g["name"].lower()):
+ total = group["done"] + group["todo"]
+ percent = f'{100 * group["done"] / total:.0f}%' if total else "-"
+ rows.append(f'
{escape(group["name"])}
{group["done"]}
{total}
{percent}
')
+ rows.append(f'
Total
{data["done"]}
{data["total"]}
{data["percent"]}%
')
+ rows.append("
")
+ return "\n".join(rows)
+
+
+def summary(libraries, shaders):
+ extra = ", ".join(f"{escape(o)}" for o in shaders["extra"])
+ return "\n".join([
+ '',
+ '',
+ 'AnyPS5 progress',
+ '',
+ '',
+ "
A function is implemented when it no longer calls NotImplemented_nid_no_patch. "
+ f'The total only includes functions already declared in core/libs/prx, '
+ "not every function exported by the PS5 firmware.
",
+ table("GPU shader instructions", "Encoding", shaders),
+ f'
The total is the AMD RDNA 1 + RDNA 2 instruction list (tools/rdna_isa.txt). '
+ f'An instruction is implemented when the decoder recognizes it. '
+ f"Decoded opcodes not present in AMD's public list are not counted: {extra}.