From a546fd113f431bd8888da50aad087213193c937e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 25 May 2022 18:02:48 -0400 Subject: add experimental image load rewrite --- src/SMAPI/SMAPI.csproj | 1 + 1 file changed, 1 insertion(+) (limited to 'src/SMAPI/SMAPI.csproj') diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj index a0ca54cc..91e4c668 100644 --- a/src/SMAPI/SMAPI.csproj +++ b/src/SMAPI/SMAPI.csproj @@ -41,6 +41,7 @@ + -- cgit From b6a8dcdd46dbc2875b24e0f77049c61a5cf398d9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 29 Mar 2022 18:59:05 -0400 Subject: update to Harmony 2.2.1 --- build/0Harmony.dll | Bin 167424 -> 238592 bytes build/0Harmony.xml | 594 ++++++++++++++++++++- docs/release-notes.md | 2 + .../Framework/TemporaryHacks/MiniMonoModHotfix.cs | 25 - src/SMAPI/SMAPI.csproj | 2 +- 5 files changed, 570 insertions(+), 53 deletions(-) (limited to 'src/SMAPI/SMAPI.csproj') diff --git a/build/0Harmony.dll b/build/0Harmony.dll index 91d36ea2..492255be 100644 Binary files a/build/0Harmony.dll and b/build/0Harmony.dll differ diff --git a/build/0Harmony.xml b/build/0Harmony.xml index ba2f340e..8499d20b 100644 --- a/build/0Harmony.xml +++ b/build/0Harmony.xml @@ -265,6 +265,9 @@ This is a static constructor + + This targets the MoveNext method of the enumerator result + Specifies the type of argument @@ -475,6 +478,13 @@ An array of argument types to target overloads An array of + + + An annotation that specifies a method, property or constructor to patch + The full name of the declaring class/type + The name of the method, property or constructor to patch + The + Annotation to define the original method for delegate injection @@ -796,6 +806,13 @@ The lambda expression using the method + + + Returns an instruction to call the specified closure + The delegate type to emit + The closure that defines the method to call + A that calls the closure as a method + Creates a CodeInstruction loading a field (LD[S]FLD[A]) @@ -980,6 +997,11 @@ For normal frames, frame.GetMethod() is returned. For frames containing patched methods, the replacement method is returned or null if no method can be found + + Gets the original method from the stackframe and uses original if method is a dynamic replacement + The + The original method from that stackframe + Gets Harmony version for all active Harmony instances [out] The current Harmony version @@ -1210,7 +1232,7 @@ - Patch serialization + Patch serialization @@ -1241,27 +1263,27 @@ - Serializable patch information + Serializable patch information - Prefixes as an array of + Prefixes as an array of - Postfixes as an array of + Postfixes as an array of - Transpilers as an array of + Transpilers as an array of - Finalizers as an array of + Finalizers as an array of - Returns if any of the patches wants debugging turned on + Returns if any of the patches wants debugging turned on @@ -1339,35 +1361,35 @@ - A serializable patch + A serializable patch - Zero-based index + Zero-based index - The owner (Harmony ID) + The owner (Harmony ID) - The priority, see + The priority, see - Keep this patch before the patches indicated in the list of Harmony IDs + Keep this patch before the patches indicated in the list of Harmony IDs - Keep this patch after the patches indicated in the list of Harmony IDs + Keep this patch after the patches indicated in the list of Harmony IDs - A flag that will log the replacement method via every time this patch is used to build the replacement, even in the future + A flag that will log the replacement method via every time this patch is used to build the replacement, even in the future - The method of the static patch method + The method of the static patch method @@ -1760,6 +1782,12 @@ The name of the field A field or null when type/name is null or when the field cannot be found + + + Gets the reflection information for a directly declared field + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A field or null when the field cannot be found + Gets the reflection information for a field by searching the type and all its super types @@ -1767,6 +1795,12 @@ The name of the field (case sensitive) A field or null when type/name is null or when the field cannot be found + + + Gets the reflection information for a field by searching the type and all its super types + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A field or null when the field cannot be found + Gets the reflection information for a field @@ -1781,6 +1815,12 @@ The name of the property (case sensitive) A property or null when type/name is null or when the property cannot be found + + + Gets the reflection information for a directly declared property + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A property or null when the property cannot be found + Gets the reflection information for the getter method of a directly declared property @@ -1788,6 +1828,12 @@ The name of the property (case sensitive) A method or null when type/name is null or when the property cannot be found + + + Gets the reflection information for the getter method of a directly declared property + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A method or null when the property cannot be found + Gets the reflection information for the setter method of a directly declared property @@ -1795,6 +1841,12 @@ The name of the property (case sensitive) A method or null when type/name is null or when the property cannot be found + + + Gets the reflection information for the Setter method of a directly declared property + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A method or null when the property cannot be found + Gets the reflection information for a property by searching the type and all its super types @@ -1802,6 +1854,12 @@ The name A property or null when type/name is null or when the property cannot be found + + + Gets the reflection information for a property by searching the type and all its super types + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A property or null when the property cannot be found + Gets the reflection information for the getter method of a property by searching the type and all its super types @@ -1809,6 +1867,12 @@ The name A method or null when type/name is null or when the property cannot be found + + + Gets the reflection information for the getter method of a property by searching the type and all its super types + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A method or null when type/name is null or when the property cannot be found + Gets the reflection information for the setter method of a property by searching the type and all its super types @@ -1816,6 +1880,12 @@ The name A method or null when type/name is null or when the property cannot be found + + + Gets the reflection information for the setter method of a property by searching the type and all its super types + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A method or null when type/name is null or when the property cannot be found + Gets the reflection information for a directly declared method @@ -1825,6 +1895,14 @@ Optional list of types that define the generic version of the method A method or null when type/name is null or when the method cannot be found + + + Gets the reflection information for a directly declared method + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + Optional parameters to target a specific overload of the method + Optional list of types that define the generic version of the method + A method or null when the method cannot be found + Gets the reflection information for a method by searching the type and all its super types @@ -1837,12 +1915,17 @@ Gets the reflection information for a method by searching the type and all its super types - The target method in the form TypeFullName:MethodName, where the type name matches a form recognized by Type.GetType like Some.Namespace.Type. + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. Optional parameters to target a specific overload of the method Optional list of types that define the generic version of the method - A method or null when type/name is null or when the method cannot be found + A method or null when the method cannot be found + + Gets the method of an enumerator method + Enumerator method that creates the enumerator + The internal method of the enumerator or null if no valid enumerator is detected + Gets the names of all method that are declared in a type The declaring class/type @@ -2109,6 +2192,12 @@ + + Creates a field reference delegate for an instance field of a class or static field (NOT an instance field of a struct) + type of the field + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A readable/assignable delegate with T=object + Creates a field reference delegate for an instance field of a class or static field (NOT an instance field of a struct) @@ -2281,6 +2370,13 @@ The name of the field A readable/assignable reference to the field + + + Creates a static field reference + The type of the field + The member in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + A readable/assignable reference to the field + Creates a static field reference @@ -2336,6 +2432,34 @@ + + + Creates a delegate to a given method + The delegate Type + The method in the form TypeFullName:MemberName, where TypeFullName matches the form recognized by Type.GetType like Some.Namespace.Type. + + Only applies for instance methods. If null (default), returned delegate is an open (a.k.a. unbound) instance delegate + where an instance is supplied as the first argument to the delegate invocation; else, delegate is a closed (a.k.a. bound) + instance delegate where the delegate invocation always applies to the given . + + + Only applies for instance methods. If true (default) and is virtual, invocation of the delegate + calls the instance method virtually (the instance type's most-derived/overriden implementation of the method is called); + else, invocation of the delegate calls the exact specified (this is useful for calling base class methods) + Note: if false and is an interface method, an ArgumentException is thrown. + + A delegate of given to given + + + Delegate invocation is more performant and more convenient to use than + at a one-time setup cost. + + + Works for both type of static and instance methods, both open and closed (a.k.a. unbound and bound) instance methods, + and both class and struct methods. + + + Creates a delegate for a given delegate definition, attributed with [] @@ -2508,6 +2632,412 @@ The objects The hash code + + + A CodeInstruction match + + + The name of the match + + + The matched opcodes + + + The matched operands + + + The jumps from the match + + + The jumps to the match + + + The match predicate + + + Creates a code match + The optional opcode + The optional operand + The optional name + + + + Creates a code match + The CodeInstruction + An optional name + + + + Creates a code match + The predicate + An optional name + + + + Returns a string that represents the match + A string representation + + + + A CodeInstruction matcher + + + The current position + The index or -1 if out of bounds + + + + Gets the number of code instructions in this matcher + The count + + + + Checks whether the position of this CodeMatcher is within bounds + True if this CodeMatcher is valid + + + + Checks whether the position of this CodeMatcher is outside its bounds + True if this CodeMatcher is invalid + + + + Gets the remaining code instructions + The remaining count + + + + Gets the opcode at the current position + The opcode + + + + Gets the operand at the current position + The operand + + + + Gets the labels at the current position + The labels + + + + Gets the exception blocks at the current position + The blocks + + + + Creates an empty code matcher + + + Creates a code matcher from an enumeration of instructions + The instructions (transpiler argument) + An optional IL generator + + + + Makes a clone of this instruction matcher + A copy of this matcher + + + + Gets instructions at the current position + The instruction + + + + Gets instructions at the current position with offset + The offset + The instruction + + + + Gets all instructions + A list of instructions + + + + Gets all instructions as an enumeration + A list of instructions + + + + Gets some instructions counting from current position + Number of instructions + A list of instructions + + + + Gets all instructions within a range + The start index + The end index + A list of instructions + + + + Gets all instructions within a range (relative to current position) + The start offset + The end offset + A list of instructions + + + + Gets a list of all distinct labels + The instructions (transpiler argument) + A list of Labels + + + + Reports a failure + The method involved + The logger + True if current position is invalid and error was logged + + + + Throw an InvalidOperationException if current state is invalid (position out of bounds / last match failed) + Explanation of where/why the exception was thrown that will be added to the exception message + The same code matcher + + + + Throw an InvalidOperationException if current state is invalid (position out of bounds / last match failed), + or if the matches do not match at current position + Explanation of where/why the exception was thrown that will be added to the exception message + Some code matches + The same code matcher + + + + Throw an InvalidOperationException if current state is invalid (position out of bounds / last match failed), + or if the matches do not match at any point between current position and the end + Explanation of where/why the exception was thrown that will be added to the exception message + Some code matches + The same code matcher + + + + Throw an InvalidOperationException if current state is invalid (position out of bounds / last match failed), + or if the matches do not match at any point between current position and the start + Explanation of where/why the exception was thrown that will be added to the exception message + Some code matches + The same code matcher + + + + Throw an InvalidOperationException if current state is invalid (position out of bounds / last match failed), + or if the check function returns false + Explanation of where/why the exception was thrown that will be added to the exception message + Function that checks validity of current state. If it returns false, an exception is thrown + The same code matcher + + + + Sets an instruction at current position + The instruction to set + The same code matcher + + + + Sets instruction at current position and advances + The instruction + The same code matcher + + + + Sets opcode and operand at current position + The opcode + The operand + The same code matcher + + + + Sets opcode and operand at current position and advances + The opcode + The operand + The same code matcher + + + + Sets opcode at current position and advances + The opcode + The same code matcher + + + + Sets operand at current position and advances + The operand + The same code matcher + + + + Creates a label at current position + [out] The label + The same code matcher + + + + Creates a label at a position + The position + [out] The new label + The same code matcher + + + + Creates a label at a position + The offset + [out] The new label + The same code matcher + + + + Adds an enumeration of labels to current position + The labels + The same code matcher + + + + Adds an enumeration of labels at a position + The position + The labels + The same code matcher + + + + Sets jump to + Branch instruction + Destination for the jump + [out] The created label + The same code matcher + + + + Inserts some instructions + The instructions + The same code matcher + + + + Inserts an enumeration of instructions + The instructions + The same code matcher + + + + Inserts a branch + The branch opcode + Branch destination + The same code matcher + + + + Inserts some instructions and advances the position + The instructions + The same code matcher + + + + Inserts an enumeration of instructions and advances the position + The instructions + The same code matcher + + + + Inserts a branch and advances the position + The branch opcode + Branch destination + The same code matcher + + + + Removes current instruction + The same code matcher + + + + Removes some instruction from current position by count + Number of instructions + The same code matcher + + + + Removes the instructions in a range + The start + The end + The same code matcher + + + + Removes the instructions in a offset range + The start offset + The end offset + The same code matcher + + + + Advances the current position + The offset + The same code matcher + + + + Moves the current position to the start + The same code matcher + + + + Moves the current position to the end + The same code matcher + + + + Searches forward with a predicate and advances position + The predicate + The same code matcher + + + + Searches backwards with a predicate and reverses position + The predicate + The same code matcher + + + + Matches forward and advances position to beginning of matching sequence + Some code matches + The same code matcher + + + + Matches forward and advances position to ending of matching sequence + Some code matches + The same code matcher + + + + Matches backwards and reverses position to beginning of matching sequence + Some code matches + The same code matcher + + + + Matches backwards and reverses position to ending of matching sequence + Some code matches + The same code matcher + + + + Repeats a match action until boundaries are met + The match action + An optional action that is executed when no match is found + The same code matcher + + + + Gets a match by its name + The match name + An instruction + General extensions for common cases @@ -2574,6 +3104,11 @@ Extensions for + + Returns if an is initialized and valid + The + + Shortcut for testing whether the operand is equal to a non-null value The @@ -2715,15 +3250,15 @@ A list of - Moves all labels from the code instruction to a different one + Moves all labels from the code instruction to another one The to move the labels from - The to move the labels to + The other to move the labels to The code instruction labels were moved from (now empty) - Moves all labels from a different code instruction to the current one - The to move the labels from - The to move the labels to + Moves all labels from another code instruction to the current one + The to move the labels to + The other to move the labels from The code instruction that received the labels @@ -2744,15 +3279,15 @@ A list of - Moves all ExceptionBlocks from the code instruction to a different one + Moves all ExceptionBlocks from the code instruction to another one The to move the ExceptionBlocks from - The to move the ExceptionBlocks to + The other to move the ExceptionBlocks to The code instruction blocks were moved from (now empty) - Moves all ExceptionBlocks from a different code instruction to the current one - The to move the ExceptionBlocks from - The to move the ExceptionBlocks to + Moves all ExceptionBlocks from another code instruction to the current one + The to move the ExceptionBlocks to + The other to move the ExceptionBlocks from The code instruction that received the blocks @@ -2859,6 +3394,11 @@ Log a string directly to disk. Slower method that prevents missing information in case of a crash The string to log. + + + Log a string directly to disk if Harmony.DEBUG is true. Slower method that prevents missing information in case of a crash + The string to log. + Resets and deletes the log diff --git a/docs/release-notes.md b/docs/release-notes.md index ddf97fe8..0781eb40 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,6 +7,8 @@ * For mod authors: * Added a new `IRawTextureData` asset type. _You can now load image files through `helper.ModContent` as `IRawTextureData` instead of `Texture2D`. This provides the image size and raw pixel data, which you can pass into other SMAPI APIs like `asset.AsImage().PatchImage`. This is much more efficient when you don't need a full `Texture2D` instance, since it bypasses the GPU operations needed to create one._ + * Updated to Harmony 2.2.1 (see what's new in [2.2.0](https://github.com/pardeike/Harmony/releases/tag/v2.2.0.0) and [2.2.1](https://github.com/pardeike/Harmony/releases/tag/v2.2.1.0)). + * Updated dependencies (MonoMod.Common 21.6.21.1 → 22.3.5.1). * Removed transitional `UsePintail` option added in 3.14.0 (now always enabled). * For mod authors: diff --git a/src/SMAPI/Framework/TemporaryHacks/MiniMonoModHotfix.cs b/src/SMAPI/Framework/TemporaryHacks/MiniMonoModHotfix.cs index b5fc1f57..1fcda077 100644 --- a/src/SMAPI/Framework/TemporaryHacks/MiniMonoModHotfix.cs +++ b/src/SMAPI/Framework/TemporaryHacks/MiniMonoModHotfix.cs @@ -27,15 +27,6 @@ namespace MonoMod.Utils private static readonly object[] _NoArgs = Array.Empty(); private static readonly object?[] _CacheGetterArgs = { /* MemberListType.All */ 0, /* name apparently always null? */ null }; - private static readonly Type? t_RuntimeModule = - typeof(Module).Assembly - .GetType("System.Reflection.RuntimeModule"); - - private static readonly PropertyInfo? p_RuntimeModule_RuntimeType = - typeof(Module).Assembly - .GetType("System.Reflection.RuntimeModule") - ?.GetProperty("RuntimeType", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); - private static readonly Type? t_RuntimeType = typeof(Type).Assembly .GetType("System.RuntimeType"); @@ -109,22 +100,6 @@ namespace MonoMod.Utils } } - public static Type? GetModuleType(this Module? module) - { - // Sadly we can't blindly resolve type 0x02000001 as the runtime throws ArgumentException. - - if (module == null || t_RuntimeModule == null || !t_RuntimeModule.IsInstanceOfType(module)) - return null; - - // .NET - if (p_RuntimeModule_RuntimeType != null) - return (Type?)p_RuntimeModule_RuntimeType.GetValue(module, _NoArgs); - - // The hotfix doesn't apply to Mono anyway, thus that's not copied over. - - return null; - } - public static Type? GetRealDeclaringType(this MemberInfo member) { return member.DeclaringType ?? member.Module.GetModuleType(); diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj index 91e4c668..5bc12429 100644 --- a/src/SMAPI/SMAPI.csproj +++ b/src/SMAPI/SMAPI.csproj @@ -23,7 +23,7 @@ - + -- cgit From 0bb9fc42933fc01c349a685e061a753cecb49518 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 7 Jun 2022 21:27:11 -0400 Subject: update Newtonsoft.Json --- docs/release-notes.md | 13 ++++++------- src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj | 2 +- src/SMAPI.Tests/SMAPI.Tests.csproj | 2 +- src/SMAPI.Toolkit/SMAPI.Toolkit.csproj | 2 +- src/SMAPI/SMAPI.csproj | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/SMAPI/SMAPI.csproj') diff --git a/docs/release-notes.md b/docs/release-notes.md index 66447b3d..83dcd53d 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,16 +7,15 @@ See [release highlights](https://www.patreon.com/posts/66986798). * For players: * Optimized mod image file loading. * Minor optimizations (thanks to Michael Kuklinski / Ameisen!). -* For mod authors: - * Added a new `IRawTextureData` asset type. - _You can now load image files through `helper.ModContent` as `IRawTextureData` instead of `Texture2D`. This provides the image size and raw pixel data, which you can pass into other SMAPI APIs like `asset.AsImage().PatchImage`. This is much more efficient when you don't need a full `Texture2D` instance, since it bypasses the GPU operations needed to create one._ - * Updated to Harmony 2.2.1 (see what's new in [2.2.0](https://github.com/pardeike/Harmony/releases/tag/v2.2.0.0) and [2.2.1](https://github.com/pardeike/Harmony/releases/tag/v2.2.1.0)). - * Updated dependencies (MonoMod.Common 21.6.21.1 → 22.3.5.1). - * Removed transitional `UsePintail` option added in 3.14.0 (now always enabled). * For mod authors: - * Fixed map edits which change warps sometimes rebuilding the NPC pathfinding cache unnecessarily, which could cause a noticeable delay for players. + * Added a [new `IRawTextureData` asset type](https://stardewvalleywiki.com/Modding:Migrate_to_SMAPI_4.0#Raw_texture_data), so mods can avoid creating full `Texture2D` instances in many cases. * In `smapi-internal/config.json`, you can now enable verbose logging for specific mods (instead of all or nothing). + * Updated dependencies: + * Harmony 2.2.1 (see changes in [2.2.0](https://github.com/pardeike/Harmony/releases/tag/v2.2.0.0) and [2.2.1](https://github.com/pardeike/Harmony/releases/tag/v2.2.1.0)); + * Newtonsoft.Json 13.0.1 (see [changes](https://github.com/JamesNK/Newtonsoft.Json/releases/tag/13.0.1)). + * Removed transitional `UsePintail` option added in 3.14.0 (now always enabled). + * Fixed map edits which change warps sometimes rebuilding the NPC pathfinding cache unnecessarily, which could cause a noticeable delay for players. ## 3.14.7 Released 01 June 2022 for Stardew Valley 1.5.6 or later. diff --git a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj index c5790186..e25da168 100644 --- a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj +++ b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj @@ -24,7 +24,7 @@ - +