Skip to content

Commit

Permalink
Virtualizing overloaded methods with in params causes issues
Browse files Browse the repository at this point in the history
  • Loading branch information
NSGolova committed Mar 24, 2024
1 parent 4bf2230 commit 5f3425b
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 5f3425b

Please sign in to comment.