Closed H-A-M-G-E-R closed 1 week ago
While I'm sure this would be fun to code, I think it would be a lot of work, so I suppose the core team wouldn't be eager to add something so specific (but maybe I'm wrong).
Here are a couple issues I see with making something round-trippable and compilable, off the top of my head:
<PrivateImplementationDetails>
- currently ILSpy exports this as _003CPrivateImplementationDetails_003E
in C#catch when (XXX)
- InlineIL can't represent the XXX expression as IL code.data
directives, which ILSpy today marks as not supported in C#Those are a few examples which make round-tripping difficult, and I'm sure there would be other surprises.
We did discuss this superficially - it is on the far, far edge feature-wise (after all, we are decompiling from IL to C#) and it kind of borders on what obfuscators do to IL code... where we also do not reverse the patterns (you'd have to apply a deobfuscator first).
I think most C# games don't obfuscate their code to ease modding.
This is something we do not intend to build, closing.
The first step to making a bytematching decomp... the second step is to gradually replace the IL code with C# code decompiled by hand so that the recompiled IL matches the original IL, just like how you make a matching decomp of a game by gradually replacing assembly code with C/C++ code.