XUserGetGamertag: components as XUserGamertagComponent documents them #64

Merged
gefydev merged 1 commit from upstream-pr/65 into main 2026-11-23 10:20:31 +00:00
gefydev commented 2026-11-22 23:20:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-22T23:20:34Z.


Two mismatches between XUserGetGamertag and the XUserGamertagComponent documentation:

  • ModernSuffix vs UniqueModern. XCL returns an empty ModernSuffix ("no suffix") but "Player1#0001" for UniqueModern. The docs say ModernSuffix is "Modern gamertag suffix if present (otherwise empty)" and UniqueModern "contains either the modern gamertag + '#' + modern suffix, or the classic gamertag with no '#' and no suffix". With no suffix, UniqueModern is now the gamertag itself. (If you'd rather keep the #0001 shown in games, the other consistent choice is ModernSuffix = "0001"; I went with the existing "no suffix".)
  • Buffer sizes. The docs give the maximum buffer per component: Classic 16 bytes (15 characters + terminator), Modern 97, ModernSuffix 15, UniqueModern 101 with "a maximum length of 16 characters". Titles allocate those sizes. A longer gamertag in xcl.toml made XUserGetGamertag(Classic) return E_NOT_SUFFICIENT_BUFFER for a 16-byte buffer. Each component is now cut to its limit at a character boundary.

The logic moved into gamertag_component(tag, component) so it can be tested without changing the global config.

Validation

  • New test gamertag_components_are_consistent_and_fit_their_buffers: "Player1" gives ["Player1", "Player1", "", "Player1"]; a 26-character gamertag gives 15 characters for Classic and 16 for UniqueModern; a multi-byte gamertag is cut at a character boundary; every component fits its buffer.
  • user_add_and_queries now also reads UniqueModern through XUserGetGamertag. On main it gets Player1#0001.
  • cargo test -p xcl --lib: 344 passed, 0 failed, on Windows GNU under Wine.
<!-- greyfinch-sync:ivall/xcl:issue:6549137084 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/65). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-22T23:20:34Z. --- Two mismatches between `XUserGetGamertag` and the [`XUserGamertagComponent`](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xuser/enums/xusergamertagcomponent) documentation: - **ModernSuffix vs UniqueModern.** XCL returns an empty ModernSuffix ("no suffix") but `"Player1#0001"` for UniqueModern. The docs say ModernSuffix is "Modern gamertag suffix if present (otherwise empty)" and UniqueModern "contains either the modern gamertag + '#' + modern suffix, or the classic gamertag with no '#' and no suffix". With no suffix, UniqueModern is now the gamertag itself. (If you'd rather keep the `#0001` shown in games, the other consistent choice is ModernSuffix = `"0001"`; I went with the existing "no suffix".) - **Buffer sizes.** The docs give the maximum buffer per component: Classic 16 bytes (15 characters + terminator), Modern 97, ModernSuffix 15, UniqueModern 101 with "a maximum length of 16 characters". Titles allocate those sizes. A longer `gamertag` in xcl.toml made `XUserGetGamertag(Classic)` return `E_NOT_SUFFICIENT_BUFFER` for a 16-byte buffer. Each component is now cut to its limit at a character boundary. The logic moved into `gamertag_component(tag, component)` so it can be tested without changing the global config. ## Validation - New test `gamertag_components_are_consistent_and_fit_their_buffers`: `"Player1"` gives `["Player1", "Player1", "", "Player1"]`; a 26-character gamertag gives 15 characters for Classic and 16 for UniqueModern; a multi-byte gamertag is cut at a character boundary; every component fits its buffer. - `user_add_and_queries` now also reads UniqueModern through `XUserGetGamertag`. On `main` it gets `Player1#0001`. - `cargo test -p xcl --lib`: 344 passed, 0 failed, on Windows GNU under Wine.
upstream-sync closed this pull request 2026-11-24 06:56:59 +00:00
ivall commented 2026-11-24 07:00:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T10:20:58Z.


Merged (2c1c9ed) as is – the documented "no suffix" form; titles now show Player1 where they showed Player1#0001. Tested on Windows 11 with an RX 9070: cargo test --workspace green with the retail samples (shader pack, console DLLs, texture archive), and Unicorn Overlord reaches its title screen with everything from this round merged. Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7097812808 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/65#issuecomment-7097812808). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T10:20:58Z. --- Merged (2c1c9ed) as is – the documented "no suffix" form; titles now show `Player1` where they showed `Player1#0001`. Tested on Windows 11 with an RX 9070: `cargo test --workspace` green with the retail samples (shader pack, console DLLs, texture archive), and Unicorn Overlord reaches its title screen with everything from this round merged. Thanks!
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
xcl-dev/xcl!64
No description provided.