mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 14:05:57 +00:00
Keep the 16:9 width of the view at shapes narrower than 16:9 (vert_plus) (#632)
The camera kept the game's vertical view angle at every shape, so 16:10, 3:2 and 4:3 showed less of the world at the sides than 16:9. res_fov_live now also multiplies the fov patch's factor by 2 atan(tan(v/2) k) / v, k = 16:9 over the aspect and v = 51.2 degrees, the game's default vertical angle measured from a 4:3 frame at fov 130 against 16:9 (scale 0.730). Measured after: 4:3 frames are 16:9 ones scaled by 0.752 (0.750 is exact), 16:10 by 1.000 (1.106 without). vert_plus = 0 keeps the game's vertical view; it multiplies with fov. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
13b4b0ca9b
commit
ce156ff76b
3 files changed
+44
-13
No files matched your search
+3
-2
@@ -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},
|
||||
|
||||
+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,
|
||||
|
||||
Reference in new issue
Block a user