Make it bootable
This commit is contained in:
parent
7c6fc4cd19
commit
a797608622
|
@ -8,6 +8,6 @@
|
|||
<!-- <BUILD_FOR_MOBILE>SAMSUNG</BUILD_FOR_MOBILE>-->
|
||||
<!-- <BUILD_FOR_MOBILE>GOOGLE_LEGACY</BUILD_FOR_MOBILE>-->
|
||||
<COMPILE_WITH_PLUGIN>False</COMPILE_WITH_PLUGIN>
|
||||
<DefineConstants Condition="'$(BUILD_FOR_MOBILE)' == 'GOOGLE'">$(DefineConstants);SMAPI_FOR_MOBILE;ANDROID_TARGET_GOOGLE;MonoAndroid10</DefineConstants>
|
||||
<DefineConstants Condition="'$(BUILD_FOR_MOBILE)' == 'GOOGLE'">SMAPI_FOR_MOBILE;ANDROID_TARGET_GOOGLE;MonoAndroid10</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
@ -34,23 +34,24 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
|
||||
<AndroidManagedSymbols>false</AndroidManagedSymbols>
|
||||
<AndroidUseAapt2>true</AndroidUseAapt2>
|
||||
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
|
||||
<AndroidDexTool>d8</AndroidDexTool>
|
||||
<AndroidLinkSkip>BmFont;MonoGame.Framework;mscorlib;System.Core;System;System.Drawing.Common;System.Numerics;System.Runtime.Serialization;System.Xml;System.Xml.Linq</AndroidLinkSkip>
|
||||
<!-- <AndroidLinkSkip>Mono.Android;MonoGame.Framework;mscorlib;System.Core;System;System.Drawing.Common;System.Numerics;System.Runtime.Serialization;System.Xml;System.Xml.Linq</AndroidLinkSkip>-->
|
||||
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||
<AndroidManagedSymbols>false</AndroidManagedSymbols>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
|
||||
|
@ -79,6 +80,8 @@
|
|||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="Mono.Security" />
|
||||
<ProjectReference Include="..\SMAPI\SMAPI.csproj" />
|
||||
<Reference Include="StardewValley">
|
||||
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.5.6.31\assemblies\StardewValley.dll</HintPath>
|
||||
|
@ -92,17 +95,12 @@
|
|||
<Reference Include="BmFont">
|
||||
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.5.6.31\assemblies\BmFont.dll</HintPath>
|
||||
</Reference>
|
||||
<!-- <PackageReference Include="MonoGame.Framework.Android">-->
|
||||
<!-- <Version>3.6.0.862</Version>-->
|
||||
<!-- </PackageReference>-->
|
||||
<Reference Include="MonoGame.Framework">
|
||||
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.5.6.31\assemblies\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="Mono.Security" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap\ic_launcher.png" />
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
|
|
|
@ -35,9 +35,9 @@ namespace StardewModdingAPI
|
|||
*********/
|
||||
#if SMAPI_FOR_MOBILE
|
||||
/// <summary>The path to the storage base folder.</summary>
|
||||
public static string StorageBasePath { get; } = Android.OS.Environment.ExternalStorageDirectory.Path;
|
||||
public static string StorageBasePath { get; } = SMainActivity.Instance.GetExternalFilesDir("").AbsolutePath;
|
||||
/// <summary>The path to the game's save folder.</summary>
|
||||
public static string StardewValleyBasePath { get; } = Path.Combine(EarlyConstants.StorageBasePath, "StardewValley");
|
||||
public static string StardewValleyBasePath { get; } = EarlyConstants.StorageBasePath;
|
||||
/// <summary>The path to the internal folder.</summary>
|
||||
public static string ExecutionPath { get; } = Path.Combine(EarlyConstants.StardewValleyBasePath, "smapi-internal");
|
||||
|
||||
|
|
|
@ -346,8 +346,10 @@ namespace StardewModdingAPI.Framework
|
|||
{
|
||||
this.IsGameRunning = true;
|
||||
StardewValley.Program.releaseBuild = true; // game's debug logic interferes with SMAPI opening the game window
|
||||
#if !SMAPI_FOR_MOBILE
|
||||
this.Game.Run();
|
||||
this.Dispose(isError: false);
|
||||
#endif
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion>
|
||||
<TargetFramework>net5.0-android</TargetFramework>
|
||||
<AndroidUseAapt2>true</AndroidUseAapt2>
|
||||
<AndroidUseAapt2>false</AndroidUseAapt2>
|
||||
<DefineConstants>$(DefineConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<AndroidUseAapt2>true</AndroidUseAapt2>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU' AND '$(BUILD_FOR_MOBILE)' != ''">
|
||||
|
@ -47,6 +49,7 @@
|
|||
<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<AndroidUseAapt2>true</AndroidUseAapt2>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(BUILD_FOR_MOBILE)' == ''">
|
||||
|
@ -135,6 +138,7 @@
|
|||
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="Mono.Security" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
|
|
@ -21,6 +21,7 @@ using Android.Util;
|
|||
using Java.Lang;
|
||||
using Java.Util;
|
||||
using Exception = System.Exception;
|
||||
using Object = Java.Lang.Object;
|
||||
using Thread = System.Threading.Thread;
|
||||
|
||||
namespace StardewModdingAPI
|
||||
|
@ -108,16 +109,22 @@ namespace StardewModdingAPI
|
|||
{
|
||||
Looper.Prepare();
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
Looper.Loop();
|
||||
}
|
||||
catch (Exception) { }
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
base.OnCreate(bundle);
|
||||
this.CheckAppPermissions();
|
||||
}
|
||||
|
@ -146,16 +153,17 @@ namespace StardewModdingAPI
|
|||
|
||||
if (string.IsNullOrWhiteSpace(modPath))
|
||||
{
|
||||
modPath = "StardewValley/Mods";
|
||||
modPath = "Mods";
|
||||
}
|
||||
|
||||
this.core = new SCore(System.IO.Path.Combine(EarlyConstants.StorageBasePath, modPath), false, false);
|
||||
this.core = new SCore(System.IO.Path.Combine(EarlyConstants.StardewValleyBasePath, modPath), false, false);
|
||||
this.core.RunInteractively();
|
||||
typeof(MainActivity).GetField("_game1", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(this, this.core.Game);
|
||||
typeof(MainActivity).GetMethod("SetZoomScaleAndMenuButtonScale", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(this, Array.Empty<object>());
|
||||
this.SetPaddingForMenus();
|
||||
typeof(MainActivity).GetField("_game1", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(this, this.core.Game.gamePtr);
|
||||
|
||||
this.SetContentView((View)this.core.Game.Services.GetService(typeof(View)));
|
||||
|
||||
this.CheckUsingServerManagedPolicy();
|
||||
this.core.Game.Run();
|
||||
}
|
||||
catch when (retry < 3)
|
||||
{
|
||||
|
@ -170,10 +178,7 @@ namespace StardewModdingAPI
|
|||
catch (Exception ex)
|
||||
{
|
||||
SAlertDialogUtil.AlertMessage($"SMAPI failed to initialize: {ex}",
|
||||
callback: type =>
|
||||
{
|
||||
this.Finish();
|
||||
});
|
||||
callback: type => { this.Finish(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,7 +213,6 @@ namespace StardewModdingAPI
|
|||
private void CheckUsingServerManagedPolicy()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue