You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[T5] Plutonium Discord presence leaves ^< ^@ color codes in the server hostname #80
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.)
Activity