Skip to content

Add configurable Windows RCON text conversion and detailed player ID queries - #1281

Open
Yioxoii6 wants to merge 2 commits into
openmultiplayer:masterfrom
Yioxoii6:codex/rcon-encoding-native-player-query
Open

Yioxoii6 wants to merge 2 commits into
openmultiplayer:masterfrom
Yioxoii6:codex/rcon-encoding-native-player-query

Conversation

@Yioxoii6

@Yioxoii6 Yioxoii6 commented Oct 11, 2026 •

Copy link
Copy Markdown

Windows console input is currently converted to UTF-8 before dispatch. On a GBK server, say 中文 therefore sends UTF-8 bytes to clients expecting D6 D0 CE C4. Remote RCON has the same mismatch when an external tool sends UTF-8 commands. Separately, the existing c player query has no IDs, and open.mp does not answer d, so external tools cannot obtain actual player pool IDs through public queries.

This adds explicit, lossless Windows conversion settings while preserving existing defaults, plus detailed player queries that never truncate or invent IDs. The implementation is based on current master (68435c7a), with no submodule changes.

Behavior

  • console.input_codepage defaults to 65001, preserving UTF-8. Setting 936 converts Unicode console input to GBK; 950 and the Windows ANSI code page are also supported. Unrepresentable characters are rejected before command dispatch. Local command replies are converted to UTF-8 for logging.
  • rcon.utf8_command_codepage defaults to 0 (original bytes). Setting 936 explicitly accepts UTF-8 remote commands and converts them to GBK after authenticating the original password bytes. Invalid UTF-8 or lossy conversion returns an error without dispatch. In-game RCON, the script command API, and remote reply bytes are unchanged. This is Windows-only and intentionally does not guess the encoding of untagged legacy packets.
  • Existing c responses stay unchanged. Legacy d returns actual IDs only when there are at most 100 players and all IDs fit in one byte.
  • Proposed D version 1 uses 16-bit IDs and consistent paginated snapshots (32 players/page, maximum 1144-byte response, 16 retained snapshots). It handles IDs 0–999 with RCON disabled and respects enable_query=false. Player data is copied on the main thread; the network thread reads bounded snapshots.

The D wire format and sc_d16=1 capability are compatible with the existing SampCtrl client. They are documented as an experimental extension for review, not an official protocol standard. I would appreciate maintainer feedback on accepting this extension/capability or separating the encoding and query changes.

Validation

  • Built the full Windows x86 Release server and all enabled components with Clang 20.1.8, Visual Studio C++ tools and Conan 2.
  • CTest: 3/3 passed, including packet tests, strict encoding tests, and isolated real-server integration. Integration covers 0/1/1000 player pool records, legacy layouts, malformed requests, retained generations, Query/RCON disabled, real UTF-16 stdin, outgoing game RPC bytes, Unicode passwords, and rejected commands not being dispatched.
  • Existing SampCtrl JVM protocol tests: 44 passed. Its actual protocol library also queried the freshly built server at 0/1/1000 players and with Query disabled.
  • Fork CI passed on both Windows and Ubuntu: regression run. Standalone test instructions are included; fixtures are kept outside deployable component output.

The upstream workflows currently require maintainer approval to run for this contribution. No production deployment or real game-client rendering validation was performed. Encoding integration was tested on Windows; the query unit-test workflow also covers Linux. See CONSOLE_QUERY.md for configuration and the exact wire format, and Tests/ConsoleQuery/README.md for reproduction commands.

@AmyrAhmady, could you review the proposed encoding boundary and player-query extension? Thank you.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant