mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-09-17 08:49:39 -04:00
def wrong
This commit is contained in:
1 parent
70ecf2c0df
commit
b5d73e91bf
5 files changed
+28
-8
No files matched your search
@@ -544,7 +544,7 @@ public class JREUtils {
|
||||
renderLibrary = "libng_gl4es.so"; break;
|
||||
case "vulkan_zink": renderLibrary = "libOSMesa.so"; break;
|
||||
case "opengles_mobileglues": renderLibrary = "libmobileglues.so"; break;
|
||||
case "opengles3_desktopgl_zink_kopper": renderLibrary = "libglxshim.so"; break;
|
||||
case "opengles3_desktopgl_zink_kopper": renderLibrary = "libEGL_mesa.so"; break;
|
||||
case "opengles3_ltw" : renderLibrary = "libltw.so"; break;
|
||||
case "opengles_system_gles" : return null; // Literally nothing, this is for system GLES.
|
||||
default:
|
||||
|
||||
@@ -35,11 +35,11 @@ __eglMustCastToProperFunctionPointerType (*eglGetProcAddress_p) (const char *pro
|
||||
bool dlsym_EGL() {
|
||||
char* gles = getenv("LIBGL_GLES");
|
||||
char* eglName = (strncmp(gles ? gles : "", "libGLESv2_angle.so", 18) == 0) ? "libEGL_angle.so" : getenv("POJAVEXEC_EGL");
|
||||
// Kopper needs this
|
||||
if (eglName != NULL && strncmp(eglName, "libEGL_mesa.so", 14) == 0) {
|
||||
void* cutils_handle = loader_dlopen("libcutils.so", "libcutils.so", RTLD_GLOBAL|RTLD_NOW);
|
||||
if(cutils_handle == NULL) return false;
|
||||
}
|
||||
// // Kopper needs this
|
||||
// if (eglName != NULL && strncmp(eglName, "libEGL_mesa.so", 14) == 0) {
|
||||
// void* cutils_handle = loader_dlopen("libcutils.so", "libcutils.so", RTLD_GLOBAL|RTLD_NOW);
|
||||
// if(cutils_handle == NULL) return false;
|
||||
// }
|
||||
void* dl_handle = loader_dlopen(eglName,"libEGL.so", RTLD_LOCAL|RTLD_LAZY);
|
||||
if(dl_handle == NULL) return false;
|
||||
eglGetProcAddress_p = dlsym(dl_handle, "eglGetProcAddress");
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#define ELF_HALF Elf64_Half
|
||||
#define ELF_XWORD Elf64_Xword
|
||||
#define ELF_DYN Elf64_Dyn
|
||||
#define ELF_SYM Elf64_Sym
|
||||
|
||||
//#define ADRENO_POSSIBLE
|
||||
|
||||
@@ -74,6 +75,9 @@ bool linker_ns_load(const char* lib_search_path) {
|
||||
#ifndef ADRENO_POSSIBLE
|
||||
return false;
|
||||
#else
|
||||
// Makes bytehook stop being all crashy about hooky
|
||||
if(driver_namespace != NULL) return true;
|
||||
|
||||
loader_dlopen_t loader_dlopen = find_branch_label(&dlopen);
|
||||
// reprotecting the functions removes protection from indirect jumps
|
||||
mprotect(loader_dlopen, page_size, PROT_WRITE | PROT_READ | PROT_EXEC);
|
||||
@@ -127,6 +131,14 @@ void* linker_ns_dlopen(const char* name, int flag) {
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Overwrites the first three characters of a soname
|
||||
* @note IMPORTANT: The supplied soname patch will overwrite the first strlen(sonamePatch) chars of the soname
|
||||
* @param elfPath Full path to the elf to patch
|
||||
* @param targetFd FD to use for storing the patched library
|
||||
* @return True on success
|
||||
*/
|
||||
bool patch_elf_soname(int patchfd, int realfd, uint16_t patchid) {
|
||||
struct stat realstat;
|
||||
if(fstat(realfd, &realstat)) return false;
|
||||
@@ -139,20 +151,22 @@ bool patch_elf_soname(int patchfd, int realfd, uint16_t patchid) {
|
||||
}
|
||||
close(realfd);
|
||||
|
||||
|
||||
ELF_EHDR *ehdr = (ELF_EHDR*)target;
|
||||
ELF_SHDR *shdr = (ELF_SHDR*)(target + ehdr->e_shoff);
|
||||
// Iterate over section headers to find the .dynamic section
|
||||
for(ELF_HALF i = 0; i < ehdr->e_shnum; i++) {
|
||||
ELF_SHDR *hdr = &shdr[i];
|
||||
if(hdr->sh_type == SHT_DYNAMIC) {
|
||||
char* strtab = target + shdr[hdr->sh_link].sh_offset;
|
||||
// If there's a warning below, it's bogus, ignore it
|
||||
ELF_DYN *dynEntries = (ELF_DYN*)(target + hdr->sh_offset);
|
||||
|
||||
// Iterate over .dynamic entries to find DT_SONAME
|
||||
for(ELF_XWORD k = 0; k < (hdr->sh_size / hdr->sh_entsize);k++) {
|
||||
ELF_DYN* dynEntry = &dynEntries[k];
|
||||
if(dynEntry->d_tag == DT_SONAME) {
|
||||
char* soname = strtab + dynEntry->d_un.d_val;
|
||||
char sprb[4];
|
||||
// Partially replace the old soname with the soname patch
|
||||
snprintf(sprb, 4, "%03x", patchid);
|
||||
memcpy(soname, sprb, 3);
|
||||
munmap(target, realstat.st_size);
|
||||
|
||||
@@ -169,6 +169,9 @@ int pojavInitOpenGL() {
|
||||
load_vulkan();
|
||||
setenv("GALLIUM_DRIVER", "zink", 1);
|
||||
setenv("MESA_ANDROID_NO_KMS_SWRAST", "1", 1);
|
||||
} else if (!strcmp(renderer, "opengles3_desktopgl_freedreno")) {
|
||||
setenv("GALLIUM_DRIVER", "freedreno", 1);
|
||||
setenv("MESA_LOADER_DRIVER_OVERRIDE", "kgsl", 1);
|
||||
}
|
||||
set_gl_bridge_tbl();
|
||||
} else if (strcmp(renderer, "vulkan_zink") == 0) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<item name="2">@string/mcl_setting_renderer_vulkan_kopper_zink</item>
|
||||
<item name="3">@string/mcl_setting_renderer_vulkan_zink</item>
|
||||
<item name="4">@string/mcl_setting_renderer_ltw</item>
|
||||
<item name="5">@string/mcl_setting_renderer_freedreno</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="menu_customcontrol">
|
||||
@@ -39,6 +40,7 @@
|
||||
<string-array name="renderer_values">
|
||||
<item>opengles2</item> <!-- BZLZHH/NG-GL4ES (Krypton Wrapper) -->
|
||||
<item>opengles_mobileglues</item>
|
||||
<item>opengles3_desktopgl_freedreno</item>
|
||||
<item>opengles3_desktopgl_zink_kopper</item> <!-- Swung's Kopper Zink backport to 23.0.4 -->
|
||||
<item>vulkan_zink</item> <!-- osmesa 23.0.4 -->
|
||||
<item>opengles3_ltw</item>
|
||||
@@ -106,4 +108,5 @@
|
||||
<item>2</item>
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
<string name="mcl_setting_renderer_freedreno">Freedreno (Adreno only, OpenGL 4.6) - (all versions, mid)</string>
|
||||
</resources>
|
||||
Reference in new issue
Block a user