Merge branch 'v3_openjdk' into holy_gl4es_extra

This commit is contained in:
Boulay Mathias 2022-04-16 19:14:31 +02:00 committed by GitHub
commit d05b321b48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 11 deletions

View File

@ -10,6 +10,7 @@
android:maxSdkVersion="28"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:allowBackup="true"

View File

@ -128,8 +128,8 @@ public final class Tools {
LauncherProfiles.update();
MinecraftProfile minecraftProfile = ((BaseMainActivity)activity).minecraftProfile;
if(minecraftProfile == null) throw new Exception("Launching empty Profile");
if(minecraftProfile.gameDir != null && !minecraftProfile.gameDir.isEmpty())
gamedirPath = minecraftProfile.gameDir;
if(minecraftProfile.gameDir != null && minecraftProfile.gameDir.startsWith(Tools.LAUNCHERPROFILES_RTPREFIX))
gamedirPath = minecraftProfile.gameDir.replace(Tools.LAUNCHERPROFILES_RTPREFIX,Tools.DIR_GAME_HOME+"/");
if(minecraftProfile.javaArgs != null && !minecraftProfile.javaArgs.isEmpty())
LauncherPreferences.PREF_CUSTOM_JAVA_ARGS = minecraftProfile.javaArgs;
}

View File

@ -9,6 +9,7 @@ import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
@ -43,12 +44,14 @@ public class ProfileEditor implements ExtraListener<ArrayList<String>> {
private final Spinner mVersionSpinner;
private final Spinner mJavaRuntimeSpinner;
private final Spinner mRendererSpinner;
private final EditText mPathSelectionEditText;
private final List<String> mRenderNames;
private final AlertDialog mDialog;
private String mSelectedVersionId;
private String mEditingProfile;
private final EditSaveCallback mEditSaveCallback;
private final Handler mUiThreadHandler;
public static MinecraftProfile generateTemplate() {
MinecraftProfile TEMPLATE = new MinecraftProfile();
TEMPLATE.name = "New";
@ -75,6 +78,9 @@ public class ProfileEditor implements ExtraListener<ArrayList<String>> {
mRendererSpinner.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_spinner_dropdown_item,renderList));
}
mProfileIconImageView = mMainView.findViewById(R.id.vprof_editor_icon);
((TextView)mMainView.findViewById(R.id.vprof_editor_beginPathView)).setText(Tools.DIR_GAME_HOME+"/");
mPathSelectionEditText = mainView.findViewById(R.id.vprof_editor_path);
builder.setPositiveButton(R.string.global_save,this::save);
builder.setNegativeButton(android.R.string.cancel,(dialog,which)->destroy(dialog));
builder.setNeutralButton(R.string.global_delete,(dialogInterface, i) -> {
@ -144,8 +150,12 @@ public class ProfileEditor implements ExtraListener<ArrayList<String>> {
}
}
ArrayList<String> versions = (ArrayList<String>) ExtraCore.getValue(ExtraConstants.VERSION_LIST);
BaseLauncherActivity.updateVersionSpinner(context,versions, mVersionSpinner, mSelectedVersionId);
mDialog.show();
BaseLauncherActivity.updateVersionSpinner(context,versions,versionSpinner, selectedVersionId);
if(minecraftProfile.gameDir != null && minecraftProfile.gameDir.startsWith(Tools.LAUNCHERPROFILES_RTPREFIX)) {
pathSelectionEditor.setText(minecraftProfile.gameDir.substring(Tools.LAUNCHERPROFILES_RTPREFIX.length()));
}
dialog.show();
return true;
}
public void save(DialogInterface dialog, int which) {
@ -175,8 +185,13 @@ public class ProfileEditor implements ExtraListener<ArrayList<String>> {
}else{
profile.javaDir = Tools.LAUNCHERPROFILES_RTPREFIX+selectedRuntime.name;
}
if(mRendererSpinner.getSelectedItemPosition() == mRenderNames.size()) profile.pojavRendererName = null;
else profile.pojavRendererName = mRenderNames.get(mRendererSpinner.getSelectedItemPosition());
String selectedPath = mPathSelectionEditText.getText().toString();
if(!selectedPath.isEmpty()) {
profile.gameDir = Tools.LAUNCHERPROFILES_RTPREFIX+selectedPath;
}
LauncherProfiles.mainProfileJson.profiles.put(mEditingProfile,profile);
mEditSaveCallback.onSave(mEditingProfile,isNew, false);
destroy(dialog);

View File

@ -113,10 +113,11 @@ public class V117CompatUtil {
String renderer;
String gamePath;
LauncherProfiles.update();
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)activity).mProfile.selectedProfile);
MinecraftProfile prof = LauncherProfiles.mainProfileJson.profiles.get(((BaseLauncherActivity)ctx).mProfile.selectedProfile);
if(prof == null) throw new MinecraftDownloaderTask.SilentException();
renderer = prof.pojavRendererName != null ? prof.pojavRendererName : LauncherPreferences.PREF_RENDERER;
gamePath = prof.gameDir != null ? prof.gameDir : Tools.DIR_GAME_NEW;
gamePath = prof.gameDir != null && prof.gameDir.startsWith(Tools.LAUNCHERPROFILES_RTPREFIX) ? prof.gameDir.replace(Tools.LAUNCHERPROFILES_RTPREFIX,Tools.DIR_GAME_HOME + "/") : Tools.DIR_GAME_NEW;
//String
if(renderer.equals("vulkan_zink") || renderer.equals("opengles3_virgl")) return; //don't install for zink/virgl users;

View File

@ -381,13 +381,13 @@ JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSetWindowAttrib(
return; // nothing to do yet
}
jclass glfwClazz = (*runtimeJNIEnvPtr_ANDROID)->FindClass(runtimeJNIEnvPtr_ANDROID, "org/lwjgl/glfw/GLFW");
jclass glfwClazz = (*runtimeJNIEnvPtr_JRE)->FindClass(runtimeJNIEnvPtr_JRE, "org/lwjgl/glfw/GLFW");
assert(glfwClazz != NULL);
jmethodID glfwMethod = (*runtimeJNIEnvPtr_ANDROID)->GetStaticMethodID(runtimeJNIEnvPtr_ANDROID, glfwMethod, "glfwSetWindowAttrib", "(JII)V");
jmethodID glfwMethod = (*runtimeJNIEnvPtr_JRE)->GetStaticMethodID(runtimeJNIEnvPtr_JRE, glfwClazz, "glfwSetWindowAttrib", "(JII)V");
assert(glfwMethod != NULL);
(*runtimeJNIEnvPtr_ANDROID)->CallStaticVoidMethod(
runtimeJNIEnvPtr_ANDROID,
(*runtimeJNIEnvPtr_JRE)->CallStaticVoidMethod(
runtimeJNIEnvPtr_JRE,
glfwClazz, glfwMethod,
(jlong) showingWindow, attrib, value
);

View File

@ -62,8 +62,9 @@
android:layout_marginEnd="16dp"
android:minHeight="48dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vprof_editior_profile_name" />
app:layout_constraintTop_toBottomOf="@+id/vprof_editor_path" />
<TextView
android:id="@+id/textView4"
@ -109,5 +110,26 @@
app:layout_constraintBottom_toTopOf="@+id/vprof_editor_profile_renderer"
app:layout_constraintStart_toStartOf="@+id/vprof_editor_profile_renderer" />
<EditText
android:id="@+id/vprof_editor_path"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:ems="10"
android:hint=".minecraft"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vprof_editior_profile_name" />
<TextView
android:id="@+id/vprof_editor_beginPathView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/vprof_editor_path"
app:layout_constraintStart_toStartOf="@+id/vprof_editor_path" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>