Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

10.0 KB
Raw Blame
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: v0lumehi <[email protected]>
Date: Wed, 28 Oct 2026 18:32:25 +0100
Subject: [PATCH] The games gallery is written to GAMES.md, and the release
 history lives in CHANGELOG.md

README.md is the player's page and stays short: docs_gallery.py writes the gallery into GAMES.md, and RELEASE-NOTES-GUIDE.md names CHANGELOG.md for the update-history table.

Upstream-Status: fork-only
Reason: README is the fork's short player page: the games gallery is written to GAMES.md (it would be most of the README) and the update history is CHANGELOG.md
Issue: LNPANDY/NX2Apple#123
---
 dm/tools/docs_gallery.py    | 26 +++++++++++++++++---------
 dm/tools/tests/test_docs.py |  6 +++---
 docs/RELEASE-NOTES-GUIDE.md |  8 ++++----
 3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/dm/tools/docs_gallery.py b/dm/tools/docs_gallery.py
index 32f3965..5994375 100644
--- a/dm/tools/docs_gallery.py
+++ b/dm/tools/docs_gallery.py
@@ -1,15 +1,23 @@
 #!/usr/bin/env python3
-# Writes the games gallery in README.md (between its gallery markers) from docs/images/gallery.tsv: one cell per row of the table, three to a row, in the table's order.
+# Writes the games gallery in GAMES.md (between its gallery markers) from docs/images/gallery.tsv: one cell per row of the table, three to a row, in the table's order.
 # The table is the source: a new game is a row in it (usually at the end), so two pull requests that each add a game change one line each instead of moving every cell after
 # the first one; .gitattributes merges the table with the union driver. Columns: image (a file in docs/images), name (the caption and the image's alt text), note (the small
 # line under it: a remark, such as "60 fps with 1.0.1"; empty for most games) and the base game's title ID, which links the name to its game note.
-# Run it after changing the table; --check only reports whether README.md is current (dm/tools/tests/test_docs.py runs it).
+# Run it after changing the table; --check only reports whether GAMES.md is current (dm/tools/tests/test_docs.py runs it).
 # Usage: docs_gallery.py [--check]
 import html, pathlib, re, sys
 
 REPO = pathlib.Path(__file__).resolve().parents[2]
 TABLE = REPO / 'docs' / 'images' / 'gallery.tsv'
-OUT = REPO / 'README.md'
+OUT = REPO / 'GAMES.md'
+BLOB = RAW = ''   # the links are relative to GAMES.md's folder, which holds the engine
+if not OUT.exists() and (REPO.parent / '.upstream-ref').is_file():
+    # In engine/ (NX2Apple's tools/engine.py sync) GAMES.md is the checkout's, one folder up, and the checkout holds no engine files: the
+    # game notes and images are seedds/nxnative's, at the commit the checkout is pinned to (.upstream-ref).
+    OUT = REPO.parent / 'GAMES.md'
+    pin = (REPO.parent / '.upstream-ref').read_text(encoding='utf-8').strip()
+    BLOB = f'https://github.com/seedds/nxnative/blob/{pin}/'
+    RAW = f'https://raw.githubusercontent.com/seedds/nxnative/{pin}/'
 BEGIN = '<!-- gallery: written by dm/tools/docs_gallery.py from docs/images/gallery.tsv; change the table, then run it -->'
 END = '<!-- end of gallery -->'
 PER_ROW = 3
@@ -38,10 +46,10 @@ def rows():
 def cell(image, name, note, tid):
     # Attributes use double quotes; apostrophes in existing captions need no escaping.
     image, name, note = (html.escape(s, quote=False).replace('"', '&quot;') for s in (image, name, note))
-    caption = f'<a href="dm/games/{tid}/README.md">{name}</a>'
+    caption = f'<a href="{BLOB}dm/games/{tid}/README.md">{name}</a>'
     detail = f'<br>{note}' if note else ''   # a game with no remark has only its caption
     # <small> is one step below the body text; <sub> would be smaller still and lower the baseline.
-    return f'<td align="center" valign="top" width="33%"><img src="docs/images/{image}" width="256" alt="{name}"><br><small><b>{caption}</b>{detail}</small></td>'
+    return f'<td align="center" valign="top" width="33%"><img src="{RAW}docs/images/{image}" width="256" alt="{name}"><br><small><b>{caption}</b>{detail}</small></td>'
 
 
 def gallery():
@@ -49,21 +57,21 @@ def gallery():
     lines = ['<table>']
     for i in range(0, len(r), PER_ROW):
         row = [cell(*x) for x in r[i:i + PER_ROW]]
-        lines += ['<tr>'] + row + ['<td></td>'] * (PER_ROW - len(row)) + ['</tr>']   # a short last row is filled with empty cells, as README had it
+        lines += ['<tr>'] + row + ['<td></td>'] * (PER_ROW - len(row)) + ['</tr>']   # a short last row is filled with empty cells, as the page had it
     return '\n'.join(lines + ['</table>'])
 
 
 def readme():
     text = OUT.read_text(encoding='utf-8')
-    if text.count(BEGIN) != 1 or text.count(END) != 1: sys.exit(f'README.md: the gallery markers ({BEGIN} … {END}) must appear once each')
+    if text.count(BEGIN) != 1 or text.count(END) != 1: sys.exit(f'GAMES.md: the gallery markers ({BEGIN} … {END}) must appear once each')
     head, rest = text.split(BEGIN)
-    if END not in rest: sys.exit('README.md: the gallery end marker must follow the begin marker')
+    if END not in rest: sys.exit('GAMES.md: the gallery end marker must follow the begin marker')
     return head + BEGIN + '\n' + gallery() + '\n' + END + rest.split(END, 1)[1]
 
 
 if __name__ == '__main__':
     text = readme()
     if '--check' in sys.argv[1:]:
-        if OUT.read_text(encoding='utf-8') != text: sys.exit('README.md: the gallery is out of date: run dm/tools/docs_gallery.py')
+        if OUT.read_text(encoding='utf-8') != text: sys.exit('GAMES.md: the gallery is out of date: run dm/tools/docs_gallery.py')
     else:
         OUT.write_text(text, encoding='utf-8')
diff --git a/dm/tools/tests/test_docs.py b/dm/tools/tests/test_docs.py
index 590343e..635c44e 100644
--- a/dm/tools/tests/test_docs.py
+++ b/dm/tools/tests/test_docs.py
@@ -1,7 +1,7 @@
 """The repository's own Markdown stays navigable: every relative link and #anchor resolves (GitHub's heading anchors), every game profile has its note
 (dm/games/<id>/README.md) and a row in the games table of dm/games/README.md, the symptom index (docs/agents/symptoms.md) is the one dm/tools/docs_symptoms.py writes from
 docs/reference, the patch index (docs/agents/game-patches.md) is the one dm/tools/docs_patches.py writes from the patch files, host tables and profiles, and the entry points stay short: AGENTS.md at most 1,500 words, each numbered guide in docs/agents at most 6,000 (a new finding goes into a game note or a
-reference, not into these), and README's games gallery is the one dm/tools/docs_gallery.py writes from docs/images/gallery.tsv. Third-party trees are left out. No game files needed."""
+reference, not into these), and GAMES.md's games gallery is the one dm/tools/docs_gallery.py writes from docs/images/gallery.tsv. Third-party trees are left out. No game files needed."""
 from pathlib import Path
 import re
 import subprocess
@@ -96,7 +96,7 @@ class PatchIndex(unittest.TestCase):
 
 class Gallery(unittest.TestCase):
     def test_gallery_is_current(self):
-        self.assertEqual(docs_gallery.OUT.read_text(encoding='utf-8'), docs_gallery.readme(), 'README.md: the gallery is out of date: run dm/tools/docs_gallery.py')
+        self.assertEqual(docs_gallery.OUT.read_text(encoding='utf-8'), docs_gallery.readme(), 'GAMES.md: the gallery is out of date: run dm/tools/docs_gallery.py')
 
     def test_plain_text_captions_and_no_remark(self):
         image, tid = docs_gallery.rows()[0][::3]
@@ -106,7 +106,7 @@ class Gallery(unittest.TestCase):
             with patch.object(docs_gallery, 'TABLE', table):
                 text = docs_gallery.gallery()
                 self.assertIn('alt="A &amp; B: &quot;Adventure&quot; &lt;2&gt;"', text)
-                self.assertIn(f'<br><small><b><a href="dm/games/{tid}/README.md">A &amp; B: &quot;Adventure&quot; &lt;2&gt;</a></b></small></td>', text)
+                self.assertIn(f'<br><small><b><a href="{docs_gallery.BLOB}dm/games/{tid}/README.md">A &amp; B: &quot;Adventure&quot; &lt;2&gt;</a></b></small></td>', text)
             self.assertIn('Game</a></b><br>60 fps &amp; more</small></td>', docs_gallery.cell(image, 'Game', '60 fps & more', tid))
 
     def test_reversed_markers_fail_before_writing(self):
diff --git a/docs/RELEASE-NOTES-GUIDE.md b/docs/RELEASE-NOTES-GUIDE.md
index ba1f332..116d6e8 100644
--- a/docs/RELEASE-NOTES-GUIDE.md
+++ b/docs/RELEASE-NOTES-GUIDE.md
@@ -53,11 +53,11 @@ same section order, and a reader picks one and reads straight through.
 
 The two halves use the **same headings in the same order** (the Chinese ones are the translations
 of the English ones), and the same number of items under each heading. Item 2 in English is item 2
-in Chinese; a reader comparing the two must not have to map lists.
+in Chinese, so a reader comparing the two does not have to map lists.
 
 Rules that matter more than the template:
 
-1. **English first.** It is the canonical text; the Chinese half is written from it.
+1. **English first.** It is the canonical text, and the Chinese half is written from it.
 2. **Both halves say the same thing.** Not "a translation of the headline and a summary of the
    rest" — a user reading either half must learn everything the other one learns.
 3. **Never split a section across the two halves.** All of Fixes is in one place, then all of
@@ -75,10 +75,10 @@ changing the template means checking that sheet's tests too.
 
 ## Where the text comes from
 
-- `README.md` and `README.zh-CN.md` share an update-history table; a release row goes in both, the
+- `CHANGELOG.md` and `CHANGELOG.zh-CN.md` share an update-history table. A release row goes in both, the
   English one first (it is the canonical project history), then translated.
 - The release body itself is written once, in both languages, and is what `gh release edit
-  --notes-file` takes. Keep the file in `/tmp` while working; the release is the record.
+  --notes-file` takes. Keep the file in `/tmp` while working, since the release is the record.
 - If a fact differs per platform (a macOS-only fix), say which platform in the same sentence in both
   languages rather than relying on the reader's inference.