fix not work

This commit is contained in:
khanhduytran0
2020-03-29 17:39:34 +07:00
parent 70c97f4c66
commit 5932f03a03
131 changed files with 19 additions and 14 deletions

View File

@@ -7,7 +7,7 @@ import org.lwjgl.input.*;
import org.lwjgl.opengl.*;
public class AndroidLWJGLKeycode {
public static boolean isSendChar;
// public static boolean isSendChar;
private static final Map<Integer, Integer> androidToLwjglMap;
static {
androidToLwjglMap = new ArrayMap<Integer, Integer>();
@@ -126,7 +126,8 @@ public class AndroidLWJGLKeycode {
}
*/
System.out.println("Sending key as char: " + ((char) keyEvent.getUnicodeChar()));
if (isSendChar) mainActivity.sendKeyPress(0, (char) keyEvent.getUnicodeChar(), isDown);
// if (isSendChar)
mainActivity.sendKeyPress(0, (char) keyEvent.getUnicodeChar(), isDown);
} catch (Throwable th) {
th.printStackTrace();
}

View File

@@ -32,6 +32,7 @@ import java.lang.reflect.*;
import net.kdt.pojavlaunch.patcher.*;
import android.graphics.*;
import android.content.pm.*;
import optifine.*;
//import android.support.v7.view.menu.*;
//import net.zhuoweizhang.boardwalk.downloader.*;
@@ -992,6 +993,8 @@ public class MCLauncherActivity extends AppCompatActivity
Tools.extractAssetFolder(MCLauncherActivity.this, "optifine_patch", Tools.optifineDir, true);
new File(Tools.optifineDir + "/optifine_patch/AndroidOptiFineUtilities.class.patch").delete();
String[] output = Tools.patchOptifineInstaller(MCLauncherActivity.this, file[0]);
File patchedFile = new File(output[1]);
@@ -1017,14 +1020,14 @@ public class MCLauncherActivity extends AppCompatActivity
optDir.mkdir();
DexClassLoader loader = new DexClassLoader(convertedFile.getAbsolutePath(), optDir.getAbsolutePath(), getApplicationInfo().nativeLibraryDir, getClass().getClassLoader());
Class utilitiesClass = Tools.insertOptiFinePath(loader, convertedFile.getAbsolutePath());
Tools.insertOptiFinePath(loader, convertedFile.getAbsolutePath());
Class installerClass = loader.loadClass("optifine.AndroidInstaller");
Method installerMethod = installerClass.getDeclaredMethod("doInstall", File.class);
installerMethod.invoke(null, new File(Tools.MAIN_PATH));
publishProgress("(4/5) Patching OptiFine Tweaker");
File optifineLibFile = new File((String) utilitiesClass.getDeclaredField("optifineOutputJar").get(null));
File optifineLibFile = new File(AndroidOptiFineUtilities.optifineOutputJar);
new OptiFinePatcher(optifineLibFile).saveTweaker();
publishProgress("(5/5) Done!");

View File

@@ -258,7 +258,7 @@ public class MainActivity extends Activity implements OnTouchListener
this.drawerLayout.closeDrawers();
AndroidLWJGLKeycode.isSendChar = mVersionInfo.minimumLauncherVersion < 18;
// AndroidLWJGLKeycode.isSendChar = mVersionInfo.minimumLauncherVersion < 18;
placeMouseAt(AndroidDisplay.windowWidth / 2, AndroidDisplay.windowHeight / 2);
new Thread(new Runnable(){

View File

@@ -19,6 +19,7 @@ import org.apache.commons.codec.digest.*;
import net.kdt.pojavlaunch.patcher.*;
import java.lang.reflect.*;
import dalvik.system.*;
import optifine.*;
public final class Tools
{
@@ -110,9 +111,8 @@ public final class Tools
try {
File file = new File(output);
if(!file.exists()) file.mkdirs();
File file2 = new File(output + "/" + outputName);
File file2 = new File(output, outputName);
if(!file2.exists() || overwrite){
file2.createNewFile(); // throw new RuntimeException("Unable to write " + output + "/" + outputName);
write(file2.getAbsolutePath(), loadFromAssetToByte(ctx, fileName));
}
} catch (Throwable th) {
@@ -144,13 +144,8 @@ public final class Tools
}
}
public static Class insertOptiFinePath(BaseDexClassLoader loader, String optifineJar) throws NoSuchFieldException, IllegalAccessException, IllegalArgumentException, ClassNotFoundException {
Class optifineClass = loader.loadClass("optifine.AndroidOptiFineUtilities");
Field optifinePathField = optifineClass.getDeclaredField("originalOptifineJar");
optifinePathField.setAccessible(true);
optifinePathField.set(null, optifineJar);
return optifineClass;
public static void insertOptiFinePath(BaseDexClassLoader loader, String optifineJar) throws NoSuchFieldException, IllegalAccessException, IllegalArgumentException, ClassNotFoundException {
AndroidOptiFineUtilities.originalOptifineJar = optifineJar;
}
/*

View File

@@ -0,0 +1,6 @@
package optifine;
public class AndroidOptiFineUtilities
{
public static String originalOptifineJar, optifineOutputJar;
}