Skip to content

Commit

Permalink
feat: Add support for Battlefield 1942 expansion packs
Browse files Browse the repository at this point in the history
  • Loading branch information
cetteup committed Apr 23, 2022
1 parent 01052ec commit b131088
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 6 deletions.
56 changes: 50 additions & 6 deletions game/titles/t_bf1942.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,56 @@ var Bf1942 = title.GameTitle{
DefaultArgs: []string{"+restart", "1"},
ExecutablePath: "BF1942.exe",
},
CmdBuilder: func(installPath string, scheme string, host string, port string, u *url.URL) ([]string, error) {
args := []string{
"+joinServer", host,
"+port", port,
}
CmdBuilder: bf1942CmdBuilder,
}

var bf1942CmdBuilder launcher.CommandBuilder = func(installPath string, scheme string, host string, port string, u *url.URL) ([]string, error) {
args := []string{
"+joinServer", host,
"+port", port,
}

return args, nil
}

return args, nil
var Bf1942RoadToRome = title.GameTitle{
ProtocolScheme: "bf1942rtr",
GameLabel: "Battlefield 1942: The Road to Rome",
RequiresPort: true,
FinderConfigs: []finder.Config{
{
ForType: finder.RegistryFinder,
RegistryPath: "SOFTWARE\\WOW6432Node\\EA Games\\Battlefield 1942 Xpack1",
RegistryValueName: "GAMEDIR",
},
},
LauncherConfig: launcher.Config{
DefaultArgs: []string{
"+restart", "1",
"+game", "XPack1",
},
ExecutablePath: "BF1942.exe",
},
CmdBuilder: bf1942CmdBuilder,
}

var Bf1942SecretWeaponsOfWW2 = title.GameTitle{
ProtocolScheme: "bf1942sw",
GameLabel: "Battlefield 1942: Secret Weapons of WWII",
RequiresPort: true,
FinderConfigs: []finder.Config{
{
ForType: finder.RegistryFinder,
RegistryPath: "SOFTWARE\\WOW6432Node\\EA Games\\Battlefield 1942 Xpack2",
RegistryValueName: "GAMEDIR",
},
},
LauncherConfig: launcher.Config{
DefaultArgs: []string{
"+restart", "1",
"+game", "XPack2",
},
ExecutablePath: "BF1942.exe",
},
CmdBuilder: bf1942CmdBuilder,
}
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ func init() {
gameFinder := finder.NewSoftwareFinder(registryRepository)
gameRouter = router.NewGameRouter(registryRepository, gameFinder)
gameRouter.AddTitle(titles.Bf1942)
gameRouter.AddTitle(titles.Bf1942RoadToRome)
gameRouter.AddTitle(titles.Bf1942SecretWeaponsOfWW2)
gameRouter.AddTitle(titles.BfVietnam)
gameRouter.AddTitle(titles.Bf2)
gameRouter.AddTitle(titles.Bf2SF)
Expand Down

0 comments on commit b131088

Please sign in to comment.