Skip to content

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

Open
fuzeofficlal wants to merge 1 commit into
Marvisak:mainfrom
fuzeofficlal:feat/hle-xpackage-slots
Open

fuzeofficlal wants to merge 1 commit into
Marvisak:mainfrom
fuzeofficlal:feat/hle-xpackage-slots

Conversation

@fuzeofficlal

@fuzeofficlal fuzeofficlal commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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 DenRakEiw 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.

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 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

Wire the three unimplemented XPackage vtable slots around the completed single-package installation model:

- 0x40 (XPackageUpdateInstallationMonitor): return false instead of falling into missing::<8>, whose E_NOTIMPL (0x80004001) sets AL = 1 and looked like true on a bool-returning ABI.
- 0x58 (XPackageGetUserLocale): query the host user locale via Win32 GetUserDefaultLocaleName (LOCALE_NAME_MAX_LENGTH = 85, falling back to en-US if empty or non-Windows), reject null buffers with E_INVALIDARG, and write UTF-8 + NUL via put_string (returning E_NOT_SUFFICIENT_BUFFER when too small).
- 0xc0 (XPackageGetMountPathSize): restore mount_path's doc comment and add a dedicated doc comment for mount_path_size; zero any non-null size pointer and return E_INVALIDARG consistently with mount_path (0xc8), since no content package is mounted.
@fuzeofficlal
fuzeofficlal force-pushed the feat/hle-xpackage-slots branch from a027f64 to e4b9e2e Compare November 25, 2026 11:10
@fuzeofficlal

Copy link
Copy Markdown
Contributor Author

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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants