[Games] Serious Sam support.

This commit is contained in:
CosminPerRam 2023-03-04 21:36:01 +02:00
parent 8992ffe4df
commit 14c5edc1be
6 changed files with 18 additions and 4 deletions

View file

@ -3,7 +3,11 @@ Who knows what the future holds...
# 0.X.Y - DD/MM/2023
### Changes:
Nothing... yet.
Protocols:
- GameSpy 1: Add key `admin` as a possible variable for `admin_name`.
Games:
- [Serious Sam](https://www.gog.com/game/serious_sam_the_first_encounter) support.
### Breaking:
None.
@ -23,7 +27,6 @@ Protocols:
- Valve:
1. Reversed (from `0.1.0`) "Players with no name are no more added to the `players_details` field.", also added a note in the [protocols](PROTOCOLS.md) file regarding this.
2. Fixed querying while multiple challenge responses might happen.
- GameSpy 1 support.
### Breaking:

View file

@ -47,6 +47,7 @@ Beware of the `Notes` column, as it contains information about query port offset
| V Rising | VR | Valve Protocol | Query port is 27016. |
| Unreal Tournament | UT | GameSpy 1 | Query Port offset: 1. |
| Battlefield 1942 | BF1942 | GameSpy 1 | Query port is 23000. |
| Serious Sam | SS | GameSpy 1 | Query Port offset: 1 |
## Planned to add support:
_

View file

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

View file

@ -89,3 +89,5 @@ pub mod vr;
pub mod ut;
/// Battlefield 1942
pub mod bf1942;
/// Serious Sam
pub mod ss;

7
src/games/ss.rs Normal file
View file

@ -0,0 +1,7 @@
use crate::GDResult;
use crate::protocols::gamespy;
use crate::protocols::gamespy::Response;
pub fn query(address: &str, port: Option<u16>) -> GDResult<Response> {
gamespy::one::query(address, port.unwrap_or(25601), None)
}

View file

@ -172,7 +172,7 @@ pub fn query(address: &str, port: u16, timeout_settings: Option<TimeoutSettings>
map: server_vars.remove("mapname").ok_or(GDError::PacketBad)?,
map_title: server_vars.remove("maptitle"),
admin_contact: server_vars.remove("AdminEMail"),
admin_name: server_vars.remove("AdminName"),
admin_name: server_vars.remove("AdminName").or(server_vars.remove("admin")),
has_password: has_password(&mut server_vars)?,
game_type: server_vars.remove("gametype").ok_or(GDError::PacketBad)?,
game_version: server_vars.remove("gamever").ok_or(GDError::PacketBad)?,