fix Mono.Cecil failing to resolve references to SMAPI in some edge cases

This commit is contained in:
Jesse Plamondon-Willard 2021-08-03 19:03:51 -04:00
parent ef1eff669d
commit 6b0d13be7c
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 2 additions and 0 deletions

View File

@ -4,6 +4,7 @@
## Upcoming release ## Upcoming release
* For players: * For players:
* The software conflict message added in SMAPI 3.11.0 now appears as a warning to simplify troubleshooting. * The software conflict message added in SMAPI 3.11.0 now appears as a warning to simplify troubleshooting.
* Fixed error loading older Harmony mods for some players who launch the unofficial 64-bit Stardew Valley through Steam.
* Updated compatibility list. * Updated compatibility list.
* For mod authors: * For mod authors:

View File

@ -61,6 +61,7 @@ namespace StardewModdingAPI.Framework.ModLoading
this.AssemblyDefinitionResolver = this.TrackForDisposal(new AssemblyDefinitionResolver()); this.AssemblyDefinitionResolver = this.TrackForDisposal(new AssemblyDefinitionResolver());
this.AssemblyDefinitionResolver.AddSearchDirectory(Constants.ExecutionPath); this.AssemblyDefinitionResolver.AddSearchDirectory(Constants.ExecutionPath);
this.AssemblyDefinitionResolver.AddSearchDirectory(Constants.InternalFilesPath); this.AssemblyDefinitionResolver.AddSearchDirectory(Constants.InternalFilesPath);
this.AssemblyDefinitionResolver.Add(AssemblyDefinition.ReadAssembly(typeof(SGame).Assembly.Location)); // for some reason Mono.Cecil can't resolve SMAPI in very specific cases involving unofficial 64-bit Stardew Valley when launched through Steam (for some players only)
// generate type => assembly lookup for types which should be rewritten // generate type => assembly lookup for types which should be rewritten
this.TypeAssemblies = new Dictionary<string, Assembly>(); this.TypeAssemblies = new Dictionary<string, Assembly>();