Skip to content

Commit a284d86

Browse files
committed
Merge branch 'develop' into stable
2 parents 8fda772 + a16d70a commit a284d86

14 files changed

Lines changed: 166 additions & 139 deletions

File tree

build/common.targets

Lines changed: 1 addition & 1 deletion
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.0.6</Version>
10+
<Version>4.0.7</Version>
1111
<Product>SMAPI</Product>
1212
<LangVersion>latest</LangVersion>
1313
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>

docs/release-notes.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
[README](README.md)
22

33
# Release notes
4+
## 4.0.7
5+
Released 18 April 2024 for Stardew Valley 1.6.4 or later.
6+
7+
* For players:
8+
* Updated for Stardew Valley 1.6.4. **This drops compatibility with Stardew Valley 1.6.0–1.6.3.**
9+
* The installer now lists detected game folders with an incompatible version to simplify troubleshooting.
10+
* When the installer asks for a game folder path, entering an incorrect path to a file inside it will now still select the folder.
11+
* Fixed installer not detecting 1.6 compatibility branch.
12+
13+
* For the web UI:
14+
* Updated `manifest.json` JSON schema for the new `MinimumGameVersion` field (thanks to KhloeLeclair!).
15+
16+
* For external tool authors:
17+
* In the SMAPI toolkit, added a new `GetGameFoldersIncludingInvalid()` method to get all detected game folders and their validity type.
18+
419
## 4.0.6
520
Released 07 April 2024 for Stardew Valley 1.6.0 or later.
621

7-
* For player:
22+
* For players:
823
* The SMAPI log file now includes installed mod IDs, to help with troubleshooting (thanks to DecidedlyHuman!).
924

1025
* For mod authors:
@@ -14,7 +29,7 @@ Released 07 April 2024 for Stardew Valley 1.6.0 or later.
1429
Released 06 April 2024 for Stardew Valley 1.6.0 or later.
1530

1631
* For players:
17-
* The installer now deletes obsolete files from very old SMAPI versions again.
32+
* The installer now deletes obsolete files from very old SMAPI versions again. (This was removed in SMAPI 4.0, but many players still had very old versions.)
1833
* The installer now deletes Error Handler automatically if it's at the default path.
1934
* Fixed mods sometimes not applying logic inside new buildings.
2035
* Minor optimizations.

src/SMAPI.Installer/Framework/InstallerContext.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ public ISemanticVersion GetInstallerVersion()
4848
return new SemanticVersion(raw);
4949
}
5050

51-
/// <summary>Get whether a folder seems to contain the game files.</summary>
52-
/// <param name="dir">The folder to check.</param>
53-
public bool LooksLikeGameFolder(DirectoryInfo dir)
54-
{
55-
return this.GameScanner.LooksLikeGameFolder(dir);
56-
}
57-
5851
/// <summary>Get whether a folder seems to contain the game, and which version it contains if so.</summary>
5952
/// <param name="dir">The folder to check.</param>
6053
public GameFolderType GetGameFolderType(DirectoryInfo dir)

src/SMAPI.Installer/InteractiveInstaller.cs

Lines changed: 66 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -695,48 +695,50 @@ private string InteractivelyChoose(string message, string[] options, string inde
695695
return null;
696696
}
697697

698-
switch (context.GetGameFolderType(dir))
698+
GameFolderType type = context.GetGameFolderType(dir);
699+
switch (type)
699700
{
700701
case GameFolderType.Valid:
701702
return dir;
702703

703-
case GameFolderType.Legacy154OrEarlier:
704-
this.PrintWarning($"{errorPrefix} that directory seems to have Stardew Valley 1.5.4 or earlier.");
705-
this.PrintWarning("Please update your game to the latest version to use SMAPI.");
706-
return null;
707-
708-
case GameFolderType.LegacyCompatibilityBranch:
709-
this.PrintWarning($"{errorPrefix} that directory seems to have the Stardew Valley legacy 'compatibility' branch.");
710-
this.PrintWarning("Unfortunately SMAPI is only compatible with the modern version of the game.");
711-
this.PrintWarning("Please update your game to the main branch to use SMAPI.");
712-
return null;
713-
714-
case GameFolderType.NoGameFound:
715-
this.PrintWarning($"{errorPrefix} that directory doesn't contain a Stardew Valley executable.");
716-
return null;
717-
718704
default:
719-
this.PrintWarning($"{errorPrefix} that directory doesn't seem to contain a valid game install.");
705+
foreach (string message in this.GetInvalidFolderWarning(type))
706+
this.PrintWarning(message);
720707
return null;
721708
}
722709
}
723710

711+
// get valid install paths & log invalid ones
712+
List<DirectoryInfo> defaultPaths = new();
713+
foreach ((DirectoryInfo dir, GameFolderType type) in this.DetectGameFolders(toolkit, context))
714+
{
715+
if (type is GameFolderType.Valid)
716+
{
717+
defaultPaths.Add(dir);
718+
continue;
719+
}
720+
721+
this.PrintDebug($"Ignored game folder: {dir.FullName}");
722+
foreach (string message in this.GetInvalidFolderWarning(type))
723+
this.PrintDebug(message);
724+
this.PrintDebug("\n");
725+
}
726+
724727
// let user choose detected path
725-
DirectoryInfo[] defaultPaths = this.DetectGameFolders(toolkit, context).ToArray();
726728
if (defaultPaths.Any())
727729
{
728730
this.PrintInfo("Where do you want to add or remove SMAPI?");
729731
Console.WriteLine();
730-
for (int i = 0; i < defaultPaths.Length; i++)
732+
for (int i = 0; i < defaultPaths.Count; i++)
731733
this.PrintInfo($"[{i + 1}] {defaultPaths[i].FullName}");
732-
this.PrintInfo($"[{defaultPaths.Length + 1}] Enter a custom game path.");
734+
this.PrintInfo($"[{defaultPaths.Count + 1}] Enter a custom game path.");
733735
Console.WriteLine();
734736

735-
string[] validOptions = Enumerable.Range(1, defaultPaths.Length + 1).Select(p => p.ToString(CultureInfo.InvariantCulture)).ToArray();
737+
string[] validOptions = Enumerable.Range(1, defaultPaths.Count + 1).Select(p => p.ToString(CultureInfo.InvariantCulture)).ToArray();
736738
string choice = this.InteractivelyChoose("Type the number next to your choice, then press enter.", validOptions);
737739
int index = int.Parse(choice, CultureInfo.InvariantCulture) - 1;
738740

739-
if (index < defaultPaths.Length)
741+
if (index < defaultPaths.Count)
740742
return defaultPaths[index];
741743
}
742744
else
@@ -766,9 +768,9 @@ private string InteractivelyChoose(string message, string[] options, string inde
766768
}
767769

768770
// get directory
769-
if (File.Exists(path))
770-
path = Path.GetDirectoryName(path)!;
771771
DirectoryInfo directory = new(path);
772+
if (!directory.Exists && (path.EndsWith(".dll") || path.EndsWith(".exe") || File.Exists(path)) && directory.Parent is { Exists: true })
773+
directory = directory.Parent;
772774

773775
// validate path
774776
if (!directory.Exists)
@@ -777,29 +779,16 @@ private string InteractivelyChoose(string message, string[] options, string inde
777779
continue;
778780
}
779781

780-
switch (context.GetGameFolderType(directory))
782+
GameFolderType type = context.GetGameFolderType(directory);
783+
switch (type)
781784
{
782785
case GameFolderType.Valid:
783786
this.PrintInfo(" OK!");
784787
return directory;
785788

786-
case GameFolderType.Legacy154OrEarlier:
787-
this.PrintWarning("That directory seems to have Stardew Valley 1.5.4 or earlier.");
788-
this.PrintWarning("Please update your game to the latest version to use SMAPI.");
789-
continue;
790-
791-
case GameFolderType.LegacyCompatibilityBranch:
792-
this.PrintWarning("That directory seems to have the Stardew Valley legacy 'compatibility' branch.");
793-
this.PrintWarning("Unfortunately SMAPI is only compatible with the modern version of the game.");
794-
this.PrintWarning("Please update your game to the main branch to use SMAPI.");
795-
continue;
796-
797-
case GameFolderType.NoGameFound:
798-
this.PrintWarning("That directory doesn't contain a Stardew Valley executable.");
799-
continue;
800-
801789
default:
802-
this.PrintWarning("That directory doesn't seem to contain a valid game install.");
790+
foreach (string message in this.GetInvalidFolderWarning(type))
791+
this.PrintWarning(message);
803792
continue;
804793
}
805794
}
@@ -808,7 +797,7 @@ private string InteractivelyChoose(string message, string[] options, string inde
808797
/// <summary>Get the possible game paths to update.</summary>
809798
/// <param name="toolkit">The mod toolkit.</param>
810799
/// <param name="context">The installer context.</param>
811-
private IEnumerable<DirectoryInfo> DetectGameFolders(ModToolkit toolkit, InstallerContext context)
800+
private IEnumerable<(DirectoryInfo, GameFolderType)> DetectGameFolders(ModToolkit toolkit, InstallerContext context)
812801
{
813802
HashSet<string> foundPaths = new HashSet<string>();
814803

@@ -817,10 +806,10 @@ private IEnumerable<DirectoryInfo> DetectGameFolders(ModToolkit toolkit, Install
817806
DirectoryInfo? curPath = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
818807
while (curPath?.Parent != null) // must be in a folder (not at the root)
819808
{
820-
if (context.LooksLikeGameFolder(curPath))
809+
if (context.GetGameFolderType(curPath) == GameFolderType.Valid)
821810
{
822811
foundPaths.Add(curPath.FullName);
823-
yield return curPath;
812+
yield return (curPath, GameFolderType.Valid);
824813
break;
825814
}
826815

@@ -829,10 +818,40 @@ private IEnumerable<DirectoryInfo> DetectGameFolders(ModToolkit toolkit, Install
829818
}
830819

831820
// game paths detected by toolkit
832-
foreach (DirectoryInfo dir in toolkit.GetGameFolders())
821+
foreach ((DirectoryInfo, GameFolderType) pair in toolkit.GetGameFoldersIncludingInvalid())
822+
{
823+
if (foundPaths.Add(pair.Item1.FullName))
824+
yield return pair;
825+
}
826+
}
827+
828+
private string[] GetInvalidFolderWarning(GameFolderType type)
829+
{
830+
switch (type)
833831
{
834-
if (foundPaths.Add(dir.FullName))
835-
yield return dir;
832+
case GameFolderType.Valid:
833+
return new[] { "OK!" }; // should never happen
834+
835+
case GameFolderType.LegacyVersion:
836+
return new[]
837+
{
838+
"That directory seems to have Stardew Valley 1.5.6 or earlier.",
839+
"Please update your game to the latest version to use SMAPI."
840+
};
841+
842+
case GameFolderType.LegacyCompatibilityBranch:
843+
return new[]
844+
{
845+
"That directory seems to have the Stardew Valley legacy 'compatibility' branch.",
846+
"Unfortunately SMAPI is only compatible with the modern version of the game.",
847+
"Please update your game to the main branch to use SMAPI."
848+
};
849+
850+
case GameFolderType.NoGameFound:
851+
return new[] { "That directory doesn't contain a Stardew Valley executable." };
852+
853+
default:
854+
return new[] { "That directory doesn't seem to contain a valid game install." };
836855
}
837856
}
838857

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"Name": "Console Commands",
33
"Author": "SMAPI",
4-
"Version": "4.0.6",
4+
"Version": "4.0.7",
55
"Description": "Adds SMAPI console commands that let you manipulate the game.",
66
"UniqueID": "SMAPI.ConsoleCommands",
77
"EntryDll": "ConsoleCommands.dll",
8-
"MinimumApiVersion": "4.0.6"
8+
"MinimumApiVersion": "4.0.7"
99
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"Name": "Save Backup",
33
"Author": "SMAPI",
4-
"Version": "4.0.6",
4+
"Version": "4.0.7",
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.0.6"
8+
"MinimumApiVersion": "4.0.7"
99
}

src/SMAPI.Toolkit/Framework/GameScanning/GameFolderType.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public enum GameFolderType
99
/// <summary>The folder doesn't contain Stardew Valley.</summary>
1010
NoGameFound,
1111

12-
/// <summary>The folder contains Stardew Valley 1.5.4 or earlier. This version uses XNA Framework and 32-bit .NET Framework 4.5.2 on Windows and Mono on Linux/macOS, and isn't compatible with current versions of SMAPI.</summary>
13-
Legacy154OrEarlier,
12+
/// <summary>The folder contains Stardew Valley 1.5.6 or earlier, which isn't compatible with current versions of SMAPI.</summary>
13+
LegacyVersion,
1414

15-
/// <summary>The folder contains Stardew Valley from the game's legacy compatibility branch, which backports newer changes to the <see cref="Legacy154OrEarlier"/> format.</summary>
15+
/// <summary>The folder contains Stardew Valley from the game's legacy compatibility branch, which backports newer changes to the <see cref="LegacyVersion"/> format.</summary>
1616
LegacyCompatibilityBranch,
1717

1818
/// <summary>The folder seems to contain Stardew Valley files, but they failed to load for unknown reasons (e.g. corrupted executable).</summary>

0 commit comments

Comments
 (0)