mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 14:05:57 +00:00
Merge pull request #1459: lay the UI out for screen shapes from 4:3 to 32:9, offer 4:3 and phone sizes, keep the 16:9 width at narrower shapes (itaskaev2) (#632, #1453)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
73aafc3c12
12 files changed
+262
-60
No files matched your search
@@ -26,7 +26,12 @@ Report problems as issues, following [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
modes as DLSS: for FSR 4 the setup downloads AMD's signed FSR SDK libraries
|
||||
(github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK, AMD FSR SDK license), ticked by default with an AMD GPU
|
||||
- HDR10 output with peak, game and HUD brightness settings
|
||||
- 16:10 (Steam Deck, handhelds), 3:2 (Surface, Framework), 21:9 and 32:9 (ultrawide) game resolutions, with the camera and the interface in that shape
|
||||
- Ultrawide monitors, 21:9 and 32:9 (2560x1080, 3440x1440, 3840x1600, 5120x2160, 3840x1080, 5120x1440, 7680x2160):
|
||||
the camera sees the whole width, the map and the loading screen fill it without bars or stretching, and the HUD sits
|
||||
at the screen's edges or in the middle 21:9 or 16:9 (`hud_width`)
|
||||
- Other screen shapes from 4:3 to 32:9, each with the camera and the interface in that shape: 16:10 (Steam Deck,
|
||||
handhelds), 3:2 (Surface, Framework), 4:3 (iPads, CRT monitors) and phones (19.5:9, 20:9) for streaming; on shapes
|
||||
narrower than 16:9 the view keeps the 16:9 width (Vert+)
|
||||
- Anisotropic texture filtering up to 16x, for sharp ground into the distance
|
||||
- In-game settings menu (F1) and performance overlay (F10)
|
||||
- Play time across runs on the Game tab of the settings menu, kept in `playtime.txt` next to the saves
|
||||
|
||||
+3
-1
@@ -109,7 +109,9 @@ loads the saves 1.4.3 wrote.
|
||||
file but the UI archive; for `pc` with the same `--binds` as the PC prompts step, whose key the step follows). The shapes are those of every connected display (Windows: `EnumDisplayDevices`; Linux:
|
||||
`xrandr`, else the DRM connectors), of the `output_res` the game defaults to on each, and of the `totk.ini`
|
||||
`output_res` (`installer/screens.py`). One folder per shape, named after the shape's size in `ASPECT_SIZES` (the
|
||||
closest within 1%; `5120x2160` uses `2560x1080`); `runtime/romfs.c` `overlay_init` maps the game resolution the
|
||||
closest within 1%; `5120x2160` uses `2560x1080`), or for an unlisted shape from 4:3 to 32:9 its own size (a
|
||||
`totk.ini` `output_res` of `2560x1200`, say; a display of an unlisted shape gets none, as the game keeps 1920x1080
|
||||
there); `runtime/romfs.c` `overlay_init` maps the game resolution the
|
||||
same way, and a folder of the exact size from an older setup still wins. A 16:9 player gets none. The step runs
|
||||
again when the displays, the prompts or the patches change. At a game resolution whose shape has no folder the
|
||||
game draws 16:9 with bars and starts the generator itself, in the background, for the next start: at start and
|
||||
|
||||
+25
-9
@@ -16,22 +16,28 @@ from pathlib import Path
|
||||
|
||||
# The game resolutions of another shape than 16:9 that runtime/ui/menu.cpp row_output_res lists, in the order of
|
||||
# runtime/cfg.c SHAPED: 21:9 and 32:9 monitors, 16:10 screens (the Steam Deck's 1280x800, handhelds and laptops) and 3:2
|
||||
# screens (Surface and Framework laptops and tablets)
|
||||
ASPECT_SIZES = ('2560x1080', '3440x1440', '3840x1600', '5120x2160', '3840x1080', '5120x1440',
|
||||
# screens (Surface and Framework laptops and tablets), 4:3 screens (CRT monitors, iPads) and 19.5:9 and 20:9 phone screens
|
||||
# (streamed to a phone)
|
||||
ASPECT_SIZES = ('2560x1080', '3440x1440', '3840x1600', '5120x2160', '3840x1080', '5120x1440', '7680x2160',
|
||||
'1280x800', '1680x1050', '1920x1200', '2560x1600',
|
||||
'1920x1280', '2160x1440', '2256x1504', '2880x1920', '3000x2000')
|
||||
'1920x1280', '2160x1440', '2256x1504', '2880x1920', '3000x2000',
|
||||
'1440x1080', '1600x1200', '2048x1536', '2732x2048',
|
||||
'2340x1080', '3120x1440', '2400x1080', '3200x1440')
|
||||
SHAPED = tuple(tuple(int(v) for v in s.split('x')) for s in ASPECT_SIZES)
|
||||
TOLERANCE = 0.01 # cfg.c and resolution.c res_is_16x9: shapes within 1% are the same
|
||||
# cfg.c SHAPE_MIN / SHAPE_MAX: the aspect ratios a UI layout can be made for (tools/ultrawide_layout.py), 4:3 to 32:9
|
||||
SHAPE_MIN, SHAPE_MAX = 4 / 3 * 0.99, 32 / 9 * 1.01
|
||||
|
||||
|
||||
def is_16x9(w, h):
|
||||
return abs((w / h) / (16 / 9) - 1) <= TOLERANCE
|
||||
|
||||
|
||||
def shape_size(w, h):
|
||||
def shape_size(w, h, listed=False):
|
||||
"""The folder size of w x h's shape: of ASPECT_SIZES within 1% of its aspect ratio, the closest, the first of equal
|
||||
ones (5120x2160 is 2560x1080's shape). None for 16:9 and for a shape the setup has no layout for. The same rule as
|
||||
runtime/cfg.c cfg_shape_size."""
|
||||
ones (5120x2160 is 2560x1080's shape); another shape from 4:3 to 32:9 its own size (an output_res of a phone's
|
||||
3120x1440, say), unless listed. None for 16:9 and for a shape no layout can be made for (portrait, narrower than
|
||||
4:3, wider than 32:9). The same rule as runtime/cfg.c cfg_shape_size."""
|
||||
if not w or not h or is_16x9(w, h):
|
||||
return None
|
||||
r, best, err = w / h, None, None
|
||||
@@ -39,7 +45,15 @@ def shape_size(w, h):
|
||||
e = abs(sw / sh / r - 1)
|
||||
if e <= TOLERANCE and (err is None or e < err):
|
||||
best, err = f'{sw}x{sh}', e
|
||||
return best
|
||||
if best or listed or not SHAPE_MIN <= r <= SHAPE_MAX:
|
||||
return best
|
||||
return f'{w}x{h}'
|
||||
|
||||
|
||||
def size_order(size):
|
||||
"""Sort key: the ASPECT_SIZES order, then the sizes of unlisted shapes by width and height."""
|
||||
w, h = (int(v) for v in size.split('x'))
|
||||
return (ASPECT_SIZES.index(size), 0, 0) if size in ASPECT_SIZES else (len(ASPECT_SIZES), w, h)
|
||||
|
||||
|
||||
def default_size(w, h):
|
||||
@@ -199,8 +213,10 @@ def wanted(dest, screens=None):
|
||||
text = ''
|
||||
sizes = set()
|
||||
for w, h in screens:
|
||||
# A display of an unlisted shape keeps the 1920x1080 default (cfg.c screen_default): no folder for it unless
|
||||
# output_res asks for its size.
|
||||
w, h = max(w, h), min(w, h)
|
||||
sizes.add(shape_size(w, h))
|
||||
sizes.add(shape_size(w, h, listed=True))
|
||||
d = default_size(w, h)
|
||||
if d:
|
||||
sizes.add(shape_size(*(int(v) for v in d.split('x'))))
|
||||
@@ -208,4 +224,4 @@ def wanted(dest, screens=None):
|
||||
if m:
|
||||
sizes.add(shape_size(int(m.group(1)), int(m.group(2))))
|
||||
sizes.discard(None)
|
||||
return sorted(sizes, key=ASPECT_SIZES.index), prompts_style(text)
|
||||
return sorted(sizes, key=size_order), prompts_style(text)
|
||||
+20
-6
@@ -66,7 +66,7 @@ static const char *const known[] = {
|
||||
"SHADER_MEMO", "SHADOW", "SHADOW_DEFER", "SHADOW_RANGE", "SHADOW_RES", "SHADOW_SCALE", "SHADOW_SNAP", "SHARED_FONTS", "SHARPNESS", "SHOTS", "SHOTS_DIR", "SHUTTER_FIX",
|
||||
"SHOTS_FULL", "SKIP_CS", "SPEED_PROBE", "SPIN", "SPIN_HANDOFF_US", "SPLIT_DRAWS", "SPLIT_US", "STICK_DEADZONE", "STICK_SENS",
|
||||
"SWKBD_ANSWER", "SYNC_AHEAD",
|
||||
"SWKBD_TEST", "TEST_OOM", "TEST_PAD", "TEST_PAD_RUMBLE_MS", "TEST_PREPARE_SHADERS", "TEX_ALIAS", "TEX_BLOCK_MIB", "TEX_HEAP_EXTRA_MB", "TEX_MEMO", "TEX_RELEASED_MIB", "TEX_VRAM_PRESSURE", "TIMER_1MS", "TRACE", "TXD_TRANSPOSE", "UBO_SNAPSHOT", "UB_OVERLAY", "UB_OVERLAY_OUT", "UPSCALER", "VB_USED", "VK_DYN_A2C", "VK_DYN_VERTEX", "VK_NO_FLOAT64", "VK_NO_HOST_IMPORT",
|
||||
"SWKBD_TEST", "TEST_OOM", "TEST_PAD", "TEST_PAD_RUMBLE_MS", "TEST_PREPARE_SHADERS", "TEX_ALIAS", "TEX_BLOCK_MIB", "TEX_HEAP_EXTRA_MB", "TEX_MEMO", "TEX_RELEASED_MIB", "TEX_VRAM_PRESSURE", "TIMER_1MS", "TRACE", "TXD_TRANSPOSE", "UBO_SNAPSHOT", "UB_OVERLAY", "UB_OVERLAY_OUT", "UPSCALER", "VB_USED", "VERT_PLUS", "VK_DYN_A2C", "VK_DYN_VERTEX", "VK_NO_FLOAT64", "VK_NO_HOST_IMPORT",
|
||||
"VK_PRESENT", "VK_RECORDER", "VK_SSBO_ALIGN", "VK_SUBGROUP", "VK_SUBGROUP_PIN", "VK_VALIDATION", "VMA_BLOCK_MIB", "VOLUME", "VOLUME_MASK_BIAS", "VOLUME_MUSIC", "VOLUME_SFX", "VOLUME_VOICE", "VRAM_HEADROOM", "VRAM_LIMIT_MIB", "VS_OUTS",
|
||||
"WALK_KEY", "WALK_SCALE", "WB_EAGER", "WB_EXACT", "WB_FENCE_LIMIT", "WB_MERGE", "WINDOW_SIZE", "XLATE", "XLATE_ID", "XLATE_KEEP", "XLATE_PROCS",
|
||||
"ZSTD_CHECK", "ZSTD_NATIVE",
|
||||
@@ -81,7 +81,7 @@ static const struct { const char *key, *section; } sections[] = {
|
||||
{"FULLSCREEN", "display"}, {"WINDOW_SIZE", "display"}, {"PERF_OVERLAY", "display"}, {"VK_PRESENT", "display"},
|
||||
{"GPU_INDEX", "display"}, {"OUTPUT_RES", "display"}, {"RENDER_SCALE", "display"}, {"UPSCALER", "display"},
|
||||
{"HUD_WIDTH", "display"},
|
||||
{"SHARPNESS", "display"}, {"DYNAMIC_RES", "display"}, {"ASPECT", "display"}, {"MOVIE_ASPECT", "display"}, {"FOV", "display"}, {"ANISO", "display"},
|
||||
{"SHARPNESS", "display"}, {"DYNAMIC_RES", "display"}, {"ASPECT", "display"}, {"MOVIE_ASPECT", "display"}, {"FOV", "display"}, {"VERT_PLUS", "display"}, {"ANISO", "display"},
|
||||
{"LOD_STEADY", "display"}, {"COLOR_PRESET", "display"},
|
||||
{"COLOR_BRIGHTNESS", "display"}, {"COLOR_CONTRAST", "display"}, {"COLOR_SATURATION", "display"},
|
||||
{"COLOR_GAMMA", "display"}, {"HDR", "display"}, {"HDR_PEAK_NITS", "display"}, {"HDR_GAME_NITS", "display"},
|
||||
@@ -149,6 +149,7 @@ static const CfgMeta metas[] = {
|
||||
{"DLSS_CHAR_MASK", "65", "0|35|65|100", LIVE}, {"REFLEX", "off", "off|auto|on|boost", RESTART}, {"FXAA", "1", "0|1", LIVE},
|
||||
{"LOD_STEADY", "0", "0|1", RESTART}, // sets steady
|
||||
{"ASPECT", "fit", "fit|stretch", LIVE}, {"MOVIE_ASPECT", "keep", "keep|stretch", LIVE}, {"FOV", "100", "70..140", LIVE},
|
||||
{"VERT_PLUS", "1", "0|1", LIVE}, // resolution.c res_fov_live
|
||||
{"ANISO", "game", "game|2|4|8|16", RESTART}, // vk_texture.c sampler_features
|
||||
// colour adjustment (vk_color.c); the preset is the menu's, the four values are what the present uses
|
||||
{"COLOR_PRESET", "default", "default|vivid|clarity|custom", LIVE}, {"COLOR_BRIGHTNESS", "0", "-30..30", LIVE},
|
||||
@@ -407,15 +408,24 @@ static const char *raw_get(const char *name) {
|
||||
// the Switch ones.
|
||||
static const unsigned SHAPED[][2] = {
|
||||
{2560, 1080}, {3440, 1440}, {3840, 1600}, {5120, 2160}, // 21:9
|
||||
{3840, 1080}, {5120, 1440}, // 32:9
|
||||
{3840, 1080}, {5120, 1440}, {7680, 2160}, // 32:9
|
||||
{1280, 800}, {1680, 1050}, {1920, 1200}, {2560, 1600}, // 16:10
|
||||
{1920, 1280}, {2160, 1440}, {2256, 1504}, {2880, 1920}, {3000, 2000}, // 3:2
|
||||
{1440, 1080}, {1600, 1200}, {2048, 1536}, {2732, 2048}, // 4:3 (CRT monitors, iPads)
|
||||
{2340, 1080}, {3120, 1440}, {2400, 1080}, {3200, 1440}, // 19.5:9 and 20:9 (phones, streamed)
|
||||
};
|
||||
|
||||
// The shapes a UI layout can be made for (tools/ultrawide_layout.py works on any aspect ratio between these): from 4:3
|
||||
// to 32:9, 1% either side. A shape between them that SHAPED does not list takes a folder of its own exact size.
|
||||
#define SHAPE_MIN (4.0 / 3.0 * 0.99)
|
||||
#define SHAPE_MAX (32.0 / 9.0 * 1.01)
|
||||
|
||||
// The folder size of w x h's shape: of SHAPED within 1% of its aspect ratio, the closest, the first of equal ones
|
||||
// (5120x2160 takes 2560x1080). The UI layout depends on the aspect ratio alone (tools/ultrawide_layout.py apply), so
|
||||
// the setup writes one romfs-patches-<w>x<h> per shape, named after this size (installer/screens.py shape_size, the
|
||||
// same rule), and romfs.c overlay_init looks for it. 0 for 16:9 and for a shape without a layout.
|
||||
// same rule), and romfs.c overlay_init looks for it. A shape SHAPED does not list but within SHAPE_MIN..SHAPE_MAX (a
|
||||
// phone's 13:6 screen streamed to, say) is its own folder, w x h itself, which the setup and the game's background
|
||||
// generator make as they make the listed ones. 0 for 16:9 and outside that range (portrait screens).
|
||||
int cfg_shape_size(unsigned w, unsigned h, unsigned out[2]) {
|
||||
if (!w || !h) return 0;
|
||||
double r = (double)w / h, err = 0;
|
||||
@@ -425,8 +435,12 @@ int cfg_shape_size(unsigned w, unsigned h, unsigned out[2]) {
|
||||
double e = fabs((double)SHAPED[i][0] / SHAPED[i][1] / r - 1);
|
||||
if (e <= 0.01 && (best < 0 || e < err)) best = i, err = e;
|
||||
}
|
||||
if (best < 0) return 0;
|
||||
out[0] = SHAPED[best][0], out[1] = SHAPED[best][1];
|
||||
if (best >= 0) {
|
||||
out[0] = SHAPED[best][0], out[1] = SHAPED[best][1];
|
||||
return 1;
|
||||
}
|
||||
if (r < SHAPE_MIN || r > SHAPE_MAX) return 0;
|
||||
out[0] = w, out[1] = h;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -23,8 +23,9 @@ unsigned cfg_version(void);
|
||||
int cfg_from_env(const char *name);
|
||||
// 1 when the player set name (the environment or totk.ini), 0 when cfg_get gives a device profile's default or NULL.
|
||||
int cfg_is_set(const char *name);
|
||||
// The folder size of w x h's shape (cfg.c SHAPED: the closest aspect ratio within 1%, the first of equal ones), the
|
||||
// one romfs-patches-<w>x<h> the setup writes for it. 0 for 16:9 and for a shape without a UI layout.
|
||||
// The folder size of w x h's shape (cfg.c SHAPED: the closest aspect ratio within 1%, the first of equal ones; an
|
||||
// unlisted shape from 4:3 to 32:9 keeps w x h), the one romfs-patches-<w>x<h> the setup writes for it. 0 for 16:9 and
|
||||
// for a shape without a UI layout (portrait, narrower than 4:3, wider than 32:9).
|
||||
int cfg_shape_size(unsigned w, unsigned h, unsigned out[2]);
|
||||
// The size output_res defaults to on this display (its shape, cfg.c screen_default) while the player set no
|
||||
// output_res, also when the default stays 1920x1080 because that shape lacks the prompts' folder. The generator the game
|
||||
|
||||
+13
-4
@@ -357,16 +357,25 @@ int probe_cfg(void) {
|
||||
"prompts: the PlayStation folder puts A on the circle exactly when the layout puts A on the east button");
|
||||
}
|
||||
// One folder per screen shape (cfg.c cfg_shape_size, installer/screens.py shape_size): the closest aspect ratio of
|
||||
// SHAPED within 1%, the first of equal ones; 16:9 and unlisted shapes have none.
|
||||
// SHAPED within 1%, the first of equal ones; an unlisted shape from 4:3 to 32:9 its own size; 16:9, portrait and
|
||||
// shapes narrower than 4:3 none.
|
||||
unsigned sz[2] = {0, 0};
|
||||
CHECK(cfg_shape_size(5120, 2160, sz) && sz[0] == 2560 && sz[1] == 1080, "shape: 5120x2160 takes 2560x1080's folder");
|
||||
CHECK(cfg_shape_size(3440, 1440, sz) && sz[0] == 3440 && sz[1] == 1440, "shape: 3440x1440 keeps its own (0.8% off 2560x1080)");
|
||||
CHECK(cfg_shape_size(1920, 800, sz) && sz[0] == 3840 && sz[1] == 1600, "shape: 1920x800 takes 3840x1600's folder");
|
||||
CHECK(cfg_shape_size(2560, 1600, sz) && sz[0] == 1280 && sz[1] == 800 && cfg_shape_size(3000, 2000, sz) &&
|
||||
sz[0] == 1920 && sz[1] == 1280 && cfg_shape_size(5120, 1440, sz) && sz[0] == 3840 && sz[1] == 1080,
|
||||
sz[0] == 1920 && sz[1] == 1280 && cfg_shape_size(5120, 1440, sz) && sz[0] == 3840 && sz[1] == 1080 &&
|
||||
cfg_shape_size(7680, 2160, sz) && sz[0] == 3840 && sz[1] == 1080,
|
||||
"shape: 16:10, 3:2 and 32:9 take their first size");
|
||||
CHECK(!cfg_shape_size(1920, 1080, sz) && !cfg_shape_size(2560, 1440, sz) && !cfg_shape_size(1024, 768, sz),
|
||||
"shape: none for 16:9 and 4:3");
|
||||
CHECK(cfg_shape_size(1024, 768, sz) && sz[0] == 1440 && sz[1] == 1080 && cfg_shape_size(2048, 1536, sz) &&
|
||||
sz[0] == 1440 && sz[1] == 1080 && cfg_shape_size(3120, 1440, sz) && sz[0] == 2340 && sz[1] == 1080,
|
||||
"shape: 4:3 and 19.5:9 take their first size");
|
||||
CHECK(cfg_shape_size(2560, 1200, sz) && sz[0] == 2560 && sz[1] == 1200 && cfg_shape_size(2000, 1080, sz) &&
|
||||
sz[0] == 2000 && sz[1] == 1080,
|
||||
"shape: an unlisted shape between 4:3 and 32:9 keeps its own size");
|
||||
CHECK(!cfg_shape_size(1920, 1080, sz) && !cfg_shape_size(2560, 1440, sz) && !cfg_shape_size(1280, 1024, sz) &&
|
||||
!cfg_shape_size(1080, 1920, sz) && !cfg_shape_size(7680, 1440, sz),
|
||||
"shape: none for 16:9, narrower than 4:3, portrait and wider than 32:9");
|
||||
// romfs.c shaped_name: the exact size's folder (an older setup wrote every size) wins, else the shape's
|
||||
{
|
||||
char dir[1100], f[1200];
|
||||
|
||||
+34
-9
@@ -44,6 +44,8 @@
|
||||
#include "ov.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
static void vert_plus_init(double ratio_over_16x9);
|
||||
|
||||
#define BASE_W 1920
|
||||
#define BASE_H 1080
|
||||
#define SCENE_W 1600
|
||||
@@ -643,6 +645,7 @@ void res_init(void) {
|
||||
memcpy(page + 56, &r, sizeof r);
|
||||
rt_patch_switch(aspect, 1);
|
||||
rt_log("resolution: camera aspect ratio %.4f (16:9 is %.4f)", ratio, game);
|
||||
if (ratio < game) vert_plus_init(ratio / game);
|
||||
}
|
||||
} else {
|
||||
rt_patch_switch(aspect, 0); // the page holds no ratio
|
||||
@@ -673,25 +676,47 @@ int res_wants_wide_overlay(const unsigned out[2]) {
|
||||
|
||||
// Field of view (TOTK_FOV, percent of the game's own, 70..140, live): the camera's vertical view angle times the factor
|
||||
// on page +60 (recomp/patches-v110.txt, patches-v121.txt and patches-v143.txt, set fov). The horizontal angle follows
|
||||
// through the aspect ratio. 100 switches the set off, so the camera code is the game's own. Runs on a settings change
|
||||
// (gfx_present.c window_settings_live), the first time at the first present.
|
||||
// through the aspect ratio. A factor of 1 switches the set off, so the camera code is the game's own. Runs on a settings
|
||||
// change (gfx_present.c window_settings_live), the first time at the first present.
|
||||
//
|
||||
// Vert+ (TOTK_VERT_PLUS, on by default): the camera keeps the game's vertical view angle at every shape, so a shape
|
||||
// narrower than 16:9 (16:10, 3:2, 4:3) showed less of the world at the sides than 16:9 does. The factor is then also
|
||||
// multiplied by the one that gives the game's default view the horizontal angle it has at 16:9: tan(v'/2) = tan(v/2)
|
||||
// * (16/9) / aspect, so v' / v = 2 atan(tan(v/2) k) / v with k = 16:9 over the aspect. v is the game's default
|
||||
// vertical angle, 51.2 degrees, measured on 1.4.3 at Lookout Landing: a 4:3 frame at TOTK_FOV=130 is a 16:9 frame of
|
||||
// the same moment scaled by 0.730 about its middle (tan(v/2) / tan(1.3 v/2) = 0.730 gives v = 51.2). The patch scales
|
||||
// the angle linearly, so a zoomed view (the bow, the scope) gets the same factor, a few percent short of the exact one.
|
||||
#define FOV_MIN 70
|
||||
#define FOV_MAX 140
|
||||
#define VERT_PLUS_V (51.2 * 3.14159265358979 / 180)
|
||||
static float vert_plus_k = 1; // set by res_init (vert_plus_init) for a camera narrower than 16:9
|
||||
|
||||
static void vert_plus_init(double ratio_over_16x9) {
|
||||
double k = 1 / ratio_over_16x9, v = VERT_PLUS_V;
|
||||
vert_plus_k = (float)(2 * atan(tan(v / 2) * k) / v);
|
||||
}
|
||||
|
||||
void res_fov_live(void) {
|
||||
static int set = -2, shown = 100;
|
||||
static int set = -2, shown = 100, shown_vp = -1;
|
||||
if (set == -2) set = rt_patch_set("fov");
|
||||
int pct = cfg_int("TOTK_FOV");
|
||||
pct = pct < FOV_MIN ? FOV_MIN : pct > FOV_MAX ? FOV_MAX : pct;
|
||||
if (pct == shown) return;
|
||||
shown = pct;
|
||||
int vp = vert_plus_k != 1 && cfg_bool("TOTK_VERT_PLUS");
|
||||
if (pct == shown && vp == shown_vp) return;
|
||||
shown = pct, shown_vp = vp;
|
||||
if (set < 0) {
|
||||
rt_log("resolution: this game version has no field-of-view patch; TOTK_FOV=%d does nothing", pct);
|
||||
if (pct != 100 || vp)
|
||||
rt_log("resolution: this game version has no field-of-view patch; TOTK_FOV=%d and Vert+ do nothing", pct);
|
||||
return;
|
||||
}
|
||||
float k = pct / 100.0f;
|
||||
float k = pct / 100.0f * (vp ? vert_plus_k : 1);
|
||||
memcpy((uint8_t *)rt_patch_page() + 60, &k, sizeof k); // before the switch: a site that sees it on reads k
|
||||
rt_patch_switch(set, pct != 100);
|
||||
rt_log("resolution: field of view %d%% of the game's", pct);
|
||||
rt_patch_switch(set, k != 1);
|
||||
if (vp)
|
||||
rt_log("resolution: field of view %d%% of the game's, times %.4f for Vert+ (the 16:9 width at this narrower "
|
||||
"shape)", pct, vert_plus_k);
|
||||
else
|
||||
rt_log("resolution: field of view %d%% of the game's", pct);
|
||||
}
|
||||
|
||||
// TOTK_DYNAMIC_RES = 0 holds the game's dynamic resolution at 100 % (patches-v110.txt, patches-v121.txt and patches-v143.txt,
|
||||
|
||||
+9
-6
@@ -571,15 +571,18 @@ static void folders_retry(const char *id, int need) {
|
||||
}
|
||||
|
||||
// The game resolution (resolution.c): 16:9 sizes from its smallest, 1280x720 (for weak GPUs), up, the common 21:9 and
|
||||
// 32:9 monitor sizes, the 16:10 screens of the Steam Deck, handhelds and laptops and the 3:2 screens of laptops and
|
||||
// tablets (Surface, Framework; the camera and the HUD follow
|
||||
// another shape, resolution.c res_init; the installer lays the HUD out for each, installer/steps.py ASPECT_SIZES), and
|
||||
// the current value when it is another size.
|
||||
// 32:9 monitor sizes (7680x2160: the 57-inch dual-4K ones), the 16:10 screens of the Steam Deck, handhelds and laptops, the 3:2 screens of laptops and
|
||||
// tablets (Surface, Framework), the 4:3 screens of CRT monitors and iPads and the 19.5:9 and 20:9 screens of phones a
|
||||
// game is streamed to (the camera and the HUD follow another shape, resolution.c res_init; the installer lays the HUD
|
||||
// out for each, installer/screens.py ASPECT_SIZES), and the current value when it is another size: any shape from 4:3
|
||||
// to 32:9 gets a layout of its own (cfg.c cfg_shape_size).
|
||||
static void row_output_res(void) {
|
||||
static const char *const vals[] = {"1280x720", "1600x900", "1920x1080", "2560x1440", "3200x1800", "3840x2160",
|
||||
"2560x1080", "3440x1440", "3840x1600", "5120x2160", "3840x1080", "5120x1440",
|
||||
"2560x1080", "3440x1440", "3840x1600", "5120x2160", "3840x1080", "5120x1440", "7680x2160",
|
||||
"1280x800", "1680x1050", "1920x1200", "2560x1600",
|
||||
"1920x1280", "2160x1440", "2256x1504", "2880x1920", "3000x2000"};
|
||||
"1920x1280", "2160x1440", "2256x1504", "2880x1920", "3000x2000",
|
||||
"1440x1080", "1600x1200", "2048x1536", "2732x2048",
|
||||
"2340x1080", "3120x1440", "2400x1080", "3200x1440"};
|
||||
enum { N = sizeof vals / sizeof *vals };
|
||||
char shown[N][32];
|
||||
const char *names[N];
|
||||
|
||||
@@ -156,6 +156,15 @@ class RealArchiveTest(unittest.TestCase):
|
||||
ui.apply(full, members, width, height)
|
||||
expected = bytearray(original)
|
||||
baseline['apply'](expected, members, width, height)
|
||||
# The map (its layout and the minimap animation's width keys), the Purah Pad's frame and the loading screen
|
||||
# changed on purpose after it (the maps fill the screen, the frame keeps its width, the camera's album window
|
||||
# has the screen's shape, the inn's clock follows the choices to the bottom edge); the rest is byte for byte.
|
||||
for member in ('blyt/AppMap_00.bflyt', 'blyt/AppMenuOverlay_00.bflyt', 'blyt/LoadingFade_00.bflyt',
|
||||
'blyt/CameraSystemWindow_00.bflyt', 'blyt/Time_00.bflyt',
|
||||
'anim/AppMap_00_MiniMap.bflan', 'anim/LoadingFade_00_BarIn.bflan',
|
||||
'anim/LoadingFade_00_BarOut.bflan'):
|
||||
lo, hi = members[member]
|
||||
expected[lo:hi] = full[lo:hi]
|
||||
self.assertEqual(full, expected)
|
||||
for cap, extension in ((16 / 9, 0), (21 / 9, 300)):
|
||||
data = bytearray(original)
|
||||
|
||||
@@ -1090,8 +1090,11 @@ class ShapesTest(unittest.TestCase):
|
||||
|
||||
def test_shape_rule(self):
|
||||
self.assertEqual([screens.shape_size(*s) for s in ((5120, 2160), (3440, 1440), (1920, 800), (2560, 1600),
|
||||
(1920, 1080), (1024, 768))],
|
||||
['2560x1080', '3440x1440', '3840x1600', '1280x800', None, None])
|
||||
(1920, 1080), (1024, 768), (3120, 1440), (2560, 1200),
|
||||
(1280, 1024), (1080, 1920), (7680, 1440), (7680, 2160))],
|
||||
['2560x1080', '3440x1440', '3840x1600', '1280x800', None, '1440x1080', '2340x1080',
|
||||
'2560x1200', None, None, None, '3840x1080'])
|
||||
self.assertIsNone(screens.shape_size(2560, 1200, listed=True)) # a display of an unlisted shape
|
||||
self.assertEqual(screens.default_size(3440, 1440), '2560x1080') # runtime/cfg.c screen_default
|
||||
self.assertEqual(screens.default_size(1280, 800), '1280x800')
|
||||
|
||||
@@ -1125,6 +1128,10 @@ class ShapesTest(unittest.TestCase):
|
||||
(['2560x1080', '3440x1440', '1280x800', '1920x1280'], 'pc'))
|
||||
self.assertEqual(screens.wanted(self.dest / 'none', [(2560, 1440)]), ([], None))
|
||||
|
||||
def test_wanted_unlisted_output_res_gets_its_own_size(self):
|
||||
(self.dest / 'totk.ini').write_text('output_res = 2560x1200\n')
|
||||
self.assertEqual(screens.wanted(self.dest, [(2560, 1200), (1600, 1200)]), (['1440x1080', '2560x1200'], None))
|
||||
|
||||
def test_layout_settings_keep_the_last_nonempty_value(self):
|
||||
for empty in ('', ' ', '""'):
|
||||
with self.subTest(empty=empty):
|
||||
|
||||
+113
-10
@@ -15,9 +15,10 @@ and every pane field and animation key holds the value the edit expects before i
|
||||
import math
|
||||
import struct
|
||||
|
||||
# BFLYT pane sections (pan1, pic1, txt1, ...): name at +12 (24 bytes), translate x / y at +44 / +48, scale x / y at +68 / +72.
|
||||
# BFLYT pane sections (pan1, pic1, txt1, ...): name at +12 (24 bytes), translate x / y at +44 / +48, scale x / y at +68 / +72,
|
||||
# size (width) at +76.
|
||||
PANE_MAGICS = (b'pan1', b'pic1', b'txt1', b'wnd1', b'bnd1', b'prt1', b'ali1', b'scr1')
|
||||
FIELD = {'x': 44, 'y': 48, 'scale_x': 68, 'scale_y': 72}
|
||||
FIELD = {'x': 44, 'y': 48, 'scale_x': 68, 'scale_y': 72, 'w': 76, 'h': 80}
|
||||
|
||||
# Full-screen layouts whose root pane stays as wide as the canvas.
|
||||
KEEP_ROOT = {'AppMenuBG_00', 'PauseMenuBG_00', 'ShopMenuParasailBG_00', 'ShortCutBG_00', 'TitleMenuBG_00', 'EventFade_00',
|
||||
@@ -60,6 +61,22 @@ def hud_extent(k, hud_aspect):
|
||||
inner = 1 / ((16 / 9) / hud_aspect) - 1 # 1 / kc - 1
|
||||
return 960 * inner, 960 * k * inner
|
||||
|
||||
# The loading screen's map is a capture of the world map that the game draws as the 3 x 3 tiles of 840 units around the
|
||||
# player's tile (measured with TOTK_DUMP at 3840x1080: nine 840x840 tile draws into the capture), so only 840 units
|
||||
# either side of the player are certain to hold map; wider, the capture shows black beside the tiles where the player
|
||||
# stands near a tile's edge. At 16:9 it is 1470 wide (the screen's 1920 less 450), its left edge 23 units past the
|
||||
# screen's, and the side panel (a window, so its frame keeps its proportions at any width) covers its right 237 units.
|
||||
LOADING_MAP_MAX = 1660
|
||||
|
||||
def loading_map(k):
|
||||
"""(width, shift, panel width) of the loading screen's map capture and side panel for k = 16:9 over the aspect: the
|
||||
map as wide as the screen allows up to LOADING_MAP_MAX, its left edge where 16:9 has it relative to the screen's
|
||||
edge (shift: how far its centre moves from x -248), and the panel from the map's right part to the screen's edge."""
|
||||
width = min(1920 / k - 450, max(1470, LOADING_MAP_MAX))
|
||||
centre = -960 / k - 23 + width / 2
|
||||
panel = 960 / k - (centre + width / 2 - 237)
|
||||
return width, centre + 248, panel
|
||||
|
||||
def edits(k, hud_aspect):
|
||||
"""(layout, pane, field, value) for the aspect: k = 16/9 over the aspect (the root's scale), w = how far a 1920-wide
|
||||
layout's edge moves out in its own units (960 * (1 / k - 1)). OFF moves a pane out of sight. hud_aspect: the
|
||||
@@ -71,7 +88,15 @@ def edits(k, hud_aspect):
|
||||
out = [
|
||||
('AppAlbum_00', 'N_FadeInOut_00', 'scale_x', k), ('AppAlbum_00', 'N_Open_01', 'scale_x', wide),
|
||||
*[('AppMap_00', f'N_BlurInOut_0{i}', 'scale_x', wide) for i in range(4)],
|
||||
('AppMap_00', 'N_MiniMap_00', 'x', -270 * (1 - k)),
|
||||
# With the map as wide as the screen, the layer tabs go to its left edge and the time, temperature and
|
||||
# position to its right edge, as at 16:9 (neither position is animated; AppMap_00_MiniMap keys their visibility).
|
||||
('AppMap_00', 'N_MiniMap_00', 'x', -w), ('AppMap_00', 'N_AllMapTime_00', 'x', w),
|
||||
# The map: the panes that cut it out and its black backing are 2250 wide, so under the 16:9 root the world map
|
||||
# ended short of the screen's sides and black bars showed there. They take the screen's width in the root's
|
||||
# units instead (a size, not a scale: the map inside keeps its proportions and more of it shows), and so do the
|
||||
# icon area and the shadow frame over it.
|
||||
*[('AppMap_00', pane, 'w', 2250 / k) for pane in ('N_Cut_00', 'N_Capture_00', 'Black8_01', 'N_Cut_01',
|
||||
'P_MapCapture_00', 'N_Cut_02', 'N_IconArea_00', 'W_Shadow_00')],
|
||||
('AppMenuOverlay_00', 'N_FadeInOut_00', 'scale_x', k), ('AppMenuOverlay_00', 'N_FadeInOut_01', 'scale_x', k),
|
||||
('AppMenuOverlay_00', 'N_Icon_00', 'scale_x', k), ('AppMenuOverlay_00', 'N_TitleOne_01', 'scale_x', k),
|
||||
('AppOpenDemoWindow_00', 'P_BG_00', 'scale_x', wide), ('AutoBuilder_00', 'N_BG_00', 'scale_x', wide),
|
||||
@@ -83,12 +108,17 @@ def edits(k, hud_aspect):
|
||||
('CameraSystemWindow_00', 'T_Text_00', 'scale_x', k),
|
||||
('ChallengeLog_00', 'C_CaptureUp_00', 'x', OFF), ('ChallengeLog_00', 'C_CaptureUp_01', 'x', OFF),
|
||||
('GameOver_00', 'P_BG_00', 'scale_x', wide),
|
||||
('LoadingFade_00', 'N_Base_00', 'scale_x', wide), ('LoadingFade_00', 'N_Logo_00', 'x', w),
|
||||
# The loading screen: the map starts at the screen's left edge and the side panel ends at its right edge, each
|
||||
# unstretched. See loading_map for the widths.
|
||||
('LoadingFade_00', 'N_Logo_00', 'x', w),
|
||||
('LoadingFade_00', 'N_Status_00', 'x', w), ('LoadingFade_00', 'N_Tips_00', 'x', -w),
|
||||
('LoadingFade_00', 'P_BG_00', 'scale_x', wide), ('LoadingFade_00', 'P_SideBGDeco_00', 'scale_x', k),
|
||||
('LoadingFade_00', 'Pa_IconPlayer_00', 'scale_x', k), ('LoadingFade_00', 'Pa_LargeDungeonMap_00', 'scale_x', k),
|
||||
('LoadingFade_00', 'Pa_LargeDungeonMap_01', 'scale_x', k), ('LoadingFade_00', 'Pa_Map_00', 'scale_x', k),
|
||||
('LoadingFade_00', 'Pa_Map_01', 'scale_x', k),
|
||||
('LoadingFade_00', 'P_BG_00', 'scale_x', wide), ('LoadingFade_00', 'P_BG_01', 'scale_x', wide),
|
||||
('LoadingFade_00', 'P_Grid_00', 'scale_x', wide), ('LoadingFade_00', 'P_Bar_00', 'scale_x', wide),
|
||||
*[('LoadingFade_00', pane, 'w', loading_map(k)[0]) for pane in ('C_CaptureMap_00', 'C_CaptureMap_01',
|
||||
'P_CaptureMap_00', 'P_CaptureMap_01')],
|
||||
('LoadingFade_00', 'N_Map_00', 'x', -248 + loading_map(k)[1]),
|
||||
('LoadingFade_00', 'W_SideBGDeco_00', 'x', 960 / k), ('LoadingFade_00', 'W_SideBGDeco_00', 'w', loading_map(k)[2]),
|
||||
('LoadingFade_00', 'P_SideBGDeco_00', 'x', 960 / k),
|
||||
('MessageLog_01', 'P_Capture_00', 'scale_x', wide), ('OwnedHorseList_00', 'N_BG_00', 'scale_x', wide),
|
||||
('PaCommonBtnTitle_00', 'B_Hit_00', 'x', OFF), ('PaCommonBtnTitle_00', 'N_Cursor_00', 'x', OFF),
|
||||
('PaLargeDungeonMap_00', 'P_BG_00', 'scale_x', wide), ('PaMessageBtn_00', 'B_Hit_00', 'x', OFF),
|
||||
@@ -99,6 +129,13 @@ def edits(k, hud_aspect):
|
||||
*[e for pane, x, _ in BALLOON_PART for e in (('PaBalloonMessage_00', pane, 'scale_x', k),
|
||||
('PaBalloonMessage_00', pane, 'x', x * k))],
|
||||
]
|
||||
# The Purah Pad's frame (map, album, ...): AppMenuOverlay_00 keeps a root as wide as the screen, so the stone and
|
||||
# light pieces at its left and right edges (x = -960 / 960, anchored at their outer side) were stretched with it.
|
||||
# They keep their own width at the edges.
|
||||
out += [('AppMenuOverlay_00', f'P_Frame{side}{part}', 'scale_x', k) for side in 'LR'
|
||||
for part in ('Core_00', 'AlbNrm_00', 'Light_00', 'EdgeFast_00', 'EdgeSlow_00', 'EdgeFastGlow_00',
|
||||
'EdgeSlowGlow_00')]
|
||||
out += [('AppMenuOverlay_00', f'P_Frame{side}Dent_0{i}', 'scale_x', k) for side in 'LR' for i in (0, 1)]
|
||||
# Menus framed by two side decorations, a header and a background: the frame stays at the screen's edges.
|
||||
for layout, deco in (('PauseMenuOverlay_00', 'P_Deco{}_00'), ('SystemLoadList_00', 'P_Deco{}_00'),
|
||||
('SystemOption_00', 'P_Deco{}_00'), ('SystemSaveLoad_00', 'P_Deco{}_00')):
|
||||
@@ -135,10 +172,21 @@ def tall_edits(k):
|
||||
out = [('AppAlbum_00', 'N_FadeInOut_00', 'scale_y', k), ('AppAlbum_00', 'N_Open_01', 'scale_y', tall),
|
||||
*[('AppMenuOverlay_00', p, 'scale_y', k) for p in ('N_FadeInOut_00', 'N_FadeInOut_01', 'N_Icon_00',
|
||||
'N_TitleOne_01')],
|
||||
('CameraPointer_00', 'N_Type_01', 'scale_y', k), ('CameraSystemWindow_00', 'N_FirstOut_00', 'scale_y', k),
|
||||
('CameraPointer_00', 'N_Type_01', 'scale_y', k),
|
||||
# The camera's "save to the album?" window: N_InOut_00 takes the screen's height (below), so the photo's
|
||||
# frame (N_AlbumPic_00) has the screen's shape, as the photo has. The compendium's square photos
|
||||
# (N_PictureBook_00) and the album's question and buttons (N_AlbumCon_00) keep their proportions, and the
|
||||
# question and the buttons move out by the frame's extra half height (319.5 of its 639).
|
||||
*[('CameraSystemWindow_00', p, 'scale_y', k) for p in ('N_PictureBook_00', 'N_AlbumCon_00')],
|
||||
('CameraSystemWindow_00', 'T_TextAlbum_00', 'y', 380 + 319.5 * (tall - 1)),
|
||||
*[('CameraSystemWindow_00', p, 'y', -396 - 319.5 * (tall - 1)) for p in ('Pa_BtnL_01', 'Pa_BtnR_01')],
|
||||
*[('LoadingFade_00', p, 'scale_y', k) for p in ('Pa_IconPlayer_00', 'Pa_LargeDungeonMap_00',
|
||||
'Pa_LargeDungeonMap_01', 'Pa_Map_00', 'Pa_Map_01')],
|
||||
*[('AppMap_00', f'N_BlurInOut_0{i}', 'scale_y', tall) for i in range(4)],
|
||||
# The map's capture, its cut, backing and shadow are 1080 high, the height of a 16:9 layout: they take the
|
||||
# screen's height, 1080 / k, so the map fills it instead of leaving black above and below (tall_anim
|
||||
# does the same for the keys of AppMap_00_MiniMap that hold 1080)
|
||||
*[('AppMap_00', pane, 'h', 1080 * tall) for pane in MAP_TALL + ('W_Shadow_00',)],
|
||||
*[(layout, 'P_BG_00', 'scale_y', tall) for layout in ('AppOpenDemoWindow_00', 'GameOver_00', 'LoadingFade_00',
|
||||
'PaLargeDungeonMap_00', 'PaRecipeCardList_00')],
|
||||
('LoadingFade_00', 'N_Base_00', 'scale_y', tall),
|
||||
@@ -157,7 +205,10 @@ def tall_edits(k):
|
||||
'ShopMenu_00', 'SystemActionGuide_00') + SYSTEM_MENUS]
|
||||
out += [(name, 'RootPane', 'y', -540 * (1 - k)) for name in (
|
||||
'CtrlGuide_00', 'DoCommand_00', 'EnvironmentInfo_00', 'HorseGauge_00', 'MessageDialog_00', 'MessageLog_01',
|
||||
'PauseMenuOverlay_00', 'SaveLoadIcon_00', 'TreasureFullShortCut_00')]
|
||||
'PauseMenuOverlay_00', 'SaveLoadIcon_00', 'TreasureFullShortCut_00',
|
||||
# the clock an inn's choices show (05:00) under MessageDialog_00's list: it stayed in the middle 16:9 and was
|
||||
# drawn over the list's last rows
|
||||
'Time_00')]
|
||||
out += [('AppAlbum_00', 'N_PicLoad_01', 'y', -540 * (1 - k)), ('AppMap_00', 'N_AllMapTime_00', 'y', -h),
|
||||
('AppMenuOverlay_00', 'A_Align_00', 'y', -(505 + h)), ('AppMenuOverlay_00', 'Pa_GuideLeft_00', 'y', -(505 + h)),
|
||||
('AppMenuOverlay_00', 'N_TitleTab_00', 'y', 491 + h),
|
||||
@@ -200,6 +251,49 @@ def anim_keys(blarc, lo, pane, tag, target):
|
||||
pos += size
|
||||
return out
|
||||
|
||||
FLPA_SIZE_X = 8 # BFLAN FLPA target: the pane's width
|
||||
|
||||
# The map's panes that AppMap_00_MiniMap sizes: in the full map they hold the width 2250 in its keys (the minimap
|
||||
# shrinks them), and the animation's keys win over the layout's size, so a wider screen still cut the map at 2250.
|
||||
MAP_SIZED = ('N_IconArea_00', 'N_Cut_00', 'N_Capture_00', 'P_MapCapture_00', 'Black8_01', 'N_Cut_01', 'N_Cut_02')
|
||||
|
||||
# The map's panes that hold the 16:9 layout's height, 1080, in the layout and in the full map's keys of AppMap_00_MiniMap
|
||||
MAP_TALL = ('N_Cut_00', 'N_Capture_00', 'P_MapCapture_00', 'Black8_01')
|
||||
FLPA_SIZE_Y = 9 # BFLAN FLPA target: the pane's height
|
||||
|
||||
def wide_anim(blarc, members, k, changed):
|
||||
"""The animation keys that hold the full map's width, for a canvas wider than 16:9: 2250 becomes 2250 / k, the
|
||||
screen's width in the 16:9 root's units plus the same margin, as edits() does for the layout's sizes."""
|
||||
member = 'anim/AppMap_00_MiniMap.bflan'
|
||||
if member not in members: raise SystemExit(f'AppMap_00_MiniMap: no animation {member} in the archive')
|
||||
lo = members[member][0]
|
||||
if blarc[lo:lo + 4] != b'FLAN': return # tests/hud_layout_test.py's synthetic archive: fixed-offset keys only
|
||||
found = 0
|
||||
for pane in MAP_SIZED:
|
||||
for keys in anim_keys(blarc, lo, pane, b'FLPA', FLPA_SIZE_X):
|
||||
for key in keys:
|
||||
if abs(struct.unpack_from('<f', blarc, key + 4)[0] - 2250) < 1e-3:
|
||||
struct.pack_into('<f', blarc, key + 4, 2250 / k); found += 1
|
||||
if found < len(MAP_SIZED): raise SystemExit(f'AppMap_00_MiniMap: {found} width keys of 2250, expected at least {len(MAP_SIZED)}')
|
||||
changed.add(member)
|
||||
|
||||
def loading_anim(blarc, members, k, changed):
|
||||
"""The loading screen's map slides by 24 units when the bar comes in and goes out (LoadingFade_00_BarIn: x -278 to
|
||||
-302, BarOut: -302 to -326); the keys move with the map's centre (loading_map)."""
|
||||
shift = loading_map(k)[1]
|
||||
for name, shipped in (('LoadingFade_00_BarIn', (-278, -302)), ('LoadingFade_00_BarOut', (-302, -326))):
|
||||
member = f'anim/{name}.bflan'
|
||||
mini = members.get('anim/AppMap_00_MiniMap.bflan')
|
||||
if mini and blarc[mini[0]:mini[0] + 4] != b'FLAN': return # tests/hud_layout_test.py's synthetic archive
|
||||
if member not in members: raise SystemExit(f'{name}: no animation {member} in the archive')
|
||||
lo = members[member][0]
|
||||
curves = anim_keys(blarc, lo, 'N_Map_00', b'FLPA', 0)
|
||||
keys = [key for curve in curves for key in curve]
|
||||
values = tuple(round(struct.unpack_from('<f', blarc, key + 4)[0], 3) for key in keys)
|
||||
if values != shipped: raise SystemExit(f'{name} N_Map_00 x: keys {values}, expected {shipped}')
|
||||
for key in keys: struct.pack_into('<f', blarc, key + 4, struct.unpack_from('<f', blarc, key + 4)[0] + shift)
|
||||
changed.add(member)
|
||||
|
||||
def tall_anim(blarc, members, k, changed):
|
||||
"""The animation keys that hold positions or zooms on the screen's height, for a canvas narrower than 16:9."""
|
||||
h = 540 * (1 / k - 1)
|
||||
@@ -221,6 +315,13 @@ def tall_anim(blarc, members, k, changed):
|
||||
abs(get(k1 + 4) + 360) < 1e-3 and get(k1 + 8) == 0):
|
||||
raise SystemExit(f'AppMap_00_MiniMap {pane}: not a line from 0 to y -360')
|
||||
put(k0 + 8, -(360 + h)), put(k1 + 4, -(360 + h))
|
||||
# The full map's height keys hold 1080 (the minimap shrinks the panes), and they win over the layout's sizes
|
||||
found = 0
|
||||
for pane in MAP_TALL:
|
||||
for keys in anim_keys(blarc, lo, pane, b'FLPA', FLPA_SIZE_Y):
|
||||
for key in keys:
|
||||
if abs(get(key + 4) - 1080) < 1e-3: put(key + 4, 1080 / k); found += 1
|
||||
if found < len(MAP_TALL): raise SystemExit(f'AppMap_00_MiniMap: {found} height keys of 1080, expected at least {len(MAP_TALL)}')
|
||||
# The large place name of a discovery holds its height (285, then 260) in flat keys; they move to the top edge.
|
||||
curves = anim_keys(blarc, anim('Location_00_IsDiscovery'), 'N_Large_00', b'FLPA', FLPA_Y)
|
||||
values = [get(key + 4) for keys in curves for key in keys]
|
||||
@@ -317,4 +418,6 @@ def apply(blarc, members, width, height, hud_aspect=None):
|
||||
have = struct.unpack_from('<f', blarc, lo + offset)[0]
|
||||
if abs(have - shipped) >= 1e-4: raise SystemExit(f'{anim} +{offset}: {have}, expected {shipped}')
|
||||
struct.pack_into('<f', blarc, lo + offset, value); changed.add(member)
|
||||
wide_anim(blarc, members, k, changed)
|
||||
loading_anim(blarc, members, k, changed)
|
||||
return sorted(changed)
|
||||
+18
-10
@@ -219,16 +219,19 @@
|
||||
# gpu_index = 0
|
||||
# gpu_name = NVIDIA
|
||||
# Game resolution: the size the game draws its picture and interface in (1280x720 to 7680x4320). Above 1920x1080 the
|
||||
# game's texture heap and memory pool grow with it. Another shape than 16:9, such as 3440x1440 on a 21:9 monitor or
|
||||
# the Steam Deck's 1280x800 (16:10), gives the camera's view that shape and lays the HUD out for it. The installer
|
||||
# prepares the UI layout for fifteen sizes: 2560x1080, 3440x1440, 3840x1600, 5120x2160 (21:9), 3840x1080, 5120x1440
|
||||
# (32:9), 1280x800, 1680x1050, 1920x1200, 2560x1600 (16:10), 1920x1280, 2160x1440, 2256x1504, 2880x1920 and 3000x2000
|
||||
# (3:2). For any other size, or a source build that has not made the layout, the game draws the largest 16:9 size that
|
||||
# fits inside it (3440x1080 gives 1920x1080) and the present adds bars; build the layout with
|
||||
# tools/make_romfs_patches.py --aspect WxH to use the full shape. Read at start. Default: 1920x1080, or on a primary
|
||||
# display of one of those shapes the smallest of its sizes at least 1080 high that fits the display (1920x1280 on a 3:2
|
||||
# laptop, 2560x1080 on a 21:9 monitor), so the picture fills the screen without black bars, with prompts = xbox or pc
|
||||
# too (on an install by an older setup, which built the Xbox prompts for 16:9 only, prompts = xbox keeps 1920x1080).
|
||||
# game's texture heap and memory pool grow with it. Another shape than 16:9, such as 3440x1440 on a 21:9 monitor or the
|
||||
# Steam Deck's 1280x800 (16:10), gives the camera's view that shape and lays the HUD out for it. Any shape from 4:3 to
|
||||
# 32:9 works: 21:9 monitors (2560x1080, 3440x1440, 3840x1600, 5120x2160), 32:9 ones (3840x1080, 5120x1440, 7680x2160;
|
||||
# hud_width below keeps the HUD in the middle), 16:10 and 3:2 screens, 4:3 (1440x1080, 2048x1536 on an iPad) and phone
|
||||
# screens streamed to (2340x1080 or 3120x1440 at 19.5:9, 2400x1080 at 20:9). The installer makes the UI layout for the
|
||||
# shapes of the connected displays and of this setting; at a shape it has none for, the game draws the largest 16:9 size
|
||||
# that fits inside it with bars and makes the layout in the background for the next start (a source build: make it with
|
||||
# tools/make_romfs_patches.py --aspect WxH). A shape narrower than 16:9 keeps the width of the 16:9 view and shows more
|
||||
# above and below (vert_plus). Portrait shapes and shapes outside 4:3..32:9 draw 16:9 with bars. Read at start. Default:
|
||||
# 1920x1080, or on a primary display of 21:9, 32:9, 16:10, 3:2 or 4:3 the smallest size of that shape at least 1080 high
|
||||
# that fits the display (1920x1280 on a 3:2 laptop, 2560x1080 on a 21:9 monitor), so the picture fills the screen
|
||||
# without black bars, with prompts = xbox or pc too (on an install by an older setup, which built the Xbox prompts for
|
||||
# 16:9 only, prompts = xbox keeps 1920x1080).
|
||||
# output_res = 1920x1080
|
||||
# HUD width on a game resolution wider than 16:9: full, the default, puts the HUD at the screen's left and right edges;
|
||||
# 21:9 keeps it within the middle 21:9 of the screen and 16:9 within the middle 16:9 (the game's own HUD), so the
|
||||
@@ -263,6 +266,11 @@
|
||||
# Field of view, in percent of the game's own: 70 to 140, 100 (the default) leaves the camera as it is. Higher shows
|
||||
# more of the world around Link. Game versions 1.1.0, 1.2.1 and 1.4.3. Changes while the game runs take effect at once.
|
||||
# fov = 100
|
||||
# Vert+ at a game resolution narrower than 16:9 (16:10, 3:2, 4:3): 1, the default, widens the camera's vertical view
|
||||
# so the picture shows as much of the world at the sides as 16:9 does, and more above and below. 0: the game's own
|
||||
# vertical view at every shape, so a narrower shape shows less at the sides. Multiplies with fov. Changes while the
|
||||
# game runs take effect at once.
|
||||
# vert_plus = 1
|
||||
# Anisotropic filtering of surface textures: game (the level the game asks for, as on the Switch) or 2, 4, 8, 16. Keeps
|
||||
# ground, roads and walls seen at a shallow angle sharp into the distance. Only filtered, mipmapped textures that tile
|
||||
# are raised; shadow maps, data maps and screen-sized buffers keep the game's setting. Read at start.
|
||||
|
||||
Reference in new issue
Block a user