From d59518901b4b86ae32a63c764b54707a7381e528 Mon Sep 17 00:00:00 2001 From: Vera-Firefly <1964762970@qq.com> Date: Mon, 19 Aug 2024 15:06:04 +0800 Subject: [PATCH 1/7] Feat[EXP]: Allow Custom Mesa Load Driver Override --- .../net/kdt/pojavlaunch/MainActivity.java | 3 ++ .../main/java/net/kdt/pojavlaunch/Tools.java | 38 ++++++++++++++ .../prefs/LauncherPreferences.java | 8 ++- ...auncherPreferenceExperimentalFragment.java | 24 ++++++--- .../net/kdt/pojavlaunch/utils/JREUtils.java | 52 +++++++++++++------ app_pojavlauncher/src/main/jni/egl_bridge.c | 43 +++++++-------- .../src/main/res/values/renderer_extra.xml | 13 +++++ .../src/main/res/xml/pref_experimental.xml | 22 ++++++++ 8 files changed, 159 insertions(+), 44 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java index e7519955c..0a23fc9ad 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java @@ -351,6 +351,9 @@ private void runCraft(String versionId, JMinecraftVersionList.Version version) t if(Tools.DRIVER_MODEL == null) { Tools.DRIVER_MODEL = LauncherPreferences.PREF_DRIVER_MODEL; } + if(Tools.LOADER_OVERRIDE) { + Tools.LOADER_OVERRIDE = LauncherPreferences.PREF_LOCAL_LOADER_OVERRIDE + } if(!Tools.checkRendererCompatible(this, Tools.LOCAL_RENDERER)) { Tools.RenderersList renderersList = Tools.getCompatibleRenderers(this); String firstCompatibleRenderer = renderersList.rendererIds.get(0); diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java index a311caf53..47104319b 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java @@ -129,9 +129,11 @@ public final class Tools { public static String DRIVER_MODEL = null; public static String MESA_LIBS = null; + public static String LOADER_OVERRIDE = null; private static CDriverModelList sCompatibleCDriverModel; private static CMesaLibList sCompatibleCMesaLibs; + private static CMesaLDOList sCompatibleCMesaLDO; private static RenderersList sCompatibleRenderers; private static File getPojavStorageRoot(Context ctx) { @@ -1333,6 +1335,42 @@ public static CDriverModelList getCompatibleCDriverModel(Context context) { return sCompatibleCDriverModel; } + public static class CMesaLDOList implements IListAndArry { + public final List CMesaLDOIds; + public final String[] CMesaLDO; + + public CMesaLDOList(List CMesaLDOIds, String[] CMesaLDO) { + this.CMesaLDOIds = CMesaLDOIds; + this.CMesaLDO = CMesaLDO; + } + + @Override + public List getList() { + return CMesaLDOIds; + } + + @Override + public String[] getArray() { + return CMesaLDO; + } + } + + public static CMesaLDOList getCompatibleCMesaLDO(Context context) { + if (sCompatibleCMesaLDO != null) return sCompatibleCMesaLDO; + Resources resources = context.getResources(); + String[] defaultCMesaLDO = resources.getStringArray(R.array.osmesa_mldo_values); + String[] defaultCMesaLDONames = resources.getStringArray(R.array.osmesa_mldo); + List CMesaLDOIds = new ArrayList<>(defaultCMesaLDO.length); + List CMesaLDONames = new ArrayList<>(defaultCMesaLDONames.length); + for (int i = 0; i < defaultCMesaLDO.length; i++) { + CMesaLibIds.add(defaultCMesaLib[i]); + CMesaLibNames.add(defaultCMesaLibNames[i]); + } + sCompatibleCMesaLDO = new CMesaLDOList(CMesaLDOIds, + CMesaLDONames.toArray(new String[0])); + return sCompatibleCMesaLDO; + } + @SuppressLint("DefaultLocale") public static String formatFileSize(long bytes) { if (bytes <= 0) return "0 B"; diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java index fa5d94b3f..1c715ca35 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java @@ -27,6 +27,7 @@ public class LauncherPreferences { public static String PREF_RENDERER = "opengles2"; public static String PREF_MESA_LIB = "default"; public static String PREF_DRIVER_MODEL = "driver_zink"; + public static String PREF_LOCAL_LOADER_OVERRIDE = "kgsl"; public static boolean PREF_VERTYPE_RELEASE = true; public static boolean PREF_VERTYPE_SNAPSHOT = false; @@ -74,9 +75,10 @@ public class LauncherPreferences { public static boolean PREF_SPARE_BRIDGE = false; public static boolean PREF_SPARE_FRAME_BUFFER = false; - public static boolean PREF_EXP_ENABLE_SYSTEM = false; + public static boolean PREF_EXP_ENABLE_SYSTEM = true; public static boolean PREF_EXP_ENABLE_SPECIFIC = false; public static boolean PREF_EXP_ENABLE_CUSTOM = false; + public static boolean PREF_LOADER_OVERRIDE = false; public static boolean PREF_VERIFY_MANIFEST = true; public static String PREF_DOWNLOAD_SOURCE = "default"; @@ -138,13 +140,15 @@ public static void loadPreferences(Context ctx) { PREF_SPARE_BRIDGE = DEFAULT_PREF.getBoolean("spareBridge", false); PREF_SPARE_FRAME_BUFFER = DEFAULT_PREF.getBoolean("SpareFrameBuffer", false); - PREF_EXP_ENABLE_SYSTEM = DEFAULT_PREF.getBoolean("ebSystem", false); + PREF_EXP_ENABLE_SYSTEM = DEFAULT_PREF.getBoolean("ebSystem", true); PREF_EXP_ENABLE_SPECIFIC = DEFAULT_PREF.getBoolean("ebSpecific", false); PREF_EXP_ENABLE_CUSTOM = DEFAULT_PREF.getBoolean("ebCustom", false); + PREF_LOADER_OVERRIDE = DEFAULT_PREF.getBoolean("ebChooseMldo", false); PREF_EXP_SETUP = DEFAULT_PREF.getBoolean("ExperimentalSetup", false); PREF_MESA_LIB = DEFAULT_PREF.getString("CMesaLibrary", "default"); PREF_DRIVER_MODEL = DEFAULT_PREF.getString("CDriverModels", "driver_zink"); + PREF_LOCAL_LOADER_OVERRIDE = DEFAULT_PREF.getString("ChooseMldo", "kgsl"); PREF_MESA_GL_VERSION = DEFAULT_PREF.getString("mesaGLVersion", "4.6"); PREF_MESA_GLSL_VERSION = DEFAULT_PREF.getString("mesaGLSLVersion", "460"); diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceExperimentalFragment.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceExperimentalFragment.java index 99c45cc6a..a1f2fa073 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceExperimentalFragment.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceExperimentalFragment.java @@ -49,20 +49,27 @@ public void onCreatePreferences(Bundle b, String str) { final ListPreference CMesaLibP = requirePreference("CMesaLibrary", ListPreference.class); final ListPreference CDriverModelP = requirePreference("CDriverModels", ListPreference.class); + final ListPreference CMesaLDOP = requirePreference("ChooseMldo", ListPreference.class); setListPreference(CMesaLibP, "CMesaLibrary"); setListPreference(CDriverModelP, "CDriverModels"); + setListPreference(CMesaLDOP, "ChooseMldo"); CMesaLibP.setOnPreferenceChangeListener((pre, obj) -> { - Tools.MESA_LIBS = (String)obj; - setListPreference(CDriverModelP, "CDriverModels"); - CDriverModelP.setValueIndex(0); - return true; + Tools.MESA_LIBS = (String)obj; + setListPreference(CDriverModelP, "CDriverModels"); + CDriverModelP.setValueIndex(0); + return true; }); CDriverModelP.setOnPreferenceChangeListener((pre, obj) -> { - Tools.DRIVER_MODEL = (String)obj; - return true; + Tools.DRIVER_MODEL = (String)obj; + return true; + }); + + CMesaLDOP.setOnPreferenceChangeListener((pre, obj) -> { + Tools.LOADER_OVERRIDE = (String)obj; + return true; }); SwitchPreference expRendererPref = requirePreference("ExperimentalSetup", SwitchPreference.class); @@ -117,6 +124,8 @@ private void computeVisibility(){ requirePreference("SpareFrameBuffer").setVisible(LauncherPreferences.PREF_EXP_SETUP); requirePreference("MesaRendererChoose").setVisible(LauncherPreferences.PREF_EXP_SETUP); requirePreference("customMesaVersionPref").setVisible(LauncherPreferences.PREF_EXP_SETUP); + requirePreference("customMesaLoaderDriverOverride").setVisible(LauncherPreferences.PREF_EXP_SETUP); + requirePreference("ChooseMldo").setVisible(LauncherPreferences.PREF_LOADER_OVERRIDE); } private void setListPreference(ListPreference listPreference, String preferenceKey) { @@ -139,6 +148,9 @@ private void setListPreference(ListPreference listPreference, String preferenceK } else if (preferenceKey.equals("CDriverModels")) { array = Tools.getCompatibleCDriverModel(getContext()); Tools.DRIVER_MODEL = value; + } else if (preferenceKey.equals("ChooseMldo")) { + array = Tools.getCompatibleCMesaLDO(getContext()); + Tools.LOADER_OVERRIDE = value; } listPreference.setEntries(array.getArray()); listPreference.setEntryValues(array.getList().toArray(new String[0])); diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java index c022e271d..ae793776c 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java @@ -5,6 +5,7 @@ import static net.kdt.pojavlaunch.Tools.LOCAL_RENDERER; import static net.kdt.pojavlaunch.Tools.MESA_LIBS; import static net.kdt.pojavlaunch.Tools.DRIVER_MODEL; +import static net.kdt.pojavlaunch.Tools.LOADER_OVERRIDE; import static net.kdt.pojavlaunch.Tools.NATIVE_LIB_DIR; import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics; import static net.kdt.pojavlaunch.Tools.shareLog; @@ -199,7 +200,6 @@ public static void setJavaEnvironment(Activity activity, String jreHome) throws envMap.put("FORCE_VSYNC", String.valueOf(LauncherPreferences.PREF_FORCE_VSYNC)); envMap.put("MESA_GLSL_CACHE_DIR", Tools.DIR_CACHE.getAbsolutePath()); - envMap.put("MESA_LOADER_DRIVER_OVERRIDE", "zink"); envMap.put("force_glsl_extensions_warn", "true"); envMap.put("allow_higher_compat_version", "true"); @@ -208,10 +208,12 @@ public static void setJavaEnvironment(Activity activity, String jreHome) throws envMap.put("LD_LIBRARY_PATH", LD_LIBRARY_PATH); envMap.put("PATH", jreHome + "/bin:" + Os.getenv("PATH")); - if(LauncherPreferences.PREF_BIG_CORE_AFFINITY) envMap.put("POJAV_BIG_CORE_AFFINITY", "1"); envMap.put("AWTSTUB_WIDTH", Integer.toString(CallbackBridge.windowWidth > 0 ? CallbackBridge.windowWidth : CallbackBridge.physicalWidth)); envMap.put("AWTSTUB_HEIGHT", Integer.toString(CallbackBridge.windowHeight > 0 ? CallbackBridge.windowHeight : CallbackBridge.physicalHeight)); + if(LauncherPreferences.PREF_BIG_CORE_AFFINITY) + envMap.put("POJAV_BIG_CORE_AFFINITY", "1"); + if(PREF_DUMP_SHADERS) envMap.put("LIBGL_VGPU_DUMP", "1"); if(PREF_ZINK_PREFER_SYSTEM_DRIVER) @@ -229,9 +231,8 @@ public static void setJavaEnvironment(Activity activity, String jreHome) throws if(Tools.deviceHasHangingLinker()) envMap.put("POJAV_EMUI_ITERATOR_MITIGATE", "1"); - if(FFmpegPlugin.isAvailable) { + if(FFmpegPlugin.isAvailable) envMap.put("PATH", FFmpegPlugin.libraryPath+":"+envMap.get("PATH")); - } if (LOCAL_RENDERER != null) { if (!PREF_EXP_SETUP) { @@ -250,6 +251,7 @@ public static void setJavaEnvironment(Activity activity, String jreHome) throws case "freedreno":{ envMap.put("POJAV_BETA_RENDERER", "mesa_3d"); envMap.put("LOCAL_DRIVER_MODEL", "driver_freedreno"); + envMap.put("LOCAL_LOADER_OVERRIDE", "kgsl"); envMap.put("MESA_LIBRARY", localMesaLibrary); } break; case "panfrost":{ @@ -260,15 +262,16 @@ public static void setJavaEnvironment(Activity activity, String jreHome) throws envMap.put("MESA_LIBRARY", localMesaLibrary); } break; default:{ + envMap.put("LOCAL_LOADER_OVERRIDE", "zink"); envMap.put("POJAV_BETA_RENDERER", LOCAL_RENDERER); } break; } - } else { - envMap.put("POJAV_BETA_RENDERER", LOCAL_RENDERER); - } + } else envMap.put("POJAV_BETA_RENDERER", LOCAL_RENDERER); + if (LOCAL_RENDERER.equals("mesa_3d")) { envMap.put("MESA_LIBRARY", localMesaLibrary); envMap.put("LOCAL_DRIVER_MODEL", DRIVER_MODEL); + if (PREF_EXP_ENABLE_SPECIFIC) { switch (DRIVER_MODEL) { case "driver_zink": @@ -291,24 +294,43 @@ public static void setJavaEnvironment(Activity activity, String jreHome) throws envMap.put("MESA_GL_VERSION_OVERRIDE", glVersion); envMap.put("MESA_GLSL_VERSION_OVERRIDE", glslVersion); } - if (MESA_LIBS.equals("mesa2205")) { - envMap.put("DCLAT_FRAMEBUFFER", "1"); - if(DRIVER_MODEL.equals("driver_zink")) - envMap.put("POJAV_LEGACY_ZINK_ALLOW", "1"); + + if (PREF_LOADER_OVERRIDE) { + switch (LOADER_OVERRIDE) { + case "kgsl": + envMap.put("LOCAL_LOADER_OVERRIDE", "kgsl"); + break; + case "msm": + envMap.put("LOCAL_LOADER_OVERRIDE", "msm"); + break; + case "virtio": + envMap.put("LOCAL_LOADER_OVERRIDE", "virtio"); + break; + default: + envMap.put("LOCAL_LOADER_OVERRIDE", "kgsl"); + } } + if (DRIVER_MODEL.equals("driver_virgl")) + { + envMap.put("DCLAT_FRAMEBUFFER", "1"); envMap.put("VTEST_SOCKET_NAME", new File(Tools.DIR_CACHE, ".virgl_test").getAbsolutePath()); - if (DRIVER_MODEL.equals("driver_panfrost")) { + } + + if (DRIVER_MODEL.equals("driver_panfrost")) + { envMap.put("MESA_DISK_CACHE_SINGLE_FILE", "1"); - if (MESA_LIBS.equals("default")) { + if (MESA_LIBS.equals("default")) envMap.put("PAN_MESA_DEBUG", "trace"); - } } } - if (LOCAL_RENDERER.equals("opengles3_desktopgl_angle_vulkan")) { + + if (LOCAL_RENDERER.equals("opengles3_desktopgl_angle_vulkan")) + { envMap.put("LIBGL_ES", "3"); envMap.put("POJAVEXEC_EGL","libEGL_angle.so"); // Use ANGLE EGL } + } File customEnvFile = new File(ProfilePathManager.getCurrentPath(), "custom_env.txt"); diff --git a/app_pojavlauncher/src/main/jni/egl_bridge.c b/app_pojavlauncher/src/main/jni/egl_bridge.c index dd0cd0124..e95b29fa5 100644 --- a/app_pojavlauncher/src/main/jni/egl_bridge.c +++ b/app_pojavlauncher/src/main/jni/egl_bridge.c @@ -198,57 +198,62 @@ void renderer_load_config() { int pojavInitOpenGL() { // Only affects GL4ES as of now const char *forceVsync = getenv("FORCE_VSYNC"); - if (strcmp(forceVsync, "true") == 0) + if (!strcmp(forceVsync, "true")) pojav_environ->force_vsync = true; // NOTE: Override for now. const char *renderer = getenv("POJAV_BETA_RENDERER"); const char *ldrivermodel = getenv("LOCAL_DRIVER_MODEL"); + const char *mldo = getenv("LOCAL_LOADER_OVERRIDE"); - if (strncmp("opengles", renderer, 8) == 0) { + if (mldo) printf("MESA_LOADER_DRIVER_OVERRIDE = %s\n", mldo); + + if (!strncmp("opengles", renderer, 8)) + { pojav_environ->config_renderer = RENDERER_GL4ES; + setenv("MESA_LOADER_DRIVER_OVERRIDE", "zink", 1); if (!SpareBridge()) set_gl_bridge_tbl(); - } else if (strcmp(renderer, "mesa_3d") == 0) { + } else if (!strcmp(renderer, "mesa_3d")) { - if (strcmp(ldrivermodel, "driver_zink") == 0) + if (!strcmp(ldrivermodel, "driver_zink")) { - setenv("GALLIUM_DRIVER","zink",1); + setenv("GALLIUM_DRIVER", "zink", 1); renderer_load_config(); load_vulkan(); } - if (strcmp(ldrivermodel, "driver_virgl") == 0) + if (!strcmp(ldrivermodel, "driver_virgl")) { pojav_environ->config_renderer = RENDERER_VIRGL; - setenv("GALLIUM_DRIVER","virpipe",1); - setenv("OSMESA_NO_FLUSH_FRONTBUFFER","1",false); - if(strcmp(getenv("OSMESA_NO_FLUSH_FRONTBUFFER"),"1") == 0) { + setenv("MESA_LOADER_DRIVER_OVERRIDE", "zink", 1); + setenv("GALLIUM_DRIVER", "virpipe", 1); + setenv("OSMESA_NO_FLUSH_FRONTBUFFER", "1", false); + if (!strcmp(getenv("OSMESA_NO_FLUSH_FRONTBUFFER"), "1")) printf("VirGL: OSMesa buffer flush is DISABLED!\n"); - } loadSymbolsVirGL(); } - if (strcmp(ldrivermodel, "driver_panfrost") == 0) + if (!strcmp(ldrivermodel, "driver_panfrost")) { setenv("GALLIUM_DRIVER", "panfrost", 1); renderer_load_config(); } - if (strcmp(ldrivermodel, "driver_freedreno") == 0) + if (!strcmp(ldrivermodel, "driver_freedreno")) { setenv("GALLIUM_DRIVER", "freedreno", 1); - setenv("MESA_LOADER_DRIVER_OVERRIDE", "kgsl", 1); + setenv("MESA_LOADER_DRIVER_OVERRIDE", mldo, 1); renderer_load_config(); } - if (strcmp(ldrivermodel, "driver_softpipe") == 0) + if (!strcmp(ldrivermodel, "driver_softpipe")) { setenv("GALLIUM_DRIVER", "softpipe", 1); setenv("LIBGL_ALWAYS_SOFTWARE", "1", 1); renderer_load_config(); } - if (strcmp(ldrivermodel, "driver_llvmpipe") == 0) + if (!strcmp(ldrivermodel, "driver_llvmpipe")) { setenv("GALLIUM_DRIVER", "llvmpipe", 1); setenv("LIBGL_ALWAYS_SOFTWARE", "1", 1); @@ -260,19 +265,15 @@ int pojavInitOpenGL() { || pojav_environ->config_renderer == RENDERER_GL4ES) { if (gl_init() && SpareBridge() && pojav_environ->config_renderer == RENDERER_GL4ES) - { gl_setup_window(); - } else { - if (br_init()) br_setup_window(); - } + else if (br_init()) br_setup_window(); } if (pojav_environ->config_renderer == RENDERER_VK_ZINK_PREF && spare_init()) spare_setup_window(); - if (pojav_environ->config_renderer == RENDERER_VIRGL) { + if (pojav_environ->config_renderer == RENDERER_VIRGL) pojav_virgl_init(); - } return 0; } diff --git a/app_pojavlauncher/src/main/res/values/renderer_extra.xml b/app_pojavlauncher/src/main/res/values/renderer_extra.xml index 8b715f65d..e4636177f 100644 --- a/app_pojavlauncher/src/main/res/values/renderer_extra.xml +++ b/app_pojavlauncher/src/main/res/values/renderer_extra.xml @@ -33,4 +33,17 @@ driver_softpipe driver_llvmpipe + + + KGSL + MSM + VIRTIO + + + + kgsl + msm + virtio + + diff --git a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml index 8790d4997..bc9d64e78 100644 --- a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml +++ b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml @@ -101,4 +101,26 @@ + + + + + + + + From 2fe77843744c8a3cfeee47f967f13a4c9dfe7ff5 Mon Sep 17 00:00:00 2001 From: Vera-Firefly <1964762970@qq.com> Date: Mon, 19 Aug 2024 15:07:35 +0800 Subject: [PATCH 2/7] Fix --- .../src/main/java/net/kdt/pojavlaunch/MainActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java index 0a23fc9ad..142db8c4d 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java @@ -352,7 +352,7 @@ private void runCraft(String versionId, JMinecraftVersionList.Version version) t Tools.DRIVER_MODEL = LauncherPreferences.PREF_DRIVER_MODEL; } if(Tools.LOADER_OVERRIDE) { - Tools.LOADER_OVERRIDE = LauncherPreferences.PREF_LOCAL_LOADER_OVERRIDE + Tools.LOADER_OVERRIDE = LauncherPreferences.PREF_LOCAL_LOADER_OVERRIDE; } if(!Tools.checkRendererCompatible(this, Tools.LOCAL_RENDERER)) { Tools.RenderersList renderersList = Tools.getCompatibleRenderers(this); From 1b464f0f4679523d2aa8263a49a80ea73aa7bb85 Mon Sep 17 00:00:00 2001 From: Vera-Firefly <1964762970@qq.com> Date: Mon, 19 Aug 2024 15:13:15 +0800 Subject: [PATCH 3/7] Fix --- .../src/main/java/net/kdt/pojavlaunch/MainActivity.java | 2 +- .../src/main/java/net/kdt/pojavlaunch/Tools.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java index 142db8c4d..4fa413dbd 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MainActivity.java @@ -351,7 +351,7 @@ private void runCraft(String versionId, JMinecraftVersionList.Version version) t if(Tools.DRIVER_MODEL == null) { Tools.DRIVER_MODEL = LauncherPreferences.PREF_DRIVER_MODEL; } - if(Tools.LOADER_OVERRIDE) { + if(Tools.LOADER_OVERRIDE == null) { Tools.LOADER_OVERRIDE = LauncherPreferences.PREF_LOCAL_LOADER_OVERRIDE; } if(!Tools.checkRendererCompatible(this, Tools.LOCAL_RENDERER)) { diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java index 47104319b..912ea146c 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java @@ -1363,8 +1363,8 @@ public static CMesaLDOList getCompatibleCMesaLDO(Context context) { List CMesaLDOIds = new ArrayList<>(defaultCMesaLDO.length); List CMesaLDONames = new ArrayList<>(defaultCMesaLDONames.length); for (int i = 0; i < defaultCMesaLDO.length; i++) { - CMesaLibIds.add(defaultCMesaLib[i]); - CMesaLibNames.add(defaultCMesaLibNames[i]); + CMesaLDOIds.add(defaultCMesaLDO[i]); + CMesaLDONames.add(defaultCMesaLDONames[i]); } sCompatibleCMesaLDO = new CMesaLDOList(CMesaLDOIds, CMesaLDONames.toArray(new String[0])); From edb9ce89584cbdd08f07b3933a7cfa40640cf068 Mon Sep 17 00:00:00 2001 From: Vera-Firefly <1964762970@qq.com> Date: Mon, 19 Aug 2024 15:14:41 +0800 Subject: [PATCH 4/7] Fix --- app_pojavlauncher/src/main/res/xml/pref_experimental.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml index bc9d64e78..0cc9ea625 100644 --- a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml +++ b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml @@ -108,7 +108,7 @@ From b0f71228e0bc2bdfd6e409b70337e8c2c05c2516 Mon Sep 17 00:00:00 2001 From: Vera-Firefly <1964762970@qq.com> Date: Mon, 19 Aug 2024 15:43:03 +0800 Subject: [PATCH 5/7] Fix --- .../src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java | 4 ++-- app_pojavlauncher/src/main/jni/egl_bridge.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java index ae793776c..4b1aef18c 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java @@ -262,7 +262,6 @@ public static void setJavaEnvironment(Activity activity, String jreHome) throws envMap.put("MESA_LIBRARY", localMesaLibrary); } break; default:{ - envMap.put("LOCAL_LOADER_OVERRIDE", "zink"); envMap.put("POJAV_BETA_RENDERER", LOCAL_RENDERER); } break; } @@ -295,7 +294,8 @@ public static void setJavaEnvironment(Activity activity, String jreHome) throws envMap.put("MESA_GLSL_VERSION_OVERRIDE", glslVersion); } - if (PREF_LOADER_OVERRIDE) { + if (PREF_LOADER_OVERRIDE && DRIVER_MODEL.equals("driver_freedreno")) + { switch (LOADER_OVERRIDE) { case "kgsl": envMap.put("LOCAL_LOADER_OVERRIDE", "kgsl"); diff --git a/app_pojavlauncher/src/main/jni/egl_bridge.c b/app_pojavlauncher/src/main/jni/egl_bridge.c index e95b29fa5..1cfc7181a 100644 --- a/app_pojavlauncher/src/main/jni/egl_bridge.c +++ b/app_pojavlauncher/src/main/jni/egl_bridge.c @@ -206,7 +206,7 @@ int pojavInitOpenGL() { const char *ldrivermodel = getenv("LOCAL_DRIVER_MODEL"); const char *mldo = getenv("LOCAL_LOADER_OVERRIDE"); - if (mldo) printf("MESA_LOADER_DRIVER_OVERRIDE = %s\n", mldo); + if (mldo) printf("OSMDroid: MESA_LOADER_DRIVER_OVERRIDE = %s\n", mldo); if (!strncmp("opengles", renderer, 8)) { @@ -242,7 +242,8 @@ int pojavInitOpenGL() { if (!strcmp(ldrivermodel, "driver_freedreno")) { setenv("GALLIUM_DRIVER", "freedreno", 1); - setenv("MESA_LOADER_DRIVER_OVERRIDE", mldo, 1); + if (mldo) setenv("MESA_LOADER_DRIVER_OVERRIDE", mldo, 1); + else setenv("MESA_LOADER_DRIVER_OVERRIDE", "kgsl", 1); renderer_load_config(); } From 308fe1ce4bcf378b42592ba048e30bdaf72f72ec Mon Sep 17 00:00:00 2001 From: Vera-Firefly <1964762970@qq.com> Date: Mon, 19 Aug 2024 18:20:49 +0800 Subject: [PATCH 6/7] Do not use hard identifier --- .../src/main/res/values-zh-rCN/pgw_strings.xml | 7 ++++++- .../src/main/res/values-zh-rTW/pgw_strings.xml | 7 ++++++- app_pojavlauncher/src/main/res/values/pgw_strings.xml | 7 ++++++- app_pojavlauncher/src/main/res/xml/pref_experimental.xml | 5 +++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app_pojavlauncher/src/main/res/values-zh-rCN/pgw_strings.xml b/app_pojavlauncher/src/main/res/values-zh-rCN/pgw_strings.xml index 1227f3017..cf1125087 100644 --- a/app_pojavlauncher/src/main/res/values-zh-rCN/pgw_strings.xml +++ b/app_pojavlauncher/src/main/res/values-zh-rCN/pgw_strings.xml @@ -59,7 +59,7 @@ 渲染器 (拓展) Mesa24.2.0 (默认) Mesa版本 - 驱动模型 + Gallium驱动程序 警告 您已打开实验性设置,此功能可能会产生意想不到的bug,是否继续使用? @@ -113,5 +113,10 @@ 正在下载Mesa运行库 Mesa运行库下载失败 Mesa运行库下载成功 + + 自定义Mesa图形驱动程序 + 允许自定义Mesa图形驱动程序(目前仅Freedreno) + 如果需要,您可以自由选择处理方法 + 选择Mesa图形驱动程序 \ No newline at end of file diff --git a/app_pojavlauncher/src/main/res/values-zh-rTW/pgw_strings.xml b/app_pojavlauncher/src/main/res/values-zh-rTW/pgw_strings.xml index 3bb71a5b7..89b3559dc 100644 --- a/app_pojavlauncher/src/main/res/values-zh-rTW/pgw_strings.xml +++ b/app_pojavlauncher/src/main/res/values-zh-rTW/pgw_strings.xml @@ -59,7 +59,7 @@ 渲染器 (額外) Mesa24.2.0 (預設) Mesa 版本 - 驅動模型 + Gallium驅動程序 警告 您已開啟實驗性設置。此功能可能會產生意外的錯誤。繼續使用? @@ -113,5 +113,10 @@ 正在下載 Mesa Lib Mesa Lib 下載失敗 Mesa Lib 下載成功 + + 自訂Mesa圖形驅動程序 + 允許自訂Mesa圖形驅動程序(目前僅Freedreno) + 如果需要,您可以自由選擇處理方法 + 選擇Mesa圖形驅動程序 \ No newline at end of file diff --git a/app_pojavlauncher/src/main/res/values/pgw_strings.xml b/app_pojavlauncher/src/main/res/values/pgw_strings.xml index 31fed15f3..0173d9a00 100644 --- a/app_pojavlauncher/src/main/res/values/pgw_strings.xml +++ b/app_pojavlauncher/src/main/res/values/pgw_strings.xml @@ -59,7 +59,7 @@ Renderer (Extra) Mesa24.2.0 (Default) Mesa Version - Driver Modle + Gallium Driver Override Warning You have turned on experimental settings.This feature may generate unexpected bugs.Continue to use? @@ -113,5 +113,10 @@ Downloading Mesa Lib Mesa Lib download fail Mesa Lib download success + + Custom Mesa Loader Driver Override + Enable Custom Mesa Load Driver Override(Only for Freedreno) + If need, you can freely choose processing method + Choose Mesa Loader Driver Override \ No newline at end of file diff --git a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml index 0cc9ea625..837ae2510 100644 --- a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml +++ b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml @@ -103,12 +103,13 @@ From feb4533a0ac3dff175f5065ec5c81dbe660495cc Mon Sep 17 00:00:00 2001 From: Vera-Firefly <1964762970@qq.com> Date: Mon, 19 Aug 2024 18:24:00 +0800 Subject: [PATCH 7/7] Do not use hard identifier --- app_pojavlauncher/src/main/res/xml/pref_experimental.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml index 837ae2510..f03aced94 100644 --- a/app_pojavlauncher/src/main/res/xml/pref_experimental.xml +++ b/app_pojavlauncher/src/main/res/xml/pref_experimental.xml @@ -109,7 +109,7 @@ @@ -118,7 +118,7 @@ android:key="ChooseMldo" android:entries="@array/osmesa_mldo" android:entryValues="@array/osmesa_mldo_values" - android:title="Choose Mesa Loader Driver Override" + android:title="@string/osm_choose_cmldo" app2:useSimpleSummaryProvider="true" app2:iconSpaceReserved="false"/>