Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
Fix merging
Browse files Browse the repository at this point in the history
  • Loading branch information
artdeell committed Dec 7, 2021
2 parents 9608545 + 4219779 commit 14a460a
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app_pojavlauncher/src/main/java/com/kdt/LoggerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void init(){
logListener = text -> {
if(log.getVisibility() != VISIBLE) return;
post(() -> {
log.append(text);
log.append(text + '\n');
scrollView.fullScroll(View.FOCUS_DOWN);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ public void handleMessage(Message msg) {
return;
}
if(msg.what == MSG_DROP_ITEM_BUTTON_CHECK) {
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_Q);
theHandler.sendEmptyMessageDelayed(MSG_DROP_ITEM_BUTTON_CHECK, 600);
if(CallbackBridge.isGrabbing()){
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_Q);
theHandler.sendEmptyMessageDelayed(MSG_DROP_ITEM_BUTTON_CHECK, 600);
}
return;
}

Expand Down Expand Up @@ -338,11 +340,13 @@ public boolean onTouchEvent(MotionEvent e) {
break;

case MotionEvent.ACTION_POINTER_DOWN: // 5
//TODO Hey we could have some sort of middle click detection ?

scrollLastInitialX = e.getX();
scrollLastInitialY = e.getY();
//Checking if we are pressing the hotbar to select the item
hudKeyHandled = handleGuiBar((int)e.getX(e.getPointerCount()-1), (int) e.getY(e.getPointerCount()-1));
if(hudKeyHandled == -1){
if(hudKeyHandled != -1){
sendKeyPress(hudKeyHandled);
if(hasDoubleTapped && hudKeyHandled == lastHotbarKey){
//Prevent double tapping Event on two different slots
Expand Down Expand Up @@ -575,7 +579,7 @@ public int handleGuiBar(int x, int y) {
int barX = (CallbackBridge.physicalWidth / 2) - (barWidth / 2);
if(x < barX || x >= barX + barWidth) return -1;

return hotbarKeys[((x - barX) / barWidth / 9) % 9];
return hotbarKeys[(int) net.kdt.pojavlaunch.utils.MathUtils.map(x, barX, barX + barWidth, 0, 9)];
}

/** Return the size, given the UI scale size */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,25 @@ public final class ExtraCore {
// No unwanted instantiation
private ExtraCore(){}

// Singleton instance
private static ExtraCore extraCoreSingleton = null;

// Store the key-value pair
private final Map<String, Object> valueMap = new ConcurrentHashMap<>();

// Store what each ExtraListener listen to
private final Map<String, ConcurrentLinkedQueue<WeakReference<ExtraListener>>> listenerMap = new ConcurrentHashMap<>();

// Inner class for singleton implementation
private static class ExtraCoreSingleton {
private static final ExtraCore extraCore = new ExtraCore();
}

// All public methods will pass through this one
private static ExtraCore getInstance(){
return ExtraCoreSingleton.extraCore;
if(extraCoreSingleton == null){
synchronized(ExtraCore.class){
if(extraCoreSingleton == null){
extraCoreSingleton = new ExtraCore();
}
}
}
return extraCoreSingleton;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class LauncherPreferences
public static boolean PREF_SUSTAINED_PERFORMANCE = false;
public static boolean PREF_ENABLE_PROFILES = true;
public static String PREF_GLES_SHRINK_HACK = "0";
public static boolean PREF_VBO_DISABLE_HACK = false;


public static void loadPreferences(Context ctx) {
Expand Down Expand Up @@ -66,6 +67,7 @@ public static void loadPreferences(Context ctx) {
PREF_CONTROL_LEFT_OFFSET = DEFAULT_PREF.getInt("controlLeftOffset", 0);
PREF_SUSTAINED_PERFORMANCE = DEFAULT_PREF.getBoolean("sustainedPerformance", false);
PREF_GLES_SHRINK_HACK = DEFAULT_PREF.getString("gl4es_shrink_hack", "0");
PREF_VBO_DISABLE_HACK = DEFAULT_PREF.getBoolean("vbo_disable_hack", false);

/*
if (PREF_CUSTOM_JAVA_ARGS.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static net.kdt.pojavlaunch.Architecture.is64BitsDevice;
import static net.kdt.pojavlaunch.Tools.LOCAL_RENDERER;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_GLES_SHRINK_HACK;
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_VBO_DISABLE_HACK;

import android.app.*;
import android.content.*;
Expand Down Expand Up @@ -211,14 +212,17 @@ public static void setJavaEnvironment(Activity activity) throws Throwable {

// The shrink hack can be enabled from the experimental settings
envMap.put("LIBGL_SHRINK", PREF_GLES_SHRINK_HACK);

// VBO disable hack
if(PREF_VBO_DISABLE_HACK) envMap.put("LIBGL_USEVBO","0");

// Fix white color on banner and sheep, since GL4ES 1.1.5
envMap.put("LIBGL_NORMALIZE", "1");

envMap.put("MESA_GLSL_CACHE_DIR", activity.getCacheDir().getAbsolutePath());
if (LOCAL_RENDERER != null) {
envMap.put("MESA_GL_VERSION_OVERRIDE", LOCAL_RENDERER.equals("opengles3_virgl")?"4.5":"4.6");
envMap.put("MESA_GLSL_VERSION_OVERRIDE", LOCAL_RENDERER.equals("opengles3_virgl")?"450":"460");
envMap.put("MESA_GL_VERSION_OVERRIDE", LOCAL_RENDERER.equals("opengles3_virgl")?"4.3":"4.6");
envMap.put("MESA_GLSL_VERSION_OVERRIDE", LOCAL_RENDERER.equals("opengles3_virgl")?"430":"460");
}
envMap.put("force_glsl_extensions_warn", "true");
envMap.put("allow_higher_compat_version", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
import static org.lwjgl.glfw.CallbackBridge.windowHeight;
import static org.lwjgl.glfw.CallbackBridge.windowWidth;

import java.io.*;
import java.lang.ref.WeakReference;
import java.util.*;

import android.os.Build;
import android.os.FileObserver;
import android.util.*;
import android.util.Log;

import androidx.annotation.Nullable;

import net.kdt.pojavlaunch.*;
import net.kdt.pojavlaunch.Tools;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;

public class MCOptionUtils
{
Expand Down Expand Up @@ -103,6 +107,8 @@ public void onEvent(int i, @Nullable String s) {
}
};
}

fileObserver.startWatching();
}

public static void notifyListeners(){
Expand Down
Binary file modified app_pojavlauncher/src/main/jniLibs/arm64-v8a/libgl4es_115.so
Binary file not shown.
Binary file modified app_pojavlauncher/src/main/jniLibs/armeabi-v7a/libgl4es_115.so
Binary file not shown.
Binary file modified app_pojavlauncher/src/main/jniLibs/x86/libgl4es_115.so
Binary file not shown.
Binary file modified app_pojavlauncher/src/main/jniLibs/x86_64/libgl4es_115.so
Binary file not shown.
5 changes: 4 additions & 1 deletion app_pojavlauncher/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<string name="mcl_setting_renderer_gles2_4">gl4es 1.1.4 (OpenGL ES 2): exports OpenGL 2.1</string>
<string name="mcl_setting_renderer_gles2_5">gl4es 1.1.5 (OpenGL ES 2): exports OpenGL 2.1</string>
<string name="mcl_setting_renderer_gles3_5">gl4es 1.1.5 (OpenGL ES 3): exports OpenGL 2.1 + partial 3.2</string>
<string name="mcl_setting_renderer_virgl">virglrenderer (OpenGL ES 3): exports OpenGL 4.5</string>
<string name="mcl_setting_renderer_virgl">virglrenderer (OpenGL ES 3): exports OpenGL 4.3</string>
<string name="mcl_setting_renderer_vgpu">vgpu (OpenGL ES 3): exports OpenGL 3.0</string>
<string name="mcl_setting_renderer_vulkan_zink">zink (Vulkan): exports OpenGL 4.6</string>
<string name="mcl_setting_category_veroption">Version type will be in version list</string>
Expand Down Expand Up @@ -279,6 +279,7 @@
<string name="preference_sustained_performance_description">Limit thermal throttling by limiting peak performance</string>

<string name="preference_back_title">Back to the last screen</string>
<string name="gles_hack_title">GL4ES Shrink hack</string>
<string name="gles_hack_none">Don\'t shrink textures</string>
<string name="gles_hack_always">Divides all textures by 2</string>
<string name="gles_hack_sometimes">Divides big textures by /2 or /4</string>
Expand All @@ -288,4 +289,6 @@
<string name="profiles_editing">Editing profile</string>
<string name="profiles_profile_name">Name</string>
<string name="profiles_profile_version">Version</string>
<string name="vbo_hack_title">Disable VBOs</string>
<string name="vbo_hack_description">Help with compatibility on some old versions</string>
</resources>
9 changes: 8 additions & 1 deletion app_pojavlauncher/src/main/res/xml/pref_experimental.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
<PreferenceCategory android:title="Experimental fuckury">

<androidx.preference.ListPreference
android:title="GL4ES Shrink hack"
android:title="@string/gles_hack_title"
android:key="gl4es_shrink_hack"
android:defaultValue="0"
android:entryValues="@array/hack_gles_shrink_values"
android:entries="@array/hack_gles_shrink"
app2:useSimpleSummaryProvider="true"/>

<SwitchPreference
android:title="@string/vbo_hack_title"
android:summary="@string/vbo_hack_description"
android:defaultValue="false"
android:key="vbo_disable_hack"
/>

</PreferenceCategory>
</PreferenceScreen>

0 comments on commit 14a460a

Please sign in to comment.