From 493bcc8b60cec642f30b7566308717d7674c1524 Mon Sep 17 00:00:00 2001 From: Mathias Boulay Date: Wed, 11 Oct 2023 22:45:01 +0200 Subject: [PATCH 1/8] Fix[settings]: improperly saved joystick deadzone settings --- .../java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java | 2 +- .../prefs/screens/LauncherPreferenceControlFragment.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java index 5eb1338e6..efe21b35a 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java @@ -102,7 +102,7 @@ public class LauncherPreferences { PREF_FORCE_VSYNC = DEFAULT_PREF.getBoolean("force_vsync", false); PREF_BUTTON_ALL_CAPS = DEFAULT_PREF.getBoolean("buttonAllCaps", true); PREF_DUMP_SHADERS = DEFAULT_PREF.getBoolean("dump_shaders", false); - PREF_DEADZONE_SCALE = DEFAULT_PREF.getInt("gamepad_deadzone_scale", 100)/100f; + PREF_DEADZONE_SCALE = ((float) DEFAULT_PREF.getInt("gamepad_deadzone_scale", 100))/100f; PREF_BIG_CORE_AFFINITY = DEFAULT_PREF.getBoolean("bigCoreAffinity", false); PREF_ZINK_PREFER_SYSTEM_DRIVER = DEFAULT_PREF.getBoolean("zinkPreferSystemDriver", false); diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceControlFragment.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceControlFragment.java index d380bb7c9..44cd9af8e 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceControlFragment.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceControlFragment.java @@ -51,7 +51,7 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen CustomSeekBarPreference deadzoneSeek = findPreference("gamepad_deadzone_scale"); deadzoneSeek.setRange(50, 200); - deadzoneSeek.setValue((int) joystickDeadzone * 100); + deadzoneSeek.setValue((int) (joystickDeadzone * 100f)); deadzoneSeek.setSuffix(" %"); @@ -66,6 +66,7 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen gyroSensitivitySeek.setRange(25, 300); gyroSensitivitySeek.setValue((int) (gyroSpeed*100f)); gyroSensitivitySeek.setSuffix(" %"); + CustomSeekBarPreference gyroSampleRateSeek = findPreference("gyroSampleRate"); gyroSampleRateSeek.setRange(5, 50); gyroSampleRateSeek.setValue(gyroSampleRate); From f3c19895a02543eb31a6555edce16dfbd1db612f Mon Sep 17 00:00:00 2001 From: Mathias Boulay Date: Fri, 13 Oct 2023 20:33:51 +0200 Subject: [PATCH 2/8] Fix[downloader]: 1.6.X assets were missing --- .../java/net/kdt/pojavlaunch/JAssets.java | 4 ++++ .../tasks/AsyncMinecraftDownloader.java | 23 ++++--------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JAssets.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JAssets.java index dc987fad6..627f95f0b 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JAssets.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JAssets.java @@ -8,7 +8,11 @@ import java.util.Map; @Keep public class JAssets { + /* Used by older versions of mc, when the files were named and under .minecraft/resources */ @SerializedName("map_to_resources") public boolean mapToResources; public Map objects; + + /* Used by the legacy.json (~1.6.X) asset file, used for paths at the root of the .minecraft/assets folder */ + public boolean virtual; } diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncMinecraftDownloader.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncMinecraftDownloader.java index 4de6935c3..9f039bff5 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncMinecraftDownloader.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/tasks/AsyncMinecraftDownloader.java @@ -241,7 +241,7 @@ public class AsyncMinecraftDownloader { JAssetInfo asset = assetsObjects.get(assetKey); assetsSizeBytes += asset.size; String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash; - File outFile = assets.mapToResources ? new File(outputDir,"/"+assetKey) : new File(objectsDir, assetPath); + File outFile = (assets.mapToResources || assets.virtual) ? new File(outputDir,"/"+assetKey) : new File(objectsDir , assetPath); boolean skip = outFile.exists();// skip if the file exists if(LauncherPreferences.PREF_CHECK_LIBRARY_SHA && skip) @@ -257,8 +257,7 @@ public class AsyncMinecraftDownloader { executor.execute(()->{ try { - if (!assets.mapToResources) downloadAsset(asset, objectsDir, downloadedSize); - else downloadAssetMapped(asset, assetKey, outputDir, downloadedSize); + downloadAssetFile(outFile, assetPath, downloadedSize); }catch (IOException e) { Log.e("AsyncMcManager", e.toString()); localInterrupt.set(true); @@ -286,12 +285,11 @@ public class AsyncMinecraftDownloader { } - public void downloadAsset(JAssetInfo asset, File objectsDir, AtomicInteger downloadCounter) throws IOException { - String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash; - File outFile = new File(objectsDir, assetPath); + public void downloadAssetFile(File outFile, String assetPath, AtomicInteger downloadCounter) throws IOException { downloadFileMonitored(MINECRAFT_RES + assetPath, outFile, getByteBuffer(), new Tools.DownloaderFeedback() { int prevCurr; + @Override public void updateProgress(int curr, int max) { downloadCounter.addAndGet(curr - prevCurr); @@ -300,19 +298,6 @@ public class AsyncMinecraftDownloader { }); } - public void downloadAssetMapped(JAssetInfo asset, String assetName, File resDir, AtomicInteger downloadCounter) throws IOException { - String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash; - File outFile = new File(resDir,"/"+assetName); - downloadFileMonitored(MINECRAFT_RES + assetPath, outFile, getByteBuffer(), - new Tools.DownloaderFeedback() { - int prevCurr; - @Override - public void updateProgress(int curr, int max) { - downloadCounter.addAndGet(curr - prevCurr); - prevCurr = curr; - } - }); - } protected void downloadLibrary(DependentLibrary libItem, String libArtifact, File outLib) throws Throwable{ String libPathURL; From 3d1d6f03f30a1bec464e10c916c5919d8ae03172 Mon Sep 17 00:00:00 2001 From: Mathias Boulay Date: Fri, 13 Oct 2023 22:00:55 +0200 Subject: [PATCH 3/8] Fix[controls]: clone swipeable/mouse passthrough --- .../kdt/pojavlaunch/customcontrols/ControlData.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlData.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlData.java index 5f39ec0c2..de03b0e5b 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlData.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlData.java @@ -109,10 +109,10 @@ public class ControlData { } public ControlData(String name, int[] keycodes, String dynamicX, String dynamicY, float width, float height, boolean isToggle) { - this(name, keycodes, dynamicX, dynamicY, width, height, isToggle, 1, 0x4D000000, 0xFFFFFFFF, 0, 0, true, true); + this(name, keycodes, dynamicX, dynamicY, width, height, isToggle, 1, 0x4D000000, 0xFFFFFFFF, 0, 0, true, true, false, false); } - public ControlData(String name, int[] keycodes, String dynamicX, String dynamicY, float width, float height, boolean isToggle, float opacity, int bgColor, int strokeColor, float strokeWidth, float cornerRadius, boolean displayInGame, boolean displayInMenu) { + public ControlData(String name, int[] keycodes, String dynamicX, String dynamicY, float width, float height, boolean isToggle, float opacity, int bgColor, int strokeColor, float strokeWidth, float cornerRadius, boolean displayInGame, boolean displayInMenu, boolean isSwipable, boolean mousePassthrough) { this.name = name; this.keycodes = inflateKeycodeArray(keycodes); this.dynamicX = dynamicX; @@ -128,6 +128,8 @@ public class ControlData { this.cornerRadius = cornerRadius; this.displayInGame = displayInGame; this.displayInMenu = displayInMenu; + this.isSwipeable = isSwipable; + this.passThruEnabled = mousePassthrough; } //Deep copy constructor @@ -146,7 +148,9 @@ public class ControlData { controlData.strokeWidth, controlData.cornerRadius, controlData.displayInGame, - controlData.displayInMenu + controlData.displayInMenu, + controlData.isSwipeable, + controlData.passThruEnabled ); } From b624b3123f2bba2228609d7d218dee92c6bdfaba Mon Sep 17 00:00:00 2001 From: Mathias Boulay Date: Fri, 13 Oct 2023 22:10:09 +0200 Subject: [PATCH 4/8] Fix[controls]: clone forward lock --- .../kdt/pojavlaunch/customcontrols/ControlJoystickData.java | 3 ++- .../pojavlaunch/customcontrols/buttons/ControlJoystick.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlJoystickData.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlJoystickData.java index 994489594..4ef42908a 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlJoystickData.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlJoystickData.java @@ -9,7 +9,8 @@ public class ControlJoystickData extends ControlData { super(); } - public ControlJoystickData(ControlData properties) { + public ControlJoystickData(ControlJoystickData properties) { super(properties); + forwardLock = properties.forwardLock; } } diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlJoystick.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlJoystick.java index 34c21c424..58fe0119a 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlJoystick.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlJoystick.java @@ -102,8 +102,8 @@ public class ControlJoystick extends JoystickView implements ControlInterface { @Override public void cloneButton() { - ControlData data = new ControlJoystickData(getProperties()); - getControlLayoutParent().addJoystickButton((ControlJoystickData) data); + ControlJoystickData data = new ControlJoystickData(mControlData); + getControlLayoutParent().addJoystickButton(data); } From d3263581c35b8ac6e85cbcb6723e09d56d970af3 Mon Sep 17 00:00:00 2001 From: Mathias Boulay Date: Fri, 13 Oct 2023 22:24:41 +0200 Subject: [PATCH 5/8] Fix[control-editor]: context buttons reaching out of the screen --- .../pojavlaunch/customcontrols/handleview/ActionRow.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/handleview/ActionRow.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/handleview/ActionRow.java index 807bf0f0d..ea5632473 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/handleview/ActionRow.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/handleview/ActionRow.java @@ -47,7 +47,7 @@ public class ActionRow extends LinearLayout { }; private final ActionButtonInterface[] actionButtons = new ActionButtonInterface[3]; private View mFollowedView = null; - private final int mSide = SIDE_TOP; + private final int mSide = SIDE_AUTO; /** Add action buttons and configure them */ private void init(){ @@ -123,10 +123,7 @@ public class ActionRow extends LinearLayout { ViewGroup parent = ((ViewGroup) mFollowedView.getParent()); if(parent == null) return mSide;//Value should not matter - int side = mFollowedView.getX() + getWidth()/2f > parent.getWidth()/2f - ? SIDE_LEFT - : SIDE_RIGHT; - + int side = SIDE_TOP; float futurePos = getYPosition(side); if(futurePos + getHeight() > (parent.getHeight() + getHeight()/2f)){ side = SIDE_TOP; From ba158d97b2029561b8f5a7efe4b72b1dd8370464 Mon Sep 17 00:00:00 2001 From: Mathias Boulay Date: Fri, 13 Oct 2023 22:55:41 +0200 Subject: [PATCH 6/8] Fix[controls]: joystick transparency --- app_pojavlauncher/build.gradle | 2 +- .../kdt/pojavlaunch/customcontrols/ControlLayout.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app_pojavlauncher/build.gradle b/app_pojavlauncher/build.gradle index 0ecbf835a..94b74a0b9 100644 --- a/app_pojavlauncher/build.gradle +++ b/app_pojavlauncher/build.gradle @@ -199,7 +199,7 @@ dependencies { implementation 'com.github.PojavLauncherTeam:portrait-ssp:6c02fd739b' implementation 'com.github.Mathias-Boulay:ExtendedView:1.0.0' implementation 'com.github.Mathias-Boulay:android_gamepad_remapper:eb92e3a5bb' - implementation 'com.github.Mathias-Boulay:virtual-joystick-android:cb7bf45ba5' + implementation 'com.github.Mathias-Boulay:virtual-joystick-android:2e7aa25e50' // implementation 'com.intuit.sdp:sdp-android:1.0.5' diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlLayout.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlLayout.java index 424d77af9..19f5e3cd9 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlLayout.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/ControlLayout.java @@ -204,7 +204,15 @@ public class ControlLayout extends FrameLayout { } private void addJoystickView(ControlJoystickData data){ - addView(new ControlJoystick(this, data)); + ControlJoystick view = new ControlJoystick(this, data); + + if (!mModifiable) { + view.setAlpha(view.getProperties().opacity); + view.setFocusable(false); + view.setFocusableInTouchMode(false); + } + addView(view); + } From f91390519c8c12fdeb0414aab05a4231f1d11eef Mon Sep 17 00:00:00 2001 From: Mathias Boulay Date: Fri, 13 Oct 2023 23:13:12 +0200 Subject: [PATCH 7/8] Fix[strings]: un-hardcode category strings --- app_pojavlauncher/src/main/res/values/strings.xml | 7 +++++++ app_pojavlauncher/src/main/res/xml/pref_control.xml | 4 ++-- app_pojavlauncher/src/main/res/xml/pref_experimental.xml | 2 +- app_pojavlauncher/src/main/res/xml/pref_java.xml | 2 +- app_pojavlauncher/src/main/res/xml/pref_main.xml | 2 +- app_pojavlauncher/src/main/res/xml/pref_misc.xml | 2 +- app_pojavlauncher/src/main/res/xml/pref_video.xml | 2 +- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app_pojavlauncher/src/main/res/values/strings.xml b/app_pojavlauncher/src/main/res/values/strings.xml index 422cc238c..7bb8fb3e5 100644 --- a/app_pojavlauncher/src/main/res/values/strings.xml +++ b/app_pojavlauncher/src/main/res/values/strings.xml @@ -338,4 +338,11 @@ An error has occurred Click to see more details Show only stable versions + Gestures + Buttons + Experimental fuckury + Java Tweaks + Categories + Miscellaneous settings + Video settings diff --git a/app_pojavlauncher/src/main/res/xml/pref_control.xml b/app_pojavlauncher/src/main/res/xml/pref_control.xml index 0f333095e..550439aea 100644 --- a/app_pojavlauncher/src/main/res/xml/pref_control.xml +++ b/app_pojavlauncher/src/main/res/xml/pref_control.xml @@ -14,7 +14,7 @@ + android:title="@string/preference_category_gestures"> + android:title="@string/preference_category_buttons"> - + - + diff --git a/app_pojavlauncher/src/main/res/xml/pref_main.xml b/app_pojavlauncher/src/main/res/xml/pref_main.xml index 21dc9bd11..b4fd754f7 100644 --- a/app_pojavlauncher/src/main/res/xml/pref_main.xml +++ b/app_pojavlauncher/src/main/res/xml/pref_main.xml @@ -10,7 +10,7 @@ - + - + Date: Fri, 13 Oct 2023 23:27:55 +0200 Subject: [PATCH 8/8] Docs: Link to LWJGL build instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78e5d6950..7f6376d3e 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ If you want to build from source code, follow the steps below. - (If needed) update the Version file with the current date
### LWJGL -- **Coming soon** +The build instructions for the custom LWJGL are available over the [LWJGL repository](https://github.com/PojavLauncherTeam/lwjgl3) ### The Launcher - Because languages are auto-added by Crowdin, you need to run the language list generator before building. In the project directory, run: