Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,34 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
# The three hooks below REWRITE files rather than just checking them, so
# they must not touch trees we do not author. Without this exclusion a
# `pre-commit run --all-files` silently reformats vendored upstream source
# and the immutable reference corpus — observed: 41 files across the
# vendored TriCNES C#, the vendored rcheevos C, `ref-docs/`, an upstream
# font licence, and upstream test-ROM READMEs. That destroys the "kept
# pristine / byte-identical to upstream" property those trees exist for,
# and pollutes any diff that happens to run the hooks broadly.
#
# `.markdownlintignore` already exempts most of these for markdownlint;
# this is the equivalent for the whitespace fixers, which had no exclusion
# at all. Scope is deliberately narrower than `.markdownlintignore`: only
# content we did not write (vendored / upstream / immutable reference).
# Frozen-but-ours trees (`docs/archive/`, `to-dos/plans/`, …) stay in
# scope — they are our prose, and whitespace hygiene on them is harmless.
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
exclude: &vendored_trees |
(?x)^(
ref-docs/
|ref-proj/
|crates/rustynes-test-harness/golden/tricnes/
|crates/rustynes-cheevos/vendor/
|tests/roms/
|assets/RustyNES_Icon/OFL\.txt$
)
- id: end-of-file-fixer
exclude: *vendored_trees
- id: check-yaml
# mkdocs.yml uses Material for MkDocs' documented `!!python/name:` YAML
# tags (pymdownx.emoji icon rendering), which check-yaml's safe_load
Expand All @@ -35,6 +60,9 @@ repos:
- id: check-merge-conflict
- id: mixed-line-ending
args: [--fix=lf]
# Third rewriting hook — same exclusion. Upstream `.resx` / `.csproj`
# files in the vendored TriCNES tree legitimately carry CRLF.
exclude: *vendored_trees

# Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
Expand Down
4 changes: 2 additions & 2 deletions scripts/diag/celldiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def rnorm(acc):

# Walk both from landmark, report first structural divergences (addr or normalized-kind)
mlist=mes[mi:]; rlist=rny[ri:]
# Mesen has NO Idle rows; RustyNES emits I rows. To align, drop RustyNES I rows?
# Mesen has NO Idle rows; RustyNES emits I rows. To align, drop RustyNES I rows?
# But I rows ARE cycles. Mesen logs a read every cycle (no idle). So an I in Rusty
# where Mesen has a read = the structural divergence we hunt. Keep both, align by index.
divs=0
Expand All @@ -57,7 +57,7 @@ def rnorm(acc):
if ma!=ra or mk2!=rk2:
print(f"off={off:5d} | MES {mk}{('('+mk+')') if mk in 'HDAG' else ''} {ma:04X}={mv:02X} | RNY {racc} {ra:04X}={rd:02X} indmc={indmc}")
divs+=1
if divs>=40:
if divs>=40:
print("... (capped at 40)")
break
print(f"total divergences shown (cap 40 of first {n} aligned cycles)")