Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtualizing overloaded methods with in params causes issues #38

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading