Skip to content

Commit

Permalink
Merge pull request #38 from NSGolova/main
Browse files Browse the repository at this point in the history
Virtualizing overloaded methods with in params causes issues
  • Loading branch information
ChecksumDev authored Mar 25, 2024
2 parents 4bf2230 + 5f3425b commit d4dd020
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions GenericStripper/Modules/BeatSaber/BSAssemblyModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,23 @@ private void VirtualizeType(TypeDefinition type)

foreach (var subType in type.NestedTypes) VirtualizeType(subType);

foreach (var m in type.Methods.Where(m => m.IsManaged && m is
foreach (var group in type.Methods.Where(m => m.IsManaged && m is
{
IsIL: true, IsStatic: false, IsVirtual: false, IsAbstract: false, IsAddOn: false,
IsConstructor: false, IsSpecialName: false, IsGenericInstance: false, HasOverrides: false
}))
}).GroupBy(m => m.Name))
{
m.IsVirtual = !m.IsPrivate || m.Parameters.FirstOrDefault(p => p.IsIn) == null;
m.IsPublic = true;
m.IsPrivate = false;
m.IsNewSlot = true;
m.IsHideBySig = true;
foreach (var m in group)
{
bool hasAnyInParam = m.Parameters.FirstOrDefault(p => p.IsIn) != null;
if (group.Count() > 1 && hasAnyInParam) continue;

m.IsVirtual = !m.IsPrivate || !hasAnyInParam;
m.IsPublic = true;
m.IsPrivate = false;
m.IsNewSlot = true;
m.IsHideBySig = true;
}
}

foreach (var field in type.Fields.Where(field => field.IsPrivate)) field.IsFamily = true;
Expand Down

0 comments on commit d4dd020

Please sign in to comment.