HLE: parse hex-prefixed TitleId in manifest and isolate self-closing element bodies #715

Closed
opened 2026-11-26 04:13:52 +00:00 by github-bot · 5 comments
Owner

@⁠Super-cod on GitHub · 2026-11-24 07:37 UTC · original

Problem

  1. Hex-prefixed TitleId: In Microsoft GDK manifests (MicrosoftGame.config), <TitleId> is specified as a hexadecimal number and is frequently formatted with a 0x or 0X prefix (e.g. <TitleId>0x639AA8DD</TitleId>), as documented in the Microsoft GDK specification and sample configs. In Title::from_manifest(), u32::from_str_radix(v, 16) is called directly on the extracted string. Because Rust's from_str_radix rejects 0x/0X prefixes with ParseIntError(InvalidDigit), any manifest using this format fails to parse, defaulting Title.id to 0. Consequently:

    • runtime::title().id reports 0 (00000000).
    • XGameGetTitleId returns 0.
    • Persistent storage and save paths fall back to data/00000000/saves/ instead of the title's real ID.
  2. Self-closing elements in elements(): When an element is self-closing (<tag ... />), elements() currently computes let body = rest[..rest.find('<').unwrap_or(rest.len())].trim() and attaches any text between the self-closing tag and the next tag as the body of the self-closing element. A self-closing tag has no body by definition; assigning subsequent text or whitespace to it corrupts element extraction.

Solution

  1. In Title::from_manifest, strip "0x" / "0X" prefixes from Game/TitleId before calling u32::from_str_radix(v, 16).
  2. In elements(), set body = String::new() when closed is true.
  3. Add regression unit tests in runtime::tests for hex-prefixed TitleId formats and self-closing element body isolation.
**@⁠Super-cod** on GitHub · 2026-11-24 07:37 UTC · [original](https://github.com/Marvisak/VIctory/issues/715) ## Problem 1. **Hex-prefixed `TitleId`**: In Microsoft GDK manifests (`MicrosoftGame.config`), `<TitleId>` is specified as a hexadecimal number and is frequently formatted with a `0x` or `0X` prefix (e.g. `<TitleId>0x639AA8DD</TitleId>`), as documented in the Microsoft GDK specification and sample configs. In `Title::from_manifest()`, `u32::from_str_radix(v, 16)` is called directly on the extracted string. Because Rust's `from_str_radix` rejects `0x`/`0X` prefixes with `ParseIntError(InvalidDigit)`, any manifest using this format fails to parse, defaulting `Title.id` to 0. Consequently: - `runtime::title().id` reports 0 (`00000000`). - `XGameGetTitleId` returns 0. - Persistent storage and save paths fall back to `data/00000000/saves/` instead of the title's real ID. 2. **Self-closing elements in `elements()`**: When an element is self-closing (`<tag ... />`), `elements()` currently computes `let body = rest[..rest.find('<').unwrap_or(rest.len())].trim()` and attaches any text between the self-closing tag and the next tag as the body of the self-closing element. A self-closing tag has no body by definition; assigning subsequent text or whitespace to it corrupts element extraction. ## Solution 1. In `Title::from_manifest`, strip `"0x"` / `"0X"` prefixes from `Game/TitleId` before calling `u32::from_str_radix(v, 16)`. 2. In `elements()`, set `body = String::new()` when `closed` is true. 3. Add regression unit tests in `runtime::tests` for hex-prefixed `TitleId` formats and self-closing element body isolation.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:52 +00:00
Author
Owner

@⁠cj5k9dnkfd-afk on GitHub · 2026-11-24 07:38 UTC · original

Hi anyone have the game Link

**@⁠cj5k9dnkfd-afk** on GitHub · 2026-11-24 07:38 UTC · [original](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7125208203) Hi anyone have the game Link
Author
Owner

@⁠Super-cod on GitHub · 2026-11-24 07:43 UTC · original

I have implemented the fix with regression tests on my fork: github.com/Super-cod/VIctory@5678a37
Branch: https://github.com/Super-cod/VIctory/tree/fix/manifest-title-id-hex-prefix
Fork PR: https://github.com/Super-cod/VIctory/pull/1

Summary of changes:

  • Stripped 0x / 0X hex prefix in Title::from_manifest() before parsing Game/TitleId so manifests using standard GDK hex notation don't fail parsing and default id to 0.
  • Ensured self-closing tags (<tag ... />) in
    untime::elements() get an empty body instead of capturing trailing sibling text.
  • Added regression tests in
    untime::tests.
**@⁠Super-cod** on GitHub · 2026-11-24 07:43 UTC · [original](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7125293054) I have implemented the fix with regression tests on my fork: https://github.com/Super-cod/VIctory/commit/5678a37 Branch: https://github.com/Super-cod/VIctory/tree/fix/manifest-title-id-hex-prefix Fork PR: https://github.com/Super-cod/VIctory/pull/1 Summary of changes: - Stripped 0x / 0X hex prefix in Title::from_manifest() before parsing Game/TitleId so manifests using standard GDK hex notation don't fail parsing and default id to 0. - Ensured self-closing tags (<tag ... />) in untime::elements() get an empty body instead of capturing trailing sibling text. - Added regression tests in untime::tests.
Author
Owner

@⁠LAKSHYA-cmd-tech on GitHub · 2026-11-24 07:50 UTC · original

Tested and verified commit 5678a37 on Windows 11 MSVC (Rust 1.98.1):

  • runtime::tests::parses_title_id_with_hex_prefixes passes cleanly for 0x, 0X, and bare hex formats.
  • runtime::tests::self_closing_elements_do_not_capture_trailing_text passes, ensuring self-closing tags assign empty bodies and do not consume subsequent sibling text.
  • Full victory-hle test suite (88 tests) passes.
  • Asset policy is 100% compliant (cargo xtask policy ok: 151 files).

Ready to be merged once upstream PR interactions open up.

**@⁠LAKSHYA-cmd-tech** on GitHub · 2026-11-24 07:50 UTC · [original](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7125432456) Tested and verified commit `5678a37` on Windows 11 MSVC (Rust 1.98.1): - `runtime::tests::parses_title_id_with_hex_prefixes` passes cleanly for `0x`, `0X`, and bare hex formats. - `runtime::tests::self_closing_elements_do_not_capture_trailing_text` passes, ensuring self-closing tags assign empty bodies and do not consume subsequent sibling text. - Full `victory-hle` test suite (88 tests) passes. - Asset policy is 100% compliant (`cargo xtask policy` ok: 151 files). Ready to be merged once upstream PR interactions open up.
Author
Owner

@⁠undeadhuman37 on GitHub · 2026-11-24 08:16 UTC · original

Hi, I'd like to contribute to VIctory. I have a tested fix for this issue (hex-prefixed TitleId, +1 test; 294 workspace tests pass, cargo xtask policy clean, no game data) on my fork: undeadhuman37/VIctory, branch fix-715-hex-titleid (commit e402d4b). PRs seem closed for outside contributors. Can I send it as a PR, or would you prefer to pull the branch? The fix was written with AI assistance (Claude Code) and tested locally.

**@⁠undeadhuman37** on GitHub · 2026-11-24 08:16 UTC · [original](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7125928664) Hi, I'd like to contribute to VIctory. I have a tested fix for this issue (hex-prefixed TitleId, +1 test; 294 workspace tests pass, `cargo xtask policy` clean, no game data) on my fork: undeadhuman37/VIctory, branch `fix-715-hex-titleid` (commit e402d4b). PRs seem closed for outside contributors. Can I send it as a PR, or would you prefer to pull the branch? The fix was written with AI assistance (Claude Code) and tested locally.
Author
Owner

@⁠LAKSHYA-cmd-tech on GitHub · 2026-11-24 08:28 UTC · original

Implemented and verified:

  1. Stripped \
**@⁠LAKSHYA-cmd-tech** on GitHub · 2026-11-24 08:28 UTC · [original](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7126184164) Implemented and verified: 1. Stripped \
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#715
No description provided.