Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dm/games/settings.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
# 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
# label, note the setting's name and the line under it (the note may be empty)
DM_FPS_TARGET choice 30=30 fps,60=60 fps DM_GAME_FPS_TARGET DM_GAME_FPS_TARGET!=0 Frame rate
DM_RENDER_SCALE range 0.5:1.0:0.05 1.0 fixups:RENDER_SCALE Render scale
DM_RENDER_SCALE range 0.5:2.0:0.05 1.0 fixups:RENDER_SCALE Render scale Size the game renders its 3D views at. The game still composites them into its own window, so above 100% supersamples into that. Breath of the Wild runs at 140% and stops at 145%.
DM_FPS_HOLD choice on=Even motion,off=Always fastest DM_GAME_FPS_HOLD DM_GAME_FPS_TARGET!=0 Frame pacing Even motion halves to 30 fps when frames run late. Always fastest keeps the frame rate up and shows late frames as they come.
DM_NVN_BARRIER choice full=Full,game=Game's own full always Draw pass ordering Full waits for each pass to finish. Game's own lets passes overlap where the game did not ask for a barrier.
DM_NVN_TBDR toggle - 0 always Tile optimisations Skips storing and loading render targets the host can prove are unused. Halved the frame rate in Breath of the Wild, which reads textures through bindless handles the check cannot see. Leave off unless measuring.
DM_OPMODE choice 1=Docked,0=Handheld DM_GAME_OPMODE always Console mode
DM_LANG choice languages build:DM_LANG languages>1 Game language
DM_SHOW_FPS toggle - build:DM_SHOW_FPS always Frame-rate counter
Expand Down
9 changes: 8 additions & 1 deletion dm/host/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,15 @@ void dm_fps_state_apply(void) {
float f = (float)t; memcpy(dm_fps_state, &f, sizeof f);
// Render scale of the 3D views (the stubs at Tears of the Kingdom's main+0xd5cc0, Breath of the Wild's main+0x1266880): 1.0 keeps the game's own size and dynamic resolution;
// another factor fixes the size at that fraction (DM_RENDER_SCALE, 0.5 to 1.0). Independent of the frame step: written at target 0 too
// Above 1.0 the game renders its 3D views larger than it sized its own per-frame texture pool for, which the host
// cannot size from outside. How far it goes is per game: Breath of the Wild 1.9.0 runs at 1.40 and dies at 1.45
// (the allocation fails, the game takes the null back, SIGSEGV at main+0xed7128 addr 0x20 while the field loads).
// Allowed with a warning rather than refused, since the working range is useful and only measurement finds it.
// Note the game still composites into its own 1920x1080 window, so this supersamples into that, it does not widen it.
const char *rs = getenv("DM_RENDER_SCALE"); float sc = 1.0f;
if (rs) { char *end; sc = strtof(rs, &end); if (end == rs || *end || !(sc >= 0.5f && sc <= 1.0f)) { LOG("[RED] DM_RENDER_SCALE=%s: must be 0.5 to 1.0; keeping the game's size", rs); sc = 1.0f; } else LOG("%s: 3D views rendered at %.2f of the game's size (DM_RENDER_SCALE)", g_fps_mod, sc); }
if (rs) { char *end; sc = strtof(rs, &end); if (end == rs || *end || !(sc >= 0.5f && sc <= 2.0f)) { LOG("[RED] DM_RENDER_SCALE=%s: must be 0.5 to 2.0; keeping the game's size", rs); sc = 1.0f; }
else { LOG("%s: 3D views rendered at %.2f of the game's size (DM_RENDER_SCALE)", g_fps_mod, sc);
if (sc > 1.0f) LOG("[RED] DM_RENDER_SCALE=%.2f is above the game's own size: its per-frame texture pool was not sized for this and the game may stop when a scene needs more than the pool holds", sc); } }
memcpy(dm_fps_state + 0x10, &sc, sizeof sc);
char cap[32]; snprintf(cap, sizeof cap, ", capped at %d fps", t);
LOG("%s: frame step %s%s (%s)", g_fps_mod, !t ? "as the game sets it" : "in whole vsyncs decided by the host", t ? cap : "", e ? "DM_FPS_TARGET" : "game profile fps_target");
Expand Down