Skip to content

Commit

Permalink
remove Unsafe/HideModTypes/HideLateTypes modloader config options
Browse files Browse the repository at this point in the history
for now commenting out, shouldn't be needed with the new type compatibility system, will require testing and later cleanup
  • Loading branch information
XDelta committed Jul 11, 2024
1 parent 988232e commit 1b060a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions ResoniteModLoader/AssemblyHider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal static class AssemblyHider {
/// <param name="harmony">Our RML harmony instance</param>
/// <param name="initialAssemblies">Assemblies that were loaded when RML first started</param>
internal static void PatchResonite(Harmony harmony, HashSet<Assembly> initialAssemblies) {
if (ModLoaderConfiguration.Get().HideModTypes) {
//if (ModLoaderConfiguration.Get().HideModTypes) {
// initialize the static assembly sets that our patches will need later
resoniteAssemblies = GetResoniteAssemblies(initialAssemblies);
modAssemblies = GetModAssemblies(resoniteAssemblies);
Expand All @@ -68,7 +68,7 @@ internal static void PatchResonite(Harmony harmony, HashSet<Assembly> initialAss
MethodInfo getAssembliesTarget = AccessTools.DeclaredMethod(typeof(AppDomain), nameof(AppDomain.GetAssemblies), Array.Empty<Type>());
MethodInfo getAssembliesPatch = AccessTools.DeclaredMethod(typeof(AssemblyHider), nameof(GetAssembliesPostfix));
harmony.Patch(getAssembliesTarget, postfix: new HarmonyMethod(getAssembliesPatch));
}
//}
}

private static HashSet<Assembly> GetResoniteAssemblies(HashSet<Assembly> initialAssemblies) {
Expand Down Expand Up @@ -116,13 +116,13 @@ private static bool IsModAssembly(Assembly assembly, string typeOrAssembly, stri
// this implies someone late-loaded an assembly after RML, and it was later used in-game
// this is super weird, and probably shouldn't ever happen... but if it does, I want to know about it.
// since this is an edge case users may want to handle in different ways, the HideLateTypes rml config option allows them to choose.
bool hideLate = ModLoaderConfiguration.Get().HideLateTypes;
if (log) {
//bool hideLate = true;// ModLoaderConfiguration.Get().HideLateTypes;
/*if (log) {
Logger.WarnInternal($"The \"{name}\" {typeOrAssembly} does not appear to part of Resonite or a mod. It is unclear whether it should be hidden or not. Due to the HideLateTypes config option being {hideLate} it will be {(hideLate ? "Hidden" : "Shown")}");
}
}*/
// if forceShowLate == true, then this function will always return `false` for late-loaded types
// if forceShowLate == false, then this function will return `true` when hideLate == true
return hideLate && !forceShowLate;
return !forceShowLate;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions ResoniteModLoader/ModLoaderConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ internal static ModLoaderConfiguration Get() {
_configuration = new ModLoaderConfiguration();

Dictionary<string, Action<string>> keyActions = new() {
{ "unsafe", (value) => _configuration.Unsafe = bool.Parse(value) },
//{ "unsafe", (value) => _configuration.Unsafe = bool.Parse(value) },
{ "debug", (value) => _configuration.Debug = bool.Parse(value) },
{ "hidevisuals", (value) => _configuration.HideVisuals = bool.Parse(value) },
{ "nomods", (value) => _configuration.NoMods = bool.Parse(value) },
{ "advertiseversion", (value) => _configuration.AdvertiseVersion = bool.Parse(value) },
{ "logconflicts", (value) => _configuration.LogConflicts = bool.Parse(value) },
{ "hidemodtypes", (value) => _configuration.HideModTypes = bool.Parse(value) },
{ "hidelatetypes", (value) => _configuration.HideLateTypes = bool.Parse(value) }
//{ "hidemodtypes", (value) => _configuration.HideModTypes = bool.Parse(value) },
//{ "hidelatetypes", (value) => _configuration.HideLateTypes = bool.Parse(value) }
};

// .NET's ConfigurationManager is some hot trash to the point where I'm just done with it.
Expand Down Expand Up @@ -62,13 +62,13 @@ private static string GetAssemblyDirectory() {
}

#pragma warning disable CA1805
public bool Unsafe { get; private set; } = false;
//public bool Unsafe { get; private set; } = false;
public bool Debug { get; private set; } = false;
public bool NoMods { get; private set; } = false;
public bool HideVisuals { get; private set; } = false;
public bool AdvertiseVersion { get; private set; } = false;
public bool LogConflicts { get; private set; } = true;
public bool HideModTypes { get; private set; } = true;
public bool HideLateTypes { get; private set; } = true;
//public bool HideModTypes { get; private set; } = true;
//public bool HideLateTypes { get; private set; } = true;
#pragma warning restore CA1805
}

0 comments on commit 1b060a1

Please sign in to comment.