Minor fix

This commit is contained in:
ZaneYork 2020-10-19 10:25:35 +08:00
parent 1df011accb
commit e6933110a5
3 changed files with 31 additions and 12 deletions

View File

@ -32,10 +32,13 @@ namespace StardewModdingAPI
/*********
** Accessors
*********/
/// <summary>The path to the game folder.</summary>
#if SMAPI_FOR_MOBILE
public static string ExecutionPath { get; } = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, "StardewValley/smapi-internal");
/// <summary>The path to the game's save folder.</summary>
public static string StardewValleyBasePath { get; } = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, "StardewValley");
/// <summary>The path to the internal folder.</summary>
public static string ExecutionPath { get; } = Path.Combine(StardewValleyBasePath, "smapi-internal");
#else
/// <summary>The path to the game folder.</summary>
public static string ExecutionPath { get; } = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
#endif
@ -92,7 +95,7 @@ namespace StardewModdingAPI
/// <summary>The directory path containing Stardew Valley's app data.</summary>
#if SMAPI_FOR_MOBILE
public static string DataPath { get; } = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, "StardewValley");
public static string DataPath { get; } = EarlyConstants.StardewValleyBasePath;
#else
public static string DataPath { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley");
#endif

View File

@ -151,6 +151,12 @@
<Reference Include="StardewValley.GameData">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.145\assemblies\StardewValley.GameData.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.145\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="xTile">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.145\assemblies\xTile.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="$(DefineConstants.Contains('ANDROID_TARGET_GOOGLE_LEGACY'))">
@ -160,6 +166,12 @@
<Reference Include="StardewValley">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.128\assemblies\StardewValley.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.128\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="xTile">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.128\assemblies\xTile.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="$(DefineConstants.Contains('ANDROID_TARGET_SAMSUNG'))">
@ -172,6 +184,12 @@
<Reference Include="StardewValley.GameData">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\StardewValley.GameData.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="xTile">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\samsung_base_1.4.5.144\assemblies\xTile.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="$(DefineConstants.Contains('ANDROID_TARGET_AMAZON'))">
@ -184,6 +202,12 @@
<Reference Include="StardewValley.GameData">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\amazon_base_1.4.5.144\assemblies\StardewValley.GameData.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\amazon_base_1.4.5.144\assemblies\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="xTile">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\amazon_base_1.4.5.144\assemblies\xTile.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(BUILD_FOR_MOBILE)' != ''">
@ -196,9 +220,6 @@
<Reference Include="MonoMod.Utils">
<HintPath>..\Loader\libs\MonoMod.Utils.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework">
<HintPath>..\Loader\libs\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Mono.Android" />
<Reference Include="SMAPI.Toolkit">
@ -214,9 +235,6 @@
<Reference Include="TMXTile">
<HintPath>..\Loader\libs\TMXTile.dll</HintPath>
</Reference>
<Reference Include="xTile">
<HintPath>..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.5.145\assemblies\xTile.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(BUILD_FOR_MOBILE)' != ''">

View File

@ -13,10 +13,8 @@ using System.Collections.Generic;
using StardewModdingAPI.Framework;
using StardewValley;
using System.Reflection;
using Android.Content.Res;
using Java.Interop;
using System.Linq;
using System.IO;
using File = Java.IO.File;
using Microsoft.AppCenter;
using Newtonsoft.Json;
@ -164,7 +162,7 @@ namespace StardewModdingAPI
modPath = "StardewValley/Mods";
}
this.core = new SCore(Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, modPath), false);
this.core = new SCore(System.IO.Path.Combine(Constants.DataPath, modPath), false);
this.core.RunInteractively();
typeof(MainActivity).GetField("_game1", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(this, this.core.Game);