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 Dec 19, 2024
2 parents 0133ca9 + f492d17 commit fd73446
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 23 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.9</Version>
<Version>4.1.10</Version>
<Product>SMAPI</Product>
<LangVersion>latest</LangVersion>
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
Expand Down
29 changes: 27 additions & 2 deletions build/unix/prepare-install-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,35 @@


##########
## Fetch values
## Find the game folder
##########
possibleGamePaths=(
# override
"$HOME/StardewValley"

# Linux
"$HOME/GOG Games/Stardew Valley/game"
"$HOME/.steam/steam/steamapps/common/Stardew Valley"
"$HOME/.local/share/Steam/steamapps/common/Stardew Valley"
"$HOME/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/Stardew Valley"

# macOS
"/Applications/Stardew Valley.app/Contents/MacOS"
"$HOME/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS"
)
gamePath=""
for possibleGamePath in "${possibleGamePaths[@]}"; do
if [[ -d "$possibleGamePath" ]]; then
gamePath="$possibleGamePath"
break
fi
done


##########
## Preset values
##########
# paths
gamePath="/home/pathoschild/Stardew Valley"
bundleModNames=("ConsoleCommands" "SaveBackup")

# build configuration
Expand Down
28 changes: 26 additions & 2 deletions build/windows/prepare-install-package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,34 @@


##########
## Fetch values
## Find the game folder
##########
$possibleGamePaths=(
# GOG
"C:\Program Files\GalaxyClient\Games\Stardew Valley",
"C:\Program Files\GOG Galaxy\Games\Stardew Valley",
"C:\Program Files\GOG Games\Stardew Valley",
"C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley",
"C:\Program Files (x86)\GOG Galaxy\Games\Stardew Valley",
"C:\Program Files (x86)\GOG Games\Stardew Valley",

# Steam
"C:\Program Files\Steam\steamapps\common\Stardew Valley",
"C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley"
)
$gamePath = ""
foreach ($possibleGamePath in $possibleGamePaths) {
if (Test-Path $possibleGamePath -PathType Container) {
$gamePath = $possibleGamePath
break
}
}


##########
## Preset values
##########
# paths
$gamePath = "C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley"
$bundleModNames = "ConsoleCommands", "SaveBackup"

# build configuration
Expand Down
18 changes: 18 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
[README](README.md)

# Release notes
## 4.1.10
Released 18 December 2024 for Stardew Valley 1.6.14 or later.

* For players:
* Updated for the upcoming Stardew Valley 1.6.15.
* Fixed errors when cross-playing between PC and Android.

* For mod authors:
* Improved [Content Patcher JSON schema](technical/web.md#using-a-schema-file-directly) to allow boolean and numeric values in dynamic tokens.


> [!IMPORTANT]
> **For players on macOS:**
> There are recent security changes in macOS. Make sure to follow the updated [install guide for
> macOS](https://stardewvalleywiki.com/Modding:Installing_SMAPI_on_Mac) when installing or updating SMAPI.
>
> Players on Linux or Windows can ignore this.
# 4.1.9
Released 08 December 2024 for Stardew Valley 1.6.14 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.9",
"Version": "4.1.10",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
"MinimumApiVersion": "4.1.9"
"MinimumApiVersion": "4.1.10"
}
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.9",
"Version": "4.1.10",
"Description": "Automatically backs up all your saves once per day into its folder.",
"UniqueID": "SMAPI.SaveBackup",
"EntryDll": "SaveBackup.dll",
"MinimumApiVersion": "4.1.9"
"MinimumApiVersion": "4.1.10"
}
2 changes: 1 addition & 1 deletion src/SMAPI.Web/wwwroot/schemas/content-patcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
"Value": {
"title": "Token value",
"description": "The value(s) to set. This can be a comma-delimited value to give it multiple values. If any block for a token name has multiple values, it will only be usable in conditions. This field supports tokens, including dynamic tokens defined before this entry.",
"type": "string"
"type": [ "boolean", "integer", "number", "string" ]
},
"When": {
"title": "When",
Expand Down
2 changes: 1 addition & 1 deletion 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.9";
internal static string RawApiVersion = "4.1.10";
}

/// <summary>Contains SMAPI's constants and assumptions.</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System.Diagnostics.CodeAnalysis;
using StardewModdingAPI.Framework.ModLoading.Framework;
using StardewValley;

namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6;

/// <summary>Maps Stardew Valley 1.5.6's <see cref="Stats"/> methods to their newer form 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 StatsFacade : Stats, IRewriteFacade
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Named due to technical limitations, since we can't have two different facades for the same fields in 1.6.0 and 1.6.15.")]
public class StatsFacade_160 : Stats, IRewriteFacade
{
/*********
** Accessors
Expand All @@ -18,7 +20,6 @@ public class StatsFacade : Stats, IRewriteFacade
get => base.specificMonstersKilled;
}

//started using this in 1.4 to track stats, rather than the annoying and messy uint fields above
public SerializableDictionary<string, uint> stat_dictionary
{
get => base.Values;
Expand Down Expand Up @@ -328,7 +329,7 @@ public void incrementStat(string label, int amount)
/*********
** Private methods
*********/
private StatsFacade()
private StatsFacade_160()
{
RewriteHelper.ThrowFakeConstructorCalled();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Diagnostics.CodeAnalysis;
using StardewModdingAPI.Framework.ModLoading.Framework;
using StardewValley;

namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6;

/// <summary>Maps Stardew Valley 1.6.14's <see cref="Stats"/> methods to their newer form 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>
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Named due to technical limitations, since we can't have two different facades for the same fields in 1.6.0 and 1.6.15.")]
public class StatsFacade_1615 : Stats, IRewriteFacade
{
/*********
** Accessors
*********/
public new SerializableDictionaryWithCaseInsensitiveKeys<int> specificMonstersKilled
{
get => base.specificMonstersKilled;
}

public SerializableDictionaryWithCaseInsensitiveKeys<uint> Values
{
get => base.Values;
}


/*********
** Private methods
*********/
private StatsFacade_1615()
{
RewriteHelper.ThrowFakeConstructorCalled();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public class UtilityFacade : Utility, IRewriteFacade
/*********
** Public methods
*********/
/// <remarks>Replaced in Stardew Valley 1.6.15.</remarks>
public static void checkForBooksReadAchievement()
{
Game1.stats.checkForBooksReadAchievement();
}

public static bool doesItemWithThisIndexExistAnywhere(int index, bool bigCraftable = false)
{
bool found = false;
Expand Down
4 changes: 4 additions & 0 deletions src/SMAPI/Framework/Networking/RemoteContextModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using Newtonsoft.Json;
using StardewModdingAPI.Toolkit.Serialization.Converters;

namespace StardewModdingAPI.Framework.Networking;

Expand All @@ -15,9 +17,11 @@ internal class RemoteContextModel
public GamePlatform Platform { get; }

/// <summary>The installed version of Stardew Valley.</summary>
[JsonConverter(typeof(NonStandardSemanticVersionConverter))] // versions from Android players may have a fourth number for the platform-specific build
public ISemanticVersion? GameVersion { get; }

/// <summary>The installed version of SMAPI.</summary>
[JsonConverter(typeof(NonStandardSemanticVersionConverter))]
public ISemanticVersion? ApiVersion { get; }

/// <summary>The installed mods.</summary>
Expand Down
11 changes: 6 additions & 5 deletions src/SMAPI/Framework/SCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ private void OnGameInitialized()
private void OnInstanceContentLoaded()
{
// override map display device
Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, Game1.game1.GraphicsDevice);
if (Constants.GameVersion.IsOlderThan("1.6.15"))
Game1.mapDisplayDevice = this.GetMapDisplayDevice_OBSOLETE();

// log GPU info
#if SMAPI_FOR_WINDOWS
Expand Down Expand Up @@ -616,8 +617,8 @@ private void OnPlayerInstanceUpdating(SGame instance, GameTime gameTime, Action
*********/
if (this.JustReturnedToTitle)
{
if (Game1.mapDisplayDevice is not SDisplayDevice)
Game1.mapDisplayDevice = this.GetMapDisplayDevice();
if (Game1.mapDisplayDevice is not SDisplayDevice && Constants.GameVersion.IsOlderThan("1.6.15"))
Game1.mapDisplayDevice = this.GetMapDisplayDevice_OBSOLETE();

this.JustReturnedToTitle = false;
}
Expand Down Expand Up @@ -2370,8 +2371,8 @@ private IFileLookup GetFileLookup(string rootDirectory)
}

/// <summary>Get the map display device which applies SMAPI features like tile rotation to loaded maps.</summary>
/// <remarks>This is separate to let mods like PyTK wrap it with their own functionality.</remarks>
private IDisplayDevice GetMapDisplayDevice()
/// <remarks>This only exists for backwards compatibility with Stardew Valley 1.6.14, and will be removed in the next SMAPI update. See <see cref="SGame.CreateDisplayDevice"/> instead.</remarks>
private IDisplayDevice GetMapDisplayDevice_OBSOLETE()
{
return new SDisplayDevice(Game1.content, Game1.game1.GraphicsDevice);
}
Expand Down
14 changes: 11 additions & 3 deletions src/SMAPI/Framework/SGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using StardewModdingAPI.Enums;
using StardewModdingAPI.Events;
using StardewModdingAPI.Framework.Input;
using StardewModdingAPI.Framework.Reflection;
using StardewModdingAPI.Framework.Rendering;
using StardewModdingAPI.Framework.StateTracking.Snapshots;
using StardewModdingAPI.Framework.Utilities;
using StardewModdingAPI.Internal;
Expand All @@ -15,6 +17,7 @@
using StardewValley.Logging;
using StardewValley.Menus;
using StardewValley.Minigames;
using xTile.Display;

namespace StardewModdingAPI.Framework;

Expand Down Expand Up @@ -166,9 +169,7 @@ public override bool ShouldDrawOnBuffer()
/*********
** Protected methods
*********/
/// <summary>Construct a content manager to read game content files.</summary>
/// <param name="serviceProvider">The service provider to use to locate services.</param>
/// <param name="rootDirectory">The root directory to search for content.</param>
/// <inheritdoc />
protected internal override LocalizedContentManager CreateContentManager(IServiceProvider serviceProvider, string rootDirectory)
{
if (SGame.CreateContentManagerImpl == null)
Expand All @@ -177,6 +178,13 @@ protected internal override LocalizedContentManager CreateContentManager(IServic
return SGame.CreateContentManagerImpl(serviceProvider, rootDirectory);
}

/// <inheritdoc />
[SuppressMessage("ReSharper", "ParameterHidesMember")]
protected internal override IDisplayDevice CreateDisplayDevice(ContentManager content, GraphicsDevice graphicsDevice)
{
return new SDisplayDevice(content, graphicsDevice);
}

/// <summary>Initialize the instance when the game starts.</summary>
protected override void Initialize()
{
Expand Down
3 changes: 2 additions & 1 deletion src/SMAPI/Metadata/InstructionMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ public IEnumerable<IInstructionHandler> GetHandlers(bool paranoidMode, bool rewr
.MapFacade<SObject, ObjectFacade>()
.MapFacade<SoundEffect, SoundEffectFacade>()
.MapFacade<SpriteText, SpriteTextFacade>()
.MapFacade<Stats, StatsFacade>()
.MapFacade<Stats, StatsFacade_160>()
.MapFacade<Stats, StatsFacade_1615>()
.MapFacade<StorageFurniture, StorageFurnitureFacade>()
.MapFacade<TemporaryAnimatedSprite, TemporaryAnimatedSpriteFacade>()
.MapFacade<TerrainFeature, TerrainFeatureFacade>()
Expand Down

0 comments on commit fd73446

Please sign in to comment.