-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
116,649 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30611.23 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dumpy", "Dumpy\Dumpy.csproj", "{596B1072-BAB8-40BC-9E4A-BA2474FBE55F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{596B1072-BAB8-40BC-9E4A-BA2474FBE55F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{596B1072-BAB8-40BC-9E4A-BA2474FBE55F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{596B1072-BAB8-40BC-9E4A-BA2474FBE55F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{596B1072-BAB8-40BC-9E4A-BA2474FBE55F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {D2433109-F90C-4564-9804-F6E7B3339C0C} | ||
EndGlobalSection | ||
EndGlobal |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
37 changes: 37 additions & 0 deletions
37
Dumpy/Dumpy/Dumpy.Decoder/ErrorHandler/Ldci4ToConvi4Handler.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,37 @@ | ||
using dnlib.DotNet; | ||
using dnlib.DotNet.Emit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
|
||
public class Ldci4ToConvi4Handler | ||
{ | ||
static int count = 0; | ||
public static void Fix(ModuleDefMD module) | ||
{ | ||
foreach (TypeDef types in module.Types) | ||
foreach (MethodDef method in types.Methods) | ||
{ | ||
if (method.HasBody) | ||
if (method.Body.HasInstructions) | ||
{ | ||
IList<Instruction> instr = method.Body.Instructions; | ||
for (int i = 0; i < instr.Count; i++) | ||
{ | ||
if (instr[i].IsLdcI4() && instr[i + 1].OpCode == OpCodes.Conv_I4) | ||
{ | ||
instr[i + 1].OpCode = OpCodes.Nop; | ||
count++; | ||
} | ||
} | ||
} | ||
|
||
} | ||
Logger.Log($"Fixed {count} convertions errors"); | ||
|
||
} | ||
} | ||
|
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,42 @@ | ||
using dnlib.DotNet; | ||
using dnlib.DotNet.Emit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
|
||
public class Abs | ||
{ | ||
static int count = 0; | ||
public static void RemoveMutations(ModuleDefMD module) | ||
{ | ||
|
||
foreach (TypeDef types in module.Types) | ||
foreach (MethodDef method in types.Methods) | ||
{ | ||
if (method.HasBody) | ||
if (method.Body.HasInstructions) | ||
{ | ||
IList<Instruction> instr = method.Body.Instructions; | ||
for (int i = 0; i < instr.Count; i++) | ||
{ | ||
if (instr[i].OpCode == OpCodes.Call && instr[i].Operand.ToString().Contains("Abs") && instr[i - 1].IsLdcI4()) | ||
{ | ||
int result = Math.Abs(instr[i - 1].GetLdcI4Value()); | ||
instr[i].OpCode = OpCodes.Ldc_I4; | ||
instr[i].Operand = result; | ||
instr[i - 1].OpCode = OpCodes.Nop; | ||
count++; | ||
} | ||
} | ||
} | ||
|
||
} | ||
Logger.Log($"Removed {count} Abs mutations"); | ||
|
||
|
||
} | ||
} | ||
|
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,45 @@ | ||
using dnlib.DotNet; | ||
using dnlib.DotNet.Emit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Maths | ||
{ | ||
public class Add | ||
{ | ||
static int count = 0; | ||
public static void RemoveMutations(ModuleDefMD module) | ||
{ | ||
|
||
foreach (TypeDef types in module.Types) | ||
foreach (MethodDef method in types.Methods) | ||
{ | ||
if (method.HasBody) | ||
if (method.Body.HasInstructions) | ||
{ | ||
IList<Instruction> instr = method.Body.Instructions; | ||
for (int i = 0; i < instr.Count; i++) | ||
{ | ||
if (instr[i].OpCode == OpCodes.Add && instr[i - 1].IsLdcI4() && instr[i - 2].IsLdcI4()) | ||
{ | ||
int result = instr[i - 1].GetLdcI4Value() + instr[i - 2].GetLdcI4Value(); | ||
instr[i].OpCode = OpCodes.Ldc_I4; | ||
instr[i].Operand = result; | ||
instr[i - 1].OpCode = OpCodes.Nop; | ||
instr[i - 2].OpCode = OpCodes.Nop; | ||
count++; | ||
} | ||
} | ||
} | ||
|
||
} | ||
Logger.Log($"Removed {count} Add mutations"); | ||
|
||
|
||
} | ||
} | ||
} | ||
|
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,41 @@ | ||
using dnlib.DotNet; | ||
using dnlib.DotNet.Emit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
|
||
public class Cos | ||
{ | ||
static int count = 0; | ||
public static void RemovedMutations(ModuleDefMD module) | ||
{ | ||
foreach (TypeDef types in module.Types) | ||
foreach (MethodDef method in types.Methods) | ||
{ | ||
if (method.HasBody) | ||
if (method.Body.HasInstructions) | ||
{ | ||
IList<Instruction> instr = method.Body.Instructions; | ||
for (int i = 0; i < instr.Count; i++) | ||
{ | ||
if (instr[i].OpCode == OpCodes.Call && instr[i].Operand.ToString().Contains("Cos") && instr[i - 1].OpCode == OpCodes.Ldc_R8) | ||
{ | ||
double result = Math.Cos((double)instr[i - 1].Operand); | ||
instr[i].OpCode = OpCodes.Ldc_R8; | ||
instr[i].Operand = result; | ||
instr[i - 1].OpCode = OpCodes.Nop; | ||
count++; | ||
} | ||
} | ||
} | ||
|
||
} | ||
Logger.Log($"Removed {count} Cos mutations"); | ||
|
||
|
||
} | ||
} | ||
|
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,42 @@ | ||
using dnlib.DotNet; | ||
using dnlib.DotNet.Emit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Maths | ||
{ | ||
public class Div | ||
{ | ||
static int count = 0; | ||
public static void RemoveMutations(ModuleDefMD module) | ||
{ | ||
foreach (TypeDef types in module.Types) | ||
foreach (MethodDef method in types.Methods) | ||
{ | ||
if (method.HasBody) | ||
if (method.Body.HasInstructions) | ||
{ | ||
IList<Instruction> instr = method.Body.Instructions; | ||
for (int i = 0; i < instr.Count; i++) | ||
{ | ||
if (instr[i].OpCode == OpCodes.Div && instr[i - 1].IsLdcI4() && instr[i - 2].IsLdcI4()) | ||
{ | ||
int result = instr[i - 1].GetLdcI4Value() / instr[i - 2].GetLdcI4Value(); | ||
instr[i].OpCode = OpCodes.Ldc_I4; | ||
instr[i].Operand = result; | ||
instr[i - 1].OpCode = OpCodes.Nop; | ||
instr[i - 2].OpCode = OpCodes.Nop; | ||
count++; | ||
} | ||
} | ||
} | ||
|
||
} | ||
Logger.Log($"Removed {count} Div mutations"); | ||
|
||
} | ||
} | ||
} |
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,42 @@ | ||
using dnlib.DotNet; | ||
using dnlib.DotNet.Emit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
|
||
public class DoubleParse | ||
{ | ||
static int count = 0; | ||
public static void RemoveMutations(ModuleDefMD module) | ||
{ | ||
|
||
foreach (TypeDef types in module.Types) | ||
foreach (MethodDef method in types.Methods) | ||
{ | ||
if (method.HasBody) | ||
if (method.Body.HasInstructions) | ||
{ | ||
IList<Instruction> instr = method.Body.Instructions; | ||
for (int i = 0; i < instr.Count; i++) | ||
{ | ||
if (instr[i].OpCode == OpCodes.Call && instr[i].Operand.ToString().Contains("Double::Parse") && instr[i - 1].OpCode == OpCodes.Ldstr) | ||
{ | ||
int result = (int)double.Parse(instr[i - 1].Operand.ToString()); | ||
instr[i].OpCode = OpCodes.Ldc_I4; | ||
instr[i].Operand = result; | ||
instr[i - 1].OpCode = OpCodes.Nop; | ||
count++; | ||
} | ||
} | ||
} | ||
|
||
} | ||
Logger.Log($"Removed {count} DoubleParse mutations"); | ||
|
||
|
||
} | ||
} | ||
|
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,40 @@ | ||
using dnlib.DotNet; | ||
using dnlib.DotNet.Emit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
|
||
public class EmpyTypes | ||
{ | ||
static int count = 0; | ||
public static void RemoveMutations(ModuleDefMD module) | ||
{ | ||
|
||
foreach (TypeDef types in module.Types) | ||
foreach (MethodDef method in types.Methods) | ||
{ | ||
if (method.HasBody) | ||
if (method.Body.HasInstructions) | ||
{ | ||
IList<Instruction> instr = method.Body.Instructions; | ||
for (int i = 0; i < instr.Count; i++) | ||
{ | ||
if (instr[i].OpCode == OpCodes.Ldsfld && instr[i].Operand.ToString().Contains("Type::EmptyTypes") && instr[i + 1].OpCode == OpCodes.Ldlen) | ||
{ | ||
instr[i].OpCode = OpCodes.Ldc_I4_0; | ||
instr[i + 1].OpCode = OpCodes.Nop; | ||
count++; | ||
} | ||
} | ||
} | ||
|
||
} | ||
Logger.Log($"Removed {count} EmptyTypes mutations"); | ||
|
||
|
||
} | ||
} | ||
|
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,41 @@ | ||
using dnlib.DotNet; | ||
using dnlib.DotNet.Emit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
|
||
public class Floor | ||
{ | ||
static int count = 0; | ||
public static void RemovedMutations(ModuleDefMD module) | ||
{ | ||
foreach (TypeDef types in module.Types) | ||
foreach (MethodDef method in types.Methods) | ||
{ | ||
if (method.HasBody) | ||
if (method.Body.HasInstructions) | ||
{ | ||
IList<Instruction> instr = method.Body.Instructions; | ||
for (int i = 0; i < instr.Count; i++) | ||
{ | ||
if (instr[i].OpCode == OpCodes.Call && instr[i].Operand.ToString().Contains("Floor") && instr[i - 1].OpCode == OpCodes.Ldc_R8) | ||
{ | ||
double result = Math.Floor((double)instr[i - 1].Operand); | ||
instr[i].OpCode = OpCodes.Ldc_R8; | ||
instr[i].Operand = result; | ||
instr[i - 1].OpCode = OpCodes.Nop; | ||
count++; | ||
} | ||
} | ||
} | ||
|
||
} | ||
Logger.Log($"Removed {count} Floor mutations"); | ||
|
||
|
||
} | ||
} | ||
|
Oops, something went wrong.