Skip to content

Commit dfff36e

Browse files
committed
Merge branch 'develop' into stable
2 parents c65a628 + 7cdd030 commit dfff36e

File tree

37 files changed

+167
-129
lines changed

37 files changed

+167
-129
lines changed

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.3</Version>
10+
<Version>4.0.4</Version>
1111
<Product>SMAPI</Product>
1212
<LangVersion>latest</LangVersion>
1313
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Chinese | ✓ [fully translated](../src/SMAPI/i18n/zh.json)
6363
French | ✓ [fully translated](../src/SMAPI/i18n/fr.json)
6464
German | ✓ [fully translated](../src/SMAPI/i18n/de.json)
6565
Hungarian | ✓ [fully translated](../src/SMAPI/i18n/hu.json)
66+
Indonesian | ✓ [fully translated](../src/SMAPI/i18n/id.json)
6667
Italian | ✓ [fully translated](../src/SMAPI/i18n/it.json)
6768
Japanese | ✓ [fully translated](../src/SMAPI/i18n/ja.json)
6869
Korean | ✓ [fully translated](../src/SMAPI/i18n/ko.json)

docs/release-notes.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
[README](README.md)
22

33
# Release notes
4+
## 4.0.4
5+
Released 29 March 2024 for Stardew Valley 1.6.0 or later.
6+
7+
* For players:
8+
* Added `log_context` console command, which replaces `test_input` and logs more info like menu changes.
9+
* Added [`--prefer-terminal-name` command-line argument](technical/smapi.md#command-line-arguments) to override which terminal SMAPI is launched with (thanks to test482!).
10+
* Fixed some mods compiled for Stardew Valley 1.6.3+ not working in 1.6.0–1.6.2.
11+
* Fixed SMAPI's "_Found warnings with X mods_" message counting hidden warnings.
12+
* Improved translations. Thanks to RezaHidayatM (added Indonesian)!
13+
14+
* For the web UI:
15+
* Improved smapi.io colors for accessibility, converted PNG images to SVG, and updated Patreon logo (thanks to ishan!).
16+
* Fixed JSON schema validation:
17+
* Manifest `UpdateKeys` field now allows dots in the GitHub repo name.
18+
* Fixed Content Patcher's `FromMapFile` and `FromFile` patterns.
19+
420
## 4.0.3
521
Released 27 March 2024 for Stardew Valley 1.6.0 or later.
622

docs/technical/smapi.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ argument | purpose
4242
-------- | -------
4343
`--developer-mode`<br />`--developer-mode-off` | Enable or disable features intended for mod developers. Currently this only makes `TRACE`-level messages appear in the console.
4444
`--no-terminal` | SMAPI won't log anything to the console. On Linux/macOS only, this will also prevent the launch script from trying to open a terminal window. (Messages will still be written to the log file.)
45+
`--prefer-terminal-name` | On Linux/macOS only, the terminal with which to open the SMAPI console. For example, `--prefer-terminal-name=xterm` to use xterm regardless of which terminal is the default one.
4546
`--use-current-shell` | On Linux/macOS only, the launch script won't try to open a terminal window. All console output will be sent to the shell running the launch script.
4647
`--mods-path` | The path to search for mods, if not the standard `Mods` folder. This can be a path relative to the game folder (like `--mods-path "Mods (test)"`) or an absolute path.
4748

@@ -55,6 +56,7 @@ environment variable | purpose
5556
`SMAPI_DEVELOPER_MODE` | Equivalent to `--developer-mode` and `--developer-mode-off` above. The value must be `true` or `false`.
5657
`SMAPI_MODS_PATH` | Equivalent to `--mods-path` above.
5758
`SMAPI_NO_TERMINAL` | Equivalent to `--no-terminal` above.
59+
`$SMAPI_PREFER_TERMINAL_NAME` | Equivalent to `--prefer-terminal-name` above.
5860
`SMAPI_USE_CURRENT_SHELL` | Equivalent to `--use-current-shell` above.
5961

6062
### Compile flags

src/SMAPI.Installer/assets/unix-launcher.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ SKIP_TERMINAL=false
1313
# Whether to avoid opening a separate terminal, but still send the usual log output to the console.
1414
USE_CURRENT_SHELL=false
1515

16+
# Specify terminal name to open and output logs
17+
PREFER_TERMINAL_NAME=""
1618

1719
##########
1820
## Read environment variables
@@ -23,6 +25,9 @@ fi
2325
if [ "$SMAPI_USE_CURRENT_SHELL" == "true" ]; then
2426
USE_CURRENT_SHELL=true
2527
fi
28+
if [ "$SMAPI_PREFER_TERMINAL_NAME" != "" ]; then
29+
PREFER_TERMINAL_NAME=$SMAPI_PREFER_TERMINAL_NAME
30+
fi
2631

2732

2833
##########
@@ -32,6 +37,7 @@ while [ "$#" -gt 0 ]; do
3237
case "$1" in
3338
--skip-terminal ) SKIP_TERMINAL=true; shift ;;
3439
--use-current-shell ) USE_CURRENT_SHELL=true; shift ;;
40+
--prefer-terminal-name=* ) PREFER_TERMINAL_NAME="${1#*=}"; shift ;; # ${1#*=} removes everything up to the equals sign from $1
3541
-- ) shift; break ;;
3642
* ) shift ;;
3743
esac
@@ -92,13 +98,18 @@ else
9298

9399
# run in terminal
94100
if [ "$USE_CURRENT_SHELL" == "false" ]; then
95-
# select terminal (prefer xterm for best compatibility, then known supported terminals)
96-
for terminal in xterm gnome-terminal kitty terminator xfce4-terminal konsole terminal termite alacritty mate-terminal x-terminal-emulator wezterm; do
97-
if command -v "$terminal" 2>/dev/null; then
98-
export TERMINAL_NAME=$terminal
99-
break;
100-
fi
101-
done
101+
# if user said preferred terminal
102+
if [ "$PREFER_TERMINAL_NAME" != "" ]; then
103+
export TERMINAL_NAME=$PREFER_TERMINAL_NAME
104+
else
105+
# select terminal (prefer xterm for best compatibility, then known supported terminals)
106+
for terminal in xterm gnome-terminal kitty terminator xfce4-terminal konsole terminal termite alacritty mate-terminal x-terminal-emulator wezterm; do
107+
if command -v "$terminal" 2>/dev/null; then
108+
export TERMINAL_NAME=$terminal
109+
break;
110+
fi
111+
done
112+
fi
102113

103114
# find the true shell behind x-terminal-emulator
104115
if [ "$TERMINAL_NAME" = "x-terminal-emulator" ]; then

src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ConsoleCommand.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ internal abstract class ConsoleCommand : IConsoleCommand
1616
/// <summary>The command description.</summary>
1717
public string Description { get; }
1818

19-
/// <summary>Whether the command may need to perform logic when the player presses a button. This value shouldn't change.</summary>
20-
public bool MayNeedInput { get; }
21-
2219
/// <summary>Whether the command may need to perform logic when the game updates. This value shouldn't change.</summary>
2320
public bool MayNeedUpdate { get; }
2421

@@ -48,13 +45,11 @@ public virtual void OnButtonPressed(IMonitor monitor, SButton button) { }
4845
/// <summary>Construct an instance.</summary>
4946
/// <param name="name">The command name the user must type.</param>
5047
/// <param name="description">The command description.</param>
51-
/// <param name="mayNeedInput">Whether the command may need to perform logic when the player presses a button.</param>
5248
/// <param name="mayNeedUpdate">Whether the command may need to perform logic when the game updates.</param>
53-
protected ConsoleCommand(string name, string description, bool mayNeedInput = false, bool mayNeedUpdate = false)
49+
protected ConsoleCommand(string name, string description, bool mayNeedUpdate = false)
5450
{
5551
this.Name = name;
5652
this.Description = description;
57-
this.MayNeedInput = mayNeedInput;
5853
this.MayNeedUpdate = mayNeedUpdate;
5954
}
6055

src/SMAPI.Mods.ConsoleCommands/Framework/Commands/IConsoleCommand.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ internal interface IConsoleCommand
1515
/// <summary>Whether the command may need to perform logic when the game updates. This value shouldn't change.</summary>
1616
bool MayNeedUpdate { get; }
1717

18-
/// <summary>Whether the command may need to perform logic when the player presses a button. This value shouldn't change.</summary>
19-
bool MayNeedInput { get; }
20-
2118

2219
/*********
2320
** Public methods
@@ -31,10 +28,5 @@ internal interface IConsoleCommand
3128
/// <summary>Perform any logic needed on update tick.</summary>
3229
/// <param name="monitor">Writes messages to the console and log file.</param>
3330
void OnUpdated(IMonitor monitor);
34-
35-
/// <summary>Perform any logic when input is received.</summary>
36-
/// <param name="monitor">Writes messages to the console and log file.</param>
37-
/// <param name="button">The button that was pressed.</param>
38-
void OnButtonPressed(IMonitor monitor, SButton button);
3931
}
4032
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
using StardewModdingAPI.Framework;
3+
4+
namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other
5+
{
6+
/// <summary>A command which logs contextual info like keys pressed or menus changed until it's disabled.</summary>
7+
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "Loaded using reflection")]
8+
internal class LogContextCommand : ConsoleCommand
9+
{
10+
/*********
11+
** Public methods
12+
*********/
13+
/// <summary>Construct an instance.</summary>
14+
public LogContextCommand()
15+
: base("log_context", "Prints contextual info like keys pressed or menus changed until it's disabled.", mayNeedUpdate: true) { }
16+
17+
/// <summary>Handle the command.</summary>
18+
/// <param name="monitor">Writes messages to the console and log file.</param>
19+
/// <param name="command">The command name.</param>
20+
/// <param name="args">The command arguments.</param>
21+
public override void Handle(IMonitor monitor, string command, ArgumentParser args)
22+
{
23+
Monitor.ForceLogContext = true;
24+
25+
monitor.Log(
26+
Monitor.ForceLogContext ? "OK, logging contextual info until you run this command again." : "OK, no longer logging contextual info.",
27+
LogLevel.Info
28+
);
29+
}
30+
}
31+
}

src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/TestInputCommand.cs

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/SMAPI.Mods.ConsoleCommands/ModEntry.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
using StardewModdingAPI.Events;
54
using StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands;
65

76
namespace StardewModdingAPI.Mods.ConsoleCommands
@@ -18,9 +17,6 @@ public class ModEntry : Mod
1817
/// <summary>The commands which may need to handle update ticks.</summary>
1918
private IConsoleCommand[] UpdateHandlers = null!;
2019

21-
/// <summary>The commands which may need to handle input.</summary>
22-
private IConsoleCommand[] InputHandlers = null!;
23-
2420

2521
/*********
2622
** Public methods
@@ -35,27 +31,16 @@ public override void Entry(IModHelper helper)
3531
helper.ConsoleCommands.Add(command.Name, command.Description, (name, args) => this.HandleCommand(command, name, args));
3632

3733
// cache commands
38-
this.InputHandlers = this.Commands.Where(p => p.MayNeedInput).ToArray();
3934
this.UpdateHandlers = this.Commands.Where(p => p.MayNeedUpdate).ToArray();
4035

4136
// hook events
4237
helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked;
43-
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
4438
}
4539

4640

4741
/*********
4842
** Private methods
4943
*********/
50-
/// <summary>The method invoked when a button is pressed.</summary>
51-
/// <param name="sender">The event sender.</param>
52-
/// <param name="e">The event arguments.</param>
53-
private void OnButtonPressed(object? sender, ButtonPressedEventArgs e)
54-
{
55-
foreach (IConsoleCommand command in this.InputHandlers)
56-
command.OnButtonPressed(this.Monitor, e.Button);
57-
}
58-
5944
/// <summary>The method invoked when the game updates its state.</summary>
6045
/// <param name="sender">The event sender.</param>
6146
/// <param name="e">The event arguments.</param>

0 commit comments

Comments
 (0)