XGameUi: a text entry's limit is the console's #370

Merged
marquezinii merged 1 commit from upstream-pr/370 into main 2026-11-25 00:10:42 +00:00
marquezinii commented 2026-11-24 02:42:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by marquezinii on 2026-11-24T02:42:56Z.


XGameUiShowTextEntryAsync ignored the length rules the GDK documents for maxTextLength: "On console, the maximum number of characters is 1024. [...] If the value 0 is passed in, it will be treated as a maximum character length of 1024. Further, if the inputScope is XGameUiTextEntryInputScope::Password, the maximum length will always be 1024 and the maxTextLength value will be ignored."

Here 0 meant no limit (the result kept whatever was typed, and EM_LIMITTEXT with 0 lifts the edit box's cap), limits above 1024 were kept, and the scope was not read, so a password entry was cut to the title's limit.

The limit is now worked out once from the scope and the title's value, and used for both the dialog and the result.

Tested: a new test checks the rule itself and two calls through the object: a 2000-character default with limit 0 now gives 1025 bytes (it gave 2006 before), and a password entry with limit 8 keeps all 8 + 1 characters. cargo test -p victory-hle passes and clippy reports nothing new. The host dialog itself was not opened.

https://learn.microsoft.com/gaming/gdk/docs/reference/system/xgameui/functions/xgameuishowtextentryasync

<!-- greyfinch-sync:Marvisak/VIctory:issue:6573420619 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/370). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T02:42:56Z. --- `XGameUiShowTextEntryAsync` ignored the length rules the GDK documents for `maxTextLength`: "On console, the maximum number of characters is 1024. [...] If the value 0 is passed in, it will be treated as a maximum character length of 1024. Further, if the *inputScope* is XGameUiTextEntryInputScope::Password, the maximum length will always be 1024 and the *maxTextLength* value will be ignored." Here 0 meant no limit (the result kept whatever was typed, and `EM_LIMITTEXT` with 0 lifts the edit box's cap), limits above 1024 were kept, and the scope was not read, so a password entry was cut to the title's limit. The limit is now worked out once from the scope and the title's value, and used for both the dialog and the result. Tested: a new test checks the rule itself and two calls through the object: a 2000-character default with limit 0 now gives 1025 bytes (it gave 2006 before), and a password entry with limit 8 keeps all 8 + 1 characters. `cargo test -p victory-hle` passes and clippy reports nothing new. The host dialog itself was not opened. https://learn.microsoft.com/gaming/gdk/docs/reference/system/xgameui/functions/xgameuishowtextentryasync
jeremygold02 commented 2026-11-24 06:55:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:06:43Z.


Thanks @marquezinii for this change. I tested head 936e5e51c91c7b380a4729aeaa2255824ce8085a with:

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

Result: 1 passed, 0 failed (86 filtered out). The test covers the console limit rule for zero and over-1024 title limits, password scope, and the resulting object-call length. It does not open the host text-entry dialog.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121716632 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/370#issuecomment-7121716632). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T04:06:43Z. --- Thanks @marquezinii for this change. I tested head `936e5e51c91c7b380a4729aeaa2255824ce8085a` with: ``` cargo test --locked -p victory-hle --lib text_entry_limits_follow_the_console -- --test-threads=1 ``` Result: 1 passed, 0 failed (86 filtered out). The test covers the console limit rule for zero and over-1024 title limits, password scope, and the resulting object-call length. It does not open the host text-entry dialog.
upstream-sync closed this pull request 2026-11-25 01:03:32 +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!370
No description provided.