summaryrefslogtreecommitdiff
path: root/src/SMAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-02 23:01:40 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-02 23:01:40 -0400
commitbbaa260007f67d6e3c88c1aae387b42b0c237063 (patch)
treedab7bba7c4dd971f09ea179ceae93b156c96a73e /src/SMAPI
parent169ce01810a66cbaaf793adaad1659809721336d (diff)
downloadSMAPI-bbaa260007f67d6e3c88c1aae387b42b0c237063.tar.gz
SMAPI-bbaa260007f67d6e3c88c1aae387b42b0c237063.tar.bz2
SMAPI-bbaa260007f67d6e3c88c1aae387b42b0c237063.zip
drop support for unofficial 64-bit mode
Diffstat (limited to 'src/SMAPI')
-rw-r--r--src/SMAPI/Constants.cs12
-rw-r--r--src/SMAPI/Framework/Content/ContentCache.cs2
-rw-r--r--src/SMAPI/Framework/Logging/LogManager.cs22
-rw-r--r--src/SMAPI/Framework/SCore.cs18
-rw-r--r--src/SMAPI/Metadata/InstructionMetadata.cs9
-rw-r--r--src/SMAPI/Program.cs20
-rw-r--r--src/SMAPI/SMAPI.csproj6
7 files changed, 25 insertions, 64 deletions
diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs
index 247e32b7..ebb504db 100644
--- a/src/SMAPI/Constants.cs
+++ b/src/SMAPI/Constants.cs
@@ -39,14 +39,6 @@ namespace StardewModdingAPI
/// <summary>The target game platform.</summary>
internal static GamePlatform Platform { get; } = (GamePlatform)Enum.Parse(typeof(GamePlatform), LowLevelEnvironmentUtility.DetectPlatform());
- /// <summary>Whether SMAPI is being compiled for Windows with a 64-bit Linux version of the game. This is highly specialized and shouldn't be used in most cases.</summary>
- internal static bool IsWindows64BitHack { get; } =
-#if SMAPI_FOR_WINDOWS_64BIT_HACK
- true;
-#else
- false;
-#endif
-
/// <summary>The game framework running the game.</summary>
internal static GameFramework GameFramework { get; } =
#if SMAPI_FOR_XNA
@@ -56,7 +48,7 @@ namespace StardewModdingAPI
#endif
/// <summary>The game's assembly name.</summary>
- internal static string GameAssemblyName => EarlyConstants.Platform == GamePlatform.Windows && !EarlyConstants.IsWindows64BitHack ? "Stardew Valley" : "StardewValley";
+ internal static string GameAssemblyName => EarlyConstants.Platform == GamePlatform.Windows ? "Stardew Valley" : "StardewValley";
/// <summary>The <see cref="Context.ScreenId"/> value which should appear in the SMAPI log, if any.</summary>
internal static int? LogScreenId { get; set; }
@@ -269,7 +261,7 @@ namespace StardewModdingAPI
targetAssemblies.Add(typeof(StardewModdingAPI.IManifest).Assembly);
// get changes for platform
- if (Constants.Platform != Platform.Windows || EarlyConstants.IsWindows64BitHack)
+ if (Constants.Platform != Platform.Windows)
{
removeAssemblyReferences.AddRange(new[]
{
diff --git a/src/SMAPI/Framework/Content/ContentCache.cs b/src/SMAPI/Framework/Content/ContentCache.cs
index 5c7ad778..7edc9ab9 100644
--- a/src/SMAPI/Framework/Content/ContentCache.cs
+++ b/src/SMAPI/Framework/Content/ContentCache.cs
@@ -57,8 +57,6 @@ namespace StardewModdingAPI.Framework.Content
IReflectedMethod method = reflection.GetMethod(typeof(TitleContainer), "GetCleanPath");
this.NormalizeAssetNameForPlatform = path => method.Invoke<string>(path);
}
- else if (EarlyConstants.IsWindows64BitHack)
- this.NormalizeAssetNameForPlatform = PathUtilities.NormalizePath;
else
this.NormalizeAssetNameForPlatform = key => key.Replace('\\', '/'); // based on MonoGame's ContentManager.Load<T> logic
}
diff --git a/src/SMAPI/Framework/Logging/LogManager.cs b/src/SMAPI/Framework/Logging/LogManager.cs
index c6faa90d..6fe44d98 100644
--- a/src/SMAPI/Framework/Logging/LogManager.cs
+++ b/src/SMAPI/Framework/Logging/LogManager.cs
@@ -291,13 +291,7 @@ namespace StardewModdingAPI.Framework.Logging
public void LogIntro(string modsPath, IDictionary<string, object> customSettings)
{
// log platform & patches
- {
- this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
-
- string[] patchLabels = this.GetPatchLabels().ToArray();
- if (patchLabels.Any())
- this.Monitor.Log($"Detected custom version: {string.Join(", ", patchLabels)}", LogLevel.Info);
- }
+ this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
// log basic info
this.Monitor.Log($"Mods go here: {modsPath}", LogLevel.Info);
@@ -416,20 +410,6 @@ namespace StardewModdingAPI.Framework.Logging
gameMonitor.Log(message, level);
}
- /// <summary>Get human-readable labels to log for detected SMAPI and Stardew Valley customizations.</summary>
- private IEnumerable<string> GetPatchLabels()
- {
- // custom game framework
- if (EarlyConstants.IsWindows64BitHack)
- yield return $"running 64-bit SMAPI with {Constants.GameFramework}";
- else if ((Constants.GameFramework == GameFramework.Xna) != (Constants.Platform == Platform.Windows))
- yield return $"running {Constants.GameFramework}";
-
- // patched by Stardew64Installer
- if (Constants.IsPatchedByStardew64Installer(out ISemanticVersion patchedByVersion))
- yield return $"patched by Stardew64Installer {patchedByVersion}";
- }
-
/// <summary>Write a summary of mod warnings to the console and log.</summary>
/// <param name="mods">The loaded mods.</param>
/// <param name="skippedMods">The mods which could not be loaded.</param>
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index f7efc89e..ce5a701d 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -12,10 +12,10 @@ using System.Security;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using Microsoft.Xna.Framework;
#if SMAPI_FOR_WINDOWS
using Microsoft.Win32;
#endif
-using Microsoft.Xna.Framework;
#if SMAPI_FOR_XNA
using System.Windows.Forms;
#endif
@@ -436,7 +436,7 @@ namespace StardewModdingAPI.Framework
Game1.mapDisplayDevice = new SDisplayDevice(Game1.content, Game1.game1.GraphicsDevice);
// log GPU info
-#if SMAPI_FOR_WINDOWS && !SMAPI_FOR_WINDOWS_64BIT_HACK
+#if SMAPI_FOR_WINDOWS
this.Monitor.Log($"Running on GPU: {Game1.game1.GraphicsDevice?.Adapter?.Description ?? "<unknown>"}");
#endif
}
@@ -1267,10 +1267,8 @@ namespace StardewModdingAPI.Framework
/// <summary>Set the titles for the game and console windows.</summary>
private void UpdateWindowTitles()
{
- string smapiVersion = $"{Constants.ApiVersion}{(EarlyConstants.IsWindows64BitHack ? " [64-bit]" : "")}";
-
- string consoleTitle = $"SMAPI {smapiVersion} - running Stardew Valley {Constants.GameVersion}";
- string gameTitle = $"Stardew Valley {Constants.GameVersion} - running SMAPI {smapiVersion}";
+ string consoleTitle = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Constants.GameVersion}";
+ string gameTitle = $"Stardew Valley {Constants.GameVersion} - running SMAPI {Constants.ApiVersion}";
if (this.ModRegistry.AreAllModsLoaded)
{
@@ -1737,10 +1735,10 @@ namespace StardewModdingAPI.Framework
catch (Exception ex)
{
errorReasonPhrase = "its DLL couldn't be loaded.";
-#if SMAPI_FOR_WINDOWS_64BIT_HACK
- if (ex is BadImageFormatException && !EnvironmentUtility.Is64BitAssembly(assemblyPath))
- errorReasonPhrase = "it needs to be updated for 64-bit mode.";
-#endif
+ // re-enable in Stardew Valley 1.5.5
+ //if (ex is BadImageFormatException && !EnvironmentUtility.Is64BitAssembly(assemblyPath))
+ // errorReasonPhrase = "it needs to be updated for 64-bit mode.";
+
errorDetails = $"Error: {ex.GetLogSummary()}";
failReason = ModFailReason.LoadFailed;
return false;
diff --git a/src/SMAPI/Metadata/InstructionMetadata.cs b/src/SMAPI/Metadata/InstructionMetadata.cs
index 44d906ea..76371e50 100644
--- a/src/SMAPI/Metadata/InstructionMetadata.cs
+++ b/src/SMAPI/Metadata/InstructionMetadata.cs
@@ -48,13 +48,12 @@ namespace StardewModdingAPI.Metadata
yield return new HeuristicFieldRewriter(this.ValidateReferencesToAssemblies);
yield return new HeuristicMethodRewriter(this.ValidateReferencesToAssemblies);
+ // rewrite for 64-bit mode
+ // re-enable in Stardew Valley 1.5.5
+ //yield return new ArchitectureAssemblyRewriter();
+
// detect Harmony & rewrite for SMAPI 3.12 (Harmony 1.x => 2.0 update)
yield return new HarmonyRewriter();
-
- // rewrite for 64-bit mode
-#if SMAPI_FOR_WINDOWS_64BIT_HACK
- yield return new ArchitectureAssemblyRewriter();
-#endif
}
else
yield return new HarmonyRewriter(shouldRewrite: false);
diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs
index b6464f3c..3f97e531 100644
--- a/src/SMAPI/Program.cs
+++ b/src/SMAPI/Program.cs
@@ -26,7 +26,7 @@ namespace StardewModdingAPI
/// <param name="args">The command-line arguments.</param>
public static void Main(string[] args)
{
- Console.Title = $"SMAPI {EarlyConstants.RawApiVersion}{(EarlyConstants.IsWindows64BitHack ? " 64-bit" : "")} - {Console.Title}";
+ Console.Title = $"SMAPI {EarlyConstants.RawApiVersion} - {Console.Title}";
try
{
@@ -84,6 +84,14 @@ namespace StardewModdingAPI
}
catch (Exception ex)
{
+ // unofficial 64-bit
+ if (EarlyConstants.Platform == GamePlatform.Windows)
+ {
+ FileInfo linuxExecutable = new FileInfo(Path.Combine(EarlyConstants.ExecutionPath, "StardewValley.exe"));
+ if (linuxExecutable.Exists && LowLevelEnvironmentUtility.Is64BitAssembly(linuxExecutable.FullName))
+ Program.PrintErrorAndExit("Oops! You're running Stardew Valley in unofficial 64-bit mode, which is no longer supported. You can update to Stardew Valley 1.5.5 or later instead. See https://stardewvalleywiki.com/Modding:Migrate_to_64-bit_on_Windows for more info.");
+ }
+
// file doesn't exist
if (!File.Exists(Path.Combine(EarlyConstants.ExecutionPath, $"{EarlyConstants.GameAssemblyName}.exe")))
Program.PrintErrorAndExit("Oops! SMAPI can't find the game. Make sure you're running StardewModdingAPI.exe in your game folder.");
@@ -116,16 +124,6 @@ namespace StardewModdingAPI
// max version
if (Constants.MaximumGameVersion != null && Constants.GameVersion.IsNewerThan(Constants.MaximumGameVersion))
Program.PrintErrorAndExit($"Oops! You're running Stardew Valley {Constants.GameVersion}, but this version of SMAPI is only compatible up to Stardew Valley {Constants.MaximumGameVersion}. Please check for a newer version of SMAPI: https://smapi.io.");
-
- // bitness
- bool is64BitGame = LowLevelEnvironmentUtility.Is64BitAssembly(Path.Combine(EarlyConstants.ExecutionPath, $"{EarlyConstants.GameAssemblyName}.exe"));
-#if SMAPI_FOR_WINDOWS_64BIT_HACK
- if (!is64BitGame)
- Program.PrintErrorAndExit("Oops! This is the 64-bit version of SMAPI, but you have the 32-bit version of Stardew Valley. You can reinstall SMAPI using its installer to automatically install the correct version of SMAPI.");
-#elif SMAPI_FOR_WINDOWS
- if (is64BitGame)
- Program.PrintErrorAndExit("Oops! This is the 32-bit version of SMAPI, but you have the 64-bit version of Stardew Valley. You can reinstall SMAPI using its installer to automatically install the correct version of SMAPI.");
-#endif
}
/// <summary>Assert that the versions of all SMAPI components are correct.</summary>
diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj
index 7d5e7ef9..0f1b0516 100644
--- a/src/SMAPI/SMAPI.csproj
+++ b/src/SMAPI/SMAPI.csproj
@@ -14,10 +14,6 @@
<Import Project="..\..\build\common.targets" />
- <PropertyGroup Condition="$(DefineConstants.Contains(SMAPI_FOR_WINDOWS_64BIT_HACK))">
- <PlatformTarget>x64</PlatformTarget>
- </PropertyGroup>
-
<ItemGroup>
<PackageReference Include="LargeAddressAware" Version="1.0.5" />
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
@@ -39,7 +35,7 @@
<!-- Windows only -->
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
- <Reference Include="Netcode" HintPath="$(GamePath)\Netcode.dll" Private="False" Condition="!$(DefineConstants.Contains(SMAPI_FOR_WINDOWS_64BIT_HACK))" />
+ <Reference Include="Netcode" HintPath="$(GamePath)\Netcode.dll" Private="False" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>