diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..e24acd17 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,31 @@ +name: CI +on: + push: + branches: + - main + pull_request: +jobs: + lint: + name: Linting/style checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + check-latest: true + + - name: Install pre-commit + run: pip install pre-commit + + - name: Cache pre-commit hooks + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit/ + # Invalidate the cache if the pre-commit config changes or the Python version changes + key: pre-commit-cache|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} + + - name: Run pre-commit checks + run: pre-commit run --all-files --verbose diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..8b2ebb4c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-illegal-windows-names + - id: check-json + - id: check-merge-conflict + - id: check-yaml + args: + - --allow-multiple-documents + - id: debug-statements + - id: destroyed-symlinks + - id: mixed-line-ending + - id: requirements-txt-fixer + - id: trailing-whitespace + args: + - --markdown-linebreak-ext=md + + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v19.1.5 + hooks: + - id: clang-format diff --git a/INSTALL.md b/INSTALL.md index 22a4f1fb..45113307 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -21,11 +21,15 @@ Contents: ```shell python -m pip install -r tools/requirements.txt ``` -4. Run the setup script: +4. Install pre-commit hooks: +```shell +pre-commit install +``` +5. Run the setup script: ```shell python tools/setup.py ``` -5. Run the Ninja configure script: +6. Run the Ninja configure script: ```shell python tools/configure.py ``` @@ -46,7 +50,7 @@ Now you can run `ninja` to build a ROM for the chosen version. First, [extract the ARM7 BIOS from your DS device](https://wiki.ds-homebrew.com/ds-index/ds-bios-firmware-dump). Put the ARM7 BIOS in the root directory of this repository, and verify that your dumped BIOS matches the one below: -| File name | SHA1 | +| File name | SHA1 | | --------------- | ------------------------------------------ | | `arm7_bios.bin` | `6ee830c7f552c5bf194c20a2c13d5bb44bdb5c03` | diff --git a/docs/actors.md b/docs/actors.md index d0efbc13..49300936 100644 --- a/docs/actors.md +++ b/docs/actors.md @@ -253,12 +253,12 @@ translations. Feel free to contribute to this list! `EVIC` | Event Icon | Exclamation point icon on the map screen `EQAR` | Earthquake Area `FMSG` | Freestanding? Message | Freestanding textbox -`ITGE` | Item Generator | Spawns an item, such as a small key +`ITGE` | Item Generator | Spawns an item, such as a small key `NCMA` | NPC Conversation Message? `NCM2` | NPC Conversation Message 2? `NMSG` | Navi Message | Starts dialogue with the fairy `RMTG` | Room Tag | Midpoint of small rooms, such as houses -`SWDS` | +`SWDS` | `SWOB` | Switch Object | Causes an event when one or more switches are active `VOCA` | Voice Area | Listens for microphone volume while Link is in the area `WNAR` | Wind Area | Creates gusts of wind that push Link diff --git a/extract/README.md b/extract/README.md index cb6f93a5..1aa8c5c2 100644 --- a/extract/README.md +++ b/extract/README.md @@ -2,7 +2,7 @@ This repository does not include any of the game's assets, and you will need an Put the base ROM(s) in this directory. Please verify that your dumped ROM matches one of the versions below: -| Version | File name | SHA1 | +| Version | File name | SHA1 | | ------- | -------------------- | ------------------------------------------ | | EUR | `baserom_ph_eur.nds` | `02be55db55cf254bd064d2b3eb368b92a5b4156d` | | USA | `baserom_ph_usa.nds` | `4c8f52dd719918bbcd46e73a8bae8628139c1b85` | diff --git a/tools/configure.py b/tools/configure.py index dbfb4f16..b1416e0f 100644 --- a/tools/configure.py +++ b/tools/configure.py @@ -158,7 +158,7 @@ def main(): command="./dsd rom build --config $in --rom $out $arm7_bios_flag" ) n.newline() - + n.rule( name="objdiff", command=f"./dsd objdiff --config-path $config_path {DSD_OBJDIFF_ARGS}" @@ -258,7 +258,7 @@ def add_mwcc_builds(n: ninja_syntax.Writer, game_version: str, game_build: Path) } ) n.newline() - + extension = source_file.suffix ctx_file = str(game_build / source_file.with_suffix(f".ctx{extension}")) n.build( diff --git a/tools/mangle.py b/tools/mangle.py index d14bec54..68d2aeb3 100644 --- a/tools/mangle.py +++ b/tools/mangle.py @@ -46,7 +46,7 @@ try: except subprocess.CalledProcessError as e: print(e.stdout.decode()) exit(1) - + output = output.decode() # print(output) diff --git a/tools/requirements.txt b/tools/requirements.txt index c0988481..4682190e 100644 --- a/tools/requirements.txt +++ b/tools/requirements.txt @@ -1,2 +1,3 @@ -requests +pre-commit pyperclip +requests