Skip to content

Using Cpp2IL: Method Dumps

Sam Byass edited this page Jul 10, 2022 · 1 revision

Note this information refers to full release versions of Cpp2IL, not the pre-releases

A lot of people generally assume that Cpp2IL's primary use is for generating DLLs with readable c# when run through a managed decompiler like ILSpy.

While this functionality does exist, it's far from perfect, and in many cases you'll get better options when reading the method dump files.

Note that some command line options disable these, so if in doubt, run with only those required to specify the path to your game, and optionally --run-analysis-for-assembly if the code you want to read isn't in Assembly-CSharp. --parallel is fine too.

Once you do so, you should find, in the cpp2il_out folder, a folder for each assembly. Open the one for the assembly you're interested in, then open the method_dumps folder.

From there, you should be able to find the type you're interested in - it follows a basic namespace hierarchy, with those types that aren't in a namespace in the top-level folder.

By default, these files are very verbose - for each method in the type, they include the raw disassembled machine code, a human-readable, text-based analysis of what each instruction is doing, then some c#-like psuedocode, and finally the generated IL code.

You can customise this behavior using the --analysis-level option. For most cases, just the pseudocode and optionally the synopsis are sufficient.

The pseudocode is generally preferable to reading the generated code in a decompiler, because some errors may occur in that process which may not happen in the psuedocode generation.

Clone this wiki locally