Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted Steam presence fixes #2324

Merged
merged 4 commits into from
Feb 1, 2024

Commits on Dec 23, 2023

  1. fix(steam): steamname.txt overrides as UTF-8

    The 'steamname.txt' feature, which allows overriding the product name
    shown in Steam rich presence, would originally read files as CP_ACP due
    to a mistaken use of 'wstringstream'/'wifstream'.
    
    This means that trying to replicate the existing product name (such as
    'FiveM 🐌') would show mojibake instead. Since we can assume people will
    save files as UTF-8 (even Windows Notepad has this as a default), just
    not converting this should be safe.
    blattersturm committed Dec 23, 2023
    Configuration menu
    Copy the full SHA
    52e4e6a View commit details
    Browse the repository at this point in the history
  2. fix(steam): race condition leading to duplicate SteamChild

    In some cases, needRefresh would be set to true before the existing
    child process would've picked up on it and exited. Instead, we use a PID
    match to make sure only the latest process remains.
    blattersturm committed Dec 23, 2023
    Configuration menu
    Copy the full SHA
    1b0320e View commit details
    Browse the repository at this point in the history
  3. tweak(vendor): update utfcpp to v4.0.4

    The Steam work needed utf8::find_invalid(const std::string&), which was
    introduced in v3.0.0.
    blattersturm committed Dec 23, 2023
    Configuration menu
    Copy the full SHA
    3683eaf View commit details
    Browse the repository at this point in the history
  4. fix(steam): truncate presence to a valid UTF-8 sequence

    With a host name such as "Êîðïîðàöèÿ Ìàéêðîñîôò; Âñå ïðàâà çàùèùåíû", we
    will try to set a presence name like "test: Êîðïîðàöèÿ Ìàéêðîñîôò; Âñå
    ïðàâà çàùèùåíû", assuming `steamname.txt` contains "test".
    
    Steam, internally, truncates app names to fit in a 64-byte buffer with a
    null terminator. However, the code which truncates does not ensure the
    resulting UTF-8 sequence is valid, which might lead to the update being
    rejected further down the line, which is especially likely with a name
    consisting solely of multi-byte sequences, like the example name.
    
    In this changeset, we circumvent this by truncating the name to 64 bytes
    ourselves, and subsequently chopping off at the first invalid UTF-8
    sequence.
    blattersturm committed Dec 23, 2023
    Configuration menu
    Copy the full SHA
    9020669 View commit details
    Browse the repository at this point in the history