summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-08-24 21:59:52 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-08-25 18:25:17 -0400
commitf8c76bde39ba2afb11540c9af5d88aad4c73f789 (patch)
treee27d552daeb113bc069bed0400b25a96ce2ba85c /src/SMAPI/Framework
parente1d8838587329bd64f3627c4cdc4ac57d187ad7f (diff)
downloadSMAPI-f8c76bde39ba2afb11540c9af5d88aad4c73f789.tar.gz
SMAPI-f8c76bde39ba2afb11540c9af5d88aad4c73f789.tar.bz2
SMAPI-f8c76bde39ba2afb11540c9af5d88aad4c73f789.zip
add 64-bit compatibility check before loading mods
That reduces time spent trying to rewrite them (which won't work anyway), and shows a more informative message than the default 'DLL couldn't be loaded' error.
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/SCore.cs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 5fb4aa03..dff0fc55 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -1704,12 +1704,21 @@ namespace StardewModdingAPI.Framework
// load as mod
else
{
+ // get mod info
IManifest manifest = mod.Manifest;
+ string assemblyPath = Path.Combine(mod.DirectoryPath, manifest.EntryDll);
+
+ // assert 64-bit
+#if SMAPI_FOR_WINDOWS_64BIT_HACK
+ if (!EnvironmentUtility.Is64BitAssembly(assemblyPath))
+ {
+ errorReasonPhrase = "it needs to be updated for 64-bit mode.";
+ failReason = ModFailReason.LoadFailed;
+ return false;
+ }
+#endif
// load mod
- string assemblyPath = manifest?.EntryDll != null
- ? Path.Combine(mod.DirectoryPath, manifest.EntryDll)
- : null;
Assembly modAssembly;
try
{