Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.
Swift apple-siliconcustom-formathomebrewiosipaipadipadosiphonemetalnative-portnintendo-switchnxnativeromfsswitch-games
The games gallery is written to GAMES.md, and the release history lives in CHANGELOG.md
v0lumehide5f75e4886f
diff --git a/dm/tools/docs_gallery.py b/dm/tools/docs_gallery.pyindex 38280413..5d5c78da 100644--- a/dm/tools/docs_gallery.py+++ b/dm/tools/docs_gallery.py@@ -1,15 +1,15 @@#!/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, in small print like the caption: the IPA's size, then " · " and a remark if any; omit when the size is unknown) and, optionally, the base game's title ID, which links 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, sysREPO = pathlib.Path(__file__).resolve().parents[2]TABLE = REPO / 'docs' / 'images' / 'gallery.tsv'-OUT = REPO / 'README.md'+OUT = REPO / 'GAMES.md'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@@ -40,7 +40,7 @@ def cell(image, name, note, tid):image, name, note = (html.escape(s, quote=False).replace('"', '"') for s in (image, name, note))caption = f'<a href="dm/games/{tid}/README.md">{name}</a>' if tid else namedetail = f'<br>{note}' if note else '' # a game whose IPA size is still open has only its caption- # All in small print: GitHub keeps its own line height in a README, so smaller text is what makes the captions compact.+ # All in small print: GitHub keeps its own line height in a page, so smaller text is what makes the captions compact.return f'<td align="center" valign="top" width="33%"><img src="docs/images/{image}" width="256" alt="{name}"><br><sub><b>{caption}</b>{detail}</sub></td>'@@ -49,21 +49,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 itreturn '\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.pyindex 350f7be9..ce6f40ed 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 fromdocs/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 Pathimport reimport subprocess@@ -95,7 +95,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_unknown_size(self):image = docs_gallery.rows()[0][0]diff --git a/docs/RELEASE-NOTES-GUIDE.md b/docs/RELEASE-NOTES-GUIDE.mdindex ba1f3323..a8378ef2 100644--- a/docs/RELEASE-NOTES-GUIDE.md+++ b/docs/RELEASE-NOTES-GUIDE.md@@ -75,7 +75,7 @@ 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, theEnglish 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.