Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Nov 12, 2024
2 parents f665caf + f3e97a0 commit ae4c426
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repo. It imports the other MSBuild files as needed.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--set general build properties -->
<Version>4.1.6</Version>
<Version>4.1.7</Version>
<Product>SMAPI</Product>
<LangVersion>latest</LangVersion>
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
Expand Down
8 changes: 8 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[README](README.md)

# Release notes
## 4.1.7
Released 12 November 2024 for Stardew Valley 1.6.14 or later.

* For players:
* Updated for Stardew Valley 1.6.14.
* Updated mod compatibility list.
* Fixed crash if a mod has a missing or invalid DLL.

## 4.1.6
Released 07 November 2024 for Stardew Valley 1.6.10 or later.

Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.ConsoleCommands/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
"Version": "4.1.6",
"Version": "4.1.7",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
"MinimumApiVersion": "4.1.6"
"MinimumApiVersion": "4.1.7"
}
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.SaveBackup/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Save Backup",
"Author": "SMAPI",
"Version": "4.1.6",
"Version": "4.1.7",
"Description": "Automatically backs up all your saves once per day into its folder.",
"UniqueID": "SMAPI.SaveBackup",
"EntryDll": "SaveBackup.dll",
"MinimumApiVersion": "4.1.6"
"MinimumApiVersion": "4.1.7"
}
15 changes: 15 additions & 0 deletions src/SMAPI.Web/wwwroot/SMAPI.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@
"~1.0.0 | Status": "AssumeBroken",
"~1.0.0 | StatusReasonDetails": "ItemStockInformation references crash at runtime"
},
"Happy Home Designer": {
"ID": "tlitookilakin.HappyHomeDesigner",
"~2.1.2 | Status": "AssumeBroken",
"~2.1.2 | StatusReasonDetails": "ItemStockInformation references crash at runtime"
},
"Heart Event Helper": {
"ID": "bungus.HeartEventHelper",
"~1.0.6 | Status": "AssumeBroken",
Expand All @@ -160,6 +165,16 @@

"Default | UpdateKey": "Nexus:1720"
},
"Lunar Disturbances": {
"ID": "KoihimeNakamura.LunarDisturbances",
"~1.5.3 | Status": "AssumeBroken",
"~1.5.3 | StatusReasonDetails": "ItemStockInformation references crash at runtime"
},
"Searchable Chests": {
"ID": "ThisIsCad.SearchableChests",
"~1.2.0 | Status": "AssumeBroken",
"~1.2.0 | StatusReasonDetails": "ItemStockInformation references crash at runtime"
},
"Shop Tile Framework": {
"ID": "Cherry.ShopTileFramework",
"~1.0.10-alpha-20240227 | Status": "AssumeBroken",
Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal static class EarlyConstants
internal static int? LogScreenId { get; set; }

/// <summary>SMAPI's current raw semantic version.</summary>
internal static string RawApiVersion = "4.1.6";
internal static string RawApiVersion = "4.1.7";
}

/// <summary>Contains SMAPI's constants and assumptions.</summary>
Expand All @@ -65,7 +65,7 @@ public static class Constants
public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion(EarlyConstants.RawApiVersion);

/// <summary>The minimum supported version of Stardew Valley.</summary>
public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.6.10");
public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.6.14");

/// <summary>The minimum supported Stardew Valley build number, or <c>null</c> for any build of <see cref="MinimumGameVersion"/>.</summary>
public static int? MinimumGameBuild { get; } = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using StardewModdingAPI.Framework.ModLoading.Framework;
using StardewValley;
using StardewValley.Internal;

namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6;

/// <summary>Maps Stardew Valley 1.6's <see cref="ItemQueryContext"/> methods to their newer form in 1.6.14 to avoid breaking older mods.</summary>
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks>
public class ItemQueryContextFacade : ItemQueryContext, IRewriteFacade
{
/*********
** Public methods
*********/
public static ItemQueryContext Constructor(ItemQueryContext parentContext)
{
return new ItemQueryContext(parentContext, null);
}

public static ItemQueryContext Constructor(GameLocation location, Farmer player, Random random)
{
return new ItemQueryContext(location, player, random, null);
}


/*********
** Private methods
*********/
private ItemQueryContextFacade()
{
RewriteHelper.ThrowFakeConstructorCalled();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Microsoft.Xna.Framework;
using StardewModdingAPI.Framework.ModLoading.Framework;
using StardewValley;
using StardewValley.Internal;
using StardewValley.WorldMaps;

namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6;

/// <summary>Maps Stardew Valley 1.'s <see cref="WorldMapManager"/> methods to their newer form in 1.6.14 to avoid breaking older mods.</summary>
/// <remarks>This is public to support SMAPI rewriting and should never be referenced directly by mods. See remarks on <see cref="ReplaceReferencesRewriter"/> for more info.</remarks>
public class WorldMapManagerFacade : IRewriteFacade
{
/*********
** Public methods
*********/
/// <summary>Get the map position which contains a given location and tile coordinate, if any.</summary>
/// <param name="location">The in-game location.</param>
/// <param name="tile">The tile coordinate within the location.</param>
public static MapAreaPosition? GetPositionData(GameLocation location, Point tile)
{
return WorldMapManager.GetPositionData(location, tile, null)?.Data;
}

/// <summary>Get the map position which contains a given location and tile coordinate, if any.</summary>
/// <param name="location">The in-game location.</param>
/// <param name="tile">The tile coordinate within the location.</param>
/// <param name="log">The detailed log to update with the steps used to match the position, if set.</param>
internal static MapAreaPosition? GetPositionData(GameLocation location, Point tile, LogBuilder log)
{
return WorldMapManager.GetPositionData(location, tile, log)?.Data;
}


/*********
** Private methods
*********/
private WorldMapManagerFacade()
{
RewriteHelper.ThrowFakeConstructorCalled();
}
}
35 changes: 30 additions & 5 deletions src/SMAPI/Framework/SCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1929,11 +1929,8 @@ private bool TryLoadMod(IModMetadata mod, IModMetadata[] mods, AssemblyLoader as
this.Monitor.Log($" {mod.DisplayName} (from {relativePath}, ID: {manifest?.UniqueID}) [content pack]...");
else if (manifest?.EntryDll != null)
{
FileVersionInfo version = FileVersionInfo.GetVersionInfo(assemblyFile!.FullName);
string versionStr = version.FilePrivatePart == 0
? $"{version.FileMajorPart}.{version.FileMinorPart}.{version.FileBuildPart}"
: $"{version.FileMajorPart}.{version.FileMinorPart}.{version.FileBuildPart}.{version.FilePrivatePart}";
this.Monitor.Log($" {mod.DisplayName} (from {relativePath}{Path.DirectorySeparatorChar}{manifest.EntryDll}, ID: {manifest.UniqueID}, assembly version: {versionStr})..."); // don't use Path.Combine here, since EntryDLL might not be valid
this.TryGetAssemblyVersion(assemblyFile?.FullName, out string? assemblyVersion);
this.Monitor.Log($" {mod.DisplayName} (from {relativePath}{Path.DirectorySeparatorChar}{manifest.EntryDll}, ID: {manifest.UniqueID}, assembly version: {assemblyVersion ?? "<unknown>"})..."); // don't use Path.Combine here, since EntryDLL might not be valid
}
else
this.Monitor.Log($" {mod.DisplayName} (from {relativePath}, ID: {manifest?.UniqueID ?? "<unknown>"})...");
Expand Down Expand Up @@ -2088,6 +2085,34 @@ IContentPack[] GetContentPacks()
}
}

/// <summary>Get the display version for an assembly file, if it's valid.</summary>
/// <param name="filePath">The absolute path to the assembly file.</param>
/// <param name="versionString">The extracted display version, if valid.</param>
/// <returns>Returns whether the assembly version was successfully extracted.</returns>
private bool TryGetAssemblyVersion(string? filePath, [NotNullWhen(true)] out string? versionString)
{
if (filePath is null || !File.Exists(filePath))
{
versionString = null;
return false;
}

try
{
FileVersionInfo version = FileVersionInfo.GetVersionInfo(filePath);
versionString = version.FilePrivatePart == 0
? $"{version.FileMajorPart}.{version.FileMinorPart}.{version.FileBuildPart}"
: $"{version.FileMajorPart}.{version.FileMinorPart}.{version.FileBuildPart}.{version.FilePrivatePart}";
return true;
}
catch (Exception ex)
{
this.Monitor.Log($"Error extracting assembly version from '{filePath}': {ex.GetLogSummary()}");
versionString = null;
return false;
}
}

/// <summary>Create a fake content pack instance for a parent mod.</summary>
/// <param name="packDirPath">The absolute path to the fake content pack's directory.</param>
/// <param name="packManifest">The fake content pack's manifest.</param>
Expand Down
5 changes: 4 additions & 1 deletion src/SMAPI/Metadata/InstructionMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using StardewValley.GameData.FloorsAndPaths;
using StardewValley.GameData.Movies;
using StardewValley.GameData.SpecialOrders;
using StardewValley.Internal;
using StardewValley.Locations;
using StardewValley.Menus;
using StardewValley.Minigames;
Expand All @@ -34,8 +35,8 @@
using StardewValley.SpecialOrders.Rewards;
using StardewValley.TerrainFeatures;
using StardewValley.Tools;
using StardewValley.WorldMaps;
using xTile.Layers;
using static StardewValley.Projectiles.BasicProjectile;
using SObject = StardewValley.Object;

namespace StardewModdingAPI.Metadata;
Expand Down Expand Up @@ -227,6 +228,7 @@ public IEnumerable<IInstructionHandler> GetHandlers(bool paranoidMode, bool rewr
.MapFacade<IClickableMenu, IClickableMenuFacade>()
.MapFacade<IslandWest, IslandWestFacade>()
.MapFacade<Item, ItemFacade>()
.MapFacade<ItemQueryContext, ItemQueryContextFacade>()
.MapFacade<JunimoHut, JunimoHutFacade>()
.MapFacade<LargeTerrainFeature, LargeTerrainFeatureFacade>()
.MapFacade<Layer, LayerFacade>()
Expand Down Expand Up @@ -265,6 +267,7 @@ public IEnumerable<IInstructionHandler> GetHandlers(bool paranoidMode, bool rewr
.MapFacade<Wallpaper, WallpaperFacade>()
.MapFacade<WateringCan, WateringCanFacade>()
.MapFacade<WorldDate, WorldDateFacade>()
.MapFacade(typeof(WorldMapManager).FullName!, typeof(WorldMapManagerFacade))

// BuildableGameLocation merged into GameLocation
.MapFacade("StardewValley.Locations.BuildableGameLocation", typeof(BuildableGameLocationFacade))
Expand Down

0 comments on commit ae4c426

Please sign in to comment.