From d671bb0310cd8c6b1d776433c53eb300444b04fe Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Mon, 28 Nov 2022 21:33:09 +0200 Subject: [PATCH] Half-Life Deathmatch: Source support. --- CHANGELOG.md | 1 + GAMES.md | 1 + examples/master_querant.rs | 3 ++- src/games/hldms.rs | 12 ++++++++++++ src/games/mod.rs | 2 ++ src/protocols/valve/types.rs | 2 ++ 6 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/games/hldms.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 55518dd..020a8af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Who knows what the future holds... [Counter-Strike](https://store.steampowered.com/app/10/CounterStrike/) support. [Arma 2: Operation Arrowhead](https://store.steampowered.com/app/33930/Arma_2_Operation_Arrowhead/) support. [Day of Infamy](https://store.steampowered.com/app/447820/Day_of_Infamy/) support. +[Half-Life Deathmatch: Source](https://store.steampowered.com/app/360/HalfLife_Deathmatch_Source/) support. Successfully tested `Alien Swarm` and `Insurgency: Modern Infantry Combat`. Restored rules response for `Counter-Strike: Global Offensive` (note: for a full player list response, the cvar `host_players_show` must be set to `2`). Increased Valve Protocol `PACKET_SIZE` from 1400 to 6144 (because some games send larger packets than the specified protocol size). diff --git a/GAMES.md b/GAMES.md index a5a3c39..223f9c0 100644 --- a/GAMES.md +++ b/GAMES.md @@ -29,6 +29,7 @@ A supported game is defined as a game that has been successfully tested, other g | Counter-Strike | CS | Valve Protocol (GoldSrc) | | | Arma 2: Operation Arrowhead | ARMA2OA | Valve Protocol | Use the query port. | | Day of Infamy | DOI | Valve Protocol | | +| Half-Life Deathmatch: Source | HLDMS | Valve Protocol | | ## Planned to add support: _ diff --git a/examples/master_querant.rs b/examples/master_querant.rs index 2d77f51..2493df4 100644 --- a/examples/master_querant.rs +++ b/examples/master_querant.rs @@ -1,6 +1,6 @@ use std::env; -use gamedig::{aliens, arma2oa, ase, asrd, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, ins, insmic, inss, l4d, l4d2, mc, rust, sc, sdtd, tf, tf2, tfc, ts, unturned}; +use gamedig::{aliens, arma2oa, ase, asrd, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, rust, sc, sdtd, tf, tf2, tfc, ts, unturned}; use gamedig::protocols::minecraft::{LegacyGroup, Server}; use gamedig::protocols::valve; use gamedig::protocols::valve::App; @@ -63,6 +63,7 @@ fn main() -> GDResult<()> { "cs" => println!("{:#?}", cs::query(ip, port)?), "arma2oa" => println!("{:#?}", arma2oa::query(ip, port)?), "doi" => println!("{:#?}", doi::query(ip, port)?), + "hldms" => println!("{:#?}", hldms::query(ip, port)?), "_src" => println!("{:#?}", valve::query(ip, port.unwrap(), App::Source(None), None, None)?), "_gld" => println!("{:#?}", valve::query(ip, port.unwrap(), App::GoldSrc(false), None, None)?), "_gld_f" => println!("{:#?}", valve::query(ip, port.unwrap(), App::GoldSrc(true), None, None)?), diff --git a/src/games/hldms.rs b/src/games/hldms.rs new file mode 100644 index 0000000..862c5e3 --- /dev/null +++ b/src/games/hldms.rs @@ -0,0 +1,12 @@ +use crate::GDResult; +use crate::protocols::valve; +use crate::protocols::valve::{game, SteamID}; + +pub fn query(address: &str, port: Option) -> GDResult { + let valve_response = valve::query(address, match port { + None => 27015, + Some(port) => port + }, SteamID::HLDMS.as_app(), None, None)?; + + Ok(game::Response::new_from_valve_response(valve_response)) +} diff --git a/src/games/mod.rs b/src/games/mod.rs index d5f7a97..18ca089 100644 --- a/src/games/mod.rs +++ b/src/games/mod.rs @@ -55,3 +55,5 @@ pub mod cs; pub mod arma2oa; /// Day of Infamy pub mod doi; +/// Half-Life Deathmatch: Source +pub mod hldms; diff --git a/src/protocols/valve/types.rs b/src/protocols/valve/types.rs index c75c8ff..c4e5bbc 100644 --- a/src/protocols/valve/types.rs +++ b/src/protocols/valve/types.rs @@ -159,6 +159,8 @@ pub enum SteamID { DODS = 300, /// Half-Life 2 Deathmatch HL2DM = 320, + /// Half-Life Deathmatch: Source + HLDMS = 360, /// Team Fortress 2 TF2 = 440, /// Left 4 Dead