Repository navigation
Conversation
…amcjr#539) & v0.4.11-beta sync
mamcjr
left a comment
There was a problem hiding this comment.
Thanks for tracking down the #539 band. The cause makes sense: the readers of getFovy() disagree with mMatrix. But writing mAngle brings back the problem #474 avoided on purpose. Main's widescreen.c says "Leave stored fovy/mAngle (p[2]) untouched so game zoom/paraglider/cutscene blends reading fovy cannot creep".
FOV creep. Main's test did a 60-frame lerp that reads the current proj[fvi] back (cur = lerp_p[fvi]; next = cur + (target - cur) * 0.12). This PR replaces it with a lerp that keeps the value on the host (expected), so it never feeds the scaled getFovy() back. Only the exact passthrough setFovy(getFovy()) stays idempotent, through the exact p[2] == scaled_fovy match in vert_scaled_match. Any game code that does setFovy(lerp(getFovy(), target, k)) (a camera blend, the scope, the paraglider, a cutscene) writes a value near the scaled one but not equal to it. rt_persp_update then takes it as a new original and scales it again, so it climbs toward the 2.95 rad clamp.
Could you do one of these?
- (a) Restore main's self-referential lerp test and make it pass.
- (b) Show with
LARECOMP_LOG_ASPECTor a setFovy hook that no 1.8.2/1.9.0 caller blends fromgetFovy()(scope, paraglider, Sheikah Slate camera, cutscenes, horse). - (c) Keep
mAngleand fix the readers instead. The PR lists four call sites; patch them, or hookgetFovythere.
Also, the matching is getting hard to reason about: three aspect fields, two caches, exact-float signature matches on (near, far, scaled_fovy), and a getter (rt_persp_aspect) that now changes state on a read. Option (c) would also let most of that go. On the POCO's 20:9 none of this runs, so I'll test it with LARECOMP_WIDE_TEST=0.9: scope in/out, paraglider, a cutscene, horse, comparing the FOV with LARECOMP_LOG_ASPECT=1.
213c521 to
d27739c
Compare
|
Rebased cleanly onto 1. Option (c) check on BOTW
|
|
Thanks for the work on this. It still writes The disassembly covers direct callers only: one of them is exactly a getFovy-then-setFovy copy from one projection to another (0x7000eefe68 -> 0x7000eefe70), and it can't rule out virtual +0x30 calls, inlined |
d27739c to
473ff8a
Compare
|
Reworked PR #543 (
|
|
Thanks, this version is much better: mAngle isn't written any more, main's lerp test is back unchanged, and the hook at Two things before merging:
Minor: After that I'll run it here with |
473ff8a to
6bccdbf
Compare
|
Rebased onto
Verified on
|
…cjr#586 updates, PR mamcjr#582 close, SM-X730 restore [skip ci]
Summary
Fixes #539 per review Option (c): instead of writing the narrowed Vert+
fovyback tomAngle(+0xA0), leave storedmAngleuntouched (preserving zero FOV creep in self-referential camera blends) and substitute the effective2 * atan(mFovyTan)at the view-frustum builder's virtualgetFovy()read in BOTW1.9.0.Changes
runtime/hle/widescreen.c: Record the livesead::PerspectiveProjectionvtable pointer inrt_persp_update()(cleared inwidescreen_reset()) and addrt_persp_fovy(proj, orig_s0), returning the reshaped Vert+fovymatchingmFovyTan(or computing it fromshapebefore the first matrix build) only for verifiedPerspectiveProjectioninstances under active narrow Vert+ rendering. Non-PerspectiveProjectionsubclasses (e.g.OrthoProjection),1:1shadow/reflection cameras,Hor-(LARECOMP_NARROW_HOR_MINUS=1),16:9(Original), and ultrawide (> 16:9) pass throughorig_s0unchanged.runtime/native.c&tools/patches.py: Hook0x7000f90da4(fmov s10, s0, immediately after the virtualgetFovy()call at0x7000f90d98insidef_7000f90cf4, called for shadow cascades and main culling) inPATCHES_190and Nativefixes[]. Both recompiledbotwgame.soandNativemode use the samert_persp_fovy(x0, s0)helper.tools/test_fullscreen_narrow.py: Keepsupstream/main's self-referential lerp creep test intact and adds unit tests + afovynegative control covering16:10,4:3, clamp consistency,g_persp_vtable/ subclass isolation,1:1cameras,Hor-,Original, and ultrawide.1.8.2 Scope Note
I only have BOTW
1.9.0(cd57b23fa4bbad65803d9788c01821ee) locally, soPATCHES_182/ Native182is left untouched rather than guessing an unverified1.8.2address. To port the frustum hook to1.8.2, run:Verification (commit
473ff8a, rebased ontoupstream/main208746bb)tools/test_fullscreen_narrow.py --wsl):PASS(including--wide-testacross-0.5..infand all11/11--negative-controlvariants includingfovy).PATCHES_190[0x7000f90da4]verified against BOTW1.9.0main(exact word0x1e20400a); NDK Clang-Wall -Wextra -Werrorclean.SM-X730, Mali-G925, BOTW1.9.0, isolated scratch):upstream/mainunlocked2560x1600):frame_01260upper bandtop_10_30 = 105.78(shadow clipping visible).f_7000f90cf4alone vs4othergetFovy/+0x12f0candidates:130.73(fixed), while the other 4 candidates individually stayed102.36–111.70.Vert+16:10(aspect = unlocked):frame_01260top_10_30 = 130.50,[widescreen]logs confirmfovy 40.0 -> 44.0 deg (mAngle preserved)across pause/inventory/zoom transitions with zero creep.Hor-rollback (LARECOMP_NARROW_HOR_MINUS=1):131.07;16:9 Original(aspect = original):134.79(2560x1440).