Skip to content

[T5] Plutonium Discord presence leaves ^< ^@ color codes in the server hostname #80

Description

@KL9modz

What happened?

The Discord "now playing" rich presence strips ^0-^9, ^: and ^; from the server name, but passes the last five T5 color codes through literally: ^< ^= ^> ^? ^@.
Any server whose name uses one of those shows the raw code on every connected player's Discord card. Including my server, which has orange ^<.

Cause. T5's color table has 17 entries, so valid codes run '0' (0x30) through '@' (0x40). The game's own parser, at t5mp.exe file offset 0x14BC70, is index = char - '0' with a bound of 17 and a white fallback, with no digit check at all:

8A 44 24 04    mov   al, [esp+4]     ; char after '^'
2C 30          sub   al, 0x30        ; index = char - '0'
3C 11          cmp   al, 0x11        ; 17 = table size
0F B6 C0       movzx eax, al
72 05          jb    use_it
B8 07 00 00 00 mov   eax, 7          ; else white
C3             ret

The strip behaves as though its range is '0'-';' (0x30-0x3B), i.e. entries 0-11, while the table has five more: ^< orange, ^= steel blue, ^> light grey, ^? purple, ^@ brown. Widening the upper bound to '@' should be the whole fix.

Expected result

Strip all T5 color codes from Discord presence. Widening the upper bound to '@' should be the whole fix.

Steps to reproduce

Set sv_hostname to a string carrying one code of each class and read the card:

sent:  PROBE ^1a ^:b ^<c ^=d ^>e ^?f ^@g ^;h END
card:  PROBE a   b   ^<c ^=d ^>e ^?f ^@g h   END

^1, ^: and ^; are removed correctly. The other five survive verbatim. (Tested on a dedicated server with the value re-asserted, since it otherwise reverts to the server-key label within ~20s.)

Affected game(s)

BO1 Multiplayer (T5MP)

Affected component(s)

Server (dedi)

Plutonium version

r5346

Relevant logs

No response

Additional information

No response

Operating system

Windows 11

Plutonium profile

https://forum.plutonium.pw/user/kl9

Discord username

KL9

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomponent: serverIssue related to the game servergame: T5Issue related to T5mode: MPIssue only affecting Multiplayer

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions