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
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ jobs:
run: |
clang++ -std=c++17 -O1 tools/test_update_tags.cpp -o build/test-update-tags
build/test-update-tags
- name: Self-updater (manifest, signature, swap and rollback)
run: |
clang++ -std=c++17 -O1 -Iruntime tools/test_update.cpp -o build/test-update
build/test-update
tools/test_update_e2e.sh
- name: Controller rumble (HID bridge to SDL, fake gamepad)
run: |
clang -std=gnu11 -O2 -I"$HOME/sdl3/include" tools/test_rumble.c -L"$HOME/sdl3/lib" -Wl,-rpath,"$HOME/sdl3/lib" -lSDL3 -lm -o build/test-rumble
Expand Down Expand Up @@ -265,6 +270,11 @@ jobs:
run: |
clang++ -std=c++17 -O1 tools/test_update_tags.cpp -o build/test-update-tags
build/test-update-tags
- name: Self-updater (manifest, signature, swap and rollback)
run: |
clang++ -std=c++17 -O1 -Iruntime tools/test_update.cpp -o build/test-update
build/test-update
tools/test_update_e2e.sh
- name: Controller rumble (HID bridge to SDL, fake gamepad)
run: |
clang -std=gnu11 -O2 -I"$HOME/sdl3/include" tools/test_rumble.c -L"$HOME/sdl3/lib" -Wl,-rpath,"$HOME/sdl3/lib" -lSDL3 -lm -o build/test-rumble
Expand Down Expand Up @@ -351,6 +361,11 @@ jobs:
run: |
clang++ -std=c++17 -O1 tools/test_update_tags.cpp -o build/test-update-tags
build/test-update-tags
- name: Self-updater (manifest, signature, swap and rollback)
run: |
clang++ -std=c++17 -O1 -Iruntime tools/test_update.cpp -o build/test-update
build/test-update
tools/test_update_e2e.sh
- name: Controller rumble (HID bridge to SDL, fake gamepad)
run: |
clang -std=gnu11 -O2 -I"$(brew --prefix sdl3)/include" -L"$(brew --prefix sdl3)/lib" tools/test_rumble.c -lSDL3 -o build/test-rumble
Expand Down Expand Up @@ -507,6 +522,10 @@ jobs:
run: python3 tools/test_delete_guard.py
- name: Data folder move (cut off at every step)
run: python3 tools/test_data_move.py
- name: Self-updater (manifest, signature, swap and rollback; Windows file rules)
run: |
clang++ -std=c++17 -O1 -Iruntime tools/test_update.cpp -o build/test-update.exe
build/test-update.exe
- name: Movie extractor lifecycle regression
run: |
clang -std=gnu11 -O1 tools/test_movie_extractor.c -lavformat -lavcodec -lavutil -lswscale -o build/test-movie-extractor.exe
Expand Down Expand Up @@ -623,6 +642,10 @@ jobs:
run: python3 tools/test_delete_guard.py
- name: Data folder move (cut off at every step)
run: python3 tools/test_data_move.py
- name: Self-updater (manifest, signature, swap and rollback; Windows file rules)
run: |
clang++ -std=c++17 -O1 -Iruntime tools/test_update.cpp -o build/test-update.exe
build/test-update.exe
- name: Movie extractor lifecycle regression
run: |
clang -pthread -std=gnu11 -O1 tools/test_movie_extractor.c -lavformat -lavcodec -lavutil -lswscale -o build/test-movie-extractor.exe
Expand Down
30 changes: 28 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,23 @@ jobs:
echo "- Linux: \`linux-x86_64.AppImage\`, \`linux-aarch64.AppImage\`"
echo "- Android: \`android.apk\`, installed as its own app, LAS Recomp Nightly, beside the release one"
echo "- iPhone and iPad: \`iOS.laskit\`, made into the app with a nightly desktop build of the same date"
# Changes: the pull requests merged since the previous round, newest round first, with the earlier
# rounds' lists kept (the last 30), so a player several nightlies behind sees everything in the start
# screen's update dialog. Each round starts with a "nightly-changes: <stamp>" line; the dialog shows the
# rounds newer than its own build (runtime/ui/update_notes.h).
CHANGES=
if [ -n "$RSHA" ]; then
MERGES=$(gh api "repos/$GH_REPO/compare/$RSHA...$SHA" --jq '.commits[] | select(.parents | length > 1) | .commit.message | split("\n") | .[0]' 2>/dev/null | sed -n 's/^Merge pull request \(#[0-9]*\).*/\1/p' | tr '\n' ' ' || true)
[ -n "$MERGES" ] && { echo; echo "New since the previous nightly: $MERGES"; }
CHANGES=$(gh api "repos/$GH_REPO/compare/$RSHA...$SHA" --jq '.commits[] | select(.parents | length > 1) | .commit.message | capture("^Merge pull request #(?<n>[0-9]+)[^\n]*\n\n(?<t>[^\n]+)") | "- \(.t) (#\(.n))"' 2>/dev/null | tac || true)
fi
OLD=$(awk '/^<!-- nightly-changes: [0-9][0-9]* -->$/ { n++ } n && n < 30 && !/^To report a problem/' <<< "$BODY" | sed '/^<!-- nightly-round:/,$d')
if [ -n "$CHANGES" ] || [ -n "$OLD" ]; then
echo; echo "## Changes"; echo
if [ -n "$CHANGES" ]; then
echo "<!-- nightly-changes: $STAMP -->"
echo "**$(date -u -d "${STAMP::8}" '+%Y-%m-%d')**"; echo
echo "$CHANGES"; echo
fi
[ -n "$OLD" ] && echo "$OLD"
fi
echo
echo "To report a problem, open an [issue]($URL/issues), say it's a nightly and which date, and attach the log (\`lasrecomp.log\` in the data folder)."
Expand Down Expand Up @@ -161,6 +175,9 @@ jobs:
find "$A" -type f \( -perm +111 -o -name '*.dylib' -o -name '*.so' \) | while read -r f; do
if nm "$f" 2>/dev/null | grep ' _\{0,1\}f_70' >/dev/null; then echo "::error::game code in $f"; exit 1; fi
done
- name: Sparkle feed
env: { UPDATE_SIGNING_KEY: '${{ secrets.UPDATE_SIGNING_KEY }}' }
run: tools/sparkle_appcast.sh nightly build/dist/*-macOS.dmg
- name: Publish
env: { GH_TOKEN: '${{ github.token }}', GH_REPO: '${{ github.repository }}' }
run: tools/nightly_publish.sh build/dist/*-macOS.dmg macOS.dmg
Expand Down Expand Up @@ -283,6 +300,9 @@ jobs:
bad=$(find "$D" -type d \( -name extracted -o -name 'generated*' -o -name exefs -o -name romfs \);
find "$D" -name '*.c' ! -path '*/zig/lib/*' ! -path '*/gamelib-src/gamelib_entry.c'; find "$D" -name 'lasgame*')
[ -z "$bad" ] || { echo "::error::must not ship: $bad"; exit 1; }
- name: Update manifest
env: { UPDATE_SIGNING_KEY: '${{ secrets.UPDATE_SIGNING_KEY }}', VERSION: '${{ needs.plan.outputs.version }}' }
run: tools/update_manifest.sh "$VERSION" windows build/dist/*-windows.zip "build/dist/LAS Recomp"
- name: Publish
shell: bash # (Git Bash: gh is on its PATH, not MSYS2's)
env: { GH_TOKEN: '${{ github.token }}', GH_REPO: '${{ github.repository }}' }
Expand Down Expand Up @@ -349,6 +369,9 @@ jobs:
bad=$(find "$D" -type d \( -name extracted -o -name 'generated*' -o -name exefs -o -name romfs \);
find "$D" -name '*.c' ! -path '*/zig/lib/*' ! -path '*/gamelib-src/gamelib_entry.c'; find "$D" -name 'lasgame*')
[ -z "$bad" ] || { echo "::error::must not ship: $bad"; exit 1; }
- name: Update manifest
env: { UPDATE_SIGNING_KEY: '${{ secrets.UPDATE_SIGNING_KEY }}', VERSION: '${{ needs.plan.outputs.version }}' }
run: tools/update_manifest.sh "$VERSION" windows-arm64 build/dist/*-windows-arm64.zip "build/dist/LAS Recomp"
- name: Publish
shell: bash # (Git Bash: gh is on its PATH, not MSYS2's)
env: { GH_TOKEN: '${{ github.token }}', GH_REPO: '${{ github.repository }}' }
Expand Down Expand Up @@ -404,6 +427,9 @@ jobs:
find "$A" -type f \( -perm /111 -o -name '*.so*' \) | while read -r f; do
if readelf -Ws --wide "$f" 2>/dev/null | grep ' f_70' >/dev/null; then echo "::error::game code in $f"; exit 1; fi
done
- name: Update manifest
env: { UPDATE_SIGNING_KEY: '${{ secrets.UPDATE_SIGNING_KEY }}', VERSION: '${{ needs.plan.outputs.version }}' }
run: tools/update_manifest.sh "$VERSION" linux-${{ matrix.arch }} build/dist/*-linux-${{ matrix.arch }}.AppImage
- name: Publish
env: { GH_TOKEN: '${{ github.token }}', GH_REPO: '${{ github.repository }}' }
run: tools/nightly_publish.sh build/dist/*-linux-${{ matrix.arch }}.AppImage linux-${{ matrix.arch }}.AppImage
Expand Down
40 changes: 33 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,18 @@ jobs:
if nm "$f" 2>/dev/null | grep ' _\{0,1\}f_70' >/dev/null; then echo "::error::game code in $f"; exit 1; fi
done
ls -la build/dist
# Sparkle's feed for the macOS app (tools/sparkle_appcast.sh; none without the key)
- name: Sparkle feed
env:
UPDATE_SIGNING_KEY: ${{ secrets.UPDATE_SIGNING_KEY }}
TAG: ${{ inputs.tag || github.event.release.tag_name }}
run: tools/sparkle_appcast.sh "$TAG" build/dist/*-macOS.dmg
- uses: actions/upload-artifact@v4
with:
name: macos
path: build/dist/*.dmg
path: |
build/dist/*.dmg
build/dist/appcast-*.xml
if-no-files-found: error
compression-level: 0 # (already compressed)

Expand Down Expand Up @@ -225,10 +233,16 @@ jobs:
find "$D" -name '*.c' ! -path '*/zig/lib/*' ! -path '*/gamelib-src/gamelib_entry.c'; find "$D" -name 'lasgame*')
[ -z "$bad" ] || { echo "::error::must not ship: $bad"; exit 1; }
ls -la build/dist
# the self-updater's signed manifest (tools/update_manifest.sh; none without the key: Download only)
- name: Update manifest
env: { UPDATE_SIGNING_KEY: '${{ secrets.UPDATE_SIGNING_KEY }}', VERSION: '${{ needs.check.outputs.version }}' }
run: tools/update_manifest.sh "$VERSION" windows build/dist/*-windows.zip "build/dist/LAS Recomp"
- uses: actions/upload-artifact@v4
with:
name: windows
path: build/dist/*.zip
path: |
build/dist/*.zip
build/dist/update-*.txt
if-no-files-found: error
compression-level: 0

Expand Down Expand Up @@ -439,10 +453,15 @@ jobs:
if readelf -Ws --wide "$f" 2>/dev/null | grep ' f_70' >/dev/null; then echo "::error::game code in $f"; exit 1; fi
done
ls -la build/dist
- name: Update manifest
env: { UPDATE_SIGNING_KEY: '${{ secrets.UPDATE_SIGNING_KEY }}', VERSION: '${{ needs.check.outputs.version }}' }
run: tools/update_manifest.sh "$VERSION" linux-${{ matrix.arch }} build/dist/*-linux-${{ matrix.arch }}.AppImage
- uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.arch }}
path: build/dist/*.AppImage
path: |
build/dist/*.AppImage
build/dist/update-*.txt
if-no-files-found: error
compression-level: 0

Expand Down Expand Up @@ -548,7 +567,8 @@ jobs:
GH_REPO: ${{ github.repository }}
run: |
cd dist
ls -la
mkdir ../manifests && mv update-*.txt appcast-*.xml ../manifests/ 2>/dev/null || true # (the updaters', beside the files)
ls -la . ../manifests
N=6; [ "$ARM64" = true ] && N=7
[ "$(ls | wc -l)" = $N ] || { echo "::error::expected $N files"; exit 1; }
# (a test build: only the platforms its fix targets ship; the others were built as a compile check)
Expand All @@ -559,11 +579,17 @@ jobs:
*) echo "::error::unknown file $f"; exit 1 ;; esac
[[ " $PLATFORMS " == *" $p "* ]] || { echo "built, not shipped: $f"; rm "$f"; }
done
for m in ../manifests/*; do # (a manifest or feed goes up only with its platform's file)
[ -f "$m" ] || continue
plat=$(basename "$m"); plat=${plat#update-}; plat=${plat#appcast-}; plat=${plat%.*}
ls ./*-"$plat".zip ./*-"$plat".AppImage ./*-"$plat".dmg >/dev/null 2>&1 || rm "$m"
done
MANIFESTS=(); for m in ../manifests/*; do [ -f "$m" ] && MANIFESTS+=("$m"); done
if [ "$EVENT" = release ]; then # (published on GitHub: attach the files, the notes get the sha256 table)
gh release view "$TAG" --json body -q .body | grep -v '^> The download files are being built' > ../body.md || true
{ cat ../body.md; echo; echo "| File | sha256 |"; echo "|---|---|"
for f in *; do echo "| \`${f// /.}\` | \`$(sha256sum "$f" | cut -d' ' -f1)\` |"; done; } > ../notes.md
gh release upload "$TAG" --clobber *
gh release upload "$TAG" --clobber * "${MANIFESTS[@]}"
gh release edit "$TAG" --notes-file ../notes.md
gh release view "$TAG" --json url,assets -q '.url, (.assets[] | "\(.name) \(.size)")'
exit 0
Expand All @@ -584,9 +610,9 @@ jobs:
if DRAFT=$(gh release view "$TAG" --json isDraft -q .isDraft 2>/dev/null); then
[ "$DRAFT" = true ] || { echo "::error::release $TAG is already published: not touched"; exit 1; }
gh release edit "$TAG" --draft --target "$SHA" --notes-file ../notes.md "${PRE[@]}"
gh release upload "$TAG" --clobber *
gh release upload "$TAG" --clobber * "${MANIFESTS[@]}"
else
gh release create "$TAG" --draft --target "$SHA" --title "$TAG" --notes-file ../notes.md "${PRE[@]}" *
gh release create "$TAG" --draft --target "$SHA" --title "$TAG" --notes-file ../notes.md "${PRE[@]}" * "${MANIFESTS[@]}"
fi
gh release view "$TAG" --json url,isDraft,assets -q '.url, .isDraft, (.assets[] | "\(.name) \(.size)")'

Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ items picked up anywhere, floor key spots included, get a message naming their d

`python tools/test_text_speed.py` checks the Text speed hooks (Normal, Fast, Instant) without game data.

The updater: `tools/test_update.cpp` (manifest, signature, the swap and its rollback; build line at its top) and
`tools/test_update_e2e.sh` (download, check, swap and restart against a local web server), without game data or network.

Build-cache regression tests use synthetic inputs and the production scheduler:
`python tools/test_build_cache.py` and `python tools/test_gamebuild_resume.py`.
On Windows, also run `python tools/test_windows_processes.py` to check independent
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ none of their files are used):
- [BIZ UDPGothic](https://github.com/googlefonts/morisawa-biz-ud-gothic) by Morisawa - the game's text on Linux when you haven't imported the Switch fonts: a free font from the same universal-design gothic family as the Switch's UD Shin Go (SIL Open Font License 1.1, `third_party/fonts/BIZUDPGothic/OFL.txt`)
- [DejaVu Sans](https://dejavu-fonts.github.io) - the in-game menu and button letters when no system font fits, and the game text's last resort (Bitstream Vera / DejaVu license, `third_party/fonts/DejaVu/LICENSE`)
- [Vulkan Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator) - Windows and Linux renderer (MIT)
- [Monocypher](https://monocypher.org) by Loup Vaillant and contributors - checks the signature of updates on Windows and
Linux (CC0, `third_party/monocypher/LICENCE.md`)
- [Sparkle](https://sparkle-project.org) - the macOS app's updater (MIT, `Contents/Resources/Sparkle-LICENSE.txt` in the app)
- [SMAA](https://github.com/iryoku/smaa) by Jorge Jimenez, Jose I. Echevarria, Belen Masia, Fernando Navarro and Diego
Gutierrez - the anti-aliasing option (MIT, `third_party/smaa/LICENSE.txt`)
- [AMD FidelityFX Super Resolution 1](https://github.com/GPUOpen-Effects/FidelityFX-FSR) - the Windows and Linux upscaler
Expand Down Expand Up @@ -348,7 +351,7 @@ LAS Recomp's own code (the recompiler tools, the runtime, the randomizer additio
Vulkan Memory Allocator (MIT), SMAA (MIT), AMD FSR 1 (MIT), the Baloo 2 and BIZ UDPGothic fonts (SIL OFL 1.1), the DejaVu Sans font (Bitstream Vera / DejaVu license), SDL 3 (zlib), FFmpeg (LGPL 2.1+, linked dynamically, and statically in the iOS app), the
Zig compiler (MIT; its LLVM / Clang / LLD: Apache 2.0 with LLVM exceptions; its C library headers keep their own
licenses), the iOS kit's Mach-O linker (LLD as built by the Rust project: Apache 2.0 with LLVM exceptions), miniz
(MIT: the iOS kit and the .ipa it makes), and the generator helpers' bundled libraries listed under Credits (oead / evfl / Keystone in the seed
(MIT: the iOS kit and the .ipa it makes), Monocypher (CC0: update signatures), Sparkle (MIT: the macOS updater), and the generator helpers' bundled libraries listed under Credits (oead / evfl / Keystone in the seed
generator and Unicorn in the game code generator are under the GPL, versions in the table below: each helper is a separate program the game runs, and its
sources are this repository plus those projects' published sources). The iOS app is the exception: iOS runs no helper
processes, so it embeds CPython and the seed generator's packages - oead, evfl and Keystone (GPL 2.0+ / GPL 2.0),
Expand Down
8 changes: 8 additions & 0 deletions docs/debug-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ Use it with `LARECOMP_INPUT` (to get into a save) and `LARECOMP_SAVE_DIR` (so th
| `LARECOMP_MENU_BAR` | entry number | Open the menu bar alone, its cursor on that entry: `0` Settings, `1` Cosmetics, `2` Randomizer, `3` Warp, `4` Save Editor, `5` Cheats, `6` Reset, `7` Quit, `8` the close button. |
| `LARECOMP_TOUCH_SHOW_INPUT` | 0 / 1 | iPhone, iPad and Android: show scripted input (`LARECOMP_INPUT`) on the touch controls, the buttons lit and the stick moved. |
| `LARECOMP_UPDATE_TAGS` | `tag,tag,...` | The update check sees these release tags instead of asking GitHub (no network). |
| `LARECOMP_UPDATE_JSON` | file | The update check reads this saved releases list instead of asking GitHub (the update dialog's changelog too). |
| `LARECOMP_UPDATE_OPEN` | `1` / `update` | The update dialog opens as soon as the update check finds one; `update` also presses Update. |
| `LARECOMP_UPDATE_URL` | URL | Update downloads `<URL>/<tag>/update-<platform>.txt` and the file it names from here instead of GitHub (`http://127.0.0.1:...`, `file:///...`). |
| `LARECOMP_UPDATE_KEY` | 64 hex | With `LARECOMP_UPDATE_URL`: the public key manifests are checked with (a test key; `tools/update_sign.cpp keygen`). |
| `LARECOMP_UPDATE_APP` | folder | Windows: the app folder Update replaces files in (default: the exe's). Linux updates `$APPIMAGE`. |
| `LARECOMP_UPDATE_NO_RESTART` | `1` | After Update installs (or rolls back), quit instead of starting the app again. |
| `LARECOMP_SPARKLE_FEED` | URL | macOS: Sparkle reads this appcast instead of the build's, and runs even in builds whose channel has no Update yet. |
| `LARECOMP_SPARKLE_AUTOINSTALL` | `1` | macOS: an update Sparkle downloaded installs at once and the app restarts, as its Install and Relaunch button does (no window to click). |
| `LARECOMP_FONT` | font file | Use this file for the system fonts the game asks for (.ttf, .otf, .ttc, .bfttf). |

## Logging and diagnostics
Expand Down
4 changes: 4 additions & 0 deletions runtime/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "hle.h"
#include "kernel.h"
#include "rando.h"
#include "update.h"

const char *g_romfs_dir;

Expand Down Expand Up @@ -324,6 +325,8 @@ int main(int argc, char **argv) {
#else
setvbuf(stderr, NULL, _IOLBF, 0);
#endif
update_boot(); // (an update's swap that was cut off, or a new version that never reached the start screen: the
// old one back, and started instead of this process. runtime/update.h)
const char *root = "extracted"; // (in the data root)
// LARECOMP_NO_LAUNCHER=1 (tools/game_slot.sh sets it for every test run): never the start screen - it can
// delete game files, and a test's extracted/ may be a link to someone else's. Where it would come up (a forced
Expand Down Expand Up @@ -368,6 +371,7 @@ int main(int argc, char **argv) {
launcher_run(root);
}
boot(root);
update_reached_start_screen(); // (--play skips the start screen: the game booting counts the same)
int kind = ui_run(); // window and input on the main thread; returns when a reboot is requested
teardown();
title = kind == RT_REBOOT_TITLE;
Expand Down
Loading
Loading