XUser: a gamertag without a suffix has an empty modern suffix #229

Manually merged
github merged 1 commit from gh-pr/229/head into gh-pr/229/base 2026-11-26 03:55:40 +00:00
Owner

@⁠Dufftwt on GitHub · 2026-11-24 01:38 UTC · original
Dufftwt:fix/gamertag-modern-suffix-empty → main · +29 −3 · 1 files · 1 commits · merged 2026-11-24 07:57 UTC

What's wrong

XUserGetGamertag takes a component, XUserGamertagComponent:

value component what the GDK says it is
0 Classic the classic gamertag
1 Modern the modern gamertag, without its suffix
2 ModernSuffix the modern gamertag's suffix if there is one, otherwise empty
3 UniqueModern modern gamertag and suffix, i.e. the plain name when there is no suffix

Our user, "Player", has no suffix. get_gamertag ignores the component and returns "Player" for all four, including the suffix. A title that shows the suffix whenever it isn't empty (name#suffix, the usual way to display a modern gamertag) shows:

Player#Player

What the fix does

get_gamertag returns an empty string (just the NUL, used = 1) for ModernSuffix (2), and the name for every other component, as before.

How it behaves after the fix

The user shows as Player. The classic, modern and unique modern components are still Player, and the suffix is empty, as for any account without a suffix. Both slots that reach get_gamertag, the gamertag interface's and the older one on the user interface, give the same result.

Tests

The new test a_gamertag_without_a_suffix_has_an_empty_modern_suffix reads all four components through both slots. It expects Player\0 for 0, 1 and 3, and \0 for 2.

I ran cargo test --workspace on GitHub's windows-latest with Rust 1.98.1 from rust-toolchain.toml:

  • This PR: everything passes. victory-hle has 87 passed, the other crates have 0 failed.
  • The new test alone on main: it fails on the suffix: left: [80, 108, 97, 121, 101, 114, 0] ("Player\0"), right: [0].
  • I ran with --test-threads=1. With 4 threads, the shader crate's GPU tests sometimes crash on that runner (STATUS_ACCESS_VIOLATION), on unmodified main as well.

Not tested: how the title displays the name.

**@⁠Dufftwt** on GitHub · 2026-11-24 01:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/229) `Dufftwt:fix/gamertag-modern-suffix-empty` → `main` · +29 −3 · 1 files · 1 commits · merged 2026-11-24 07:57 UTC ## What's wrong `XUserGetGamertag` takes a component, [`XUserGamertagComponent`](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xuser/enums/xusergamertagcomponent): | value | component | what the GDK says it is | |---|---|---| | 0 | `Classic` | the classic gamertag | | 1 | `Modern` | the modern gamertag, without its suffix | | 2 | `ModernSuffix` | the modern gamertag's suffix if there is one, **otherwise empty** | | 3 | `UniqueModern` | modern gamertag and suffix, i.e. the plain name when there is no suffix | Our user, "Player", has no suffix. `get_gamertag` ignores the component and returns `"Player"` for all four, including the suffix. A title that shows the suffix whenever it isn't empty (`name#suffix`, the usual way to display a modern gamertag) shows: ``` Player#Player ``` ## What the fix does `get_gamertag` returns an empty string (just the NUL, `used` = 1) for `ModernSuffix` (2), and the name for every other component, as before. ## How it behaves after the fix The user shows as `Player`. The classic, modern and unique modern components are still `Player`, and the suffix is empty, as for any account without a suffix. Both slots that reach `get_gamertag`, the gamertag interface's and the older one on the user interface, give the same result. ## Tests The new test `a_gamertag_without_a_suffix_has_an_empty_modern_suffix` reads all four components through both slots. It expects `Player\0` for 0, 1 and 3, and `\0` for 2. I ran `cargo test --workspace` on GitHub's `windows-latest` with Rust 1.98.1 from `rust-toolchain.toml`: - **This PR:** everything passes. `victory-hle` has 87 passed, the other crates have 0 failed. - **The new test alone on `main`:** it fails on the suffix: `left: [80, 108, 97, 121, 101, 114, 0]` ("Player\0"), `right: [0]`. - I ran with `--test-threads=1`. With 4 threads, the shader crate's GPU tests sometimes crash on that runner (`STATUS_ACCESS_VIOLATION`), on unmodified `main` as well. **Not tested:** how the title displays the name.
XUserGetGamertag returned the name for every component, the modern
suffix included. The GDK documents the suffix as empty when there is
none, and a title that shows "name#suffix" whenever the suffix is not
empty showed "Player#Player".

The modern suffix (component 2) is now empty; the classic, modern and
unique modern components are still the name.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:55:37 +00:00
github manually merged commit d46b07803c into gh-pr/229/base 2026-11-26 03:55:40 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 05:27 UTC · original

Thanks @⁠Dufftwt for covering the modern gamertag suffix when the tag has no suffix.

I tested commit d46b07803c80c6f05ae1738254ec98c7d50529a9 with:

cargo test --locked -p victory-hle --lib a_gamertag_without_a_suffix_has_an_empty_modern_suffix -- --test-threads=1

The targeted test passed (1 passed, 0 failed; 86 filtered). a_gamertag_without_a_suffix_has_an_empty_modern_suffix checks classic, modern, modern-suffix, and unique-modern components through both gamertag interface slots. The ordinary components return Player; the modern suffix returns an empty NUL-terminated string.

This exercises the HLE interface with its default user fixture; it does not use a real account or online profile.

**@⁠jeremygold02** on GitHub · 2026-11-24 05:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/229#issuecomment-7122971855) Thanks @⁠Dufftwt for covering the modern gamertag suffix when the tag has no suffix. I tested commit `d46b07803c80c6f05ae1738254ec98c7d50529a9` with: ``` cargo test --locked -p victory-hle --lib a_gamertag_without_a_suffix_has_an_empty_modern_suffix -- --test-threads=1 ``` The targeted test passed (1 passed, 0 failed; 86 filtered). [`a_gamertag_without_a_suffix_has_an_empty_modern_suffix`](https://github.com/Marvisak/VIctory/blob/d46b07803c80c6f05ae1738254ec98c7d50529a9/crates/victory-hle/src/modules/xuser.rs#L333) checks classic, modern, modern-suffix, and unique-modern components through both gamertag interface slots. The ordinary components return `Player`; the modern suffix returns an empty NUL-terminated string. This exercises the HLE interface with its default user fixture; it does not use a real account or online profile.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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!229
No description provided.