From 1c173b76ca703c201ff0182e416ef8c578344915 Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Mon, 28 Nov 2022 20:53:12 +0200 Subject: [PATCH] Day of Infamy support. --- CHANGELOG.md | 1 + GAMES.md | 1 + examples/master_querant.rs | 3 ++- src/games/doi.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/doi.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index c878ae7..55518dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Who knows what the future holds... [Rust](https://store.steampowered.com/app/252490/Rust/) support. [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. 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 ab3131c..a5a3c39 100644 --- a/GAMES.md +++ b/GAMES.md @@ -28,6 +28,7 @@ A supported game is defined as a game that has been successfully tested, other g | Rust | RUST | Valve Protocol | | | Counter-Strike | CS | Valve Protocol (GoldSrc) | | | Arma 2: Operation Arrowhead | ARMA2OA | Valve Protocol | Use the query port. | +| Day of Infamy | DOI | Valve Protocol | | ## Planned to add support: _ diff --git a/examples/master_querant.rs b/examples/master_querant.rs index 0d6295a..27a5a17 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, 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, 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; @@ -56,6 +56,7 @@ fn main() -> GDResult<()> { "rust" => println!("{:#?}", rust::query(ip, port)?), "cs" => println!("{:#?}", cs::query(ip, port)?), "arma2oa" => println!("{:#?}", arma2oa::query(ip, port)?), + "doi" => println!("{:#?}", doi::query(ip, port)?), "_src" => println!("{:#?}", valve::query(ip, 27015, App::Source(None), None, None)?), "_gld" => println!("{:#?}", valve::query(ip, 27015, App::GoldSrc(false), None, None)?), "_gld_f" => println!("{:#?}", valve::query(ip, 27015, App::GoldSrc(true), None, None)?), diff --git a/src/games/doi.rs b/src/games/doi.rs new file mode 100644 index 0000000..f5f8d69 --- /dev/null +++ b/src/games/doi.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::DOI.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 e998e16..d5f7a97 100644 --- a/src/games/mod.rs +++ b/src/games/mod.rs @@ -53,3 +53,5 @@ pub mod rust; pub mod cs; /// ARMA 2: Operation Arrowhead pub mod arma2oa; +/// Day of Infamy +pub mod doi; diff --git a/src/protocols/valve/types.rs b/src/protocols/valve/types.rs index e83a3e9..c75c8ff 100644 --- a/src/protocols/valve/types.rs +++ b/src/protocols/valve/types.rs @@ -183,6 +183,8 @@ pub enum SteamID { SC = 225840, /// Rust RUST = 252490, + /// Day of Infamy + DOI = 447820, /// The Forrest TF = 556450, //this is the id for the dedicated server, for the game its 242760 /// 7 Days To Die