Skip to content

Read tune data in any unit system; add optional Simplified Chinese UI - #242

Closed
KCTT-a11y wants to merge 1 commit into
Views2k:mainfrom
KCTT-a11y:Wisp-zh-cn
Closed

KCTT-a11y wants to merge 1 commit into
Views2k:mainfrom
KCTT-a11y:Wisp-zh-cn

Conversation

@KCTT-a11y

@KCTT-a11y KCTT-a11y commented Dec 4, 2026 •

Copy link
Copy Markdown

Purpose

Read current-car tune data in any unit system. The Tune page used to require Forza to be set to imperial units; with metric units, or with the game's "Default" unit option, it could not read the car. This change also adds an optional Simplified Chinese UI that keeps English as the default and the source language.

What this fixes

  • The Tune page now reads the current car with Forza set to metric units (bar/kPa, N/mm, kgf/mm, cm, mm, kgf).
  • It now reads with Forza's "Default" unit option; that case used to stop with "not ready".
  • One unusable unit conversion no longer blanks the whole page: only the affected values are marked unsupported.
  • An unmapped unit still shows its value; only the unit label is missing.
  • Adds an optional Simplified Chinese interface. English remains the default and the source language, and switching back restores the original text.

Root cause and solution

Tune reading had three separate problems:

  • TuneDecoder only mapped the imperial unit IDs (psi 41, lb/in 54, in 14, lb 60), so every metric unit became UnsupportedUnit.
  • An unmapped unit ID was treated as a failure even though the game reports its own conversion factor.
  • One unusable conversion (missing factor, or a conversion that runs through a game callback) failed the whole capture with InvalidConversion, hiding every value that did read.
  • On the Store build 3.483.970.0 with units "Default", the reader stopped at UnitProfile because the active locale-profile index is 10 and the reader only accepted 0–7.

Fix:

  • TuneDecoder.TryUnitDefinition now also maps bar 40, kPa 42, N/mm 55, kgf/mm 56, cm 15, mm 16 and kgf 61.
  • ResolveUnit(quantity, unitId, factor) identifies an unknown scale unit by comparing the game's own conversion factor with the anchors captured in the shipped fixtures (psi 1, 39.37007141113281 m→in, 2.2046000957489014 kg→lb, tolerance 1e-3). If that fails, the value still reads and only the label is dropped (TuneUnit.GameDefined).
  • Identity quantities (angle 47, percentage 1, number 0) still require their exact ID.
  • Conversion problems became per-field: only the affected quantity reports UnsupportedConversion, and InvalidConversion is reserved for an ID outside the game's 0–127 table.
  • NativeTuneCapture accepts locale-profile indices 0–63 and falls back to the imperial row when the profile's preference is not a table row.
  • TunePresentation.CaptureStatus lists unit IDs it could not name.

The language layer is presentation only: English strings, settings keys, logs and protocol values are unchanged. A dictionary is embedded as a resource and applied at runtime, with three entry points (Wisp mark in the title bar, Appearance → UNITS / Readouts → Language, Ctrl+Shift+L). The choice is stored in settings and re-applied at startup; switching back restores the original English. Pages that are realised on demand are re-translated when their selector changes, and cached-but-detached pages are reached through a weak registry.

Validation

  • dotnet test tests/Wisp.Core.Tests --filter TuneDecoderTests → 37 passed, 0 failed.

  • dotnet test tests/Wisp.App.Tests --filter Tune → 432 passed, 0 failed.

  • Built Release x64 (self-contained single file) and exercised the UI on Windows 11: English default, switch to Chinese, navigate every page and back, switch to English, restart and confirm the saved choice.

  • The change is within the approved scope.

  • The change improves usability, functionality, feel, reliability, or maintenance, or fixes a verified bug.

  • I have read and agree to the contributor-rights terms in CONTRIBUTING.md.

  • Regression coverage has been added or updated where appropriate.

  • Steam and Xbox app / Microsoft Store impacts, checks, and outstanding gaps are recorded separately as required by docs/VALIDATION.md.

  • The complete Release test suite passes.

  • No credentials, personal data, machine paths, game binaries, save data, private captures, or generated output are included, except matching shader bytecode for an approved shader change described in docs/SHADERS.md.

  • User-facing changes are recorded in CHANGELOG.md.

  • Native HUD assets are unchanged, or their distribution rights, provenance, and hashes are documented.

Outstanding validation

  • Only the Tune-focused test filters were run; the complete Release suite was not executed for this branch.
  • The UnitProfile observation comes from a single Microsoft Store build (3.483.970.0). The Steam path was not re-checked against a metric or "Default" unit setting.
  • Metric unit IDs other than spring rate 56 (kgf/mm, factor 0.1019716) come from the FH6 tune unit table rather than a captured sample; a capture would confirm them.
  • Only spring rate lacks a captured imperial anchor, so an unmapped spring ID reads its value without a unit label.
  • The localization dictionary covers the 2.7.8 UI; a few dynamically composed strings may still fall back to English.
  • No CHANGELOG.md entry was added; I left release-note wording to the maintainer.

Add Simplified Chinese UI with runtime language switch; read tune data in metric and Default units
@KCTT-a11y
KCTT-a11y requested a review from Views2k as a code owner December 4, 2026 13:43
@Views2k

Views2k commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

Thanks for the time you put into this. I'm closing it because it doesn't follow CONTRIBUTING.md.

In #235 I approved a draft PR for Simplified Chinese UI support, linked to that issue, with source changes only. This PR is not a draft, doesn't reference the issue, and adds two things that were never approved: a rewrite of the tune unit reader and a second installer script. The scope and contributor-rights boxes in the checklist are unchecked, the full Release test suite wasn't run (three existing tests fail with these changes), and there is no CHANGELOG entry.

The tune changes loosen checks that are meant to fail closed: the profile index bound goes from 8 to 64 based on one observation, an unreadable preference now falls back to imperial, and unit IDs 40, 42, 55, 15, 16 and 61 are mapped from a table instead of captures. I would need a captured fixture for each unit before considering it. The new units also never get a label in the UI, because TunePresentation.Unit() wasn't updated.

  • installer/Wisp-zh-CN.iss can't go in. It reuses the official AppId and mutex, and the license doesn't allow separately distributed builds. The translation has to ship in the official installer.

Additionally:

  • Tooltips break in English. The localizer keeps one source string per element, so any control with both a label and a tooltip ends up with the label as its tooltip once the window loads. The "Display mode" button's tooltip becomes "Display mode ↗".
  • Text on tabs that aren't visible can be reset to an older value when you change tabs or a list selection, because ApplyTracked writes the remembered source back.
  • Switching back to English doesn't always restore the original text. 54 Chinese values map to more than one English key (Close/Dismiss, Dashboard/DASHBOARD), and the reverse map takes the first one.
  • It translates user data. A profile named "Drift" shows as "漂移".
  • All of this runs for English users too. The dictionary loads at startup and every tab or list selection change walks the whole window. It should do nothing until Chinese is selected.
  • Ctrl+Shift+L is handled before the hotkey capture buttons see it, so it can no longer be bound. Please drop the shortcut and the logo click and keep only the Appearance setting.
  • Changing HeaderBrand to a Button fails two existing header tests, and the new Language setting fails HudProfileCompletenessTests. The setting also needs normalization and persistence tests, per CONTRIBUTING.md.
  • A large part of the dictionary can't match anything at runtime. 465 keys contain C# interpolation source such as {DurationCoverage(group, ...)}. Please build it from text that is displayed, not from string literals in the source.

If you want to try again, please read CONTRIBUTING.md first and open a new draft PR that contains only the localization change and links #235. The tune reader change would need its own issue and approval before any code.

@Views2k Views2k closed this Dec 4, 2026
@KCTT-a11y

Copy link
Copy Markdown
Author

感谢你为这篇文章投入的时间。我要关闭它,因为它跟不上 CONTRIBUTING.md。

在#235中,我批准了一份与简体中文界面支持相关的草案,仅修改了源代码。这份PR不是草稿,没有提及这个问题,并且增加了两个从未获批准的内容:重写调音单元读取器和第二个安装脚本。检查列表中的范围和贡献者权限框未被选中,完整发布测试套件未运行(三个现有测试因这些更改失败),且没有 CHANGELOG 条目。

调整调整放宽了本应闭合时失败的检查:基于一个观察值,配置文件索引界限从8调整到64,无法读取的偏好现在回落为英制,单位编号40、42、55、15、16和61则从表映射而非捕获。在考虑之前,我需要为每个单元捕获一个灯具。新单位在界面里也从来没有标签,因为没有更新。TunePresentation.Unit()

  • installer/Wisp-zh-CN.iss不能进去。它重复使用官方 AppId 和互斥电路,且许可不允许单独分发版本。翻译必须随官方安装包一起发货。

此外:

  • 英文提示容易出问题。本地化器会为每个元素保留一个源字符串,因此任何同时带有标签和工具提示的控件,在窗口加载后都会以标签作为工具提示。“显示模式”按钮的工具提示变成了“显示模式↗”。
  • 在更改选项卡或列表选择时,不可见的选项卡上的文本可以被重置为较早的值,因为会写回记忆的源。ApplyTracked
  • 切换回英文并不总能恢复原文。54 个中文值对应到多个英文键(关闭/关闭、仪表盘/仪表盘),反向映射取第一个键。
  • 它翻译用户数据。一个名为“漂移”的配置文件显示为“漂移”。
  • 这些内容对英语用户同样适用。词典在启动时加载,每一次标签页或列表选择的更改都会在整个窗口中移动。在选中中文之前,它应该什么都不做。
  • Ctrl+Shift+L 在快捷键捕获按钮识别之前已操作,因此无法再绑定。请丢弃快捷方式,点击标志,只保留外观设置。
  • 切换为按钮会在两个现有头部测试中失败,新设置也失败。根据 CONTRIBUTING.md,该设置还需要进行归一化和持久化测试。HeaderBrand``Language``HudProfileCompletenessTests
  • 字典中很大一部分无法在运行时匹配任何内容。465个键包含C#插值源,例如。请根据显示的文本构建,而不是源代码中的字符串字面值。{DurationCoverage(group, ...)}

如果你想重试,请先阅读 CONTRIBUTING.md,打开一个只包含本地化更改和链接#235的新草稿PR。调音阅读器的更改需要单独发布并获得批准,然后才会有任何代码。

@KCTT-a11y

Copy link
Copy Markdown
Author

Thanks for the detailed review — agreed on all points. I'll leave this PR closed and open a new draft PR from latest main with only the localization change, linked to #235, with the checklist completed, a CHANGELOG entry, and the full Release suite run. I'll drop the tune reader rewrite and the separate installer; the tune unit work will be proposed separately with captured fixtures. I'll also address the tooltip/source tracking, reverse-map, user-data, English no-op, hotkey, HeaderBrand, and dictionary issues you listed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants