Compare commits

...
Author SHA1 Message Date
khanhduytran0 eb3afced42 Remove load gl4es at startup 2020-08-15 15:47:32 +07:00
khanhduytran0 52a0936b86 LWJGL3: Set some properties 2020-08-15 15:23:46 +07:00
khanhduytran0 f7ea549102 Enable LWJGL3 debug 2020-08-15 13:53:09 +07:00
LegacyGamerHD d1625d3064 Update .travis.yml 2020-08-14 10:24:06 +02:00
LegacyGamerHD ba93a9493c a typo 2020-08-14 10:21:12 +02:00
LegacyGamerHD a87c97fbbe up the sdk to 28 and some other changes 2020-08-14 10:20:38 +02:00
khanhduytran0 4726a8dfce Change how to get internal resources 2020-08-12 06:03:20 +07:00
khanhduytran0 a25089fdd9 Attempt fix unable to copy error... 2020-08-11 18:20:19 +07:00
khanhduytran0 638a5871ca Fix 'JNI_OnLoad` crash 2020-08-11 15:31:14 +07:00
khanhduytran0 24984f360f Added x86 LWJGL3 libraries 2020-08-11 12:00:09 +07:00
LegacyGamerHD 92bda73750 update branch 2020-08-07 11:39:21 +02:00
Tran Khanh Duy 967d488457 Update README.md 2020-08-07 15:39:21 +07:00
Tran Khanh Duy ea8e83903d Update README.md 2020-08-07 15:39:03 +07:00
khanhduytran0 394a08ee5a LWJGL3 changes... 2020-08-07 15:24:21 +07:00
15 changed files with 85 additions and 76 deletions

No files matched your search

+6 -7
View File
@@ -4,18 +4,17 @@ jdk: oraclejdk8
env:
global:
- ANDROID_API_LEVEL=26
- ANDROID_BUILD_TOOLS_VERSION=26.0.0
- ANDROID_ABI=armeabi-v7a
- ANDROID_ABI=X86
- ANDROID_ABI=ARMEABI_V7A
- ANDROID_API_LEVEL=28
- ANDROID_BUILD_TOOLS_VERSION=28.0.3
# - ANDROID_ABI=armeabi-v7a
# - ANDROID_ABI=X86
# - ANDROID_ABI=ARMEABI_V7A
android:
components:
- tools
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
- android-$ANDROID_API_LEVEL
- extra-android-m2repository
licenses:
- yes | sudo sdkmanager --licenses
- 'android-sdk-preview-license-52d11cd2'
@@ -56,4 +55,4 @@ deploy:
overwrite: true
target_commitish: $TRAVIS_COMMIT
on:
branch: gl4es
branch: gl4es_lwjgl3
+3
View File
@@ -1,3 +1,6 @@
## Warning
Do not merge this branch as it only have LWJGL3 so Minecraft 1.12.2 and below will not run...
![badge](https://api.travis-ci.com/PojavLauncherTeam/PojavLauncher.svg?branch=gl4es)
# PojavLauncher
An open source Minecraft: Java Edition launcher for Android based from Boardwalk. Support up-to Minecraft 1.11
@@ -32,15 +32,18 @@ import net.kdt.pojavlaunch.value.customcontrols.*;
import android.support.v7.app.*;
public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListener {
private static final int POPUP_TEXT_LAYOUT = getInternalId("layout", "text_edit_action_popup_text");
private final int POPUP_TEXT_LAYOUT;
private TextView mEditTextView;
private TextView mDeleteTextView;
public ActionPopupWindow(HandleView handleView) {
super(handleView);
POPUP_TEXT_LAYOUT = Tools.getInternalResId(handleView.getContext(), "layout", "text_edit_action_popup_text");
}
/*
private static int getInternalId(String type, String name) {
try {
for (Class perType : Class.forName("com.android.internal.R").getDeclaredClasses()) {
if (perType.getSimpleName().equals(type)) {
@@ -72,10 +75,10 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
return -1;
}
*/
@Override
protected void createPopupWindow() {
mPopupWindow = new PopupWindow(mHandleView.getContext(), null, getInternalId("attr", "textSelectHandleWindowStyle"));
mPopupWindow = new PopupWindow(mHandleView.getContext(), null, Tools.getInternalResId(mHandleView.getContext(), "attr", "textSelectHandleWindowStyle"));
mPopupWindow.setClippingEnabled(true);
}
@@ -84,7 +87,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
LinearLayout linearLayout = new LinearLayout(mHandleView.getContext());
linearLayout.setOrientation(LinearLayout.HORIZONTAL);
mContentView = linearLayout;
mContentView.setBackgroundResource(getInternalId("drawable", "text_edit_paste_window"));
mContentView.setBackgroundResource(Tools.getInternalResId(mHandleView.getContext(), "drawable", "text_edit_paste_window"));
LayoutInflater inflater = (LayoutInflater) mHandleView.getContext().
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -101,7 +104,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
mDeleteTextView = (TextView) inflater.inflate(POPUP_TEXT_LAYOUT, null);
mDeleteTextView.setLayoutParams(wrapContent);
mContentView.addView(mDeleteTextView);
mDeleteTextView.setText(getInternalId("string", "delete"));
mDeleteTextView.setText(Tools.getInternalResId(mHandleView.getContext(), "string", "delete"));
mDeleteTextView.setOnClickListener(this);
}
@@ -188,7 +191,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
dialog.show();
} else if (view == mDeleteTextView) {
alert.setMessage(view.getResources().getString(getInternalId("string", "delete")) + " " + mHandleView.mView.getText() + "?");
alert.setMessage(view.getResources().getString(Tools.getInternalResId(mHandleView.getContext(), "string", "delete")) + " " + mHandleView.mView.getText() + "?");
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){
@Override
@@ -72,25 +72,6 @@ public abstract class HandleView extends View implements ViewPositionListener, V
}
return mPositionListener;
}
private int getInternalId(String type, String name) {
try {
for (Class perType : Class.forName("com.android.internal.R").getDeclaredClasses()) {
if (perType.getSimpleName().equals(type)) {
try {
Field f = perType.getDeclaredField(name);
f.setAccessible(true);
return (int) f.get(null);
} catch (Throwable th) {
th.printStackTrace();
}
}
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return -1;
}
public HandleView(ControlView view) {
super(view.getContext());
@@ -100,7 +81,7 @@ public abstract class HandleView extends View implements ViewPositionListener, V
mDownWidth = view.getLayoutParams().width;
mDownHeight = view.getLayoutParams().height;
mContainer = new PopupWindow(view.getContext(), null, getInternalId("attr", "textSelectHandleWindowStyle"));
mContainer = new PopupWindow(view.getContext(), null, Tools.getInternalResId(getContext(), "attr", "textSelectHandleWindowStyle"));
mContainer.setSplitTouchEnabled(true);
mContainer.setClippingEnabled(false);
mContainer.setWindowLayoutType(WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL);
@@ -108,7 +89,7 @@ public abstract class HandleView extends View implements ViewPositionListener, V
mDrawableLtr = view.getContext().getDrawable(R.drawable.text_select_handle_left_material);
mDrawableRtl = view.getContext().getDrawable(R.drawable.text_select_handle_right_material);
mMinSize = view.getContext().getResources().getDimensionPixelSize(getInternalId("dimen", "text_handle_min_size"));
mMinSize = view.getContext().getResources().getDimensionPixelSize(Tools.getInternalResId(getContext(), "dimen", "text_handle_min_size"));
setOnLongClickListener(this);
@@ -8,31 +8,28 @@ import android.widget.Toast;
import net.kdt.pojavlaunch.Tools;
import java.awt.mod.*;
import android.os.*;
public class Clipboard extends Object
{
private final Activity mActivity;
public static Context mSystemCtx;
public static ClipboardManager mClipboardAndroidMgr;
public Clipboard() {
mActivity = ModdingKit.getCurrentActivity();
// mActivity = ModdingKit.getCurrentActivity();
mSystemCtx = ModdingKit.getSystemContext();
mClipboardAndroidMgr = (ClipboardManager) mSystemCtx.getSystemService(Context.CLIPBOARD_SERVICE);
}
public synchronized void setContents(final Transferable contents, ClipboardOwner owner) {
try {
mActivity.runOnUiThread(new Runnable(){
new Handler().post(new Runnable(){
@Override
public void run()
{
ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("Minecraft", ((StringSelection) contents).getString());
clipboard.setPrimaryClip(clip);
public void run() {
ClipData clip = ClipData.newPlainText("Clipboard", ((StringSelection) contents).getString());
mClipboardAndroidMgr.setPrimaryClip(clip);
Toast.makeText(mActivity, "Copied to clipboard!", Toast.LENGTH_SHORT).show();
Toast.makeText(mSystemCtx, "Copied to clipboard!", Toast.LENGTH_SHORT).show();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
private Transferable clipboardText;
@@ -41,15 +38,12 @@ public class Clipboard extends Object
try {
clipboardPasted = false;
mActivity.runOnUiThread(new Runnable(){
new Handler().post(new Runnable(){
@Override
public void run()
{
ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
clipboardText = new StringSelection(clipboard.getText().toString());
public void run() {
clipboardText = new StringSelection(mClipboardAndroidMgr.getText().toString());
clipboardPasted = true;
Toast.makeText(mActivity, "Paste from clipboard", Toast.LENGTH_SHORT).show();
Toast.makeText(mSystemCtx, "Paste from clipboard", Toast.LENGTH_SHORT).show();
}
});
+14 -2
View File
@@ -1,15 +1,27 @@
package java.awt.mod;
import android.app.*;
import android.content.*;
import android.graphics.*;
import java.awt.image.*;
import java.lang.reflect.*;
import java.util.*;
import net.kdt.pojavlaunch.*;
public class ModdingKit
{
public static Activity getCurrentActivity()
{
public static Context getSystemContext() {
try {
// ActivityThread.currentActivityThread().getSystemContext();
Class activityThreadClass = Class.forName("android.app.ActivityThread");
Object activityThread = activityThreadClass.getMethod("currentActivityThread").invoke(null);
return (Context) activityThreadClass.getDeclaredMethod("getSystemContext").invoke(activityThread);
} catch (Throwable th) {
return null;
}
}
public static Activity getCurrentActivity() {
try {
Class activityThreadClass = Class.forName("android.app.ActivityThread");
Object activityThread = activityThreadClass.getMethod("currentActivityThread").invoke(null);
@@ -203,14 +203,12 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
setTitle("Minecraft " + mProfile.getVersion());
initEnvs();
//System.loadLibrary("gl4es");
/*
/*
if (mVersionInfo.arguments != null) {
System.loadLibrary("lwjgl32");
System.loadLibrary("lwjgl_opengl32");
System.loadLibrary("lwjgl_stb32");
System.loadLibrary("gl04es");
}
*/
*/
this.displayMetrics = Tools.getDisplayMetrics(this);
AndroidDisplay.windowWidth = displayMetrics.widthPixels / scaleFactor;
@@ -873,6 +871,15 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
if (!System.getProperty("user.home", "/").equals(Tools.MAIN_PATH)) {
forceUserHome(Tools.MAIN_PATH);
}
// FIXME: Is loading libc.so good?
System.setProperty("org.lwjgl.jemalloc.libname", "libc.so");
System.setProperty("org.lwjgl.opengl.libname", "libgl04es.so");
// Enable LWJGL3 debug
System.setProperty("org.lwjgl.util.Debug", "true");
System.setProperty("org.lwjgl.util.DebugLoader", "true");
System.setProperty("org.apache.logging.log4j.level", "INFO");
System.setProperty("org.apache.logging.log4j.simplelog.level", "INFO");
@@ -20,7 +20,6 @@ import net.kdt.pojavlaunch.patcher.*;
import java.lang.reflect.*;
import dalvik.system.*;
import optifine.*;
import android.text.*;
import java.awt.*;
import javax.xml.transform.*;
import java.awt.datatransfer.*;
@@ -164,29 +163,36 @@ public final class Tools
showError(ctx, e);
}
}
public static int getInternalResId(Context ctx, String type, String name) {
Resources res = ctx.getResources();
int internalId = res.getIdentifier(name, type, "com.android.internal");
// = Resources.getSystem().getIdentifier();
if (internalId == 0) {
internalId = res.getIdentifier(name, type, "android");
}
return internalId;
}
public static void showError(Context ctx, Throwable e)
{
public static void showError(Context ctx, Throwable e) {
showError(ctx, e, false);
}
public static void showError(final Context ctx, final Throwable e, final boolean exitIfOk)
{
public static void showError(final Context ctx, final Throwable e, final boolean exitIfOk) {
showError(ctx, R.string.global_error, e, exitIfOk, false);
}
public static void showError(final Context ctx, final int titleId, final Throwable e, final boolean exitIfOk)
{
public static void showError(final Context ctx, final int titleId, final Throwable e, final boolean exitIfOk) {
showError(ctx, titleId, e, exitIfOk, false);
}
private static void showError(final Context ctx, final int titleId, final Throwable e, final boolean exitIfOk, final boolean showMore)
{
private static void showError(final Context ctx, final int titleId, final Throwable e, final boolean exitIfOk, final boolean showMore) {
Runnable runnable = new Runnable(){
@Override
public void run()
{
public void run() {
final String errMsg = showMore ? Log.getStackTraceString(e): e.getMessage();
new AlertDialog.Builder((Context) ctx)
.setTitle(titleId)
@@ -220,7 +226,11 @@ public final class Tools
{
StringSelection errData = new StringSelection(errMsg);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(errData, null);
ClipboardManager cmgr = (ClipboardManager) ctx.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("Error", Log.getStackTraceString(e));
cmgr.setPrimaryClip(clip);
if(exitIfOk) {
if (ctx instanceof MainActivity) {
MainActivity.fullyExit();
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.