Imporve compatibility
This commit is contained in:
parent
18f34debcc
commit
f59c4f194b
|
@ -15,6 +15,7 @@
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:resizeableActivity="false"
|
android:resizeableActivity="false"
|
||||||
android:debuggable="true"
|
android:debuggable="true"
|
||||||
android:requestLegacyExternalStorage="true"></application>
|
android:requestLegacyExternalStorage="true">
|
||||||
|
</application>
|
||||||
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
|
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace Loader
|
||||||
public static void UpdateIdValues()
|
public static void UpdateIdValues()
|
||||||
{
|
{
|
||||||
global::StardewModdingAPI.Resource.String.app_name = global::Loader.Resource.String.app_name;
|
global::StardewModdingAPI.Resource.String.app_name = global::Loader.Resource.String.app_name;
|
||||||
|
global::StardewModdingAPI.Resource.String.hello = global::Loader.Resource.String.hello;
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class Attribute
|
public partial class Attribute
|
||||||
|
@ -125,6 +126,9 @@ namespace Loader
|
||||||
// aapt resource value: 0x7F040001
|
// aapt resource value: 0x7F040001
|
||||||
public const int app_name = 2130968577;
|
public const int app_name = 2130968577;
|
||||||
|
|
||||||
|
// aapt resource value: 0x7F040002
|
||||||
|
public const int hello = 2130968578;
|
||||||
|
|
||||||
static String()
|
static String()
|
||||||
{
|
{
|
||||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||||
|
|
|
@ -13,10 +13,11 @@ namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades
|
||||||
{
|
{
|
||||||
|
|
||||||
public static new IList<IClickableMenu> onScreenMenus => Game1.onScreenMenus;
|
public static new IList<IClickableMenu> onScreenMenus => Game1.onScreenMenus;
|
||||||
|
public static new RainDrop[] RainDropsProp => Game1.rainDrops.ToArray();
|
||||||
|
|
||||||
public static new IList<GameLocation> LocationsGetter(Game1 game1)
|
public static new IList<GameLocation> LocationsGetter()
|
||||||
{
|
{
|
||||||
return game1._locations;
|
return Game1.game1._locations;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SMAPI_LEGACY_PATCH
|
#if SMAPI_LEGACY_PATCH
|
||||||
|
|
|
@ -292,6 +292,7 @@ namespace StardewModdingAPI.Framework
|
||||||
#if SMAPI_FOR_MOBILE
|
#if SMAPI_FOR_MOBILE
|
||||||
new StringPatcher(this.Reflection),
|
new StringPatcher(this.Reflection),
|
||||||
new ThreadSilenceExitPatch(this.Monitor),
|
new ThreadSilenceExitPatch(this.Monitor),
|
||||||
|
new UIThreadPatch(this.Monitor),
|
||||||
#endif
|
#endif
|
||||||
new TitleMenuPatcher(this.OnLoadStageChanged)
|
new TitleMenuPatcher(this.OnLoadStageChanged)
|
||||||
);
|
);
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace StardewModdingAPI.Metadata
|
||||||
|
|
||||||
#if SMAPI_FOR_MOBILE
|
#if SMAPI_FOR_MOBILE
|
||||||
// module rewrite for .Net 5 runtime assemblies
|
// module rewrite for .Net 5 runtime assemblies
|
||||||
yield return new ModuleReferenceRewriter("System.*", "System.", new Version(5,0), new[]
|
yield return new ModuleReferenceRewriter("System.*", "System.", new Version(4,0), new[]
|
||||||
{
|
{
|
||||||
typeof(System.Collections.CollectionBase).Assembly,
|
typeof(System.Collections.CollectionBase).Assembly,
|
||||||
typeof(System.Collections.Generic.ISet<>).Assembly,
|
typeof(System.Collections.Generic.ISet<>).Assembly,
|
||||||
|
@ -66,7 +66,7 @@ namespace StardewModdingAPI.Metadata
|
||||||
typeof(System.Xml.XmlDocument).Assembly,
|
typeof(System.Xml.XmlDocument).Assembly,
|
||||||
typeof(System.Xml.Linq.XComment).Assembly,
|
typeof(System.Xml.Linq.XComment).Assembly,
|
||||||
typeof(System.Collections.Generic.IReadOnlySet<>).Assembly,
|
typeof(System.Collections.Generic.IReadOnlySet<>).Assembly,
|
||||||
typeof(System.Data.DataTable).Assembly,
|
typeof(System.Data.DataTable).Assembly
|
||||||
});
|
});
|
||||||
|
|
||||||
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "onScreenMenus", "onScreenMenus");
|
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "onScreenMenus", "onScreenMenus");
|
||||||
|
@ -82,6 +82,7 @@ namespace StardewModdingAPI.Metadata
|
||||||
|
|
||||||
// Game1.location fix
|
// Game1.location fix
|
||||||
yield return new TypePropertyToAnotherTypeMethodRewriter(typeof(Game1), typeof(Game1Methods), "locations", "LocationsGetter", null);
|
yield return new TypePropertyToAnotherTypeMethodRewriter(typeof(Game1), typeof(Game1Methods), "locations", "LocationsGetter", null);
|
||||||
|
yield return new TypeFieldToAnotherTypePropertyRewriter(typeof(Game1), typeof(Game1Methods), "rainDrops", "RainDropsProp");
|
||||||
|
|
||||||
// Rewrite Missing Type
|
// Rewrite Missing Type
|
||||||
yield return new TypeReferenceRewriter("StardewValley.Menus.CraftingPage", typeof(CraftingPageMobile));
|
yield return new TypeReferenceRewriter("StardewValley.Menus.CraftingPage", typeof(CraftingPageMobile));
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
#if SMAPI_FOR_MOBILE
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Threading;
|
||||||
|
using HarmonyLib;
|
||||||
|
using StardewModdingAPI.Internal.Patching;
|
||||||
|
|
||||||
|
namespace StardewModdingAPI.Patches
|
||||||
|
{
|
||||||
|
/// <summary>A Harmony patch for <see cref="Microsoft.Xna.Framework.Threading"/> .</summary>
|
||||||
|
/// <remarks>Patch methods must be static for Harmony to work correctly. See the Harmony documentation before renaming patch arguments.</remarks>
|
||||||
|
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony and methods are named for clarity.")]
|
||||||
|
[SuppressMessage("ReSharper", "IdentifierTypo", Justification = "Argument names are defined by Harmony and methods are named for clarity.")]
|
||||||
|
internal class UIThreadPatch : BasePatcher
|
||||||
|
{
|
||||||
|
/*********
|
||||||
|
** Fields
|
||||||
|
*********/
|
||||||
|
|
||||||
|
/*********
|
||||||
|
** Fields
|
||||||
|
*********/
|
||||||
|
/// <summary>Writes messages to the console and log file.</summary>
|
||||||
|
private static IMonitor Monitor;
|
||||||
|
|
||||||
|
/*********
|
||||||
|
** Accessors
|
||||||
|
*********/
|
||||||
|
/// <summary>A unique name for this patch.</summary>
|
||||||
|
public string Name => nameof(UIThreadPatch);
|
||||||
|
|
||||||
|
|
||||||
|
/*********
|
||||||
|
** Public methods
|
||||||
|
*********/
|
||||||
|
/// <summary>Construct an instance.</summary>
|
||||||
|
/// <param name="monitorForGame">Writes messages to the console and log file on behalf of the game.</param>
|
||||||
|
public UIThreadPatch(IMonitor monitor)
|
||||||
|
{
|
||||||
|
Monitor = monitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Apply the Harmony patch.</summary>
|
||||||
|
/// <param name="harmony">The Harmony instance.</param>
|
||||||
|
public override void Apply(Harmony harmony, IMonitor monitor)
|
||||||
|
{
|
||||||
|
harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(Microsoft.Xna.Framework.Point).Assembly.GetType("Microsoft.Xna.Framework.Threading"), "EnsureUIThread"),
|
||||||
|
prefix: this.GetHarmonyMethod(nameof(UIThreadPatch.UIThreadPatch_Prefix))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********
|
||||||
|
** Private methods
|
||||||
|
*********/
|
||||||
|
/// <summary>The method to call instead of <see cref="Microsoft.Xna.Framework.Threading.EnsureUIThread"/>.</summary>
|
||||||
|
/// <returns>Returns whether to execute the original method.</returns>
|
||||||
|
private static bool UIThreadPatch_Prefix()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Reference in New Issue