MicrosoftGame.config: attribute values with their character references replaced #51

Merged
gefydev merged 1 commit from upstream-pr/52 into main 2026-11-22 22:40:51 +00:00
gefydev commented 2026-11-22 22:35:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-22T22:35:50Z.


xml_attrs (launcher.rs) returns attribute values as they are written in MicrosoftGame.config. A & in an attribute has to be written &, so since 9a15c53 a game called "Ratchet & Clank" gets XCL – Ratchet & Clank as its window title. The same reader gives the Executable Name values, and an escaped character there names a file that doesn't exist.

Values now go through a small xml_unescape: the five named references (& < > " ') and numeric ones (', '). Anything that isn't a valid reference (a bare &,  , &#xZZ;) stays as written.

Validation

  • New test attribute_values_have_their_character_references_replaced, and a & case in display_name_is_the_shell_name_unless_it_is_a_resource. Both fail on main and pass with the change.
  • cargo test -p xcl --lib: 340 passed, 0 failed, on Windows GNU under Wine.
<!-- greyfinch-sync:ivall/xcl:issue:6548703375 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/52). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-22T22:35:50Z. --- `xml_attrs` (`launcher.rs`) returns attribute values as they are written in `MicrosoftGame.config`. A `&` in an attribute has to be written `&amp;`, so since 9a15c53 a game called "Ratchet & Clank" gets `XCL – Ratchet &amp; Clank` as its window title. The same reader gives the `Executable Name` values, and an escaped character there names a file that doesn't exist. Values now go through a small `xml_unescape`: the five named references (`&amp;` `&lt;` `&gt;` `&quot;` `&apos;`) and numeric ones (`&#39;`, `&#x27;`). Anything that isn't a valid reference (a bare `&`, `&nbsp;`, `&#xZZ;`) stays as written. ## Validation - New test `attribute_values_have_their_character_references_replaced`, and a `&amp;` case in `display_name_is_the_shell_name_unless_it_is_a_resource`. Both fail on `main` and pass with the change. - `cargo test -p xcl --lib`: 340 passed, 0 failed, on Windows GNU under Wine.
upstream-sync closed this pull request 2026-11-24 06:56:55 +00:00
ivall commented 2026-11-24 07:00:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-22T22:41:03Z.


Thanks, merged, and good catch on my 9a15c53!

The decoder looks right to me:

  • only a well-formed reference is replaced, and a bare & or &nbsp; stays as written;
  • &#X27; with an upper-case X stays too, which matches XML, where hex references take a lower-case x.

The values it touches are the Executable names, the Identity name and the display name. Of those, only the display name and the exe names can contain a &; package identities can't.

All tests pass with the MSVC toolchain on Windows: 343 lib tests with your new one, plus the e2e test title. My four titles' configs have no & at all, so nothing changes for them.

<!-- greyfinch-sync:ivall/xcl:comment:7087001337 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/52#issuecomment-7087001337). Originally posted by [ivall](https://github.com/ivall) on 2026-11-22T22:41:03Z. --- Thanks, merged, and good catch on my 9a15c53! The decoder looks right to me: - only a well-formed reference is replaced, and a bare `&` or `&nbsp;` stays as written; - `&#X27;` with an upper-case X stays too, which matches XML, where hex references take a lower-case `x`. The values it touches are the `Executable` names, the `Identity` name and the display name. Of those, only the display name and the exe names can contain a `&`; package identities can't. All tests pass with the MSVC toolchain on Windows: 343 lib tests with your new one, plus the e2e test title. My four titles' configs have no `&` at all, so nothing changes for them.
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!51
No description provided.