From 1f7ddcfd90eb7d9dec99a025bcc768af502220cf Mon Sep 17 00:00:00 2001 From: fgsfds <4870330+fgsfds@users.noreply.github.com> Date: Thu, 26 Sep 2024 12:27:35 +0500 Subject: [PATCH] fixed duke addons launch with eduke32 --- README.md | 1 - src/Common/Helpers/Extensions.cs | 30 ++++++-- src/Games/Games/BaseGame.cs | 21 ----- src/Games/Games/DukeGame.cs | 76 +++++++++++++++++- src/Games/Providers/GamesPathsProvider.cs | 2 +- src/Ports/Ports/EDuke32/EDuke32.cs | 77 +++++++++++++------ src/Ports/Ports/EDuke32/RedNukem.cs | 3 + src/Ports/Ports/Raze.cs | 33 ++++---- .../CmdArguments/BloodCmdArgumentsTests.cs | 7 +- .../CmdArguments/DukeCmdArgumentsTests.cs | 25 +++--- .../CmdArguments/FuryCmdArgumentsTests.cs | 2 +- .../CmdArguments/RedneckCmdArgumentsTests.cs | 4 +- .../CmdArguments/SlaveCmdArgumentsTests.cs | 3 +- .../CmdArguments/WangCmdArgumentsTests.cs | 6 +- 14 files changed, 191 insertions(+), 99 deletions(-) diff --git a/README.md b/README.md index 2577c087..cd4b1fec 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,6 @@ Another goal of this project is to create a unification standard for Build Engin -- Caribbean and Duke it out in DC can't be launched with EDuke32 and RedNukem - Wanton Destruction launched from Raze has episodes and maps names from the original game unless downloaded from the lancher - Skip intro checkbox doesn't work with RedNukem diff --git a/src/Common/Helpers/Extensions.cs b/src/Common/Helpers/Extensions.cs index 6fa86af6..827cd95b 100644 --- a/src/Common/Helpers/Extensions.cs +++ b/src/Common/Helpers/Extensions.cs @@ -43,11 +43,11 @@ public static string ToTimeString(this TimeSpan time) { if (time.TotalSeconds > 2) { - sb.Append($" {time.Seconds} seconds"); + _ = sb.Append($" {time.Seconds} seconds"); } else if (time.TotalSeconds >= 1) { - sb.Append($" {time.Seconds} second"); + _ = sb.Append($" {time.Seconds} second"); } return sb.ToString(); @@ -56,22 +56,40 @@ public static string ToTimeString(this TimeSpan time) if (time.TotalHours >= 2) { - sb.Append($" {(int)time.TotalHours} hours"); + _ = sb.Append($" {(int)time.TotalHours} hours"); } else if (time.TotalHours >= 1) { - sb.Append($" {(int)time.TotalHours} hour"); + _ = sb.Append($" {(int)time.TotalHours} hour"); } if (time.Minutes >= 2) { - sb.Append($" {time.Minutes} minutes"); + _ = sb.Append($" {time.Minutes} minutes"); } else if (time.Minutes >= 1) { - sb.Append($" {time.Minutes} minute"); + _ = sb.Append($" {time.Minutes} minute"); } return sb.Replace(" ", " ").ToString(); } + + /// + /// Add new element or replace value of and existing element + /// + /// Dictionary + /// Key + /// Value + public static void AddOrReplace(this IDictionary dict, TKey key, TValue value) + { + if (dict.ContainsKey(key)) + { + dict[key] = value; + } + else + { + dict.Add(key, value); + } + } } diff --git a/src/Games/Games/BaseGame.cs b/src/Games/Games/BaseGame.cs index 036ef271..72a084a7 100644 --- a/src/Games/Games/BaseGame.cs +++ b/src/Games/Games/BaseGame.cs @@ -94,25 +94,4 @@ protected bool IsInstalled(List files, string? path = null) return true; } - - - /// - /// Does the file exist in the game install folder - /// - /// File - protected bool IsInstalled(string file) - { - if (GameInstallFolder is null) - { - return false; - } - - if (!File.Exists(Path.Combine(GameInstallFolder, file)) && - !File.Exists(Path.Combine(GameInstallFolder, "addons", file))) - { - return false; - } - - return true; - } } diff --git a/src/Games/Games/DukeGame.cs b/src/Games/Games/DukeGame.cs index 616718cd..3cb4bebf 100644 --- a/src/Games/Games/DukeGame.cs +++ b/src/Games/Games/DukeGame.cs @@ -38,17 +38,17 @@ public sealed class DukeGame : BaseGame /// /// Is Duke it Out in DC installed /// - public bool IsDukeDCInstalled => IsInstalled("DUKEDC.GRP"); + public bool IsDukeDCInstalled => GetDukeAddon(DukeAddonEnum.DukeDC); /// /// Is Nuclear Winter installed /// - public bool IsNuclearWinterInstalled => IsInstalled("NWINTER.GRP"); + public bool IsNuclearWinterInstalled => GetDukeAddon(DukeAddonEnum.DukeNW); /// /// Is Caribbean installed /// - public bool IsCaribbeanInstalled => IsInstalled("VACATION.GRP"); + public bool IsCaribbeanInstalled => GetDukeAddon(DukeAddonEnum.DukeVaca); /// /// Is World Tour installed @@ -60,6 +60,11 @@ public sealed class DukeGame : BaseGame /// public bool IsDuke64Installed => File.Exists(Duke64RomPath); + /// + /// List of paths to Duke's addons folders + /// + public Dictionary AddonsPaths { get; set; } = []; + public DukeGame() : base() { @@ -303,4 +308,69 @@ private void CreateWTStopgapFolder() archive.ExtractToDirectory(stopgapFolder); } + + + /// + /// Find Duke's addon files + /// + /// Duke addon + private bool GetDukeAddon(DukeAddonEnum addon) + { + if (GameInstallFolder is null) + { + return false; + } + + var file = addon switch + { + DukeAddonEnum.DukeDC => "DUKEDC.GRP", + DukeAddonEnum.DukeNW => "NWINTER.GRP", + DukeAddonEnum.DukeVaca => "VACATION.GRP", + DukeAddonEnum.Base => throw new NotImplementedException(), + _ => throw new NotImplementedException(), + }; + + //root + var path = Path.Combine(GameInstallFolder, file); + if (File.Exists(path)) + { + AddonsPaths.AddOrReplace(addon, Path.GetDirectoryName(path)); + return true; + } + + //zoom + path = Path.Combine(GameInstallFolder, "AddOns", file); + if (File.Exists(path)) + { + AddonsPaths.AddOrReplace(addon, Path.GetDirectoryName(path)); + return true; + } + + //megaton + path = Path.Combine(GameInstallFolder, "addons", "dc", file); + if (File.Exists(path)) + { + AddonsPaths.AddOrReplace(addon, Path.GetDirectoryName(path)); + return true; + } + + //megaton + path = Path.Combine(GameInstallFolder, "addons", "nw", file); + if (File.Exists(path)) + { + AddonsPaths.AddOrReplace(addon, Path.GetDirectoryName(path)); + return true; + } + + //megaton + path = Path.Combine(GameInstallFolder, "addons", "vacation", file); + if (File.Exists(path)) + { + AddonsPaths.AddOrReplace(addon, Path.GetDirectoryName(path)); + return true; + } + + _ = AddonsPaths.Remove(addon); + return false; + } } diff --git a/src/Games/Providers/GamesPathsProvider.cs b/src/Games/Providers/GamesPathsProvider.cs index 58c309c6..0e1d7f42 100644 --- a/src/Games/Providers/GamesPathsProvider.cs +++ b/src/Games/Providers/GamesPathsProvider.cs @@ -54,7 +54,7 @@ public GamesPathsProvider(IConfigProvider config) } //Megaton - pathToGame = Path.Combine(lib, "Duke Nukem 3D", "gameroot", "classic"); + pathToGame = Path.Combine(lib, "Duke Nukem 3D", "gameroot"); if (Directory.Exists(pathToGame)) { _dukePath ??= pathToGame; diff --git a/src/Ports/Ports/EDuke32/EDuke32.cs b/src/Ports/Ports/EDuke32/EDuke32.cs index 4e37fe0d..e007d69d 100644 --- a/src/Ports/Ports/EDuke32/EDuke32.cs +++ b/src/Ports/Ports/EDuke32/EDuke32.cs @@ -174,33 +174,57 @@ protected void GetDukeArgs(StringBuilder sb, DukeGame game, IAddon addon) } else { - var dukeAddon = (byte)DukeAddonEnum.Base; + _ = sb.Append($@" {AddDirectoryParam}""{game.GameInstallFolder}"""); - if (addon.DependentAddons is null) - { - dukeAddon = (byte)DukeAddonEnum.Base; - } - else if (addon.DependentAddons.ContainsKey(nameof(DukeAddonEnum.DukeDC))) - { - dukeAddon = (byte)DukeAddonEnum.DukeDC; - } - else if (addon.DependentAddons.ContainsKey(nameof(DukeAddonEnum.DukeNW))) - { - dukeAddon = (byte)DukeAddonEnum.DukeNW; - } - else if (addon.DependentAddons.ContainsKey(nameof(DukeAddonEnum.DukeVaca))) + if (addon.DependentAddons is not null) { - dukeAddon = (byte)DukeAddonEnum.DukeVaca; - } + //DUKE IT OUT IN DC + if (addon.DependentAddons.ContainsKey(nameof(DukeAddonEnum.DukeDC))) + { + var addonPath = game.AddonsPaths[DukeAddonEnum.DukeDC]; - _ = sb.Append($@" {AddDirectoryParam}""{game.GameInstallFolder}"""); + if (!addonPath.Equals(game.GameInstallFolder)) + { + _ = sb.Append($@" {AddDirectoryParam}""{addonPath}"""); + } - if (Directory.Exists(Path.Combine(game.GameInstallFolder!, "AddOns"))) - { - _ = sb.Append($@" {AddDirectoryParam}""{Path.Combine(game.GameInstallFolder!, "AddOns")}"""); - } + _ = sb.Append($@" {AddGrpParam}DUKEDC.GRP"); - _ = sb.Append($" -addon {dukeAddon}"); + if (File.Exists(Path.Combine(addonPath, "DUKEDC.CON"))) + { + _ = sb.Append($@" {MainConParam}DUKEDC.CON"); + } + } + //NUCLEAR WINTER + else if (addon.DependentAddons.ContainsKey(nameof(DukeAddonEnum.DukeNW))) + { + var addonPath = game.AddonsPaths[DukeAddonEnum.DukeNW]; + + if (!addonPath.Equals(game.GameInstallFolder)) + { + _ = sb.Append($@" {AddDirectoryParam}""{addonPath}"""); + } + + _ = sb.Append($@" {AddGrpParam}NWINTER.GRP {MainConParam}NWINTER.CON"); + } + //CARIBBEAN + else if (addon.DependentAddons.ContainsKey(nameof(DukeAddonEnum.DukeVaca))) + { + var addonPath = game.AddonsPaths[DukeAddonEnum.DukeVaca]; + + if (!addonPath.Equals(game.GameInstallFolder)) + { + _ = sb.Append($@" {AddDirectoryParam}""{addonPath}"""); + } + + _ = sb.Append($@" {AddGrpParam}VACATION.GRP"); + + if (File.Exists(Path.Combine(addonPath, "VACATION.CON"))) + { + _ = sb.Append($@" {MainConParam}VACATION.CON"); + } + } + } } @@ -260,7 +284,7 @@ protected override void GetAutoloadModsArgs(StringBuilder sb, IGame game, IAddon return; } - _ = sb.Append($@" {AddDirectoryParam}""{game.ModsFolderPath}"""); + var enabledModsCount = 0; foreach (var mod in mods) { @@ -291,6 +315,13 @@ protected override void GetAutoloadModsArgs(StringBuilder sb, IGame game, IAddon _ = sb.Append($@" {AddConParam}""{con}"""); } } + + enabledModsCount++; + } + + if (enabledModsCount > 0) + { + _ = sb.Append($@" {AddDirectoryParam}""{game.ModsFolderPath}"""); } } diff --git a/src/Ports/Ports/EDuke32/RedNukem.cs b/src/Ports/Ports/EDuke32/RedNukem.cs index aa05ed2a..654bbded 100644 --- a/src/Ports/Ports/EDuke32/RedNukem.cs +++ b/src/Ports/Ports/EDuke32/RedNukem.cs @@ -23,6 +23,9 @@ public sealed class RedNukem : EDuke32 /// public override string Name => "RedNukem"; + /// + protected override string AddGrpParam => "-g "; + /// public override List SupportedGames => [ diff --git a/src/Ports/Ports/Raze.cs b/src/Ports/Ports/Raze.cs index e7fa13f7..321ef61e 100644 --- a/src/Ports/Ports/Raze.cs +++ b/src/Ports/Ports/Raze.cs @@ -141,7 +141,7 @@ protected override void BeforeStart(IGame game, IAddon campaign) File.WriteAllText(config, DefaultConfig); } - AddGamePathsToConfig(game.GameInstallFolder!, game.ModsFolderPath, config, campaign); + AddGamePathsToConfig(game, campaign, game.GameInstallFolder!, config); FixRoute66Files(game, campaign); } @@ -214,7 +214,7 @@ private void GetDukeArgs(StringBuilder sb, DukeGame game, IAddon addon) { var config = Path.Combine(PathToExecutableFolder, ConfigFile); - AddGamePathsToConfig(game.DukeWTInstallPath!, game.ModsFolderPath, config, addon); + AddGamePathsToConfig(game, addon, game.DukeWTInstallPath!, config); _ = sb.Append($" -addon {(byte)DukeAddonEnum.Base}"); } @@ -350,7 +350,7 @@ private void GetRedneckArgs(StringBuilder sb, RedneckGame game, IAddon addon) if (rCamp.Id.Equals(nameof(GameEnum.RidesAgain), StringComparison.OrdinalIgnoreCase)) { var pathToConfig = Path.Combine(PathToExecutableFolder, ConfigFile); - AddGamePathsToConfig(game.AgainInstallPath!, game.ModsFolderPath, pathToConfig, addon); + AddGamePathsToConfig(game, addon, game.AgainInstallPath!, pathToConfig); } @@ -480,8 +480,7 @@ private void FixRoute66Files(IGame game, IAddon _) /// /// Add paths to game and mods folder to the config /// - [Obsolete("Remove if this ever implemented https://github.com/ZDoom/Raze/issues/1060")] - private static void AddGamePathsToConfig(string gameFolder, string modsFolder, string config, IAddon campaign) + private static void AddGamePathsToConfig(IGame game, IAddon campaign, string gameInstallFolder, string config) { var contents = File.ReadAllLines(config); @@ -493,12 +492,18 @@ private static void AddGamePathsToConfig(string gameFolder, string modsFolder, s { _ = sb.AppendLine(contents[i]); - var path = gameFolder.Replace('\\', '/'); + //game folder + var path = gameInstallFolder.Replace('\\', '/'); _ = sb.Append("Path=").AppendLine(path); - if (Directory.Exists(Path.Combine(gameFolder, "addons"))) + //duke addons folders + if (game is DukeGame dGame) { - _ = sb.Append("Path=").AppendLine(path + "/addons"); + foreach (var folder in dGame.AddonsPaths) + { + path = folder.Value.Replace('\\', '/'); + _ = sb.Append("Path=").AppendLine(path); + } } do @@ -515,17 +520,11 @@ private static void AddGamePathsToConfig(string gameFolder, string modsFolder, s { _ = sb.AppendLine(contents[i]); - var path = gameFolder.Replace('\\', '/'); - _ = sb.Append("Path=").AppendLine(path); - - if (Directory.Exists(Path.Combine(gameFolder, "addons"))) - { - _ = sb.Append("Path=").AppendLine(path + "/addons"); - } - - path = modsFolder.Replace('\\', '/'); + //mods folder + var path = game.ModsFolderPath.Replace('\\', '/'); _ = sb.Append("Path=").AppendLine(path); + //blood unpacked addons if (campaign is BloodCampaign bCamp && bCamp.IsUnpacked) { diff --git a/src/Tests/CmdArguments/BloodCmdArgumentsTests.cs b/src/Tests/CmdArguments/BloodCmdArgumentsTests.cs index 22a24d75..4528eda4 100644 --- a/src/Tests/CmdArguments/BloodCmdArgumentsTests.cs +++ b/src/Tests/CmdArguments/BloodCmdArgumentsTests.cs @@ -139,7 +139,6 @@ public void RazeTest() Path=D:/Games/Blood [FileSearch.Directories] - Path=D:/Games/Blood Path={Directory.GetCurrentDirectory()}/Data/Blood/Mods [SoundfontSearch.Directories] @@ -184,7 +183,6 @@ public void RazeCpTest() Path=D:/Games/Blood [FileSearch.Directories] - Path=D:/Games/Blood Path={Directory.GetCurrentDirectory()}/Data/Blood/Mods [SoundfontSearch.Directories] @@ -214,7 +212,6 @@ public void RazeTCTest() Path=D:/Games/Blood [FileSearch.Directories] - Path=D:/Games/Blood Path={Directory.GetCurrentDirectory()}/Data/Blood/Mods [SoundfontSearch.Directories] @@ -242,7 +239,7 @@ public void NBloodTest() NBlood nblood = new(); var args = nblood.GetStartGameArgs(_bloodGame, _bloodCamp, mods, true, true, 2); - var expected = @$" -quick -nosetup -j ""{Directory.GetCurrentDirectory()}\Data\Blood\Mods"" -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -g ""mod_incompatible_with_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -g ""feature_mod.zip"" -usecwd -j ""D:\Games\Blood"" -h ""a"" -s 2"; + var expected = @$" -quick -nosetup -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -g ""mod_incompatible_with_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -g ""feature_mod.zip"" -j ""{Directory.GetCurrentDirectory()}\Data\Blood\Mods"" -usecwd -j ""D:\Games\Blood"" -h ""a"" -s 2"; if (OperatingSystem.IsLinux()) { @@ -274,7 +271,7 @@ public void NBloodCPTest() NBlood nblood = new(); var args = nblood.GetStartGameArgs(_bloodGame, _bloodCpCamp, mods, true, true, 2); - var expected = @$" -quick -nosetup -j ""{Directory.GetCurrentDirectory()}\Data\Blood\Mods"" -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -g ""mod_requires_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -g ""feature_mod.zip"" -usecwd -j ""D:\Games\Blood"" -h ""a"" -ini ""CRYPTIC.INI"" -s 2"; + var expected = @$" -quick -nosetup -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -g ""mod_requires_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -g ""feature_mod.zip"" -j ""{Directory.GetCurrentDirectory()}\Data\Blood\Mods"" -usecwd -j ""D:\Games\Blood"" -h ""a"" -ini ""CRYPTIC.INI"" -s 2"; if (OperatingSystem.IsLinux()) { diff --git a/src/Tests/CmdArguments/DukeCmdArgumentsTests.cs b/src/Tests/CmdArguments/DukeCmdArgumentsTests.cs index 16b57651..a3c09c0b 100644 --- a/src/Tests/CmdArguments/DukeCmdArgumentsTests.cs +++ b/src/Tests/CmdArguments/DukeCmdArgumentsTests.cs @@ -16,7 +16,7 @@ public sealed class DukeCmdArgumentsTests private readonly DukeGame _dukeGame; private readonly DukeCampaign _dukeCamp; private readonly DukeCampaign _dukeVaca; - private readonly DukeCampaign _dukeTC; + private readonly DukeCampaign _dukeTcForVaca; private readonly DukeCampaign _dukeWtCamp; private readonly DukeCampaign _duke64Camp; @@ -30,7 +30,8 @@ public DukeCmdArgumentsTests() { Duke64RomPath = Path.Combine("D:", "Games", "Duke64", "rom.z64"), DukeWTInstallPath = Path.Combine("D:", "Games", "DukeWT"), - GameInstallFolder = Path.Combine("D:", "Games", "Duke3D") + GameInstallFolder = Path.Combine("D:", "Games", "Duke3D"), + AddonsPaths = new() { {DukeAddonEnum.DukeVaca , Path.Combine("D:", "Games", "Duke3D", "Vaca") } } }; _dukeCamp = new() @@ -129,7 +130,7 @@ public DukeCmdArgumentsTests() IsUnpacked = false }; - _dukeTC = new() + _dukeTcForVaca = new() { Id = "duke-tc", Type = AddonTypeEnum.TC, @@ -190,9 +191,9 @@ public void RazeTest() Assert.StartsWith($""" [GameSearch.Directories] Path=D:/Games/Duke3D + Path=D:/Games/Duke3D/Vaca [FileSearch.Directories] - Path=D:/Games/Duke3D Path={Directory.GetCurrentDirectory()}/Data/Duke3D/Mods [SoundfontSearch.Directories] @@ -220,9 +221,9 @@ public void RazeWtTest() Assert.StartsWith($""" [GameSearch.Directories] Path=D:/Games/DukeWT + Path=D:/Games/Duke3D/Vaca [FileSearch.Directories] - Path=D:/Games/DukeWT Path={Directory.GetCurrentDirectory()}/Data/Duke3D/Mods [SoundfontSearch.Directories] @@ -256,9 +257,9 @@ public void RazeVacaTest() Assert.StartsWith($""" [GameSearch.Directories] Path=D:/Games/Duke3D + Path=D:/Games/Duke3D/Vaca [FileSearch.Directories] - Path=D:/Games/Duke3D Path={Directory.GetCurrentDirectory()}/Data/Duke3D/Mods [SoundfontSearch.Directories] @@ -270,7 +271,7 @@ public void RazeTCTest() { Raze raze = new(); - var args = raze.GetStartGameArgs(_dukeGame, _dukeTC, [], true, true); + var args = raze.GetStartGameArgs(_dukeGame, _dukeTcForVaca, [], true, true); var expected = @$" -quick -nosetup -savedir ""{Directory.GetCurrentDirectory()}\Data\Ports\Raze\Save\duke-tc"" -def ""TC.DEF"" -adddef ""TC1.DEF"" -adddef ""TC2.DEF"" -addon 3 -con ""TC.CON"" -addcon ""TC1.CON"" -addcon ""TC2.CON"" -file ""{Directory.GetCurrentDirectory()}\Data\Duke3D\Campaigns\duke_tc.zip"""; if (OperatingSystem.IsLinux()) @@ -303,7 +304,7 @@ public void EDuke32Test() EDuke32 eduke32 = new(); var args = eduke32.GetStartGameArgs(_dukeGame, _dukeCamp, mods, true, true, 3); - var expected = @$" -quick -nosetup -j ""{Directory.GetCurrentDirectory()}\Data\Duke3D\Mods"" -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -mx ""ENABLED1.CON"" -mx ""ENABLED2.CON"" -g ""mod_incompatible_with_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -g ""feature_mod.zip"" -usecwd -cachesize 262144 -h ""a"" -j ""D:\Games\Duke3D"" -addon 0 -s3"; + var expected = @$" -quick -nosetup -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -mx ""ENABLED1.CON"" -mx ""ENABLED2.CON"" -g ""mod_incompatible_with_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -g ""feature_mod.zip"" -j ""{Directory.GetCurrentDirectory()}\Data\Duke3D\Mods"" -usecwd -cachesize 262144 -h ""a"" -j ""D:\Games\Duke3D"" -s3"; if (OperatingSystem.IsLinux()) { @@ -343,7 +344,7 @@ public void Eduke32VacaTest() EDuke32 eduke32 = new(); var args = eduke32.GetStartGameArgs(_dukeGame, _dukeVaca, mods, true, true); - var expected = @$" -quick -nosetup -j ""{Directory.GetCurrentDirectory()}\Data\Duke3D\Mods"" -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -mx ""ENABLED1.CON"" -mx ""ENABLED2.CON"" -g ""mod_requires_addon.zip"" -usecwd -cachesize 262144 -h ""a"" -j ""D:\Games\Duke3D"" -addon 3"; + var expected = @$" -quick -nosetup -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -mx ""ENABLED1.CON"" -mx ""ENABLED2.CON"" -g ""mod_requires_addon.zip"" -j ""{Directory.GetCurrentDirectory()}\Data\Duke3D\Mods"" -usecwd -cachesize 262144 -h ""a"" -j ""D:\Games\Duke3D"" -j ""D:\Games\Duke3D\Vaca"" -grp VACATION.GRP"; if (OperatingSystem.IsLinux()) { @@ -359,8 +360,8 @@ public void EdukeTCTest() { EDuke32 eduke32 = new(); - var args = eduke32.GetStartGameArgs(_dukeGame, _dukeTC, [], true, true); - var expected = @$" -quick -nosetup -usecwd -cachesize 262144 -h ""TC.DEF"" -mh ""TC1.DEF"" -mh ""TC2.DEF"" -j ""D:\Games\Duke3D"" -addon 3 -x ""TC.CON"" -mx ""TC1.CON"" -mx ""TC2.CON"" -g ""{Directory.GetCurrentDirectory()}\Data\Duke3D\Campaigns\duke_tc.zip"""; + var args = eduke32.GetStartGameArgs(_dukeGame, _dukeTcForVaca, [], true, true); + var expected = @$" -quick -nosetup -usecwd -cachesize 262144 -h ""TC.DEF"" -mh ""TC1.DEF"" -mh ""TC2.DEF"" -j ""D:\Games\Duke3D"" -j ""D:\Games\Duke3D\Vaca"" -grp VACATION.GRP -x ""TC.CON"" -mx ""TC1.CON"" -mx ""TC2.CON"" -g ""{Directory.GetCurrentDirectory()}\Data\Duke3D\Campaigns\duke_tc.zip"""; if (OperatingSystem.IsLinux()) { @@ -409,7 +410,7 @@ public void RedNukemTest() RedNukem redNukem = new(); var args = redNukem.GetStartGameArgs(_dukeGame, _dukeCamp, mods, true, true); - var expected = @$" -quick -nosetup -j ""{Directory.GetCurrentDirectory()}\Data\Duke3D\Mods"" -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -mx ""ENABLED1.CON"" -mx ""ENABLED2.CON"" -g ""mod_incompatible_with_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -usecwd -h ""a"" -j ""D:\Games\Duke3D"" -addon 0"; + var expected = @$" -quick -nosetup -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -mx ""ENABLED1.CON"" -mx ""ENABLED2.CON"" -g ""mod_incompatible_with_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -j ""{Directory.GetCurrentDirectory()}\Data\Duke3D\Mods"" -usecwd -h ""a"" -j ""D:\Games\Duke3D"""; if (OperatingSystem.IsLinux()) { diff --git a/src/Tests/CmdArguments/FuryCmdArgumentsTests.cs b/src/Tests/CmdArguments/FuryCmdArgumentsTests.cs index 77c8b7da..e60f0509 100644 --- a/src/Tests/CmdArguments/FuryCmdArgumentsTests.cs +++ b/src/Tests/CmdArguments/FuryCmdArgumentsTests.cs @@ -70,7 +70,7 @@ public void FuryTest() Fury fury = new(new ConfigProviderFake()); var args = fury.GetStartGameArgs(_dukeGame, _dukeCamp, mods, true, true, 3); - var expected = @$" -quick -nosetup -j ""{Directory.GetCurrentDirectory()}\Data\Fury\Mods"" -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -mx ""ENABLED1.CON"" -mx ""ENABLED2.CON"" -g ""mod_incompatible_with_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -g ""feature_mod.zip"" -s3"; + var expected = @$" -quick -nosetup -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -mx ""ENABLED1.CON"" -mx ""ENABLED2.CON"" -g ""mod_incompatible_with_addon.zip"" -g ""incompatible_mod_with_compatible_version.zip"" -g ""dependant_mod.zip"" -g ""dependant_mod_with_compatible_version.zip"" -g ""feature_mod.zip"" -j ""{Directory.GetCurrentDirectory()}\Data\Fury\Mods"" -s3"; if (OperatingSystem.IsLinux()) { diff --git a/src/Tests/CmdArguments/RedneckCmdArgumentsTests.cs b/src/Tests/CmdArguments/RedneckCmdArgumentsTests.cs index edd23707..1eb50d4e 100644 --- a/src/Tests/CmdArguments/RedneckCmdArgumentsTests.cs +++ b/src/Tests/CmdArguments/RedneckCmdArgumentsTests.cs @@ -104,7 +104,6 @@ public void RazeTest() Path=D:/Games/Redneck [FileSearch.Directories] - Path=D:/Games/Redneck Path={Directory.GetCurrentDirectory()}/Data/Redneck/Mods [SoundfontSearch.Directories] @@ -139,7 +138,6 @@ public void RazeAgainTest() Path=D:/Games/Again [FileSearch.Directories] - Path=D:/Games/Again Path={Directory.GetCurrentDirectory()}/Data/Redneck/Mods [SoundfontSearch.Directories] @@ -157,7 +155,7 @@ public void RedNukemTest() RedNukem redNukem = new(); var args = redNukem.GetStartGameArgs(_redneckGame, _redneckCamp, mods, true, true); - var expected = @$" -quick -nosetup -j ""{Directory.GetCurrentDirectory()}\Data\Redneck\Mods"" -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -usecwd -h ""a"" -j ""D:\Games\Redneck"""; + var expected = @$" -quick -nosetup -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -j ""{Directory.GetCurrentDirectory()}\Data\Redneck\Mods"" -usecwd -h ""a"" -j ""D:\Games\Redneck"""; if (OperatingSystem.IsLinux()) { diff --git a/src/Tests/CmdArguments/SlaveCmdArgumentsTests.cs b/src/Tests/CmdArguments/SlaveCmdArgumentsTests.cs index acccc1e3..ca6ef610 100644 --- a/src/Tests/CmdArguments/SlaveCmdArgumentsTests.cs +++ b/src/Tests/CmdArguments/SlaveCmdArgumentsTests.cs @@ -75,7 +75,6 @@ public void RazeTest() Path=D:/Games/Slave [FileSearch.Directories] - Path=D:/Games/Slave Path={Directory.GetCurrentDirectory()}/Data/Slave/Mods [SoundfontSearch.Directories] @@ -93,7 +92,7 @@ public void PCExhumedTest() PCExhumed pcExhumed = new(); var args = pcExhumed.GetStartGameArgs(_slaveGame, _slaveCamp, mods, true, true); - var expected = @$" -quick -nosetup -j ""{Directory.GetCurrentDirectory()}\Data\Slave\Mods"" -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -usecwd -j ""D:\Games\Slave"" -h ""a"""; + var expected = @$" -quick -nosetup -g ""enabled_mod.zip"" -mh ""ENABLED1.DEF"" -mh ""ENABLED2.DEF"" -j ""{Directory.GetCurrentDirectory()}\Data\Slave\Mods"" -usecwd -j ""D:\Games\Slave"" -h ""a"""; if (OperatingSystem.IsLinux()) { diff --git a/src/Tests/CmdArguments/WangCmdArgumentsTests.cs b/src/Tests/CmdArguments/WangCmdArgumentsTests.cs index eafca82a..f200ceae 100644 --- a/src/Tests/CmdArguments/WangCmdArgumentsTests.cs +++ b/src/Tests/CmdArguments/WangCmdArgumentsTests.cs @@ -106,7 +106,6 @@ public void RazeTest() Path=D:/Games/Wang [FileSearch.Directories] - Path=D:/Games/Wang Path={Directory.GetCurrentDirectory()}/Data/Wang/Mods [SoundfontSearch.Directories] @@ -142,7 +141,6 @@ public void RazeTdTest() Path=D:/Games/Wang [FileSearch.Directories] - Path=D:/Games/Wang Path={Directory.GetCurrentDirectory()}/Data/Wang/Mods [SoundfontSearch.Directories] @@ -168,7 +166,7 @@ public void VoidSWTest() VoidSW voidSw = new(); var args = voidSw.GetStartGameArgs(_wangGame, _wangCamp, mods, true, true, 3); - var expected = @$" -quick -nosetup -j""{Directory.GetCurrentDirectory()}\Data\Wang\Mods"" -g""enabled_mod.zip"" -mh""ENABLED1.DEF"" -mh""ENABLED2.DEF"" -g""incompatible_mod_with_compatible_version.zip"" -g""dependant_mod.zip"" -g""dependant_mod_with_compatible_version.zip"" -usecwd -j""D:\Games\Wang"" -h""a"" -addon0 -s3"; + var expected = @$" -quick -nosetup -g""enabled_mod.zip"" -mh""ENABLED1.DEF"" -mh""ENABLED2.DEF"" -g""incompatible_mod_with_compatible_version.zip"" -g""dependant_mod.zip"" -g""dependant_mod_with_compatible_version.zip"" -j""{Directory.GetCurrentDirectory()}\Data\Wang\Mods"" -usecwd -j""D:\Games\Wang"" -h""a"" -addon0 -s3"; if (OperatingSystem.IsLinux()) { @@ -191,7 +189,7 @@ public void VoidSWTdTest() VoidSW voidSw = new(); var args = voidSw.GetStartGameArgs(_wangGame, _tdCamp, mods, true, true, 3); - var expected = @$" -quick -nosetup -j""{Directory.GetCurrentDirectory()}\Data\Wang\Mods"" -g""enabled_mod.zip"" -mh""ENABLED1.DEF"" -mh""ENABLED2.DEF"" -g""mod_requires_addon.zip"" -usecwd -j""D:\Games\Wang"" -h""a"" -addon0 -j""{Directory.GetCurrentDirectory()}\Data\Wang\Campaigns"" -g""TD.zip"" -s3"; + var expected = @$" -quick -nosetup -g""enabled_mod.zip"" -mh""ENABLED1.DEF"" -mh""ENABLED2.DEF"" -g""mod_requires_addon.zip"" -j""{Directory.GetCurrentDirectory()}\Data\Wang\Mods"" -usecwd -j""D:\Games\Wang"" -h""a"" -addon0 -j""{Directory.GetCurrentDirectory()}\Data\Wang\Campaigns"" -g""TD.zip"" -s3"; if (OperatingSystem.IsLinux()) {