-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fullscreen fix. Update libraries in MultiMC.md
- Loading branch information
Showing
9 changed files
with
155 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
plugins { | ||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' | ||
} | ||
rootProject.name = 'launchwrapper' | ||
include 'launchwrapper-fabric' | ||
// include 'launchwrapper-micromixin' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
src/main/java/org/mcphackers/launchwrapper/tweak/injection/vanilla/OutOfFocusFullscreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package org.mcphackers.launchwrapper.tweak.injection.vanilla; | ||
|
||
import static org.mcphackers.rdi.util.InsnHelper.*; | ||
import static org.objectweb.asm.Opcodes.*; | ||
|
||
import org.mcphackers.launchwrapper.LaunchConfig; | ||
import org.mcphackers.launchwrapper.tweak.injection.InjectionWithContext; | ||
import org.mcphackers.launchwrapper.tweak.injection.MinecraftGetter; | ||
import org.mcphackers.launchwrapper.util.ClassNodeSource; | ||
import org.mcphackers.rdi.util.NodeHelper; | ||
import org.objectweb.asm.tree.AbstractInsnNode; | ||
import org.objectweb.asm.tree.ClassNode; | ||
import org.objectweb.asm.tree.FieldNode; | ||
import org.objectweb.asm.tree.InsnNode; | ||
import org.objectweb.asm.tree.MethodInsnNode; | ||
import org.objectweb.asm.tree.MethodNode; | ||
|
||
/** | ||
* Part of LWJGLPatch, but for 1.6+ without need for deAWT | ||
*/ | ||
public class OutOfFocusFullscreen extends InjectionWithContext<MinecraftGetter> { | ||
|
||
public OutOfFocusFullscreen(MinecraftGetter context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return "Fullscreen fix"; | ||
} | ||
|
||
@Override | ||
public boolean required() { | ||
return false; | ||
} | ||
|
||
private MethodNode getTickMethod(MethodNode run) { | ||
ClassNode minecraft = context.getMinecraft(); | ||
FieldNode running = context.getIsRunning(); | ||
if(running == null) { | ||
return run; | ||
} | ||
AbstractInsnNode insn = run.instructions.getFirst(); | ||
while(insn != null) { | ||
if(compareInsn(insn.getPrevious(), ALOAD) | ||
&& compareInsn(insn, INVOKESPECIAL, minecraft.name, null, "()V")) { | ||
MethodInsnNode invoke = (MethodInsnNode) insn; | ||
MethodNode testedMethod = NodeHelper.getMethod(minecraft, invoke.name, invoke.desc); | ||
if(testedMethod != null) { | ||
AbstractInsnNode insn2 = testedMethod.instructions.getFirst(); | ||
while(insn2 != null) { | ||
// tick method up to 1.12.2 contains this call | ||
if(compareInsn(insn2, INVOKESTATIC, "org/lwjgl/opengl/Display", "isCloseRequested", "()Z")) { | ||
return testedMethod; | ||
} | ||
insn2 = nextInsn(insn2); | ||
} | ||
} | ||
} | ||
insn = nextInsn(insn); | ||
} | ||
return run; | ||
} | ||
|
||
@Override | ||
public boolean apply(ClassNodeSource source, LaunchConfig config) { | ||
ClassNode minecraft = context.getMinecraft(); | ||
MethodNode tick = getTickMethod(context.getRun()); | ||
for(AbstractInsnNode insn = tick.instructions.getFirst(); insn != null; insn = nextInsn(insn)) { | ||
AbstractInsnNode[] insns2 = fill(insn, 7); | ||
if(compareInsn(insns2[0], INVOKESTATIC, "org/lwjgl/opengl/Display", "isActive", "()Z") | ||
&& compareInsn(insns2[1], IFNE) | ||
&& compareInsn(insns2[2], ALOAD) | ||
&& compareInsn(insns2[3], GETFIELD, minecraft.name, null, "Z") | ||
&& compareInsn(insns2[4], IFEQ) | ||
&& compareInsn(insns2[5], ALOAD) | ||
&& compareInsn(insns2[6], INVOKEVIRTUAL, minecraft.name, null, "()V")) { | ||
tick.instructions.set(insn, new InsnNode(ICONST_1)); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters