Skip to content

Commit

Permalink
Release 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nelpats authored Dec 9, 2020
1 parent b3c2d0b commit 6d4db9e
Show file tree
Hide file tree
Showing 44 changed files with 116,649 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Dumpy/Dumpy.sln
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
6 changes: 6 additions & 0 deletions Dumpy/Dumpy/App.config
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 Dumpy/Dumpy/Dumpy.Decoder/ErrorHandler/Ldci4ToConvi4Handler.cs
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");

}
}

42 changes: 42 additions & 0 deletions Dumpy/Dumpy/Dumpy.Decoder/Maths/Abs.cs
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");


}
}

45 changes: 45 additions & 0 deletions Dumpy/Dumpy/Dumpy.Decoder/Maths/Add.cs
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");


}
}
}

41 changes: 41 additions & 0 deletions Dumpy/Dumpy/Dumpy.Decoder/Maths/Cos.cs
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");


}
}

42 changes: 42 additions & 0 deletions Dumpy/Dumpy/Dumpy.Decoder/Maths/Div.cs
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");

}
}
}
42 changes: 42 additions & 0 deletions Dumpy/Dumpy/Dumpy.Decoder/Maths/DoubleParse.cs
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");


}
}

40 changes: 40 additions & 0 deletions Dumpy/Dumpy/Dumpy.Decoder/Maths/EmpyTypes.cs
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");


}
}

41 changes: 41 additions & 0 deletions Dumpy/Dumpy/Dumpy.Decoder/Maths/Floor.cs
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");


}
}

Loading

0 comments on commit 6d4db9e

Please sign in to comment.