From 6430bbf7aca7ddd1266b4422e7bdcacb2cc0ec68 Mon Sep 17 00:00:00 2001 From: ZaneYork Date: Mon, 23 Mar 2020 18:44:33 +0800 Subject: [PATCH] Adapt for Galaxy Store Stardew Valley --- src/SMAPI/SMAPI.csproj | 48 +++++++++++++++++++++++++++----------- src/SMAPI/SMainActivity.cs | 14 ++++++++--- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj index c8d1039e..15c21a51 100644 --- a/src/SMAPI/SMAPI.csproj +++ b/src/SMAPI/SMAPI.csproj @@ -17,13 +17,14 @@ Off false v9.0 + $(DefineConstants);ANDROID_TARGET_SAMSUNG true portable false bin\Debug\ - DEBUG;TRACE + TRACE;DEBUG;ANDROID_TARGET_SAMSUNG prompt 4 latest @@ -52,24 +53,49 @@ runtime; build; native; contentfiles; analyzers - - - ..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\0Harmony.dll - + ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\Google.Android.Vending.Expansion.Downloader.dll ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\Google.Android.Vending.Licensing.dll + + ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\MonoGame.Framework.dll + + + ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\StardewValley.dll + + + ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\StardewValley.GameData.dll + + + + + ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\Google.Android.Vending.Expansion.Downloader.dll + + + ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\Google.Android.Vending.Licensing.dll + + + ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\MonoGame.Framework.dll + + + ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\StardewValley.dll + + + ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\StardewValley.GameData.dll + + + + + ..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\0Harmony.dll + ..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\Mono.Cecil.dll - - ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\MonoGame.Framework.dll - ..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\MonoMod.RuntimeDetour.dll @@ -85,12 +111,6 @@ ..\SMAPI.Toolkit.CoreInterfaces\bin\Debug\net4.5\SMAPI.Toolkit.CoreInterfaces.dll - - ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\StardewValley.dll - - - ..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\StardewValley.GameData.dll - diff --git a/src/SMAPI/SMainActivity.cs b/src/SMAPI/SMainActivity.cs index 30dee912..5bec9c78 100644 --- a/src/SMAPI/SMainActivity.cs +++ b/src/SMAPI/SMainActivity.cs @@ -14,7 +14,6 @@ using StardewValley; using System.Reflection; using Android.Content.Res; using Java.Interop; -using StardewModdingAPI.Patches; using System.Threading; using System.Linq; using System.IO; @@ -25,12 +24,18 @@ using Newtonsoft.Json; namespace StardewModdingAPI { [Activity(Label = "SMAPI Stardew Valley", Icon = "@mipmap/ic_launcher", Theme = "@style/Theme.Splash", MainLauncher = true, AlwaysRetainTaskState = true, LaunchMode = LaunchMode.SingleInstance, ScreenOrientation = ScreenOrientation.SensorLandscape, ConfigurationChanges = (ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.Orientation | ConfigChanges.ScreenLayout | ConfigChanges.ScreenSize | ConfigChanges.UiMode))] - public class SMainActivity: MainActivity, ILicenseCheckerCallback, IJavaObject, IDisposable, IJavaPeerable +#if ANDROID_TARGET_SAMSUNG + public class SMainActivity: MainActivity +#else + public class SMainActivity : MainActivity, ILicenseCheckerCallback, IJavaObject, IDisposable, IJavaPeerable +#endif { private SCore core; private LicenseChecker _licenseChecker; private PowerManager.WakeLock _wakeLock; +#if !ANDROID_TARGET_SAMSUNG private ServerManagedPolicyExtended _serverManagedPolicyExtended; +#endif public static SMainActivity Instance; @@ -171,6 +176,7 @@ namespace StardewModdingAPI private void CheckUsingServerManagedPolicy() { +#if !ANDROID_TARGET_SAMSUNG this._serverManagedPolicyExtended = new ServerManagedPolicyExtended(this, new AESObfuscator(new byte[15] { 46, @@ -191,8 +197,10 @@ namespace StardewModdingAPI }, this.PackageName, Settings.Secure.GetString(this.ContentResolver, "android_id"))); this._licenseChecker = new LicenseChecker(this, this._serverManagedPolicyExtended, "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAry4fecehDpCohQk4XhiIZX9ylIGUThWZxfN9qwvQyTh53hvnpQl/lCrjfflKoPz6gz5jJn6JI1PTnoBy/iXVx1+kbO99qBgJE2V8PS5pq+Usbeqqmqqzx4lEzhiYQ2um92v4qkldNYZFwbTODYPIMbSbaLm7eK9ZyemaRbg9ssAl4QYs0EVxzDK1DjuXilRk28WxiK3lNJTz4cT38bfs4q6Zvuk1vWUvnMqcxiugox6c/9j4zZS5C4+k+WY6mHjUMuwssjCY3G+aImWDSwnU3w9G41q8EoPvJ1049PIi7GJXErusTYZITmqfonyejmSFLPt8LHtux9AmJgFSrC3UhwIDAQAB"); this._licenseChecker.CheckAccess(this); +#endif } +#if !ANDROID_TARGET_SAMSUNG public new void Allow(PolicyResponse response) { typeof(MainActivity).GetMethod("CheckToDownloadExpansion", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(this, null); @@ -210,7 +218,7 @@ namespace StardewModdingAPI break; } } - +#endif protected override void OnResume() { base.OnResume();