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
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ IndentWidth: 4
ColumnLimit: 120
PointerAlignment: Left
AllowShortFunctionsOnASingleLine: Empty
SortIncludes: CaseSensitive
SortIncludes: Never # include order is load-bearing in spliced TUs (runtime_ui.cpp)
71 changes: 71 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# clang-tidy configuration for first-party C/C++ (runtime-recomp/src,
# runtime-recomp/tests, modding). LLVM major is pinned to 18 everywhere
# (clang-format, clang-tidy, the sanitizer job); bump them together.
#
# CI runs this diff-gated on changed lines (`tidy` job, advisory first, see
# CONTRIBUTING.md). Whole-tree runs are a report, not a gate.
#
# The set is deliberately conservative: bug finders and the static analyzer,
# with the checks that are mostly noise on recompiled N64 code turned off.
# Turning one of the disabled checks on is its own PR with its own baseline.
#
# Disabled, and why:
# bugprone-easily-swappable-parameters style opinion, fires on most (int, int) APIs
# bugprone-implicit-widening-of-multiplication-result
# address math on guest RDRAM is intentional
# bugprone-narrowing-conversions alias of cppcoreguidelines-narrowing-conversions;
# guest u32/s16 conversions are everywhere
# bugprone-reserved-identifier N64 SDK and libultra names (__osXxx, _gXxx)
# bugprone-macro-parentheses decomp-style macros, mostly in extern/
# bugprone-assignment-in-if-condition style
# bugprone-switch-missing-default-case style; -Wswitch covers enums
# bugprone-branch-clone per-version tables (v77/v80) repeat on purpose
# performance-no-int-to-ptr guest-to-host pointer translation by design
# performance-enum-size enum layout is part of save and wire formats
# clang-analyzer-optin.performance.Padding layout matches guest structs on purpose
# clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
# flags every memcpy/snprintf (C11 Annex K)
# misc-include-cleaner wrong on spliced .inl translation units
# (runtime_ui.cpp); enable per module once the
# include order is explicit (plan C2/C4)
Checks: >
-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-narrowing-conversions,
-bugprone-reserved-identifier,
-bugprone-macro-parentheses,
-bugprone-assignment-in-if-condition,
-bugprone-switch-missing-default-case,
-bugprone-branch-clone,
clang-analyzer-*,
-clang-analyzer-optin.performance.Padding,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
performance-*,
-performance-no-int-to-ptr,
-performance-enum-size,
misc-definitions-in-headers,
concurrency-mt-unsafe,
cert-err33-c

# Promoted to errors even while the job is advisory: these are almost never
# false positives and each one is a crash or memory corruption.
WarningsAsErrors: >
bugprone-use-after-move,
bugprone-dangling-handle,
bugprone-sizeof-expression,
clang-analyzer-core.*

# First-party headers only. extern/, third_party/ and the build tree are not
# reported even when a first-party TU includes them.
HeaderFilterRegex: '/(runtime-recomp/(src|tests)|modding)/'
FormatStyle: none
SystemHeaders: false

CheckOptions:
# printf-family results are ignored on purpose for logging.
- key: cert-err33-c.CheckedFunctions
value: '::aligned_alloc;::calloc;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fopen;::fread;::freopen;::fseek;::fsetpos;::ftell;::fwrite;::malloc;::realloc;::remove;::rename;::setvbuf;::tmpfile'
- key: bugprone-unused-return-value.AllowCastToVoid
value: true
51 changes: 51 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/scripts/agent_hooks/run session_start.py",
"timeout": 30
}
]
}
],
"PreToolUse": [
{
"matcher": "Edit|Write|MultiEdit|NotebookEdit",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/scripts/agent_hooks/run pre_edit_guard.py",
"timeout": 10
}
]
}
],
"PostToolUse": [
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/scripts/agent_hooks/run post_edit_check.py",
"timeout": 30
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/scripts/agent_hooks/run stop_check.py",
"timeout": 120
}
]
}
]
}
}
51 changes: 51 additions & 0 deletions .codex/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"description": "DKR-R pattern enforcement. Same scripts as .claude/settings.json; see scripts/agent_hooks/ and AGENTS.md.",
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "\"$(git rev-parse --show-toplevel)\"/scripts/agent_hooks/run session_start.py",
"timeout": 30
}
]
}
],
"PreToolUse": [
{
"matcher": "apply_patch",
"hooks": [
{
"type": "command",
"command": "\"$(git rev-parse --show-toplevel)\"/scripts/agent_hooks/run pre_edit_guard.py",
"timeout": 10
}
]
}
],
"PostToolUse": [
{
"matcher": "apply_patch",
"hooks": [
{
"type": "command",
"command": "\"$(git rev-parse --show-toplevel)\"/scripts/agent_hooks/run post_edit_check.py",
"timeout": 30
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "\"$(git rev-parse --show-toplevel)\"/scripts/agent_hooks/run stop_check.py",
"timeout": 120
}
]
}
]
}
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ indent_size = 2

[*.md]
trim_trailing_whitespace = false

# shfmt reads these when run without flags. Measured against the tracked
# scripts: 2 spaces, no case indent, no -bn/-sr is the style already in use.
[*.sh]
indent_style = space
indent_size = 2
switch_case_indent = false
binary_next_line = false
space_redirects = false
9 changes: 9 additions & 0 deletions .gersemirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# gersemi configuration for first-party CMake. Indent matches .editorconfig
# and the line length matches .clang-format and ruff. favour-inlining is the
# closer of the two expansion modes to the existing hand-written style
# (31 of 37 files drift vs 34 with favour-expansion).
definitions: [runtime-recomp/cmake]
indent: 4
line_length: 120
list_expansion: favour-inlining
warn_about_unknown_commands: false
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Formatting-only commits. GitHub's blame view reads this file; locally run
# git config blame.ignoreRevsFile .git-blame-ignore-revs
# Apply ruff format, ruff --fix and shfmt to first-party scripts (A2)
d6690f6da8690bdaf79ab898f10e5cee69f6ef07
35 changes: 35 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Only the files that define the project's rules have owners. Ordinary code
# needs no owner review. Both maintainers own every entry, so either one can
# approve the other's change (GitHub does not let you approve your own PR).
# The ruleset in .github/ruleset-main.json turns these into required reviews.

# Pattern guard, architecture contracts and the check entry point
/architecture/ @ThatGuyMcd @swhitt
/scripts/check.py @ThatGuyMcd @swhitt
/scripts/pattern_guard.py @ThatGuyMcd @swhitt
/scripts/check_includes.py @ThatGuyMcd @swhitt
/scripts/check_registries.py @ThatGuyMcd @swhitt
/scripts/agent_hooks/ @ThatGuyMcd @swhitt
/scripts/check_pinned_bytes.py @ThatGuyMcd @swhitt
/scripts/bootstrap_hooks.py @ThatGuyMcd @swhitt

# Lint, format and hook configuration (a new ignore or baseline entry is a rule change)
/.pre-commit-config.yaml @ThatGuyMcd @swhitt
/pyproject.toml @ThatGuyMcd @swhitt
/.clang-format @ThatGuyMcd @swhitt
/.clang-tidy @ThatGuyMcd @swhitt
/.gersemirc @ThatGuyMcd @swhitt
/runtime-recomp/cmake/Warnings.cmake @ThatGuyMcd @swhitt
/.git-blame-ignore-revs @ThatGuyMcd @swhitt

# CI, ownership and repository policy
/.github/ @ThatGuyMcd @swhitt

# Agent instructions
/.claude/ @ThatGuyMcd @swhitt
/.codex/ @ThatGuyMcd @swhitt
/AGENTS.md @ThatGuyMcd @swhitt
/CLAUDE.md @ThatGuyMcd @swhitt

# Online compatibility identity
/runtime-recomp/src/game/netplay/legacy_identity.hpp @ThatGuyMcd @swhitt
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## What

<!-- One paragraph: what changes and why. -->

## Pattern checklist

- [ ] First-party changes are in-place edits under `runtime-recomp/`, `modding/` or `scripts/` (no new `patches/<name>/`)
- [ ] Third-party changes are `*.patch` files registered in `patches/manifest.json`
- [ ] Guest hooks only via `guest-hooks/hooks.toml`; symbols only via `symbols/*.toml`
- [ ] New settings, launcher pages and owned services are registered, and their contract docs are updated
- [ ] `netplay/legacy_identity.hpp` updated (reviewed by both owners) if simulation, wire or owned-service behaviour changed
- [ ] Tests added or updated; `python scripts/check.py --suite all` passes locally
- [ ] Platforms considered: Windows / Linux / macOS / iOS / Android (say which ones you built)

## Risk

<!-- What could break online play, saves or mods, and how to roll it back. -->
Loading
Loading