[Games] Add Hell Let Loose support.

This commit is contained in:
CosminPerRam 2023-05-30 16:48:19 +03:00
parent 06a2ceeda9
commit b3ba7df6d9
6 changed files with 26 additions and 1 deletions

View file

@ -11,6 +11,7 @@ Games:
- [Quake 2](https://store.steampowered.com/app/2320/Quake_II/) support.
- [Quake 1](https://store.steampowered.com/app/2310/Quake/) support.
- [Quake 3: Arena](https://store.steampowered.com/app/2200/Quake_III_Arena/) support.
- [Hell Let Loose](https://store.steampowered.com/app/686810/Hell_Let_Loose/) support.
### Breaking:
- Every function that used `&str` for the address has been changed to `&IpAddr` (thanks [@Douile](https://github.com/Douile) for the re-re-write).

View file

@ -53,6 +53,7 @@ Beware of the `Notes` column, as it contains information about query port offset
| Quake 2 | QUAKE2 | Quake 2 | |
| Quake 1 | QUAKE1 | Quake 1 | |
| Quake 3: Arena | QUAKE3A | Quake 3 | |
| Hell Let Loose | HLL | Valve Protocol | Query port is 26420. Note that on this port it might not send players data, as there might be another query port that does send players data. |
## Planned to add support:
_

View file

@ -2,7 +2,7 @@ use gamedig::protocols::{gamespy, quake};
use gamedig::protocols::minecraft::LegacyGroup;
use gamedig::protocols::valve;
use gamedig::protocols::valve::Engine;
use gamedig::{aliens, aoc, arma2oa, ase, asrd, avorion, bat1944, bb2, bf1942, bm, bo, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, ffow, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ohd, onset, pz, ror2, rust, sc, sdtd, ss, tf, tf2, tfc, ts, unturned, ut, vr, GDResult, cw, quake2, quake1, quake3a};
use gamedig::{aliens, aoc, arma2oa, ase, asrd, avorion, bat1944, bb2, bf1942, bm, bo, ccure, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, ffow, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ohd, onset, pz, ror2, rust, sc, sdtd, ss, tf, tf2, tfc, ts, unturned, ut, vr, GDResult, cw, quake2, quake1, quake3a, hll};
use std::env;
use std::net::IpAddr;
@ -129,6 +129,7 @@ fn main() -> GDResult<()> {
"quake2" => println!("{:#?}", quake2::query(ip, port)?),
"quake1" => println!("{:#?}", quake1::query(ip, port)?),
"quake3a" => println!("{:#?}", quake3a::query(ip, port)?),
"hll" => println!("{:#?}", hll::query(ip, port)?),
_ => panic!("Undefined game: {}", args[1]),
};

17
src/games/hll.rs Normal file
View file

@ -0,0 +1,17 @@
use std::net::IpAddr;
use crate::{
protocols::valve::{self, game, SteamApp},
GDResult,
};
pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<game::Response> {
let valve_response = valve::query(
address,
port.unwrap_or(26420),
SteamApp::HLL.as_engine(),
None,
None,
)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -100,3 +100,5 @@ pub mod quake2;
pub mod quake1;
/// Quake 3: Arena
pub mod quake3a;
/// Hell Let Loose
pub mod hll;

View file

@ -308,6 +308,8 @@ pub enum SteamApp {
ONSET,
/// V Rising
VR,
/// Hell Let Loose
HLL,
}
impl SteamApp {
@ -355,6 +357,7 @@ impl SteamApp {
SteamApp::OHD => Engine::new_source_with_dedicated(736590, 950900),
SteamApp::ONSET => Engine::new_source(1105810),
SteamApp::VR => Engine::new_source(1604030),
SteamApp::HLL => Engine::new_source(686810),
}
}
}