Improve launcher injection and hook reliability

Find Fabric through the render thread's class loader and make bytecode transformations safer for launcher-provided class definitions. Improve hook reporting, process-picker refresh behavior, and self-destruct cleanup; document Dawn and Lunar 1.21.11 setup.
This commit is contained in:
bbldrizzy committed 2026-11-03 11:40:43 +00:00
1 parent 38ff6d387c
commit 036b24f2ae
12 files changed
+186 -48

No files matched your search

@@ -2,6 +2,7 @@ package dev.zprestige.prestige.module.misc;
import dev.zprestige.prestige.Module;
import dev.zprestige.prestige.client.Prestige;
import dev.zprestige.prestige.engine.EngineState;
import dev.zprestige.prestige.inject.Bootstrap;
import dev.zprestige.prestige.inject.NativeBridge;
import dev.zprestige.prestige.ui.mc.Overlay;
@@ -22,9 +23,10 @@ public class SelfDestruct extends Module {
@Override
public void onEnable() {
if (Prestige.selfDestructed) return;
Prestige.selfDestructed = true;
System.out.println("[Prestige] Self Destruct started");
Overlay.shutdown();
mc.setScreen(null);
List<Module> modules = new ArrayList<>(Prestige.moduleManager.getModules());
for (Module module : modules) {
@@ -41,10 +43,13 @@ public class SelfDestruct extends Module {
}
// Disposing this module now would null its own "Enabled" value while Module.toggle still has to read it.
mc.execute(() -> dispose(modules));
EngineState.ready = false;
mc.send(() -> dispose(modules));
}
private void dispose(List<Module> modules) {
Prestige.eventBus.unregister(this);
Prestige.eventBus.unregister(Prestige.moduleManager);
for (Module module : modules) {
try {
module.dispose();
@@ -56,15 +61,20 @@ public class SelfDestruct extends Module {
Prestige.moduleManager.setModules(new ArrayList<>());
if (Bootstrap.isInjected()) {
// one more tick so no hook of the current tick is still being entered when the original classes come back
mc.execute(() -> mc.execute(SelfDestruct::unhook));
unhook();
} else {
System.out.println("[Prestige] Self Destruct finished");
}
}
private static void unhook() {
try {
Bootstrap.uninstall();
NativeBridge.release();
if (Bootstrap.uninstall() == 0) {
NativeBridge.release();
System.out.println("[Prestige] Self Destruct finished");
} else {
System.out.println("[Prestige] Self Destruct left hooks installed. Restart the game to clear them.");
}
} catch (UnsatisfiedLinkError ignored) {
// loader already gone
} catch (Throwable error) {
@@ -73,6 +83,11 @@ public class SelfDestruct extends Module {
}
}
@Override
protected boolean requiresWorldOnEnable() {
return false;
}
@Override
public boolean isPersistent() {
return false;