Add support for Mindustry (#178)

* buffer: Add UTF8LengthPrefixed string decoder

* games: Use expression for default port

This allows us to refer to constants for the default ports if we want to
(literals will still work).

* games: Add support for mindustry
This commit is contained in:
Tom 2024-01-17 13:53:40 +00:00 committed by GitHub
parent ba92466ae1
commit 07de5168f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 251 additions and 3 deletions

View file

@ -9,7 +9,7 @@ use crate::protocols::valve::GatheringSettings;
use phf::{phf_map, Map};
macro_rules! game {
($name: literal, $default_port: literal, $protocol: expr) => {
($name: literal, $default_port: expr, $protocol: expr) => {
game!(
$name,
$default_port,
@ -18,7 +18,7 @@ macro_rules! game {
)
};
($name: literal, $default_port: literal, $protocol: expr, $extra_request_settings: expr) => {
($name: literal, $default_port: expr, $protocol: expr, $extra_request_settings: expr) => {
Game {
name: $name,
default_port: $default_port,
@ -132,4 +132,5 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
"unrealtournament2003" => game!("Unreal Tournament 2003", 7758, Protocol::Unreal2),
"unrealtournament2004" => game!("Unreal Tournament 2004", 7778, Protocol::Unreal2),
"zps" => game!("Zombie Panic: Source", 27015, Protocol::Valve(Engine::new(17_500))),
"mindustry" => game!("Mindustry", crate::games::mindustry::DEFAULT_PORT, Protocol::PROPRIETARY(ProprietaryProtocol::Mindustry)),
};