mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 23:59:21 -04:00
More stub. Show error if could not allocate RAM
This commit is contained in:
parent
f97a74b9f5
commit
d9a13183b2
@ -133,6 +133,26 @@ public class MCLauncherActivity extends AppCompatActivity
|
||||
finish();
|
||||
}
|
||||
|
||||
File logFile = new File(Tools.MAIN_PATH, "latestlog.txt");
|
||||
if (logFile.exists() && logFile.length() < 2048) {
|
||||
String errMsg = "Error occurred during initialization of ";
|
||||
try {
|
||||
String logContent = Tools.read(logFile.getAbsolutePath());
|
||||
if (logContent.contains(errMsg + "VM") &&
|
||||
logContent.contains("Could not reserve enough space for")) {
|
||||
OutOfMemoryError ex = new OutOfMemoryError("Java error: " + logContent);
|
||||
ex.setStackTrace(null);
|
||||
Tools.showError(MCLauncherActivity.this, ex);
|
||||
|
||||
// Do it so dialog will not shown for second time
|
||||
Tools.write(logFile.getAbsolutePath(), logContent.replace(errMsg + "VM", errMsg + " JVM"));
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
System.err.println("Could not detect java crash");
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//showProfileInfo();
|
||||
|
||||
List<String> versions = new ArrayList<String>();
|
||||
|
@ -17,7 +17,9 @@ include $(BUILD_SHARED_LIBRARY)
|
||||
LOCAL_PATH := $(LOCAL_PATH)/awt_xawt
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := awt_xawt
|
||||
LOCAL_CFLAGS += -DHEADLESS
|
||||
LOCAL_SRC_FILES := xawt_fake.c
|
||||
# LOCAL_CFLAGS += -DHEADLESS
|
||||
LOCAL_SRC_FILES := \
|
||||
xawt_fake.c \
|
||||
awt_GraphicsEnv.c
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
136
app/src/main/jni/awt_xawt/awt_GraphicsEnv.c
Normal file
136
app/src/main/jni/awt_xawt/awt_GraphicsEnv.c
Normal file
@ -0,0 +1,136 @@
|
||||
#include <jni.h>
|
||||
|
||||
struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
|
||||
struct X11GraphicsDeviceIDs x11GraphicsDeviceIDs;
|
||||
|
||||
struct char* display = ":0";
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11GraphicsConfig_initIDs (JNIEnv *env, jclass cls) {
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11GraphicsDevice_initIDs (JNIEnv *env, jclass cls) {
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11GraphicsEnvironment_initGLX(JNIEnv *env, jclass cls) {
|
||||
// Return true if want try enable it
|
||||
return false;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_sun_awt_X11GraphicsEnvironment_initXRender(JNIEnv *env, jclass cls, jboolean verbose) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_sun_awt_X11GraphicsEnvironment_getDisplayString(JNIEnv *env, jclass cls) {
|
||||
return (*env)->NewStringUTF(env, display);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11GraphicsEnvironment_getNumScreens(JNIEnv *env, jobject this) {
|
||||
return (jint) 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if Shared Memory extension can be used.
|
||||
* Returns:
|
||||
* -1 if server doesn't support MITShm
|
||||
* 1 if server supports it and it can be used
|
||||
* 0 otherwise
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11GraphicsEnvironment_checkShmExt(JNIEnv *env, jclass cls, jboolean verbose) {
|
||||
// This could be return 0 once MITShm implementation added
|
||||
return (jint) -1;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_sun_awt_X11GraphicsDevice_getDisplay(JNIEnv *env, jobject this) {
|
||||
return (jlong) &display;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11GraphicsDevice_getNumConfigs(JNIEnv *env, jobject this, jint screen) {
|
||||
return (jint) 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11GraphicsDevice_getConfigVisualId(JNIEnv *env, jobject this, jint index, jint screen) {
|
||||
// Should be zero?
|
||||
return (jint)0;
|
||||
/*
|
||||
int visNum;
|
||||
|
||||
ensureConfigsInited(env, screen);
|
||||
if (index == 0) {
|
||||
return ((jint)x11Screens[screen].defaultConfig->awt_visInfo.visualid);
|
||||
} else {
|
||||
return ((jint)x11Screens[screen].configs[index]->awt_visInfo.visualid);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11GraphicsDevice_getConfigDepth(JNIEnv *env, jobject this, jint index, jint screen) {
|
||||
return (jint) 24;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11GraphicsDevice_getConfigColormap(JNIEnv *env, jobject this, jint index, jint screen) {
|
||||
// Should be zero?
|
||||
return (jint) 0;
|
||||
/*
|
||||
int visNum;
|
||||
|
||||
ensureConfigsInited(env, screen);
|
||||
if (index == 0) {
|
||||
return ((jint)x11Screens[screen].defaultConfig->awt_cmap);
|
||||
} else {
|
||||
return ((jint)x11Screens[screen].configs[index]->awt_cmap);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11GraphicsDevice_resetNativeData(JNIEnv *env, jclass x11gd, jint screen) {
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11GraphicsConfig_dispose(JNIEnv *env, jclass x11gc, jlong configData) {
|
||||
/*
|
||||
* The native GLXGraphicsConfig data needs to be disposed separately
|
||||
* on the OGL queue flushing thread (should not be called while
|
||||
* the AWT lock is held).
|
||||
*/
|
||||
/*
|
||||
JNU_CallStaticMethodByName(env, NULL,
|
||||
"sun/java2d/opengl/OGLRenderQueue",
|
||||
"disposeGraphicsConfig", "(J)V",
|
||||
ptr_to_jlong(aData->glxInfo));
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL Java_sun_awt_X11GraphicsConfig_getXResolution(JNIEnv *env, jobject this, jint screen) {
|
||||
/* FIXME implement this, maybe
|
||||
* AndroidDpWidth * 25.4 / AndroidPxWidth
|
||||
*/
|
||||
|
||||
return (jdouble) 1d;
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL Java_sun_awt_X11GraphicsConfig_getYResolution(JNIEnv *env, jobject this, jint screen) {
|
||||
/* FIXME implement this, maybe
|
||||
* AndroidDpHeight * 25.4 / AndroidPxHeight
|
||||
*/
|
||||
|
||||
return (jdouble) 1d;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_sun_awt_X11GraphicsConfig_getNumColors(JNIEnv *env, jobject this) {
|
||||
// FIXME stub num colors
|
||||
return (jint) 256;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_sun_awt_X11GraphicsConfig_init(JNIEnv *env, jobject this, jint visualNum, jint screen) {
|
||||
/*
|
||||
(*env)->SetIntField(env, this, x11GraphicsConfigIDs.bitsPerPixel,
|
||||
(jint)tempImage->bits_per_pixel);
|
||||
*/
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_sun_awt_X11GraphicsConfig_makeColorModel(JNIEnv *env, jobject this) {
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user