Skip to content

Instantly share code, notes, and snippets.

@l-Luna
Last active January 19, 2021 18:33
Show Gist options
  • Save l-Luna/01cbaea0f6082cead29d9f7893b7efb7 to your computer and use it in GitHub Desktop.
Save l-Luna/01cbaea0f6082cead29d9f7893b7efb7 to your computer and use it in GitHub Desktop.
Opus Magnum modding: How to
  1. Backup your Lightning.exe. These tools won't damage it, but you might - rename it to something like LightningBackup.exe.

  2. Compile Opus Modded (produces mapped & patched decompiled output) and OpusPatcher (helps dump scrambled strings). Copy mappings.csv, keys.txt, and patch.diff from Opus Modded to somewhere else, you'll need those.

  3. Run OpusPatcher.exe, passing the path to your Lightning.exe as the first command line argument, and the path to your keys.txt as the second. It creates a new Lightning.exe in the directory you ran it - move it to the normal Opus Magnum folder and run it. It must be named Lightning.exe, and I think it has to be in the correct folder (though I haven't tested). It won't start the game, instead creating out.csv. Avoid overwriting your original Lightning.exe. Don't worry if you do - Steam can redownload it. It's just annoying.

  4. Run Opus Modded.exe, passing the path to your Lightning.exe as the first argument and path to mappings.csv as the second. This will create decomp.cs.

  5. Apply patch.diff to decomp.cs with git: git apply --unsafe-paths patch.diff in git bash, in a directory containing both decomp.cs and patch.diff. The patch fixes compilation errors and adds Ravari's Wheel, a testing part.

  6. Open decomp.cs in a Visual Studio project, set the CPU architecture to x86, add Steamworks.NET.Standard.Windows.x86 and Ionic.Zip as dependancies from NuGet, and build (Ctrl+B). This will create a number of files in /bin/Debug/netcoreapp3.1/ relative to the projects directory. Copy them all to your Opus Magnum folder.

  7. Run the new executable to play the modded game, passing the path to out.csv as a command line parameter. You might want to setup a script to simplify that.

  8. Marvel at Ravari's Wheel and all of the bugs.

  9. Submit PRs to help me.

Yes, I would like to merge the two executables into one and have it automatically compile and handle everything for you, but I'm lazy and have more important things to do. There's two executables because OpusPatcher.exe has to use the same older version of .NET that Opus Magnum uses, and Opus Modded.exe was made before I realized that and uses newer language features (using statements 💛).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment