Cpp2IL

SamboyCodingMIT活跃维护

把 Unity 的 IL2CPP 编译产物还原成可读的 .NET 中间代码,方便逆向分析和修改游戏逻辑。

Work-in-progress tool to reverse unity's IL2CPP toolchain.

2022.1.0-pre-release.21发布于 2026-02-22 14:04 UTC3,098star +9 / 7 天408fork同步于 2026-11-10 11:42 UTC

怎么上手

README 里没有找到可直接复制的安装命令

README 里没有找到可直接复制的安装命令,请到 README 或官方文档查看安装方式。

硬件要求

README 没有说明硬件要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

这个项目的说明还在生成中,先参考下面「最近发版」和 README。

最近发版

5 个版本2022.1.0-pre-release.21
  1. 2022.1.0-pre-release.21Milestone Preview: 2022.1.0 #21pre-release最新正式版2026-02-22 · 2026-02-22 14:04 UTC

    Another year goes by and the version number is still 2022. Anyway, this brings support for all recent unity versions.

    All Projects

    • Bumped AssetRipper.* and AsmResolver dependencies. Thanks to @ds5678 in #487 and again in #501!
    • Bumped all other dependencies used in the project to the latest version.
    • Added an slnx solution file. Thanks to @thegu5 in #367!
    • Fixed some compiler warnings. Thanks to @ds5678 in #503!

    Cpp2IL Command-Line

    • Binaries are now built for arm64 in addition to x86, on all 3 supported operating systems. Thanks to @kaylincoded in #488!

    Cpp2IL Core

    • Added a check for the HasDefault flag when emitting parameters to Dummy DLLs. Thanks to @ds5678 in #486!
    • Added additional methods for working with concrete generics. Thanks to @ds5678 in #485!
    • Fixed an issue where FieldAnalysisContext's ToString impl was wrong for injected fields. Thanks to @ds5678 in #489!
    • Added the ability to override attributes (e.g. FieldAttributes on FieldAnalysisContext) on all analyses contexts. Thanks to @ds5678 in #491!
    • Updated the documentation for the call analysis processing layer. Thanks to @ds5678 in #493!
    • Fixed an issue where interface types could theoretically have a base type configured, despite this not being allowed. Thanks to @ds5678 in #494!
    • Added the ability to change which methods a MethodAnalysisContext overrides. Thanks to @ds5678 in #495!
    • Added the ability to override basic properties of an AssemblyAnalysisContext (e.g. version, hash algorithm, etc). Thanks to @ds5678 in #498!
    • Added a utility method to map a Cpp2IlMethodRef to a MethodAnalysisContext. Thanks to @ds5678 in #499!
    • Changed the Overrides property on MethodAnalysisContext to refer specifically to explicit method overrides (i.e. those which use .override statement in IL). The "normal" base method of a method, if there is one, is now exposed via the BaseMethod property. Thanks to @ds5678 in #509!
    • Fixed incorrect ToString implementations of CustomAttributeArrayParameter and CustomAttributeTypeParameter (missing closing parentheses). This could lead to invalid C# output in diffable-cs mode. Thanks to @Minecool in #512!

    LibCpp2IL

    • Added support for Il2Cpp metadata versions 35, 38, 39, 104, 105, and 106. This brings support up to the latest 6000.5.0 alpha build.
    • Fixed an issue where MapVirtualAddressToRaw could give the wrong result if the provided virtual address was exactly on the boundary between 2 segments. This affected NSO and PE binaries. Thanks to @WitherOrNot in #496!
    • Fixed a regression from the last version where, during code/meta reg search, binary files no longer had the context of what Il2Cpp metadata version was being used, which could lead these searches to fail or give invalid results. Thanks to @ViRb3 in #515!
    • Improved handling of endianness on systems where the endianness of the binary being loaded was different to that of the system running Cpp2IL. Thanks to @ds5678 in #514!
    • Fixed an issue getting the method body of the last method in the .text section on an Arm64 binary. Thanks to @ViRb3 in #516!
  2. 2022.1.0-pre-release.20Milestone Preview: 2022.1.0 #20pre-release2025-08-11 · 2025-08-11 15:30 UTC
    查看更新说明

    All Projects

    • Updated dependencies

    Cpp2Il Command-Line

    • --force-unity-version now interprets a lack of any f1, b13, etc. version suffix to be f1, instead of a0.
    • ~ in paths is now resolved to user home. Thanks to @commonuserlol in #407
    • The application now gives a more meaningful error message if no game path or force options are configured.
    • The CET compatibility requirement added in .NET 9 has been disabled. This should fix issues running Cpp2IL on older (unsupported) versions of Windows, but support for those is not guaranteed - this was just an easy change to make. Thanks to @ds5678 in #478.

    Cpp2IL Core

    • Reduced static state throughout the library.
    • Unity version is kept around after initial loading and exposed via a field on ApplicationAnalysisContext.
    • Fixed a bug in v31.0 (2021.3.40) support
    • X86 ISIL improvements for call <register>. Thanks to @ItsMilos in #397
    • Arm64 ISIL improvements for ADRP.
    • Added a Type field to [Attribute] in Dummy DLLs. Thanks to @ds5678 in #393
      • Also removed the now-obsolete Name field from [Attribute], which was also done by @ds5678 in #455
    • Added overloads for various methods in X86Utils which directly take a MethodAnalysisContext. Thanks to @ds5678 in #399
    • Fixed a number of issues in the HasCustomAttributes class which were negatively impacting performance. Thanks to @ds5678 in #405
    • Improvements to explicit interface implementations. Thanks to @ds5678 in #414, #415
    • Moved largely-incorrect IsPrimitive property from TypeAnalysisContext to WasmUtils, because it's actually testing for WASM primitive status.
    • Improvements to the API for Generic Parameters. Thanks to @ds5678 in #433.
    • Unify lib and core on using a + to separate declaring type and nested type names.
    • Fixed a stack overflow with generic types that reference themselves in constraints. Thanks to @ds5678 in #472.
    • A bunch of changes from @ds5678 to allow overriding basically everything in analysis contexts.
      • This includes work in #435, #436, #450, #451, #452, #456, #457, #460, #464, and #475, as well as probably a couple others I missed.
    • A bunch of changes to ensure output DLLs are more technically correct. These include:
      • Set PublicKey on AssemblyDefinition when generating AsmResolver output formats. Thanks to @ds5678 in #390
      • Ensure emitted method signatures have the correct generic parameter count. Thanks to @ds5678 in #391
      • Include lower bounds when making array type signatures. Thanks to @ds5678 in #394
      • Fixed boxing of custom attribute arguments where that is required.
      • Fixed incorrect Il2CppTypeEnum for some TypeAnalysisContexts
      • Fixed correctness of some checks for if types were primitive or not.
      • Fixed generated method bodies for methods in types with fixed buffer fields. Thanks to @ds5678 in #428
      • Fixed generated corlib modules self-referencing. Thanks to @ds5678 in #431
      • Don't set a field offset for static fields. Thanks to @ds5678 in #434
    • Miscellaneous smaller bugfixes from @ds5678. E.g. #401, #402, #403

    Cpp2IL Stripped CodeReg Support Plugin

    • Improved recovery of CodeGenModules list if it was inlined. Thanks to @aldelaro5 in #429

    LibCpp2IL

    • Reduced static state throughout the library.
    • Performance improvements to MetadataUsage::IsValid and MetadataUsage::AsType
    • Fixed support for getting PublicKey from Il2CppAssemblyNameDefinition. Thanks to @ds5678 in #395
    • Changed search order of code which determines unity version, to prioritize assets files, as those contain a full version string, not just the part before the letter.
    • Fixed thread safety issue in Il2CppBinary::GetFieldOffsetFromIndex
    • Unify lib and core on using a + to separate declaring type and nested type names.
    • Mach-O files now support relocation processing via DYLD Chained Fixups. Should improve the number of MachO binaries which load sucessfully.
    • Added support for M
  3. 2022.1.0-pre-release.19Milestone Preview: 2022.1.0 #19pre-release2024-12-08 · 2024-12-08 15:33 UTC
    查看更新说明

    A huge thank you goes out to everyone who contributed for this release - pretty much none of this is my work!

    All Projects

    • A bunch of dependency updates, including updating Cpp2IL to .NET 9.0 (from .NET 7.0).

    Cpp2Il Command-Line

    • Added support for specifying a macOS bundle file with --game-path. Thanks to @yeah-its-gloria in #383.

    Cpp2IL Core

    • Improved ISIL support for x64, including the first calling convention resolver. Thanks to @Alluseri in #333, @BadRyuner in #335, @MrUser3 in #344, and @ds5678 in #353.
    • Made a bunch of changes to WASM signature calculations (the code which maps C# method signatures to WASM parameter types)
    • Improvements to ConcreteGenericMethodAnalysisContext by @ds5678 in #352
    • Added methods to resolve an il2cpp definition to its analysis context. Thanks to @ds5678 in #364 and #376
    • Cleaned up duplicate properties in MethodAnalysisContext's API. Thanks to @ds5678 in #354
    • Added a new output format: wasm_name_section, which outputs a binary file which can be appended to a wasm file, which will provide debugging symbols in e.g. the browser's dev tools. Thanks to @thegu5 in #388.
    • Diffable-CS: Fixed an exception when outputting a non-printable char default value. Thanks to @MrUser127 in #386.
    • DummyDll: Properly emit metadata for explicit interface implementations. Thanks to @ds5678 in #346 and #368.

    LibCpp2IL

    • Fixed definition of Il2CppRGCTXDefinition in metadata versions > 27.1. Thanks to @lifeengines in #339
    • Fixed an exception in the metadata reader when trying to read an array of length 0. Thanks to @commonuserlol in #345
    • Made some improvements to the API for fields, allowing resolution of a field's declaring type. Thanks to @ds5678 in #347 and #348

    StrippedCodeRegSupport Plugin

    • Fixed an issue which may have caused the plugin to fail when it shouldn't have. Thanks to @ds5678 in #381

    PDB Plugin

    • Added. This plugin provides a rudimentary PDB output format using the official MsPdbCore library. Thanks to @ds5678 in #382.
  4. 2022.1.0-pre-release.18Milestone Preview: 2022.1.0 #18pre-release2024-09-01 · 2024-09-01 13:58 UTC
    查看更新说明

    This release is mainly just a maintenance one to address the v29.2 issue.

    Cpp2IL.Core

    • Trim .winmd extension by @chuck6900 in #327
    • Clean type namespace before being used as a path by @thegu5 in #329
    • Began work on adding some unit testing to core so we can be more sure of not breaking things
      • Including some CFG unit tests from @gompoc
    • Fixed some exceptions that would occur when injecting a method with parameters.
    • Properly support 2023.2 and 6000.0 UnmanagedCallersOnly metadata on methods.
    • Made Cpp2IlApi.ResetInternalState() public so that you can load multiple games in the same process more easily (still only one at a time, but you can clean up old ones and load a new one properly now)

    LibCpp2IL

    • Removed non-existent "v29.2" support which caused loading games on Unity 2023.2 and some early 6000.0 versions to fail.
  5. 2022.1.0-pre-release.17Milestone Preview: 2022.1.0 #17pre-release2024-08-19 · 2024-08-19 12:49 UTC
    查看更新说明

    Cpp2IL Command Line

    • Fixed more trimming issues which caused plugins, especially the stripped code reg plugin, to fail to load on the net7 builds.

    Plugins

    • Added a Control Flow Graph plugin which adds a cfg output format which allows writing .dot graph files for all methods in the binary.

    Cpp2IL.Core

    • Added support for performing control-flow analysis of generated ISIL. This is the next big step in a working decompiler to IL. Huge thanks to @gompoc (this was #318)
    • Optimized IsilImmediateOperand.ToString by avoiding exceptions as control flow.
    • Implemented more x86 -> ISIL conversions
    • Added a block processing layer system that works in tandem with the control flow graph analysis system. Currently, strings, unambiguous method calls, and type metadata are resolved via this system.
    • Fixed a bug in the Arm64 instruction set which could lead to attempts to get the method body for some methods disassembling the entire remainder of the binary 4 bytes at a time. This manifested as the application getting stuck processing an assembly.
    • Optimized the call analysis and native method detection processing layers to only get ISIL, instead of fully analyzing methods. Thanks to @ds5678 in #324.

    LibCpp2IL

    • Fixed an issue with multiple exported functions at the same address in Mach-O binaries. Thanks to @gabriel-nsiqueira in #316
    • Fixed a thread safety issue in Il2CppBinary.ReadPointerAtVirtualAddress which could cause fields in structures to be corrupted when read from multithreaded code.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Cpp2IL

    NuGet Coverage Status

    Need Help? Join the discord!

    WIP Tool to reverse Unity's IL2CPP build process back to the original managed DLLs.

    The information below almost entirely applies to the CLI application available on github releases. For documentation on using the "core" module - which the CLI is just a wrapper around - in your own projects, see README_CORE.md

    Uses LibCpp2IL for the initial parsing and loading of metadata structures. LibCpp2IL is obtainable from the build artifacts if you want to do something yourself with IL2CPP metadata, and is released under the MIT license. The link above will take you to the documentation for LibCpp2IL.

    Decompiler

    The decompiled CIL is pretty messy right now, the next thing is probably pattern matching to convert il2cpp specific stuff into C# (generic ISIL should be converted into more C# specific ISIL, new object, throw, etc. instructions should be added to ISIL), but most of the times it's at least possible to see what the method does. Use ILSpy because it works with broken CIL better than dnSpy.

    The entry point to decompilation is MethodAnalysisContext.Analyze(), it translates platform specific assembly into ISIL with Cpp2IlInstructionSet, builds the control flow graph and dominator info, and the rest of the decompilation is done with IAction classes (MethodAnalysisContext.analysisActions), these include stack analysis, simplification, applying metadata, etc. and then Ilgenerator.GenerateIl() translates the ISIL into CIL that's saved into managed dlls.

    Development Branch Notes

    Cpp2IL has undergone a major rewrite. This branch represents work in progress, and is subject to change.

    CI builds for developers can be obtained from My Nuget Feed.

    The command-line interface has been simplified, going from a lot of command line options to a concept of output formats and processing layers. However, a lot of these formats and layers are not yet implemented, so functionality is limited compared to the previously released versions.

    Obvious Changes:

    Many options, such as --analysis-level, --skip-analysis, etc, have been removed. Analysis is now off by default and can be enabled with --output-as dll_il_recovery.

    Equally, options like --supress-attributes, which previously suppressed the Cpp2ILInjected attributes, have been replaced with a process layer - this one is actually implemented, and is called attributeinjector. You can enable this layer using the --use-processor option, and you can list other options using --list-processors.

    Metadata dumps and method dumps will be their own output format too, instead of both being default-on, and controlled via a dedicated option. Currently this means you'll need to run Cpp2IL multiple times if you want both dumps, though this may change in the future if we add support for outputting to multiple formats simultaneously. Like processing layers, output formats can be listed via the --list-output-formats option, and are selected via the --output-as option.

    Less obvious changes:

    Under the hood, the application has been almost completely rewritten. Primarily, this was necessary due to the degree Cpp2IL was dependent on the Mono.Cecil library, which had some limitations. When we looked into switching, we realised how reliant we were on the library. This is no longer the case - the application is written around LibCpp2IL types and the new Analysis Context objects, and the Mono.Cecil library is no longer used, having been replaced with AsmResolver.DotNet.

    Analysis is now based on an intermediate representation called ISIL (Instruction-Set-Independent Language), which is converted into a Control Flow Graph for more intelligent analysis.

    We're also working on a Plugin system which will allow third-party developers to write plugins to add support for custom instruction sets, binary formats, and eventually load obfuscated or encrypted metadata or binary files.

    Command Line Options

    Basic Usage

    The simplest usage of this application is for a windows x86 or x64 unity game. In that case you can just run Cpp2IL-Win.exe --game-path=C:\Path\To\Your\Game and Cpp2IL will detect your unity version, locate the files it needs, and dump the output into a cpp2il_out folder wherever you ran the command from.

    Assuming you have a single APK file (not an APKM), and are running at least cpp2il 2021.4.0, you can use the same argument as above but pass in the path to the APK, and cpp2il will extract the files it needs from the APK.

    Supported Command Line Option Listing

    OptionArgument ExampleDescription
    --game-pathC:\Path\To\GameSpecify the path to the game folder. Required.
    --exe-nameTestGameSpecify the name of the game's exe file in case auto detection fails (because there are other exe files in the game directory)
    --verbose<None>Log more information about what we are doing
    --list-processors<None>List available processing layers, then exit.
    --use-processorattributeinjectorSelect a processing layer to use, which can change the raw data prior to outputting. This option can appear multiple times.
    --processor-configkey=valueProvide configuration options to the selected processing layers. These will be documented by the plugin which adds the processing layer.
    --list-output-formats<None>List available output formats, then exit.
    --output-asdll_il_recoverySpecify the output format you wish to use.
    --output-tocpp2il_outRoot directory to output to. This path will be passed to the selected output format, which may then create subdirectories etc. within this location.
    --wasm-framework-fileC:\Path\To\webgl.framework.jsOnly used in conjunction with WASM binaries. Some of these have obfuscated exports but they can be recovered via a framework.js file, which you can provide the path to using this argument.

    Release Structure

    Every single commit is built to a CI build using Github Actions - the action file can be found in the .github folder, if you want to reproduce the builds yourself. Be aware these may not be the most stable - while there are tests to ensure compatibility with a range of games, sometimes things do break! These are versioned by the commit they were built from.

    The release files can be downloaded from the Actions tab if you are signed into GitHub, or you can use the following links, which always point to the latest successful CI build. Note that the .NET Framework build is provided for compatibility with wine/proton.

    On top of this, I manually release "milestone" release builds whenever I think a major set of improvements have been made. These are NOT marked as pre-releases on github, and should (at least in theory) be stable and suitable for use on a range of games.

    Terminal Colors and Debug Logging

    From the first milestone build 2021.0, and onwards, Cpp2IL now outputs more rigidly-structured data to the console. This includes log levels (VERB, INFO, WARN, FAIL) and associated colours (Grey for VERB, Blue for INFO, Yellow for WARN, Red for FAIL).

    As of milestone 2021.1, if Cpp2IL is able to detect that you're running in Wine/Proton, these ANSI colour codes are disabled, as they are not supported by wine and look awful.

    VERB messages will only be logged if Cpp2IL is launched with the --verbose option, and it would be helpful if you could report issues with this flag enabled. For normal operation, they shouldn't be needed, unless you're curious.

    If you do not wish for the output to be coloured, set the Environment Variable NO_COLOR=true.

    Credits

    This application is built primarily using .NET 9.0, but a .NET Framework 4.7.2 build is also published for legacy purposes.

    It uses the following libraries, for which I am very thankful:

    (All are MIT licensed aside from XUnit which is Apache 2.0+MIT)

    • iced disassembler for x86
    • Capstone.NET for ARMv8 and ARMv7 disassembly, though its usage is deprecated in favor of:
    • My own Disarm library for fully-managed ARMv8/ARM64 disassembly.
    • My own WasmDisassembler library for WebAssembly disassembly. This can be found in the WasmDisassembler subdirectory.
    • Pastel for the console colours.
    • CommandLineParser so I didn't need to write one myself.
    • AsmResolver for any output formats which produce managed .NET assemblies.
    • xUnit for the unit tests.
    • AssetRipper.CIL for filling stub method bodies with IL that decompiles cleanly.
    • AssetRipper.Primitives for unity version handling.

    The net472 build uses the following additional libraries:

    • System.ValueTuple for value tuples in .NET Framework.
    • PolySharp (licensed under the MIT license) for polyfilling newer runtime features in .NET Framework.

    Some plugins also use additional libraries:

    • The OrbisPkg plugin uses LibOrbisPkg, which is licensed under the LGPL, version 3.
    • The ControlFlowGraph plugin uses DotNetGraph, which is licensed under the MIT license, for creating dot files.
    • The Pdb plugin uses AssetRipper.Bindings.MsPdbCore, which is licensed under the MIT license.

    Cpp2IL is (very loosely, at this point) based off of Il2CppDumper, which I forked in 2018 and removed a lot of code, rewrote a lot, and added a lot more. But at its core, it's still got some dumper left in it, mostly in LibCpp2IL.

    It contains bits and pieces from Il2CppInspector, taken with permission from djKaty, and I'd like to express my gratitude to her here for her invaluable help.

    I'd like to thank the Audica Modding community and Discord for the initial inspiration for this project, lots of support in the early days, and feature requests these days.

    And finally, check out some other cool projects which link in with this one. Of course, I mentioned Il2CppInterop further up, but also check out MelonLoader, which uses Cpp2IL for Dummy DLL generation.