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

Merged
Dufftwt merged 1 commit from upstream-pr/229 into main 2026-11-24 07:57:16 +00:00
Dufftwt commented 2026-11-24 01:38:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dufftwt on 2026-11-24T01:38:32Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6572632264 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/229). Originally posted by [Dufftwt](https://github.com/Dufftwt) on 2026-11-24T01:38:32Z. --- ## 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.
jeremygold02 commented 2026-11-24 06:56:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T05:27:53Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7122971855 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/229#issuecomment-7122971855). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T05:27:53Z. --- 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.
upstream-sync closed this pull request 2026-11-24 08:01:57 +00:00
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
Marvisak/VIctory!229
No description provided.