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 Dec 2, 2022
2 parents b95d2a3 + a2944ee commit 368b25b
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repo. It imports the other MSBuild files as needed.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--set general build properties -->
<Version>3.18.0</Version>
<Version>3.18.1</Version>
<Product>SMAPI</Product>
<LangVersion>latest</LangVersion>
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
Expand Down
9 changes: 9 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
_If needed, you can update to SMAPI 3.16.0 first and then install the latest version._
-->

## 3.18.1
Released 01 December 2022 for Stardew Valley 1.5.6 or later.

* For players:
* Fixed mod texture edits sometimes cut off (thanks to atravita!).

* For the web UI:
* The log parser no longer warns about missing Error Handler on Android, where it doesn't exist yet (thanks to AnotherPillow!).

## 3.18.0
Released 12 November 2022 for Stardew Valley 1.5.6 or later. See [release highlights](https://www.patreon.com/posts/74565278).

Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.ConsoleCommands/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
"Version": "3.18.0",
"Version": "3.18.1",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
"MinimumApiVersion": "3.18.0"
"MinimumApiVersion": "3.18.1"
}
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.ErrorHandler/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Error Handler",
"Author": "SMAPI",
"Version": "3.18.0",
"Version": "3.18.1",
"Description": "Handles some common vanilla errors to log more useful info or avoid breaking the game.",
"UniqueID": "SMAPI.ErrorHandler",
"EntryDll": "ErrorHandler.dll",
"MinimumApiVersion": "3.18.0"
"MinimumApiVersion": "3.18.1"
}
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.SaveBackup/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Save Backup",
"Author": "SMAPI",
"Version": "3.18.0",
"Version": "3.18.1",
"Description": "Automatically backs up all your saves once per day into its folder.",
"UniqueID": "SMAPI.SaveBackup",
"EntryDll": "SaveBackup.dll",
"MinimumApiVersion": "3.18.0"
"MinimumApiVersion": "3.18.1"
}
2 changes: 1 addition & 1 deletion src/SMAPI.Web/Views/LogParser/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ else if (log?.IsValid == true)
{
<h2>Suggested fixes</h2>
<ul id="fix-list">
@if (errorHandler is null)
@if (errorHandler is null && log.ApiVersionParsed?.IsNewerThan("3.8.4") is true)
{
<li class="important">You don't have the <strong>Error Handler</strong> mod installed. This automatically prevents many game or mod errors. You can <a href="https://stardewvalleywiki.com/Modding:Player_Guide#Install_SMAPI">reinstall SMAPI</a> to re-add it.</li>
}
Expand Down
2 changes: 1 addition & 1 deletion src/SMAPI/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal static class EarlyConstants
internal static int? LogScreenId { get; set; }

/// <summary>SMAPI's current raw semantic version.</summary>
internal static string RawApiVersion = "3.18.0";
internal static string RawApiVersion = "3.18.1";
}

/// <summary>Contains SMAPI's constants and assumptions.</summary>
Expand Down
36 changes: 18 additions & 18 deletions src/SMAPI/Framework/Content/AssetDataForImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ private void GetPatchBounds([NotNull] ref Rectangle? sourceArea, [NotNull] ref R
/// <exception cref="InvalidOperationException">The content being read isn't an image.</exception>
private void PatchImageImpl(Color[] sourceData, int sourceWidth, int sourceHeight, Rectangle sourceArea, Rectangle targetArea, PatchMode patchMode, int startRow = 0)
{
// get texture
// get texture info
Texture2D target = this.Data;
int pixelCount = sourceArea.Width * sourceArea.Height;
int firstPixel = startRow * sourceArea.Width;
int lastPixel = firstPixel + pixelCount - 1;

// validate
if (sourceArea.X < 0 || sourceArea.Y < 0 || sourceArea.Right > sourceWidth || sourceArea.Bottom > sourceHeight)
Expand All @@ -155,36 +157,34 @@ private void PatchImageImpl(Color[] sourceData, int sourceWidth, int sourceHeigh
// shortcut: replace the entire area
if (patchMode == PatchMode.Replace)
{
target.SetData(0, targetArea, sourceData, startRow * sourceArea.Width, pixelCount);
target.SetData(0, targetArea, sourceData, firstPixel, pixelCount);
return;
}

// skip transparent pixels at the start & end (e.g. large spritesheet with a few sprites replaced)
int startIndex = -1;
int endIndex = -1;
for (int i = firstPixel; i <= lastPixel; i++)
{
for (int i = startRow * sourceArea.Width; i < pixelCount; i++)
if (sourceData[i].A >= AssetDataForImage.MinOpacity)
{
if (sourceData[i].A >= AssetDataForImage.MinOpacity)
{
startIndex = i;
break;
}
startIndex = i;
break;
}
if (startIndex == -1)
return; // blank texture
}
if (startIndex == -1)
return; // blank texture

for (int i = startRow * sourceArea.Width + pixelCount - 1; i >= startIndex; i--)
for (int i = lastPixel; i >= startIndex; i--)
{
if (sourceData[i].A >= AssetDataForImage.MinOpacity)
{
if (sourceData[i].A >= AssetDataForImage.MinOpacity)
{
endIndex = i;
break;
}
endIndex = i;
break;
}
if (endIndex == -1)
return; // ???
}
if (endIndex == -1)
return; // ???

// update target rectangle
int sourceOffset;
Expand Down

0 comments on commit 368b25b

Please sign in to comment.