Skip to content

Commit

Permalink
feat: Add mod support for Battlefield 1942
Browse files Browse the repository at this point in the history
  • Loading branch information
cetteup committed Apr 23, 2022
1 parent b131088 commit a828cb6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions game/titles/t_bf1942.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ import (
"net/url"
)

const (
bf1942ModBasePath = "Mods"
bf1942ModRoadToRome = "Xpack1"
bf1942ModSecretWeaponsOfWW2 = "Xpack2"
bf1942Mod1918 = "bf1918"
bf1942ModDCFinal = "DC_Final"
bf1942ModDesertCombat = "DesertCombat"
bf1942ModPirates = "Pirates"
)

var Bf1942 = title.GameTitle{
ProtocolScheme: "bf1942",
GameLabel: "Battlefield 1942",
Expand All @@ -31,6 +41,21 @@ var bf1942CmdBuilder launcher.CommandBuilder = func(installPath string, scheme s
"+port", port,
}

query := u.Query()
if query != nil && query.Has(UrlQueryKeyMod) {
mod, err := getValidMod(
installPath,
bf1942ModBasePath,
query.Get(UrlQueryKeyMod),
bf1942ModRoadToRome, bf1942ModSecretWeaponsOfWW2, bf1942Mod1918, bf1942ModDesertCombat, bf1942ModDCFinal, bf1942ModPirates,
)
if err != nil {
return nil, err
}

args = append(args, "+game", mod)
}

return args, nil
}

Expand Down

0 comments on commit a828cb6

Please sign in to comment.