From 50a146d1c9a228391c4201685a5e0df9daa529e9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 20 Dec 2020 22:34:58 -0500 Subject: [PATCH 01/12] update game version --- docs/release-notes.md | 4 ++++ src/SMAPI/Constants.cs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 1115f482..00445832 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,6 +7,10 @@ * Migrated to Harmony 2.0 (see [_migrate to Harmony 2.0_](https://stardewvalleywiki.com/Modding:Migrate_to_Harmony_2.0) for more info). --> +## Upcoming release +* For players: + * Updated for Stardew Valley 1.5. + ## 3.7.6 Released 21 November 2020 for Stardew Valley 1.4.1 or later. diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 88f79811..5ff324b0 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -54,10 +54,10 @@ namespace StardewModdingAPI public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.7.6"); /// The minimum supported version of Stardew Valley. - public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.4.1"); + public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.5.0"); /// The maximum supported version of Stardew Valley. - public static ISemanticVersion MaximumGameVersion { get; } = new GameVersion("1.4.5"); + public static ISemanticVersion MaximumGameVersion { get; } = null; /// The target game platform. public static GamePlatform TargetPlatform { get; } = EarlyConstants.Platform; From 2e8c7e06c5c46834b570b667cb7497fe4cc408ac Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 20 Dec 2020 22:34:59 -0500 Subject: [PATCH 02/12] update for split-screen mode This includes splitting GameRunner (the main game instance) from Game1 (now a per-screen game state), adding a PerScreen utility to simplify per-screen values, adding separate per-screen input handling and events, adding new Context fields for split-screen, and logging the screen ID in split-screen mode to distinguish log entries. --- docs/release-notes.md | 6 +- .../Framework/LogParsing/LogMessageBuilder.cs | 8 +- .../Framework/LogParsing/LogParser.cs | 4 +- .../Framework/LogParsing/Models/LogMessage.cs | 3 + src/SMAPI.Web/Views/LogParser/Index.cshtml | 11 +- src/SMAPI/Constants.cs | 3 + src/SMAPI/Context.cs | 79 +++- src/SMAPI/Framework/Logging/LogManager.cs | 5 +- src/SMAPI/Framework/ModHelpers/DataHelper.cs | 8 +- src/SMAPI/Framework/ModHelpers/InputHelper.cs | 21 +- src/SMAPI/Framework/ModHelpers/ModHelper.cs | 6 +- src/SMAPI/Framework/Monitor.cs | 11 +- src/SMAPI/Framework/SCore.cs | 402 ++++++++++-------- src/SMAPI/Framework/SGame.cs | 121 ++++-- src/SMAPI/Framework/SGameRunner.cs | 156 +++++++ src/SMAPI/Utilities/PerScreen.cs | 79 ++++ 16 files changed, 646 insertions(+), 277 deletions(-) create mode 100644 src/SMAPI/Framework/SGameRunner.cs create mode 100644 src/SMAPI/Utilities/PerScreen.cs diff --git a/docs/release-notes.md b/docs/release-notes.md index 00445832..176961d4 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -9,7 +9,11 @@ ## Upcoming release * For players: - * Updated for Stardew Valley 1.5. + * Updated for Stardew Valley 1.5, including split-screen support. + +* For modders: + * Added `PerScreen` utility and new `Context` fields to simplify split-screen support in mods. + * Added screen ID to log when playing in split-screen mode. ## 3.7.6 Released 21 November 2020 for Stardew Valley 1.4.1 or later. diff --git a/src/SMAPI.Web/Framework/LogParsing/LogMessageBuilder.cs b/src/SMAPI.Web/Framework/LogParsing/LogMessageBuilder.cs index 42e283a9..992876ef 100644 --- a/src/SMAPI.Web/Framework/LogParsing/LogMessageBuilder.cs +++ b/src/SMAPI.Web/Framework/LogParsing/LogMessageBuilder.cs @@ -16,6 +16,9 @@ namespace StardewModdingAPI.Web.Framework.LogParsing /// The log level for the next log message. public LogLevel Level { get; set; } + /// The screen ID in split-screen mode. + public int ScreenId { get; set; } + /// The mod name for the next log message. public string Mod { get; set; } @@ -36,10 +39,11 @@ namespace StardewModdingAPI.Web.Framework.LogParsing /// Start accumulating values for a new log message. /// The local time when the log was posted. /// The log level. + /// The screen ID in split-screen mode. /// The mod name. /// The initial log text. /// A log message is already started; call before starting a new message. - public void Start(string time, LogLevel level, string mod, string text) + public void Start(string time, LogLevel level, int screenId, string mod, string text) { if (this.Started) throw new InvalidOperationException("Can't start new message, previous log message isn't done yet."); @@ -48,6 +52,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing this.Time = time; this.Level = level; + this.ScreenId = screenId; this.Mod = mod; this.Text.Append(text); } @@ -74,6 +79,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing { Time = this.Time, Level = this.Level, + ScreenId = this.ScreenId, Mod = this.Mod, Text = this.Text.ToString() }; diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs index 227dcd89..f69d4b6f 100644 --- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs +++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs @@ -14,7 +14,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing ** Fields *********/ /// A regex pattern matching the start of a SMAPI message. - private readonly Regex MessageHeaderPattern = new Regex(@"^\[(?