Commit Graph
114 Commits
Author SHA1 Message Date
Valiantsin Dzerakh 1a1f21ebe0 Merge branch 'dev' into task/vloc 2026-11-13 20:11:40 +03:00
Valiantsin DzerakhandClaude Opus 5.5 44bc5887f0 gen.py keeps 8 V registers per function in locals by default
K = 8 cut guest time 3.9-6.2% in the town on a 7900X against K = 0. func.py tests the same default; --v-locals 0
gives the previous output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 20:11:39 +03:00
Valiantsin DzerakhandClaude Opus 5.5 eb8c7ea888 gen.py --v-locals K keeps the K most used V registers of each function in C locals
recomp/vlocals.py rewrites each emitted function: c->v forms become the RT_VLOCALS accessors of runtime/simd.h, the
K registers the function names most get bits in VMASK, they are loaded at entry, stored where the dirty mask may hold
them before calls and exits, and reloaded after calls; --v-trust skips the reload of V8-V15. A function with a form the
rewrite does not know keeps every register in the Cpu. K = 0, the default, emits the same C as before. The manifest
counts the rewritten functions and syncs. tests/diff/func.py takes --v-locals, --v-trust and --work (one work
directory per concurrent run).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 19:40:05 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bc578148ab Write RomFS layout folders only for the screen shapes and prompts this player uses
The setup wrote 64 patch folders: every prompts style for all 15 shaped game resolutions. The new shapes step
(installer/screens.py) writes romfs-patches-<w>x<h> only for the shapes of the connected displays, the output_res the
game defaults to on each and the totk.ini output_res, and the prompts' shaped folder only for the style totk.ini
selects. One folder per shape: the runtime maps the game resolution to its shape's size (cfg.c cfg_shape_size, the
closest ratio within 1%), and an exact-size folder from an older install still wins. The settings menu marks a game
resolution whose shape has no folder and can start the generator for it in the background, for the next start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 19:02:31 +03:00
Valiantsin DzerakhandClaude Opus 5.5 df3e90dc4c Merge task/pr1136: opt-in gameplay tweaks for keyboard and mouse, the wheel turns and moves an Ultrahand object, switches weapons, steps the D-pad strips and zooms the map smoothly (RxEmam)
Pull request #1136 with three fixes: the Russian and Portuguese rows name Ultrahand as the catalogs do, smooth map
zoom takes the wheel only on the map menu_cursor.c finds, and the weapon bar opens only where the camera hooks saw
free roam, a lock-on or a mount. Off by default (gameplay_tweaks_enabled = 0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 18:29:37 +03:00
Valiantsin DzerakhandClaude Opus 5.5 a9de583d79 Merge pull request #1002: game 1.1.0 gets the core frame and camera patch sets of 1.2.1 and 1.4.3, so the frame rate, cursor, field of view and aspect ratio options work on it (shenjackyuanjie)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 18:29:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d14e2a8f62 Merge pull request #1136 into task/pr1136
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 18:21:53 +03:00
itaskaev2andClaude Opus 5.5 f854d67e6f Name the other program that holds totk.exe when the setup cannot link it
When ld.lld cannot write the totk.exe it links in the setup's temp build folder (Permission denied), the setup
showed only "Compiling totk.exe failed". In #1122 the holder was an antivirus that flagged the new exe, not a
running game. The compile step now recognises that failure in the build log and says what to do: close the game,
exclude the setup's and the install folder from the antivirus, restart Windows and run the setup again. Texts in
en, ru, pt-BR and zh-Hans; build_game.py's own line names the antivirus too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 11:17:51 +01:00
0xEmz 312e59a9f7 Add optional mouse wheel and keyboard gameplay tweaks (gameplay_tweaks_enabled, off by default). 2026-11-12 03:29:24 +02:00
Valiantsin Dzerakh 6ec533524c Merge pull request #1098 into task/kbmwave 2026-11-11 13:10:00 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f23dc9ffb2 Merge pull request #1101: a mod's file named for another game version is served under its own name, so a sound mod that ships one plays (xellow78-lgtm)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 13:08:04 +03:00
Louis JusticeandClaude Opus 5.5 c2716d2e7c The keyboard and mouse text prompts show Y as T, and the setup draws the PC prompts from totk.ini's bindings.
Y has two default keys: the left mouse button, which is a menu's A while the pointer is shown, and T, which presses Y
everywhere. The button font (menu guides, the dialogue log) now shows Y as its first bound key that is not a mouse
button; the button guide in play and the action prompt keep the left button. The PC prompts are a setup step of their
own, keyed by the bind_ lines of the install's totk.ini, so running the setup again after rebinding redraws them
without preparing the shaders again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:11:38 -05:00
Valiantsin DzerakhandClaude Opus 5.5 bb339a614d Import at the top of tests/run_all.py and list cheats_vm_check
json, shutil and tomllib were imported inside the functions that use them. cheats_vm_check came into dev after the
table was written; it compiles runtime/cheats.c with clang like mouse_direct_check, so it takes the same cc need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 23:08:43 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8fc4d0a2d2 Merge pull request #864: tests/run_all.py, one entry point for the tests (#675 by zzs181, carried by itaskaev2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 23:04:41 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1cbe7bdb79 Merge pull request #990: the AppImage shadow test refuses a venv interpreter instead of passing without the user site (jay23606)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 22:59:10 +03:00
Claude 2cc0a4eaa6 Serve a mod's file named for another game version under its own name instead of leaving it out
A mod file whose name carries Product.<n> and which the RomFS lacks was counted as made for another game version and
never served. The game does ask for such names: on 1.4.3 with mods on, the file trace (trace = fs) shows it opening
Sound/Resource/Pack_MasterSword.Product.110.bars.zs, while its RomFS holds only the Product.140 and the unversioned
file. A sound mod that ships its pack under all those names was silent here and works on a console, where LayeredFS
shows the game every file of a mod. Such files are now added overlays like any other new file. Another version's
resource size table is still not served and still lends its entries; the files are still counted, and the Mods tab
and docs/mods.md now say they are read only when asked for by name.

tests/mods_romfs_check.py gets a case for it. Not run here: the test and --probe-fs need a build and the game's files.
runtime/romfs.c compiles with llvm-mingw.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TgQM2zwuVagwScByEJhT8V
2026-11-10 14:32:15 -05:00
itaskaev2andClaude Opus 5.5 95052a280e List the tests added since, and the differential tests, in tests/run_all.py
The table predates exefs_patches_test and leaves out settings_doc_check, mouse_direct_check and tests/diff. A name may now name a script below tests/ (diff/simd), and a need of a compiler (cc, which mouse_direct_check passes as --cc) runs without --all, as only game files, a build, the embeddable Python and a desktop wait for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 18:21:14 +01:00
zzs181 5635dd5e3a Let a test need more than one thing, and find the romfs where it actually lives
mods_romfs_check needs both a built totk.exe and the extracted romfs, and the romfs was hard-coded to build/extracted/<version>/romfs in two places inside the test. Needs now compose with '+' (exe+romfs) and each gets its own placeholder, the romfs is found in the extracted tree, the work dir or the GUI builder's record (build/build_gui.json), and any build/v143-*/totk.exe counts as the built exe - so the test runs on the layouts people actually build in instead of failing on a path it assumed. The test takes --romfs; its default is the old path, so running it by hand is unchanged.
2026-11-10 18:21:14 +01:00
zzs181 88cd32fddf Add tests/run_all.py: one entry point for the tests, each with its interpreter and needs
Each test already says in its header how it wants to be run; this reads that intent into one table (.venv for the lifter, .venv-py314 for the extraction tools) and runs them all:

    python tests/run_all.py                 # the ones that need no game files
    python tests/run_all.py --all           # also the ones that read game files or a built totk.exe

A need that cannot be met here is SKIP with the reason, never a failure: a missing game dump is not a broken build. Exit is 0 when nothing failed, 1 when something did. Windows picks clang up from C:/msys64/ucrt64/bin for the tests that compile C; on any other host the PATH is left alone. No third-party imports, so this runs before any venv is trusted.
2026-11-10 18:21:14 +01:00
Valiantsin DzerakhandClaude Opus 5.5 8da13aa9b4 Merge pull request #1006: stop the installer space check at an unavailable drive root (Luxury213)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 17:43:41 +03:00
jay23606 bbd63f9720 Address review feedback 2026-11-10 09:24:56 -05:00
shenjack 41899438ea Merge remote-tracking branch 'origin/dev' into pr/v110-patch-parity 2026-11-10 14:25:07 +08:00
Valiantsin DzerakhandClaude Opus 5.5 14b1b1aece Run cheat opcodes C0-C3 in the data cheat VM (#973)
The VM refused C0 (register conditional), so cheats like C046B400 FFFFFFFF were greyed out as unsupported. C0 now
runs with dmnt's operand types 0-5, widths and conditions; C1 and C2 save, restore and clear registers, C3 moves
registers to and from the static registers. tools/cheats.py gives the same opcode lengths and accepts the same opcodes.

skip() took the end of a nested block at depth 1 for the else of the failed outer block; it now counts depth the way
dmnt does, and 2x000000 is an else only for x = 1.

tests/cheats_vm_check.py runs tools/cheats.py and runtime/cheats.c on cheats of its own, the two from the issue
included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 08:05:01 +03:00
Luxury 2907f4efc3 Stop the installer space check at an unavailable drive root 2026-11-08 23:09:58 -05:00
shenjack 68b918933f Check every SIMD register for integer-only patch preservation 2026-11-09 09:13:09 +08:00
shenjack c8eb315c1e Describe 1.1.0 field of view support and strengthen patch preservation checks 2026-11-09 08:44:44 +08:00
shenjack 89364414ea Check the 1.1.0 patch contracts and document their coverage 2026-11-09 08:39:10 +08:00
Valiantsin DzerakhandClaude Opus 5.5 35968c1efb Merge pull request #990: Linux AppImage: ignore the user site-packages so installer.gui imports (jay23606)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:13:00 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bdb41dff7e Merge pull request #979: PC prompts for every game resolution the setup lays the UI out for (Wintego)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:36:02 +03:00
Wintego 62b8e9dee5 Draw the PC prompts' Shift as an arrow over its name
The arrow alone read as a direction (review of #585). The key keeps the width of the game's own glyph, so the name goes
under a solid arrow rather than on a wider key.
2026-11-08 20:35:55 +03:00
jay23606 9d07157b3e Linux AppImage fails with "No module named installer.gui" when the PyPI 2026-11-08 11:45:21 -05:00
Wintego ceece5683a Make the PC prompts for every game resolution the setup lays the UI out for
The setup wrote romfs-patches-pc for 16:9 only, so prompts = pc on a 21:9, 32:9, 16:10 or 3:2 screen kept the game
resolution at 1920x1080 (cfg.c) or, with output_res set to the screen's shape, fell back to the Switch prompts.

- make_romfs_patches.py --reuse <folder>: a file of an earlier overlay whose contents match is hard-linked (copied
  where links fail) instead of compressed again; the output is byte for byte the same.
- The setup builds romfs-patches-pc-<w>x<h> for each of ASPECT_SIZES from romfs-patches-pc with --reuse: only the
  Common archive is compressed, so the fifteen folders take about two minutes and 6 MiB each instead of 22 minutes
  and 73 MiB each.
- cfg.c: the display-shaped output_res default applies with prompts = pc when romfs-patches-pc-<w>x<h> is there
  (romfs_shaped_pc_ready); Xbox prompts keep 1920x1080 as before.
2026-11-08 13:20:17 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1c59c98adf Merge #878: keep the native camera distance after aiming in direct mouse mode
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 11:21:19 +03:00
null15564 2a937319b4 Restore native camera distance after aiming with direct mouse input 2026-11-07 05:55:00 +07:00
itaskaev2andClaude Opus 5.5 9233322aa8 Ignore every linked file in the worktree test's scratch repository
tools/worktree.py links config.local.toml and CLAUDE.local.md since e3e72df, but the test's .gitignore listed only the first, so git status in the new worktree showed CLAUDE.local.md and the test failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 19:08:11 +01:00
Valiantsin Dzerakh 545a97d7ff Merge branch 'pr814' into task/hudshape 2026-11-06 20:24:04 +03:00
fa94e36549 Store the data writes of mods' ExeFS patch files into main before the game runs
An IPS, IPS32 or pchtxt file for main that writes main's .rodata, .data or .bss was refused as a whole. Such writes
need no lifting: tools/exefs_patches.py now puts them in build-cache/exefs.data, and runtime/mods.c stores them into
the loaded main before any game code runs, as emulators and Atmosphere apply a patch file to the module before its
dynamic linker runs. A DT_RELR word gets main's base added; bytes over words an explicit-addend relocation fills change
nothing and are dropped; a write into the dynamic linker's tables, a lazily bound function pointer or outside main's
image keeps the file unsupported. A mod whose data lines do not all fit the build keeps its code patches off too.

The mods are applied from the bottom one up (mods_exefs_apply), so where two mods write the same bytes the higher one
wins, as it does for files. --probe-mods checks it with two mods writing one byte.

The lifted code reads some of main's bytes at lift time (the jump tables). recomp/gen.py lists those ranges in
<gen>/main/folded.txt, and the setup checks the data writes against them after the lift: a file that writes them
becomes unsupported, since the change would not reach the generated code. Generated C without mods is unchanged.

This is the data part of #790 (ericdallo's ExeFS work), split out on its own; the plugin part follows separately.

Co-Authored-By: itaskaev2 <165683571+itaskaev2@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 15:51:42 +01:00
Luxury 057a2d751c Account for Tk screen size rounding in the DPI test 2026-11-05 18:37:07 -05:00
Valiantsin DzerakhandClaude Opus 5.5 a27e85b673 Merge task/mouse (1.2.1): the direct mouse camera on game 1.2.1 (issue #751)
All 72 1.4.3 sites mapped to 1.2.1 main (82 patch lines), the values that differ in a per-version MouseLayout. The
player state (ability, bow in hand) is not known on 1.2.1 yet, so mouse_aim_scale has no effect there, and the menu
pointer and map cursor stay 1.4.3 only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 18:48:19 +03:00
Valiantsin DzerakhandClaude Opus 5.5 61d0075039 Give game 1.2.1 the direct mouse camera of 1.4.3 (issue #751)
The 72 mouse_direct sites of patches-v143.txt mapped to the 1.2.1 main by enclosing function, each original word
checked: the camera input update, free orbit, Ultrahand and the 16 player camera modes. 1.2.1 keeps some values in
other registers and stack slots (camera input x in s11, orbit angles at sp+0x3c/0x40, Ultrahand x in s9), so the
hooks read a per-version MouseLayout; the 1.4.3 values and behaviour are unchanged.

Where 1.2.1 adds a turn in a shared helper, the degrees go to the store of the helper's result (Aiming's pitch
target, new ROLE_BASE_STORE) or to the turn it is given (Horse yaw). Wakeboard, ShieldSurfing and Tail read the stick
twice (REPEAT on the first read), the dialogue cameras' angle loads are pre-indexed (mov -> add, as ClimbObj).
The player state (ability, bow in hand) is not known on 1.2.1 and reads as not found.

tests/mouse_direct_check.py runs the hooks with both layouts and checks each load-site table against its patch file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 18:47:26 +03:00
Valiantsin DzerakhandClaude Opus 5.5 dc9a29f13c Merge task/mouse (1.4.3): PR #752 and #753 with the direct mouse camera follow-ups
The menu pointer stays through tab switches, the mouse moves the map cursor and the wheel zooms it (#769). Every player
camera turns at the 0.3.10 rate of 0.08 degrees a count, the pitch no longer springs back after an aim (#717) and a
mouse shake detaches a fused part from what Ultrahand holds (#734). The load hooks return the game's own value in a step
without mouse motion, so a gamepad player gets the game's values unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 18:02:41 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b77962bae5 Keep the 0.3.10 mouse rate in the direct camera: 0.08 degrees a count in every camera and Ultrahand at its old rate (PR #753 follow-up)
PR #753 unified the cameras at 70/1500 = 0.0467 degrees a count and doubled Ultrahand's rate, which made every
existing mouse_sens turn the free camera 42% slower. The free camera keeps 0.08 degrees a count at mouse_sens 1, every
camera #753 unifies takes the same 0.08, and the held object keeps 0.01 stick units a count over the frame ratio (with
#753's cap of three full tilts a step). A mouse shake now needs 125 counts a swing at sensitivity 1 (10 degrees).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:49:49 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d52463b2cc Keep the game's own value in the direct mouse camera load hooks when the mouse did not move (PR #753 follow-up)
The stick loads returned the sample's pad stick even in a step without mouse motion, which drops anything the game
writes to the camera input's stick after the input update (main has 426 stores to +0x420/+0x424). The base loads added
0 degrees, which turns a -0 into +0. Both now return the loaded value untouched when the step has no mouse motion and no
mouse shake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:48:40 +03:00
Valiantsin DzerakhandClaude Opus 5.5 184221f032 Merge PR #753 from Tempus3214: the direct mouse turns every player camera at one rate, the pitch no longer springs back after an aim, and a mouse shake detaches a fused part from what Ultrahand holds (fixes #734, #717)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:32:19 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c2c68aa2cc Prefilled base and update paths stay only while the chosen install recorded the same files
Another install, say 1.2.1 while the recorded update is 1.4.3, would extract again from them. Each dest change compares the prefilled file's name and size (one stat) with the install's totk-install.json inputs and clears the field on a mismatch. Fields the user picked or typed are never cleared, and a folder without state keeps the prefill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:27:03 +03:00
Valiantsin DzerakhandClaude Opus 5.5 23c278ef9f The setup window waits at most 1.5 seconds for the recorded paths
A recorded path on a disconnected network share can block its stat call. The paths load in a daemon thread and nothing is prefilled when it has not returned in time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:22:34 +03:00
Valiantsin DzerakhandClaude Opus 5.5 a2843c3fbf The setup window remembers the base, update, keys and firmware paths along with the install folder
A reinstall or a switch to another game version starts with the form filled in. Only absolute paths are stored, never the keys file's contents, and an entry that no longer exists, has the wrong kind or cannot be statted is dropped on load. Follows #715 by DanielSvoboda.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:21:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 640990afcc The setup window starts with the last install folder, kept in a per-user file
An update needs only the install folder: the recorded game language and the other inputs come from totk-install.json. installer/recent.py stores the folder in %LOCALAPPDATA%\TotK Recomp\setup.json (XDG state dir elsewhere), outside the release folder, so a new release finds it.

Idea from #715 by DanielSvoboda.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 17:14:23 +03:00
Valiantsin DzerakhandClaude Opus 5.5 49de824008 Merge PR #602: make the setup window DPI aware so Windows does not stretch it (ethanblazkowicz)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 16:56:52 +03:00
Tempus3214andClaude Opus 5.5 8235ea8d34 Fix the crash when the camera turns vertically while climbing a creature
The ClimbObj pitch hook replaced the pre-indexed load ldr s1, [x22, #0x88]! and wrote the write-back to x22 from the
host call. The lifter keeps X19-X29 in locals across a call and does not reload them, so the write-back was lost and
the following str s0, [x22] wrote the pitch over the camera object's vtable pointer; the next virtual call crashed
(seen climbing a Stone Talus). The mov x22, x19 before the load is now patched to add x22, x19, #0x88, the hook
performs a plain ldr s1, [x22], and load hooks no longer support write-back loads at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 05:43:25 -03:00