mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-14 15:17:02 -04:00
- Fix improper architecture detection
- Progressive transition towards a new architecture system
This commit is contained in:
parent
bcb9957e0c
commit
fed4fe74d5
@ -79,10 +79,10 @@ public class Architecture
|
||||
*/
|
||||
public static int archAsInt(String arch){
|
||||
arch = arch.toLowerCase().trim().replace(" ", "");
|
||||
if(arch.contains("arm64") || arch.equals("aarch64") || arch.equals("adm64")) return ARCH_ARM64;
|
||||
if(arch.contains("arm64") || arch.equals("aarch64")) return ARCH_ARM64;
|
||||
if(arch.contains("arm")) return ARCH_ARM;
|
||||
if(arch.equals("x86_64")) return ARCH_X86_64;
|
||||
if(arch.equals("x86") || (arch.startsWith("i") && arch.endsWith("86"))) return ARCH_X86;
|
||||
if(arch.equals("x86_64") || arch.equals("amd64")) return ARCH_X86_64;
|
||||
if(arch.contains("x86") || (arch.startsWith("i") && arch.endsWith("86"))) return ARCH_X86;
|
||||
//Shouldn't happen
|
||||
return UNSUPPORTED_ARCH;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
import static net.kdt.pojavlaunch.Architecture.ARCH_X86;
|
||||
|
||||
import android.app.*;
|
||||
import android.content.*;
|
||||
import android.content.pm.PackageManager;
|
||||
@ -763,7 +765,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
}
|
||||
|
||||
private void checkVulkanZinkIsSupported() {
|
||||
if (Tools.CURRENT_ARCHITECTURE.equals("x86")
|
||||
if (Tools.CURRENT_ARCHITECTURE == ARCH_X86
|
||||
|| Build.VERSION.SDK_INT < 25
|
||||
|| !getPackageManager().hasSystemFeature(PackageManager.FEATURE_VULKAN_HARDWARE_LEVEL)
|
||||
|| !getPackageManager().hasSystemFeature(PackageManager.FEATURE_VULKAN_HARDWARE_VERSION)) {
|
||||
|
@ -110,7 +110,7 @@ public class PojavLoginActivity extends BaseActivity
|
||||
LinearLayout startScr = new LinearLayout(PojavLoginActivity.this);
|
||||
LayoutInflater.from(PojavLoginActivity.this).inflate(R.layout.start_screen,startScr);
|
||||
PojavLoginActivity.this.setContentView(startScr);
|
||||
|
||||
|
||||
progress = (ProgressBar) findViewById(R.id.startscreenProgress);
|
||||
if(isStarting) progress.setVisibility(View.VISIBLE);
|
||||
startupTextView = (TextView) findViewById(R.id.startscreen_text);
|
||||
|
@ -23,8 +23,7 @@ import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
|
||||
public class JREUtils
|
||||
{
|
||||
public class JREUtils {
|
||||
private JREUtils() {}
|
||||
|
||||
public static String JRE_ARCHITECTURE;
|
||||
@ -32,18 +31,18 @@ public class JREUtils
|
||||
public static String LD_LIBRARY_PATH;
|
||||
private static String nativeLibDir;
|
||||
|
||||
public static void checkJavaArchitecture(LoggableActivity act, String jreArch) throws Exception {
|
||||
String[] argName = Tools.CURRENT_ARCHITECTURE.split("/");
|
||||
/**
|
||||
* Checks if the java architecture is correct for the device architecture.
|
||||
* @param act An Activity with logging capabilities
|
||||
* @param jreArch The java architecture to compare as a String.
|
||||
*/
|
||||
public static void checkJavaArchitecture(LoggableActivity act, String jreArch) {
|
||||
act.appendlnToLog("Architecture: " + Tools.CURRENT_ARCHITECTURE);
|
||||
if (!(jreArch.contains(argName[0]) || jreArch.contains(argName[1]))) {
|
||||
// x86 check workaround
|
||||
if (jreArch.startsWith("i") && jreArch.endsWith("86") && Tools.CURRENT_ARCHITECTURE.contains("x86") && !Tools.CURRENT_ARCHITECTURE.contains("64")) {
|
||||
return;
|
||||
}
|
||||
if(Tools.CURRENT_ARCHITECTURE == Architecture.archAsInt(jreArch)) return;
|
||||
|
||||
act.appendlnToLog("Architecture " + Tools.CURRENT_ARCHITECTURE + " is incompatible with Java Runtime " + jreArch);
|
||||
throw new RuntimeException(act.getString(R.string.mcn_check_fail_incompatiblearch, String.valueOf(Tools.CURRENT_ARCHITECTURE), jreArch));
|
||||
|
||||
act.appendlnToLog("Architecture " + Tools.CURRENT_ARCHITECTURE + " is incompatible with Java Runtime " + jreArch);
|
||||
throw new RuntimeException(act.getString(R.string.mcn_check_fail_incompatiblearch, Tools.CURRENT_ARCHITECTURE, jreArch));
|
||||
}
|
||||
}
|
||||
|
||||
public static String findInLdLibPath(String libName) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user