Skip to content

Commit ed167c7

Browse files
committed
Merge branch 'develop' into stable
2 parents 0133ca9 + 2ae9a6f commit ed167c7

File tree

15 files changed

+144
-23
lines changed

15 files changed

+144
-23
lines changed

build/common.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repo. It imports the other MSBuild files as needed.
77
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
88
<PropertyGroup>
99
<!--set general build properties -->
10-
<Version>4.1.9</Version>
10+
<Version>4.1.10</Version>
1111
<Product>SMAPI</Product>
1212
<LangVersion>latest</LangVersion>
1313
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>

build/unix/prepare-install-package.sh

+27-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,35 @@
99

1010

1111
##########
12-
## Fetch values
12+
## Find the game folder
13+
##########
14+
possibleGamePaths=(
15+
# override
16+
"$HOME/StardewValley"
17+
18+
# Linux
19+
"$HOME/GOG Games/Stardew Valley/game"
20+
"$HOME/.steam/steam/steamapps/common/Stardew Valley"
21+
"$HOME/.local/share/Steam/steamapps/common/Stardew Valley"
22+
"$HOME/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/common/Stardew Valley"
23+
24+
# macOS
25+
"/Applications/Stardew Valley.app/Contents/MacOS"
26+
"$HOME/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS"
27+
)
28+
gamePath=""
29+
for possibleGamePath in "${possibleGamePaths[@]}"; do
30+
if [[ -d "$possibleGamePath" ]]; then
31+
gamePath="$possibleGamePath"
32+
break
33+
fi
34+
done
35+
36+
37+
##########
38+
## Preset values
1339
##########
1440
# paths
15-
gamePath="/home/pathoschild/Stardew Valley"
1641
bundleModNames=("ConsoleCommands" "SaveBackup")
1742

1843
# build configuration

build/windows/prepare-install-package.ps1

+26-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,34 @@
1313

1414

1515
##########
16-
## Fetch values
16+
## Find the game folder
17+
##########
18+
$possibleGamePaths=(
19+
# GOG
20+
"C:\Program Files\GalaxyClient\Games\Stardew Valley",
21+
"C:\Program Files\GOG Galaxy\Games\Stardew Valley",
22+
"C:\Program Files\GOG Games\Stardew Valley",
23+
"C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley",
24+
"C:\Program Files (x86)\GOG Galaxy\Games\Stardew Valley",
25+
"C:\Program Files (x86)\GOG Games\Stardew Valley",
26+
27+
# Steam
28+
"C:\Program Files\Steam\steamapps\common\Stardew Valley",
29+
"C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley"
30+
)
31+
$gamePath = ""
32+
foreach ($possibleGamePath in $possibleGamePaths) {
33+
if (Test-Path $possibleGamePath -PathType Container) {
34+
$gamePath = $possibleGamePath
35+
break
36+
}
37+
}
38+
39+
40+
##########
41+
## Preset values
1742
##########
1843
# paths
19-
$gamePath = "C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley"
2044
$bundleModNames = "ConsoleCommands", "SaveBackup"
2145

2246
# build configuration

docs/release-notes.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
[README](README.md)
22

33
# Release notes
4+
## 4.1.10
5+
Released 18 December 2024 for Stardew Valley 1.6.14 or later.
6+
7+
* For players:
8+
* Updated for the upcoming Stardew Valley 1.6.15.
9+
* Fixed errors when cross-playing between PC and Android.
10+
11+
* For mod authors:
12+
* Improved [Content Patcher JSON schema](technical/web.md#using-a-schema-file-directly) to allow boolean and numeric values in dynamic tokens.
13+
14+
15+
> [!IMPORTANT]
16+
> **For players on macOS:**
17+
> There are recent security changes in macOS. Make sure to follow the updated [install guide for
18+
> macOS](https://stardewvalleywiki.com/Modding:Installing_SMAPI_on_Mac) when installing or updating SMAPI.
19+
>
20+
> Players on Linux or Windows can ignore this.
21+
422
# 4.1.9
523
Released 08 December 2024 for Stardew Valley 1.6.14 or later.
624

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"Name": "Console Commands",
33
"Author": "SMAPI",
4-
"Version": "4.1.9",
4+
"Version": "4.1.10",
55
"Description": "Adds SMAPI console commands that let you manipulate the game.",
66
"UniqueID": "SMAPI.ConsoleCommands",
77
"EntryDll": "ConsoleCommands.dll",
8-
"MinimumApiVersion": "4.1.9"
8+
"MinimumApiVersion": "4.1.10"
99
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"Name": "Save Backup",
33
"Author": "SMAPI",
4-
"Version": "4.1.9",
4+
"Version": "4.1.10",
55
"Description": "Automatically backs up all your saves once per day into its folder.",
66
"UniqueID": "SMAPI.SaveBackup",
77
"EntryDll": "SaveBackup.dll",
8-
"MinimumApiVersion": "4.1.9"
8+
"MinimumApiVersion": "4.1.10"
99
}

src/SMAPI.Web/wwwroot/schemas/content-patcher.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
"Value": {
148148
"title": "Token value",
149149
"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.",
150-
"type": "string"
150+
"type": [ "boolean", "integer", "number", "string" ]
151151
},
152152
"When": {
153153
"title": "When",

src/SMAPI/Constants.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ internal static class EarlyConstants
4949
internal static int? LogScreenId { get; set; }
5050

5151
/// <summary>SMAPI's current raw semantic version.</summary>
52-
internal static string RawApiVersion = "4.1.9";
52+
internal static string RawApiVersion = "4.1.10";
5353
}
5454

5555
/// <summary>Contains SMAPI's constants and assumptions.</summary>

src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/StatsFacade.cs renamed to src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/StatsFacade_160.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
using System.Diagnostics.CodeAnalysis;
12
using StardewModdingAPI.Framework.ModLoading.Framework;
23
using StardewValley;
34

45
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6;
56

67
/// <summary>Maps Stardew Valley 1.5.6's <see cref="Stats"/> methods to their newer form to avoid breaking older mods.</summary>
78
/// <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>
8-
public class StatsFacade : Stats, IRewriteFacade
9+
[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.")]
10+
public class StatsFacade_160 : Stats, IRewriteFacade
911
{
1012
/*********
1113
** Accessors
@@ -18,7 +20,6 @@ public class StatsFacade : Stats, IRewriteFacade
1820
get => base.specificMonstersKilled;
1921
}
2022

21-
//started using this in 1.4 to track stats, rather than the annoying and messy uint fields above
2223
public SerializableDictionary<string, uint> stat_dictionary
2324
{
2425
get => base.Values;
@@ -328,7 +329,7 @@ public void incrementStat(string label, int amount)
328329
/*********
329330
** Private methods
330331
*********/
331-
private StatsFacade()
332+
private StatsFacade_160()
332333
{
333334
RewriteHelper.ThrowFakeConstructorCalled();
334335
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
using StardewModdingAPI.Framework.ModLoading.Framework;
3+
using StardewValley;
4+
5+
namespace StardewModdingAPI.Framework.ModLoading.Rewriters.StardewValley_1_6;
6+
7+
/// <summary>Maps Stardew Valley 1.6.14's <see cref="Stats"/> methods to their newer form to avoid breaking older mods.</summary>
8+
/// <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>
9+
[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.")]
10+
public class StatsFacade_1615 : Stats, IRewriteFacade
11+
{
12+
/*********
13+
** Accessors
14+
*********/
15+
public new SerializableDictionaryWithCaseInsensitiveKeys<int> specificMonstersKilled
16+
{
17+
get => base.specificMonstersKilled;
18+
}
19+
20+
public SerializableDictionaryWithCaseInsensitiveKeys<uint> Values
21+
{
22+
get => base.Values;
23+
}
24+
25+
26+
/*********
27+
** Private methods
28+
*********/
29+
private StatsFacade_1615()
30+
{
31+
RewriteHelper.ThrowFakeConstructorCalled();
32+
}
33+
}

src/SMAPI/Framework/ModLoading/Rewriters/StardewValley_1_6/UtilityFacade.cs

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ public class UtilityFacade : Utility, IRewriteFacade
1717
/*********
1818
** Public methods
1919
*********/
20+
/// <remarks>Replaced in Stardew Valley 1.6.15.</remarks>
21+
public static void checkForBooksReadAchievement()
22+
{
23+
Game1.stats.checkForBooksReadAchievement();
24+
}
25+
2026
public static bool doesItemWithThisIndexExistAnywhere(int index, bool bigCraftable = false)
2127
{
2228
bool found = false;

src/SMAPI/Framework/Networking/RemoteContextModel.cs

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using Newtonsoft.Json;
3+
using StardewModdingAPI.Toolkit.Serialization.Converters;
24

35
namespace StardewModdingAPI.Framework.Networking;
46

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

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

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

2327
/// <summary>The installed mods.</summary>

src/SMAPI/Framework/SCore.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,8 @@ private void OnGameInitialized()
493493
private void OnInstanceContentLoaded()
494494
{
495495
// override map display device
496-
Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, Game1.game1.GraphicsDevice);
496+
if (Constants.GameVersion.IsOlderThan("1.6.15"))
497+
Game1.mapDisplayDevice = this.GetMapDisplayDevice_OBSOLETE();
497498

498499
// log GPU info
499500
#if SMAPI_FOR_WINDOWS
@@ -616,8 +617,8 @@ private void OnPlayerInstanceUpdating(SGame instance, GameTime gameTime, Action
616617
*********/
617618
if (this.JustReturnedToTitle)
618619
{
619-
if (Game1.mapDisplayDevice is not SDisplayDevice)
620-
Game1.mapDisplayDevice = this.GetMapDisplayDevice();
620+
if (Game1.mapDisplayDevice is not SDisplayDevice && Constants.GameVersion.IsOlderThan("1.6.15"))
621+
Game1.mapDisplayDevice = this.GetMapDisplayDevice_OBSOLETE();
621622

622623
this.JustReturnedToTitle = false;
623624
}
@@ -2370,8 +2371,8 @@ private IFileLookup GetFileLookup(string rootDirectory)
23702371
}
23712372

23722373
/// <summary>Get the map display device which applies SMAPI features like tile rotation to loaded maps.</summary>
2373-
/// <remarks>This is separate to let mods like PyTK wrap it with their own functionality.</remarks>
2374-
private IDisplayDevice GetMapDisplayDevice()
2374+
/// <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>
2375+
private IDisplayDevice GetMapDisplayDevice_OBSOLETE()
23752376
{
23762377
return new SDisplayDevice(Game1.content, Game1.game1.GraphicsDevice);
23772378
}

src/SMAPI/Framework/SGame.cs

+11-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
using System.Collections.ObjectModel;
33
using System.Diagnostics.CodeAnalysis;
44
using Microsoft.Xna.Framework;
5+
using Microsoft.Xna.Framework.Content;
56
using Microsoft.Xna.Framework.Graphics;
67
using StardewModdingAPI.Enums;
78
using StardewModdingAPI.Events;
89
using StardewModdingAPI.Framework.Input;
910
using StardewModdingAPI.Framework.Reflection;
11+
using StardewModdingAPI.Framework.Rendering;
1012
using StardewModdingAPI.Framework.StateTracking.Snapshots;
1113
using StardewModdingAPI.Framework.Utilities;
1214
using StardewModdingAPI.Internal;
@@ -15,6 +17,7 @@
1517
using StardewValley.Logging;
1618
using StardewValley.Menus;
1719
using StardewValley.Minigames;
20+
using xTile.Display;
1821

1922
namespace StardewModdingAPI.Framework;
2023

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

181+
/// <inheritdoc />
182+
[SuppressMessage("ReSharper", "ParameterHidesMember")]
183+
protected internal override IDisplayDevice CreateDisplayDevice(ContentManager content, GraphicsDevice graphicsDevice)
184+
{
185+
return new SDisplayDevice(content, graphicsDevice);
186+
}
187+
180188
/// <summary>Initialize the instance when the game starts.</summary>
181189
protected override void Initialize()
182190
{

src/SMAPI/Metadata/InstructionMetadata.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ public IEnumerable<IInstructionHandler> GetHandlers(bool paranoidMode, bool rewr
255255
.MapFacade<SObject, ObjectFacade>()
256256
.MapFacade<SoundEffect, SoundEffectFacade>()
257257
.MapFacade<SpriteText, SpriteTextFacade>()
258-
.MapFacade<Stats, StatsFacade>()
258+
.MapFacade<Stats, StatsFacade_160>()
259+
.MapFacade<Stats, StatsFacade_1615>()
259260
.MapFacade<StorageFurniture, StorageFurnitureFacade>()
260261
.MapFacade<TemporaryAnimatedSprite, TemporaryAnimatedSpriteFacade>()
261262
.MapFacade<TerrainFeature, TerrainFeatureFacade>()

0 commit comments

Comments
 (0)