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

Closed
opened 2026-11-24 07:37:00 +00:00 by Super-cod · 5 comments
Super-cod commented 2026-11-24 07:37:00 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by Super-cod on 2026-11-24T07:37:00Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6576967971 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/715). Originally posted by [Super-cod](https://github.com/Super-cod) on 2026-11-24T07:37:00Z. --- ## 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.
cj5k9dnkfd-afk commented 2026-11-24 08:02:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by cj5k9dnkfd-afk on 2026-11-24T07:38:22Z.


Hi anyone have the game Link

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125208203 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7125208203). Originally posted by [cj5k9dnkfd-afk](https://github.com/cj5k9dnkfd-afk) on 2026-11-24T07:38:22Z. --- Hi anyone have the game Link
Super-cod commented 2026-11-24 08:02:55 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Super-cod on 2026-11-24T07:43:03Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7125293054 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7125293054). Originally posted by [Super-cod](https://github.com/Super-cod) on 2026-11-24T07:43:03Z. --- 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.
LAKSHYA-cmd-tech commented 2026-11-24 08:02:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T07:50:35Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125432456 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7125432456). Originally posted by [LAKSHYA-cmd-tech](https://github.com/LAKSHYA-cmd-tech) on 2026-11-24T07:50:35Z. --- 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.
undeadhuman37 commented 2026-11-24 09:06:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by undeadhuman37 on 2026-11-24T08:16:08Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125928664 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7125928664). Originally posted by [undeadhuman37](https://github.com/undeadhuman37) on 2026-11-24T08:16:08Z. --- 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.
LAKSHYA-cmd-tech commented 2026-11-24 09:06:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T08:28:46Z.


Implemented and verified:

  1. Stripped \
<!-- greyfinch-sync:Marvisak/VIctory:comment:7126184164 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/715#issuecomment-7126184164). Originally posted by [LAKSHYA-cmd-tech](https://github.com/LAKSHYA-cmd-tech) on 2026-11-24T08:28:46Z. --- Implemented and verified: 1. Stripped \
Sign in to join this conversation.
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#715
No description provided.