Fix merging

This commit is contained in:
artdeell 2021-12-07 14:29:47 +03:00
commit 14a460a22c
12 changed files with 52 additions and 21 deletions

View File

@ -68,7 +68,7 @@ public class LoggerView extends ConstraintLayout {
logListener = text -> {
if(log.getVisibility() != VISIBLE) return;
post(() -> {
log.append(text);
log.append(text + '\n');
scrollView.fullScroll(View.FOCUS_DOWN);
});

View File

@ -98,8 +98,10 @@ public class MinecraftGLView extends TextureView {
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;
}
@ -338,11 +340,13 @@ public class MinecraftGLView extends TextureView {
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
@ -575,7 +579,7 @@ public class MinecraftGLView extends TextureView {
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 */

View File

@ -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;
}
/**

View File

@ -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) {
@ -66,6 +67,7 @@ public class LauncherPreferences
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()) {

View File

@ -5,6 +5,7 @@ import static net.kdt.pojavlaunch.Architecture.archAsString;
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.*;
@ -211,14 +212,17 @@ public class JREUtils {
// 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");

View File

@ -2,17 +2,21 @@ package net.kdt.pojavlaunch.utils;
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
{
@ -103,6 +107,8 @@ public class MCOptionUtils
}
};
}
fileObserver.startWatching();
}
public static void notifyListeners(){

View File

@ -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>
@ -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>
@ -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>

View File

@ -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>