These come from CLAUDE.md. The ones below are those this work runs into most.
Licenses. ScarletNX is GPL-3.0-or-later. A new file starts with the SPDX line and the project's copyright line, as
this guide does. You may port code under GPL-3.0, GPL-2.0-or-later, LGPL, MIT, BSD, ISC, zlib or Apache 2.0. Keep its
copyright lines, say where it came from, and list it in docs/CREDITS.md. Never port GPL-2.0-only code. Atmosphère is
GPL-2.0-only: read it, never port it. Never take code from the attesor repository that the plan mentions, because it
holds decompiled Apple code.
Find the mechanism. A fix explains why the guest does what it does, from what the game or SDK code expects
(tools/disasm.py) and what the runtime gave it instead. Do not tune delays, add retries or add special cases for a
title ID.
A build is not a test. Verify a runtime change by running a game through the scene the change affects, and say in the commit what you ran. For a crash fix, run enough times to show the crash is gone, since one good run proves nothing about an intermittent crash.
C. Clang only, strict ISO C23 (.claude/skills/snx-code-quality/SKILL.md).
-fno-strict-aliasing. Access an object through its own type, a character type, memcpy or
common/utilities/endian.h, a union member, or a local copied in and out.-fwrapv. Do wrapping arithmetic in unsigned types. -DSNX_TRAPV=ON builds
with -ftrapv to find overflows.src/common/utilities/ (ascii.h, bits.h,
endian.h, common.h), never from a local copy.-Werror=missing-prototypes.tests/, and CPU references for tests go in tests/support/.The contract with generated code. A change to codegen.c, the decoder, loader.c, a native back end or anything in
src/common/cpu/aarch64/ means games must be recompiled to get it. A change to the contract itself raises SNX_ABI in
cpu.h, updates tests/module_contract.c and adds a row to the table in docs/dev/architecture.md. Every bump forces a
full recompile of every game, so group bumps where the plan allows it, such as I3 with I4.
Emitters. Check every emitter or decoder change against QEMU with ctest -R native_qemu_differential, and give
the test binary --sweep for more words and states. A group that newly differs fails the test, and so does a group in
tests/native_qemu_expected.txt that no longer differs. Update that file in the same change.
The native back ends. native_qemu_differential holds the host's own native back end to QEMU, with the groups
known to differ in tests/native_qemu_expected.txt. native_qemu_differential_jit loads the
code with the JIT's loader, and native_qemu_differential_portable makes it without the host's optional features. A word
the back end has no code for is listed in the run's native_qemu_coverage.txt. The programs that compare a word's
result with a value (native_*, a64_ported_cases and crc32_helper) run on the native steps (tests/steps.h).
The recorded QEMU reference. The hosts with no qemu-aarch64 beside the test run the differential against a file
that a Linux host recorded: Windows, macOS, and the cross-built PowerPC64, RISC-V and LoongArch. CI's qemu-reference job records it for each run and hands it over as the artifact
ScarletNX-native-qemu-reference-<commit>. No file is kept in the repository, because one is bound to the commit that
made it. Record another when one of these changes: the rows of the generated decoder, directed(), scalar_words()
or kept[] in tests/native_qemu_differential.c, the random states, the runner in tests/qemu_ref/, or the QEMU
version. By hand, on a Linux host with the tools named above, the job's command takes about 20 seconds and 56 MB:
cmake --build build --target snx-test-native-qemu-differential snx_qemu_ref_runner
build/tests/snx-test-native-qemu-differential qemu-aarch64 build/qemu_ref_runner build/record \
tests/native_qemu_expected.txt --quiet --record qemu_reference.bin
On the other host, configure with -DSNX_QEMU_REFERENCE=/path/qemu_reference.bin and run native_qemu_differential. It
is skipped, with the reason, where the file is not there. A program run by hand takes DIR EXPECTED --reference FILE,
and fails where the file is not there.
Settings. A new setting goes in src/nx/runtime/settings.txt, from which tools/settingsgen generates the code
that reads it. A setting that changes generated code must also join the JIT cache key in jit_cache_key.c, as
volatile_memory does. A mode that changes results stays a setting whose default keeps the exact behavior.
Game data. Keys, dumps, work/, recompiled/, game logs, and shader or texture dumps stay on your machine. Commit
messages and docs may quote addresses, symbol names and short disassembly, but never extracted files. They never name
the game or its title ID either. Write "one game's menus" or "another game's save".
Processes. Never use pkill, killall or kill $(pgrep -f PATTERN), because they can match the shell that runs
them. List the processes with pgrep -a NAME and kill by number. Game logs grow to megabytes, so read them with
grep and tail.
Made from docs/layers/cpu/guide.md at 69237645142c. GPL-3.0-or-later.