Skip to content

mac: add Chinese/English switch and fix build on Intel Mac - #166

Open
s121091 wants to merge 279 commits into
nullmoth:mainfrom
s121091:mac-zh-i18n
Open

s121091 wants to merge 279 commits into
nullmoth:mainfrom
s121091:mac-zh-i18n

Conversation

@s121091

@s121091 s121091 commented Nov 12, 2026

Copy link
Copy Markdown

The Windows app and guide already have Chinese translations in Loc.cs and loc.py, but the Mac app and Driver settings window were still English-only.

This adds a 中文/EN toggle button in the title bar (and in settings.html) using the same English-key dictionary approach and saving the choice in localStorage. I also widened the right margin in TitleBar.swift from 80 to 120 so the new button isn't covered by TitleDragView, and fixed two build issues I hit on my Intel Hackintosh (an empty RUN[@] array with bash 3.2 set -u in mac/build.sh, and a slow string concatenation in ArmApps.swift).

Tested on my Hackintosh (x86_64, macOS 15.7.4, HD 630 + Radeon 6950XT) by running ./mac/build.sh, node mac/tools/test_update_ui.js, node mac/tools/test_usb_connector.js, and checking all tabs and the EFI check / Driver settings windows in 1401.app.

oops@MacPro 1401_- % ./mac/build.sh && node ./mac/tools/test_update_ui.js && node ./mac/tools/test_usb_connector.js && rm -rf mac/build
377 cases agree with the Python checker, 0 differ
ok   a click in the middle of the title bar drags the window
ok   the light/dark switch on the right of the bar still gets its click
ok   the window buttons' corner is left alone
ok   a click below the bar goes to the page
ok   after the window grows, the bar still drags it
ok   after the window grows, the switch still gets its click
ok   after the window grows, the page under the bar gets its clicks
0 failed
ok   a driver release package maps to the same version and file on the site
ok   a three-part version and a signature file keep their exact names
ok   SHA256SUMS.txt has a mirror
ok   another repository has no mirror
ok   another owner has no mirror
ok   another host has no mirror
ok   plain http has no mirror
ok   a path that climbs out has no mirror
ok   an extra path part has no mirror
ok   a non-version tag has no mirror
ok   a hidden file name has no mirror
ok   an encoded dot-dot has no mirror
mirror: all arms hold
ok   macOS 15 and 26 may install the driver
ok   macOS 14 may not install the driver
ok   setup mode install is refused on macOS 14
ok   setup mode tahoe is refused on macOS 14
ok   setup mode dry is refused on macOS 14
ok   macOS 27 may not install the driver
ok   setup mode install is refused on macOS 27
ok   setup mode tahoe is refused on macOS 27
ok   setup mode dry is refused on macOS 27
ok   macOS 28 may not install the driver
ok   setup mode install is refused on macOS 28
ok   setup mode tahoe is refused on macOS 28
ok   setup mode dry is refused on macOS 28
ok   setup mode install still runs on macOS 26
ok   setup mode tahoe still runs on macOS 26
ok   setup mode dry still runs on macOS 26
ok   setup mode remove (no driver install) is not refused on macOS 27
ok   setup mode usbmap (no driver install) is not refused on macOS 27
ok   setup mode verbose (no driver install) is not refused on macOS 27
ok   setup mode tahoecancel (no driver install) is not refused on macOS 27
ok   the refusal names the macOS this driver is for and the one this Mac runs, and offers nothing else
0 failed
  ok   the started call comes while the command is still running   [started 0.51s, ended 3.46s]
  ok   the command's output still comes back   [finished
]
  ok   a command that finishes at once calls started at most once   [calls=0]
  ok   no callback is fine
  ok   install runs the checked service script with the two files it installs
  ok   the files are passed as paths into the verified private copy, not the bundle
  ok   remove runs the same checked script with only the word remove after it
  ok   any other word is refused
  ok   a build with no hash for the script refuses to run it
  ok   status: installed and running
  ok   status: installed but stopped
  ok   status: not installed
  ok   status: noise reads as nothing installed
all ok
ok   the catalogue holds the 19 settings the command-line tool has
ok   all 878 vectors from the command-line tool give the same answer here
ok   enabling HDR adds one boot argument and keeps the others
ok   a boot line with shell characters is never rewritten
ok   a frame limit with shell characters is refused before any command exists
ok   a frame limit below 10 is refused
ok   a block holding a line an update would drop is not extended
ok   the command writes exactly the planned conf
ok   quotes, $( ) and backticks in the existing conf are written as text, never run
  ok   no temporary file is left beside the conf
ok   the frame limit reads back from the file
ok   a boot-args change goes through nvram, quoted
0 failed
ok   Gen4 x16 against a Gen4 x16 card is ok
ok   fewer lanes than the card supports is flagged
ok   a lower speed at full width is idle step-down, not a fault
ok   unreadable registers are unknown, never ok
ok   device ids map to generations
ok   only NVIDIA display-class devices are listed (not the AMD card, not the card's audio function)
ok   a card under a Thunderbolt port is external
ok   attached driver parts are read from the card's children
ok   the kext's BAR and Resizable BAR facts are carried
ok   a Gen5 x4 link on an x16 card reads LOW with the card's width
0 failed
  ok   valid limits become sustained:slow:fast:temperature
  ok   the edges are accepted
  ok   watts outside 5 to 65 are refused
  ok   sustained above slow, or slow above fast, is refused
  ok   a temperature outside 50 to 100 is refused
  ok   the page's missing numbers (-1) are refused
  ok   a picked plain .plist file is accepted
  ok   a partition id and auto are not config choices
  ok   a missing file, a non-plist, a folder and a relative path are refused
  ok   a path with a newline is refused
  ok   nothing installed reads as not installed whatever the setting file says
  ok   installed with gpuboost=1 reads as on
  ok   installed with gpuboost=0 reads as switched off
  ok   a setting the daemon does not accept is named, not called on
  ok   no setting file is said so
  ok   the program is read from the job's plist, wherever the package puts it
  ok   a relative program, an empty list and a non-plist give none
  ok   the setting and job files are the ones boost_daemon.sh uses
  ok   a path of root-owned, non-writable directories is trusted
  ok   a user-owned component is not trusted
  ok   a group-writable component is not trusted
  ok   a symbolic link on the way is not trusted
  ok   a missing component and a relative path are not trusted
  ok   an untrusted path reads as not usable, whatever the setting
  ok   the package that hashes to the pin is chosen, with the PIN as the sha
  ok   a planted file is skipped and the genuine one after it is chosen
  ok   when only a file that does not hash to the pin exists, nothing is chosen (hybrid, ryzenpower, GPU boost and the rest are refused)
  ok   a file is never judged by its own hash: whatever the hash is, if it is not the pin it is refused
  ok   an empty pin, an empty list and unreadable files choose nothing
  ok   the comparison ignores case
  ok   a list of known ids becomes setup's value, in the catalog's order
  ok   an empty list means none are on
  ok   an unknown id refuses the whole list
  ok   the HID route without the keyboard backlight is refused
  ok   a non-list and a list of non-strings are refused
  ok   repeats are folded
  ok   a shell-looking id is refused
  ok   the record's ON=
image image

NullMoth Systems added 30 commits October 30, 2026 11:09
Tiger Lake and newer Intel GPUs have no Apple driver. The build now says so per GPU: basic display at install, and
for the IDs WhateverXe covers, the Mac app's opt-in WhateverXe afterwards (untested beside the NVIDIA driver). The ID
list is the Mac app's, checked by test. Intel GPUs macOS already drives get no new notice. Notices only: no kext,
boot argument or config change.
AMDRadeonRDNA4 (RX4Darwin, BSD-3) was already offered behind the experimental-drivers switch but had no NOTICE row.
WhateverXe (BSD-3), fetched by the Mac app, now has its row in licenses.json.
A 403 on the chunklist now gets one fresh token like the image does, and a refused retry says what to change. A chunklist that is an HTML page is reported as the network's own page with its title. A connection that gave no byte records its status and headers in the STOP line.
The drive letter search falls back to F:, E: and D: and lists the letters in use when none is free. An offline stick says Windows' OfflineReason and how to bring it online. A drive that disappears for the whole EFI copy retry says the stick dropped off USB. A letter that never appears after diskpart carries the stick search's answer.
A build that stops on a UEFI driver missing on disk now says what the Drivers folder holds, so a report tells a binary-data download that never reached the build from one file a security program removed.
OpenCore's "Only N/256 slide values are usable" followed by a boot.efi stop at EB.MM.AKM now turns DevirtualiseMmio on (or, when it already ran, gives the BIOS checklist), the same as "No slide values are usable".
The runtime refusal now says which macOS this Mac runs. The unconfirmed startup partition stop prints OpenCore's boot-path and each candidate's partition identity on their own lines; the candidate lines the app offers as choices are unchanged.
Only an error naming the stick's root, with the root gone for the whole retry window, becomes the dropped-off-USB stop; per-file copy errors and other OS errors keep their own stops.
Which slide count makes DevirtualiseMmio the fix is not measured, so a boot with some slides left keeps its quirks, as before, and the user is told the BIOS memory checklist instead of nothing.
1401: do not erase the stick before Apple will serve the download; finish the Windows hardware map

Measured over the raw write logs users sent on 2026-10-31..11-02 (780 write logs of 16,620
uploads), not over the summarised digest, which truncates each line before its status code:

  HTTP 406 from oscdn        328 logs   323 of them AFTER "OK erased the stick"
  HTTP 405 from osrecovery    11 logs
  HTTP 503 / 502              16 logs   (already retried)
  HTTP 403                     5 logs   (already has a fresh-token path)
  HTTP 400                     2 logs
  HTTP 408                     1 log
  HTTP 416 on a resume         1 log    20 resumes over 15 minutes that could not succeed

333 of the 339 406/405 stops fell inside ONE UTC hour (2026-11-01 09:00-09:59), across six app
versions back to 1.10.0, with zero in the other 61 hours of the window. That is Apple's side
failing for an hour, not a per-network and not a per-version fault. What was ours:

- The chunklist was the download's first request and the download ran after the erase, so 323
  users lost whatever was on their stick to learn that Apple would not serve them. apple.preflight()
  now fetches and verifies the signed chunklist and samples 64 KiB of the image BEFORE the erase,
  and download() reuses those verified bytes instead of asking oscdn a second time. A refusal there
  stops with "your USB stick was not touched".
- 406, 405, 408, 425 and 429 were outside _transient, so each got one request with no back-off and
  no reroute. They are now retried like a 5xx; 406 also tries another edge through DNS-over-HTTPS,
  and 405/406 on osrecovery now take the existing HTTPS route that 400 and 403 already took.
- The stop for those statuses was a bare status and a raw CDN URL. It now says Apple answered that
  way to every try, that waiting is the thing to do, and that nothing was changed - and no longer
  claims the network "keeps cutting the connection", which a 406 is not.
- A 416 on a resume means the server's object ends before the byte we need while Apple's signed
  chunklist says the image is longer, so no retry can satisfy it. It refuses at once and says so.
- The readback stop now names the stick by model and claimed size (never its serial), and tells the
  two faults apart: of 32 readback stops, 16 had 1-19 of 85-92 parts different (a failing write,
  rewritten once, still wrong -> try another port) and 16 had 37-82 different (a stick reporting a
  size it does not have -> use a different stick). 27 of the 32 named a generic controller.
- The read-only refusal says what to do about a lock switch and what it means when there is none.

Windows hardware map, the counterpart of the Mac app's Sources/HardwareMap.swift, finished:

- HardwareMap.cs is wired into the check step as one call site, off the UI thread, writing
  hardware-map.txt beside Report.json so the identifiers travel with every report.
- Added the fields Windows can actually state and the map needed: pci_class (from the CC_ compatible
  ID - the field that says "this is an HD-audio controller"), audio_codec_vendor_device and
  audio_codec_revision (from HDAUDIO ids, the only place Windows names the codec itself),
  usb_class/subclass/protocol, usb_interface_number and hid_usage_page/hid_usage. Every one is a
  fixed-width hex capture from an anchored pattern, so the strict allow-list is unchanged.
- Each WMI object is now disposed, the enumeration is bounded by devices examined and not only by
  devices listed, a damaged WMI repository is reported as a devices_status line rather than thrown,
  and each device line is field-name sorted so two maps of one PC are the same text and can be diffed.
- hardware_map_parse_check.py: 9 arms -> 20, including two negative controls that must fire and two
  arms calibrated on identifiers from real reports. Its fixtures no longer carry a personal name or
  a private LAN address; they use RFC 5737 and IANA documentation values.

HardwareMap.cs is UNBUILT: there is no .NET toolchain on the machine it was written on. It was
reviewed line by line against net48 and C# 7.3 and its parse rules are proven by the Python mirror,
but it has never been compiled and never run against WMI.

Tests: 878 pass (859 before, plus 19 new in tests/test_apple_preflight_status.py), 5 skipped.
usbwriter --selftest 20/20. hardware_map_parse_check 20/20, and it fails when an anchor is removed.
1401: the resume give-up says what was observed instead of blaming the network, and stops being silent

The resume and readback paths already existed, so nothing was added on top of them. This answers the
narrower question: given that resume already runs, what do the give-up reports actually show? Read from
the RAW write logs of 10-31..11-02 (100 resume give-ups among 780 write logs), because the digest
truncates each stop line before the trail that carries the evidence.

  stalled-in-a-row at give-up        20 on ALL 100 (the RESUMES_WINDOWED cap)
  total resumes at give-up           20 on 87, then 21..60 (RESUMES_TOTAL is 400 and was never near)
  never printed a PROGRESS line      83 of 100
  span of the recorded connections   min 968 s, median 1084 s, max 3935 s
  the first full connection gave     exactly 1048576 B on 89 of 100
  the empty answers                  343 of them, EVERY one a well-formed HTTP 206 with
                                     Content-Length 524288 - the window 1401 asked for - and no body
  who answered                       Server nginx on 48 machines, dlb/1.0.2 on 1, Via absent on all 343
  versions                           2.6.6 x54, 2.6.5 x30, 2.6.4 x8, 2.6.2 x3, 2.5.4 x2, 2.0.4 x2, 2.5.5 x1

Three changes, each named by the number that drove it:

- The stop said "Something on this network cuts Apple's download: turn off web/HTTP scanning in your
  antivirus". The 343 empty answers were not cut: the server accepted the range, promised the exact
  length and sent nothing, and no proxy announced itself in a Via header. A scanner cutting a stream
  does not answer 206 and state a Content-Length first. The stop now reports what happened - how many
  connections, how many delivered nothing, how many minutes, what percent - offers the two possible
  causes without claiming which, and orders the three remedies cheapest first (antivirus, then hotspot
  or VPN, then wait an hour because Apple may be busy). Driven by: 343 empty answers, all 206 with
  Content-Length 524288, Via absent on all of them.

- Nothing was printed while this was happening. 83 of 100 give-ups never printed a PROGRESS line, and
  the recorded connections spanned a median of 1084 s, so for 16 to 65 minutes the window showed a bar
  at zero and no text. Each stalled connection now prints one line saying how many in a row have
  delivered nothing, at what percent, and how many are left before it stops. A healthy windowed
  download never reaches that path, so a working write cannot be spammed by it. Driven by: 83 of 100,
  median span 1084 s.

- No log, failed or successful, has ever recorded who answers a download that WORKS, which is the only
  reason "nginx" cannot be told from Apple's own edge. The first connection's Server, Via, X-Cache and
  X-Responding-Server are now logged once, deliberately without calling them Apple's. Driven by: 51 of
  the 100 recorded no headers at all, and the 49 that did had no baseline to be compared against.

Thresholds NOT changed, and this is the restraint the numbers demand: all 100 give-ups stopped at
exactly 20 stalled connections, but every one of those logs is a FAILURE, so they cannot show how often
20 would have recovered. The code's own history records a write that reached 8 MiB after 19 resumes,
which is why the limit is 20 and not 8. A negative-control arm now pins RESUMES, RESUMES_WINDOWED,
RESUMES_TOTAL and WINDOW_MAX_DELAY so a later change has to be argued for rather than drifted into.

Whether "nginx" is Apple's edge or an interposer is UNKNOWN and is left labelled as such in the code
and in the user-facing text.

Tests: 885 pass (878 before, plus 7 arms), 5 skipped. usbwriter --selftest 20/20. The give-up wording
had no test at all before this, which is why it could assert a cause for weeks without being noticed.
NullMoth Systems and others added 27 commits November 9, 2026 03:26
Send logs: carry WindowServer's watchdog samples (.spin), newest two under fixed names, first 512 KB

Issues 454, 527 and 410 each described a WindowServer watchdog sample that named what it waited on, and none reached
an upload because only .ips reports were collected. Test: tools/test_ws_watchdog_spin.py, with a control on the
previous collector.
Reached-desktop note: an NVRM state line on every macOS (started, cards claimed, model published, auto-go, boot hold)

170 first-login notes showed the card as 10DE:xxxx with no name and could not say whether NVRM never claimed the card,
was still holding the boot, or started and published nothing. The four registry facts that decide it now ride every
note. Test: three registry fixtures in tools/test_reached_desktop.py (compiled), and a source arm the previous file fails.
Mac setup: finds OpenCore in the folder its boot-path names (EFI/macos/OC), says when a start skipped OpenCore (PC model, no boot path) instead of no OpenCore config, and Send logs records what the macOS 26 update preparation left (#484)
Mac app: the setup log records the app's own read of each removable OpenCore config (ok, refused, or still waiting), so a Removable Volumes stop says whose read was refused
Stick diagnoser: PKDownloadError from the installer asks for the Installer Log and checks network and clock (1401 nullmoth#111)
Windows app: stick logs name the board and CPU the stick was built for, so hand-off freezes can be grouped per board
First-login report: says whether the NVIDIA accelerator offers its Metal plugin, splitting no-Metal reports into withheld and refused
# Conflicts:
#	mac/Sources/ReachedDesktop.swift
Builds: every desktop gets SMCSuperIO (fan speeds), not only Intel ones; AMD desktops had no fan readings. Laptops unchanged (embedded-controller fans)
Builds: VirtualSMC and its sensor plugins built from source (vendor/smcsuperio: pinned commits, patch, 0-warning build) replace the downloaded release, all or nothing; SMCSuperIO reads the ITE IT8696E/IT8698E and its ITE model checks are fixed
Experimental features: Idle link power saving (nvrmaspm=1), off by default
Experimental features: the keyboard backlight item says what a tester must also do (the kext goes into the EFI by hand) and that it has not run on a laptop
Mac app: the last two Swift warnings fixed (an unread list, a constant declared variable); every Swift compile in build.sh now stops on a warning
Experimental drivers: the builder places NullMoth's own EFI drivers that fit a PC (keyboard backlight on laptops, NVIDIA display sound with volume on macOS 15) in the EFI switched off; the Mac app switches each on or off there, copies one into an older EFI from the installed driver, and has Select all and Deselect all
Experimental drivers: a driver is copied into the EFI only from the installed package's root-owned folder (no link, nothing another user can write), with no environment override of that folder
Send logs: the reader of fixed-name system logs refuses a link (some of those names are in folders any account can write, and it runs as root)

@beaver383 beaver383 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

推荐此修改
建议拉取最新版本代码重新提交pr

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