backport SMAPI 1.9 to Stardew Valley 1.11 (#258)

This commit is contained in:
Jesse Plamondon-Willard 2017-03-30 18:59:01 -04:00
parent 04cae4ef46
commit df1e748629
5 changed files with 443 additions and 783 deletions

View File

@ -2,20 +2,23 @@
<!--
## 2.0
See [log](https://github.com/Pathoschild/SMAPI/compare/1.9...2.0).
See [log](https://github.com/Pathoschild/SMAPI/compare/1.10...2.0).
For mod developers:
* Added `ContentEvents.AssetLoading` event with a helper which lets you intercept the XNB content
load, and dynamically adjust or replace the content being loaded (including support for patching
images).
## 1.10
See [log](https://github.com/Pathoschild/SMAPI/compare/1.9...1.10).
* Updated for Stardew Valley 1.2.
* SMAPI now rewrites many mods for compatibility with game updates, but some mods will need an update.
-->
## 1.9
See [log](https://github.com/Pathoschild/SMAPI/compare/1.8...1.9).
For players:
* Updated for Stardew Valley 1.2.
* SMAPI now rewrites many mods for compatibility with game updates, but some mods will need an update.
* SMAPI now detects incompatible mods and disables them before they cause problems.
* SMAPI now allows mods nested into an otherwise empty parent folder (like `Mods\ModName-1.0\ModName\manifest.json`), since that's a common default behaviour when unpacking mods.
* The installer now detects if you need to update .NET Framework before installing SMAPI.
@ -35,10 +38,10 @@ For players:
For mod developers:
* Added a simpler API for console commands (see `helper.ConsoleCommands`).
* Added `SaveEvents.AfterReturnToTitle` event triggered when the player returns to the title screen.
* Added `TimeEvents.AfterDayStarted` event triggered when a day starts. This happens no matter how the day started (including new game, loaded save, or player went to bed).
* Added `ContentEvents.AfterLocaleChanged` event triggered when the player changes the content language.
* Added `GetPrivateProperty` to the reflection helper.
* Added `ContentEvents.AfterLocaleChanged` event triggered when the player changes the content language (for the upcoming Stardew Valley 1.2).
* Added `SaveEvents.AfterReturnToTitle` event triggered when the player returns to the title screen (for the upcoming Stardew Valley 1.2).
* Added `helper.Reflection.GetPrivateProperty` method.
* SMAPI now writes XNA input enums (`Buttons` and `Keys`) to JSON as strings automatically, so mods no longer need to add a `StringEnumConverter` themselves for those.
* The SMAPI log now has a simpler filename.
* The SMAPI log now shows the OS caption (like "Windows 10") instead of its internal version when available.

View File

@ -33,10 +33,10 @@ namespace StardewModdingAPI
** Public
****/
/// <summary>SMAPI's current semantic version.</summary>
public static ISemanticVersion ApiVersion { get; } = new SemanticVersion(1, 8, 0);
public static ISemanticVersion ApiVersion { get; } = new SemanticVersion(1, 9, 0);
/// <summary>The minimum supported version of Stardew Valley.</summary>
public static ISemanticVersion MinimumGameVersion { get; } = new SemanticVersion("1.2.15");
public static ISemanticVersion MinimumGameVersion { get; } = new SemanticVersion("1.1.1");
/// <summary>The path to the game folder.</summary>
public static string ExecutionPath { get; } = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
@ -146,9 +146,6 @@ namespace StardewModdingAPI
/****
** Finders throw an exception when incompatible code is found.
****/
// changes in Stardew Valley 1.2 (with no rewriters)
new FieldFinder("StardewValley.Item", "set_Name"),
// APIs removed in SMAPI 1.9
new TypeFinder("StardewModdingAPI.Advanced.ConfigFile"),
new TypeFinder("StardewModdingAPI.Advanced.IConfigFile"),
@ -172,12 +169,7 @@ namespace StardewModdingAPI
// crossplatform
new MethodParentRewriter(typeof(SpriteBatch), typeof(SpriteBatchWrapper), onlyIfPlatformChanged: true),
// Stardew Valley 1.2
new FieldToPropertyRewriter(typeof(Game1), nameof(Game1.activeClickableMenu)),
new FieldToPropertyRewriter(typeof(Game1), nameof(Game1.gameMode)),
new FieldToPropertyRewriter(typeof(Game1), nameof(Game1.player)),
new FieldReplaceRewriter(typeof(Game1), "borderFont", nameof(Game1.smallFont)),
new FieldReplaceRewriter(typeof(Game1), "smoothFont", nameof(Game1.smallFont)),
// SMAPI 1.9
new TypeReferenceRewriter("StardewModdingAPI.Inheritance.ItemStackChange", typeof(ItemStackChange))
};
}

File diff suppressed because it is too large Load Diff

View File

@ -219,7 +219,10 @@ namespace StardewModdingAPI
this.GameInstance.Exiting += (sender, e) => this.IsGameRunning = false;
this.GameInstance.Window.ClientSizeChanged += (sender, e) => GraphicsEvents.InvokeResize(this.Monitor, sender, e);
this.GameInstance.Window.Title = $"Stardew Valley {Constants.GameVersion} with SMAPI {Constants.ApiVersion}";
StardewValley.Program.gamePtr = this.GameInstance;
{
Type type = typeof(Game1).Assembly.GetType("StardewValley.Program", true);
type.GetField("gamePtr").SetValue(null, this.GameInstance);
}
// configure
Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef;

View File

@ -27,15 +27,6 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha
* Changing this field is not recommended and may destabilise your game.
*/
"ModCompatibility": [
{
"Name": "AccessChestAnywhere",
"ID": "AccessChestAnywhere",
"UpperVersion": "1.1",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/257",
"UnofficialUpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/518",
"Notes": "Crashes with 'Method not found: Void StardewValley.Item.set_Name(System.String)'."
},
{
"Name": "Almighty Tool",
"ID": "AlmightyTool.dll",
@ -50,7 +41,14 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha
"UpperVersion": "2.3",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/41",
"UnofficialUpdateUrl": "http://community.playstarbound.com/threads/125031",
"Notes": "Uses obsolete StardewModdingAPI.Extensions."
},
{
"Name": "Better Sprinklers",
"ID": "Speeder.BetterSprinklers",
"UpperVersion": "2.3",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/41",
"Notes": "Uses obsolete StardewModdingAPI.Extensions."
},
{
@ -62,36 +60,26 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha
"Notes": "Not compatible with Stardew Valley 1.1+"
},
{
"Name": "Chests Anywhere",
"ID": "ChestsAnywhere",
"UpperVersion": "1.8.2",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/518",
"Notes": "Crashes with 'Method not found: Void StardewValley.Menus.TextBox.set_Highlighted(Boolean)'."
"Name": "CJB Cheats Menu",
"ID": "CJBCheatsMenu",
"UpperVersion": "1.12",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/4",
"Notes": "Not compatible with Stardew Valley 1.1+"
},
{
"Name": "Chests Anywhere",
"ID": "Pathoschild.ChestsAnywhere",
"UpperVersion": "1.9-beta",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/518",
"Notes": "ID changed in 1.9. Crashes with InvalidOperationException: 'The menu doesn't seem to have a player inventory'."
"Name": "CJB Item Spawner",
"ID": "CJBItemSpawner",
"UpperVersion": "1.5",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/93",
"Notes": "Not compatible with Stardew Valley 1.1+"
},
{
"Name": "CJB Automation",
"ID": "CJBAutomation",
"UpperVersion": "1.4",
"Name": "CJB Show Item Sell Price",
"ID": "CJBShowItemSellPrice",
"UpperVersion": "1.6",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/211",
"Notes": "Crashes with 'Method not found: Void StardewValley.Item.set_Name(System.String)'."
},
{
"Name": "Cooking Skill",
"ID": "CookingSkill",
"UpperVersion": "1.0.3",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/522",
"Notes": "Crashes with 'Method not found: Void StardewValley.Buff..ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, System.String)'."
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/93",
"Notes": "Uses SMAPI's internal SGame class."
},
{
"Name": "Enemy Health Bars",
@ -109,38 +97,6 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha
"UpdateUrl": "http://community.playstarbound.com/resources/4228",
"Notes": "Uses obsolete StardewModdingAPI.Inheritance.SObject until 1.6.1; then crashes until 1.6.4 ('Entoarox Framework requested an immediate game shutdown: Fatal error attempting to update player tick properties System.NullReferenceException: Object reference not set to an instance of an object. at Entoarox.Framework.PlayerHelper.Update(Object s, EventArgs e)')."
},
{
"Name": "Extended Fridge",
"ID": "Mystra007ExtendedFridge",
"UpperVersion": "1.0",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/485",
"Notes": "Actual upper version is 0.94, but mod incorrectly sets it to 1.0 in the manifest. Crashes with 'Field not found: StardewValley.Game1.mouseCursorTransparency'."
},
{
"Name": "Get Dressed",
"ID": "GetDressed.dll",
"UpperVersion": "3.2",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/331",
"Notes": "Crashes with NullReferenceException in GameEvents.UpdateTick."
},
{
"Name": "Lookup Anything",
"ID": "LookupAnything",
"UpperVersion": "1.10",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/541",
"Notes": "Crashes with FormatException when looking up NPCs."
},
{
"Name": "Lookup Anything",
"ID": "Pathoschild.LookupAnything",
"UpperVersion": "1.10.1",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/541",
"Notes": "ID changed in 1.10.1. Crashes with FormatException when looking up NPCs."
},
{
"Name": "Makeshift Multiplayer",
"ID": "StardewValleyMP",
@ -155,7 +111,7 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha
"UpperVersion": "0.5",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/237",
"Notes": "Uses Assembly.GetExecutingAssembly().Location."
"Notes": "Uses obsolete StardewModdingAPI.Extensions."
},
{
"Name": "NPC Map Locations",
@ -198,14 +154,6 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha
"UpdateUrl": "http://www.nexusmods.com/stardewvalley/mods/683",
"Notes": "Crashes with 'Method not found: Void StardewModdingAPI.Command.CallCommand(System.String)'."
},
{
"Name": "Teleporter",
"ID": "Teleporter",
"UpperVersion": "1.0.2",
"Compatibility": "AssumeBroken",
"UpdateUrl": "http://community.playstarbound.com/resources/4374",
"Notes": "Crashes with 'InvalidOperationException: The StardewValley.Menus.MapPage object doesn't have a private 'points' instance field'."
},
{
"Name": "Zoryn's Better RNG",
"ID": "76b6d1e1-f7ba-4d72-8c32-5a1e6d2716f6",