Adapt for Galaxy Store Stardew Valley

This commit is contained in:
ZaneYork 2020-03-23 18:44:33 +08:00
parent e948cac769
commit 6430bbf7ac
2 changed files with 45 additions and 17 deletions

View File

@ -17,13 +17,14 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
<DefineConstants>$(DefineConstants);ANDROID_TARGET_SAMSUNG</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;ANDROID_TARGET_SAMSUNG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
@ -52,24 +53,49 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\0Harmony.dll</HintPath>
</Reference>
<ItemGroup Condition="!$(DefineConstants.Contains('ANDROID_TARGET_SAMSUNG'))">
<Reference Include="Google.Android.Vending.Expansion.Downloader">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\Google.Android.Vending.Expansion.Downloader.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Licensing">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\Google.Android.Vending.Licensing.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="StardewValley">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\StardewValley.dll</HintPath>
</Reference>
<Reference Include="StardewValley.GameData">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\StardewValley.GameData.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="$(DefineConstants.Contains('ANDROID_TARGET_SAMSUNG'))">
<Reference Include="Google.Android.Vending.Expansion.Downloader">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\Google.Android.Vending.Expansion.Downloader.dll</HintPath>
</Reference>
<Reference Include="Google.Android.Vending.Licensing">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\Google.Android.Vending.Licensing.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="StardewValley">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\StardewValley.dll</HintPath>
</Reference>
<Reference Include="StardewValley.GameData">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\StardewValley.GameData.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Mono.Android" />
<Reference Include="Mono.Cecil">
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="MonoMod.RuntimeDetour">
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\MonoMod.RuntimeDetour.dll</HintPath>
</Reference>
@ -85,12 +111,6 @@
<Reference Include="SMAPI.Toolkit.CoreInterfaces">
<HintPath>..\SMAPI.Toolkit.CoreInterfaces\bin\Debug\net4.5\SMAPI.Toolkit.CoreInterfaces.dll</HintPath>
</Reference>
<Reference Include="StardewValley">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\StardewValley.dll</HintPath>
</Reference>
<Reference Include="StardewValley.GameData">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.142\assemblies\StardewValley.GameData.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />

View File

@ -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();