Add latest changes from v3_openjdk

This commit is contained in:
artdeell 2023-10-14 08:43:31 +03:00
commit 20a83d377e
18 changed files with 57 additions and 50 deletions

View File

@ -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</br> - (If needed) update the Version file with the current date</br>
### LWJGL ### LWJGL
- **Coming soon** The build instructions for the custom LWJGL are available over the [LWJGL repository](https://github.com/PojavLauncherTeam/lwjgl3)
### The Launcher ### The Launcher
- Because languages are auto-added by Crowdin, you need to run the language list generator before building. In the project directory, run: - Because languages are auto-added by Crowdin, you need to run the language list generator before building. In the project directory, run:

View File

@ -199,7 +199,7 @@ dependencies {
implementation 'com.github.PojavLauncherTeam:portrait-ssp:6c02fd739b' implementation 'com.github.PojavLauncherTeam:portrait-ssp:6c02fd739b'
implementation 'com.github.Mathias-Boulay:ExtendedView:1.0.0' implementation 'com.github.Mathias-Boulay:ExtendedView:1.0.0'
implementation 'com.github.Mathias-Boulay:android_gamepad_remapper:eb92e3a5bb' 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' // implementation 'com.intuit.sdp:sdp-android:1.0.5'

View File

@ -8,7 +8,11 @@ import java.util.Map;
@Keep @Keep
public class JAssets { 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; @SerializedName("map_to_resources") public boolean mapToResources;
public Map<String, JAssetInfo> objects; public Map<String, JAssetInfo> 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;
} }

View File

@ -109,10 +109,10 @@ public class ControlData {
} }
public ControlData(String name, int[] keycodes, String dynamicX, String dynamicY, float width, float height, boolean isToggle) { 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.name = name;
this.keycodes = inflateKeycodeArray(keycodes); this.keycodes = inflateKeycodeArray(keycodes);
this.dynamicX = dynamicX; this.dynamicX = dynamicX;
@ -128,6 +128,8 @@ public class ControlData {
this.cornerRadius = cornerRadius; this.cornerRadius = cornerRadius;
this.displayInGame = displayInGame; this.displayInGame = displayInGame;
this.displayInMenu = displayInMenu; this.displayInMenu = displayInMenu;
this.isSwipeable = isSwipable;
this.passThruEnabled = mousePassthrough;
} }
//Deep copy constructor //Deep copy constructor
@ -146,7 +148,9 @@ public class ControlData {
controlData.strokeWidth, controlData.strokeWidth,
controlData.cornerRadius, controlData.cornerRadius,
controlData.displayInGame, controlData.displayInGame,
controlData.displayInMenu controlData.displayInMenu,
controlData.isSwipeable,
controlData.passThruEnabled
); );
} }

View File

@ -9,7 +9,8 @@ public class ControlJoystickData extends ControlData {
super(); super();
} }
public ControlJoystickData(ControlData properties) { public ControlJoystickData(ControlJoystickData properties) {
super(properties); super(properties);
forwardLock = properties.forwardLock;
} }
} }

View File

@ -204,7 +204,15 @@ public class ControlLayout extends FrameLayout {
} }
private void addJoystickView(ControlJoystickData data){ 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);
} }

View File

@ -102,8 +102,8 @@ public class ControlJoystick extends JoystickView implements ControlInterface {
@Override @Override
public void cloneButton() { public void cloneButton() {
ControlData data = new ControlJoystickData(getProperties()); ControlJoystickData data = new ControlJoystickData(mControlData);
getControlLayoutParent().addJoystickButton((ControlJoystickData) data); getControlLayoutParent().addJoystickButton(data);
} }

View File

@ -47,7 +47,7 @@ public class ActionRow extends LinearLayout {
}; };
private final ActionButtonInterface[] actionButtons = new ActionButtonInterface[3]; private final ActionButtonInterface[] actionButtons = new ActionButtonInterface[3];
private View mFollowedView = null; private View mFollowedView = null;
private final int mSide = SIDE_TOP; private final int mSide = SIDE_AUTO;
/** Add action buttons and configure them */ /** Add action buttons and configure them */
private void init(){ private void init(){
@ -123,10 +123,7 @@ public class ActionRow extends LinearLayout {
ViewGroup parent = ((ViewGroup) mFollowedView.getParent()); ViewGroup parent = ((ViewGroup) mFollowedView.getParent());
if(parent == null) return mSide;//Value should not matter if(parent == null) return mSide;//Value should not matter
int side = mFollowedView.getX() + getWidth()/2f > parent.getWidth()/2f int side = SIDE_TOP;
? SIDE_LEFT
: SIDE_RIGHT;
float futurePos = getYPosition(side); float futurePos = getYPosition(side);
if(futurePos + getHeight() > (parent.getHeight() + getHeight()/2f)){ if(futurePos + getHeight() > (parent.getHeight() + getHeight()/2f)){
side = SIDE_TOP; side = SIDE_TOP;

View File

@ -104,7 +104,7 @@ public class LauncherPreferences {
PREF_FORCE_VSYNC = DEFAULT_PREF.getBoolean("force_vsync", false); PREF_FORCE_VSYNC = DEFAULT_PREF.getBoolean("force_vsync", false);
PREF_BUTTON_ALL_CAPS = DEFAULT_PREF.getBoolean("buttonAllCaps", true); PREF_BUTTON_ALL_CAPS = DEFAULT_PREF.getBoolean("buttonAllCaps", true);
PREF_DUMP_SHADERS = DEFAULT_PREF.getBoolean("dump_shaders", false); 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_BIG_CORE_AFFINITY = DEFAULT_PREF.getBoolean("bigCoreAffinity", false);
PREF_ZINK_PREFER_SYSTEM_DRIVER = DEFAULT_PREF.getBoolean("zinkPreferSystemDriver", false); PREF_ZINK_PREFER_SYSTEM_DRIVER = DEFAULT_PREF.getBoolean("zinkPreferSystemDriver", false);
PREF_DOWNLOAD_SOURCE = DEFAULT_PREF.getString("downloadSource", "default"); PREF_DOWNLOAD_SOURCE = DEFAULT_PREF.getString("downloadSource", "default");

View File

@ -56,7 +56,7 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen
CustomSeekBarPreference deadzoneSeek = requirePreference("gamepad_deadzone_scale", CustomSeekBarPreference deadzoneSeek = requirePreference("gamepad_deadzone_scale",
CustomSeekBarPreference.class); CustomSeekBarPreference.class);
deadzoneSeek.setRange(50, 200); deadzoneSeek.setRange(50, 200);
deadzoneSeek.setValue((int) joystickDeadzone * 100); deadzoneSeek.setValue((int) (joystickDeadzone * 100f));
deadzoneSeek.setSuffix(" %"); deadzoneSeek.setSuffix(" %");
@ -73,6 +73,7 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen
gyroSensitivitySeek.setRange(25, 300); gyroSensitivitySeek.setRange(25, 300);
gyroSensitivitySeek.setValue((int) (gyroSpeed*100f)); gyroSensitivitySeek.setValue((int) (gyroSpeed*100f));
gyroSensitivitySeek.setSuffix(" %"); gyroSensitivitySeek.setSuffix(" %");
CustomSeekBarPreference gyroSampleRateSeek = requirePreference("gyroSampleRate", CustomSeekBarPreference gyroSampleRateSeek = requirePreference("gyroSampleRate",
CustomSeekBarPreference.class); CustomSeekBarPreference.class);
gyroSampleRateSeek.setRange(5, 50); gyroSampleRateSeek.setRange(5, 50);

View File

@ -245,7 +245,7 @@ public class AsyncMinecraftDownloader {
JAssetInfo asset = assetsObjects.get(assetKey); JAssetInfo asset = assetsObjects.get(assetKey);
assetsSizeBytes += asset.size; assetsSizeBytes += asset.size;
String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash; 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 boolean skip = outFile.exists();// skip if the file exists
if(LauncherPreferences.PREF_CHECK_LIBRARY_SHA && skip) if(LauncherPreferences.PREF_CHECK_LIBRARY_SHA && skip)
@ -261,8 +261,7 @@ public class AsyncMinecraftDownloader {
executor.execute(()->{ executor.execute(()->{
try { try {
if (!assets.mapToResources) downloadAsset(asset, objectsDir, downloadedSize); downloadAssetFile(outFile, assetPath, downloadedSize);
else downloadAssetMapped(asset, assetKey, outputDir, downloadedSize);
}catch (IOException e) { }catch (IOException e) {
Log.e("AsyncMcManager", e.toString()); Log.e("AsyncMcManager", e.toString());
localInterrupt.set(true); localInterrupt.set(true);
@ -290,32 +289,18 @@ 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);
downloadFileMirrored(DownloadMirror.DOWNLOAD_CLASS_ASSETS, MINECRAFT_RES + assetPath, outFile, getByteBuffer(),
new Tools.DownloaderFeedback() {
int prevCurr;
@Override
public void updateProgress(int curr, int max) {
downloadCounter.addAndGet(curr - prevCurr);
prevCurr = curr;
}
});
}
public void downloadAssetMapped(JAssetInfo asset, String assetName, File resDir, AtomicInteger downloadCounter) throws IOException { public void downloadAssetFile(File outFile, String assetPath, AtomicInteger downloadCounter) throws IOException {
String assetPath = asset.hash.substring(0, 2) + "/" + asset.hash;
File outFile = new File(resDir,"/"+assetName);
downloadFileMirrored(DownloadMirror.DOWNLOAD_CLASS_ASSETS, MINECRAFT_RES + assetPath, outFile, getByteBuffer(), downloadFileMirrored(DownloadMirror.DOWNLOAD_CLASS_ASSETS, MINECRAFT_RES + assetPath, outFile, getByteBuffer(),
new Tools.DownloaderFeedback() { new Tools.DownloaderFeedback() {
int prevCurr; int prevCurr;
@Override @Override
public void updateProgress(int curr, int max) { public void updateProgress(int curr, int max) {
downloadCounter.addAndGet(curr - prevCurr); downloadCounter.addAndGet(curr - prevCurr);
prevCurr = curr; prevCurr = curr;
} }
}); }
);
} }
protected void downloadLibrary(DependentLibrary libItem, String libArtifact, File outLib) throws Throwable{ protected void downloadLibrary(DependentLibrary libItem, String libArtifact, File outLib) throws Throwable{

View File

@ -352,4 +352,11 @@
<string name="preference_verify_manifest_description">When enabled, the launcher will check the game version manifest along with the libraries.</string> <string name="preference_verify_manifest_description">When enabled, the launcher will check the game version manifest along with the libraries.</string>
<string name="notif_download_finished">The game is ready to launch</string> <string name="notif_download_finished">The game is ready to launch</string>
<string name="notif_download_finished_desc">Click here to start it!</string> <string name="notif_download_finished_desc">Click here to start it!</string>
<string name="preference_category_gestures">Gestures</string>
<string name="preference_category_buttons">Buttons</string>
<string name="preference_category_experimental_settings">Experimental fuckury</string>
<string name="preference_category_java_tweaks">Java Tweaks</string>
<string name="preference_category_main_categories">Categories</string>
<string name="preference_category_miscellaneous">Miscellaneous settings</string>
<string name="preference_category_video">Video settings</string>
</resources> </resources>

View File

@ -14,7 +14,7 @@
</Preference> </Preference>
<PreferenceCategory <PreferenceCategory
android:title="Gestures "> android:title="@string/preference_category_gestures">
<androidx.preference.SwitchPreferenceCompat <androidx.preference.SwitchPreferenceCompat
android:defaultValue="false" android:defaultValue="false"
@ -42,7 +42,7 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="Buttons"> android:title="@string/preference_category_buttons">
<net.kdt.pojavlaunch.prefs.CustomSeekBarPreference <net.kdt.pojavlaunch.prefs.CustomSeekBarPreference
android:key="buttonscale" android:key="buttonscale"

View File

@ -2,7 +2,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app2="http://schemas.android.com/apk/res-auto"> xmlns:app2="http://schemas.android.com/apk/res-auto">
<net.kdt.pojavlaunch.prefs.BackButtonPreference/> <net.kdt.pojavlaunch.prefs.BackButtonPreference/>
<PreferenceCategory android:title="Experimental fuckury"> <PreferenceCategory android:title="@string/preference_category_experimental_settings">
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:key="dump_shaders" android:key="dump_shaders"

View File

@ -4,7 +4,7 @@
<net.kdt.pojavlaunch.prefs.BackButtonPreference/> <net.kdt.pojavlaunch.prefs.BackButtonPreference/>
<PreferenceCategory android:title="Java Tweaks"> <PreferenceCategory android:title="@string/preference_category_java_tweaks">
<Preference <Preference
android:key="install_jre" android:key="install_jre"
android:persistent="false" android:persistent="false"

View File

@ -10,7 +10,7 @@
<net.kdt.pojavlaunch.prefs.BackButtonPreference/> <net.kdt.pojavlaunch.prefs.BackButtonPreference/>
<PreferenceCategory <PreferenceCategory
android:title="Categories" android:title="@string/preference_category_main_categories"
> >
<Preference <Preference

View File

@ -4,7 +4,7 @@
<net.kdt.pojavlaunch.prefs.BackButtonPreference/> <net.kdt.pojavlaunch.prefs.BackButtonPreference/>
<PreferenceCategory android:title="Miscellaneous settings"> <PreferenceCategory android:title="@string/preference_category_miscellaneous">
<SwitchPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:icon="@drawable/ic_setting_hash_verification" android:icon="@drawable/ic_setting_hash_verification"

View File

@ -4,7 +4,7 @@
<net.kdt.pojavlaunch.prefs.BackButtonPreference/> <net.kdt.pojavlaunch.prefs.BackButtonPreference/>
<PreferenceCategory android:title="Video settings" > <PreferenceCategory android:title="@string/preference_category_video" >
<androidx.preference.ListPreference <androidx.preference.ListPreference
android:title="@string/mcl_setting_category_renderer" android:title="@string/mcl_setting_category_renderer"
android:key="renderer" android:key="renderer"