mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-04-20 17:47:03 -04:00
[Forge size fix] Set overrideWidth and overrideHeight auto
This commit is contained in:
@@ -137,6 +137,10 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
CallbackBridge.windowHeight = displayMetrics.heightPixels / scaleFactor;
|
||||
System.out.println("WidthHeight: " + CallbackBridge.windowWidth + ":" + CallbackBridge.windowHeight);
|
||||
|
||||
MCOptionUtils.INSTANCE.set("overrideWidth", Integer.toString(CallbackBridge.windowWidth));
|
||||
MCOptionUtils.INSTANCE.set("overrideHeight", Integer.toString(CallbackBridge.windowHeight));
|
||||
MCOptionUtils.INSTANCE.save();
|
||||
|
||||
gestureDetector = new GestureDetector(this, new SingleTapConfirm());
|
||||
|
||||
// Menu
|
||||
@@ -726,7 +730,6 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
minecraftGLView.setOnGenericMotionListener(gmlistener);
|
||||
touchPad.setOnGenericMotionListener(gmlistener);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
Tools.showError(this, e, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MCProfile
|
||||
try {
|
||||
byte[] bFull = toString(builder).getBytes("UTF-8");
|
||||
Tools.write(Tools.mpProfiles + "/" + builder.getUsername(), bFull);
|
||||
} catch (Exception e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@@ -115,8 +115,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
||||
Tools.write(logFile.getAbsolutePath(), logContent.replace(errMsg + "VM", errMsg + "JVM"));
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
System.err.println("Could not detect java crash");
|
||||
th.printStackTrace();
|
||||
Log.w(Tools.APP_NAME, "Could not detect java crash", th);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ public class PojavLoginActivity extends BaseActivity
|
||||
forgeSplashContent.replace("enabled=true", "enabled=false"));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.w(Tools.APP_NAME, "Could not disable Forge splash screen!");
|
||||
Log.w(Tools.APP_NAME, "Could not disable Forge splash screen!", e);
|
||||
}
|
||||
|
||||
mkdirs(Tools.CTRLMAP_PATH);
|
||||
|
||||
@@ -212,12 +212,6 @@ public final class Tools
|
||||
}
|
||||
}
|
||||
|
||||
// Window size fix
|
||||
minecraftArgs.add("--width");
|
||||
minecraftArgs.add(Integer.toString(CallbackBridge.windowWidth));
|
||||
minecraftArgs.add("--height");
|
||||
minecraftArgs.add(Integer.toString(CallbackBridge.windowHeight));
|
||||
|
||||
String[] argsFromJson = JSONUtils.insertJSONValueList(
|
||||
splitAndFilterEmpty(
|
||||
versionInfo.minecraftArguments == null ?
|
||||
@@ -621,8 +615,7 @@ public final class Tools
|
||||
fieldB.set(targetVer, value);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
System.err.println("Unable to insert " + key + "=" + value);
|
||||
th.printStackTrace();
|
||||
Log.w(Tools.APP_NAME, "Unable to insert " + key + "=" + value, th);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,9 +139,7 @@ public class JREUtils
|
||||
return;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
Log.e("jrelog-logcat", "Exception on logging thread");
|
||||
e.printStackTrace();
|
||||
|
||||
Log.e("jrelog-logcat", "Exception on logging thread", e);
|
||||
act.appendlnToLog("Exception on logging thread:\n" + Log.getStackTraceString(e));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package net.kdt.pojavlaunch.utils;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import android.util.*;
|
||||
import net.kdt.pojavlaunch.*;
|
||||
|
||||
public class MCOptionUtils
|
||||
{
|
||||
public static final MCOptionUtils INSTANCE = new MCOptionUtils();
|
||||
|
||||
private List<String> mLineList;
|
||||
|
||||
private MCOptionUtils() {
|
||||
mLineList = new ArrayList<String>();
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(Tools.MAIN_PATH + "/options.txt"));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
mLineList.add(line);
|
||||
}
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
Log.w(Tools.APP_NAME, "Could not load options.txt", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void set(String key, String value) {
|
||||
for (int i = 0; i < mLineList.size(); i++) {
|
||||
String line = mLineList.get(i);
|
||||
if (line.startsWith(key + ":")) {
|
||||
mLineList.set(i, key + ":" + value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mLineList.add(key + ":" + value);
|
||||
}
|
||||
|
||||
public void save() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < mLineList.size(); i++) {
|
||||
result.append(mLineList.get(i));
|
||||
if (i + 1 < mLineList.size()) {
|
||||
result.append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Tools.write(Tools.MAIN_PATH + "/options.txt", result.toString());
|
||||
} catch (IOException e) {
|
||||
Log.w(Tools.APP_NAME, "Could not save options.txt", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user