Skip to content

Clan tags + ConVar/NeoUI UTF-8 bytes truncation#682

Merged
nullsystem merged 1 commit into
NeotokyoRebuild:masterfrom
nullsystem:GH-267_Clantag
Oct 25, 2024
Merged

Clan tags + ConVar/NeoUI UTF-8 bytes truncation#682
nullsystem merged 1 commit into
NeotokyoRebuild:masterfrom
nullsystem:GH-267_Clantag

Conversation

@nullsystem

@nullsystem nullsystem commented Oct 7, 2024

Copy link
Copy Markdown
Collaborator

Description

  • Be able to set it from the settings
  • Networked clan tag via the gamerules, updates only when necessary
  • Scoreboard:
    • If all players have the clantag, it'll show the clantag as the team
    • Clantag will prefix [CLANTAG] to the player's name
  • Server-side allow/disallow clantag
  • Friendly HUD:
    • Spectators will always show clantag
    • Client can toggle if to extend showing clantag to team members during play
  • ConVars:
    • neo_clantag - "" by default, Player's set clantag name
    • neo_sv_clantag_allow - 1 by default, Server-side allow/disallow clantags
    • neo_sv_dev_test_clantag - "" by default, DEVELOPMENT + DEBUG-BUILD ONLY, override the clantag text for everyone - development purpose only and not compiled in Release mode
    • neo_cl_clantag_friendly_marker_spec_only - 1 by default, If enabled, only the spectator/non-team will see the clantag next to name for the friendly markers.
  • Unicode string truncation:
    • Callback added for neo_name and neo_clantag to truncate by expected bytes
    • NeoUI text edit changed from wchar_t size limit to conversion-resulting char/UTF-8 bytes limit

Toolchain

  • Linux GCC Distro Native Arch/GCC 14

Linked Issues

@nullsystem
nullsystem force-pushed the GH-267_Clantag branch 5 times, most recently from 0e467af to d61f8b4 Compare October 18, 2024 19:29
@nullsystem
nullsystem marked this pull request as ready for review October 18, 2024 19:29
@nullsystem nullsystem changed the title [WIP] Clan tag Clan tags Oct 18, 2024
@nullsystem
nullsystem requested a review from a team October 18, 2024 19:33
brysondev
brysondev previously approved these changes Oct 19, 2024
Comment thread mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp
@nullsystem
nullsystem requested a review from a team October 19, 2024 09:47
@nullsystem nullsystem added this to the v9.1-prealpha milestone Oct 19, 2024
Comment thread mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp Outdated
Comment thread mp/src/game/shared/neo/neo_player_shared.cpp Outdated
Comment thread mp/src/game/shared/neo/neo_player_shared.cpp Outdated
Comment thread mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp Outdated
Comment thread mp/src/game/client/neo/ui/neo_root_settings.cpp Outdated
Comment thread mp/src/game/shared/neo/neo_player_shared.cpp Outdated
brysondev
brysondev previously approved these changes Oct 23, 2024

@Rainyan Rainyan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's any reasonable way we can deal with this assertion being hit more gracefully, it would be nice:

] neo_clantag "ああああ"

// When opening the scoreboard with the clantag set:
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence
strtools_unicode.cpp (290) : invalid Unicode byte sequence

I'm guessing it's another case of a multibyte character getting cut due to running out of bytes in the allocated buffer.

@nullsystem

Copy link
Copy Markdown
Collaborator Author

I'm think there's a need to try to restrict the convar string length properly by either callback function or expanding it, but also changing a bit on length checking for the NeoUI text edit. Also a neo_name issue as well from the seems of it.

@nullsystem
nullsystem marked this pull request as draft October 24, 2024 21:19
@nullsystem
nullsystem marked this pull request as ready for review October 24, 2024 22:17
@nullsystem nullsystem changed the title Clan tags Clan tags + ConVar/NeoUI UTF-8 bytes truncation Oct 24, 2024
@nullsystem

Copy link
Copy Markdown
Collaborator Author

@Rainyan I've added in callbacks for neo_name + neo_clantag to truncate the string when too long, and also altered NeoUI text edit to limit by bytes when it's in char rather than wchar_t length.

* Be able to set it from the settings
* Networked clan tag via the gamerules, updates only when necessary
* Scoreboard: If all players have the clantag, the team name gets
  replaced by it
* Friendly markers: Also shows in here but with an extra toggle to
  either only show for spectator or for all people

* NeoUI - TextEdit limit by the bytes in char UTF-8, NOT wchar_t length
* Callback added for neo_name and neo_clantag to truncate strings that
  are too long

* fixes NeotokyoRebuild#267
@nullsystem nullsystem added the New Changes for Reviewers New changes has been made. This label is mostly to notify reviewers. label Oct 24, 2024
@nullsystem
nullsystem merged commit 0f97466 into NeotokyoRebuild:master Oct 25, 2024
@nullsystem
nullsystem deleted the GH-267_Clantag branch May 7, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Changes for Reviewers New changes has been made. This label is mostly to notify reviewers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clan tag - Left-side of name, right-side of teamname if all players same clantag

3 participants