diff options
-rw-r--r-- | docs/release-notes.md | 4 | ||||
-rw-r--r-- | src/SMAPI/Constants.cs | 2 | ||||
-rw-r--r-- | src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs | 16 |
3 files changed, 16 insertions, 6 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index 07eb6c03..5aded254 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,6 +1,10 @@ ← [README](README.md) # Release notes +## Upcoming release +* For players: + * Fixed error loading some mods which reference other mod DLLs in SMAPI 3.12.3. + ## 3.12.3 Released 25 August 2021 for Stardew Valley 1.5.4 or later. diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index cce267ba..07a5e8e6 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -249,7 +249,7 @@ namespace StardewModdingAPI // - 'StardewValley': assembly name on Linux/macOS; // - 'Stardew Valley': assembly name on Windows; // - 'Netcode': an assembly that's separate on Windows only. - resolver.Add(AssemblyDefinition.ReadAssembly(typeof(Game1).Assembly.Location), "StardewValley", "Stardew Valley" + resolver.AddWithExplicitNames(AssemblyDefinition.ReadAssembly(typeof(Game1).Assembly.Location), "StardewValley", "Stardew Valley" #if !SMAPI_FOR_WINDOWS , "Netcode" #endif diff --git a/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs b/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs index b3415609..8e2f5ef3 100644 --- a/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs +++ b/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs @@ -21,13 +21,13 @@ namespace StardewModdingAPI.Framework.ModLoading public void Add(params AssemblyDefinition[] assemblies) { foreach (AssemblyDefinition assembly in assemblies) - this.Add(assembly, assembly.Name.Name, assembly.Name.FullName); + this.AddWithExplicitNames(assembly, assembly.Name.Name, assembly.Name.FullName); } - /// <summary>Add known assemblies to the resolver.</summary> + /// <summary>Add a known assembly to the resolver with the given names. This overrides the assembly names that would normally be assigned.</summary> /// <param name="assembly">The assembly to add.</param> /// <param name="names">The assembly names for which it should be returned.</param> - public void Add(AssemblyDefinition assembly, params string[] names) + public void AddWithExplicitNames(AssemblyDefinition assembly, params string[] names) { this.RegisterAssembly(assembly); foreach (string name in names) @@ -36,12 +36,18 @@ namespace StardewModdingAPI.Framework.ModLoading /// <summary>Resolve an assembly reference.</summary> /// <param name="name">The assembly name.</param> - public override AssemblyDefinition Resolve(AssemblyNameReference name) => this.ResolveName(name.Name) ?? base.Resolve(name); + public override AssemblyDefinition Resolve(AssemblyNameReference name) + { + return this.ResolveName(name.Name) ?? base.Resolve(name); + } /// <summary>Resolve an assembly reference.</summary> /// <param name="name">The assembly name.</param> /// <param name="parameters">The assembly reader parameters.</param> - public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters) => this.ResolveName(name.Name) ?? base.Resolve(name, parameters); + public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters) + { + return this.ResolveName(name.Name) ?? base.Resolve(name, parameters); + } /********* |