Skip to content

support implement adjustable system clocks - #26

Closed
m1guelpf wants to merge 1 commit into
LNPANDY:mainfrom
m1guelpf:system-clock
Closed

m1guelpf wants to merge 1 commit into
LNPANDY:mainfrom
m1guelpf:system-clock

Conversation

@m1guelpf

@m1guelpf m1guelpf commented Oct 26, 2026 •

Copy link
Copy Markdown

this + #24 got Tomodachi Life: Living the Dream to boot

LNPANDY added a commit that referenced this pull request Oct 26, 2026
… (PR #26)

The adjustable user clock had no HLE entry, so a game that snapshots it read through the SDK's
time-service session (which the host never made) into a null. m1guelpf's fix also sets the
snapshot's type byte at 0xcd — 1 for the standard clock, 2 for the adjustable one — which is what
CalculateSpanBetween and the user-difference check read to decide the two clocks' relationship.

Verified rather than taken on faith:

- both mangled names decode exactly (`c++filt`: …CreateWithAdjustableSystemClock(nn::time::ClockSnapshot*),
  and the 29/31 class-name prefixes follow Itanium ABI)
- `h_time_Snapshot` is the handler the Standard entry already uses, so the new entry reuses the
  one snapshot-filling path instead of duplicating it
- the test's guard bytes prove the entry writes exactly 0xd0 bytes, the fixed-clock calendar is
  checked to the second, and a type change is confirmed not to read as a user clock change
- **one correction to the PR's test**: it set DM_FIXED_TIME after the first snapshot, but
  h_time_GetCurrentTime reads that variable once and caches it — the two assertions failed until
  the variable was set before any snapshot. 24 checks, 0 failed after the reorder.
- the host builds; the unit suite ends on the same pre-existing audio-device stall failure this
  machine already had (verified last hour by stashing)
@LNPANDY

LNPANDY commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Applied in 1f15ad6, with credit — and thank you for the test, which is the part that made this safe to take.

What I checked, since hand-written mangled names are exactly where a plausible-looking patch goes wrong:

  • Both symbols decode exactly. c++filt gives nn::time::ClockSnapshot::CreateWithAdjustableSystemClock(nn::time::ClockSnapshot*), and the 31 prefix matches the class name's length in Itanium ABI (the Standard entry's 29 follows the same rule).
  • h_time_Snapshot is the right reuse. It is the handler the Standard entry already installs, so your adjustable entry fills the snapshot through the one path that exists instead of duplicating the calendar/steady-clock/zone logic — that also means the two snapshots agree on the steady time source, which your own assertion checks.
  • The 0xcd type byte matters and you set it in both entries. The Standard one did not set it before; it was left at whatever memset produced. That is a real second half of the fix, not cosmetic.

One correction, in your test: it sets DM_FIXED_TIME after snap(a), but h_time_GetCurrentTime reads that variable once and caches the value — so the fixed-clock assertions ran against the real clock and two of them failed ("adjustable user time follows the host clock", "…UTC calendar for the fixed time"). Moving the setenv above the first snapshot fixes it; 24 checks, 0 failed. Everything else in the test is unchanged, including the guard bytes, which are a good idea I would not have thought to add.

Also confirmed hle_time.c is not a file this fork patches, so the entry survives the daily sync untouched.

If you have the title that needed this, naming it in the entry's comment (the way the neighbouring lines name STEINS;GATE RE:BOOT and Tears of the Kingdom) would make the next reader's job easier — say the word and I will add it, or send it as a follow-up.

@LNPANDY LNPANDY closed this Oct 26, 2026
LNPANDY added a commit that referenced this pull request Oct 27, 2026
v0lumehi's PR #27 turned the Mac front end into a launcher library (40 files), and m1guelpf's
#24/#26 fixed two HLE entries that games read through as nulls. Neither appeared anywhere in the
README, and the first thing a new visitor sees should include who built what beyond the
maintainer. Both names link their PRs so the work is one click away; the section ends by pointing
at Contributing, since a visible contributor list is also an invitation.
LNPANDY added a commit that referenced this pull request Oct 27, 2026
…ssue #29)

v0lumehi read the sync script while working on #27/#28 and found a real structural gap: a fix
merged here into a vendored file that is neither OURS nor PATCHED is silently reverted the next
time upstream touches that file. The concrete instance was PR #26 itself — hle_time.c and its test
carry the adjustable-clock entry, neither was protected, and seedds has no such function.

Both parts of the suggestion are taken:

- hle_time.c and t_time.c join OURS (with a comment saying why, and that they leave if upstream
  takes the PR). Found by the issue, verified by the code: neither file was in either list.
- A new pr-scope workflow fails a PR that edits a vendored file outside OURS/PATCHED and outside
  the fork-only paths (frontend/, frontend-qt/, .github/workflows/), with the at-risk list and the
  two ways out. It reads OURS and PATCHED from sync_upstream.py itself, so the check cannot drift
  from the lists it enforces.
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