# Player-facing settings: the iOS launcher (dm/ios/Sources/Launcher.swift) and the Mac app's settings window (dm/mac/Launcher.swift) show them before the game starts; Mac front ends read the same list.
# dm/games/settings.py writes one game's list into its app (dm/launcher.json; build_ipa.sh, and dm/mac/pack_app.py through the NSP script): the rows whose condition holds for that game, with its defaults. Each sets an environment variable the host reads when the game starts; one an env file sets
# (Documents/env.txt, the bundle's dm/env.txt) is shown but kept. Diagnostic switches stay environment-only, so they are not listed here. The player's page is docs/settings.md.
# Columns, separated by tabs:
#   variable  the environment variable the setting sets
#   kind      choice: values value=label,..., an option only some games have with ?<shown>&<shown> after its label (languages: the game's own, from its control data; every language when it has none, with a note); range: values low:high:step, shown as a percentage;
#             toggle: values - (on sets 1, off 0) or <on>/<off>, the two values the variable takes (on/off)
#   default   a value (a toggle's: 1 on, 0 off); DM_GAME_<NAME>: the host's own default from the game profile (game_profile.h, game.py); build:<VAR>: the IPA build's setting (build_ipa.sh)
#             <ios>|<mac> selects the platform's default before resolving a profile macro or build variable
#   shown     always; DM_GAME_<NAME>!=<value> or ==<value>; fixups:<KEY>: main's rewriter table has that key (a stub in the game's build, patch_nso.py); languages>1 (more than one to pick, so also when the control data lists none); gfxapi:<API>: the packer's GFXAPI;
#             platform:<ios | mac>: the app's platform (SETTINGS_PLATFORM, ios when unset), for a switch only that platform's front end reads
#   section   Game, Controls or Performance: a heading on the single settings screen. Rows appear in table order within each section
#             Reset to tested defaults clears all launcher choices; values fixed by an env file stay
#   label, note  the setting's name and the line under it (may be empty): its cost (latency, memory, heat), then the setting recommended, as "Recommended: ..."
#   meta      optional, key=value pairs separated by ; (settings.py META lists the keys; docs/frontends.md, The settings list, describes them):
#             level=basic  a setting a front end shows first;  needs=<VAR>=<value>  a sub-setting, drawn only while the row that sets <VAR> has that value
DM_FPS_TARGET	choice	30=30 fps,60=60 fps,120=120 fps?DM_GAME_FPS_MAX==120&platform:mac	DM_GAME_FPS_TARGET	DM_GAME_FPS_TARGET!=0	Game	Frame rate	Recommended: 30 fps with Frame generation on. 60 fps heats an iPhone within a few minutes, and iOS then slows it down.	level=basic
DM_FRAMEGEN	toggle	-	0	gfxapi:nvn	Game	Frame generation	Shows 60 frames a second while the game draws 30: MetalFX makes a frame between each two. Less work and heat than 60 fps, with more input delay than real 60; fast motion can smear. Recommended: on, with Deadline boost, Real-time presenting and Encode thread on.	needs=DM_FPS_TARGET=30
DM_FRAMEGEN_SCALE	choice	1=Full,0.75=Lighter	1	gfxapi:nvn	Game	Frame generation size	Lighter makes the in-between frames at 0.75 of the picture's size, and MetalFX scales the picture back up: about half of frame generation's GPU time, for a slightly softer picture, the HUD too. Recommended: Full; Lighter if frames drop in busy areas.	needs=DM_FRAMEGEN=1
DM_DYNAMIC_RESOLUTION	toggle	-	0	fixups:DYNAMIC_RESOLUTION	Game	Dynamic resolution	Adjusts resolution between 70% and 100% under load. Turn off to keep full resolution for the selected console mode. Recommended: off when you set a Render scale.
DM_RENDER_SCALE	range	0.5:1.0:0.05	1.0	fixups:RENDER_SCALE	Game	Render scale	Recommended: 0.60 on an iPhone. Lower it if frames drop in busy areas: it is the setting that frees the most GPU time.	level=basic
DM_PRESET	toggle	potato/standard	0	DM_GAME_POTATO_N!=0	Game	Potato mode	For iPhones with less memory (8 GB, such as the iPhone 15 Pro): the A builds' memory savers. Off, none of them runs. Recommended: off, unless the game closes on an 8 GB iPhone.	level=basic
DM_OPMODE	choice	1=Docked,0=Handheld	DM_GAME_OPMODE	always	Game	Console mode	Recommended: Handheld on an iPhone. Docked renders at the TV resolution: heavier, warmer, and little sharper on a phone screen.	level=basic
DM_RES_PRESET	choice	0=Normal,1=Potato	0	DM_GAME_RES_PRESETS!=0	Game	Resolution	Normal renders 1280×720 handheld (1951×1098 docked), steady at 30 fps. Potato is the game's lighter mode: 960×540 shown at 720p, for 60 fps on a warm phone. Recommended: Normal.	level=basic
DM_PRESENT_UPSCALE	choice	off=Standard,metalfx=MetalFX	off	always	Game	Upscaling	Uses more GPU time and can increase heat. Recommended: Standard.
DM_UPSCALER	choice	game=Game's own,metalfx=MetalFX	game	DM_GAME_UPSCALER_N!=0	Game	Game's upscaler	Recommended: MetalFX. It takes about 1 ms where the game's own upscaler takes several.
DM_LANG	choice	languages	build:DM_LANG	languages>1	Game	Game language		level=basic
DM_FULLSCREEN	choice	0=Window,1=Fullscreen	0	platform:mac	Game	Display mode		level=basic
DM_PICTURE_FIT	choice	fit=Fit,fill=Fill	fit	platform:ios	Game	Picture	Fill crops the game's 16:9 picture to cover the screen. Health bars, subtitles or maps near the edges can be cut off. A full-screen picture without cropping needs a patch for each game. Recommended: Fit.
DM_SHOW_FPS	toggle	-	build:DM_SHOW_FPS	always	Game	Frame-rate counter	Recommended: off; turn it on to check the frame rate.
DM_TOUCH_HAPTICS	toggle	-	1	platform:ios	Controls	Touch feedback
DM_PAD_THEME	choice	0=Classic,1=Forest	DM_GAME_PAD_THEME	platform:ios	Controls	Touch controls style	The colours of the on-screen controls.
DM_RUMBLE	toggle	-	1	always	Controls	Game rumble		level=basic
DM_RUMBLE_GAIN	range	0:3:0.1	1.0	always	Controls	Rumble strength		needs=DM_RUMBLE=1
DM_RUMBLE_MIN	range	0:0.9:0.05	0	always	Controls	Rumble cutoff
DM_WIDE_VIEW	toggle	-	0	fixups:WIDE_VIEW	Game	Wide view	Fills the whole iPhone screen with a wider view and no black bars. Renders about a fifth more pixels and uses more memory: a little slower and warmer. Takes effect the next time the game starts. Recommended: off with Frame generation, on for 30 fps without it.
DM_SCREEN_ASPECT	choice	1.43=iPhone Duo screen (1.43:1),0=16:9 (Switch)	1.43|0	DM_GAME_SCREEN_ASPECT!=0	Game	Picture shape	Renders about a quarter more pixels: a little slower and warmer.
DM_FRAME_WG	toggle	-	DM_GAME_FRAME_WG	gfxapi:nvn	Performance	Deadline boost	Tells iOS each frame's deadline, so it keeps the game on the fast cores at a higher clock. Uses more power and heat. Recommended: on. Off, a warm phone moves the game to the slow cores and frames drop.
DM_RT	toggle	1/0	1	gfxapi:nvn	Performance	Real-time presenting	On tells iOS how much of each frame the presenting thread needs, which keeps it fast. Off may use less power, with a risk of more stutter. Recommended: on.
DM_PRESENT_SNAP	toggle	-	DM_GAME_PRESENT_SNAP	gfxapi:nvn	Performance	Frame buffering	Up to one frame more display latency. Recommended: on. Frame generation turns it on anyway.
DM_PSO_MTL4	toggle	-	DM_GAME_PSO_MTL4|1	gfxapi:nvn	Performance	Metal 4 pipelines	Keeps a pipeline archive; uses more memory. Recommended: on: fewer stutters the first time an area is drawn.
DM_PSO_PREBUILD	toggle	-	1	gfxapi:nvn	Performance	Pipeline prebuild	The first start waits a few minutes for it, once. Recommended: on.	needs=DM_PSO_MTL4=1
DM_NVN_ENC_THREAD	toggle	-	1|DM_GAME_ENC_THREAD	gfxapi:nvn	Performance	Encode thread	Prepares each frame's GPU work on a thread of its own. Recommended: on. Off, the game's own thread does it every frame and frames come late, with stutter.
DM_NVN_RC_STALE	toggle	-	0	DM_GAME_RENDER_COND!=0	Performance	Skip hidden objects (experimental)	Skips objects the game's visibility checks found hidden a frame earlier, instead of drawing them while this frame's answer is still on its way. Saves GPU time; an object coming into view can appear a frame late. Recommended: off; try it if frames drop in busy areas.
DM_FPS_HOLD	toggle	on/off	DM_GAME_FPS_HOLD	DM_GAME_FPS_TARGET!=0	Performance	Hold frames when late	Recommended: off at a fixed 30 fps.
DM_METAL_HUD	toggle	-	0	always	Performance	Performance HUD	Apple's performance overlay. Costs a little GPU time. Recommended: off; on only to measure.
