mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
[Mod installer] Fix errors on some devices
This commit is contained in:
parent
27c0f009a1
commit
73c8385bba
@ -80,8 +80,8 @@ public class AWTCanvasView extends TextureView implements TextureView.SurfaceTex
|
|||||||
Canvas canvas;
|
Canvas canvas;
|
||||||
mSurface = new Surface(getSurfaceTexture());
|
mSurface = new Surface(getSurfaceTexture());
|
||||||
|
|
||||||
while (!mIsDestroyed) {
|
try {
|
||||||
try {
|
while (!mIsDestroyed && mSurface.isAvailable()) {
|
||||||
canvas = mSurface.lockCanvas(null);
|
canvas = mSurface.lockCanvas(null);
|
||||||
canvas.drawRGB(0, 0, 0);
|
canvas.drawRGB(0, 0, 0);
|
||||||
|
|
||||||
@ -92,16 +92,15 @@ public class AWTCanvasView extends TextureView implements TextureView.SurfaceTex
|
|||||||
if (rgbArray == null) {
|
if (rgbArray == null) {
|
||||||
drawing = false;
|
drawing = false;
|
||||||
} else {
|
} else {
|
||||||
// canvas.drawText("FPS", 50, 50, fpsPaint);
|
canvas.drawBitmap(rgbArray, 0, CallbackBridge.windowWidth, 0, 0, CallbackBridge.windowWidth, callbackBridge.windowHeight, true, null);
|
||||||
canvas.drawBitmap(rgbArray, 0, mWidth, 0, 0, mWidth, mHeight, true, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
canvas.drawText("FPS: " + (Math.round(fps() * 10) / 10) + ", attached=" + attached + ", drawing=" + drawing, 50, 50, fpsPaint);
|
canvas.drawText("FPS: " + (Math.round(fps() * 10) / 10) + ", attached=" + attached + ", drawing=" + drawing, 50, 50, fpsPaint);
|
||||||
|
|
||||||
mSurface.unlockCanvasAndPost(canvas);
|
mSurface.unlockCanvasAndPost(canvas);
|
||||||
} catch (Throwable th) {
|
|
||||||
th.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
} catch (Throwable th) {
|
||||||
|
Tools.showError(getContext(), th);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import android.text.*;
|
|||||||
public class InstallModActivity extends LoggableActivity {
|
public class InstallModActivity extends LoggableActivity {
|
||||||
public static volatile boolean IS_JRE_RUNNING;
|
public static volatile boolean IS_JRE_RUNNING;
|
||||||
|
|
||||||
private AWTCanvasView mTextureView;
|
private AWTCanvasView mTextureView;
|
||||||
private LinearLayout contentLog;
|
private LinearLayout contentLog;
|
||||||
private TextView textLog;
|
private TextView textLog;
|
||||||
private ScrollView contentScroll;
|
private ScrollView contentScroll;
|
||||||
@ -27,13 +27,13 @@ public class InstallModActivity extends LoggableActivity {
|
|||||||
|
|
||||||
private boolean isLogAllow;
|
private boolean isLogAllow;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.install_mod);
|
setContentView(R.layout.install_mod);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Tools.setFullscreen(this);
|
Tools.setFullscreen(this);
|
||||||
|
|
||||||
logFile = new File(Tools.MAIN_PATH, "latestlog.txt");
|
logFile = new File(Tools.MAIN_PATH, "latestlog.txt");
|
||||||
logFile.delete();
|
logFile.delete();
|
||||||
@ -53,7 +53,7 @@ public class InstallModActivity extends LoggableActivity {
|
|||||||
isLogAllow = isChecked;
|
isLogAllow = isChecked;
|
||||||
appendToLog("");
|
appendToLog("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
JREUtils.redirectAndPrintJRELog(this, null);
|
JREUtils.redirectAndPrintJRELog(this, null);
|
||||||
|
|
||||||
final File modFile = (File) getIntent().getExtras().getSerializable("modFile");
|
final File modFile = (File) getIntent().getExtras().getSerializable("modFile");
|
||||||
@ -71,11 +71,11 @@ public class InstallModActivity extends LoggableActivity {
|
|||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
Tools.showError(this, th, true);
|
Tools.showError(this, th, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceClose(View v) {
|
public void forceClose(View v) {
|
||||||
MainActivity.dialogForceClose(this);
|
MainActivity.dialogForceClose(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openLogOutput(View v) {
|
public void openLogOutput(View v) {
|
||||||
contentLog.setVisibility(View.VISIBLE);
|
contentLog.setVisibility(View.VISIBLE);
|
||||||
@ -84,44 +84,44 @@ public class InstallModActivity extends LoggableActivity {
|
|||||||
public void closeLogOutput(View view) {
|
public void closeLogOutput(View view) {
|
||||||
contentLog.setVisibility(View.GONE);
|
contentLog.setVisibility(View.GONE);
|
||||||
// mIsResuming = true;
|
// mIsResuming = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchJavaRuntime(File modFile, String javaArgs) {
|
private void launchJavaRuntime(File modFile, String javaArgs) {
|
||||||
try {
|
try {
|
||||||
List<String> javaArgList = new ArrayList<String>();
|
List<String> javaArgList = new ArrayList<String>();
|
||||||
|
|
||||||
File cacioAwtLibPath = new File(Tools.MAIN_PATH, "cacioawtlib");
|
File cacioAwtLibPath = new File(Tools.MAIN_PATH, "cacioawtlib");
|
||||||
if (cacioAwtLibPath.exists()) {
|
if (cacioAwtLibPath.exists()) {
|
||||||
StringBuilder libStr = new StringBuilder();
|
StringBuilder libStr = new StringBuilder();
|
||||||
for (File file: cacioAwtLibPath.listFiles()) {
|
for (File file: cacioAwtLibPath.listFiles()) {
|
||||||
if (file.getName().endsWith(".jar")) {
|
if (file.getName().endsWith(".jar")) {
|
||||||
libStr.append(":" + file.getAbsolutePath());
|
libStr.append(":" + file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
javaArgList.add("-Xbootclasspath/a" + libStr.toString());
|
javaArgList.add("-Xbootclasspath/a" + libStr.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
javaArgList.add("-Dcacio.managed.screensize=" + CallbackBridge.windowWidth + "x" + CallbackBridge.windowHeight);
|
javaArgList.add("-Dcacio.managed.screensize=" + CallbackBridge.windowWidth + "x" + CallbackBridge.windowHeight);
|
||||||
|
|
||||||
File cacioArgOverrideFile = new File(cacioAwtLibPath, "overrideargs.txt");
|
File cacioArgOverrideFile = new File(cacioAwtLibPath, "overrideargs.txt");
|
||||||
if (cacioArgOverrideFile.exists()) {
|
if (cacioArgOverrideFile.exists()) {
|
||||||
javaArgList.addAll(Arrays.asList(Tools.read(cacioArgOverrideFile.getAbsolutePath()).split(" ")));
|
javaArgList.addAll(Arrays.asList(Tools.read(cacioArgOverrideFile.getAbsolutePath()).split(" ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (javaArgs != null) {
|
if (javaArgs != null) {
|
||||||
javaArgList.addAll(Arrays.asList(javaArgs.split(" ")));
|
javaArgList.addAll(Arrays.asList(javaArgs.split(" ")));
|
||||||
} else {
|
} else {
|
||||||
javaArgList.add("-jar");
|
javaArgList.add("-jar");
|
||||||
javaArgList.add(modFile.getAbsolutePath());
|
javaArgList.add(modFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
// System.out.println(Arrays.toString(javaArgList.toArray(new String[0])));
|
// System.out.println(Arrays.toString(javaArgList.toArray(new String[0])));
|
||||||
|
|
||||||
Tools.launchJavaVM(this, javaArgList);
|
Tools.launchJavaVM(this, javaArgList);
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
Tools.showError(this, th, true);
|
Tools.showError(this, th, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user