Skip to content

Commit

Permalink
Merge branch 'v3_openjdk' into upd/v4_sol/next
Browse files Browse the repository at this point in the history
  • Loading branch information
SolDev69 committed Jun 27, 2024
2 parents 6df31d0 + df0b762 commit 73048f8
Show file tree
Hide file tree
Showing 109 changed files with 3,382 additions and 789 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body:
Give us some details into the problem, and how this affects it.
placeholder: 'Example: You should add a version selector because of the text box being too small.'
validations:
required: false
required: true

- type: textarea
attributes:
Expand All @@ -20,7 +20,7 @@ body:
What do you want to see changed, added, or removed? Make sure to be specific.
placeholder: 'Example: A scrollable version picker.'
validations:
required: false
required: true

- type: textarea
attributes:
Expand Down
42 changes: 37 additions & 5 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,17 @@ jobs:
path: app_solcraftlauncher/src/main/assets/components/jre-new
workflow_conclusion: success
repo: PojavLauncherTeam/android-openjdk-build-multiarch
branch: buildjre21
branch: buildjre17-21
name: jre17-pojav

- name: Get JRE21
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
path: app_solcraftlauncher/src/main/assets/components/jre-21
workflow_conclusion: success
repo: PojavLauncherTeam/android-openjdk-build-multiarch
branch: buildjre17-21
name: jre21-pojav

- uses: gradle/gradle-build-action@v2
Expand Down Expand Up @@ -80,14 +90,36 @@ jobs:
run: |
rm -r app_solcraftlauncher/src/main/assets/components/jre
rm -r app_solcraftlauncher/src/main/assets/components/jre-new
rm -r app_solcraftlauncher/src/main/assets/components/jre-21
gradle assembleDebug
mv app_solcraftlauncher/build/outputs/apk/debug/app_solcraftlauncher-debug.apk out/app_solcraftlauncher-noruntime.apk
mv app_solcraftlauncher/build/outputs/apk/debug/app_solcraftlauncher-debug.apk out/app-debug-noruntime.apk
- name: Gen md5sums
run: |
md5sum out/app-debug.apk > out/app-debug.md5
md5sum out/app-debug-noruntime.apk > out/app-debug-noruntime.md5
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app_solcraftlauncher
path: out/app_solcraftlauncher-debug.apk
name: app-debug
path: out/app-debug.*

- name: Upload AAB
uses: actions/upload-artifact@v3
with:
name: app-release-aab
path: out/app-gplay.aab

- name: Upload onto the Google Play testing track
continue-on-error: true
if: github.repository_owner == 'PojavLauncherTeam' && github.ref_name == 'v3_openjdk'
uses: r0adkll/upload-google-play@v1.1.2
with:
serviceAccountJsonPlainText: ${{ secrets.GPLAY_SERVICE_JSON }}
packageName: net.kdt.pojavlaunch
releaseFiles: out/app-gplay.aab
track: internal
inAppUpdatePriority: 5

- name: Upload APK (without runtime)
uses: actions/upload-artifact@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/build
/*/build
app_solcraftlauncher/src/main/assets/components/jre
/app_solcraftlauncher/src/main/assets/components/jre-new/
/app_solcraftlauncher/src/main/assets/components/jre-21/
local.properties
.idea/
app_solcraftlauncher/.cxx/
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SolCraftLauncher is a fork of PojavLauncher with more technical added features,

## Introduction
* PojavLauncher is a Minecraft: Java Edition launcher for Android and iOS based on [Boardwalk](https://github.com/zhuowei/Boardwalk).
* This launcher can launch almost all available Minecraft versions ranging from rd-132211 to 1.19 snapshots (including Combat Test versions).
* This launcher can launch almost all available Minecraft versions ranging from rd-132211 to 1.21 snapshots (including Combat Test versions).
* Modding via Forge and Fabric are also supported.
* This repository contains source code for Android.
* For iOS/iPadOS, check out [PojavLauncher_iOS](https://github.com/PojavLauncherTeam/PojavLauncher_iOS).
Expand Down Expand Up @@ -140,7 +140,7 @@ Any code change to this repository (or iOS) should be submitted as a pull reques
- [LWJGLX](https://github.com/PojavLauncherTeam/lwjglx) (LWJGL2 API compatibility layer for LWJGL3): unknown license.<br>
- [Mesa 3D Graphics Library](https://gitlab.freedesktop.org/mesa/mesa): [MIT License](https://docs.mesa3d.org/license.html).
- [pro-grade](https://github.com/pro-grade/pro-grade) (Java sandboxing security manager): [Apache License 2.0](https://github.com/pro-grade/pro-grade/blob/master/LICENSE.txt).
- [xHook](https://github.com/iqiyi/xHook) (Used for exit code trapping): [MIT and BSD-style licenses](https://github.com/iqiyi/xHook/blob/master/LICENSE).
- [bhook](https://github.com/bytedance/bhook) (Used for exit code trapping): [MIT license](https://github.com/bytedance/bhook/blob/main/LICENSE).
- [libepoxy](https://github.com/anholt/libepoxy): [MIT License](https://github.com/anholt/libepoxy/blob/master/COPYING).
- [virglrenderer](https://github.com/PojavLauncherTeam/virglrenderer): [MIT License](https://gitlab.freedesktop.org/virgl/virglrenderer/-/blob/master/COPYING).
- Thanks to [MCHeads](https://mc-heads.net) for providing Minecraft avatars.
3 changes: 2 additions & 1 deletion app_solcraftlauncher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ dependencies {
// implementation 'com.intuit.ssp:ssp-android:1.0.5'

implementation 'org.tukaani:xz:1.8'
implementation 'com.github.PojavLauncherTeam:exp4j:60eaec6f78'
// Our version of exp4j can be built from source at
// https://github.com/PojavLauncherTeam/exp4j
implementation 'net.sourceforge.htmlcleaner:htmlcleaner:2.6.1'
implementation 'com.bytedance:bytehook:1.0.9'

Expand Down
Binary file not shown.
26 changes: 18 additions & 8 deletions app_solcraftlauncher/src/main/java/com/kdt/LoggerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.ToggleButton;

Expand All @@ -22,8 +21,8 @@
*/
public class LoggerView extends ConstraintLayout {
private Logger.eventLogListener mLogListener;
private ToggleButton mToggleButton;
private ScrollView mScrollView;
private ToggleButton mLogToggle;
private DefocusableScrollView mScrollView;
private TextView mLogTextView;


Expand All @@ -40,7 +39,7 @@ public LoggerView(@NonNull Context context, @Nullable AttributeSet attrs) {
public void setVisibility(int visibility) {
super.setVisibility(visibility);
// Triggers the log view shown state by default when viewing it
mToggleButton.setChecked(visibility == VISIBLE);
mLogToggle.setChecked(visibility == VISIBLE);
}

/**
Expand All @@ -56,8 +55,8 @@ private void init(){
mLogTextView.setVisibility(GONE);

// Toggle log visibility
mToggleButton = findViewById(R.id.content_log_toggle_log);
mToggleButton.setOnCheckedChangeListener(
mLogToggle = findViewById(R.id.content_log_toggle_log);
mLogToggle.setOnCheckedChangeListener(
(compoundButton, isChecked) -> {
mLogTextView.setVisibility(isChecked ? VISIBLE : GONE);
if(isChecked) {
Expand All @@ -68,21 +67,32 @@ private void init(){
// NOTE: was tested by rapidly smashing the log on/off button, no sync issues found :)
}
});
mToggleButton.setChecked(false);
mLogToggle.setChecked(false);

// Remove the loggerView from the user View
ImageButton cancelButton = findViewById(R.id.log_view_cancel);
cancelButton.setOnClickListener(view -> LoggerView.this.setVisibility(GONE));

// Set the scroll view
mScrollView = findViewById(R.id.content_log_scroll);
mScrollView.setKeepFocusing(true);

//Set up the autoscroll switch
ToggleButton autoscrollToggle = findViewById(R.id.content_log_toggle_autoscroll);
autoscrollToggle.setOnCheckedChangeListener(
(compoundButton, isChecked) -> {
if(isChecked) mScrollView.fullScroll(View.FOCUS_DOWN);
mScrollView.setKeepFocusing(isChecked);
}
);
autoscrollToggle.setChecked(true);

// Listen to logs
mLogListener = text -> {
if(mLogTextView.getVisibility() != VISIBLE) return;
post(() -> {
mLogTextView.append(text + '\n');
mScrollView.fullScroll(View.FOCUS_DOWN);
if(mScrollView.isKeepFocusing()) mScrollView.fullScroll(View.FOCUS_DOWN);
});

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ protected void onResume() {
protected void onPostResume() {
super.onPostResume();
Tools.setFullscreen(this, setFullscreen());
Tools.ignoreNotch(PREF_IGNORE_NOTCH,this);
Tools.ignoreNotch(shouldIgnoreNotch(),this);
}

/** @return Whether or not the notch should be ignored */
protected boolean shouldIgnoreNotch(){
return PREF_IGNORE_NOTCH;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public class EfficientAndroidLWJGLKeycode {

add(KeyEvent.KEYCODE_CAPS_LOCK, LwjglGlfwKeycode.GLFW_KEY_CAPS_LOCK);
add(KeyEvent.KEYCODE_BREAK, LwjglGlfwKeycode.GLFW_KEY_PAUSE);
add(KeyEvent.KEYCODE_MOVE_HOME, LwjglGlfwKeycode.GLFW_KEY_HOME);
add(KeyEvent.KEYCODE_MOVE_END, LwjglGlfwKeycode.GLFW_KEY_END);
add(KeyEvent.KEYCODE_INSERT, LwjglGlfwKeycode.GLFW_KEY_INSERT);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package net.kdt.pojavlaunch;

import android.content.*;
import android.os.*;
import androidx.appcompat.app.*;
import android.util.*;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

public class FatalErrorActivity extends AppCompatActivity {

Expand All @@ -13,8 +16,13 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Bundle extras = getIntent().getExtras();
boolean storageAllow = extras.getBoolean("storageAllow");
final String stackTrace = Log.getStackTraceString((Throwable) extras.getSerializable("throwable"));
if(extras == null) {
finish();
return;
}
boolean storageAllow = extras.getBoolean("storageAllow", false);
Throwable throwable = (Throwable) extras.getSerializable("throwable");
final String stackTrace = throwable != null ? Tools.printToString(throwable) : "<null>";
String strSavePath = extras.getString("savePath");
String errHeader = storageAllow ?
"Crash stack trace saved to " + strSavePath + "." :
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.kdt.pojavlaunch;
package net.kdt.pojavlaunch.customcontrols.mouse;

import android.app.Activity;
import android.content.Context;
Expand All @@ -10,6 +10,7 @@
import android.view.Surface;
import android.view.WindowManager;

import net.kdt.pojavlaunch.GrabListener;
import net.kdt.pojavlaunch.prefs.LauncherPreferences;

import org.lwjgl.glfw.CallbackBridge;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.kdt.pojavlaunch;

import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
import android.Manifest;
import android.app.NotificationManager;
import android.content.Context;
Expand All @@ -23,14 +24,15 @@
import com.kdt.mcgui.ProgressLayout;
import com.kdt.mcgui.mcAccountSpinner;

import net.kdt.pojavlaunch.lifecycle.ContextExecutor;
import net.kdt.pojavlaunch.contracts.OpenDocumentWithExtension;
import net.kdt.pojavlaunch.extra.ExtraConstants;
import net.kdt.pojavlaunch.extra.ExtraCore;
import net.kdt.pojavlaunch.extra.ExtraListener;
import net.kdt.pojavlaunch.fragments.MainMenuFragment;
import net.kdt.pojavlaunch.fragments.MicrosoftLoginFragment;
import net.kdt.pojavlaunch.fragments.SelectAuthFragment;
import net.kdt.pojavlaunch.lifecycle.ContextAwareDoneListener;
import net.kdt.pojavlaunch.lifecycle.ContextExecutor;
import net.kdt.pojavlaunch.modloaders.modpacks.ModloaderInstallTracker;
import net.kdt.pojavlaunch.modloaders.modpacks.imagecache.IconCacheJanitor;
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
Expand All @@ -40,7 +42,6 @@
import net.kdt.pojavlaunch.services.ProgressServiceKeeper;
import net.kdt.pojavlaunch.tasks.AsyncMinecraftDownloader;
import net.kdt.pojavlaunch.tasks.AsyncVersionList;
import net.kdt.pojavlaunch.lifecycle.ContextAwareDoneListener;
import net.kdt.pojavlaunch.tasks.MinecraftDownloader;
import net.kdt.pojavlaunch.utils.NotificationUtils;
import net.kdt.pojavlaunch.value.launcherprofiles.LauncherProfiles;
Expand Down Expand Up @@ -153,14 +154,27 @@ public void onFragmentResumed(@NonNull FragmentManager fm, @NonNull Fragment f)
private ActivityResultLauncher<String> mRequestNotificationPermissionLauncher;
private WeakReference<Runnable> mRequestNotificationPermissionRunnable;

@Override
protected boolean shouldIgnoreNotch() {
return getResources().getConfiguration().orientation == ORIENTATION_PORTRAIT || super.shouldIgnoreNotch();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pojav_launcher);
this.getSupportFragmentManager().beginTransaction()
.setReorderingAllowed(true)
.addToBackStack("ROOT")
.replace(R.id.container_fragment, MainMenuFragment.class, null, "ROOT").commit();
FragmentManager fragmentManager = getSupportFragmentManager();
// If we don't have a back stack root yet...
if(fragmentManager.getBackStackEntryCount() < 1) {
// Manually add the first fragment to the backstack to get easily back to it
// There must be a better way to handle the root though...
// (artDev: No, there is not. I've spent days researching this for another unrelated project.)
fragmentManager.beginTransaction()
.setReorderingAllowed(true)
.addToBackStack("ROOT")
.add(R.id.container_fragment, MainMenuFragment.class, null, "ROOT").commit();
}


IconCacheJanitor.runJanitor();
mRequestNotificationPermissionLauncher = registerForActivityResult(
Expand Down Expand Up @@ -248,6 +262,11 @@ public void onBackPressed() {
}
}

// Check if we are at the root then
if(getVisibleFragment("ROOT") != null){
finish();
}

super.onBackPressed();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.kdt.pojavlaunch;

import static net.kdt.pojavlaunch.Architecture.ARCH_X86;
import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_SUSTAINED_PERFORMANCE;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_USE_ALTERNATE_SURFACE;
Expand All @@ -17,7 +16,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
Expand All @@ -44,7 +42,6 @@

import com.kdt.LoggerView;

import net.kdt.pojavlaunch.lifecycle.ContextExecutor;
import net.kdt.pojavlaunch.customcontrols.ControlButtonMenuListener;
import net.kdt.pojavlaunch.customcontrols.ControlData;
import net.kdt.pojavlaunch.customcontrols.ControlDrawerData;
Expand All @@ -54,6 +51,9 @@
import net.kdt.pojavlaunch.customcontrols.EditorExitable;
import net.kdt.pojavlaunch.customcontrols.keyboard.LwjglCharSender;
import net.kdt.pojavlaunch.customcontrols.keyboard.TouchCharInput;
import net.kdt.pojavlaunch.customcontrols.mouse.GyroControl;
import net.kdt.pojavlaunch.customcontrols.mouse.Touchpad;
import net.kdt.pojavlaunch.lifecycle.ContextExecutor;
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
import net.kdt.pojavlaunch.services.GameService;
import net.kdt.pojavlaunch.utils.JREUtils;
Expand Down Expand Up @@ -363,16 +363,6 @@ private void printLauncherInfo(String gameVersion, String javaArguments) {
Logger.appendToLog("Info: Custom Java arguments: \"" + javaArguments + "\"");
}

private void checkVulkanZinkIsSupported() {
if (Tools.DEVICE_ARCHITECTURE == ARCH_X86
|| Build.VERSION.SDK_INT < 25
|| !getPackageManager().hasSystemFeature(PackageManager.FEATURE_VULKAN_HARDWARE_LEVEL)
|| !getPackageManager().hasSystemFeature(PackageManager.FEATURE_VULKAN_HARDWARE_VERSION)) {
Logger.appendToLog("Error: Vulkan Zink renderer is not supported!");
throw new RuntimeException(getString(R.string. mcn_check_fail_vulkan_support));
}
}

private void dialogSendCustomKey() {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(R.string.control_customkey);
Expand Down Expand Up @@ -630,7 +620,7 @@ public void exitEditor() {
public void onServiceConnected(ComponentName name, IBinder service) {
GameService.LocalBinder localBinder = (GameService.LocalBinder) service;
mServiceBinder = localBinder;
minecraftGLView.start(localBinder.isActive);
minecraftGLView.start(localBinder.isActive, touchpad);
localBinder.isActive = true;
}

Expand Down
Loading

0 comments on commit 73048f8

Please sign in to comment.