Skip to content

Commit

Permalink
More FormID Range parameter passing work
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggog committed Apr 12, 2024
1 parent a44c01f commit eea1c82
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,25 @@
<Version>17.9.0</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda">
<Version>[0.44]</Version>
<Version>[0.44.0-nightly-20240411-215887]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Autofac">
<Version>[0.44]</Version>
<Version>[0.44.0-nightly-20240411-215887]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Core">
<Version>[0.44]</Version>
<Version>[0.44.0-nightly-20240411-215887]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Json">
<Version>[0.44]</Version>
<Version>[0.44.0-nightly-20240411-215887]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Kernel">
<Version>[0.44]</Version>
<Version>[0.44.0-nightly-20240411-215887]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.Testing">
<Version>[0.44]</Version>
<Version>[0.44.0-nightly-20240411-215887]</Version>
</PackageVersion>
<PackageVersion Include="Mutagen.Bethesda.WPF">
<Version>[0.44]</Version>
<Version>[0.44.0-nightly-20240411-215887]</Version>
</PackageVersion>
<PackageVersion Include="Newtonsoft.Json">
<Version>13.0.3</Version>
Expand Down
5 changes: 3 additions & 2 deletions Mutagen.Bethesda.Synthesis/Pipeline/SynthesisPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ public void Patch<TMod, TModGetter>(
#endregion

private BinaryWriteParameters GetWriteParams(RunSynthesisMutagenPatcher args, IEnumerable<ModKey> loadOrder)
{
{
return new BinaryWriteParameters()
{
ModKey = ModKeyOption.NoCheck,
Expand All @@ -795,7 +795,8 @@ private BinaryWriteParameters GetWriteParams(RunSynthesisMutagenPatcher args, IE
Encodings = args.UseUtf8ForEmbeddedStrings
? new EncodingBundle(NonTranslated: MutagenEncoding._1252, NonLocalized: MutagenEncoding._utf8)
: null,
LowerRangeDisallowedHandler = ALowerRangeDisallowedHandlerOption.AddPlaceholder(loadOrder)
LowerRangeDisallowedHandler = ALowerRangeDisallowedHandlerOption.AddPlaceholder(loadOrder),
MinimumFormID = AMinimumFormIdOption.Force(args.FormIDRangeMode.ToForceBool())
};
}

Expand Down
20 changes: 14 additions & 6 deletions Mutagen.Bethesda.Synthesis/States/DI/PatcherStateFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,26 @@ public SynthesisState<TModSetter, TModGetter> ToState<TModSetter, TModGetter>(Ru
{
if (settings.SourcePath == null)
{
bool? forceFormIdLowerRange = settings.FormIDRangeMode switch
Console.WriteLine("Creating new mod:");
Console.WriteLine($" ModKey: {exportKey}");
Console.WriteLine($" GameRelease: {settings.GameRelease}");
if (settings.HeaderVersionOverride != null)
{
FormIDRangeMode.Auto => null,
FormIDRangeMode.Off => false,
FormIDRangeMode.On => true,
_ => throw new NotImplementedException(),
};
Console.WriteLine($" HeaderVersion: {settings.HeaderVersionOverride}");
}

var forceFormIdLowerRange = settings.FormIDRangeMode.ToForceBool();

if (forceFormIdLowerRange != null)
{
Console.WriteLine($" Force FormID Lower Range: {forceFormIdLowerRange}");
}
patchMod = ModInstantiator<TModSetter>.Activator(
exportKey,
settings.GameRelease,
headerVersion: settings.HeaderVersionOverride,
forceUseLowerFormIDRanges: forceFormIdLowerRange);
Console.WriteLine($" Next FormID: {patchMod.NextFormID}");
}
else
{
Expand Down
14 changes: 14 additions & 0 deletions Synthesis.Bethesda/FormIDRangeMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,17 @@ public enum FormIDRangeMode
Off = 2,
On = 3,
}

public static class FormIDRangeModeExt
{
public static bool? ToForceBool(this FormIDRangeMode mode)
{
return mode switch
{
FormIDRangeMode.Auto => null,
FormIDRangeMode.Off => false,
FormIDRangeMode.On => true,
_ => throw new NotImplementedException(),
};
}
}

0 comments on commit eea1c82

Please sign in to comment.