Merge branch 'develop' of https://github.com/Pathoschild/SMAPI into harmony2

This commit is contained in:
ZaneYork 2020-06-08 11:17:10 +08:00
commit ef854b288e
2 changed files with 6 additions and 4 deletions

View File

@ -7,6 +7,7 @@
* MacOS files starting with `._` are now ignored and can no longer cause skipped mods. * MacOS files starting with `._` are now ignored and can no longer cause skipped mods.
* Simplified paranoid warning logs and reduced their log level. * Simplified paranoid warning logs and reduced their log level.
* Reduced startup time when loading mod DLLs (thanks to ZaneYork!). * Reduced startup time when loading mod DLLs (thanks to ZaneYork!).
* Reduced processing time when a mod loads many unpacked images (thanks to Entoarox!).
* Fixed `BadImageFormatException` error detection. * Fixed `BadImageFormatException` error detection.
* Fixed black maps on Android for mods which use `.tmx` files. * Fixed black maps on Android for mods which use `.tmx` files.

View File

@ -252,10 +252,11 @@ namespace StardewModdingAPI.Framework.ContentManagers
texture.GetData(data); texture.GetData(data);
for (int i = 0; i < data.Length; i++) for (int i = 0; i < data.Length; i++)
{ {
if (data[i].A == byte.MinValue || data[i].A == byte.MaxValue) var pixel = data[i];
if (pixel.A == byte.MinValue || pixel.A == byte.MaxValue)
continue; // no need to change fully transparent/opaque pixels continue; // no need to change fully transparent/opaque pixels
data[i] = Color.FromNonPremultiplied(data[i].ToVector4()); data[i] = new Color(pixel.R * pixel.A / byte.MaxValue, pixel.G * pixel.A / byte.MaxValue, pixel.B * pixel.A / byte.MaxValue, pixel.A); // slower version: Color.FromNonPremultiplied(data[i].ToVector4())
} }
texture.SetData(data); texture.SetData(data);
@ -280,12 +281,12 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// * If the location is indoors or the desert, or the image source contains 'path' or 'object', it's loaded /// * If the location is indoors or the desert, or the image source contains 'path' or 'object', it's loaded
/// as-is relative to the <c>Content</c> folder. /// as-is relative to the <c>Content</c> folder.
/// * Else it's loaded from <c>Content\Maps</c> with a seasonal prefix. /// * Else it's loaded from <c>Content\Maps</c> with a seasonal prefix.
/// ///
/// That logic doesn't work well in our case, mainly because we have no location metadata at this point. /// That logic doesn't work well in our case, mainly because we have no location metadata at this point.
/// Instead we use a more heuristic approach: check relative to the map file first, then relative to /// Instead we use a more heuristic approach: check relative to the map file first, then relative to
/// <c>Content\Maps</c>, then <c>Content</c>. If the image source filename contains a seasonal prefix, try for a /// <c>Content\Maps</c>, then <c>Content</c>. If the image source filename contains a seasonal prefix, try for a
/// seasonal variation and then an exact match. /// seasonal variation and then an exact match.
/// ///
/// While that doesn't exactly match the game logic, it's close enough that it's unlikely to make a difference. /// While that doesn't exactly match the game logic, it's close enough that it's unlikely to make a difference.
/// </remarks> /// </remarks>
private void FixCustomTilesheetPaths(Map map, string relativeMapPath) private void FixCustomTilesheetPaths(Map map, string relativeMapPath)