HLE: implement XPackage monitor update, user locale, and mount path size #2135

Closed
fuzeofficlal wants to merge 1 commit from upstream-pr/2137 into main
fuzeofficlal commented 2026-11-25 05:50:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T05:50:20Z.


Summary

  • Wire XPackage vtable slots 0x40, 0x58, and 0xc0 in crates/victory-hle/src/modules/xpackage.rs to match main's completed single-package installation model:
    • 0x40 (XPackageUpdateInstallationMonitor): Return false (no installation progress change on a completed installation) instead of falling into missing::<8>, whose E_NOTIMPL (0x8000_4001) sets AL = 1 (true) on a bool-returning x64 ABI.
    • 0x58 (XPackageGetUserLocale): Query the host user's default BCP-47 locale via Win32 GetUserDefaultLocaleName (LOCALE_NAME_MAX_LENGTH = 85, falling back to "en-US" only if empty or non-Windows), reject null buffers with E_INVALIDARG, and write UTF-8 + NUL via put_string (E_NOT_SUFFICIENT_BUFFER when size is too small), per Microsoft Learn's XPackageGetUserLocale specification.
    • 0xc0 (XPackageGetMountPathSize): Zero non-null size and return E_INVALIDARG consistently with mount_path (0xc8), since no content package mount handles exist.

Verification

  • modules::xpackage::tests::monitor_update_user_locale_and_mount_path_size: verifies 0x40 returns false, 0x58 matches the host's GetUserDefaultLocaleName and enforces buffer bounds, and 0xc0 agrees with 0xc8.
  • cargo test -p victory-hle --locked, cargo clippy -p victory-hle --tests --locked -- -D warnings, and cargo xtask policy: passed.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6598156119 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2137). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T05:50:20Z. --- ### Summary - Wire `XPackage` vtable slots `0x40`, `0x58`, and `0xc0` in `crates/victory-hle/src/modules/xpackage.rs` to match `main`'s completed single-package installation model: - **`0x40` (`XPackageUpdateInstallationMonitor`)**: Return `false` (no installation progress change on a completed installation) instead of falling into `missing::<8>`, whose `E_NOTIMPL` (`0x8000_4001`) sets `AL = 1` (`true`) on a `bool`-returning x64 ABI. - **`0x58` (`XPackageGetUserLocale`)**: Query the host user's default BCP-47 locale via Win32 `GetUserDefaultLocaleName` (`LOCALE_NAME_MAX_LENGTH` = `85`, falling back to `"en-US"` only if empty or non-Windows), reject null buffers with `E_INVALIDARG`, and write UTF-8 + NUL via `put_string` (`E_NOT_SUFFICIENT_BUFFER` when `size` is too small), per Microsoft Learn's `XPackageGetUserLocale` specification. - **`0xc0` (`XPackageGetMountPathSize`)**: Zero non-null `size` and return `E_INVALIDARG` consistently with `mount_path` (`0xc8`), since no content package mount handles exist. ### Verification - `modules::xpackage::tests::monitor_update_user_locale_and_mount_path_size`: verifies `0x40` returns `false`, `0x58` matches the host's `GetUserDefaultLocaleName` and enforces buffer bounds, and `0xc0` agrees with `0xc8`. - `cargo test -p victory-hle --locked`, `cargo clippy -p victory-hle --tests --locked -- -D warnings`, and `cargo xtask policy`: passed.
DenRakEiw commented 2026-11-25 07:02:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T06:02:50Z.

Review: APPROVED


Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-hle --lib xpackage:: — 3 passed, 0 failed (including monitor_update_user_locale_and_mount_path_size)
  • cargo clippy -p victory-hle --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean implementation of XPackage monitor update, user locale, and mount path size with unit tests. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6052603937 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2137#pullrequestreview-6052603937). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T06:02:50Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test -p victory-hle --lib xpackage::` — 3 passed, 0 failed (including `monitor_update_user_locale_and_mount_path_size`) - `cargo clippy -p victory-hle --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean implementation of `XPackage` monitor update, user locale, and mount path size with unit tests. Looks good. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 07:02:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T06:33:03Z.

Review: COMMENTED


Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.

XPackage monitor update, user locale, mouse — HLE API surface expansion; locale handling is a common conformance gap, good addition.

<!-- greyfinch-sync:Marvisak/VIctory:review:6052888535 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2137#pullrequestreview-6052888535). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T06:33:03Z. **Review:** COMMENTED --- Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff. XPackage monitor update, user locale, mouse — HLE API surface expansion; locale handling is a common conformance gap, good addition.
Marvisak commented 2026-11-25 11:05:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:51:07Z.


Automated triage for the maintainers.

Needs work.

The new head e4b9e2e fixes the doc comment: mount_path has its own comment again, and mount_path_size has a separate one. The 0x40 update_monitor → false and 0xc0 mount_path_size (zero size, E_INVALIDARG, same as mount_path) changes look reasonable. CI: passing (check).

Two things still block this:

  • No evidence the slots are called. In your reply you say the change comes from auditing the vtable, not from a runtime method not implemented warning in a title run. For runtime return values we need some sign that the title reaches 0x40, 0x58 or 0xc0, such as a log line from a run.
  • 0x58 locale. user_locale now returns the host's raw GetUserDefaultLocaleName. As I read the public reference, the call returns the user's locale matched against the languages the package declares, not the system's raw tag. A host tag like de-AT, en-150 or sr-Latn-RS may not be a language the title ships. If the title takes the result as a resource language, it could miss its own assets. Please cite the docs that say how the call behaves, and match against the package's languages (the manifest is already parsed in runtime::Title::from_manifest), or explain why the raw host tag is right. The new test compares the result with GetUserDefaultLocaleName again, so it only checks that the code does what it does.

On your reply: the doc-comment fix is done. The locale change swaps one unverified value for another and does not yet answer the evidence question. If the locale slot is dropped or backed as above, and you show the title calls these slots, this could become a merge candidate.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7160257606 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2137#issuecomment-7160257606). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T10:51:07Z. --- <!-- victory-triage v1 head=e4b9e2e7da75fac82e4f5ae3af8b99305bb36df3 verdict=needs-work at=2026-11-25T11:23:54Z --> Automated triage for the maintainers. **Needs work.** The new head `e4b9e2e` fixes the doc comment: `mount_path` has its own comment again, and `mount_path_size` has a separate one. The 0x40 `update_monitor` → `false` and 0xc0 `mount_path_size` (zero `size`, `E_INVALIDARG`, same as `mount_path`) changes look reasonable. CI: passing (`check`). Two things still block this: - **No evidence the slots are called.** In your reply you say the change comes from auditing the vtable, not from a `runtime method not implemented` warning in a title run. For runtime return values we need some sign that the title reaches 0x40, 0x58 or 0xc0, such as a log line from a run. - **0x58 locale.** `user_locale` now returns the host's raw `GetUserDefaultLocaleName`. As I read the public reference, the call returns the user's locale matched against the languages the package declares, not the system's raw tag. A host tag like `de-AT`, `en-150` or `sr-Latn-RS` may not be a language the title ships. If the title takes the result as a resource language, it could miss its own assets. Please cite the docs that say how the call behaves, and match against the package's languages (the manifest is already parsed in `runtime::Title::from_manifest`), or explain why the raw host tag is right. The new test compares the result with `GetUserDefaultLocaleName` again, so it only checks that the code does what it does. On your reply: the doc-comment fix is done. The locale change swaps one unverified value for another and does not yet answer the evidence question. If the locale slot is dropped or backed as above, and you show the title calls these slots, this could become a merge candidate. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-25 12:03:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T11:10:02Z.


Updated in e4b9e2e7 per triage feedback:

  • 0x58 (user_locale): Replaced the hard-coded "en-US" literal with GetUserDefaultLocaleName (LOCALE_NAME_MAX_LENGTH = 85 UTF-16 code units converted to UTF-8, falling back to "en-US" only if the host returns empty or on non-Windows), matching the public XPackageGetUserLocale specification (which resolves to the current user's BCP-47 locale when no package locale list restricts it).
  • Doc comments: Restored mount_path's original doc comment directly above mount_path (0xc8) and added a dedicated doc comment on mount_path_size (0xc0), which mirrors mount_path (0xc8) on main.
  • Note on call evidence: this PR was motivated by auditing VTABLE slots in xpackage.rs whose return type is bool (0x40 XPackageUpdateInstallationMonitor, where missing::<8> returns 0x8000_4001 with AL = 1 == true) alongside the paired synchronous helpers (0x58, 0xc0) of main's already-wired create_monitor (0x28) and mount_path (0xc8), rather than a runtime method not implemented log from a title run.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7160682107 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2137#issuecomment-7160682107). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T11:10:02Z. --- Updated in `e4b9e2e7` per triage feedback: - **`0x58` (`user_locale`)**: Replaced the hard-coded `"en-US"` literal with `GetUserDefaultLocaleName` (`LOCALE_NAME_MAX_LENGTH` = `85` UTF-16 code units converted to UTF-8, falling back to `"en-US"` only if the host returns empty or on non-Windows), matching the public `XPackageGetUserLocale` specification (which resolves to the current user's BCP-47 locale when no package locale list restricts it). - **Doc comments**: Restored `mount_path`'s original doc comment directly above `mount_path` (`0xc8`) and added a dedicated doc comment on `mount_path_size` (`0xc0`), which mirrors `mount_path` (`0xc8`) on `main`. - Note on call evidence: this PR was motivated by auditing `VTABLE` slots in `xpackage.rs` whose return type is `bool` (`0x40` `XPackageUpdateInstallationMonitor`, where `missing::<8>` returns `0x8000_4001` with `AL = 1 == true`) alongside the paired synchronous helpers (`0x58`, `0xc0`) of `main`'s already-wired `create_monitor` (`0x28`) and `mount_path` (`0xc8`), rather than a `runtime method not implemented` log from a title run.
upstream-sync closed this pull request 2026-11-25 18:01:46 +00:00
fuzeofficlal commented 2026-11-25 18:02:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T17:20:24Z.


Closing this PR: as noted in triage, implementing XPackage slots 0x40/0x58/0xc0 without title call-site logs is premature.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7169360553 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2137#issuecomment-7169360553). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T17:20:24Z. --- Closing this PR: as noted in triage, implementing `XPackage` slots `0x40`/`0x58`/`0xc0` without title call-site logs is premature.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!2135
No description provided.