Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Nov 1, 2017
2 parents 7911831 + 089e6de commit e0b7237
Show file tree
Hide file tree
Showing 95 changed files with 2,765 additions and 661 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ _ReSharper*/
**/packages/*
*.nuget.props
*.nuget.targets

# sensitive files
appsettings.Development.json
4 changes: 2 additions & 2 deletions build/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
using System.Runtime.InteropServices;

[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
10 changes: 5 additions & 5 deletions build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!-- copy files into game directory and enable debugging (only in debug mode) -->
<Target Name="AfterBuild">
<CallTarget Targets="CopySMAPI;CopyTrainerMod" Condition="'$(Configuration)' == 'Debug'" />
<CallTarget Targets="CopySMAPI;CopyDefaultMod" Condition="'$(Configuration)' == 'Debug'" />
</Target>
<Target Name="CopySMAPI" Condition="'$(MSBuildProjectName)' == 'StardewModdingAPI'">
<Copy SourceFiles="$(TargetDir)\$(TargetName).exe" DestinationFolder="$(GamePath)" />
Expand All @@ -89,10 +89,10 @@
<Copy SourceFiles="$(TargetDir)\Newtonsoft.Json.dll" DestinationFolder="$(GamePath)" />
<Copy SourceFiles="$(TargetDir)\Mono.Cecil.dll" DestinationFolder="$(GamePath)" />
</Target>
<Target Name="CopyTrainerMod" Condition="'$(MSBuildProjectName)' == 'TrainerMod'">
<Copy SourceFiles="$(TargetDir)\$(TargetName).dll" DestinationFolder="$(GamePath)\Mods\TrainerMod" />
<Copy SourceFiles="$(TargetDir)\$(TargetName).pdb" DestinationFolder="$(GamePath)\Mods\TrainerMod" Condition="Exists('$(TargetDir)\$(TargetName).pdb')" />
<Copy SourceFiles="$(TargetDir)\manifest.json" DestinationFolder="$(GamePath)\Mods\TrainerMod" />
<Target Name="CopyDefaultMod" Condition="'$(MSBuildProjectName)' == 'StardewModdingAPI.Mods.ConsoleCommands'">
<Copy SourceFiles="$(TargetDir)\$(TargetName).dll" DestinationFolder="$(GamePath)\Mods\ConsoleCommands" />
<Copy SourceFiles="$(TargetDir)\$(TargetName).pdb" DestinationFolder="$(GamePath)\Mods\ConsoleCommands" Condition="Exists('$(TargetDir)\$(TargetName).pdb')" />
<Copy SourceFiles="$(TargetDir)\manifest.json" DestinationFolder="$(GamePath)\Mods\ConsoleCommands" />
</Target>

<!-- launch SMAPI on debug -->
Expand Down
30 changes: 29 additions & 1 deletion docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
# Release notes
## 2.1
* For players:
* Added a log parser at [log.smapi.io](https://log.smapi.io).
* Added better Steam instructions to the SMAPI installer.
* Renamed the bundled _TrainerMod_ to _ConsoleCommands_ to make its purpose clearer.
* Removed the game's test messages from the console log.
* Improved update-check errors when playing offline.
* Fixed compatibility check for players with Stardew Valley 1.08.
* Fixed `player_setlevel` command not setting XP too.

* For modders:
* The reflection API now works with public code to simplify mod integrations.
* The content API now lets you invalidated multiple assets at once.
* The `InputEvents` have been improved:
* Added `e.IsActionButton` and `e.IsUseToolButton`.
* Added `ToSButton()` extension for the game's `Game1.options` button type.
* Deprecated `e.IsClick`, which is limited and unclear. Use `IsActionButton` or `IsUseToolButton` instead.
* Fixed `e.SuppressButton()` not correctly suppressing keyboard buttons.
* Fixed `e.IsClick` (now `e.IsActionButton`) ignoring custom key bindings.
* `SemanticVersion` can now be constructed from a `System.Version`.
* Fixed reflection API blocking access to some non-SMAPI members.
* Fixed content API allowing absolute paths as asset keys.
* Fixed content API failing to load custom map tilesheets that aren't preloaded.
* Fixed content API incorrectly detecting duplicate loaders when a mod implements `IAssetLoader` directly.

* For SMAPI developers:
* Added the installer version and platform to the installer window title to simplify troubleshooting.

## 2.0
### Release highlights
* **Mod update checks**
Expand All @@ -18,7 +46,7 @@
SMAPI 2.0 adds several features to enable new kinds of mods (see
[API documentation](https://stardewvalleywiki.com/Modding:SMAPI_APIs)).

The **content API** lets you edit, inject, and reload XNB data loaded by the game at any time. This let SMAPI mods do
The **content API** lets you edit, inject, and reload XNB data loaded by the game at any time. This lets SMAPI mods do
anything previously only possible with XNB mods, and enables new mod scenarios not possible with XNB mods (e.g.
seasonal textures, NPC clothing that depend on the weather or location, etc).

Expand Down
107 changes: 97 additions & 10 deletions docs/technical-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@
This file provides more technical documentation about SMAPI. If you only want to use or create
mods, this section isn't relevant to you; see the main README to use or create mods.

## Contents
* [Development](#development)
* [Compiling from source](#compiling-from-source)
* [Debugging a local build](#debugging-a-local-build)
* [Preparing a release](#preparing-a-release)
* [Customisation](#customisation)
* [Configuration file](#configuration-file)
* [Command-line arguments](#command-line-arguments)
* [Compile flags](#compile-flags)

# Contents
* [SMAPI](#smapi)
* [Development](#development)
* [Compiling from source](#compiling-from-source)
* [Debugging a local build](#debugging-a-local-build)
* [Preparing a release](#preparing-a-release)
* [Customisation](#customisation)
* [Configuration file](#configuration-file)
* [Command-line arguments](#command-line-arguments)
* [Compile flags](#compile-flags)
* [SMAPI web services](#smapi-web-services)
* [Overview](#overview)
* [Log parser](#log-parser)
* [Mods API](#mods-api)
* [Development](#development-2)
* [Local development](#local-development)
* [Deploying to Amazon Beanstalk](#deploying-to-amazon-beanstalk)

# SMAPI
## Development
### Compiling from source
Using an official SMAPI release is recommended for most users.
Expand Down Expand Up @@ -135,3 +144,81 @@ SMAPI uses a small number of conditional compilation constants, which you can se
flag | purpose
---- | -------
`SMAPI_FOR_WINDOWS` | Indicates that SMAPI is being compiled on Windows for players on Windows. Set automatically in `crossplatform.targets`.
# SMAPI web services
## Overview
The `StardewModdingAPI.Web` project provides an API and web UI hosted at `*.smapi.io`.
### Log parser
The log parser provides a web UI for uploading, parsing, and sharing SMAPI logs. The logs are
persisted in a compressed form to Pastebin.
The log parser lives at https://log.smapi.io.
### Mods API
The mods API provides version info for mods hosted by Chucklefish, GitHub, or Nexus Mods. It's used
by SMAPI to perform update checks. The `{version}` URL token is the version of SMAPI making the
request; it doesn't do anything currently, but lets us version breaking changes if needed.
Each mod is identified by a repository key and unique identifier (like `nexus:541`). The following
repositories are supported:
key | repository
------------- | ----------
`chucklefish` | A mod page on the [Chucklefish mod site](https://community.playstarbound.com/resources/categories/22), identified by the mod ID in the page URL.
`github` | A repository on [GitHub](https://github.com), identified by its owner and repository name (like `Zoryn4163/SMAPI-Mods`). This checks the version of the latest repository release.
`nexus` | A mod page on [Nexus Mods](https://www.nexusmods.com/stardewvalley), identified by the mod ID in the page URL.
The API accepts either `GET` or `POST` for convenience:
> ```
>GET https://api.smapi.io/v2.0/mods?modKeys=nexus:541,chucklefish:4228
>```
>```
>POST https://api.smapi.io/v2.0/mods
>{
> "ModKeys": [ "nexus:541", "chucklefish:4228" ]
>}
>```
It returns a response like this:
>```
>{
> "chucklefish:4228": {
> "name": "Entoarox Framework",
> "version": "1.8.0",
> "url": "https://community.playstarbound.com/resources/4228"
> },
> "nexus:541": {
> "name": "Lookup Anything",
> "version": "1.16",
> "url": "http://www.nexusmods.com/stardewvalley/mods/541"
> }
>}
>```
## Development
### Local development
`StardewModdingAPI.Web` is a regular ASP.NET MVC Core app, so you can just launch it from within
Visual Studio to run a local version.
There are two differences when it's run locally: all endpoints use HTTP instead of HTTPS, and the
subdomain portion becomes a route (e.g. `log.smapi.io` &rarr; `localhost:59482/log`).
Before running it locally, you need to enter your credentials in the `appsettings.Development.json`
file. See the next section for a description of each setting. This file is listed in `.gitignore`
to prevent accidentally committing credentials.
### Deploying to Amazon Beanstalk
The app can be deployed to a standard Amazon Beanstalk IIS environment. When creating the
environment, make sure to specify the following environment properties:
property name | description
------------------------------- | -----------------
`LogParser:PastebinDevKey` | The [Pastebin developer key](https://pastebin.com/api#1) used to authenticate with the Pastebin API.
`LogParser:PastebinUserKey` | The [Pastebin user key](https://pastebin.com/api#8) used to authenticate with the Pastebin API. Can be left blank to post anonymously.
`LogParser:SectionUrl` | The root URL of the log page, like `https://log.smapi.io/`.
`ModUpdateCheck:GitHubPassword` | The password with which to authenticate to GitHub when fetching release info.
`ModUpdateCheck:GitHubUsername` | The username with which to authenticate to GitHub when fetching release info.
13 changes: 13 additions & 0 deletions src/SMAPI.Common/SemanticVersionImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ public SemanticVersionImpl(int major, int minor, int patch, string tag = null)
this.Tag = this.GetNormalisedTag(tag);
}

/// <summary>Construct an instance.</summary>
/// <param name="version">The assembly version.</param>
/// <exception cref="ArgumentNullException">The <paramref name="version"/> is null.</exception>
public SemanticVersionImpl(Version version)
{
if (version == null)
throw new ArgumentNullException(nameof(version), "The input version can't be null.");

this.Major = version.Major;
this.Minor = version.Minor;
this.Patch = version.Build;
}

/// <summary>Construct an instance.</summary>
/// <param name="version">The semantic version string.</param>
/// <exception cref="ArgumentNullException">The <paramref name="version"/> is null.</exception>
Expand Down
39 changes: 25 additions & 14 deletions src/SMAPI.Installer/InteractiveInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Threading;
using Microsoft.Win32;
using StardewModdingApi.Installer.Enums;
using StardewModdingAPI.Common;

namespace StardewModdingApi.Installer
{
Expand Down Expand Up @@ -97,6 +98,7 @@ private IEnumerable<string> GetUninstallPaths(DirectoryInfo installDir, Director

// obsolete
yield return GetInstallPath("Mods/.cache"); // 1.3-1.4
yield return GetInstallPath("Mods/TrainerMod"); // *–2.0 (renamed to ConsoleCommands)
yield return GetInstallPath("Mono.Cecil.Rocks.dll"); // 1.3–1.8
yield return GetInstallPath("StardewModdingAPI-settings.json"); // 1.0-1.4
if (modsDir.Exists)
Expand Down Expand Up @@ -135,6 +137,13 @@ private IEnumerable<string> GetUninstallPaths(DirectoryInfo installDir, Director
/// </remarks>
public void Run(string[] args)
{
/****
** Get platform & set window title
****/
Platform platform = this.DetectPlatform();
Console.Title = $"SMAPI {new SemanticVersionImpl(this.GetType().Assembly.GetName().Version)} installer on {platform}";
Console.WriteLine();

/****
** read command-line arguments
****/
Expand All @@ -159,10 +168,6 @@ public void Run(string[] args)
/****
** collect details
****/
// get platform
Platform platform = this.DetectPlatform();
this.PrintDebug($"Platform: {(platform == Platform.Windows ? "Windows" : "Linux or Mac")}.");

// get game path
DirectoryInfo installDir = this.InteractivelyGetInstallPath(platform, gamePathArg);
if (installDir == null)
Expand All @@ -182,7 +187,9 @@ public void Run(string[] args)
unixLauncher = Path.Combine(installDir.FullName, "StardewValley"),
unixLauncherBackup = Path.Combine(installDir.FullName, "StardewValley-original")
};
this.PrintDebug($"Install path: {installDir}.");

// show output
Console.WriteLine($"Your game folder: {installDir}.");

/****
** validate assumptions
Expand Down Expand Up @@ -340,22 +347,26 @@ public void Run(string[] args)
this.InteractivelyRemoveAppDataMods(platform, modsDir, packagedModsDir);
}
Console.WriteLine();
Console.WriteLine();

/****
** exit
** final instructions
****/
this.PrintColor("Done!", ConsoleColor.DarkGreen);
if (platform == Platform.Windows)
{
this.PrintColor(
action == ScriptAction.Install
? "Don't forget to launch StardewModdingAPI.exe instead of the normal game executable. See the readme.txt for details."
: "If you manually changed shortcuts or Steam to launch SMAPI, don't forget to change those back.",
ConsoleColor.DarkGreen
);
if (action == ScriptAction.Install)
{
this.PrintColor("SMAPI is installed! If you use Steam, set your launch options to enable achievements (see smapi.io/install):", ConsoleColor.DarkGreen);
this.PrintColor($" \"{Path.Combine(installDir.FullName, "StardewModdingAPI.exe")}\" %command%", ConsoleColor.DarkGreen);
Console.WriteLine();
this.PrintColor("If you don't use Steam, launch StardewModdingAPI.exe in your game folder to play with mods.", ConsoleColor.DarkGreen);
}
else
this.PrintColor("SMAPI is removed! If you configured Steam to launch SMAPI, don't forget to clear your launch options.", ConsoleColor.DarkGreen);
}
else if (action == ScriptAction.Install)
this.PrintColor("You can launch the game the same way as before to play with mods.", ConsoleColor.DarkGreen);
this.PrintColor("SMAPI is installed! Launch the game the same way as before to play with mods.", ConsoleColor.DarkGreen);

Console.ReadKey();
}

Expand Down
3 changes: 2 additions & 1 deletion src/SMAPI.Installer/StardewModdingAPI.Installer.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -50,6 +50,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="..\SMAPI.Common\StardewModdingAPI.Common.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\build\common.targets" />
<Import Project="..\..\build\prepare-install-package.targets" />
Expand Down
22 changes: 11 additions & 11 deletions src/SMAPI.Installer/readme.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
 ___ ___ ___ ___
/ /\ /__/\ / /\ / /\ ___
/ /:/_ | |::\ / /::\ / /::\ / /\
/ /:/ /\ | |:|:\ / /:/\:\ / /:/\:\ / /:/
/ /:/ /::\ __|__|:|\:\ / /:/~/::\ / /:/~/:/ /__/::\
/__/:/ /:/\:\ /__/::::| \:\ /__/:/ /:/\:\ /__/:/ /:/ \__\/\:\__
\ \:\/:/~/:/ \ \:\~~\__\/ \ \:\/:/__\/ \ \:\/:/ \ \:\/\
\ \::/ /:/ \ \:\ \ \::/ \ \::/ \__\::/
\__\/ /:/ \ \:\ \ \:\ \ \:\ /__/:/
/__/:/ \ \:\ \ \:\ \ \:\ \__\/
\__\/ \__\/ \__\/ \__\/
___ ___ ___ ___ ___
/ /\ /__/\ / /\ / /\ / /\
/ /:/_ | |::\ / /::\ / /::\ / /:/
/ /:/ /\ | |:|:\ / /:/\:\ / /:/\:\ / /:/
/ /:/ /::\ __|__|:|\:\ / /:/~/::\ / /:/~/:/ / /::\ ___
/__/:/ /:/\:\ /__/::::| \:\ /__/:/ /:/\:\ /__/:/ /:/ /__/:/\:\ /\
\ \:\/:/~/:/ \ \:\~~\__\/ \ \:\/:/__\/ \ \:\/:/ \__\/ \:\/:/
\ \::/ /:/ \ \:\ \ \::/ \ \::/ \__\::/
\__\/ /:/ \ \:\ \ \:\ \ \:\ / /:/
/__/:/ \ \:\ \ \:\ \ \:\ /__/:/
\__\/ \__\/ \__\/ \__\/ \__\/


SMAPI lets you run Stardew Valley with mods. Don't forget to download mods separately.
Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI.ModBuildConfig/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
[assembly: AssemblyDescription("")]
[assembly: Guid("ea4f1e80-743f-4a1d-9757-ae66904a196a")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyVersion("2.0.2.0")]
[assembly: AssemblyFileVersion("2.0.2.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>StardewModdingAPI.ModBuildConfig</RootNamespace>
<AssemblyName>StardewModdingAPI.ModBuildConfig</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
Expand Down
5 changes: 4 additions & 1 deletion src/SMAPI.ModBuildConfig/package.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Pathoschild.Stardew.ModBuildConfig</id>
<version>2.0.1</version>
<version>2.0.2</version>
<title>Build package for SMAPI mods</title>
<authors>Pathoschild</authors>
<owners>Pathoschild</owners>
Expand All @@ -23,6 +23,9 @@

2.0.1:
- Fixed mod deploy failing to create subfolders if they don't already exist.

2.0.2:
- Fixed compatibility issue on Linux.
</releaseNotes>
</metadata>
<files>
Expand Down
Loading

0 comments on commit e0b7237

Please sign in to comment.