Repository navigation
Ocarina: clothes and hair sway at real speed with FPS Unlock above 60 fps - #1793
Conversation
âĶ fps The cloth update builds its time step as scale * 1/60 at four sites, without the frame step, so above 60 fps clothes and hair sway too fast (about 1.4x at 86 fps, 2x at 120 fps). FPS Unlock now returns min(step / 60, 1/60) there; 60 fps and below keep the original value. Confirmed live: 0x2C2208C and 0x2AB804 run several times a frame, and restoring the original bytes at ~86 fps visibly sped cloth up again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
âĶ and cloth speed Ports zortos293/Lichii zortos293#1743 (movie frame count by the step), zortos293#1745 (Scarecrow's Song recording lengths) and open PR zortos293#1793 (cloth and hair sway at real speed above 60 fps). Routines that branch back into the game are marked fixed; the cloth leaf routines can move if a mod takes their cave. Docs carry the sound feed at 0x3C462E0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
âĶl speed with FPS Unlock above 60 fps
Port of zortos293/Lichii zortos293#1793 (cloth and hair at real speed under FPS Unlock), adapted to Fritchii's high refresh mode. The cloth update (clothes, hair, the wind action's phase) builds its time step as scale * 1/60 without the frame step, so above 60 fps every frame still simulates 1/60 s and cloth sways too fast (twice at 120 fps). The four 1/60 loads (main+0x14632C, 0x2AB804, 0x2C207A4, 0x2C2208C) each branch to their own stub (0x3C46830, 0x3C46890, 0x3C468F0, 0x3C46950) that returns min(step / 60, 1/60) in the high refresh mode (1/60 when not positive, so a step of 1 and more gives the game's constant exactly) and runs the game's own load in Dark's mode. Plain branches instead of bl (x30 untouched), x16/x17 saved. Credit: zortos293/Lichii PR zortos293#1793 (atk3001). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
âĶs293#1679 zortos293#1743 zortos293#1745 zortos293#1793 as 'High refresh fixes (built-in)') Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Changes
With FPS Unlock above 60 fps, clothes, hair and other cloth sway too fast in the wind: about 1.4x at
86 fps and 2x at 120 fps. At 60 fps they look right.
The cloth update (Havok cloth, entry
main+0x166A00) gets its time step asT[0x168] * T[0x1C0] * (1/60)(T = *[main+0x4E94B20], the game's timing table). Unlike the otherusers of that table, it never multiplies in the frame step at
T+0x10, so every frame simulates1/60 s however long the frame really was. Four sites load the
1/60before that multiply:main+)0x14632Cldr s0, [x8, #0x66c]0x1461000x2AB804fmov s0, w8(0x3C888889)0x2AA8200x2C207A4ldr s0, [x8, #0x66c]0x2C1FAB00x2C2208Cldr s2, [x8, #0x66c]0x2C1FAB0FPS Unlock (built-in)replaces each withblto a 48-byte routine at0x3C46B00(result ins0)or
0x3C46B30(ins2). It returnsmin(T+0x18, 1/60), whereT+0x18is the frame step / 60, or1/60 when the step is not positive. The comparison runs on the float bits, so at 60 fps and below the
value is the original constant bit for bit. The routines use only x16 and x17; the four functions
save x30 in their prologue. Both caves are guarded zero-filled executable padding after the Scarecrow
caves, and each hook checks its original word, so another build or a user mod skips all of FPS Unlock
as before.
Dynamic FPS by Dark (built-in)never lowers the step below 1.0 and is unchanged.Upstream check: nothing in
Djihads80/Eglantine,zortos293/Lichii(PRs, issues) or Hookshot'soot_patches.pytouches cloth or these sites, and no open PR uses the caves at0x3C46B00..0x3C46B5F.This appends to
FPS_UNLOCK_RECORDSlike the other FPS Unlock fixes.Testing
Windows 10, RTX 5080, Ryzen 7 9800X3D, MSVC 14.50.
[patch_manager],[addon_config]unit tests pass on this branch (380 assertions in 23 test cases). New checks: the four hooks and bothroutines with FPS Unlock, the game's words with Dynamic FPS, and a wrong original or a non-zero cave
skips all of FPS Unlock.
In game (Kakariko Village, FPS Unlock at about 83-86 fps, debug server and GDB stub):
T[0x168]andT[0x1C0]both 1.0. The originalcloth step is 0.0167 s; the patched one 0.0120-0.0126 s, the real frame time.
0x2C2208Cwas hit 22 times and0x2AB80418times, several times a frame.
0x14632Cand0x2C207A4did not run in that scene.original words back at the four sites, they visibly sway faster; with the patch written again they
are back to normal.
Not tested: scenes that use the other two sites, and 120 fps or above.
ðĪ Generated with Claude Code
Summary by CodeRabbit