mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 08:05:34 -04:00
Upstreamify profiles (#2472)
* Extended MCOptionUtils to support list values * Mitigation for the Apache Log4j RCE in 1.8.x-1.18 Related issue: #2378 * Update JREUtils.java * Completely fix Log4J RCE (1.7-1.16.5) (not yet tested) #2378 * fix moment * Fix a NullPointerException when launching ≤ 1.6.4 * Updated virgl vtest (arm64 only) Experimental changes: - HACK: explicitly set location for fsout_c0/1. this might not work, not tested - Fix empty screen on OF + shader: caused by target fb/texture changed * Trigger a texture creation, which then set VIRGL_TEXTURE_ID * Replace sprintf with asprintf for auto allocation * Update egl_bridge.c * Updated vtest lib: fixes flipped screen * CI: Update gl4es * Updated vtest arm64: fixes black screen on <1.13(?) Co-authored-by: SerpentSpirale <mathiasboulay@free.fr> Co-authored-by: Duy Tran Khanh <40482367+khanhduytran0@users.noreply.github.com> Co-authored-by: khanhduytran0 <khanhduytran0@users.noreply.github.com> Co-authored-by: github-actions <github-actions@users.noreply.github.com>
This commit is contained in:
parent
9fc4d5dc82
commit
85889338c1
@ -1,10 +1,8 @@
|
|||||||
package net.kdt.pojavlaunch;
|
package net.kdt.pojavlaunch;
|
||||||
|
|
||||||
import androidx.annotation.Keep;
|
import androidx.annotation.Keep;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import net.kdt.pojavlaunch.value.*;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import net.kdt.pojavlaunch.value.*;
|
||||||
|
|
||||||
@Keep
|
@Keep
|
||||||
public class JMinecraftVersionList {
|
public class JMinecraftVersionList {
|
||||||
@ -16,18 +14,23 @@ public class JMinecraftVersionList {
|
|||||||
public Version[] versions;
|
public Version[] versions;
|
||||||
|
|
||||||
@Keep
|
@Keep
|
||||||
public static class Version {
|
public static class FileProperties {
|
||||||
|
public String id, sha1, url;
|
||||||
|
public long size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public static class Version extends FileProperties {
|
||||||
// Since 1.13, so it's one of ways to check
|
// Since 1.13, so it's one of ways to check
|
||||||
public Arguments arguments;
|
public Arguments arguments;
|
||||||
|
|
||||||
public AssetIndex assetIndex;
|
public AssetIndex assetIndex;
|
||||||
|
|
||||||
public String assets;
|
public String assets;
|
||||||
public Map<String, MinecraftClientInfo> downloads;
|
public Map<String, MinecraftClientInfo> downloads;
|
||||||
public String id;
|
|
||||||
public String inheritsFrom;
|
public String inheritsFrom;
|
||||||
public JavaVersionInfo javaVersion;
|
public JavaVersionInfo javaVersion;
|
||||||
public DependentLibrary[] libraries;
|
public DependentLibrary[] libraries;
|
||||||
|
public LoggingConfig logging;
|
||||||
public String mainClass;
|
public String mainClass;
|
||||||
public String minecraftArguments;
|
public String minecraftArguments;
|
||||||
public int minimumLauncherVersion;
|
public int minimumLauncherVersion;
|
||||||
@ -35,15 +38,23 @@ public class JMinecraftVersionList {
|
|||||||
public String releaseTime;
|
public String releaseTime;
|
||||||
public String time;
|
public String time;
|
||||||
public String type;
|
public String type;
|
||||||
public String url;
|
|
||||||
public String sha1;
|
|
||||||
}
|
}
|
||||||
@Keep
|
@Keep
|
||||||
public static class JavaVersionInfo {
|
public static class JavaVersionInfo {
|
||||||
public String component;
|
public String component;
|
||||||
public int majorVersion;
|
public int majorVersion;
|
||||||
}
|
}
|
||||||
|
@Keep
|
||||||
|
public static class LoggingConfig {
|
||||||
|
public LoggingClientConfig client;
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public static class LoggingClientConfig {
|
||||||
|
public String argument;
|
||||||
|
public FileProperties file;
|
||||||
|
public String type;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Since 1.13
|
// Since 1.13
|
||||||
@Keep
|
@Keep
|
||||||
public static class Arguments {
|
public static class Arguments {
|
||||||
@ -66,9 +77,8 @@ public class JMinecraftVersionList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Keep
|
@Keep
|
||||||
public static class AssetIndex {
|
public static class AssetIndex extends FileProperties {
|
||||||
public String id, sha1, url;
|
public long totalSize;
|
||||||
public long size, totalSize;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +151,9 @@ public final class Tools {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (versionInfo.logging != null) {
|
||||||
|
javaArgList.add("-Dlog4j.configurationFile=" + Tools.DIR_GAME_NEW + "/" + versionInfo.logging.client.file.id);
|
||||||
|
}
|
||||||
javaArgList.add("-cp");
|
javaArgList.add("-cp");
|
||||||
javaArgList.add(getLWJGL3ClassPath() + ":" + launchClassPath);
|
javaArgList.add(getLWJGL3ClassPath() + ":" + launchClassPath);
|
||||||
|
|
||||||
|
@ -130,6 +130,36 @@ public class MinecraftDownloaderTask extends AsyncTask<String, String, Throwable
|
|||||||
|
|
||||||
File outLib;
|
File outLib;
|
||||||
|
|
||||||
|
// Patch the Log4J RCE (CVE-2021-44228)
|
||||||
|
if (verInfo.logging != null) {
|
||||||
|
outLib = new File(Tools.DIR_GAME_NEW, verInfo.logging.client.file.id);
|
||||||
|
if (outLib.exists()) {
|
||||||
|
if(LauncherPreferences.PREF_CHECK_LIBRARY_SHA) {
|
||||||
|
if(!Tools.compareSHA1(outLib,verInfo.logging.client.file.sha1)) {
|
||||||
|
outLib.delete();
|
||||||
|
publishProgress("0", mActivity.getString(R.string.dl_library_sha_fail,verInfo.logging.client.file.id));
|
||||||
|
}else{
|
||||||
|
publishProgress("0", mActivity.getString(R.string.dl_library_sha_pass,verInfo.logging.client.file.id));
|
||||||
|
}
|
||||||
|
} else if (outLib.length() != verInfo.logging.client.file.size) {
|
||||||
|
// force updating anyways
|
||||||
|
outLib.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!outLib.exists()) {
|
||||||
|
publishProgress("0", mActivity.getString(R.string.mcl_launch_downloading, verInfo.logging.client.file.id));
|
||||||
|
Tools.downloadFileMonitored(
|
||||||
|
verInfo.logging.client.file.url,
|
||||||
|
outLib.getAbsolutePath(),
|
||||||
|
new Tools.DownloaderFeedback() {
|
||||||
|
@Override
|
||||||
|
public void updateProgress(int curr, int max) {
|
||||||
|
publishDownloadProgress(verInfo.logging.client.file.id, curr, max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setMax(verInfo.libraries.length);
|
setMax(verInfo.libraries.length);
|
||||||
zeroProgress();
|
zeroProgress();
|
||||||
|
@ -604,6 +604,7 @@ GLubyte* (*glGetString_p) (GLenum name);
|
|||||||
void (*glFinish_p) (void);
|
void (*glFinish_p) (void);
|
||||||
void (*glClearColor_p) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
void (*glClearColor_p) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||||
void (*glClear_p) (GLbitfield mask);
|
void (*glClear_p) (GLbitfield mask);
|
||||||
|
void (*glReadPixels_p) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * data);
|
||||||
|
|
||||||
/*EGL functions */
|
/*EGL functions */
|
||||||
EGLBoolean (*eglMakeCurrent_p) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
EGLBoolean (*eglMakeCurrent_p) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||||
@ -667,16 +668,16 @@ void pojavTerminate() {
|
|||||||
|
|
||||||
JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_utils_JREUtils_setupBridgeWindow(JNIEnv* env, jclass clazz, jobject surface) {
|
JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_utils_JREUtils_setupBridgeWindow(JNIEnv* env, jclass clazz, jobject surface) {
|
||||||
potatoBridge.androidWindow = ANativeWindow_fromSurface(env, surface);
|
potatoBridge.androidWindow = ANativeWindow_fromSurface(env, surface);
|
||||||
char *ptrStr = malloc(sizeof(long));
|
char *ptrStr;
|
||||||
sprintf(ptrStr, "%ld", (long) potatoBridge.androidWindow);
|
asprintf(&ptrStr, "%ld", (long) potatoBridge.androidWindow);
|
||||||
setenv("POJAV_WINDOW_PTR", ptrStr, 1);
|
setenv("POJAV_WINDOW_PTR", ptrStr, 1);
|
||||||
|
free(ptrStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* pojavGetCurrentContext() {
|
void* pojavGetCurrentContext() {
|
||||||
switch (config_renderer) {
|
switch (config_renderer) {
|
||||||
case RENDERER_GL4ES:
|
case RENDERER_GL4ES:
|
||||||
return (void *)eglGetCurrentContext_p();
|
return (void *)eglGetCurrentContext_p();
|
||||||
|
|
||||||
case RENDERER_VIRGL:
|
case RENDERER_VIRGL:
|
||||||
case RENDERER_VK_ZINK:
|
case RENDERER_VK_ZINK:
|
||||||
return (void *)OSMesaGetCurrentContext_p();
|
return (void *)OSMesaGetCurrentContext_p();
|
||||||
@ -716,6 +717,7 @@ void dlsym_OSMesa(void* dl_handle) {
|
|||||||
glClearColor_p = dlsym(dl_handle, "glClearColor");
|
glClearColor_p = dlsym(dl_handle, "glClearColor");
|
||||||
glClear_p = dlsym(dl_handle,"glClear");
|
glClear_p = dlsym(dl_handle,"glClear");
|
||||||
glFinish_p = dlsym(dl_handle,"glFinish");
|
glFinish_p = dlsym(dl_handle,"glFinish");
|
||||||
|
glReadPixels_p = dlsym(dl_handle,"glReadPixels");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loadSymbols() {
|
bool loadSymbols() {
|
||||||
@ -1040,6 +1042,11 @@ void pojavMakeCurrent(void* window) {
|
|||||||
printf("OSMDroid: renderer: %s\n",glGetString_p(GL_RENDERER));
|
printf("OSMDroid: renderer: %s\n",glGetString_p(GL_RENDERER));
|
||||||
glClear_p(GL_COLOR_BUFFER_BIT);
|
glClear_p(GL_COLOR_BUFFER_BIT);
|
||||||
glClearColor_p(0.4f, 0.4f, 0.4f, 1.0f);
|
glClearColor_p(0.4f, 0.4f, 0.4f, 1.0f);
|
||||||
|
|
||||||
|
// Trigger a texture creation, which then set VIRGL_TEXTURE_ID
|
||||||
|
int pixelsArr[4];
|
||||||
|
glReadPixels_p(0, 0, 1, 1, GL_RGB, GL_INT, &pixelsArr);
|
||||||
|
|
||||||
pojavSwapBuffers();
|
pojavSwapBuffers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user