r/ReverseEngineering • • 3d ago

porting a windows-only il2cpp unity game to macos without wine: pe loader, seh unwinding, a fork of unity's serialization, and dxbc to metal

https://github.com/thecatthatflies/glade
6 Upvotes

1 comment sorted by

1

u/Responsible-Lake85 3d ago

some details for anyone curious:

  • the target is ori and the will of the wisps (unity 2018.4, modified by the studio, il2cpp). GameAssembly.dll is 77.6 mb with 143,202 functions and imports 173 windows functions. a small pe loader provides those and patches the 11 gs: teb accesses, so the dll runs inside unity's stock mac player under rosetta 2.
  • il2cpp throws through RaiseException and unwinds with .pdata, so the loader implements windows seh dispatch and unwinding itself.
  • 215 engine calls only exist in the studio's fork of unity, and the bridge reimplements them. nine built-in classes are serialized differently from stock unity, and every object gets rewritten to the stock layout.
  • the game ships d3d11 bytecode only, with the reflection chunk stripped. glade rebuilds the reflection data and runs it through hlslcc to metal: about 47,300 programs, 2 failures.
  • in progress: a static recompiler that lifts the x86-64 to c. each lifted function is checked against the original on random inputs inside a forked copy of the running game, then patched over the original in the live game. the goal is native arm64.

the repo has no game files, and you bring your own copy. built with heavy help from claude code. writeup of every finding: docs/ARCHITECTURE.md. discord: https://discord.gg/nztkCGVuSm