mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-21 09:01:56 -07:00
Upstreamify
This commit is contained in:
commit
d7556c318b
15 changed files with 68 additions and 44 deletions
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
|
@ -22,7 +22,7 @@ body:
|
|||
|
||||
Tip: You can attach files by clicking this area to highlight it and then dragging files in or select them on 🖼 option at the toolbar.
|
||||
validations:
|
||||
required: false
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
|
|
|
|||
1
.github/workflows/android.yml
vendored
1
.github/workflows/android.yml
vendored
|
|
@ -60,6 +60,7 @@ jobs:
|
|||
|
||||
- name: Install gl4es
|
||||
if: github.ref == 'refs/heads/v3_openjdk' && steps.gl4es-cache.outputs.cache-hit != 'true'
|
||||
continue-on-error: true
|
||||
run: |
|
||||
cp -R gl4es/libs/* app_pojavlauncher/src/main/jniLibs/
|
||||
mv gl4es ..
|
||||
|
|
|
|||
|
|
@ -74,6 +74,10 @@ public abstract class BaseLauncherActivity extends BaseActivity {
|
|||
|
||||
public static final int RUN_MOD_INSTALLER = 2050;
|
||||
private void installMod(boolean customJavaArgs) {
|
||||
if (MultiRTUtils.getExactJREName(8) == null) {
|
||||
Toast.makeText(this, R.string.multirt_nojava8rt, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
if (customJavaArgs) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.alerttitle_installmod);
|
||||
|
|
@ -259,6 +263,11 @@ public abstract class BaseLauncherActivity extends BaseActivity {
|
|||
mRuntimeConfigDialog = new MultiRTConfigDialog();
|
||||
mRuntimeConfigDialog.prepare(this);
|
||||
|
||||
((Button)findViewById(R.id.installJarButton)).setOnLongClickListener(view -> {
|
||||
installMod(true);
|
||||
return true;
|
||||
});
|
||||
|
||||
//TODO ADD CRASH CHECK AND FOCUS
|
||||
System.out.println("call to onResumeFragments; E");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ public class BaseMainActivity extends BaseActivity {
|
|||
checkLWJGL3Installed();
|
||||
|
||||
JREUtils.jreReleaseList = JREUtils.readJREReleaseProperties();
|
||||
JREUtils.checkJavaArchitecture(this, JREUtils.jreReleaseList.get("OS_ARCH"));
|
||||
Logger.getInstance().appendToLog("Architecture: " + Architecture.archAsString(Tools.DEVICE_ARCHITECTURE));
|
||||
checkJavaArgsIsLaunchable(JREUtils.jreReleaseList.get("JAVA_VERSION"));
|
||||
// appendlnToLog("Info: Custom Java arguments: \"" + LauncherPreferences.PREF_CUSTOM_JAVA_ARGS + "\"");
|
||||
|
||||
|
|
|
|||
|
|
@ -67,8 +67,15 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
|
|||
Logger.getInstance().reset();
|
||||
|
||||
try {
|
||||
JREUtils.jreReleaseList = JREUtils.readJREReleaseProperties(LauncherPreferences.PREF_DEFAULT_RUNTIME);
|
||||
if (JREUtils.jreReleaseList.get("JAVA_VERSION").equals("1.8.0")) {
|
||||
MultiRTUtils.setRuntimeNamed(this,LauncherPreferences.PREF_DEFAULT_RUNTIME);
|
||||
} else {
|
||||
MultiRTUtils.setRuntimeNamed(this,MultiRTUtils.getExactJREName(8));
|
||||
JREUtils.jreReleaseList = JREUtils.readJREReleaseProperties();
|
||||
}
|
||||
|
||||
loggerView = findViewById(R.id.launcherLoggerView);
|
||||
MultiRTUtils.setRuntimeNamed(this,LauncherPreferences.PREF_DEFAULT_RUNTIME);
|
||||
gestureDetector = new GestureDetector(this, new SingleTapConfirm());
|
||||
|
||||
findViewById(R.id.installmod_mouse_pri).setOnTouchListener(this);
|
||||
|
|
@ -278,14 +285,6 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
|
|||
public int launchJavaRuntime(File modFile, String javaArgs) {
|
||||
JREUtils.redirectAndPrintJRELog(this);
|
||||
try {
|
||||
JREUtils.jreReleaseList = JREUtils.readJREReleaseProperties();
|
||||
|
||||
// Fail immediately when Java 8 is not selected
|
||||
// TODO: auto override Java 8 if installed
|
||||
if (!JREUtils.jreReleaseList.get("JAVA_VERSION").equals("1.8.0")) {
|
||||
throw new RuntimeException("Cannot use the mod installer. In order to use the mod installer, you need to install Java 8 and specify it in the Preferences menu.");
|
||||
}
|
||||
|
||||
List<String> javaArgList = new ArrayList<String>();
|
||||
|
||||
// Enable Caciocavallo
|
||||
|
|
|
|||
|
|
@ -63,6 +63,15 @@ public class MultiRTUtils {
|
|||
|
||||
return ret;
|
||||
}
|
||||
public static String getExactJREName(int majorVersion) {
|
||||
List<Runtime> runtimes = getRuntimes();
|
||||
for(Runtime r : runtimes) {
|
||||
if(r.javaVersion == majorVersion) {
|
||||
return r.name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static String getNearestJREName(int majorVersion) {
|
||||
List<Runtime> runtimes = getRuntimes();
|
||||
int diff_factor = Integer.MAX_VALUE;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import net.kdt.pojavlaunch.Architecture;
|
||||
import net.kdt.pojavlaunch.R;
|
||||
import net.kdt.pojavlaunch.Tools;
|
||||
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
||||
|
|
@ -71,7 +72,7 @@ public class RTRecyclerViewAdapter extends RecyclerView.Adapter<RTRecyclerViewAd
|
|||
public void bindRuntime(MultiRTUtils.Runtime rt, int pos) {
|
||||
currentRuntime = rt;
|
||||
currentPosition = pos;
|
||||
if(rt.versionString != null) {
|
||||
if(rt.versionString != null && Tools.DEVICE_ARCHITECTURE == Architecture.archAsInt(rt.arch)) {
|
||||
javaVersionView.setText(ctx.getString(R.string.multirt_java_ver, rt.name, rt.javaVersion));
|
||||
fullJavaVersionView.setText(rt.versionString);
|
||||
fullJavaVersionView.setTextColor(defaultColors);
|
||||
|
|
@ -80,8 +81,12 @@ public class RTRecyclerViewAdapter extends RecyclerView.Adapter<RTRecyclerViewAd
|
|||
setDefaultButton.setEnabled(!default_);
|
||||
setDefaultButton.setText(default_?R.string.multirt_config_setdefault_already:R.string.multirt_config_setdefault);
|
||||
}else{
|
||||
if(rt.versionString == null){
|
||||
fullJavaVersionView.setText(R.string.multirt_runtime_corrupt);
|
||||
}else{
|
||||
fullJavaVersionView.setText(ctx.getString(R.string.multirt_runtime_incompatiblearch, rt.arch));
|
||||
}
|
||||
javaVersionView.setText(rt.name);
|
||||
fullJavaVersionView.setText(R.string.multirt_runtime_corrupt);
|
||||
fullJavaVersionView.setTextColor(Color.RED);
|
||||
setDefaultButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
@ -91,7 +96,7 @@ public class RTRecyclerViewAdapter extends RecyclerView.Adapter<RTRecyclerViewAd
|
|||
public void onClick(View v) {
|
||||
if(v.getId() == R.id.multirt_view_removebtn) {
|
||||
if (currentRuntime != null) {
|
||||
if(MultiRTUtils.getRuntimes().size() < 2) {
|
||||
if(MultiRTUtils.getRuntimes().size() < 2 && setDefaultButton.isShown()) {
|
||||
AlertDialog.Builder bldr = new AlertDialog.Builder(ctx);
|
||||
bldr.setTitle(R.string.global_error);
|
||||
bldr.setMessage(R.string.multirt_config_removeerror_last);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class MinecraftDownloaderTask extends AsyncTask<String, String, Throwable
|
|||
mActivity.runOnUiThread(()->{
|
||||
AlertDialog.Builder bldr = new AlertDialog.Builder(mActivity);
|
||||
bldr.setTitle(R.string.global_error);
|
||||
bldr.setMessage(R.string.multirt_nocompartiblert);
|
||||
bldr.setMessage(mActivity.getString(R.string.multirt_nocompartiblert, verInfo.javaVersion.majorVersion));
|
||||
bldr.setPositiveButton(android.R.string.ok,(dialog, which)->{
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -35,19 +35,6 @@ public class JREUtils {
|
|||
private static String nativeLibDir;
|
||||
public static Map<String, String> jreReleaseList;
|
||||
|
||||
/**
|
||||
* Checks if the java architecture is correct for the device architecture.
|
||||
* @param activity Some context to load resources from
|
||||
* @param jreArch The java architecture to compare as a String.
|
||||
*/
|
||||
public static void checkJavaArchitecture(Activity activity, String jreArch) {
|
||||
Logger.getInstance().appendToLog("Architecture: " + archAsString(Tools.DEVICE_ARCHITECTURE));
|
||||
if(Tools.DEVICE_ARCHITECTURE == Architecture.archAsInt(jreArch)) return;
|
||||
|
||||
Logger.getInstance().appendToLog("Architecture " + archAsString(Tools.DEVICE_ARCHITECTURE) + " is incompatible with Java Runtime " + jreArch);
|
||||
Tools.dialogOnUiThread(activity, "", activity.getString(R.string.mcn_check_fail_incompatiblearch, archAsString(Tools.DEVICE_ARCHITECTURE), jreArch));
|
||||
}
|
||||
|
||||
public static String findInLdLibPath(String libName) {
|
||||
if(Os.getenv("LD_LIBRARY_PATH")==null) {
|
||||
try {
|
||||
|
|
@ -104,8 +91,14 @@ public class JREUtils {
|
|||
}
|
||||
|
||||
public static Map<String, String> readJREReleaseProperties() throws IOException {
|
||||
return readJREReleaseProperties(Tools.DIR_HOME_JRE);
|
||||
}
|
||||
public static Map<String, String> readJREReleaseProperties(String name) throws IOException {
|
||||
Map<String, String> jreReleaseMap = new ArrayMap<>();
|
||||
BufferedReader jreReleaseReader = new BufferedReader(new FileReader(Tools.DIR_HOME_JRE + "/release"));
|
||||
if (!name.contains("/")) {
|
||||
name = Tools.MULTIRT_HOME + "/" + name;
|
||||
}
|
||||
BufferedReader jreReleaseReader = new BufferedReader(new FileReader(name + "/release"));
|
||||
String currLine;
|
||||
while ((currLine = jreReleaseReader.readLine()) != null) {
|
||||
if (!currLine.isEmpty() || currLine.contains("=")) {
|
||||
|
|
@ -324,6 +317,7 @@ public class JREUtils {
|
|||
initJavaRuntime();
|
||||
setupExitTrap(activity.getApplication());
|
||||
chdir(Tools.DIR_GAME_NEW);
|
||||
userArgs.add(0,"java"); //argv[0] is the program name according to C standard.
|
||||
|
||||
final int exitCode = VMLauncher.launchJVM(userArgs.toArray(new String[0]));
|
||||
Logger.getInstance().appendToLog("Java Exit code: " + exitCode);
|
||||
|
|
@ -347,6 +341,8 @@ public class JREUtils {
|
|||
*/
|
||||
public static List<String> getJavaArgs(Context ctx) {
|
||||
List<String> userArguments = parseJavaArguments(LauncherPreferences.PREF_CUSTOM_JAVA_ARGS);
|
||||
String resolvFile;
|
||||
resolvFile = new File(Tools.DIR_DATA,"resolv.conf").getAbsolutePath();
|
||||
String[] overridableArguments = new String[]{
|
||||
"-Djava.home=" + Tools.DIR_HOME_JRE,
|
||||
"-Djava.io.tmpdir=" + ctx.getCacheDir().getAbsolutePath(),
|
||||
|
|
@ -365,29 +361,30 @@ public class JREUtils {
|
|||
"-Dglfwstub.windowWidth=" + CallbackBridge.windowWidth,
|
||||
"-Dglfwstub.windowHeight=" + CallbackBridge.windowHeight,
|
||||
"-Dglfwstub.initEgl=false",
|
||||
|
||||
"-Dext.net.resolvPath=" +new File(Tools.DIR_DATA,"resolv.conf").getAbsolutePath(),
|
||||
|
||||
"-Dext.net.resolvPath=" +resolvFile,
|
||||
"-Dlog4j2.formatMsgNoLookups=true", //Log4j RCE mitigation
|
||||
|
||||
"-Dnet.minecraft.clientmodname=" + Tools.APP_NAME,
|
||||
"-Dfml.earlyprogresswindow=false" //Forge 1.14+ workaround
|
||||
};
|
||||
|
||||
|
||||
for (String userArgument : userArguments) {
|
||||
for(int i=0; i < overridableArguments.length; ++i){
|
||||
String overridableArgument = overridableArguments[i];
|
||||
//Only java properties are considered overridable for now
|
||||
if(userArgument.startsWith("-D") && userArgument.startsWith(overridableArgument.substring(0, overridableArgument.indexOf("=")))){
|
||||
overridableArguments[i] = ""; //Remove the argument since it is overridden
|
||||
List<String> additionalArguments = new ArrayList<>();
|
||||
for(String arg : overridableArguments) {
|
||||
String strippedArg = arg.substring(0,arg.indexOf('='));
|
||||
boolean add = true;
|
||||
for(String uarg : userArguments) {
|
||||
if(uarg.startsWith(strippedArg)) {
|
||||
add = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(add)
|
||||
additionalArguments.add(arg);
|
||||
else
|
||||
Log.i("ArgProcessor","Arg skipped: "+arg);
|
||||
}
|
||||
|
||||
//Add all the arguments
|
||||
userArguments.addAll(Arrays.asList(overridableArguments));
|
||||
userArguments.addAll(additionalArguments);
|
||||
return userArguments;
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -127,11 +127,10 @@
|
|||
<string name="global_waiting">Wait</string>
|
||||
|
||||
<!-- MainActivity: strings -->
|
||||
<string name="mcn_exit_title">Application/Game exited with code %d</string>
|
||||
<string name="mcn_exit_title">Application/Game exited with code %d, check latestlog.txt for more details.</string>
|
||||
<string name="mcn_exit_call">Exit</string>
|
||||
<string name="mcn_exit_confirm">Are you sure want to force close?</string>
|
||||
<string name="mcn_check_fail_lwjgl">LWJGL3 was not installed!</string>
|
||||
<string name="mcn_check_fail_incompatiblearch">Architecture %1$s is incompatible with Java Runtime %2$s.</string>
|
||||
<string name="mcn_check_fail_vulkan_support">Vulkan Zink renderer is not supported on this device!</string>
|
||||
|
||||
<!-- MainActivity: Control buttons -->
|
||||
|
|
@ -238,6 +237,7 @@
|
|||
<string name="mcl_memory_allocation_subtitle">Controls how much memory is given to Minecraft</string>
|
||||
<string name="multirt_java_ver">%s (Java %d)</string>
|
||||
<string name="multirt_runtime_corrupt">Corrupted Java Runtime</string>
|
||||
<string name="multirt_runtime_incompatiblearch">Incompatible architecture: %s</string>
|
||||
<string name="multirt_config_title">Java VMs</string>
|
||||
<string name="multirt_config_add">Add new</string>
|
||||
<string name="multirt_config_add_subtitle">Import new Java VM</string>
|
||||
|
|
@ -247,7 +247,8 @@
|
|||
<string name="multirt_config_setdefault">Set default</string>
|
||||
<string name="multirt_config_setdefault_already">Default</string>
|
||||
<string name="multirt_config_removeerror_last">You must have at least one Java Runtime installed</string>
|
||||
<string name="multirt_nocompartiblert">Can\'t find any compartible Java Runtime</string>
|
||||
<string name="multirt_nocompartiblert">Can\'t find any compartible Java Runtime. This version requires Java %d or newer.</string>
|
||||
<string name="multirt_nojava8rt">Can\'t find Java 8. In order to use this option, you need to install Java 8.</string>
|
||||
|
||||
<string name="compat_117_message">Minecraft 21w10a+ requires the OpenGL 3.2 core profile. Sadly, GL4ES wrapper doesn\'t fully support it at the moment, but there are some additional resources you can install to run these versions. Press OK to confirm installation, and press Cancel to abort launch.</string>
|
||||
<string name="compat_11x_playanyway">Play anyway</string>
|
||||
|
|
@ -300,4 +301,6 @@
|
|||
<string name="pedit_renderer">Renderer</string>
|
||||
<string name="gles_version_hack_title">Force openGL 1</string>
|
||||
<string name="gles_version_hack_description">Help with compatibility on some old versions</string>
|
||||
<string name="arc_capes_title">Arc Capes</string>
|
||||
<string name="arc_capes_desc">Enables capes from Arc. For more information please visit https://arccapes.com</string>
|
||||
</resources>
|
||||
|
|
|
|||
1
gl4es
Submodule
1
gl4es
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit baf1c7482ee8dd138324a1f670fc04706723ed83
|
||||
Loading…
Add table
Add a link
Reference in a new issue