-
-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split dummydll into 4 separate output formats (#266)
- Loading branch information
Showing
7 changed files
with
141 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Cpp2IL.Core/OutputFormats/AsmResolverDllOutputFormatDefault.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using AsmResolver.DotNet; | ||
using AssetRipper.CIL; | ||
using Cpp2IL.Core.Model.Contexts; | ||
|
||
namespace Cpp2IL.Core.OutputFormats; | ||
|
||
public class AsmResolverDllOutputFormatDefault : AsmResolverDllOutputFormat | ||
{ | ||
public override string OutputFormatId => "dll_default"; | ||
|
||
public override string OutputFormatName => "DLL files with default method bodies"; | ||
|
||
protected override void FillMethodBody(MethodDefinition methodDefinition, MethodAnalysisContext methodContext) | ||
{ | ||
methodDefinition.FillMethodBodyWithStub(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Cpp2IL.Core/OutputFormats/AsmResolverDllOutputFormatEmpty.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using AsmResolver.DotNet; | ||
using Cpp2IL.Core.Model.Contexts; | ||
using Cpp2IL.Core.Utils.AsmResolver; | ||
|
||
namespace Cpp2IL.Core.OutputFormats; | ||
|
||
public class AsmResolverDllOutputFormatEmpty : AsmResolverDllOutputFormat | ||
{ | ||
public override string OutputFormatId => "dll_empty"; | ||
|
||
public override string OutputFormatName => "DLL files with empty method bodies"; | ||
|
||
protected override void FillMethodBody(MethodDefinition methodDefinition, MethodAnalysisContext methodContext) | ||
{ | ||
if (methodDefinition.IsManagedMethodWithBody()) | ||
methodDefinition.CilMethodBody = new(methodDefinition); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Cpp2IL.Core/OutputFormats/AsmResolverDllOutputFormatIlRecovery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using AsmResolver.DotNet; | ||
using AsmResolver.PE.DotNet.Cil; | ||
using Cpp2IL.Core.Model.Contexts; | ||
using Cpp2IL.Core.Utils.AsmResolver; | ||
|
||
namespace Cpp2IL.Core.OutputFormats; | ||
|
||
public class AsmResolverDllOutputFormatIlRecovery : AsmResolverDllOutputFormat | ||
{ | ||
public override string OutputFormatId => "dll_il_recovery"; | ||
|
||
public override string OutputFormatName => "DLL files with IL Recovery"; | ||
|
||
protected override void FillMethodBody(MethodDefinition methodDefinition, MethodAnalysisContext methodContext) | ||
{ | ||
if (methodDefinition.IsManagedMethodWithBody()) | ||
{ | ||
methodDefinition.CilMethodBody = new(methodDefinition); | ||
var instructions = methodDefinition.CilMethodBody.Instructions; | ||
instructions.Add(CilOpCodes.Ldnull); | ||
instructions.Add(CilOpCodes.Throw); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Cpp2IL.Core/OutputFormats/AsmResolverDllOutputFormatThrowNull.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using AsmResolver.DotNet; | ||
using AsmResolver.PE.DotNet.Cil; | ||
using Cpp2IL.Core.Model.Contexts; | ||
using Cpp2IL.Core.Utils.AsmResolver; | ||
|
||
namespace Cpp2IL.Core.OutputFormats; | ||
|
||
public class AsmResolverDllOutputFormatThrowNull : AsmResolverDllOutputFormat | ||
{ | ||
public override string OutputFormatId => "dll_throw_null"; | ||
|
||
public override string OutputFormatName => "DLL files with method bodies containing throw null"; | ||
|
||
protected override void FillMethodBody(MethodDefinition methodDefinition, MethodAnalysisContext methodContext) | ||
{ | ||
if (methodDefinition.IsManagedMethodWithBody()) | ||
{ | ||
methodDefinition.CilMethodBody = new(methodDefinition); | ||
var instructions = methodDefinition.CilMethodBody.Instructions; | ||
instructions.Add(CilOpCodes.Ldnull); | ||
instructions.Add(CilOpCodes.Throw); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.