Su5eD / IC2-Patcher

A tool to modify IndustrialCraft2 using binary patches
The Unlicense
9 stars 4 forks source link

IC2 Patcher

Fixes several bugs in IndustrialCraft2 using binary patches.

Note that you may NOT distribute any decompiled code generated by this tool. For more information, see IC2's license.

List of patches

You can find lists of patches for each supported IC2 Version [here]().

Currently supported versions:

Contribution

Setting up the dev environment

  1. Clone the repository.
  2. Run the setup gradle task found in env setup.
    This will set up both IC2-Base and IC2-Patched projects, which contain clean and patched code respectively.
    Note that while this code will compile, it's highly unstable and might not work on your OS / IDE.

Generating patches for currently supported versions of IC2

After making changes to the code, run the generatePatches task of the IC2-Patched project to generate the patches for currently set IC2 version. This has to be done manually every time you make changes.


Generating patches for non-supported versions of IC2

To add support for a new version of IC2:

  1. Change IC2 version in gradle.properties file.
  2. Create a new Folder in root of project 'IC2-Base' and 'IC2-Patched' with name in the following format:
    patches[minVersion,maxVersion] where:

    • minVersion - Minimum version of IC2 that those patches are meant to be applied to, inclusive.
    • maxVersion - Maximum version of IC2 that those patches are meant to be applied to, exclusive.

    Example: patches[2.8.164, 2.8.165] -> Folder for patches for IC2 version 2.8.164-exp112
    It's recommended to copy over patches from the closest supported version and resolve issues from there.

  3. Run the setup gradle task found in env setup.
    1. If IC2-Base project fails to compile, resolve all issues generated by Compiler and run the generatePatches gradle task found in IC2-Base project. This will generate patches that will be applied after IC2-Base de-compilation step.
      Take note that while this process will allow the code to compile, the code might have been decompiled incorrectly in the first place, and cause the dev env game to not launch successfully. It's recommended to use the other decompilation tool to diagnose and correct the mistake.
    2. If IC2-Patched project fails to compile, remove patches that aren't getting applied properly, and if relevant, port them to the currently used IC2 version.
  4. After making changes to the code, run generatePatches task of the IC2-Patched project to generate the patches.

Building & Exporting

  1. Run the generateBinPatches task of the IC2-Patched project for each version you have done changes to.
    1. Make sure there aren't overlapping folders from previously generated patches!
  2. Run gradlew buildto build the patcher. The resulting jar will be located in the build/libs folder.
    Remember that the jar build by the jar task will NOT work outside the dev environment.
The Unlicense Logo

Licensing

All code is licensed under The Unlicense, except for mods.su5ed.ic2patcher.asm.BinPatchManager, which is a modified version of MinecraftForge's ClassPatchManager class, and is licensed under the GNU Lesser General Public License version 2.1