Commit Graph
371 Commits
Author SHA1 Message Date
shinodanpenandClaude bb6523a080 The audio_drain_fix texts say when the game's guard fires: evenly paced audio frames, not any run above 200 fps (#337)
The texts that came with the audiodrain set (docs/settings.md, totk.ini.example, the comments in patches-v121.txt and
patches-v143.txt) said that above about 200 game updates a second the game switches its sound off. Every run behind
them had captured the mix with audio = none. With a device playing, on Linux with PipeWire, the game keeps its sound at
240 fps without the set.

The guard (1.2.1 main+0x9bcdc4) sets its count back to 0 whenever a free list is there (0x9bce00), which takes two
audio frames between two updates of the game. The mixer's timer renders one frame every 5 ms, so at 240 updates a
second that never happens and the count reaches 300. A device paces the render thread in bursts after each period
(audren.c, gap_ns: 4 ms apart on Linux; 0 on Windows, read from the code and not measured), so it happens several times
a second. Sampled on the render thread on Linux with PipeWire's 1024-frame periods: 200 frames a second either way, 76%
of them 4 ms after the one before with the device, 939 of 940 at 5 ms with the timer. The count and the switch have
not been read in a run.

The mixer also keeps time by its timer while a device takes nothing. Measured at fps_limit 240, same save and input
script, with the game's audio stream paused from outside (pw-cli on its PipeWire node, not a real device stalling)
while the game ran at 240 fps. On 1.2.1 with the set off a pause of 5 s (two runs) and of 2 s (two runs) left the game
silent to the end of the run, also after the device resumed, and a pause of 1 s (one run) did not; with the set on a
pause of 5 s (two runs) left only the gap. On 1.4.3, one run each: silent after a pause of 5 s and of 2 s with the set
off, sound after a pause of 5 s with it on, sound with a device and no pause with the set off.

The numbers without a device now come from runs that can be named: 1.2.1 6 of 119 and 111 of 119, 1.4.3 3 of 119 and
113 of 120 (set off and on). They replace 5 of 118 / 108 of 118 and 2 of 118 / 110 of 119, which I cannot match to a
run any more.

Text only: no code, no site and no default changes. Not measured: Windows, a device with periods of 240 frames or
less, a real device stalling, 1.4.3 with a device and the set on.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-18 18:18:43 +00:00
Valiantsin Dzerakh 6c48e7a364 Merge dev into task/psp 2026-11-18 19:12:50 +03:00
Valiantsin DzerakhandClaude Opus 5.5 234a10f413 With sync_ahead an exit line gives the run total of the waits at a pool invalidate, as the shadow log lines stop at frame 1800 without TOTK_TRACE=perf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:55:13 +03:00
Valiantsin DzerakhandClaude Opus 5.5 ee6d5a6183 Merge dev into task/pr1275
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:54:52 +03:00
Valiantsin Dzerakh 792d5398ab Merge branch 'pr1276-head' into task/pr1276
# Conflicts:
#	docs/agents/symptoms.md
#	runtime/cfg.c
2026-11-18 18:46:16 +03:00
Valiantsin DzerakhandClaude Opus 5.5 6f03ccd30d The build and controls docs show the romfs-patches folder paths again, which held a carriage return in place of the backslash before romfs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:44:22 +03:00
Valiantsin DzerakhandClaude Opus 5.5 00b04df8b2 The game makes a missing layout or prompts folder in the background, at start and when a setting asks for it (#180, #378)
When the game resolution, the HUD width, the button prompts or the pad layout need a folder the install lacks (an
older setup, a failed setup step, a new display), totk.exe starts the setup's generator for it in the background
with the tools build-cache/rebuild.txt names, once per folder and process: at start for the settings in effect
(the resolution output_res asks for, also when the missing layout made this start 16:9), and from the settings
menu once a changed choice has stayed for 1.5 seconds or the menu closes. A missing 16:9 prompts folder is made too,
the PC prompts from totk.ini's bindings. The notes under Game resolution and Button prompts say the files are being
made and are used at the next start; when the tools did not start they say so and Try again starts them again.
The Prepare button is gone. Source builds without rebuild.txt and TOTK_ROMFS_PATCHES keep the old behaviour.

romfs_shape_missing and romfs_shape_prepare become romfs_folders_missing (a mask of the missing folders) and
romfs_folders_prepare; --probe-cfg and tests/romfs_shapes_check.py check the new decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:34:50 +03:00
Valiantsin DzerakhandClaude Opus 5.5 65e6dc50d3 Merge pull request #1284: on 1.4.3 DLAA's jitter goes into the game's camera instead of the viewport, so water seen at a low angle stops flickering (ipavlin98, #1126)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:34:05 +03:00
Valiantsin DzerakhandClaude Opus 5.5 902d91a94e Merge pull request #1275 head into task/pr1275
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:27:57 +03:00
Valiantsin DzerakhandClaude Opus 5.5 0ae38dd34a Merge pull request #1278: a VRAM mirror copies from the shadow only after the shadow sync, so loads with sync_ahead and replay_workers no longer leave stretched slabs (ipavlin98)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:26:25 +03:00
Valiantsin Dzerakh c1449b2a9b Merge commit 'refs/pull/1284/head' of https://github.com/valentderah/totk-pc-recomp into task/pr1284
# Conflicts:
#	docs/agents/symptoms.md
2026-11-18 18:22:56 +03:00
fabiomode2andClaude Opus 5.5 bae687a10d Add PlayStation button prompts (#180)
prompts = playstation shows the face buttons as circle, cross, triangle and square, L1 R1 L2 R2, Options and Share.
The setup writes romfs-patches-playstation (pad_layout = nintendo) and romfs-patches-playstation-xbox (xbox, auto) on
every install, next to the Xbox folders, and the Shapes step and the settings menu make their shaped folders like the
other styles. playstation-xbox lays the action prompt's diamond out as xbox-label does, cross at the bottom.

Rebased onto dev from pull request #741 by fabiomode2: the shaped folders, hud_width, the Xbox diamond and the
keyboard prompts' text glyphs of dev are kept, and cfg.c's shape default uses input_prompts_folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:10:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 402d1fe8b0 Merge pull request #1278 head into task/pr1278
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:07:48 +03:00
Valiantsin Dzerakh a111ca77b3 Merge commit 'refs/pull/1283/head' of https://github.com/valentderah/totk-pc-recomp into task/pr1283 2026-11-18 18:06:22 +03:00
ipavlin98 85888bc9ba Symptoms: the world behind the inventory streaked with DLAA, from the camera jitter's read-back taking the inventory camera's off-centre projection for a jitter 2026-11-18 10:50:58 +03:00
Valiantsin DzerakhandClaude Opus 5.5 96a809044d Steam Input motion: buttons move to Steam's virtual gamepad once it is up, a controller Steam hid keeps its own bias as the pad, and a sensor SDL could not turn on is logged with SDL's error (#1282)
1. scan_pads took a controller Steam hid when the virtual pad was not up yet and kept it for the session, so Steam's
   remapping was lost. While the open pad is a hidden one, pad_physical looks again every RESCAN_MS and scan_pads
   moves the buttons to the virtual pad; the hidden controller stays open as motion_extra, so motion goes on with
   the same bias and orientation.
2. pad_identity marked " (under Steam)" only on motion_extra; a hidden controller that became the pad lost the mark
   and could take the bias calibrated with Steam closed. The mark now follows steam_hidden_id.
3. After pull request #1024: sensors_ready logs SDL_GetError when the pad has both sensors but enabling them failed,
   instead of "has no gyro and accelerometer".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 09:08:52 +03:00
2dbdcf9a37 Read the gyro from the controller behind Steam Input's virtual gamepad when the game is started from Steam, from the patch in issue #1282
A game Steam starts gets SDL_GAMECONTROLLER_IGNORE_DEVICES with the controllers Steam reads itself and sees Steam's
virtual gamepad, which has no motion sensors. input.c steam_reveal keeps that list and clears the hint before
SDL_Init (only with motion on); scan_pads still takes the virtual pad for buttons and sticks, so Steam's remapping
holds, and motion_source opens the hidden controller for its gyro and accelerometer only. A bias belongs to the pad
as Steam presents it: " (Steam Input)" or " (under Steam)" in gyro_bias_pad. docs/controls.md, "Steam Input and
motion", says the Steam layout must bind the gyro to something or Steam zeroes it on the Steam Controller.

The patch as posted against 6151ac4, with sensors_ready merged with #1274's restart. Tested by the author on Linux
(Steam Controller) and the Steam Deck; not on Windows.

Co-authored-by: St5sz2Jk <St5sz2Jk@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 09:08:13 +03:00
ipavlin98 d5d62ab406 The camera jitter is described as dlaa_cam_jitter, and the game's matrix copies skip it at once while DLSS is not running 2026-11-18 09:01:16 +03:00
ipavlin98 77cb787de7 The water volume mask's depth bias can be turned off with volume_mask_bias = 0 (or TOTK_VOLUME_MASK_BIAS), a test setting to compare against 2026-11-18 09:01:00 +03:00
ipavlin98 0eab458030 Symptoms: water at a low angle flickering with DLAA from the viewport jitter the game's camera did not share; cfg knows DLAA_CAM_JITTER 2026-11-18 08:50:22 +03:00
ipavlin98 cc84958cee Give TotK's water volume mask draws a depth bias toward the viewer, so a puddle's surface, on which the volume's top face lies, counts as inside the volume in every frame instead of by rounding and the camera's sub-millimetre motion, which turned the puddle's reflection on and off in patches from frame to frame, more with DLAA 2026-11-18 05:41:05 +03:00
ipavlin98 07f9760971 Symptoms: stretched slabs over the ground in the Depths from a VRAM mirror copied from the shadow too early 2026-11-18 02:23:21 +03:00
ipavlin98 efb896235a DLSS without auto exposure is a setting, dlss_fixed_exposure, next to the other DLSS settings, off by default: 0 creates DLSS with AutoExposure as before, 1 without it, and a change recreates the features at once 2026-11-18 00:58:32 +03:00
ipavlin98 ae5fff3d46 With sync_ahead the game takes its depth query results when their frame number is one frame older than it expects, so in shrines the reflections of the lamps on the floor no longer go out on the frames where the GPU runs behind, which flickered at some camera angles 2026-11-18 00:57:06 +03:00
ipavlin98 68078948f5 With sync_ahead an invalidate of pool storage waits for the GPU write of a value the game was told is done when the range holds no older result, so the pixels TotK reads back once through a buffer per request are no longer zeros or an answer from the ring's last round, which in the Depths put Link in gloom on clean ground; buffers the game reads every frame still get the result of the frame before without a wait 2026-11-18 00:21:46 +03:00
ipavlin98 fd08b5cee3 DLSS is created without auto exposure, so large distant blocks behind the fog in the Depths no longer turn darker or lighter for a frame while the camera moves 2026-11-18 00:21:25 +03:00
Valiantsin DzerakhandClaude Opus 5.5 6b0974f08d Merge pull request #1188: opt-in quick save and quick load on rebindable keys with no menu on the screen, game 1.4.3 (itaskaev2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:17:57 +03:00
Valiantsin DzerakhandClaude Opus 5.5 358b7916d8 Merge task/hud: hud_width keeps the HUD within the middle 21:9 or 16:9 of a wide screen, from pull request #1262 (Marjaperse, ProSep, #643)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:15:16 +03:00
Valiantsin DzerakhandClaude Opus 5.5 96afa531c9 Merge pull request #1131: with frame-ahead on, fence write-backs no longer wait for the GPU about every ninth frame (ProSep)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:13:01 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8232ac4505 The exit log counts the fence write-backs that waited for the GPU and their time with frame-ahead on
The new line is written for wb_eager 0, 1 and check alike, so the stall wb_eager removes can be compared between the settings. It costs a clock read only on the blocking path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:12:18 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f801169e1c Merge pull request #1188: opt-in quick save and quick load with no menu on the screen (itaskaev2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:07:20 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1974b671be Merge pull request #1263: with DLAA, fog and particles can be drawn over the smoothed picture, so dust in shrine fog no longer vanishes; off by default until checked on NVIDIA (ipavlin98)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:07:08 +03:00
Valiantsin Dzerakh 006c186928 Merge pull request #1262 into task/hud: hud_width keeps the HUD narrower than a wide screen on the Shapes step (Marjaperse, ProSep) 2026-11-17 20:06:17 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c76a38852e The DLAA effects switch sits with the other DLSS settings and is read only while DLSS runs
dlaa_effects_after moves to the Screen tab under the DLSS rows, to [display] in totk.ini and totk.ini.example next
to dlss_char_mask, and vk_dlaa_frame reads it after the dl_active check, so a game without DLSS does no new work
per frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:05:44 +03:00
ProSepandClaude Sonnet 5.5 3b2bd1f6ba Stop fence write-backs from stalling the game behind the GPU with frame-ahead on
With sync_ahead on, the fence write-back of small GPU-drawn targets that the game reads back still blocked the game thread behind the running frame, about every ninth frame. wb_eager copies those targets into staging at the end of the submission that rendered them, so the write-back at the fence wait needs no GPU wait.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 20:05:15 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f53b86c61d Merge pull request #1253: sync_ahead works on game 1.1.0, and game-time scripts find the player there (Marjaperse)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:01:26 +03:00
Valiantsin DzerakhandClaude Opus 5.5 e031ac596a Merge dev into task/pr1263
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 19:59:52 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bd8c5d637f Merge task/objreuse: a private build compiles only the generated chunks that differ from the main build, so a private lift of a patch builds in seconds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 19:38:43 +03:00
Valiantsin DzerakhandClaude Opus 5.5 2b95408642 A private build reuses each main build object whose compile is provably the same, also for a private lift in another generated dir
build_game.py used to reuse build/<ver>'s generated objects only as a whole and only for generated/<ver>, so a private
lift of a patch change (gen.py --out generated/<ver>-prN, build_game.py --gen) compiled all 421 chunks, about 5 min on
12 jobs, for one changed chunk. main_objects now decides per object: same compiler, flags and rule in the main
build.ninja (with the main runtime/ and generated dir in place of ours), main build up to date, and every file the main
compile read according to its Ninja deps log byte-identical on our side and unchanged since the object was written
(NTFS ChangeTime, st_ctime elsewhere), the compiler binaries too. A file new on our side whose name those compiles
included or probed blocks the reuse. Anything unknown compiles. The build prints "reused N of M generated objects",
--verbose lists the rest with the reason; obj/reused.txt lets a later build delete a copied object before compiling it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 19:37:43 +03:00
shinodanpenandClaude 037a39d303 The sound engine's audio thread takes every queued command list, so the game keeps its sound above 200 fps (#337)
The game thread hands its sound commands to the audio thread in lists: 16, of which 4 are always held, so at most 12
wait in the command ring. The game thread submits at most one per update (1.2.1 main+0x9bd144), the audio thread
takes one per 5 ms audio frame (after a list, main+0x883780 goes on past the ring's check). Above about 200 updates a
second the ring stays full. The game's guard (main+0x9bcdc4) counts the updates that find the ring of free lists
empty and exactly 12 lists in the command ring (0x9bce1c cmp w9, #0xc); the count returns to 0 only when a free list
is there. At every multiple of 300 (10 s at 30 fps, 1.25 s at 240) it clears the sound command switch
(main+0x2268bfc) and stops every active voice (main+0x226f29c). Only the switch's constructor sets it to 1
(main+0xf31ce8, from the engine's init main+0xf31530), so the game is silent until it is restarted.

Measured on 1.2.1 (Linux, RX 6750 XT), same save and scripted input, mix dumped without a device: with fps_limit 60,
144, 180, 200 and 201 the mix has sound; with 205, 210, 220, 230, 239 and 240 it goes silent after the boot logo and
stays silent, also at the 130-148 fps of the scene that follows. The guard is read from the code; the switch going
to 0 has not been observed in a run.

The set audiodrain (TOTK_AUDIO_DRAIN_FIX, audio_drain_fix, on by default) sends the audio thread back to the ring's
check after each list, so it takes every queued list in the pass: one site per version (1.2.1 main+0x883780, 1.4.3
main+0x149244), each going to a target the game's own code already branches to in the same way (1.2.1 main+0x883c18,
1.4.3 main+0x149700). The setting is in runtime/cfg.c, totk.ini.example and docs/settings.md.

At fps_limit 240, 120 s runs of one build per game version with the set switched, seconds with sound in the mix: on
1.2.1 5 of 118 with the set off and 108 of 118 with it on; on 1.4.3 2 of 118 off and 110 of 119 on. Not run:
Windows. Not covered: 1.1.0, whose main we do not have, so its table has no site and it keeps the game's code.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-17 18:56:55 +03:00
Valiantsin DzerakhandClaude Opus 5.5 a5c3e0f9f5 A game with a mod plugin no longer stops at start: plugin_trace has its row in the settings table (#845)
plugin_init.c reads TOTK_PLUGIN_TRACE through cfg_bool, which stops the game when the key is unset and metas[] has no
row. Every test run set the key, so only a plain start hit it. tests/settings_doc_check.py now fails on any
cfg_value/cfg_int/cfg_double/cfg_bool reading without a metas[] row that is not guarded by cfg_get of the same key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 12:49:27 +03:00
Valiantsin DzerakhandClaude Opus 5.5 e7c901b864 The setup's builds name every path relative to the build kit, so a moved game folder rebuilds incrementally (#845)
tools/build_game.py --portable writes build.ninja paths on the tools' drive relative to the kit, also through '..'
(the generated C and objects in build-cache/work), names the compiler, windres and ar the same way (backslashes:
CreateProcess does not find a relative program with forward slashes), and passes clang -resource-dir and --sysroot
relative to the kit, because clang names its own headers by its absolute folder whatever argv[0] says. The Ninja deps
log then holds no absolute path. installer/steps.py build_args passes --portable for the build kit.

Measured on an install moved after a portable build: the rebuild compiled modules.c only, 3.5 s; before, the move cost
a full compile of 430 objects (335 s on 12 cores). Without --portable build.ninja is byte-identical to before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:57:12 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8c9c18a6d2 A kit whose replacement fails is put back, so the game keeps a build kit; docs rewrapped to 120 columns (#845)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 11:06:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 501f0d3e6f The setup installs a build kit into the game folder, and the game's rebuild for code mods runs from it (#845)
The rebuild for ExeFS patches, code cheats and mod plugins ran the setup window from the setup folder, whose absolute
path build-cache/rebuild.txt held, with the generated C and objects in that folder's temp/. A moved or deleted setup
folder left code mods without a rebuild.

- A new Kit step after the check copies the release folder without TotK-Setup.exe into <game>/build-kit
  (installer/layout.py KIT_ITEMS), and every later step runs its tools from there. A newer setup replaces the kit,
  the kit's own rebuild keeps it.
- The release's temp folder is <game>/build-cache/work, so the lift cache and the objects stay with the game.
- rebuild.txt names the kit relative to the game folder; runtime/cheats.c and runtime/romfs.c resolve relative
  entries against the exe's folder.
- runtime_key drops the lines of clang --version that name its folder, so a rebuild from the kit or a moved game
  folder keeps the compile and prepare steps the setup recorded.
- An update over an install of an older setup moves that setup's temp folder into build-cache/work when both are on
  one disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:54:17 +03:00
Valiantsin DzerakhandClaude Opus 5.5 791e077c54 docs/mods.md: removing a plugin mod starts the rebuild without it (#845)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 10:36:10 +03:00
ipavlin98 40c0071dd2 With DLAA, DLSS runs before the fog and the particles, which are drawn over its picture without jitter, so the dust in shrine fog no longer vanishes
DLSS ran at the bloom, after the volumetric fog composite and the particle pass. Neither has motion vectors or jitter
of its own, and DLSS wiped out the smallest motes. In DLAA mode DLSS now runs right after the deferred lighting: the
light target is the G-buffer's scene colour target, the lighting is the first pass into it after the G-buffer, with
a D16 depth, and the first pass into it with any other depth (the scene's, none, or the D16 of an ability's highlight)
is an effect. The order of the effects changes from frame to frame (the yard's half-size effects pass is in some
frames only; with Ultrahand or Ascend open the highlight comes before or after the fog layer), and rules that waited
for one of them, or took any D16 pass for the lighting, flickered. As a safety net the point is used only after it
held for 60 frames with nothing of the scene drawn after it; otherwise DLSS stays at the bloom.

dlaa_effects_after (Advanced tab, Render fixes, default 1, live) turns it off. The upscaling DLSS modes are unchanged.
2026-11-17 09:41:08 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b9b8f3dce1 Each mod plugin is built or refused on its own: one that is refused, crashes or hangs costs only itself (#845)
tools/exefs_plugins.py ran every plugin's init in one service run and refused them all when one was refused. Now a run
without inits lists the plugin modules, then each plugin runs in service runs of its own (TOTK_PLUGIN_ONLY, the others
stay loaded): a refused svc, a crash (the FATAL line is the reason), a timeout or a failed check refuses that plugin
alone, with its reason in plugins.status; the rest are built in. 4 plugins take 2.3 s.

At start, plugins_start compares each plugin right after its own init and takes its branches out of main's .text before
the next one, so each init sees the game's bytes, as in its service run. Only that init's aliases are flushed: the
start stays at 113 ms for Full Inventory Expansion + Quick Weapon Durability (107 ms before).

The installer's second lift keeps every plugin of the service runs in the layout when one is built: the records hold
that layout's addresses. A refused plugin stays loaded and never starts. A mod with a built plugin and a refused one,
used without its code, runs the built one (mods.c; --probe-mods case T).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:25:24 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8cee1afe5d The rebuild builds mod plugins in: service run, checks, patch sets and status lines (#845)
After the design in #845 by itaskaev2. tools/exefs_plugins.py writes an accepted plugin's patch set
(recomp/patches.py plugin lines and hook sites, one ordered set mod_<hash> per plugin, several plugins
in one record told apart by their hooks) and a line per plugin of build-cache/plugins.status: built, or
refused with the first reason. It also checks the code the hooks reach (direct branches and calls from
the stubs, impls, callbacks and targets): no svc but OutputDebugString, imports only from a reviewed
list. The init's imports may now include malloc, free, memcpy, memmove and memset, because the init runs
again at every start and its heap blocks exist while the game runs.

The setup's lift step runs the plugin stage when a mod has exefs/subsdk*: a lift with the plugins, a
totk.exe of it in the compile step's folder, the service run, then the lift with the hook sites; a failed
stage warns (warn.plugins_skipped) and installs without the plugins. docs/mods.md describes what works,
what is refused and why, and the rebuild.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 08:48:31 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b488d9e41d totk.exe --plugin-init runs a mod plugin's init on our kernel and records what it did (#845)
The plugin service run loads the modules as boot does, runs sdk's DT_INIT and then each plugin's from nn::init::Start's
module-init callback (rtld initialises the last loaded module first), writes the record and exits before any game
constructor, graphics or audio. The record holds every word the init wrote into a game module, the plugin's image
before and after its init, the process-memory maps, and the svcs and imports it called.

exlaunch's init needs a Switch-like address space: QueryMemory shows the game's own rtld image below main and the
host's ranges as Inaccessible (it takes Code RX runs for modules), and a 64 GiB free pool for its random alias picks.
New svcs: GetSystemTick, GetInfo 65001 (current process handle), and Map/UnmapProcessMemory, which only the service
run serves: an alias is a copy whose changed words go back into the source when it is unmapped. Any other svc, such
as the CreateSession fallback, ends the run with a reason. nn::oe::GetDisplayVersion is answered with the build's game
version. The game calls none of these svcs; the SVC trace test is still one mask test per SVC.

After the design in #845 by itaskaev2, with the init run natively instead of under Unicorn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 08:05:19 +03:00
Marjaperse 3a9e8ea50a Verify selective HUD shape preparation and fallback (#643) 2026-11-17 03:58:35 +02:00