feat: remove games.txt and replace it with an in-code solution (#407)

* feat: remove games.txt and replace it with an in-code solution

* docs: update changelog

* chore: add todo comment regarding weird game ids to rename

* fix: generate games list md file

* fix: gemerate games list file to alphabetical id order

* fix: update changelog to note removal of some game ids and add geneshift alternative
This commit is contained in:
CosminPerRam 2023-11-19 02:59:31 +02:00 committed by GitHub
parent 2fb9f507e2
commit ce4cddb87f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 2456 additions and 468 deletions

View file

@ -8,9 +8,14 @@
#### Games
* Renamed `Counter Strike: 2D` to `CS2D` in [games.txt](games.txt) (why? see [this](https://cs2d.com/faq.php?show=misc_name#misc_name)).
* Updated `CS2D` protocol (by @ernestpasnik).
* Removed the following alternative game ids: `minecraftping` (as it was deprecated and the same thing as `minecraft`),
`minecraftpe` (deprecated, which is the same as `minecraftbe`), `flashpoint` (alternative was `operationflashpoint`,
see next point) and `tshock` (which is `terraria`).
* Renamed the game id `operationflashpoint` to reference it by its full name, now is `ofcwc`.
### Other changes
#### Package
* Removed the `games.txt` file, the games definitions are now stored in-code.
* Replaced usage of deprecated `substr` with `substring`.
* Replaced deprecated internal `punycode` with the [punycode](https://www.npmjs.com/package/punycode) package.
* Updated [got](https://github.com/sindresorhus/got) from 12.1 to 13.

345
games.txt
View file

@ -1,345 +0,0 @@
# id | pretty name for readme | protocol | options | extra
7d2d|7 Days to Die (2013)|valve|port=26900,port_query_offset=1
as|Action: Source (2019)|valve|port=27015
ahl|Action Half-Life|valve|port=27015
ageofchivalry|Age of Chivalry (2007)|valve|port=27015
aoe2|Age of Empires 2 (1999)|ase|port_query=27224
alienarena|Alien Arena (2004)|quake2|port_query=27910
alienswarm|Alien Swarm (2010)|valve|port=27015
arkse|Ark: Survival Evolved (2017)|valve|port=7777,port_query=27015
asa|Ark: Survival Ascended (2023)|asa|port=7777
assettocorsa|Assetto Corsa (2014)|assettocorsa|port=9610
atlas|Atlas (2018)|valve|port=5761,port_query_offset=51800
avorion|Avorion (2020)|valve|port=27000,port_query_offset=20
avp2|Aliens versus Predator 2 (2001)|gamespy1|port=27888
avp2010|Aliens vs. Predator (2010)|valve|port=27015
americasarmy|America's Army (2002)|gamespy2|port=1716,port_query_offset=1
americasarmy2|America's Army 2 (2003)|gamespy2|port=1716,port_query_offset=1
americasarmy3|America's Army 3 (2009)|valve|port=8777,port_query=27020
americasarmypg|America's Army: Proving Grounds (2015)|valve|port=8777,port_query=27020
arcasimracing|Arca Sim Racing (2008)|rfactor|port=34397,port_query_offset=-100
arma|ARMA: Armed Assault (2007)|gamespy2|port=2302
arma2|ARMA 2 (2009)|valve|port=2302,port_query_offset=1
arma2oa|ARMA 2: Operation Arrowhead (2010)|valve|port=2302,port_query_offset=1
armacwa|ARMA: Cold War Assault (2011)|gamespy1|port=2302,port_query_offset=1
armar|ARMA: Resistance (2011)|gamespy1|port=2302,port_query_offset=1
arma3|ARMA 3 (2013)|valve|port=2302,port_query_offset=1
armare|ARMA: Reforger (2022)|valve|port=2001,port_query=17777
armagetron|Armagetron Advanced (2001)|armagetron|port=4534
baldursgate|Baldur's Gate (1998)|gamespy1|port=6073,port_query=1470
ballisticoverkill|Ballistic Overkill (2017)|valve|port=27015,port_query_offset=1
barotrauma|Barotrauma (2019)|valve|port=27015,port_query_offset=1
bat1944|Battalion 1944 (2018)|valve|port=7777,port_query_offset=3
bf1942|Battlefield 1942 (2002)|gamespy1|port=14567,port_query=23000
bfv|Battlefield Vietnam (2004)|gamespy2|port=15567,port_query=23000
bf2|Battlefield 2 (2005)|gamespy3|port=16567,port_query=29900
bf2142|Battlefield 2142 (2006)|gamespy3|port=16567,port_query=29900
bfbc2|Battlefield: Bad Company 2 (2010)|battlefield|port=19567,port_query=48888
bf3|Battlefield 3 (2011)|battlefield|port=25200,port_query_offset=22000
bf4|Battlefield 4 (2013)|battlefield|port=25200,port_query_offset=22000
bfh|Battlefield Hardline (2015)|battlefield|port=25200,port_query_offset=22000
blackmesa|Black Mesa (2020)|valve|port=27015
brainbread2|BrainBread 2 (2022)|valve|port=27015
brainbread|BrainBread|valve|port=27015
breach|Breach (2011)|valve|port=27016
breed|Breed (2004)|gamespy2|port=7649
brink|Brink (2011)|valve|port_query_offset=1
bd|Base Defense (2017)|valve|port=27015
bs|Blade Symphony (2014)|valve|port=27015
buildandshoot|Build and Shoot / Ace of Spades Classic (2012)|buildandshoot|port=32887,port_query_offset=-1
cod|Call of Duty (2003)|quake3|port=28960
coduo|Call of Duty: United Offensive (2004)|quake3|port=28960
cod2|Call of Duty 2 (2005)|quake3|port=28960
cod3|Call of Duty 3 (2006)|quake3|port=28960
cod4|Call of Duty 4: Modern Warfare (2007)|quake3|port=28960
codwaw|Call of Duty: World at War (2008)|quake3|port=28960
codmw2|Call of Duty: Modern Warfare 2 (2009)|quake3|port=28960
codmw3|Call of Duty: Modern Warfare 3 (2011)|valve|port_query_offset=2
callofjuarez|Call of Juarez (2006)|ase|port_query=26000
chaser|Chaser (2003)|ase|port=3000,port_query_offset=123
chivalry|Chivalry: Medieval Warfare (2012)|valve|port=7777,port_query_offset=2
chrome|Chrome (2003)|ase|port=27015,port_query_offset=123
codenamecure|Codename CURE (2017)|valve|port=27015
codenameeagle|Codename Eagle (2000)|gamespy1|port_query=4711
colonysurvival|Colony Survival (2017)|valve|port=27004
commandos3|Commandos 3: Destination Berlin (2003)|gamespy1|port_query=6500
cacrenegade|Command and Conquer: Renegade (2002)|gamespy1|port=4848,port_query=25300
conanexiles|Conan Exiles (2018)|valve|port=7777,port_query=27015
contagion|Contagion (2011)|valve|port=27015
contactjack|Contract J.A.C.K. (2003)|gamespy1|port_query=27888
corekeeper|Core Keeper (2022)|valve|port=1234,port_query_offset=1
cs15|Counter-Strike 1.5 (2002)|goldsrc|port=27015
cs16|Counter-Strike 1.6 (2003)|valve|port=27015
cs2d|CS2D (2004)|cs2d|port=36963
cscz|Counter-Strike: Condition Zero (2004)|valve|port=27015
css|Counter-Strike: Source (2004)|valve|port=27015
csgo|Counter-Strike: Global Offensive (2012)|valve|port=27015|doc_notes=csgo
cs2|Counter-Strike 2 (2023)|valve|port=27015
creativerse|Creativerse (2017)|valve|port=26900,port_query_offset=1
crossracing|Cross Racing Championship Extreme 2005 (2005)|ase|port=12321,port_query_offset=123
crysis|Crysis (2007)|gamespy3|port=64087
crysiswars|Crysis Wars (2008)|gamespy3|port=64100
crysis2|Crysis 2 (2011)|gamespy3|port=64000
dab|Double Action: Boogaloo (2014)|valve|port=27015
daikatana|Daikatana (2000)|quake2|port=27982,port_query_offset=10
dmomam|Dark Messiah of Might and Magic (2006)|valve|port=27015
darkesthour|Darkest Hour: Europe '44-'45 (2008)|unreal2|port=7757,port_query_offset=1
dayofdragons|Day of Dragons (2019)|valve|port=7777,port_query=27015
daysofwar|Days of War (2017)|valve|port=27015
dayz|DayZ (2018)|valve|port=2302,port_query_offset=24714
dayzmod|DayZ Mod (2013)|valve|port=2302,port_query_offset=1
deadlydozenpt|Deadly Dozen: Pacific Theater (2002)|gamespy1|port_query=25300
dh2005|Deer Hunter 2005 (2004)|gamespy2|port=23459,port_query=34567
descent3|Descent 3 (1999)|gamespy1|port=2092,port_query=20142
deusex|Deus Ex (2000)|gamespy2|port=7791,port_query_offset=1
devastation|Devastation (2003)|unreal2|port=7777,port_query_offset=1
dinodday|Dino D-Day (2011)|valve|port=27015
dirttrackracing2|Dirt Track Racing 2 (2002)|gamespy1|port=32240,port_query_offset=-100
discord|Discord|discord||doc_notes=discord
dmc|Deathmatch Classic (2001)|valve|port=27015
dnl|Dark and Light (2017)|valve|port=7777,port_query=27015
dod|Day of Defeat (2003)|valve|port=27015
dods|Day of Defeat: Source (2005)|valve|port=27015
doi|Day of Infamy (2017)|valve|port=27015
doom3|Doom 3 (2004)|doom3|port=27666
dota2|Dota 2 (2013)|valve|port=27015
drakan|Drakan: Order of the Flame (1999)|gamespy1|port=27045,port_query_offset=1
dst|Don't Starve Together (2016)|valve|port=10999,port_query=27016
dys|Dystopia (2005)|valve|port=27015
eco|Eco (2018)|eco|port=3000,port_query_offset=1
em|Empires Mod (2008)|valve|port=27015
empyrion|Empyrion - Galactic Survival (2015)|valve|port=30000,port_query_offset=1
etqw|Enemy Territory: Quake Wars (2007)|doom3|port=3074,port_query=27733
fear|F.E.A.R. (2005)|gamespy2|port_query=27888
f12002|Formula One 2002 (2002)|gamespy1|port_query=3297
f1c9902|F1 Challenge '99-'02 (2002)|gamespy1|port_query=34397
farcry|Far Cry (2004)|ase|port=49001,port_query_offset=123
farcry2|Far Cry 2 (2008)|ase|port_query=14001
fof|Fistful of Frags (2014)|valve|port=27015
fortressforever|Fortress Forever (2007)|valve|port=27015
operationflashpoint,flashpoint|Operation Flashpoint: Cold War Crisis (2001)|gamespy1|port=2302,port_query_offset=1
flashpointresistance|Operation Flashpoint: Resistance (2002)|gamespy1|port=2302,port_query_offset=1
ffow|Frontlines: Fuel of War (2008)|ffow|port=5476,port_query_offset=2
fivem|Grand Theft Auto V - FiveM (2013)|fivem|port=30120
forrest|The Forrest (2014)|valve|port=27015,port_query_offset=1
garrysmod|Garry's Mod (2004)|valve|port=27015
graw|Tom Clancy's Ghost Recon Advanced Warfighter (2006)|gamespy2|port_query=15250
graw2|Tom Clancy's Ghost Recon Advanced Warfighter 2 (2007)|gamespy2|port_query=16250
giantscitizenkabuto|Giants: Citizen Kabuto (2000)|gamespy1|port_query=8911
globaloperations|Global Operations (2002)|gamespy1|port_query=28672
geneshift,mutantfactions|Geneshift (2017)|geneshift|port=11235
ges|GoldenEye: Source (2010)|valve|port=27015
gore|Gore: Ultimate Soldier (2002)|gamespy1|port=27777,port_query_offset=1
groundbreach|Ground Breach (2018)|valve|port=27015
gunmanchronicles|Gunman Chronicles (2000)|valve|port=27015
hldm|Half-Life Deathmatch (1998)|valve|port=27015
hldms|Half-Life Deathmatch: Source (2005)|valve|port=27015
hlopfor|Half-Life: Opposing Force (1999)|valve|port=27015
hl2dm|Half-Life 2: Deathmatch (2004)|valve|port=27015
halo|Halo (2003)|gamespy2|port=2302
halo2|Halo 2 (2007)|gamespy2|port=2302
heretic2|Heretic II (1998)|gamespy1|port=27900,port_query_offset=1
hexen2|Hexen II (1997)|hexen2|port=26900,port_query_offset=50
hidden|The Hidden (2005)|valve|port=27015
hll|Hell Let Loose|valve|port=27015
had2|Hidden & Dangerous 2 (2003)|gamespy1|port=11001,port_query_offset=3
homefront|Homefront (2011)|valve|port=27015
homeworld2|Homeworld 2 (2003)|gamespy1|port_query=6500
hurtworld|Hurtworld (2015)|valve|port=12871,port_query=12881
igi2|I.G.I.-2: Covert Strike (2003)|gamespy1|port_query=26001
il2|IL-2 Sturmovik (2001)|gamespy1|port_query=21000
insurgency|Insurgency (2014)|valve|port=27015
insurgencymic|Insurgency: Modern Infantry Combat (2007)|valve|port=27015
insurgencysandstorm|Insurgency: Sandstorm (2018)|valve|port=27015,port_query_offset=1
ironstorm|Iron Storm (2002)|gamespy1|port_query=3505
isle|The Isle (2015)|valve|port=7707,port_query_offset=1
jamesbondnightfire|James Bond 007: Nightfire (2002)|gamespy1|port_query=6550
jc2mp|Just Cause 2 - Multiplayer (2010)|jc2mp|port=7777
jc3mp|Just Cause 3 - Multiplayer (2017)|valve|port=4200,port_query_offset=1
killingfloor|Killing Floor (2009)|unreal2|port=7707,port_query_offset=1
killingfloor2|Killing Floor 2 (2016)|valve|port=7777,port_query=27015
kingpin|Kingpin: Life of Crime (1999)|gamespy1|port=31510,port_query_offset=-10
kisspc|Kiss: Psycho Circus: The Nightmare Child (2000)|gamespy1|port=7777,port_query_offset=1
kspdmp|Kerbal Space Program - DMP Multiplayer (2015)|kspdmp|port=6702,port_query_offset=1
kzmod|Kreedz Climbing (2017)|valve|port=27015
left4dead|Left 4 Dead (2008)|valve|port=27015
left4dead2|Left 4 Dead 2 (2009)|valve|port=27015
m2mp|Mafia II - Multiplayer (2010)|mafia2mp|port=27016,port_query_offset=1
m2o|Mafia II - Online (2010)|mafia2online|port=27015,port_query_offset=1
medievalengineers|Medieval Engineers (2015)|valve|port=27015
mohaa|Medal of Honor: Allied Assault (2002)|gamespy1|port=12203,port_query_offset=97
mohsh|Medal of Honor: Allied Assault Spearhead (2002)|gamespy1|port=12203,port_query_offset=97
mohbt|Medal of Honor: Allied Assault Breakthrough (2003)|gamespy1|port=12203,port_query_offset=97
mohpa|Medal of Honor: Pacific Assault (2004)|gamespy1|port=13203,port_query_offset=97
mohab|Medal of Honor: Airborne (2007)|gamespy1|port=12203,port_query_offset=97
moh2010|Medal of Honor (2010)|battlefield|port=7673,port_query=48888
mohwf|Medal of Honor: Warfighter (2012)|battlefield|port=25200,port_query_offset=22000
minecraft,minecraftping|Minecraft (2009)|minecraft|port=25565
minecraftpe,minecraftbe|Minecraft: Bedrock Edition (2011)|minecraft|port=19132
mnc|Monday Night Combat (2011)|valve|port=7777,port_query=27016
mordhau|Mordhau (2019)|valve|port=7777,port_query=27015
mtavc|Grand Theft Auto: Vice City - Multi Theft Auto (2002)|ase|port=22003,port_query_offset=123
mtasa|Grand Theft Auto: San Andreas - Multi Theft Auto (2004)|ase|port=22003,port_query_offset=123
mumble|Mumble - GTmurmur Plugin (2005)|mumble|port=64738,port_query=27800|doc_notes=mumble
mumbleping|Mumble - Lightweight (2005)|mumbleping|port=64738|doc_notes=mumble
nascarthunder2004|NASCAR Thunder 2004 (2003)|gamespy2|port_query=13333
netpanzer|netPanzer (2002)|gamespy1|port=3030
nmrih|No More Room in Hell (2011)|valve|port=27015
ns|Natural Selection (2002)|valve|port=27015
ns2|Natural Selection 2 (2012)|valve|port_query_offset=1
nfshp2|Need for Speed: Hot Pursuit 2 (2002)|gamespy1|port_query=61220
nab|Nerf Arena Blast (1999)|gamespy1|port=4444,port_query_offset=1
nwn|Neverwinter Nights (2002)|gamespy2|port_query=5121
nwn2|Neverwinter Nights 2 (2006)|gamespy2|port=5121,port_query=6500
nexuiz|Nexuiz (2005)|quake3|port_query=26000
nitrofamily|Nitro Family (2004)|gamespy1|port_query=25601
nolf|The Operative: No One Lives Forever (2000)|gamespy1|port_query=27888
nolf2|No One Lives Forever 2: A Spy in H.A.R.M.'s Way (2002)|gamespy1|port_query=27890
nucleardawn|Nuclear Dawn (2011)|valve|port=27015
ohd|Operation: Harsh Doorstop (2023)|valve|port=7777,port_query=27005
onset|Onset (2019)|valve|port=7777,port_query_offset=-1
openarena|OpenArena (2005)|quake3|port_query=27960
openttd|OpenTTD (2004)|openttd|port=3979
painkiller|Painkiller|ase|port=3455,port_query_offset=123
pvkii|Pirates, Vikings, and Knights II (2007)|valve|port=27015
pixark|PixARK (2018)|valve|port=7777,port_query=27015
ps|Post Scriptum|squad|port=10037
postal2|Postal 2|gamespy1|port=7777,port_query_offset=1
prey|Prey|doom3|port=27719
primalcarnage|Primal Carnage: Extinction|valve|port=7777,port_query=27015
pc|Project Cars (2015)|valve|port=27015,query_port=1
pc2|Project Cars 2 (2017)|valve|port=27015,query_port=1
prbf2|Project Reality: Battlefield 2 (2005)|gamespy3|port=16567,port_query=29900
przomboid|Project Zomboid|valve|port=16261
quake1|Quake 1: QuakeWorld (1996)|quake1|port=27500
quake2|Quake 2 (1997)|quake2|port=27910
quake3|Quake 3: Arena (1999)|quake3|port=27960
quake4|Quake 4 (2005)|doom3|port=28004
quakelive|Quake Live (2010)|valve|port=27960
ragdollkungfu|Rag Doll Kung Fu|valve|port=27015
r6|Rainbow Six|gamespy1|port_query=2348
r6roguespear|Rainbow Six 2: Rogue Spear|gamespy1|port_query=2346
r6ravenshield|Rainbow Six 3: Raven Shield|gamespy1|port=7777,port_query_offset=1000
rallisportchallenge|RalliSport Challenge|gamespy1|port_query=17500
rallymasters|Rally Masters|gamespy1|port_query=16666
redorchestra|Red Orchestra|unreal2|port=7758,port_query_offset=1
redorchestraost|Red Orchestra: Ostfront 41-45|gamespy1|port=7757,port_query_offset=10
redorchestra2|Red Orchestra 2|valve|port=7777,port_query=27015
redline|Redline|gamespy1|port_query=25252
redm|Red Dead Redemption 2 - RedM (2018)|fivem|port=30120
rtcw|Return to Castle Wolfenstein|quake3|port_query=27960
rfactor|rFactor|rfactor|port=34397,port_query_offset=-100
ricochet|Ricochet|valve|port=27015
riseofnations|Rise of Nations|gamespy1|port_query=6501
risingworld|Rising World (2014)|valve|port=4255
ror2|Risk of Rain 2 (2020)|valve|port=27015,port_query_offset=1
rs2|Rising Storm 2: Vietnam|valve|port=27015
rune|Rune|gamespy1|port=7777,port_query_offset=1
rust|Rust|valve|port=28015
samp|San Andreas Multiplayer|samp|port=7777
saomp|San Andreas OpenMP|samp|port=7777
savage2|Savage 2: A Tortured Soul (2008)|savage2|port_query=11235
spaceengineers|Space Engineers|valve|port=27015
ss|Serious Sam|gamespy1|port=25600,port_query_offset=1
ss2|Serious Sam 2|gamespy2|port=25600
shatteredhorizon|Shattered Horizon|valve|port=27015
ship|The Ship|valve|port=27015
shogo|Shogo|gamespy1|port_query=27888
shootmania|Shootmania|nadeo|port=2350,port_query=5000|doc_notes=nadeo-shootmania--trackmania--etc
sin|SiN|gamespy1|port_query=22450
sinep|SiN Episodes|valve|port=27015
soldat|Soldat|ase|port=13073,port_query_offset=123
sof|Soldier of Fortune|quake1|port_query=28910
sof2|Soldier of Fortune 2|quake3|port_query=20100
sonsoftheforest|Sons Of The Forest (2023)|valve|port=8766,port_query=27016
stalker|S.T.A.L.K.E.R.|gamespy3|port=5445,port_query_offset=2
stn|Survive the Nights (2017)|valve|port=7950,port_query_offset=1
stbc|Star Trek: Bridge Commander|gamespy1|port_query=22101
stvef|Star Trek: Voyager - Elite Force|quake3|port_query=27960
stvef2|Star Trek: Voyager - Elite Force 2|quake3|port_query=29253
squad|Squad|valve|port=7787,port_query=27165
swbf|Star Wars: Battlefront|gamespy2|port_query=3658
swbf2|Star Wars: Battlefront 2|gamespy2|port_query=3658
swjk|Star Wars Jedi Knight: Jedi Academy (2003)|quake3|port_query=29070
swjk2|Star Wars Jedi Knight II: Jedi Outcast (2002)|quake3|port_query=28070
swrc|Star Wars: Republic Commando|gamespy2|port=7777,port_query=11138
starbound|Starbound|valve|port=21025
starmade|StarMade|starmade|port=4242
starsiege|Starsiege (2009)|starsiege|port=29001
suicidesurvival|Suicide Survival|valve|port=27015
swat4|SWAT 4|gamespy2|port=10480,port_query_offset=2
svencoop|Sven Coop|valve|port=27015
synergy|Synergy|valve|port=27015
tacticalops|Tactical Ops|gamespy1|port=7777,port_query_offset=1
takeonhelicopters|Take On Helicopters (2011)|gamespy1|port=2302,port_query_offset=1
teamfactor|Team Factor|gamespy1|port_query=57778
tfc|Team Fortress Classic|valve|port=27015
tf2|Team Fortress 2|valve|port=27015
teamspeak2|Teamspeak 2|teamspeak2|port=8767
teamspeak3|Teamspeak 3|teamspeak3|port=9987|doc_notes=teamspeak3
terminus|Terminus|gamespy1|port_query=12286
terraria,tshock|Terraria - TShock (2011)|terraria|port=7777,port_query_offset=101|doc_notes=terraria
theforest|The Forest (2014)|valve|port=27015,port_query_offset=1
thefront|The Front (2023)|valve|port_query=27015
thps3|Tony Hawk's Pro Skater 3|gamespy1|port_query=6500
thps4|Tony Hawk's Pro Skater 4|gamespy1|port_query=6500
thu2|Tony Hawk's Underground 2|gamespy1|port_query=5153
towerunite|Tower Unite|valve|port=27015
trackmania2|Trackmania 2|nadeo|port=2350,port_query=5000|doc_notes=nadeo-shootmania--trackmania--etc
trackmaniaforever|Trackmania Forever|nadeo|port=2350,port_query=5000|doc_notes=nadeo-shootmania--trackmania--etc
tremulous|Tremulous|quake3|port_query=30720
tribes1|Tribes 1: Starsiege|tribes1|port=28001
tribesvengeance|Tribes: Vengeance|gamespy2|port=7777,port_query_offset=1
tron20|Tron 2.0|gamespy2|port_query=27888
ts|The Specalists|valve|port=27015
turok2|Turok 2|gamespy1|port_query=12880
universalcombat|Universal Combat|ase|port=1135,port_query_offset=123
unreal|Unreal|gamespy1|port=7777,port_query_offset=1
unturned|unturned|valve|port=27015,port_query_offset=1
ut|Unreal Tournament|gamespy1|port=7777,port_query_offset=1
ut2003|Unreal Tournament 2003|unreal2|port=7757,port_query_offset=1
ut2004|Unreal Tournament 2004|unreal2|port=7777,port_query_offset=1
ut3|Unreal Tournament 3|ut3|port=7777,port_query_offset=-1277
urbanterror|Urban Terror|quake3|port_query=27960
v8supercar|V8 Supercar Challenge|gamespy1|port_query=16700
valheim|Valheim (2021)|valve|port=2456,port_query_offset=1|doc_notes=valheim
vcmp|Vice City Multiplayer|vcmp|port=8192
ventrilo|Ventrilo|ventrilo|port=3784
vietcong|Vietcong|gamespy1|port=5425,port_query=15425
vietcong2|Vietcong 2|gamespy2|port=5001,port_query=19967
vrising|V Rising (2022)|valve|port=27015,port_query_offset=1
vs|Vampire Slayer|valve|port=27015
warsow|Warsow|warsow|port=44400
warfork|Warfork|warsow|port_query=44400
wheeloftime|Wheel of Time|gamespy1|port=7777,port_query_offset=1
wolfenstein2009|Wolfenstein 2009|doom3|port=27666
wolfensteinet|Wolfenstein: Enemy Territory|quake3|port_query=27960
wurm|Wurm Unlimited|valve|port=3724,query_port=27016
xpandrally|Xpand Rally|ase|port=28015,port_query_offset=123
zombiemaster|Zombie Master|valve|port=27015
zps|Zombie Panic: Source|valve|port=27015

View file

@ -1,114 +0,0 @@
import * as path from 'node:path'
import { fileURLToPath } from 'node:url'
import * as fs from 'node:fs'
export default class GameResolver {
constructor () {
const loaded = this._readGames()
this.gamesByKey = loaded.gamesByKey
this.games = loaded.games
}
lookup (type) {
if (!type) { throw Error('No game specified') }
if (type.startsWith('protocol-')) {
return {
protocol: type.substring(9)
}
}
const game = this.gamesByKey.get(type)
if (!game) { throw Error('Invalid game: ' + type) }
return game.options
}
printReadme () {
let out = ''
out += '| GameDig Type ID | Name | See Also\n'
out += '|---|---|---\n'
const sorted = this.games
.filter(game => game.pretty)
.sort((a, b) => {
return a.pretty.localeCompare(b.pretty)
})
for (const game of sorted) {
const keysOut = game.keys.map(key => '`' + key + '`').join('<br>')
out += '| ' + keysOut.padEnd(10, ' ') + ' ' +
'| ' + game.pretty
const notes = []
if (game.extra.doc_notes) {
notes.push('[Notes](#' + game.extra.doc_notes + ')')
}
if (game.options.protocol === 'valve') {
notes.push('[Valve Protocol](#valve)')
}
if (notes.length) {
out += ' | ' + notes.join(', ')
}
out += '\n'
}
return out
}
_readGames () {
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const gamesFile = path.normalize(__dirname + '/../games.txt')
const lines = fs.readFileSync(gamesFile, 'utf8').split('\n')
const gamesByKey = new Map()
const games = []
for (let line of lines) {
// strip comments
const comment = line.indexOf('#')
if (comment !== -1) line = line.substring(0, comment)
line = line.trim()
if (!line) continue
const split = line.split('|')
const keys = split[0].trim().split(',')
const name = split[1].trim()
const options = this._parseList(split[3])
options.protocol = split[2].trim()
const extra = this._parseList(split[4])
const game = {
keys,
pretty: name,
options,
extra
}
for (const key of keys) {
gamesByKey.set(key, game)
}
games.push(game)
}
return { gamesByKey, games }
}
_parseList (str) {
if (!str) { return {} }
const out = {}
for (const one of str.split(',')) {
const equals = one.indexOf('=')
const key = equals === -1 ? one : one.substring(0, equals)
/** @type {string|number|boolean} */
let value = equals === -1 ? '' : one.substring(equals + 1)
if (value === 'true' || value === '') { value = true } else if (value === 'false') { value = false } else if (!isNaN(parseInt(value))) { value = parseInt(value) }
out[key] = value
}
return out
}
}

View file

@ -1,4 +1,4 @@
import GameResolver from './GameResolver.js'
import { lookup } from './game-resolver.js'
import { getProtocol } from './ProtocolResolver.js'
import GlobalUdpSocket from './GlobalUdpSocket.js'
@ -14,7 +14,6 @@ export default class QueryRunner {
this.udpSocket = new GlobalUdpSocket({
port: runnerOpts.listenUdpPort
})
this.gameResolver = new GameResolver()
}
async run (userOptions) {
@ -29,7 +28,7 @@ export default class QueryRunner {
port_query: gameQueryPort,
port_query_offset: gameQueryPortOffset,
...gameOptions
} = this.gameResolver.lookup(userOptions.type)
} = lookup(userOptions.type)
const attempts = []
const optionsCollection = {
@ -78,7 +77,7 @@ export default class QueryRunner {
} finally {
// Deno doesn't support unref, so we must close the socket after every connection
// https://github.com/denoland/deno/issues/20138
if (typeof Deno !== "undefined") {
if (typeof Deno !== 'undefined') {
this.udpSocket?.socket?.close()
delete this.udpSocket
}

17
lib/game-resolver.js Normal file
View file

@ -0,0 +1,17 @@
import { games } from './games.js'
export const lookup = (type) => {
if (!type) { throw Error('No game specified') }
if (type.startsWith('protocol-')) {
return {
protocol: type.substring(9)
}
}
const game = games[type]
if (!game) { throw Error('Invalid game: ' + type) }
return game.options
}

2404
lib/games.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,10 @@
#!/usr/bin/env node
import * as fs from 'node:fs'
import GameResolver from '../lib/GameResolver.js'
import { games } from '../lib/games.js'
import { fileURLToPath } from 'node:url'
import { dirname } from 'node:path'
const gameResolver = new GameResolver()
const generated = gameResolver.printReadme()
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
@ -18,6 +14,32 @@ const readme = fs.readFileSync(readmeFilename, { encoding: 'utf8' })
const markerTop = '<!--- BEGIN GENERATED GAMES -->'
const markerBottom = '<!--- END GENERATED GAMES -->'
const sortedGamesIds = Object.keys(games).sort()
const sortedGames = {}
sortedGamesIds.forEach(key => {
sortedGames[key] = games[key]
})
let generated = ''
generated += '| GameDig Type ID | Name | See Also\n'
generated += '|---|---|---\n'
for (const id in sortedGames) {
const game = sortedGames[id]
generated += '| ' + id.padEnd(10, ' ') + ' | ' + game.name
const notes = []
if (game?.extra?.doc_notes) {
notes.push('[Notes](#' + game.extra.doc_notes + ')')
}
if (game.options.protocol === 'valve') {
notes.push('[Valve Protocol](#valve)')
}
if (notes.length) {
generated += ' | ' + notes.join(', ')
}
generated += '\n'
}
let start = readme.indexOf(markerTop)
start += markerTop.length
const end = readme.indexOf(markerBottom)