diff options
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs')
-rw-r--r-- | src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs new file mode 100644 index 00000000..cc830216 --- /dev/null +++ b/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs @@ -0,0 +1,31 @@ +using Mono.Cecil; +using StardewModdingAPI.Framework.ModLoading.Framework; + +namespace StardewModdingAPI.Framework.ModLoading.Rewriters +{ + /// <summary>Removes the 32-bit-only from loaded assemblies.</summary> + internal class ArchitectureAssemblyRewriter : BaseInstructionHandler + { + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + public ArchitectureAssemblyRewriter() + : base(defaultPhrase: "32-bit architecture") { } + + + /// <inheritdoc /> + public override bool Handle(ModuleDefinition module) + { + if (module.Attributes.HasFlag(ModuleAttributes.Required32Bit)) + { + module.Attributes &= ~ModuleAttributes.Required32Bit; + this.MarkRewritten(); + return true; + } + + return false; + } + + } +} |