Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic Folder Matching installer #504

Merged
merged 10 commits into from
Aug 2, 2023

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using NexusMods.DataModel.Games.GameCapabilities.AFolderMatchInstallerCapability;
using NexusMods.Paths;

namespace NexusMods.Games.BethesdaGameStudios.Capabilities;

/// <summary>
/// Capability to support installing simple Data and GameRoot level mods for Bethesda games.
/// </summary>
public class BethesdaFolderMatchInstallerCapability : AFolderMatchInstallerCapability
{
protected static readonly RelativePath DataFolder = new RelativePath("data");

// TODO: make this only contain values common for all bethesda games, let games add their own values
// find good way to do that
protected static readonly InstallFolderTarget DataInstallFolderTarget = new()
{
DestinationGamePath = new GamePath(GameFolderType.Game, DataFolder),

KnownSourceFolderNames = new[] { "data" },

KnownValidSubfolders = new[]
{
"fonts",
"interface",
"menus",
"meshes",
"music",
"scripts",
"shaders",
"sound",
"strings",
"textures",
"trees",
"video",
"facegen",
"materials",
"skse",
"obse",
"mwse",
"nvse",
"fose",
"f4se",
"distantlod",
"asi",
"SkyProc Patchers",
"Tools",
"MCM",
"icons",
"bookart",
"distantland",
"mits",
"splash",
"dllplugins",
"CalienteTools",
"NetScriptFramework",
"shadersfx"
},

KnownValidFileExtensions = new[]
{
new Extension(".esp"),
new Extension(".esm"),
new Extension(".esl"),
new Extension(".bsa"),
new Extension(".ba2"),
new Extension(".modgroups"),
}
};

protected static readonly InstallFolderTarget GameRootInstallFolderTarget = new()
{
DestinationGamePath = new GamePath(GameFolderType.Game, RelativePath.Empty),

KnownSourceFolderNames = new[]
{
"Mopy",
"xLODGen",
"DynDOLOD",
"BethINI Standalone",
"WrapperVersion"
},

KnownValidSubfolders = new[]
{
"data"
},

SubPathsToDiscard = new[]
{
new RelativePath("src")
},

SubTargets = new[]
{
DataInstallFolderTarget
}
};

protected override IEnumerable<InstallFolderTarget> InstallFolderTargets { get; } = new[]
{
GameRootInstallFolderTarget
};
}

This file was deleted.

3 changes: 0 additions & 3 deletions src/Games/NexusMods.Games.BethesdaGameStudios/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
using NexusMods.DataModel.Abstractions;
using NexusMods.DataModel.Games;
using NexusMods.DataModel.JsonConverters.ExpressionGenerator;
using NexusMods.DataModel.ModInstallers;
using NexusMods.Games.BethesdaGameStudios.Installers;

namespace NexusMods.Games.BethesdaGameStudios;

public static class Services
{
public static IServiceCollection AddBethesdaGameStudios(this IServiceCollection services)
{
services.AddAllSingleton<IModInstaller, SkyrimInstaller>();
services.AddAllSingleton<IGame, SkyrimSpecialEdition>();
services.AddAllSingleton<IGame, SkyrimLegendaryEdition>();
services.AddSingleton<ITool, RunGameTool<SkyrimLegendaryEdition>>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using NexusMods.Common;
using NexusMods.DataModel.Games;
using NexusMods.Paths;
using NexusMods.DataModel.Games.GameCapabilities;
using NexusMods.DataModel.Games.GameCapabilities.AFolderMatchInstallerCapability;
using NexusMods.FileExtractor.StreamFactories;

using NexusMods.Games.BethesdaGameStudios.Capabilities;
using NexusMods.Paths;

namespace NexusMods.Games.BethesdaGameStudios;

Expand All @@ -27,6 +29,14 @@ protected override IEnumerable<KeyValuePair<GameFolderType, AbsolutePath>> GetLo
.GetKnownPath(KnownPath.LocalApplicationDataDirectory)
.Combine("Skyrim"));
}

public override Dictionary<GameCapabilityId, IGameCapability> SupportedCapabilities => new()
{
{
// Support for installing simple Data and GameRoot level mods.
AFolderMatchInstallerCapability.CapabilityId, new BethesdaFolderMatchInstallerCapability()
}
};

public IEnumerable<uint> SteamIds => new[] { 72850u };

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using NexusMods.Common;
using NexusMods.DataModel.Abstractions;
using NexusMods.DataModel.Games;
using NexusMods.DataModel.Games.GameCapabilities;
using NexusMods.DataModel.Games.GameCapabilities.AFolderMatchInstallerCapability;
using NexusMods.DataModel.Loadouts;
using NexusMods.FileExtractor.StreamFactories;
using NexusMods.Games.BethesdaGameStudios.Capabilities;
using NexusMods.Paths;

namespace NexusMods.Games.BethesdaGameStudios;
Expand Down Expand Up @@ -50,6 +53,15 @@
};
}

public override Dictionary<GameCapabilityId, IGameCapability> SupportedCapabilities => new()
{
{
// Support for installing simple Data and GameRoot level mods.
AFolderMatchInstallerCapability.CapabilityId, new BethesdaFolderMatchInstallerCapability()
}
};


public IEnumerable<uint> SteamIds => new[] { 489830u };

public IEnumerable<long> GogIds => new long[]
Expand All @@ -62,8 +74,10 @@
public IEnumerable<string> XboxIds => new[] { "BethesdaSoftworks.SkyrimSE-PC" };

public override IStreamFactory Icon =>
new EmbededResourceStreamFactory<SkyrimSpecialEdition>("NexusMods.Games.BethesdaGameStudios.Resources.SkyrimSpecialEdition.icon.jpg");
new EmbededResourceStreamFactory<SkyrimSpecialEdition>(
"NexusMods.Games.BethesdaGameStudios.Resources.SkyrimSpecialEdition.icon.jpg");

Check warning on line 78 in src/Games/NexusMods.Games.BethesdaGameStudios/SkyrimSpecialEdition/SkyrimSpecialEdition.cs

View check run for this annotation

Codecov / codecov/patch

src/Games/NexusMods.Games.BethesdaGameStudios/SkyrimSpecialEdition/SkyrimSpecialEdition.cs#L77-L78

Added lines #L77 - L78 were not covered by tests

public override IStreamFactory GameImage =>
new EmbededResourceStreamFactory<SkyrimSpecialEdition>("NexusMods.Games.BethesdaGameStudios.Resources.SkyrimSpecialEdition.game_image.png");
new EmbededResourceStreamFactory<SkyrimSpecialEdition>(
"NexusMods.Games.BethesdaGameStudios.Resources.SkyrimSpecialEdition.game_image.png");

Check warning on line 82 in src/Games/NexusMods.Games.BethesdaGameStudios/SkyrimSpecialEdition/SkyrimSpecialEdition.cs

View check run for this annotation

Codecov / codecov/patch

src/Games/NexusMods.Games.BethesdaGameStudios/SkyrimSpecialEdition/SkyrimSpecialEdition.cs#L81-L82

Added lines #L81 - L82 were not covered by tests
}
Loading
Loading