Viewer: wear and primer window widths with the game's float arithmetic #381
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/holdmysocks--SixNG!381
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/381/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@holdmysocks on GitHub · 2026-11-26 17:10 UTC · original
holdmysocks:wear-window-widths→master· +19 −8 · 1 files · 1 commits · merged 2026-11-26 18:33 UTCThe viewer now computes the wear and primer window bytes with the game's float arithmetic, so its widths match the game's.
What the game does
byte * 0x3b808081in f32 (helper 0x44b6d0), the float nearest 1/255.trunc(255 * max(1e-4, end - start)).trunc(255 * f(byte)).Because of the f32 rounding, many widths come out one less than
end - start. Before, the viewer rounded the exact byte difference. For example, 27..43 gives 15 in the game and gave 16 in the viewer. On the rancher, 12 of the 31 presets it uses have at least one such window.Change
part_wear: preset bytes go through the game's 1/255 float. Window starts, widths, the primer window, the cross byte and the gradient window are truncated as the game does them.Check