Skip to content

Commit

Permalink
Cleanup after the patching process
Browse files Browse the repository at this point in the history
  • Loading branch information
kiooeht committed Sep 16, 2018
1 parent e216bb1 commit 8ae356f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Changelog ##
#### dev ####
* SpireOverride: Allow overriding private methods from superclasses
* Cleanup after the patching process

#### v3.1.0 ####
* Option dependencies field in ModInfo
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/com/evacipated/cardcrawl/modthespire/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static boolean isModLoaded(String modID)

public static ClassPool getClassPool()
{
return new ClassPool(POOL);
return POOL;
}

public static void main(String[] args) {
Expand Down Expand Up @@ -178,7 +178,6 @@ public static void runMods(File[] modJars) {

System.out.println("Begin patching...");
ClassPool pool = new MTSClassPool(tmpPatchingLoader);
POOL = pool;
pool.insertClassPath(new LoaderClassPath(tmpPatchingLoader));
tmpPatchingLoader.addStreamToClassPool(pool); // Inserts infront of above path
SortedMap<String, CtClass> ctClasses = new TreeMap<>();
Expand All @@ -200,6 +199,13 @@ public static void runMods(File[] modJars) {
Patcher.finalizePatches(tmpPatchingLoader);
Patcher.compilePatches(loader, ctClasses);

ctClasses.clear();
tmpPatchingLoader.close();

POOL = new MTSClassPool(loader);
POOL.insertClassPath(new LoaderClassPath(loader));
loader.addStreamToClassPool(POOL);

System.out.printf("Patching enums...");
Patcher.patchEnums(loader, Loader.class.getResource(Loader.COREPATCHES_JAR));
// Patch SpireEnums from mods
Expand Down

0 comments on commit 8ae356f

Please sign in to comment.