diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs
index 0f19908e..4c53cfb7 100644
--- a/src/SMAPI/Constants.cs
+++ b/src/SMAPI/Constants.cs
@@ -20,7 +20,7 @@ namespace StardewModdingAPI
** Public
****/
/// SMAPI's current semantic version.
- public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.3.2.3", allowNonStandard: true);
+ public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.3.2.4", allowNonStandard: true);
/// The minimum supported version of Stardew Valley.
public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.4.5");
diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/TypePropertyToAnotherTypeMethodRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/TypePropertyToAnotherTypeMethodRewriter.cs
new file mode 100644
index 00000000..efba50e4
--- /dev/null
+++ b/src/SMAPI/Framework/ModLoading/Rewriters/TypePropertyToAnotherTypeMethodRewriter.cs
@@ -0,0 +1,66 @@
+using System;
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+using StardewModdingAPI.Framework.ModLoading.Finders;
+
+namespace StardewModdingAPI.Framework.ModLoading.Rewriters
+{
+ internal class TypePropertyToAnotherTypeMethodRewriter : PropertyFinder
+ {
+ /*********
+ ** Fields
+ *********/
+ /// The type whose field to which references should be rewritten to.
+ private readonly Type ToType;
+
+ /// The property name.
+ private readonly string GetterName;
+ /// The property name.
+ private readonly string SetterName;
+ /// The property name.
+ private readonly string PropertyName;
+
+ /*********
+ ** Public methods
+ *********/
+ /// Construct an instance.
+ /// The type whose field to which references should be rewritten.
+ /// The field name to rewrite.
+ /// The property name (if different).
+ public TypePropertyToAnotherTypeMethodRewriter(Type type, Type toType, string propertyName, string targetGetter = null, string targetSetter = null)
+ : base(type.FullName, propertyName, InstructionHandleResult.None)
+ {
+ this.ToType = toType;
+ this.PropertyName = propertyName;
+ this.GetterName = targetGetter;
+ this.SetterName = targetSetter;
+ }
+
+ /// Perform the predefined logic for an instruction if applicable.
+ /// The assembly module containing the instruction.
+ /// The CIL processor.
+ /// The instruction to handle.
+ /// Metadata for mapping assemblies to the current platform.
+ /// Whether the mod was compiled on a different platform.
+ public override InstructionHandleResult Handle(ModuleDefinition module, ILProcessor cil, Instruction instruction, PlatformAssemblyMap assemblyMap, bool platformChanged)
+ {
+ if (!this.IsMatch(instruction))
+ return InstructionHandleResult.None;
+
+ MethodReference methodRef = RewriteHelper.AsMethodReference(instruction);
+ if (this.GetterName != null && methodRef.Name == "get_" + this.PropertyName)
+ {
+ methodRef = module.ImportReference(this.ToType.GetMethod(this.GetterName));
+ cil.Replace(instruction, cil.Create(OpCodes.Callvirt, methodRef));
+ return InstructionHandleResult.Rewritten;
+ }
+ if(this.SetterName != null && methodRef.Name == "set_" + this.PropertyName)
+ {
+ methodRef = module.ImportReference(this.ToType.GetMethod(this.SetterName));
+ cil.Replace(instruction, cil.Create(OpCodes.Callvirt, methodRef));
+ return InstructionHandleResult.Rewritten;
+ }
+ return InstructionHandleResult.None;
+ }
+ }
+}
diff --git a/src/SMAPI/Framework/RewriteFacades/TextBoxMethods.cs b/src/SMAPI/Framework/RewriteFacades/TextBoxMethods.cs
index cd4aaf0b..26b43061 100644
--- a/src/SMAPI/Framework/RewriteFacades/TextBoxMethods.cs
+++ b/src/SMAPI/Framework/RewriteFacades/TextBoxMethods.cs
@@ -1,7 +1,6 @@
-using System.Diagnostics.CodeAnalysis;
+using System.Reflection;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
-using StardewValley;
using StardewValley.Menus;
#pragma warning disable 1591 // missing documentation
@@ -9,10 +8,20 @@ namespace StardewModdingAPI.Framework.RewriteFacades
{
public class TextBoxMethods : TextBox
{
+ public static void SelectedSetter(TextBox textBox, bool value)
+ {
+ if(!textBox.Selected && value)
+ {
+ typeof(TextBox).GetMethod("ShowAndroidKeyboard", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(textBox, new object[] { });
+ textBox.Selected = value;
+ }
+ else
+ textBox.Selected = value;
+ }
+
public TextBoxMethods(Texture2D textboxTexture, Texture2D caretTexture, SpriteFont font, Color textColor)
: base(textboxTexture, caretTexture, font, textColor, true, false)
{
-
}
}
}
diff --git a/src/SMAPI/Metadata/InstructionMetadata.cs b/src/SMAPI/Metadata/InstructionMetadata.cs
index dd97d36d..d05008ec 100644
--- a/src/SMAPI/Metadata/InstructionMetadata.cs
+++ b/src/SMAPI/Metadata/InstructionMetadata.cs
@@ -72,6 +72,8 @@ namespace StardewModdingAPI.Metadata
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(AnimalQueryMenu), typeof(AnimalQueryMenuMethods), "allowReproductionButton", "AllowReproductionButtonProp");
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(AnimalQueryMenu), typeof(AnimalQueryMenuMethods), "sellButton", "SellButtonProp");
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(AnimalQueryMenu), typeof(AnimalQueryMenuMethods), "moveHomeButton", "MoveHomeButtonProp");
+ // TextBox fix
+ yield return new TypePropertyToAnotherTypeMethodRewriter(typeof(TextBox), typeof(TextBoxMethods), "Selected", null, "SelectedSetter");
// Rewrite Missing Type
yield return new TypeReferenceRewriter("StardewValley.Menus.CraftingPage", typeof(CraftingPageMobile));
diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj
index 921d6632..c8d1039e 100644
--- a/src/SMAPI/SMAPI.csproj
+++ b/src/SMAPI/SMAPI.csproj
@@ -246,6 +246,7 @@
+