# LSWTCS testing profile: the play settings plus detailed logs, for reporting a problem.
# Turn it on by naming this file sdmc:/lswtcs/env.txt; rename it back (env-testing.txt) to stop the logs.
# Logs go to sdmc:/lswtcs/logs/, about 120 MB per hour. One NAME=VALUE per line. Never set LSWTCS_AUTOSTART.
LSWTCS_COMPILE=1
LSWTCS_HEAPBYPASS=0
LSWTCS_SEMFIX=1
LSWTCS_STUBSRC=1
LSWTCS_RUNSHC=1
LSWTCS_GIL=1
LSWTCS_AE698EXIT=1
LSWTCS_SYNCREAD=1
LSWTCS_SPINGUARD=1
LSWTCS_WORKERGUARD=1
LSWTCS_BINDCLAMP=1
LSWTCS_GEOM=1
LSWTCS_PRISTINE=1
LSWTCS_FPS_CAP=60
LSWTCS_VCLOCK=0
# GAMEROOT disables fallback only; files already under /lswtcs, including movies, still resolve.
LSWTCS_GAMEROOT=X:/none/
# --- 2026-10-09: on by default in the build; listed so they can be switched off (=0) ---
# Pause the audio while the picture waits for shader builds (keeps cutscene sound in sync).
LSWTCS_AVHOLD=1
# Save shader GLSL to sdmc:/lswtcs/glprogs2 and prepare it in the background at boot.
LSWTCS_GLPROGLIST=1
# Capture combos, right stick clicked last: ZL + ZR = full (screenshot, per-draw log, render targets); L + R = light (no targets).
LSWTCS_CAPCOMBO=1

# W0 diagnostics; all other existing options preserved.
LSWTCS_FRAMELOG=1
LSWTCS_CAMLOG=0
LSWTCS_CAMCAPTURE=0
LSWTCS_CAMDUMP=0
LSWTCS_CPULOAD=0
LSWTCS_GLTIMING=0
# Every 300th replay, and every 60th in frames of 1300 draws or more, GPU timestamps after each draw: where the GPU's time goes. A brief hitch each time.
LSWTCS_GLGPUPROF=150
# In those frames also pixels per draw, for fill per program (the smoke of Episode I chapter 2).
LSWTCS_GLGPUPIX=0
LSWTCS_GLGPUSPLIT=0
# Every 12 s at most, a frame of 1300+ draws is drawn eleven times with one change each and GPU-timed (BENCH lines): the game holds about half a second.
# log64: off, so no hold adds noise to the comparison of builds.
LSWTCS_GPUBENCH=0
# Running totals of targets, formats, primitives, textures and EDRAM use, from every 16th replay ([GLINV]): what a Deko backend would have to implement.
LSWTCS_GLINV=0
LSWTCS_GLDIAG=1
# log73: each worker program build with its GLSL sizes and time ([GLSTEP], two lines per program): which programs are slow to build.
LSWTCS_GLSTEPS=1
LSWTCS_SCHEDPROF=1
LSWTCS_GLGPUSPAN=1

# Test session: settings change by themselves every 6 s, in a new order each round, so FPS and audio can be compared over the same scenes.
LSWTCS_ABCYCLE=6
# Each state differs from MAPXS in one thing, to compare one change at a time. M tile merging and A audio threads first stay on.
# P reuse of draw preparation, X XMA and LZ2K off the guest scheduler's turn, S resolves straight into stitched targets, H page hash per
# frame instead of per epoch (only this state: it can miss a page changed in mid-frame, and counts what it would have missed), V compares.
# Both states use N (native audio mixer, exact in runs 15 and 16). They differ in H (page hash per frame, off for the session at its
# first sampled miss; no miss in runs 10 to 16). Q (longer quantum) is out: in run 16 it did not lower the thread switches.
# Thread priorities. R: render thread at 0x2C (was 0x3B, equal to the guest threads). G: guest threads at 0x2E (were 0x3B), not the
# XAudio thread. C (guest threads on core 0 only) is out: in run 24 it emptied the audio buffers most (40 % filled at 4000+ draws)
# for no FPS gain. Run 25 measures R alone, which runs 23-24 did not separate, against today's placement and RG. W is out.
# One draw pass per frame instead of one per EDRAM tile (one_tile.cpp). Set to 0 if the picture breaks: it returns to the game's three tiles without a new build.
LSWTCS_ONETILE=1
# Real locks from boot (LSWTCS_SPINREAL) and U, the XAudio per-tick voice loop off the turn.
# B: nouveau skips constant buffer binds that change nothing. Run 38, handheld: GPU -4 % per 1000 draws, no FPS gain shown; harmless, stays.
# Out after run 40 (handheld): Z, compressed depth on a big-page mapping, GPU -3 % per 1000 draws (90 %: -7 to +4), no visible change; J, compressed 32-bit colour, blurs the picture
# (the tester's captures, both in J) and is slower.
# F (early depth tests): run 42, every draw with the alpha-test code has the test on; F now also takes draws that write neither depth
# nor stencil. Measured in the bench only ("early-z on").
# I: the frame's ring walk on a thread of its own, on core 1 (LSWTCS_WALKOFF_CORE). Kept after run 46 (docked, 1300+ draws: +11 %, 90 % +0.2 to +24;
# load-matched +7 %, -3 to +19; handheld no change, GPU-bound). The state without I stays as a control while it is new.
# K out after run 47: the walker on core 2 was 12 % slower (load-matched, 90 % -18 to -6). I alone: 27.5 against 25.0 FPS at 1300+ draws.
# k (log48, lower case): with I, the walker starts at every kick instead of only at the fence wait. Run 47: about 9 ms per heavy frame
# was still walked on the main thread at the GPU-phase wait. No state without I any more.
# Run 48: with k the main thread walked nothing, but its fence wait waited for the walker to finish everything (12-14 ms per heavy
# frame; k -7 % load-matched, 90 % -13 to +0.3). log49: a fence wait waits only until the reader has passed its own segment.
# Run 49: no fence wait was released mid-walk and k was -11.5 % (90 % -20.6 to -3.8). log50 measures what those waits wait for ([FENCEWAIT]).
# Run 50: every such wait was for the segment kicked 0.1 ms before. The cause is sub_822AEEB0: with HSIO training "failed" (the boot stub
# returns 0) each flush waits for the GPU to have read everything. h (log51) turns that wait off as on a console that trained; Ik is out.
# Run 51 (1300+ draws): I 28.8, Ih 25.2, Ikh 26.4 FPS. Ih: the phase wait walks all on the main thread. Ikh: the main thread is free (24 ms
# CPU) but waits in present for the render thread, slowed on core 1 by the walker at a higher priority. w (log52): walker below render.
# Run 52 (1300+ draws, load-matched): Ikh against I +13 % (90 % +4 to +27), Ikhw against I +11.6 % (-1.5 to +24.6); pooled with run 51,
# Ikh +4.7 % (-1.4 to +12.4). With w the render replay fell from 16.3 to 13.6 ms (median). The main thread now runs guest code 83 % of
# its turn and waits for the walker about 3 ms per frame, mostly at the ring-space wait. r (log53): that wait ends once the reader is
# past the window; f: the walker on core 1 or 2. I stays as the control.
# Run 53: with r the ring-space wait fell from 1.5-3.2 ms per heavy frame to 0, no fallback; r +7.3 % load-matched (90 % -0.5 to +14.6).
# r joins the base. f: Ikhwrf against Ikhwr +2.9 % (-8.8 to +20.7), still open; Ikhw against I +6.0 % (-0.7 to +14.1) over runs 52-53.
# G again (guest threads but XAudio at 0x2E; run 34, before I: +5.1 %, -2.2 to +13.5): the main thread is the wall again, and the second
# shader-compile worker shares core 0 with it at 0x3B.
# Run 54 docked (126 s at 1300+ draws): Ikhwr against I +21.7 % (90 % +14.4 to +33.3); with run 53, +15.5 % (+7.4 to +24.1). f +2.2 %
# (-4.1 to +10.0) over both; G +1.7 % (-4.0 to +7.2) docked, -6.5 % handheld: G out. Handheld, kh(w)r against I +8.5 % (+0.3 to +17.5).
# log55 is for handheld: z, the bench's forced early depth test shown (-17 % of GPU in the bench, not exact: look at cut-outs).
# Run 55 (handheld): z broke transparency nearly everywhere (foliage, studs); alpha references are about 0.5 in nearly every draw. z out.
# Run 56 (handheld bench): trivial pixel shaders -26.3 ms, the same as no pixels: the cost is inside the shaders. log57 splits it.
# e (log57): pixel shader epilogues (alpha test function, alpha to coverage, gamma) specialised per draw. Exact; f is out (open for 4 runs).
# Run 57 (handheld): e +10.4 % load-matched (90 % +0.9 to +20.5); bench -6.0 ms of 40.5. e joins the base. g (log58): e also for shaders
# that write depth, and an exponent bias of exactly 1.
# Run 58: g +2.0 % (90 % -5.0 to +8.9), bench about 0.4 ms; exact, so it joins the base. p (log59): depth pre-pass for alpha-tested draws
# with two or more textures (pass 1 alpha only, pass 2 full shader with an early EQUAL test).
# Run 59: p -5.6 % (90 % -11.8 to +0.7), bench +1.2 ms: the second pass over vertices and alpha costs more than it saves. p out.
# d (log60): with e, each fetch's exponent scale of 1 and LOD bias of 0 as constants. Exact.
# Run 60: d -3.1 % (90 % -10.1 to +4.1), bench +1.8 ms when turned off (range -4.8 to +5.4): open. NIR session: wrong shadows, darker
# light, -21 % (90 % -26 to -16), crash in nv50_ir; NIR is out and its Mesa edits are no longer applied.
# c (log62): ZCULL, the GPU's coarse depth culling, set up in nouveau (mesa_zcull_edits.py). Exact if the setup is right; the pixel
# check below compares frames with and without it. d stays in the bench only, to settle in a run where nothing else changes.
# Run 62: c is exact (6 pixel checks, 0 px) but saves nothing: bench +0.1 and -0.3 ms. Every draw that writes depth has a real alpha test,
# and ZCULL cannot learn depth from draws that may discard. c out. d joins the base: exact, and the bench saved 1.3 ms here and 1.8 ms in
# run 60. q (log63): quad lists as indexed triangles instead of through the quad geometry shader.
# Run 63: q exact (3 pixel checks, 0 px), bench -1.2 ms on and +0.4 ms off; q joins the base. One state until the next test.
# log64 changes the build, not a state (LSW_GAME_INLINE, tools/make_game_units.py). One session is enough: main-thread CPU per
# guest call from [THREADCPU] is 156-161 ns in runs 54, 62 and 63 (90 % intervals about 2 ns wide), so log64 compares against them.
LSWTCS_WALKOFF_CORE=1
# Out after run 34 (load-matched, 90 %): WY -11.5 % (-17.2 to -5.5), -26 % at 1300+ draws; R -5.9 % (-12.5 to +1.2); G +5.1 % (-2.2 to +13.5), no audio or heavy-scene gain;
# E +3.6 % (-3.3 to +11.3), and both of the tester's captures of the shimmer fell in a state with E. See RUN2_FINDINGS.md, "Run 34".
LSWTCS_SPINREAL=1
LSWTCS_ABSTATES=MAPXSHNLUBIkhwregdq
# log65, loading: load modes cycled over loads ([LOADEP], kernel_stubs.cpp). "-" as before; "ob" = the guest turn released during
# host file calls (run 64: two loader threads held the turn about 30 % of the load time while blocked on the card, so reading and
# processing never overlapped) and 512 KB read-ahead refills instead of 64 KB (about 26 MB/s). Run 65 never left "-" (the quiet rule
# never met its 10 s: music refills every 2-4 s); log66 moves the mode on at each light-frame stretch (loading screen or menu) after
# play. The order -,ob,ob,- keeps a fixed pattern of loads from always meeting one mode.
# Run 66: b (512 KB refills) doubled the card's rate (60-66 MB/s against 23-35), but the loads' file-call spans barely moved
# (4.4 s against 4.6), so the turn is not what holds loads back; o (turn released during file calls) is the suspect for the hang
# and crash when the tester quit to the menu (the I/O thread and the loader then passed the turn back and forth for 50 s, and the
# loader crashed on a bad pointer). log67: b for every load, o off.
# log72: back to 64 KB refills (-). Audio empty per second of loading screen and menu after the first minute: runs 63-66 (64 KB,
# or mixed) 5-14 ms, runs 67-69 and 71 (b) 47-66 ms; in run 71 one 256 KB read took 377 ms while the loading music ran dry. b
# never shortened a load.
LSWTCS_LOADMODES=-
# log66: per-draw colour and depth probe in full captures (zprobe_<replay>.bin; one GPU wait per draw, captures only).
LSWTCS_ZPROBE=1
# log65, studs over the legs (RUN2_FINDINGS.md, runs 17-20; still seen): hold L + R and click the left stick to step through these
# states, then back to the one above. Each drops base parts that reuse or skip data between frames: all three, then H (page hash per
# frame), P (reuse of draw preparation), S (resolves into stitched targets). The fault predates the GPU letters (k h w r e g d q).
LSWTCS_ABTOGGLE=MAXNLUBIkhwregdq,MAPXSNLUBIkhwregdq,MAXSHNLUBIkhwregdq,MAPXHNLUBIkhwregdq
# log65, face buttons (win32_switch.cpp): auto = by label (Switch A confirms, as on the Switch) while the frames are light (title,
# menus, load and save screens) or, from log66, the scene is frozen behind a menu (the hub's character selection, the pause menu),
# by position in play (the bottom button is the 360's A, the tester's choice of 2026-10-11).
# position or label fix one layout. Hold L + R and press Minus for the next layout.
LSWTCS_PADLAYOUT=auto
# Local co-op (log70): two players, the connected controllers in the order handheld, controller 1, controller 2. Player 2 joins
# with Start. A single Joy-Con is held sideways. L + R + Plus (SL + SR + Plus/Minus on a single Joy-Con) opens the system's
# controller screen. 1 = one merged pad, as before. A sideways Joy-Con's stick is turned a quarter (log71; LSWTCS_JOYROT=0: as the
# system reports it) and its face buttons follow the layout (confirm on the right button in menus).
LSWTCS_PLAYERS=2
# L: guest spinlocks really taken (compare-and-swap on the lock word) instead of held only through the one guest turn. Run 27 froze in
# L on a lock word that never cleared; log27 releases as the 360 does (writes 0) and reports any wait past 200 ms ([SPINLOCK]).
# Run 29: the XAudio voice lock's holder then did not run for 200 ms and more (6 FPS in L); log28 passes the turn straight to the
# holder. Two states only, so L gets twice the play time (RG was measured in runs 23-26).
# Run 27 measured 0.010 ms of mixing per call against 0.41 ms of turn handoffs, so U now moves a whole subtree at once
# (private/session-tools/offturn_audit.py lists what one reaches).
# Once a second, a guest thread outside an off-core move that lost its starting core mask or priority gets it back ([PLACEMENT]).
LSWTCS_PLACEGUARD=1
# Fourth core for host threads when the launch allows core 3 (a forwarder title; homebrew launches stop at core 2, then this does nothing).
LSWTCS_CORE3=1
# In the V state, every 60 replays: the frame drawn merged, unmerged and merged again, then compared. The unmerged pass also resolves and
# stitches the old way, so this checks state S as well. Brief hitches there.
LSWTCS_GLUNTILECHECK=60
# Every 900 replays (about 40 s), in any state: a frame of 1300+ draws drawn with change q off, on and off, then compared ([EXACTCHECK]).
# Flagged frames keep their images as xcheck_q_<replay>_*.png. Brief hitches there.
LSWTCS_EXACTCHECK=0
LSWTCS_EXACTWHAT=q
# The last 40 presented frames go out with a capture combo.
LSWTCS_GLHISTORY=40
# Guest frames of 250 ms or more say where the time went ([GSPIKE]).
LSWTCS_SPIKEMS=250
# Samples of each thread every 2 ms (hwprof.txt, tools/hwprof_report.py): where the guest CPU goes.
LSWTCS_HWPROF=2
# Pages hashed and walk and record time, every 60 frames ([GPUPAGES]).
LSWTCS_GPUPROFLOG=1
