Skip to content

Commit 482a919

Browse files
committed
Merge branch 'develop' into stable
2 parents 22806ab + d4f172f commit 482a919

24 files changed

Lines changed: 644 additions & 135 deletions

release-notes.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ For mod developers:
1010
images).
1111
-->
1212

13+
## 1.11
14+
See [log](https://github.com/Pathoschild/SMAPI/compare/1.10...1.11).
15+
16+
For players:
17+
* SMAPI now detects issues in `ObjectInformation.xnb` files caused by outdated XNB mods.
18+
* Errors when loading a save are now shown in the SMAPI console.
19+
* Improved console logging performance.
20+
* Fixed errors during game update causing the game to hang.
21+
* Fixed errors due to mod events triggering during game save in Stardew Valley 1.2.
22+
23+
For mod developers:
24+
* Added a content API which loads custom textures/maps/data from the mod's folder (`.xnb` or `.png` format) or game content.
25+
* `Console.Out` messages are now written to the log file.
26+
* `Monitor.ExitGameImmediately` now aborts SMAPI initialisation and events more quickly.
27+
1328
## 1.10
1429
See [log](https://github.com/Pathoschild/SMAPI/compare/1.9...1.10).
1530

src/.editorconfig

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# topmost editorconfig
2+
root: true
3+
4+
##########
5+
## General formatting
6+
## documentation: http://editorconfig.org
7+
##########
8+
[*]
9+
indent_style = space
10+
indent_size = 4
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
15+
##########
16+
## C# formatting
17+
## documentation: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
18+
## some undocumented settings from: https://github.com/dotnet/roslyn/blob/master/.editorconfig
19+
##########
20+
[*.cs]
21+
22+
#sort 'system' usings first
23+
dotnet_sort_system_directives_first = true
24+
25+
# use 'this.' qualifier
26+
dotnet_style_qualification_for_field = true:error
27+
dotnet_style_qualification_for_property = true:error
28+
dotnet_style_qualification_for_method = true:error
29+
dotnet_style_qualification_for_event = true:error
30+
31+
# use language keywords (like int) instead of type (like Int32)
32+
dotnet_style_predefined_type_for_locals_parameters_members = true:error
33+
dotnet_style_predefined_type_for_member_access = true:error
34+
35+
# don't use 'var' for language keywords
36+
csharp_style_var_for_built_in_types = false:error
37+
38+
# suggest modern C# features where simpler
39+
dotnet_style_object_initializer = true:suggestion
40+
dotnet_style_collection_initializer = true:suggestion
41+
dotnet_style_coalesce_expression = true:suggestion
42+
dotnet_style_null_propagation = true:suggestion
43+
dotnet_style_explicit_tuple_names = true:suggestion
44+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
45+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
46+
csharp_style_conditional_delegate_call = true:suggestion
47+
48+
# prefer method block bodies
49+
csharp_style_expression_bodied_methods = false:suggestion
50+
csharp_style_expression_bodied_constructors = false:suggestion
51+
52+
# prefer property expression bodies
53+
csharp_style_expression_bodied_properties = true:suggestion
54+
csharp_style_expression_bodied_indexers = true:suggestion
55+
csharp_style_expression_bodied_accessors = true:suggestion
56+
57+
# prefer inline out variables
58+
csharp_style_inlined_variable_declaration = true:warning

src/GlobalAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
using System.Runtime.InteropServices;
33

44
[assembly: ComVisible(false)]
5-
[assembly: AssemblyVersion("1.8.0.0")]
6-
[assembly: AssemblyFileVersion("1.8.0.0")]
5+
[assembly: AssemblyVersion("1.11.0.0")]
6+
[assembly: AssemblyFileVersion("1.11.0.0")]

src/StardewModdingAPI.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26228.4
4+
VisualStudioVersion = 15.0.26403.7
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrainerMod", "TrainerMod\TrainerMod.csproj", "{28480467-1A48-46A7-99F8-236D95225359}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewModdingAPI", "StardewModdingAPI\StardewModdingAPI.csproj", "{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}"
99
EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "metadata", "metadata", "{86C452BE-D2D8-45B4-B63F-E329EB06CEDA}"
1111
ProjectSection(SolutionItems) = preProject
12+
.editorconfig = .editorconfig
1213
..\.gitattributes = ..\.gitattributes
1314
..\.gitignore = ..\.gitignore
1415
crossplatform.targets = crossplatform.targets

src/StardewModdingAPI.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeMadeStatic_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
23
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantNameQualifier/@EntryIndexedValue">HINT</s:String>
4+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantTypeArgumentsOfMethod/@EntryIndexedValue">HINT</s:String>
35
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/StaticQualifier/STATIC_MEMBERS_QUALIFY_MEMBERS/@EntryValue">Field, Property, Event, Method</s:String>
46
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">Field, Property, Event, Method</s:String>
57
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean>

src/StardewModdingAPI/Constants.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public static class Constants
2020
** Properties
2121
*********/
2222
/// <summary>The directory path containing the current save's data (if a save is loaded).</summary>
23-
private static string RawSavePath => Constants.IsSaveLoaded ? Path.Combine(Constants.SavesPath, Constants.GetSaveFolderName()) : null;
23+
private static string RawSavePath => Context.IsSaveLoaded ? Path.Combine(Constants.SavesPath, Constants.GetSaveFolderName()) : null;
2424

2525
/// <summary>Whether the directory containing the current save's data exists on disk.</summary>
26-
private static bool SavePathReady => Constants.IsSaveLoaded && Directory.Exists(Constants.RawSavePath);
26+
private static bool SavePathReady => Context.IsSaveLoaded && Directory.Exists(Constants.RawSavePath);
2727

2828

2929
/*********
@@ -33,10 +33,10 @@ public static class Constants
3333
** Public
3434
****/
3535
/// <summary>SMAPI's current semantic version.</summary>
36-
public static ISemanticVersion ApiVersion { get; } = new SemanticVersion(1, 10, 0);
36+
public static ISemanticVersion ApiVersion { get; } = new SemanticVersion(1, 11, 0);
3737

3838
/// <summary>The minimum supported version of Stardew Valley.</summary>
39-
public static ISemanticVersion MinimumGameVersion { get; } = new SemanticVersion("1.2.15");
39+
public static ISemanticVersion MinimumGameVersion { get; } = new SemanticVersion("1.2.26");
4040

4141
/// <summary>The maximum supported version of Stardew Valley.</summary>
4242
public static ISemanticVersion MaximumGameVersion { get; } = null;
@@ -54,7 +54,7 @@ public static class Constants
5454
public static string SavesPath { get; } = Path.Combine(Constants.DataPath, "Saves");
5555

5656
/// <summary>The directory name containing the current save's data (if a save is loaded and the directory exists).</summary>
57-
public static string SaveFolderName => Constants.IsSaveLoaded ? Constants.GetSaveFolderName() : "";
57+
public static string SaveFolderName => Context.IsSaveLoaded ? Constants.GetSaveFolderName() : "";
5858

5959
/// <summary>The directory path containing the current save's data (if a save is loaded and the directory exists).</summary>
6060
public static string CurrentSavePath => Constants.SavePathReady ? Path.Combine(Constants.SavesPath, Constants.GetSaveFolderName()) : "";
@@ -74,9 +74,6 @@ public static class Constants
7474
/// <summary>The full path to the folder containing mods.</summary>
7575
internal static string ModPath { get; } = Path.Combine(Constants.ExecutionPath, "Mods");
7676

77-
/// <summary>Whether a player save has been loaded.</summary>
78-
internal static bool IsSaveLoaded => Game1.hasLoadedGame && !string.IsNullOrEmpty(Game1.player.name);
79-
8077
/// <summary>The game's current semantic version.</summary>
8178
internal static ISemanticVersion GameVersion { get; } = Constants.GetGameVersion();
8279

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace StardewModdingAPI
2+
{
3+
/// <summary>Specifies a source containing content that can be loaded.</summary>
4+
public enum ContentSource
5+
{
6+
/// <summary>Assets in the game's content manager (i.e. XNBs in the game's content folder).</summary>
7+
GameContent,
8+
9+
/// <summary>XNB files in the current mod's folder.</summary>
10+
ModFolder
11+
}
12+
}

src/StardewModdingAPI/Context.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using StardewValley;
2+
3+
namespace StardewModdingAPI
4+
{
5+
/// <summary>Provides information about the current game state.</summary>
6+
internal static class Context
7+
{
8+
/*********
9+
** Accessors
10+
*********/
11+
/// <summary>Whether a player save has been loaded.</summary>
12+
public static bool IsSaveLoaded => Game1.hasLoadedGame && !string.IsNullOrEmpty(Game1.player.name);
13+
14+
/// <summary>Whether the game is currently writing to the save file.</summary>
15+
public static bool IsSaving => SaveGame.IsProcessing;
16+
17+
/// <summary>Whether the game is currently running the draw loop.</summary>
18+
public static bool IsInDrawLoop { get; set; }
19+
}
20+
}

0 commit comments

Comments
 (0)