# Reference copy in the Anka package: no program reads this file under this name.
# anka-cli.exe takes the switches from its environment (a launcher .bat); the menu program
# anka.exe reads nx2_switches.txt next to it and in
# %APPDATA%\eden (the notes below). anka.exe sets its own switches from
# Configure > Anka; a switch set in the environment or in nx2_switches.txt wins.
#
# Anka switches (EDEN_NX2_*) - nx2_switches.txt next to anka.exe is read at every start of the
# menu program anka.exe. The program without menus, anka-cli.exe, does not read it: give it the
# variables in its environment (a launcher .bat).
# One NAME=VALUE per line. Lines starting with # are ignored.
# A variable already set in the environment wins over this file.
# Between files, %APPDATA%\eden\nx2_switches.txt (yours) wins over this one, so editing
# this file is never needed: copy the lines you want into your own and restart.
# A switch set here or in the environment wins over anka.exe's Anka tab, which never changes
# it (its box is greyed out, its tooltip names the value).
#
# Restart the emulator after editing.
#
# A few switches are read before this file is loaded, so only the real environment (a
# launcher .bat) sets them: EDEN_NX2_3D_METHODS, ALIAS_LAZY, PROFILE_TSC, RANGE_SKIP,
# SAME_SKIP, SMALL_WRITE, SSBO_MEMO, SYNC_EXACT, SYNC_SKIP, TEX_TOUCH_SKIP, and the
# pusher's EDEN_NX2_PB_CHECK and SEM_WATCH (all EDEN_NX2_...).

# --- workarounds / behaviour ---
#EDEN_NX2_BUFFER_DOWNLOADS=1
#EDEN_NX2_SPLIT=1
#EDEN_NX2_MME_JIT=0
#EDEN_NX2_PBFLUSH=0
#EDEN_NX2_RESETFIX=0
#EDEN_NX2_FENCE_BATCH=1
#EDEN_NX2_SKIP_SAME=0
#EDEN_NX2_INLINE_DEFER=0
#EDEN_NX2_SPLIT_SKIP=1
#EDEN_NX2_AUTO_STUB=1

# --- GPU thread shortcuts (on by default; =0 as before; added by Anka) ---
# =2 keeps them on and logs what they would get wrong: VERTEX_CLEAN, LIGHT_SYNC_SKIP,
# FAST_PRIORITY_SCAN, DESC_XLAT.
#EDEN_NX2_VERTEX_SKIP=0
#EDEN_NX2_VERTEX_FAST=0
#EDEN_NX2_SYNC_MEMO=0
#EDEN_NX2_VERTEX_CLEAN=0
#EDEN_NX2_LIGHT_SYNC_SKIP=0
#EDEN_NX2_FAST_PRIORITY_SCAN=0
#EDEN_NX2_DESC_XLAT=0
#EDEN_NX2_DIRTY_THUNK_SKIP=0

# --- limits / tuning ---
#EDEN_NX2_VRAM_LIMIT_MIB=8192
#EDEN_NX2_GPU_PROFILE=0
#EDEN_NX2_FRAMES_AHEAD=2
#EDEN_NX2_TC_EXPECTED_MIB=21322
#EDEN_NX2_TC_CRITICAL_MIB=22346

# --- experiments (off by default; NX2_NOTES.md; added by Anka) ---
#EDEN_NX2_PACE_GUEST_SLEEP=1
#EDEN_NX2_PACE_GUEST_TAIL_US=1000
# vi2 104 = GetHdrStatus, SDR reply (one line "104: 1 0 0" in a file works too)
#EDEN_NX2_VI2_REPLY=104:1,0,0
# pace by the swap interval word's refresh rate too (needs EDEN_NX2_PRESENT_INTERVAL_WORD=12:16:4)
#EDEN_NX2_PRESENT_RATE=1
# MEM_OP_D MEMBAR and WaitForIdle record a real memory barrier (H1 experiment)
#EDEN_NX2_MEMBAR=1
# root table 0 (3D 0x504/0x508) and bank 17: log only / keep the game's tables (H1 experiment)
#EDEN_NX2_ROOT_DIAG=1
#EDEN_NX2_ROOT_TABLES=1

# ======================================================================================
# Anka additions (since PokeDinner 2.0.0, commit 70ecb39ef0). Every switch below was
# added by this fork. anka-cli reads only its environment: set them in a launcher .bat
# (the Anka launchers set the recommended ones; anka.exe sets them from its Anka tab).
# The value shown is the one that changes the default. Unless noted, a switch is read
# once, at its first use.
# Source files are under src/; NX2_NOTES.md and NX2_GPU_THREAD_SPLIT.md have the details.
# ======================================================================================

# --- split GPU thread: back stages and cores (video_core/nx2_stages.*, nx2_back_cpu.h) ---
# BACK_STAGES: the split back as a pipeline of stages. 0 off (default), 1 on, 2 verify
# (lockstep, replicas compared; slow), 3 pass-through. Recommended: 1 with BACK_CUTS=a.
#EDEN_NX2_BACK_STAGES=1
# BACK_CUTS: which cuts with BACK_STAGES. a: A | BC (the default with stages on);
# c: A | B | C (experimental, not for play or measuring).
#EDEN_NX2_BACK_CUTS=a
# BACK_STAGES_EVERY=<n>: with BACK_STAGES=2, compare every n-th record (default 1).
#EDEN_NX2_BACK_STAGES_EVERY=1
# STAGE_CHECK=1: owner checks and hazard counters at full speed (diagnostic).
#EDEN_NX2_STAGE_CHECK=1
# BACK_STAGES_LIGHT=0: with cut c every draw is set up in full (default: light decision on B).
#EDEN_NX2_BACK_STAGES_LIGHT=0
# GEOMETRY_MIRROR=0: with cut c, B does not mirror vertex and index binds to C (default on).
#EDEN_NX2_GEOMETRY_MIRROR=0
# BACK_CPU: the split back on a physical core of its own (Windows CPU Sets). 0 off (default),
# 1 pinned, 2 pinned and logged, 3 not pinned, logged. BACK_CORE / FRONT_CORE=<n> pick the
# cores by Windows' CoreIndex (default: the second core of group 0 / the next one).
#EDEN_NX2_BACK_CPU=1
#EDEN_NX2_BACK_CORE=2
#EDEN_NX2_FRONT_CORE=4
# WRITE_BATCH=0: every macro write is a ring entry of its own (default: batched).
#EDEN_NX2_WRITE_BATCH=0
# BATCH_DIRECT=0: a batch entry's writes reach the engine one virtual call each (default:
# CallMethodBatch).
#EDEN_NX2_BATCH_DIRECT=0
# CB_RUNS=0: the back runs the constant buffer words a macro writes one at a time (default:
# in runs).
#EDEN_NX2_CB_RUNS=0
# TICK_SKIP=0: the GPU tick looks at its queue under the lock every time (default: skipped
# when empty).
#EDEN_NX2_TICK_SKIP=0

# --- split GPU thread: front (video_core/engines/maxwell_3d.cpp, puller.cpp, macro JIT) ---
# ACQUIRE_PEEK: a semaphore acquire whose value memory already holds goes on without
# draining the back. 0 off (default), 1 on (recommended), 2 drains and logs where 1 would not.
#EDEN_NX2_ACQUIRE_PEEK=1
# JIT_SAME: the front's macro JIT drops state writes that would change nothing. 0 off
# (default), 1 in the JIT (recommended), 2 verify, 3 in C++.
#EDEN_NX2_JIT_SAME=1
# FRONT_MACRO_LEAN=1: leaner front macro path (off by default; recommended with JIT_SAME=1).
#EDEN_NX2_FRONT_MACRO_LEAN=1
# SEMEXEC_DEFER=1: experimental handling of SemaphoreExecute with the split (off).
#EDEN_NX2_SEMEXEC_DEFER=1
# HLE_INDIRECT=0: run NVN's indexed indirect draw macro as it is, reading its records on the
# CPU (default: one host indirect draw from the GPU-written records).
#EDEN_NX2_HLE_INDIRECT=0
# INDIRECT_BATCH=0: one host draw per call of NVN's multi-draw macro (default: merged).
#EDEN_NX2_INDIRECT_BATCH=0
# LAYOUT_MEMO=0: look the layout size up every time (default: remembered).
#EDEN_NX2_LAYOUT_MEMO=0
# SAME_SKIP=0: constant buffer writes of bytes memory already holds are still made (default:
# skipped).
#EDEN_NX2_SAME_SKIP=0
# PBFLUSH_WINDOW_KIB=<n>: a GPU-written pushbuffer record is flushed with the n KiB window
# around it (default 256); 0 flushes the record alone.
#EDEN_NX2_PBFLUSH_WINDOW_KIB=0
# SKIP_EMPTY_DRAWS=1: draws without indices, vertices or instances are dropped (off).
#EDEN_NX2_SKIP_EMPTY_DRAWS=1
# 3D_HISTORY=1: keep Maxwell3D's register write history in release builds (off).
#EDEN_NX2_3D_HISTORY=1
# HSETP2_REG=0: reject HSETP2's register form as before (default: lowered).
#EDEN_NX2_HSETP2_REG=0

# --- draws, buffers and descriptors: shortcuts on by default; =0 as before, and for most of
#     them =2 keeps them on and logs what they would get wrong ---
#EDEN_NX2_LIGHT_DRAW=0
#EDEN_NX2_LIGHT_UNIFORM=0
#EDEN_NX2_LIGHT_UNIFORM_VALUES=0
#EDEN_NX2_LIGHT_STORAGE=0
#EDEN_NX2_UNIFORM_SYNC_SKIP=0
#EDEN_NX2_STORAGE_KEEP=0
#EDEN_NX2_UBO_REUSE=0
#EDEN_NX2_UBO_DIRECT=0
#EDEN_NX2_UBO_STAGE=0
#EDEN_NX2_UBO_BIND_SKIP=0
#EDEN_NX2_SSBO_FAST=0
#EDEN_NX2_SSBO_MEMO=0
#EDEN_NX2_SYNC_SETS=0
#EDEN_NX2_SYNC_SKIP=0
#EDEN_NX2_SYNC_EXACT=0
#EDEN_NX2_INDEX_SKIP=0
#EDEN_NX2_INLINE_FIX=0
#EDEN_NX2_TOUCH_SKIP=0
#EDEN_NX2_TEX_TOUCH_SKIP=0
#EDEN_NX2_ALIAS_LAZY=0
#EDEN_NX2_USAGE_SKIP=0
#EDEN_NX2_USAGE_RESET_SKIP=0
#EDEN_NX2_GPU_WRITTEN_FILTER=0
#EDEN_NX2_MARK_WORDS=0
#EDEN_NX2_INVAL_HULL=0
#EDEN_NX2_INVAL_SKIP=0
#EDEN_NX2_SMALL_WRITE=0
#EDEN_NX2_RANGE_SKIP=0
#EDEN_NX2_SLOT_SKIP=0
#EDEN_NX2_QUERY_BOUNDS=0
#EDEN_NX2_SHADER_BOUNDS=0
#EDEN_NX2_DESC_REUSE=0
#EDEN_NX2_DESC_HULL=0
#EDEN_NX2_DESC_SECONDARY=0
#EDEN_NX2_KEY_CMP=0
#EDEN_NX2_NOTIFY_LAZY=0
#EDEN_NX2_RESET_BATCH=0
#EDEN_NX2_RESET_LAST=0
#EDEN_NX2_RESET_RUNS=0
#EDEN_NX2_RESET_SORT=0
# ASYNC_SKIP=1: skip draws whose pipeline is still compiling (things pop in; off).
#EDEN_NX2_ASYNC_SKIP=1

# --- presents and frame pacing (core/hle/service/nx2_gsv.h, video_core/nx2_mode_pace*.h) ---
# PRESENT_INTERVAL=<1-4>: hold each present at least n vblanks after the previous one.
#EDEN_NX2_PRESENT_INTERVAL=2
# PRESENT_INTERVAL_WORD=<word>[:<shift>[:<bits>]]: take the interval from that word of the
# game's present request. Donkey Kong Bananza: 12:16:4 (recommended: the game's own 60/30/20
# modes keep their speed).
#EDEN_NX2_PRESENT_INTERVAL_WORD=12:16:4
# MODE_PACE: steer Bananza's 60/30/20 fps mode by holding presents (multicore, needs
# PRESENT_INTERVAL_WORD). 0 off (default), 1 first controller, 2 v2.1 (recommended).
# Set aside while DK_DYN is applied.
#EDEN_NX2_MODE_PACE=2
# PACE_SPIN_US=<0-3000>: pacing sleeps wake that long early and yield until the target
# (default 0; recommended 1500).
#EDEN_NX2_PACE_SPIN_US=1500
# (PACE_GUEST_SLEEP=1 and PACE_GUEST_TAIL_US=<0-5000>, default 1000, are listed above.)
# PACE_ONE=0: with DK_DYN applied, presents are not paced to every vblank (default: paced).
#EDEN_NX2_PACE_ONE=0
# VBLANK_GRID=1: flip on a 60 Hz vblank grid like the console's double-buffered vsync.
#EDEN_NX2_VBLANK_GRID=1
# VRR_VSYNC=1 or <max Hz>:<min Hz> (1 = 120:40): vsync events at a variable rate (off).
#EDEN_NX2_VRR_VSYNC=1
# MODE_GOV=1: an older mode governor that steers through the GPU timer (off; MODE_PACE
# turns it off).
#EDEN_NX2_MODE_GOV=1
# GPU_BUSY_CLOCK=1: the GPU timer counts busy time only (off). GPU_TICK_DIV=<1-512>: divide
# the GPU timer by d instead of fast_gpu_time's 256.
#EDEN_NX2_GPU_BUSY_CLOCK=1
#EDEN_NX2_GPU_TICK_DIV=256
# Controller tuning (advanced; a value out of range is ignored with a warning). Defaults
# (ms, s or frames):
# EDEN_NX2_MODE_PACE_<NAME> (MODE_PACE=1): AUTO=1 60=1 FROM60=17.5 SELF60=34 DOWN_DWELL=0.5
#   TO60=13 UP_DWELL=5 UP_DWELL_MAX=60 VERIFY60=10 STABLE60=60 TO30=25 VERIFY30=10
#   UP20_DWELL=2 AFTER_UP20=10 HOLD=42 HOLD_LATE=46 HOLD20=56 HOLD20_STEP=6 HOLD20_MAX=68
#   HOLD20_EVERY=10 DOWN_FRAMES=30 UP_FRAMES=90 UP20_FRAMES=40 DOWN_REST=2 DOWN_REST_MAX=60
#   DOWN_TRIES=3 UP_REST=20 UP_REST_MAX=160 UP_TRIES=3 UP20_REST=5 UP20_REST_MAX=60
#   UP20_TRIES=3 STALL=100 STALL_QUIET=2 MODE_QUIET=1 MODE_QUIET60=0.5 TO20=0 TO20_K=34
#   TO20_MS=110 TO20_FRAMES=2 TO20_REST=30
#   UP_SINGLE=0 (0 or 50-95 ms); PROBE=<down|up|up20|to20|cycle>:<1-3600 s> (a test push)
# EDEN_NX2_MODE_PACE21_<NAME> (MODE_PACE=2): AUTO=1 CAP60=15 SELF60=34 DOWN_DWELL=0.5
#   DOWN_HOLD=37 DOWN_FRAMES=40 DOWN_REST=2 DOWN_REST_MAX=30 CAP20=31 TO20_DWELL=3
#   TO20_HOLD=42 TO20_FRAMES=10 TO20_REST=10 TO20_REST_MAX=60 FULL30_ESCAPES=2 ESCAPE=30
#   CAP30=28 REL_DWELL=2 REL=30 REL_FRAMES=6 REL_WAIT=6 REL_REST=3 REL_REST_MAX=60
#   VERIFY30=10 UP_REL=0 CAP_UP=13 UP_DWELL=5 UP_REL_MS=14 UP_REST=20 UP_REST_MAX=160
#   VERIFY60=10 STALL=100 STALL_QUIET=2 MODE_QUIET=1 MODE_QUIET60=0.5
#   PROBE=<down|to20|rel20|rel60|cycle>:<1-3600 s> (a test push)
# EDEN_NX2_MODE_GOV_<NAME> (MODE_GOV=1): HOLD=10 UP=36 DOWN=34 SPIKE=70 TO60=17 FROM60=19.5
#   TO30=31 FROM30=36, and UP_FRAMES, DOWN_FRAMES, COOLDOWN (video_core/nx2_mode_gov.h).
#EDEN_NX2_MODE_PACE21_DOWN_HOLD=37

# --- Donkey Kong Bananza dynamic frame rate (game-specific; core/loader/nx2_dk_dynamic_fps.h) ---
# DK_DYN=1: while Bananza's main module loads, patch its frame rate controller in memory (a
# port of the ZendNevs fork's dk_dynamic_fps patch): any rate from 40 to 60 fps instead of
# 60 or 30, with the game clock stepped by the real frame time. Off by default; off, no
# module is touched. Nothing is written to disk.
#EDEN_NX2_DK_DYN=1
# DK_DYN_MIN_FPS=<1-60>: with DK_DYN, move the game's 40 fps floor (unset: 40; 30 measured
# worse on our machine).
#EDEN_NX2_DK_DYN_MIN_FPS=40

# --- reactive flushing (video_core/nx2_reactive_flush.h, common/nx2_reactive.h) ---
# All off by default. Most matter only with use_reactive_flushing=true in the config;
# RX_RT_FIT, RX_MASKED_TARGETS, RX_ONE_SUBMIT and RX_COALESCE act without it too. None of
# them was measured together with frame generation (README, "Reactive flushing").
# RX_RT_FIT: a render target lookup takes the narrower image with the target's memory when
# the guest's surface clip is exactly that image (Bananza's opening: one image instead of a
# copy per draw). Both 1 and 3 need barrier_feedback_loops=true in the config. 1: a color
# feedback loop ends the render pass first. 3 (experimental): a barrier inside the render pass
# instead (color attachment writes before fragment shader reads, by region), so the render pass
# goes on; a depth feedback loop still ends it. 2 (diagnostic): no barrier. 0 off.
#EDEN_NX2_RX_RT_FIT=3
# FLUSH_FIRST_READ=1: a guest CPU read of a buffer page the GPU wrote flushes it once, at
# that read (without it the first such read gets stale data).
#EDEN_NX2_FLUSH_FIRST_READ=1
# READ_LATCH_AGE=<frames>: what a guest CPU read latched (buffer pages copied back at
# every fence, images downloaded at every bind) is dropped when not read again for that
# many frames. 0 / unset: kept for good.
#EDEN_NX2_READ_LATCH_AGE=60
# RX_ONE_SUBMIT=1: no second, empty submission after a fence's own one.
#EDEN_NX2_RX_ONE_SUBMIT=1
# RX_COALESCE=<n>: a buffer copy back that alone would turn a fence real waits for a fence
# made anyway, at most n - 1 fences (only without delayed fences). 0 / 1: off.
#EDEN_NX2_RX_COALESCE=4
# RX_PITCH_FORCED=1: with reactive flushing on, pitch linear images stay downloaded at every
# bind (as with it off).
#EDEN_NX2_RX_PITCH_FORCED=1
# RX_MASKED_TARGETS=1: a draw marks only the render targets its masks let it write.
# KNOWN DEFECT (a texture blit ignores the mask): do not turn it on.
#EDEN_NX2_RX_MASKED_TARGETS=1
# Diagnostics (they defeat reactive flushing; for tests only):
# REACTIVE_STATS=1: counters and one "nx2 reactive:" log line about every 10 s.
#EDEN_NX2_REACTIVE_STATS=1
# RX_NO_COPYBACK=1: CPU reads note no buffer page (nothing copied back at fences).
#EDEN_NX2_RX_NO_COPYBACK=1
# RX_NO_RT_LATCH=1: CPU reads latch no image (images never downloaded for them).
#EDEN_NX2_RX_NO_RT_LATCH=1
# RX_COALESCE_LOOSE=1 (with RX_COALESCE): a fence made only for queued operations, query fence
# work or the skip limit no longer takes the buffer copy backs along; they wait for a fence
# real for other work. It weakens the ordering reactive flushing gives; it measures what the
# extra submissions cost.
#EDEN_NX2_RX_COALESCE_LOOSE=1

# --- frame generation and on-screen display ---
# FG_TIMED=1: FSR3 frame generation blends each generated frame for the time it is shown
# (off; FSR3 only).
#EDEN_NX2_FG_TIMED=1
# FG_REFRESH_HZ=<20-1000>: the display refresh FG_TIMED assumes and Dynamic frame generation
# takes as its ceiling (default: asked from Windows).
#EDEN_NX2_FG_REFRESH_HZ=120
# FG_DIAG=1: frame generation timing lines in the log.
#EDEN_NX2_FG_DIAG=1
# OSD=1: game FPS, display FPS (with the frame generation multiplier) and game speed in
# RivaTuner Statistics Server's OSD every 0.5 s (anka-cli and anka.exe on Windows; RTSS must
# be running).
#EDEN_NX2_OSD=1

# --- tensor upscaler stand-in (video_core/engines/kepler_compute.cpp) ---
# UPSCALE_SCAN=0, UPSCALE_LEARN=0, UPSCALE_HEADER=0 turn off the scan for the upscaler's input
# and output words, sharing a location one program learned, and skipping bank 0's header
# words. UPSCALE_IN / UPSCALE_OUT=<bank>:<offset> (hex) pin a word; UPSCALE_DIAG=1 lists them.
#EDEN_NX2_UPSCALE_SCAN=0
#EDEN_NX2_UPSCALE_LEARN=0
#EDEN_NX2_UPSCALE_HEADER=0
#EDEN_NX2_UPSCALE_DIAG=1

# --- vi2 service experiments (core/hle/service/nx2_gsv.h; all off by default) ---
# VI2_REPLY_FILE=<file>: vi2 replies from a table, read again at most once a second.
# VI2_REPLY_OWN=<commands>: commands answered from that table alone. VI2_KIND_EVENTS=<modes>:
# what signals command 31's events of kinds 1-3. VI2_NOTIFY_OPEN=1|2: set the display's
# notification after command 101 / at the open.
#EDEN_NX2_VI2_NOTIFY_OPEN=1
# VDEC_EOS_RELEASE_NOW=1: after the end of a video stream, image releases complete at once.
#EDEN_NX2_VDEC_EOS_RELEASE_NOW=1

# --- diagnostics and unattended runs (logging only; leave them off for play) ---
#EDEN_NX2_PRESENT_DIAG=1
#EDEN_NX2_MODE_DIAG=1
#EDEN_NX2_MODE_DIAG_MAX=48
#EDEN_NX2_VI2_DIAG=1
#EDEN_NX2_VDEC_TRACE=1
#EDEN_NX2_HID_DIAG=1
#EDEN_NX2_INDIRECT_DIAG=1
#EDEN_NX2_FRONT_DIAG=0
#EDEN_NX2_FRONT_DIAG_REGS=0
#EDEN_NX2_PROFILE_FINE=0
#EDEN_NX2_PROFILE_LEAN=1
#EDEN_NX2_PROFILE_TSC=0
#EDEN_NX2_PROBE_FRONT_US=100
# AUTO_INPUT_FILE=<file>: timed presses on a virtual pad. AUTO_EXIT=<s>[@boot|@present|@album]:
# close the window that many seconds later (anka-cli, for unattended measuring).
