Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd21fe7588 | ||
|
|
ea6cd92455 | ||
|
|
fd979288fe | ||
|
|
276dc3b62b | ||
|
|
c6c01f0486 | ||
|
|
74494cc74d | ||
|
|
a003439d6f | ||
|
|
1603cea76c | ||
|
|
293b2452c3 | ||
|
|
42160148e7 | ||
|
|
5cb1db6fee | ||
|
|
da2568a222 | ||
|
|
f613d730cb | ||
|
|
bd02d25c9d |
No files matched your search
@@ -1 +1,2 @@
|
||||
open_collective: pojavlauncher
|
||||
patreon: pojavlauncher
|
||||
@@ -90,7 +90,7 @@ configurations {
|
||||
android {
|
||||
namespace 'net.kdt.pojavlaunch'
|
||||
|
||||
compileSdk = 34
|
||||
compileSdk = 33
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
@@ -114,7 +114,7 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "net.kdt.pojavlaunch"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 34
|
||||
targetSdkVersion 33
|
||||
versionCode getDateSeconds()
|
||||
versionName getVersionName()
|
||||
multiDexEnabled true //important
|
||||
@@ -203,7 +203,7 @@ dependencies {
|
||||
implementation 'com.github.PojavLauncherTeam:portrait-sdp:ed33e89cbc'
|
||||
implementation 'com.github.PojavLauncherTeam:portrait-ssp:6c02fd739b'
|
||||
implementation 'com.github.Mathias-Boulay:ExtendedView:1.0.0'
|
||||
implementation 'com.github.Mathias-Boulay:android_gamepad_remapper:2.0.3'
|
||||
implementation 'com.github.Mathias-Boulay:android_gamepad_remapper:06184ddbce'
|
||||
implementation 'com.github.Mathias-Boulay:virtual-joystick-android:2e7aa25e50'
|
||||
|
||||
// implementation 'com.intuit.sdp:sdp-android:1.0.5'
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>
|
||||
|
||||
<application
|
||||
android:name=".PojavApplication"
|
||||
@@ -121,13 +119,10 @@
|
||||
</intent-filter>
|
||||
</provider>
|
||||
|
||||
<service android:name=".services.ProgressService"
|
||||
android:foregroundServiceType="dataSync"/>
|
||||
<service android:name=".services.GameService" android:process=":game"
|
||||
android:foregroundServiceType="specialUse">
|
||||
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||
android:value="This application is intended to run a 3rd-party piece of software which cannot be managed using the activity's saved instance state. This service is used for background persistence of this piece of software."/>
|
||||
</service>
|
||||
<service android:name=".services.ProgressService" />
|
||||
<service
|
||||
android:name=".services.GameService"
|
||||
android:process=":game" />
|
||||
</application>
|
||||
<queries>
|
||||
<package android:name="net.kdt.pojavlaunch.ffmpeg"/>
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
1720909595576
|
||||
1703946470579
|
||||
@@ -12,22 +12,6 @@ public class Architecture {
|
||||
public static final int ARCH_X86 = 0x4;
|
||||
public static final int ARCH_X86_64 = 0x8;
|
||||
|
||||
/* On both 32-bit ARM and x86, the top 1GB is reserved for kernel use. */
|
||||
public static final long ADDRESS_SPACE_LIMIT_32_BIT = 0xbfffffffL;
|
||||
/*
|
||||
* Technically, this is supposed to be 48 bits on x86_64, but nobody's allocating
|
||||
* 524288 terabytes of RAM on Pojav any time soon.
|
||||
*/
|
||||
public static final long ADDRESS_SPACE_LIMIT_64_BIT = 0x7fffffffffL;
|
||||
|
||||
/**
|
||||
* Get the highest byte accessible within the process's address space.
|
||||
* @return the highest byte accessible within the process's address space.
|
||||
*/
|
||||
public static long getAddressSpaceLimit() {
|
||||
return is64BitsDevice() ? ADDRESS_SPACE_LIMIT_64_BIT : ADDRESS_SPACE_LIMIT_32_BIT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell us if the device supports 64 bits architecture
|
||||
* @return If the device supports 64 bits architecture
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ public class EfficientAndroidLWJGLKeycode {
|
||||
sendKeyPress(getValueByIndex(index));
|
||||
}
|
||||
|
||||
public static short getValueByIndex(int index) {
|
||||
public static int getValueByIndex(int index) {
|
||||
return sLwjglKeycodes[index];
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.kdt.LoggerView;
|
||||
|
||||
@@ -186,7 +185,6 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
|
||||
try {
|
||||
File cacheFile = new File(getCacheDir(), "mod-installer-temp");
|
||||
InputStream contentStream = getContentResolver().openInputStream(uri);
|
||||
if(contentStream == null) throw new IOException("Failed to open content stream");
|
||||
try (FileOutputStream fileOutputStream = new FileOutputStream(cacheFile)) {
|
||||
IOUtils.copy(contentStream, fileOutputStream);
|
||||
}
|
||||
@@ -197,71 +195,23 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
|
||||
}
|
||||
}
|
||||
|
||||
public Runtime selectRuntime(File modFile) {
|
||||
int javaVersion = getJavaVersion(modFile);
|
||||
if(javaVersion == -1) {
|
||||
finalErrorDialog(getString(R.string.execute_jar_failed_to_read_file));
|
||||
return null;
|
||||
}
|
||||
String nearestRuntime = MultiRTUtils.getNearestJreName(javaVersion);
|
||||
if(nearestRuntime == null) {
|
||||
finalErrorDialog(getString(R.string.multirt_nocompatiblert, javaVersion));
|
||||
return null;
|
||||
}
|
||||
Runtime selectedRuntime = MultiRTUtils.forceReread(nearestRuntime);
|
||||
int selectedJavaVersion = Math.max(javaVersion, selectedRuntime.javaVersion);
|
||||
// Don't allow versions higher than Java 17 because our caciocavallo implementation does not allow for it
|
||||
if(selectedJavaVersion > 17) {
|
||||
finalErrorDialog(getString(R.string.execute_jar_incompatible_runtime, selectedJavaVersion));
|
||||
return null;
|
||||
}
|
||||
return selectedRuntime;
|
||||
}
|
||||
|
||||
private File findModPath(List<String> argList) {
|
||||
int argsSize = argList.size();
|
||||
for(int i = 0; i < argsSize; i++) {
|
||||
// Look for the -jar argument
|
||||
if(!argList.get(i).equals("-jar")) continue;
|
||||
int pathIndex = i+1;
|
||||
// Check if the supposed path is out of the argument bounds
|
||||
if(pathIndex >= argsSize) return null;
|
||||
// Use the path as a file
|
||||
return new File(argList.get(pathIndex));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void startModInstaller(File modFile, String javaArgs) {
|
||||
new Thread(() -> {
|
||||
// Maybe replace with more advanced arg parsing logic later
|
||||
List<String> argList = javaArgs != null ? Arrays.asList(javaArgs.split(" ")) : null;
|
||||
File selectedMod = modFile;
|
||||
if(selectedMod == null && argList != null) {
|
||||
// If modFile is not specified directly, try to extract the -jar argument from the javaArgs
|
||||
selectedMod = findModPath(argList);
|
||||
}
|
||||
Runtime selectedRuntime;
|
||||
if(selectedMod == null) {
|
||||
// We were unable to find out the path to the mod. In that case, use the default runtime.
|
||||
selectedRuntime = MultiRTUtils.forceReread(LauncherPreferences.PREF_DEFAULT_RUNTIME);
|
||||
}else {
|
||||
// Autoselect it properly in the other case.
|
||||
selectedRuntime = selectRuntime(selectedMod);
|
||||
// If the selection failed, just return. The autoselect function has already shown the dialog.
|
||||
if(selectedRuntime == null) return;
|
||||
}
|
||||
launchJavaRuntime(selectedRuntime, modFile, argList);
|
||||
Runtime runtime = pickJreForMod(modFile);
|
||||
launchJavaRuntime(runtime, modFile, javaArgs);
|
||||
}, "JREMainThread").start();
|
||||
}
|
||||
|
||||
private void finalErrorDialog(CharSequence msg) {
|
||||
runOnUiThread(()-> new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.global_error)
|
||||
.setMessage(msg)
|
||||
.setPositiveButton(android.R.string.ok, (d,w)->this.finish())
|
||||
.setCancelable(false)
|
||||
.show());
|
||||
private Runtime pickJreForMod(File modFile) {
|
||||
String jreName = LauncherPreferences.PREF_DEFAULT_RUNTIME;
|
||||
if(modFile != null) {
|
||||
int javaVersion = getJavaVersion(modFile);
|
||||
if(javaVersion != -1) {
|
||||
String autoselectRuntime = MultiRTUtils.getNearestJreName(javaVersion);
|
||||
if (autoselectRuntime != null) jreName = autoselectRuntime;
|
||||
}
|
||||
}
|
||||
return MultiRTUtils.forceReread(jreName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -351,20 +301,21 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
public void launchJavaRuntime(Runtime runtime, File modFile, List<String> javaArgs) {
|
||||
public void launchJavaRuntime(Runtime runtime, File modFile, String javaArgs) {
|
||||
JREUtils.redirectAndPrintJRELog();
|
||||
try {
|
||||
List<String> javaArgList = new ArrayList<>();
|
||||
|
||||
// Enable Caciocavallo
|
||||
Tools.getCacioJavaArgs(javaArgList,runtime.javaVersion == 8);
|
||||
if(javaArgs != null) {
|
||||
javaArgList.addAll(javaArgs);
|
||||
}
|
||||
if(modFile != null) {
|
||||
|
||||
if (javaArgs != null) {
|
||||
javaArgList.addAll(Arrays.asList(javaArgs.split(" ")));
|
||||
} else {
|
||||
javaArgList.add("-jar");
|
||||
javaArgList.add(modFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
if (LauncherPreferences.PREF_JAVA_SANDBOX) {
|
||||
Collections.reverse(javaArgList);
|
||||
@@ -423,7 +374,7 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
|
||||
Log.i("JavaGUILauncher", majorVersion+","+minorVersion);
|
||||
return classVersionToJavaVersion(majorVersion);
|
||||
}catch (Exception e) {
|
||||
Log.e("JavaVersion", "Exception thrown", e);
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import net.kdt.pojavlaunch.customcontrols.ControlLayout;
|
||||
import net.kdt.pojavlaunch.customcontrols.gamepad.DefaultDataProvider;
|
||||
import net.kdt.pojavlaunch.customcontrols.gamepad.Gamepad;
|
||||
import net.kdt.pojavlaunch.customcontrols.mouse.AbstractTouchpad;
|
||||
import net.kdt.pojavlaunch.customcontrols.mouse.AndroidPointerCapture;
|
||||
@@ -63,8 +62,7 @@ public class MinecraftGLSurface extends View implements GrabListener {
|
||||
.remapLeftShoulder(true)
|
||||
.remapRightShoulder(true)
|
||||
.remapLeftTrigger(true)
|
||||
.remapRightTrigger(true)
|
||||
.remapDpad(true));
|
||||
.remapRightTrigger(true));
|
||||
|
||||
/* Resolution scaler option, allow downsizing a window */
|
||||
private final float mScaleFactor = LauncherPreferences.PREF_SCALE_FACTOR/100f;
|
||||
@@ -204,10 +202,6 @@ public class MinecraftGLSurface extends View implements GrabListener {
|
||||
return mCurrentTouchProcessor.processTouchEvent(e);
|
||||
}
|
||||
|
||||
private void createGamepad(View contextView, InputDevice inputDevice) {
|
||||
mGamepad = new Gamepad(contextView, inputDevice, DefaultDataProvider.INSTANCE, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* The event for mouse/joystick movements
|
||||
*/
|
||||
@@ -217,7 +211,9 @@ public class MinecraftGLSurface extends View implements GrabListener {
|
||||
int mouseCursorIndex = -1;
|
||||
|
||||
if(Gamepad.isGamepadEvent(event)){
|
||||
if(mGamepad == null) createGamepad(this, event.getDevice());
|
||||
if(mGamepad == null){
|
||||
mGamepad = new Gamepad(this, event.getDevice());
|
||||
}
|
||||
|
||||
mInputManager.handleMotionEventInput(getContext(), event, mGamepad);
|
||||
return true;
|
||||
@@ -289,7 +285,9 @@ public class MinecraftGLSurface extends View implements GrabListener {
|
||||
}
|
||||
|
||||
if(Gamepad.isGamepadEvent(event)){
|
||||
if(mGamepad == null) createGamepad(this, event.getDevice());
|
||||
if(mGamepad == null){
|
||||
mGamepad = new Gamepad(this, event.getDevice());
|
||||
}
|
||||
|
||||
mInputManager.handleKeyEventInput(getContext(), event, mGamepad);
|
||||
return true;
|
||||
|
||||
@@ -47,87 +47,46 @@ public class NewJREUtil {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static InternalRuntime getInternalRuntime(Runtime runtime) {
|
||||
public static InternalRuntime getInternalRuntime(String s_runtime) {
|
||||
Runtime runtime = MultiRTUtils.read(s_runtime);
|
||||
if(runtime == null) return null;
|
||||
for(InternalRuntime internalRuntime : InternalRuntime.values()) {
|
||||
if(internalRuntime.name.equals(runtime.name)) return internalRuntime;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static MathUtils.RankedValue<Runtime> getNearestInstalledRuntime(int targetVersion) {
|
||||
List<Runtime> runtimes = MultiRTUtils.getRuntimes();
|
||||
return MathUtils.findNearestPositive(targetVersion, runtimes, (runtime)->runtime.javaVersion);
|
||||
}
|
||||
|
||||
private static MathUtils.RankedValue<InternalRuntime> getNearestInternalRuntime(int targetVersion) {
|
||||
private static InternalRuntime findAppropriateInternalRuntime(int targetVersion) {
|
||||
List<InternalRuntime> runtimeList = Arrays.asList(InternalRuntime.values());
|
||||
return MathUtils.findNearestPositive(targetVersion, runtimeList, (runtime)->runtime.majorVersion);
|
||||
}
|
||||
|
||||
|
||||
/** @return true if everything is good, false otherwise. */
|
||||
public static boolean installNewJreIfNeeded(Activity activity, JMinecraftVersionList.Version versionInfo) {
|
||||
//Now we have the reliable information to check if our runtime settings are good enough
|
||||
if (versionInfo.javaVersion == null || versionInfo.javaVersion.component.equalsIgnoreCase("jre-legacy"))
|
||||
return true;
|
||||
|
||||
int gameRequiredVersion = versionInfo.javaVersion.majorVersion;
|
||||
|
||||
LauncherProfiles.load();
|
||||
AssetManager assetManager = activity.getAssets();
|
||||
MinecraftProfile minecraftProfile = LauncherProfiles.getCurrentProfile();
|
||||
String profileRuntime = Tools.getSelectedRuntime(minecraftProfile);
|
||||
Runtime runtime = MultiRTUtils.read(profileRuntime);
|
||||
// Partly trust the user with his own selection, if the game can even try to run in this case
|
||||
if (runtime.javaVersion >= gameRequiredVersion) {
|
||||
// Check whether the selection is an internal runtime
|
||||
InternalRuntime internalRuntime = getInternalRuntime(runtime);
|
||||
// If it is, check if updates are available from the APK file
|
||||
if(internalRuntime != null) {
|
||||
// Not calling showRuntimeFail on failure here because we did, technically, find the compatible runtime
|
||||
return checkInternalRuntime(assetManager, internalRuntime);
|
||||
}
|
||||
String selectedRuntime = Tools.getSelectedRuntime(minecraftProfile);
|
||||
Runtime runtime = MultiRTUtils.read(selectedRuntime);
|
||||
if (runtime.javaVersion >= versionInfo.javaVersion.majorVersion) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the runtime version selected by the user is not appropriate for this version (which means the game won't run at all)
|
||||
// automatically pick from either an already installed runtime, or a runtime packed with the launcher
|
||||
MathUtils.RankedValue<?> nearestInstalledRuntime = getNearestInstalledRuntime(gameRequiredVersion);
|
||||
MathUtils.RankedValue<?> nearestInternalRuntime = getNearestInternalRuntime(gameRequiredVersion);
|
||||
|
||||
MathUtils.RankedValue<?> selectedRankedRuntime = MathUtils.objectMin(
|
||||
nearestInternalRuntime, nearestInstalledRuntime, (value)->value.rank
|
||||
);
|
||||
|
||||
// No possible selections
|
||||
if(selectedRankedRuntime == null) {
|
||||
showRuntimeFail(activity, versionInfo);
|
||||
return false;
|
||||
}
|
||||
|
||||
Object selected = selectedRankedRuntime.value;
|
||||
String appropriateRuntime;
|
||||
String appropriateRuntime = MultiRTUtils.getNearestJreName(versionInfo.javaVersion.majorVersion);
|
||||
boolean failOnMiss = false;
|
||||
InternalRuntime internalRuntime;
|
||||
|
||||
// Perform checks on the picked runtime
|
||||
if(selected instanceof Runtime) {
|
||||
// If it's an already installed runtime, save its name and check if
|
||||
// it's actually an internal one (just in case)
|
||||
Runtime selectedRuntime = (Runtime) selected;
|
||||
appropriateRuntime = selectedRuntime.name;
|
||||
internalRuntime = getInternalRuntime(selectedRuntime);
|
||||
} else if (selected instanceof InternalRuntime) {
|
||||
// If it's an internal runtime, set it's name as the appropriate one.
|
||||
internalRuntime = (InternalRuntime) selected;
|
||||
appropriateRuntime = internalRuntime.name;
|
||||
} else {
|
||||
throw new RuntimeException("Unexpected type of selected: "+selected.getClass().getName());
|
||||
if(appropriateRuntime == null) {
|
||||
internalRuntime = NewJREUtil.findAppropriateInternalRuntime(versionInfo.javaVersion.majorVersion);
|
||||
failOnMiss = true;
|
||||
}else {
|
||||
internalRuntime = NewJREUtil.getInternalRuntime(appropriateRuntime);
|
||||
}
|
||||
|
||||
// If it turns out the selected runtime is actually an internal one, attempt automatic installation or update
|
||||
if(internalRuntime != null && !checkInternalRuntime(assetManager, internalRuntime)) {
|
||||
// Not calling showRuntimeFail here because we did, technically, find the compatible runtime
|
||||
if((internalRuntime == null || !NewJREUtil.checkInternalRuntime(activity.getAssets(), internalRuntime)) && failOnMiss) {
|
||||
showRuntimeFail(activity, versionInfo);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,6 @@ import com.google.gson.GsonBuilder;
|
||||
import net.kdt.pojavlaunch.lifecycle.ContextExecutor;
|
||||
import net.kdt.pojavlaunch.lifecycle.ContextExecutorTask;
|
||||
import net.kdt.pojavlaunch.lifecycle.LifecycleAwareAlertDialog;
|
||||
import net.kdt.pojavlaunch.memory.MemoryHoleFinder;
|
||||
import net.kdt.pojavlaunch.memory.SelfMapsParser;
|
||||
import net.kdt.pojavlaunch.multirt.MultiRTUtils;
|
||||
import net.kdt.pojavlaunch.multirt.Runtime;
|
||||
import net.kdt.pojavlaunch.plugins.FFmpegPlugin;
|
||||
@@ -172,20 +170,9 @@ public final class Tools {
|
||||
public static void launchMinecraft(final AppCompatActivity activity, MinecraftAccount minecraftAccount,
|
||||
MinecraftProfile minecraftProfile, String versionId, int versionJavaRequirement) throws Throwable {
|
||||
int freeDeviceMemory = getFreeDeviceMemory(activity);
|
||||
int localeString;
|
||||
int freeAddressSpace = Architecture.is32BitsDevice() ? getMaxContinuousAddressSpaceSize() : -1;
|
||||
Log.i("MemStat", "Free RAM: " + freeDeviceMemory + " Addressable: " + freeAddressSpace);
|
||||
if(freeDeviceMemory > freeAddressSpace && freeAddressSpace != -1) {
|
||||
freeDeviceMemory = freeAddressSpace;
|
||||
localeString = R.string.address_memory_warning_msg;
|
||||
} else {
|
||||
localeString = R.string.memory_warning_msg;
|
||||
}
|
||||
|
||||
if(LauncherPreferences.PREF_RAM_ALLOCATION > freeDeviceMemory) {
|
||||
int finalDeviceMemory = freeDeviceMemory;
|
||||
LifecycleAwareAlertDialog.DialogCreator dialogCreator = (dialog, builder) ->
|
||||
builder.setMessage(activity.getString(localeString, finalDeviceMemory, LauncherPreferences.PREF_RAM_ALLOCATION))
|
||||
builder.setMessage(activity.getString(R.string.memory_warning_msg, freeDeviceMemory, LauncherPreferences.PREF_RAM_ALLOCATION))
|
||||
.setPositiveButton(android.R.string.ok, (d, w)->{});
|
||||
|
||||
if(LifecycleAwareAlertDialog.haltOnDialog(activity.getLifecycle(), activity, dialogCreator)) {
|
||||
@@ -936,23 +923,6 @@ public final class Tools {
|
||||
return (int) (memInfo.availMem / 1048576L);
|
||||
}
|
||||
|
||||
private static int internalGetMaxContinuousAddressSpaceSize() throws Exception{
|
||||
MemoryHoleFinder memoryHoleFinder = new MemoryHoleFinder();
|
||||
new SelfMapsParser(memoryHoleFinder).run();
|
||||
long largestHole = memoryHoleFinder.getLargestHole();
|
||||
if(largestHole == -1) return -1;
|
||||
else return (int)(largestHole / 1048576L);
|
||||
}
|
||||
|
||||
public static int getMaxContinuousAddressSpaceSize() {
|
||||
try {
|
||||
return internalGetMaxContinuousAddressSpaceSize();
|
||||
}catch (Exception e){
|
||||
Log.w("Tools", "Failed to find the largest uninterrupted address space");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getDisplayFriendlyRes(int displaySideRes, float scaling){
|
||||
displaySideRes *= scaling;
|
||||
if(displaySideRes % 2 != 0) displaySideRes --;
|
||||
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package net.kdt.pojavlaunch.customcontrols.gamepad;
|
||||
|
||||
import net.kdt.pojavlaunch.GrabListener;
|
||||
|
||||
import org.lwjgl.glfw.CallbackBridge;
|
||||
|
||||
public class DefaultDataProvider implements GamepadDataProvider {
|
||||
public static final DefaultDataProvider INSTANCE = new DefaultDataProvider();
|
||||
|
||||
// Cannot instantiate this class publicly
|
||||
private DefaultDataProvider() {}
|
||||
|
||||
@Override
|
||||
public GamepadMap getGameMap() {
|
||||
return GamepadMapStore.getGameMap();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GamepadMap getMenuMap() {
|
||||
return GamepadMapStore.getMenuMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGrabbing() {
|
||||
return CallbackBridge.isGrabbing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachGrabListener(GrabListener grabListener) {
|
||||
CallbackBridge.addGrabListener(grabListener);
|
||||
}
|
||||
}
|
||||
+31
-51
@@ -19,6 +19,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.math.MathUtils;
|
||||
@@ -26,6 +27,7 @@ import androidx.core.math.MathUtils;
|
||||
import net.kdt.pojavlaunch.GrabListener;
|
||||
import net.kdt.pojavlaunch.LwjglGlfwKeycode;
|
||||
import net.kdt.pojavlaunch.R;
|
||||
import net.kdt.pojavlaunch.Tools;
|
||||
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
||||
import net.kdt.pojavlaunch.utils.MCOptionUtils;
|
||||
|
||||
@@ -73,11 +75,12 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
private double mMouseAngle;
|
||||
private double mMouseSensitivity = 19;
|
||||
|
||||
private GamepadMap mGameMap;
|
||||
private GamepadMap mMenuMap;
|
||||
private GamepadMap mCurrentMap;
|
||||
private final GamepadMap mGameMap = GamepadMap.getDefaultGameMap();
|
||||
private final GamepadMap mMenuMap = GamepadMap.getDefaultMenuMap();
|
||||
private GamepadMap mCurrentMap = mGameMap;
|
||||
|
||||
private boolean isGrabbing;
|
||||
// The negation is to force trigger the onGrabState
|
||||
private boolean isGrabbing = !CallbackBridge.isGrabbing();
|
||||
|
||||
|
||||
/* Choreographer with time to compute delta on ticking */
|
||||
@@ -88,9 +91,7 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
@SuppressWarnings("FieldCanBeLocal") //the field is used in a WeakReference
|
||||
private final MCOptionUtils.MCOptionListener mGuiScaleListener = () -> notifyGUISizeChange(getMcScale());
|
||||
|
||||
private final GamepadDataProvider mMapProvider;
|
||||
|
||||
public Gamepad(View contextView, InputDevice inputDevice, GamepadDataProvider mapProvider, boolean showCursor){
|
||||
public Gamepad(View contextView, InputDevice inputDevice){
|
||||
Settings.setDeadzoneScale(PREF_DEADZONE_SCALE);
|
||||
|
||||
mScreenChoreographer = Choreographer.getInstance();
|
||||
@@ -119,34 +120,16 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
int size = (int) ((22 * getMcScale()) / mScaleFactor);
|
||||
mPointerImageView.setLayoutParams(new FrameLayout.LayoutParams(size, size));
|
||||
|
||||
mMapProvider = mapProvider;
|
||||
|
||||
CallbackBridge.sendCursorPos(CallbackBridge.windowWidth/2f, CallbackBridge.windowHeight/2f);
|
||||
|
||||
if(showCursor) {
|
||||
((ViewGroup)contextView.getParent()).addView(mPointerImageView);
|
||||
}
|
||||
|
||||
((ViewGroup)contextView.getParent()).addView(mPointerImageView);
|
||||
|
||||
placePointerView(CallbackBridge.physicalWidth/2, CallbackBridge.physicalHeight/2);
|
||||
|
||||
reloadGamepadMaps();
|
||||
mMapProvider.attachGrabListener(this);
|
||||
CallbackBridge.addGrabListener(this);
|
||||
}
|
||||
|
||||
|
||||
public void reloadGamepadMaps() {
|
||||
if(mGameMap != null) mGameMap.resetPressedState();
|
||||
if(mMenuMap != null) mMenuMap.resetPressedState();
|
||||
GamepadMapStore.load();
|
||||
mGameMap = mMapProvider.getGameMap();
|
||||
mMenuMap = mMapProvider.getMenuMap();
|
||||
mCurrentMap = mGameMap;
|
||||
// Force state refresh
|
||||
boolean currentGrab = CallbackBridge.isGrabbing();
|
||||
isGrabbing = !currentGrab;
|
||||
onGrabState(currentGrab);
|
||||
}
|
||||
|
||||
|
||||
public void updateJoysticks(){
|
||||
updateDirectionalJoystick();
|
||||
@@ -161,8 +144,8 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
}
|
||||
|
||||
|
||||
public static void sendInput(short[] keycodes, boolean isDown){
|
||||
for(short keycode : keycodes){
|
||||
public static void sendInput(int[] keycodes, boolean isDown){
|
||||
for(int keycode : keycodes){
|
||||
switch (keycode){
|
||||
case GamepadMap.MOUSE_SCROLL_DOWN:
|
||||
if(isDown) CallbackBridge.sendScroll(0, -1);
|
||||
@@ -170,23 +153,20 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
case GamepadMap.MOUSE_SCROLL_UP:
|
||||
if(isDown) CallbackBridge.sendScroll(0, 1);
|
||||
break;
|
||||
case GamepadMap.MOUSE_LEFT:
|
||||
sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown);
|
||||
break;
|
||||
case GamepadMap.MOUSE_MIDDLE:
|
||||
sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_MIDDLE, isDown);
|
||||
break;
|
||||
case GamepadMap.MOUSE_RIGHT:
|
||||
|
||||
case LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_RIGHT:
|
||||
sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
|
||||
break;
|
||||
case GamepadMap.UNSPECIFIED:
|
||||
case LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT:
|
||||
sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
sendKeyPress(keycode, CallbackBridge.getCurrentMods(), isDown);
|
||||
CallbackBridge.setModifiers(keycode, isDown);
|
||||
break;
|
||||
}
|
||||
CallbackBridge.setModifiers(keycode, isDown);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -281,32 +261,32 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
private static void sendDirectionalKeycode(int direction, boolean isDown, GamepadMap map){
|
||||
switch (direction){
|
||||
case DIRECTION_NORTH:
|
||||
map.DIRECTION_FORWARD.update(isDown);
|
||||
sendInput(map.DIRECTION_FORWARD, isDown);
|
||||
break;
|
||||
case DIRECTION_NORTH_EAST:
|
||||
map.DIRECTION_FORWARD.update(isDown);
|
||||
map.DIRECTION_RIGHT.update(isDown);
|
||||
sendInput(map.DIRECTION_FORWARD, isDown);
|
||||
sendInput(map.DIRECTION_RIGHT, isDown);
|
||||
break;
|
||||
case DIRECTION_EAST:
|
||||
map.DIRECTION_RIGHT.update(isDown);
|
||||
sendInput(map.DIRECTION_RIGHT, isDown);
|
||||
break;
|
||||
case DIRECTION_SOUTH_EAST:
|
||||
map.DIRECTION_RIGHT.update(isDown);
|
||||
map.DIRECTION_BACKWARD.update(isDown);
|
||||
sendInput(map.DIRECTION_RIGHT, isDown);
|
||||
sendInput(map.DIRECTION_BACKWARD, isDown);
|
||||
break;
|
||||
case DIRECTION_SOUTH:
|
||||
map.DIRECTION_BACKWARD.update(isDown);
|
||||
sendInput(map.DIRECTION_BACKWARD, isDown);
|
||||
break;
|
||||
case DIRECTION_SOUTH_WEST:
|
||||
map.DIRECTION_BACKWARD.update(isDown);
|
||||
map.DIRECTION_LEFT.update(isDown);
|
||||
sendInput(map.DIRECTION_BACKWARD, isDown);
|
||||
sendInput(map.DIRECTION_LEFT, isDown);
|
||||
break;
|
||||
case DIRECTION_WEST:
|
||||
map.DIRECTION_LEFT.update(isDown);
|
||||
sendInput(map.DIRECTION_LEFT, isDown);
|
||||
break;
|
||||
case DIRECTION_NORTH_WEST:
|
||||
map.DIRECTION_FORWARD.update(isDown);
|
||||
map.DIRECTION_LEFT.update(isDown);
|
||||
sendInput(map.DIRECTION_FORWARD, isDown);
|
||||
sendInput(map.DIRECTION_LEFT, isDown);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+33
-17
@@ -1,30 +1,46 @@
|
||||
package net.kdt.pojavlaunch.customcontrols.gamepad;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
|
||||
/**
|
||||
* This class corresponds to a button that does exist on the gamepad
|
||||
* Simple button able to store its state and some properties
|
||||
*/
|
||||
public class GamepadButton extends GamepadEmulatedButton {
|
||||
public class GamepadButton {
|
||||
|
||||
public int[] keycodes;
|
||||
public boolean isToggleable = false;
|
||||
private boolean mIsDown = false;
|
||||
private boolean mIsToggled = false;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDownStateChanged(boolean isDown) {
|
||||
if(isToggleable && isDown){
|
||||
mIsToggled = !mIsToggled;
|
||||
Gamepad.sendInput(keycodes, mIsToggled);
|
||||
return;
|
||||
}
|
||||
super.onDownStateChanged(isDown);
|
||||
public void update(KeyEvent event){
|
||||
boolean isKeyDown = (event.getAction() == KeyEvent.ACTION_DOWN);
|
||||
update(isKeyDown);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetButtonState() {
|
||||
if(!mIsDown && mIsToggled) {
|
||||
public void update(boolean isKeyDown){
|
||||
if(isKeyDown != mIsDown){
|
||||
mIsDown = isKeyDown;
|
||||
if(isToggleable){
|
||||
if(isKeyDown){
|
||||
mIsToggled = !mIsToggled;
|
||||
Gamepad.sendInput(keycodes, mIsToggled);
|
||||
}
|
||||
return;
|
||||
}
|
||||
Gamepad.sendInput(keycodes, mIsDown);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetButtonState(){
|
||||
if(mIsDown || mIsToggled){
|
||||
Gamepad.sendInput(keycodes, false);
|
||||
mIsToggled = false;
|
||||
} else {
|
||||
super.resetButtonState();
|
||||
}
|
||||
mIsDown = false;
|
||||
mIsToggled = false;
|
||||
}
|
||||
|
||||
public boolean isDown(){
|
||||
return isToggleable ? mIsToggled : mIsDown;
|
||||
}
|
||||
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
package net.kdt.pojavlaunch.customcontrols.gamepad;
|
||||
|
||||
import net.kdt.pojavlaunch.GrabListener;
|
||||
|
||||
public interface GamepadDataProvider {
|
||||
GamepadMap getMenuMap();
|
||||
GamepadMap getGameMap();
|
||||
boolean isGrabbing();
|
||||
void attachGrabListener(GrabListener grabListener);
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package net.kdt.pojavlaunch.customcontrols.gamepad;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
|
||||
/**
|
||||
* This class corresponds to a button that does not physically exist on the gamepad, but is
|
||||
* emulated from other inputs on it (like WASD directional keys)
|
||||
*/
|
||||
public class GamepadEmulatedButton {
|
||||
public short[] keycodes;
|
||||
protected boolean mIsDown = false;
|
||||
|
||||
public void update(KeyEvent event) {
|
||||
boolean isKeyDown = (event.getAction() == KeyEvent.ACTION_DOWN);
|
||||
update(isKeyDown);
|
||||
}
|
||||
|
||||
public void update(boolean isKeyDown){
|
||||
if(isKeyDown != mIsDown){
|
||||
mIsDown = isKeyDown;
|
||||
onDownStateChanged(mIsDown);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetButtonState() {
|
||||
if(mIsDown) Gamepad.sendInput(keycodes, false);
|
||||
mIsDown = false;
|
||||
}
|
||||
|
||||
protected void onDownStateChanged(boolean isDown) {
|
||||
Gamepad.sendInput(keycodes, mIsDown);
|
||||
}
|
||||
}
|
||||
+86
-102
@@ -4,16 +4,8 @@ import net.kdt.pojavlaunch.LwjglGlfwKeycode;
|
||||
|
||||
public class GamepadMap {
|
||||
|
||||
|
||||
public static final short MOUSE_SCROLL_DOWN = -1;
|
||||
public static final short MOUSE_SCROLL_UP = -2;
|
||||
// Made mouse keycodes their own specials because managing special keycodes above 0
|
||||
// proved to be complicated
|
||||
public static final short MOUSE_LEFT = -3;
|
||||
public static final short MOUSE_MIDDLE = -4;
|
||||
public static final short MOUSE_RIGHT = -5;
|
||||
// Workaround, because GLFW_KEY_UNKNOWN and GLFW_MOUSE_BUTTON_LEFT are both 0
|
||||
public static final short UNSPECIFIED = -6;
|
||||
public static final int MOUSE_SCROLL_DOWN = -1;
|
||||
public static final int MOUSE_SCROLL_UP = -2;
|
||||
|
||||
/*
|
||||
This class is just here to store the mapping
|
||||
@@ -22,11 +14,33 @@ public class GamepadMap {
|
||||
Be warned, you should define ALL keys if you want to avoid a non defined exception
|
||||
*/
|
||||
|
||||
public GamepadButton BUTTON_A, BUTTON_B, BUTTON_X, BUTTON_Y, BUTTON_START, BUTTON_SELECT,
|
||||
TRIGGER_RIGHT, TRIGGER_LEFT, SHOULDER_RIGHT, SHOULDER_LEFT, THUMBSTICK_RIGHT,
|
||||
THUMBSTICK_LEFT, DPAD_UP, DPAD_DOWN, DPAD_RIGHT, DPAD_LEFT;
|
||||
public final GamepadButton BUTTON_A = new GamepadButton();
|
||||
public final GamepadButton BUTTON_B = new GamepadButton();
|
||||
public final GamepadButton BUTTON_X = new GamepadButton();
|
||||
public final GamepadButton BUTTON_Y = new GamepadButton();
|
||||
|
||||
public final GamepadButton BUTTON_START = new GamepadButton();
|
||||
public final GamepadButton BUTTON_SELECT = new GamepadButton();
|
||||
|
||||
public final GamepadButton TRIGGER_RIGHT = new GamepadButton(); //R2
|
||||
public final GamepadButton TRIGGER_LEFT = new GamepadButton(); //L2
|
||||
|
||||
public final GamepadButton SHOULDER_RIGHT = new GamepadButton(); //R1
|
||||
public final GamepadButton SHOULDER_LEFT = new GamepadButton(); //L1
|
||||
|
||||
public int[] DIRECTION_FORWARD;
|
||||
public int[] DIRECTION_BACKWARD;
|
||||
public int[] DIRECTION_RIGHT;
|
||||
public int[] DIRECTION_LEFT;
|
||||
|
||||
public final GamepadButton THUMBSTICK_RIGHT = new GamepadButton(); //R3
|
||||
public final GamepadButton THUMBSTICK_LEFT = new GamepadButton(); //L3
|
||||
|
||||
public final GamepadButton DPAD_UP = new GamepadButton();
|
||||
public final GamepadButton DPAD_RIGHT = new GamepadButton();
|
||||
public final GamepadButton DPAD_DOWN = new GamepadButton();
|
||||
public final GamepadButton DPAD_LEFT = new GamepadButton();
|
||||
|
||||
public GamepadEmulatedButton DIRECTION_FORWARD, DIRECTION_BACKWARD, DIRECTION_RIGHT, DIRECTION_LEFT;
|
||||
|
||||
/*
|
||||
* Sets all buttons to a not pressed state, sending an input if needed
|
||||
@@ -56,70 +70,39 @@ public class GamepadMap {
|
||||
|
||||
}
|
||||
|
||||
private static GamepadMap createAndInitializeButtons() {
|
||||
GamepadMap gamepadMap = new GamepadMap();
|
||||
gamepadMap.BUTTON_A = new GamepadButton();
|
||||
gamepadMap.BUTTON_B = new GamepadButton();
|
||||
gamepadMap.BUTTON_X = new GamepadButton();
|
||||
gamepadMap.BUTTON_Y = new GamepadButton();
|
||||
|
||||
gamepadMap.BUTTON_START = new GamepadButton();
|
||||
gamepadMap.BUTTON_SELECT = new GamepadButton();
|
||||
|
||||
gamepadMap.TRIGGER_RIGHT = new GamepadButton();
|
||||
gamepadMap.TRIGGER_LEFT = new GamepadButton();
|
||||
|
||||
gamepadMap.SHOULDER_RIGHT = new GamepadButton();
|
||||
gamepadMap.SHOULDER_LEFT = new GamepadButton();
|
||||
|
||||
gamepadMap.DIRECTION_FORWARD = new GamepadEmulatedButton();
|
||||
gamepadMap.DIRECTION_BACKWARD = new GamepadEmulatedButton();
|
||||
gamepadMap.DIRECTION_RIGHT = new GamepadEmulatedButton();
|
||||
gamepadMap.DIRECTION_LEFT = new GamepadEmulatedButton();
|
||||
|
||||
gamepadMap.THUMBSTICK_RIGHT = new GamepadButton();
|
||||
gamepadMap.THUMBSTICK_LEFT = new GamepadButton();
|
||||
|
||||
gamepadMap.DPAD_UP = new GamepadButton();
|
||||
gamepadMap.DPAD_RIGHT = new GamepadButton();
|
||||
gamepadMap.DPAD_DOWN = new GamepadButton();
|
||||
gamepadMap.DPAD_LEFT = new GamepadButton();
|
||||
return gamepadMap;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a pre-done mapping used when the mouse is grabbed by the game.
|
||||
*/
|
||||
public static GamepadMap getDefaultGameMap(){
|
||||
GamepadMap gameMap = GamepadMap.createEmptyMap();
|
||||
GamepadMap gameMap = new GamepadMap();
|
||||
|
||||
gameMap.BUTTON_A.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_SPACE;
|
||||
gameMap.BUTTON_B.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_Q;
|
||||
gameMap.BUTTON_X.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_E;
|
||||
gameMap.BUTTON_Y.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_F;
|
||||
gameMap.BUTTON_A.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_SPACE};
|
||||
gameMap.BUTTON_B.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_Q};
|
||||
gameMap.BUTTON_X.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_E};
|
||||
gameMap.BUTTON_Y.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_F};
|
||||
|
||||
gameMap.DIRECTION_FORWARD.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_W;
|
||||
gameMap.DIRECTION_BACKWARD.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_S;
|
||||
gameMap.DIRECTION_RIGHT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_D;
|
||||
gameMap.DIRECTION_LEFT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_A;
|
||||
gameMap.DIRECTION_FORWARD = new int[]{LwjglGlfwKeycode.GLFW_KEY_W};
|
||||
gameMap.DIRECTION_BACKWARD = new int[]{LwjglGlfwKeycode.GLFW_KEY_S};
|
||||
gameMap.DIRECTION_RIGHT = new int[]{LwjglGlfwKeycode.GLFW_KEY_D};
|
||||
gameMap.DIRECTION_LEFT = new int[]{LwjglGlfwKeycode.GLFW_KEY_A};
|
||||
|
||||
gameMap.DPAD_UP.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_LEFT_SHIFT;
|
||||
gameMap.DPAD_DOWN.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_O; //For mods ?
|
||||
gameMap.DPAD_RIGHT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_K; //For mods ?
|
||||
gameMap.DPAD_LEFT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_J; //For mods ?
|
||||
gameMap.DPAD_UP.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_LEFT_SHIFT};
|
||||
gameMap.DPAD_DOWN.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_O}; //For mods ?
|
||||
gameMap.DPAD_RIGHT.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_K}; //For mods ?
|
||||
gameMap.DPAD_LEFT.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_J}; //For mods ?
|
||||
|
||||
gameMap.SHOULDER_LEFT.keycodes[0] = GamepadMap.MOUSE_SCROLL_UP;
|
||||
gameMap.SHOULDER_RIGHT.keycodes[0] = GamepadMap.MOUSE_SCROLL_DOWN;
|
||||
gameMap.SHOULDER_LEFT.keycodes = new int[]{GamepadMap.MOUSE_SCROLL_UP};
|
||||
gameMap.SHOULDER_RIGHT.keycodes = new int[]{GamepadMap.MOUSE_SCROLL_DOWN};
|
||||
|
||||
gameMap.TRIGGER_LEFT.keycodes[0] = GamepadMap.MOUSE_RIGHT;
|
||||
gameMap.TRIGGER_RIGHT.keycodes[0] = GamepadMap.MOUSE_LEFT;
|
||||
gameMap.TRIGGER_LEFT.keycodes = new int[]{LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_RIGHT};
|
||||
gameMap.TRIGGER_RIGHT.keycodes = new int[]{LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT};
|
||||
|
||||
gameMap.THUMBSTICK_LEFT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_LEFT_CONTROL;
|
||||
gameMap.THUMBSTICK_RIGHT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_LEFT_SHIFT;
|
||||
gameMap.THUMBSTICK_LEFT.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_LEFT_CONTROL};
|
||||
gameMap.THUMBSTICK_RIGHT.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_LEFT_SHIFT};
|
||||
gameMap.THUMBSTICK_RIGHT.isToggleable = true;
|
||||
|
||||
gameMap.BUTTON_START.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_ESCAPE;
|
||||
gameMap.BUTTON_SELECT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_TAB;
|
||||
gameMap.BUTTON_START.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_ESCAPE};
|
||||
gameMap.BUTTON_SELECT.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_TAB};
|
||||
|
||||
return gameMap;
|
||||
}
|
||||
@@ -128,63 +111,64 @@ public class GamepadMap {
|
||||
* Returns a pre-done mapping used when the mouse is NOT grabbed by the game.
|
||||
*/
|
||||
public static GamepadMap getDefaultMenuMap(){
|
||||
GamepadMap menuMap = GamepadMap.createEmptyMap();
|
||||
GamepadMap menuMap = new GamepadMap();
|
||||
|
||||
menuMap.BUTTON_A.keycodes[0] = GamepadMap.MOUSE_LEFT;
|
||||
menuMap.BUTTON_B.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_ESCAPE;
|
||||
menuMap.BUTTON_X.keycodes[0] = GamepadMap.MOUSE_RIGHT;
|
||||
{
|
||||
short[] keycodes = menuMap.BUTTON_Y.keycodes;
|
||||
keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_LEFT_SHIFT;
|
||||
keycodes[1] = GamepadMap.MOUSE_RIGHT;
|
||||
}
|
||||
menuMap.BUTTON_A.keycodes = new int[]{LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT};
|
||||
menuMap.BUTTON_B.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_ESCAPE};
|
||||
menuMap.BUTTON_X.keycodes = new int[]{LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_RIGHT};
|
||||
menuMap.BUTTON_Y.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_LEFT_SHIFT, LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_RIGHT}; //Oops, doesn't work since left shift isn't properly applied.
|
||||
|
||||
{
|
||||
short[] keycodes = menuMap.DIRECTION_FORWARD.keycodes;
|
||||
keycodes[0] = keycodes[1] = keycodes[2] = keycodes[3] = GamepadMap.MOUSE_SCROLL_UP;
|
||||
}
|
||||
{
|
||||
short[] keycodes = menuMap.DIRECTION_BACKWARD.keycodes;
|
||||
keycodes[0] = keycodes[1] = keycodes[2] = keycodes[3] = GamepadMap.MOUSE_SCROLL_DOWN;
|
||||
}
|
||||
menuMap.DIRECTION_FORWARD = new int[]{GamepadMap.MOUSE_SCROLL_UP, GamepadMap.MOUSE_SCROLL_UP, GamepadMap.MOUSE_SCROLL_UP, GamepadMap.MOUSE_SCROLL_UP, GamepadMap.MOUSE_SCROLL_UP};
|
||||
menuMap.DIRECTION_BACKWARD = new int[]{GamepadMap.MOUSE_SCROLL_DOWN, GamepadMap.MOUSE_SCROLL_DOWN, GamepadMap.MOUSE_SCROLL_DOWN, GamepadMap.MOUSE_SCROLL_DOWN, GamepadMap.MOUSE_SCROLL_DOWN};
|
||||
menuMap.DIRECTION_RIGHT = new int[]{};
|
||||
menuMap.DIRECTION_LEFT = new int[]{};
|
||||
|
||||
menuMap.DPAD_DOWN.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_O; //For mods ?
|
||||
menuMap.DPAD_RIGHT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_K; //For mods ?
|
||||
menuMap.DPAD_LEFT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_J; //For mods ?
|
||||
menuMap.DPAD_UP.keycodes = new int[]{};
|
||||
menuMap.DPAD_DOWN.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_O}; //For mods ?
|
||||
menuMap.DPAD_RIGHT.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_K}; //For mods ?
|
||||
menuMap.DPAD_LEFT.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_J}; //For mods ?
|
||||
|
||||
menuMap.SHOULDER_LEFT.keycodes[0] = GamepadMap.MOUSE_SCROLL_UP;
|
||||
menuMap.SHOULDER_RIGHT.keycodes[0] = GamepadMap.MOUSE_SCROLL_DOWN;
|
||||
menuMap.SHOULDER_LEFT.keycodes = new int[]{GamepadMap.MOUSE_SCROLL_UP};
|
||||
menuMap.SHOULDER_RIGHT.keycodes = new int[]{GamepadMap.MOUSE_SCROLL_DOWN};
|
||||
|
||||
menuMap.BUTTON_SELECT.keycodes[0] = LwjglGlfwKeycode.GLFW_KEY_ESCAPE;
|
||||
menuMap.TRIGGER_LEFT.keycodes = new int[]{};
|
||||
menuMap.TRIGGER_RIGHT.keycodes = new int[]{};
|
||||
|
||||
menuMap.THUMBSTICK_LEFT.keycodes = new int[]{};
|
||||
menuMap.THUMBSTICK_RIGHT.keycodes = new int[]{};
|
||||
|
||||
menuMap.BUTTON_START.keycodes = new int[]{LwjglGlfwKeycode.GLFW_KEY_ESCAPE};
|
||||
menuMap.BUTTON_SELECT.keycodes = new int[]{};
|
||||
|
||||
return menuMap;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns all GamepadEmulatedButtons of the controller key map.
|
||||
* Returns all GamepadButtons, does not include directional keys
|
||||
*/
|
||||
public GamepadEmulatedButton[] getButtons(){
|
||||
return new GamepadEmulatedButton[]{ BUTTON_A, BUTTON_B, BUTTON_X, BUTTON_Y,
|
||||
public GamepadButton[] getButtons(){
|
||||
return new GamepadButton[]{ BUTTON_A, BUTTON_B, BUTTON_X, BUTTON_Y,
|
||||
BUTTON_SELECT, BUTTON_START,
|
||||
TRIGGER_LEFT, TRIGGER_RIGHT,
|
||||
SHOULDER_LEFT, SHOULDER_RIGHT,
|
||||
THUMBSTICK_LEFT, THUMBSTICK_RIGHT,
|
||||
DPAD_UP, DPAD_RIGHT, DPAD_DOWN, DPAD_LEFT,
|
||||
DIRECTION_FORWARD, DIRECTION_BACKWARD,
|
||||
DIRECTION_LEFT, DIRECTION_RIGHT};
|
||||
DPAD_UP, DPAD_RIGHT, DPAD_DOWN, DPAD_LEFT};
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns an pre-initialized GamepadMap with only empty keycodes
|
||||
*/
|
||||
@SuppressWarnings("unused") public static GamepadMap createEmptyMap(){
|
||||
GamepadMap emptyMap = createAndInitializeButtons();
|
||||
for(GamepadEmulatedButton button : emptyMap.getButtons())
|
||||
button.keycodes = new short[] {UNSPECIFIED, UNSPECIFIED, UNSPECIFIED, UNSPECIFIED};
|
||||
@SuppressWarnings("unused") public static GamepadMap getEmptyMap(){
|
||||
GamepadMap emptyMap = new GamepadMap();
|
||||
for(GamepadButton button : emptyMap.getButtons())
|
||||
button.keycodes = new int[]{};
|
||||
|
||||
emptyMap.DIRECTION_LEFT = new int[]{};
|
||||
emptyMap.DIRECTION_FORWARD = new int[]{};
|
||||
emptyMap.DIRECTION_RIGHT = new int[]{};
|
||||
emptyMap.DIRECTION_BACKWARD = new int[]{};
|
||||
|
||||
return emptyMap;
|
||||
}
|
||||
|
||||
public static String[] getSpecialKeycodeNames() {
|
||||
return new String[] {"UNSPECIFIED", "MOUSE_RIGHT", "MOUSE_MIDDLE", "MOUSE_LEFT", "SCROLL_UP", "SCROLL_DOWN"};
|
||||
}
|
||||
}
|
||||
-60
@@ -1,60 +0,0 @@
|
||||
package net.kdt.pojavlaunch.customcontrols.gamepad;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonParseException;
|
||||
|
||||
import net.kdt.pojavlaunch.Tools;
|
||||
import net.kdt.pojavlaunch.utils.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class GamepadMapStore {
|
||||
private static final File STORE_FILE = new File(Tools.DIR_DATA, "gamepad_map.json");
|
||||
private static GamepadMapStore sMapStore;
|
||||
private GamepadMap mInMenuMap;
|
||||
private GamepadMap mInGameMap;
|
||||
private static GamepadMapStore createDefault() {
|
||||
GamepadMapStore mapStore = new GamepadMapStore();
|
||||
mapStore.mInGameMap = GamepadMap.getDefaultGameMap();
|
||||
mapStore.mInMenuMap = GamepadMap.getDefaultMenuMap();
|
||||
return mapStore;
|
||||
}
|
||||
|
||||
private static void loadIfNecessary() {
|
||||
if(sMapStore == null) return;
|
||||
load();
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
GamepadMapStore mapStore = null;
|
||||
if(STORE_FILE.exists() && STORE_FILE.canRead()) {
|
||||
try {
|
||||
String storeFileContent = Tools.read(STORE_FILE);
|
||||
mapStore = Tools.GLOBAL_GSON.fromJson(storeFileContent, GamepadMapStore.class);
|
||||
} catch (JsonParseException | IOException e) {
|
||||
Log.w("GamepadMapStore", "Map store failed to load!", e);
|
||||
}
|
||||
}
|
||||
if(mapStore == null) mapStore = createDefault();
|
||||
sMapStore = mapStore;
|
||||
}
|
||||
|
||||
public static void save() throws IOException {
|
||||
if(sMapStore == null) throw new RuntimeException("Must load map store first!");
|
||||
FileUtils.ensureParentDirectory(STORE_FILE);
|
||||
String jsonData = Tools.GLOBAL_GSON.toJson(sMapStore);
|
||||
Tools.write(STORE_FILE.getAbsolutePath(), jsonData);
|
||||
}
|
||||
|
||||
public static GamepadMap getGameMap() {
|
||||
loadIfNecessary();
|
||||
return sMapStore.mInGameMap;
|
||||
}
|
||||
|
||||
public static GamepadMap getMenuMap() {
|
||||
loadIfNecessary();
|
||||
return sMapStore.mInMenuMap;
|
||||
}
|
||||
}
|
||||
-313
@@ -1,313 +0,0 @@
|
||||
package net.kdt.pojavlaunch.customcontrols.gamepad;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import net.kdt.pojavlaunch.EfficientAndroidLWJGLKeycode;
|
||||
import net.kdt.pojavlaunch.GrabListener;
|
||||
import net.kdt.pojavlaunch.R;
|
||||
import net.kdt.pojavlaunch.Tools;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
public class GamepadMapperAdapter extends RecyclerView.Adapter<GamepadMapperAdapter.ViewHolder> implements GamepadDataProvider {
|
||||
private static final int BUTTON_COUNT = 20;
|
||||
|
||||
private GamepadMap mSimulatedGamepadMap;
|
||||
private RebinderButton[] mRebinderButtons;
|
||||
private GamepadEmulatedButton[] mRealButtons;
|
||||
private final ArrayAdapter<String> mKeyAdapter;
|
||||
private final int mSpecialKeycodeCount;
|
||||
private GrabListener mGamepadGrabListener;
|
||||
private boolean mGrabState = false;
|
||||
private boolean mOldState = false;
|
||||
|
||||
public GamepadMapperAdapter(Context context) {
|
||||
GamepadMapStore.load();
|
||||
mKeyAdapter = new ArrayAdapter<>(context, R.layout.item_centered_textview_large);
|
||||
String[] specialKeycodeNames = GamepadMap.getSpecialKeycodeNames();
|
||||
mSpecialKeycodeCount = specialKeycodeNames.length;
|
||||
mKeyAdapter.addAll(specialKeycodeNames);
|
||||
mKeyAdapter.addAll(EfficientAndroidLWJGLKeycode.generateKeyName());
|
||||
createRebinderMap();
|
||||
updateRealButtons();
|
||||
}
|
||||
|
||||
private void createRebinderMap() {
|
||||
mRebinderButtons = new RebinderButton[BUTTON_COUNT];
|
||||
mRealButtons = new GamepadEmulatedButton[BUTTON_COUNT];
|
||||
mSimulatedGamepadMap = new GamepadMap();
|
||||
int index = 0;
|
||||
mSimulatedGamepadMap.BUTTON_A = mRebinderButtons[index++] = new RebinderButton(R.drawable.button_a, R.string.controller_button_a);
|
||||
mSimulatedGamepadMap.BUTTON_B = mRebinderButtons[index++] = new RebinderButton(R.drawable.button_b, R.string.controller_button_b);
|
||||
mSimulatedGamepadMap.BUTTON_X = mRebinderButtons[index++] = new RebinderButton(R.drawable.button_x, R.string.controller_button_x);
|
||||
mSimulatedGamepadMap.BUTTON_Y = mRebinderButtons[index++] = new RebinderButton(R.drawable.button_y, R.string.controller_button_y);
|
||||
mSimulatedGamepadMap.BUTTON_START = mRebinderButtons[index++] = new RebinderButton(R.drawable.button_start, R.string.controller_button_start);
|
||||
mSimulatedGamepadMap.BUTTON_SELECT = mRebinderButtons[index++] = new RebinderButton(R.drawable.button_select, R.string.controller_button_select);
|
||||
mSimulatedGamepadMap.TRIGGER_RIGHT = mRebinderButtons[index++] = new RebinderButton(R.drawable.trigger_right, R.string.controller_button_trigger_right);
|
||||
mSimulatedGamepadMap.TRIGGER_LEFT = mRebinderButtons[index++] = new RebinderButton(R.drawable.trigger_left, R.string.controller_button_trigger_left);
|
||||
mSimulatedGamepadMap.SHOULDER_RIGHT = mRebinderButtons[index++] = new RebinderButton(R.drawable.shoulder_right, R.string.controller_button_shoulder_right);
|
||||
mSimulatedGamepadMap.SHOULDER_LEFT = mRebinderButtons[index++] = new RebinderButton(R.drawable.shoulder_left, R.string.controller_button_shoulder_left);
|
||||
mSimulatedGamepadMap.DIRECTION_FORWARD = mRebinderButtons[index++] = new RebinderButton(R.drawable.stick_right, R.string.controller_direction_forward);
|
||||
mSimulatedGamepadMap.DIRECTION_RIGHT = mRebinderButtons[index++] = new RebinderButton(R.drawable.stick_right, R.string.controller_direction_right);
|
||||
mSimulatedGamepadMap.DIRECTION_LEFT = mRebinderButtons[index++] = new RebinderButton(R.drawable.stick_right, R.string.controller_direction_left);
|
||||
mSimulatedGamepadMap.DIRECTION_BACKWARD = mRebinderButtons[index++] = new RebinderButton(R.drawable.stick_right, R.string.controller_direction_backward);
|
||||
mSimulatedGamepadMap.THUMBSTICK_RIGHT = mRebinderButtons[index++] = new RebinderButton(R.drawable.stick_right_click, R.string.controller_stick_press_r);
|
||||
mSimulatedGamepadMap.THUMBSTICK_LEFT = mRebinderButtons[index++] = new RebinderButton(R.drawable.stick_left_click, R.string.controller_stick_press_l);
|
||||
mSimulatedGamepadMap.DPAD_UP = mRebinderButtons[index++] = new RebinderButton(R.drawable.dpad_up, R.string.controller_dpad_up);
|
||||
mSimulatedGamepadMap.DPAD_DOWN = mRebinderButtons[index++] = new RebinderButton(R.drawable.dpad_down, R.string.controller_dpad_down);
|
||||
mSimulatedGamepadMap.DPAD_RIGHT = mRebinderButtons[index++] = new RebinderButton(R.drawable.dpad_right, R.string.controller_dpad_right);
|
||||
mSimulatedGamepadMap.DPAD_LEFT = mRebinderButtons[index] = new RebinderButton(R.drawable.dpad_left, R.string.controller_dpad_left);
|
||||
}
|
||||
|
||||
private void updateRealButtons() {
|
||||
GamepadMap currentRealMap = mGrabState ? GamepadMapStore.getGameMap() : GamepadMapStore.getMenuMap();
|
||||
int index = 0;
|
||||
mRealButtons[index++] = currentRealMap.BUTTON_A;
|
||||
mRealButtons[index++] = currentRealMap.BUTTON_B;
|
||||
mRealButtons[index++] = currentRealMap.BUTTON_X;
|
||||
mRealButtons[index++] = currentRealMap.BUTTON_Y;
|
||||
mRealButtons[index++] = currentRealMap.BUTTON_START;
|
||||
mRealButtons[index++] = currentRealMap.BUTTON_SELECT;
|
||||
mRealButtons[index++] = currentRealMap.TRIGGER_RIGHT;
|
||||
mRealButtons[index++] = currentRealMap.TRIGGER_LEFT;
|
||||
mRealButtons[index++] = currentRealMap.SHOULDER_RIGHT;
|
||||
mRealButtons[index++] = currentRealMap.SHOULDER_LEFT;
|
||||
mRealButtons[index++] = currentRealMap.DIRECTION_FORWARD;
|
||||
mRealButtons[index++] = currentRealMap.DIRECTION_RIGHT;
|
||||
mRealButtons[index++] = currentRealMap.DIRECTION_LEFT;
|
||||
mRealButtons[index++] = currentRealMap.DIRECTION_BACKWARD;
|
||||
mRealButtons[index++] = currentRealMap.THUMBSTICK_RIGHT;
|
||||
mRealButtons[index++] = currentRealMap.THUMBSTICK_LEFT;
|
||||
mRealButtons[index++] = currentRealMap.DPAD_UP;
|
||||
mRealButtons[index++] = currentRealMap.DPAD_DOWN;
|
||||
mRealButtons[index++] = currentRealMap.DPAD_RIGHT;
|
||||
mRealButtons[index] = currentRealMap.DPAD_LEFT;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
|
||||
View view = layoutInflater.inflate(R.layout.item_controller_mapping, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.attach(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull ViewHolder holder) {
|
||||
super.onViewRecycled(holder);
|
||||
holder.detach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mRebinderButtons.length;
|
||||
}
|
||||
|
||||
private void updateStickIcons() {
|
||||
// Which stick is used for keyboard emulation depends on grab state, so we need
|
||||
// to update the mapper UI icons accordingly
|
||||
int stickIcon = mGrabState ? R.drawable.stick_left : R.drawable.stick_right;
|
||||
((RebinderButton)mSimulatedGamepadMap.DIRECTION_FORWARD).iconResourceId = stickIcon;
|
||||
((RebinderButton)mSimulatedGamepadMap.DIRECTION_BACKWARD).iconResourceId = stickIcon;
|
||||
((RebinderButton)mSimulatedGamepadMap.DIRECTION_RIGHT).iconResourceId = stickIcon;
|
||||
((RebinderButton)mSimulatedGamepadMap.DIRECTION_LEFT).iconResourceId = stickIcon;
|
||||
}
|
||||
|
||||
private static class RebinderButton extends GamepadButton {
|
||||
public int iconResourceId;
|
||||
public final int localeResourceId;
|
||||
private GamepadMapperAdapter.ViewHolder mButtonHolder;
|
||||
|
||||
public RebinderButton(int iconResourceId, int localeResourceId) {
|
||||
this.iconResourceId = iconResourceId;
|
||||
this.localeResourceId = localeResourceId;
|
||||
}
|
||||
|
||||
public void changeViewHolder(GamepadMapperAdapter.ViewHolder viewHolder) {
|
||||
mButtonHolder = viewHolder;
|
||||
if(mButtonHolder != null) mButtonHolder.setPressed(mIsDown);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDownStateChanged(boolean isDown) {
|
||||
if(mButtonHolder == null) return;
|
||||
mButtonHolder.setPressed(isDown);
|
||||
}
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements AdapterView.OnItemSelectedListener, View.OnClickListener {
|
||||
private static final int COLOR_ACTIVE_BUTTON = 0x2000FF00;
|
||||
private final Context mContext;
|
||||
private final ImageView mButtonIcon;
|
||||
private final ImageView mExpansionIndicator;
|
||||
private final Spinner[] mKeySpinners;
|
||||
private final View mExpandedView;
|
||||
private final TextView mKeycodeLabel;
|
||||
private int mAttachedPosition = -1;
|
||||
private short[] mKeycodes;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mContext = itemView.getContext();
|
||||
mButtonIcon = itemView.findViewById(R.id.controller_mapper_button);
|
||||
mExpandedView = itemView.findViewById(R.id.controller_mapper_expanded_view);
|
||||
mExpansionIndicator = itemView.findViewById(R.id.controller_mapper_expand_button);
|
||||
mKeycodeLabel = itemView.findViewById(R.id.controller_mapper_keycode_label);
|
||||
View defaultView = itemView.findViewById(R.id.controller_mapper_default_view);
|
||||
defaultView.setOnClickListener(this);
|
||||
mKeySpinners = new Spinner[4];
|
||||
mKeySpinners[0] = itemView.findViewById(R.id.controller_mapper_key_spinner1);
|
||||
mKeySpinners[1] = itemView.findViewById(R.id.controller_mapper_key_spinner2);
|
||||
mKeySpinners[2] = itemView.findViewById(R.id.controller_mapper_key_spinner3);
|
||||
mKeySpinners[3] = itemView.findViewById(R.id.controller_mapper_key_spinner4);
|
||||
for(Spinner spinner : mKeySpinners) {
|
||||
spinner.setAdapter(mKeyAdapter);
|
||||
spinner.setOnItemSelectedListener(this);
|
||||
}
|
||||
}
|
||||
private void attach(int index) {
|
||||
RebinderButton rebinderButton = mRebinderButtons[index];
|
||||
mExpandedView.setVisibility(View.GONE);
|
||||
mButtonIcon.setImageResource(rebinderButton.iconResourceId);
|
||||
String buttonName = mContext.getString(rebinderButton.localeResourceId);
|
||||
mButtonIcon.setContentDescription(buttonName);
|
||||
rebinderButton.changeViewHolder(this);
|
||||
|
||||
GamepadEmulatedButton realButton = mRealButtons[index];
|
||||
|
||||
mKeycodes = realButton.keycodes;
|
||||
|
||||
int spinnerIndex;
|
||||
|
||||
// Populate spinners with known keycodes until we run out of keycodes
|
||||
for(spinnerIndex = 0; spinnerIndex < mKeycodes.length; spinnerIndex++) {
|
||||
Spinner keySpinner = mKeySpinners[spinnerIndex];
|
||||
keySpinner.setEnabled(true);
|
||||
short keyCode = mKeycodes[spinnerIndex];
|
||||
int selected;
|
||||
if(keyCode < 0) selected = keyCode + mSpecialKeycodeCount;
|
||||
else selected = EfficientAndroidLWJGLKeycode.getIndexByValue(keyCode) + mSpecialKeycodeCount;
|
||||
keySpinner.setSelection(selected);
|
||||
}
|
||||
// In case if there is too much spinners, disable the rest of them
|
||||
for(;spinnerIndex < mKeySpinners.length; spinnerIndex++) {
|
||||
mKeySpinners[spinnerIndex].setEnabled(false);
|
||||
}
|
||||
updateKeycodeLabel();
|
||||
|
||||
mAttachedPosition = index;
|
||||
}
|
||||
private void detach() {
|
||||
mRebinderButtons[mAttachedPosition].changeViewHolder(null);
|
||||
mAttachedPosition = -1;
|
||||
}
|
||||
private void setPressed(boolean pressed) {
|
||||
itemView.setBackgroundColor(pressed ? COLOR_ACTIVE_BUTTON : Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
private void updateKeycodeLabel() {
|
||||
StringBuilder labelBuilder = new StringBuilder();
|
||||
boolean first = true;
|
||||
int unspecifiedPosition = GamepadMap.UNSPECIFIED + mSpecialKeycodeCount;
|
||||
for (Spinner keySpinner : mKeySpinners) {
|
||||
if (keySpinner.getSelectedItemPosition() == unspecifiedPosition) continue;
|
||||
if (!first) labelBuilder.append(" + ");
|
||||
else first = false;
|
||||
labelBuilder.append(keySpinner.getSelectedItem().toString());
|
||||
}
|
||||
if(labelBuilder.length() == 0) labelBuilder.append(mKeyAdapter.getItem(unspecifiedPosition));
|
||||
mKeycodeLabel.setText(labelBuilder.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int selectionIndex, long selectionId) {
|
||||
if(mAttachedPosition == -1) return;
|
||||
int editedKeycodeIndex = -1;
|
||||
for(int i = 0; i < mKeySpinners.length && i < mKeycodes.length; i++) {
|
||||
if(!adapterView.equals(mKeySpinners[i])) continue;
|
||||
editedKeycodeIndex = i;
|
||||
break;
|
||||
}
|
||||
if(editedKeycodeIndex == -1) return;
|
||||
int keycode_offset = selectionIndex - mSpecialKeycodeCount;
|
||||
if(selectionIndex <= mSpecialKeycodeCount) mKeycodes[editedKeycodeIndex] = (short) (keycode_offset);
|
||||
else mKeycodes[editedKeycodeIndex] = EfficientAndroidLWJGLKeycode.getValueByIndex(keycode_offset);
|
||||
updateKeycodeLabel();
|
||||
try {
|
||||
GamepadMapStore.save();
|
||||
}catch (Exception e) {
|
||||
Tools.showError(adapterView.getContext(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int visibility = mExpandedView.getVisibility();
|
||||
switch (visibility) {
|
||||
case View.INVISIBLE:
|
||||
case View.GONE:
|
||||
mExpansionIndicator.setRotation(0);
|
||||
mExpandedView.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case View.VISIBLE:
|
||||
mExpansionIndicator.setRotation(180);
|
||||
mExpandedView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GamepadMap getMenuMap() {
|
||||
return mSimulatedGamepadMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GamepadMap getGameMap() {
|
||||
return mSimulatedGamepadMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGrabbing() {
|
||||
return mGrabState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachGrabListener(GrabListener grabListener) {
|
||||
mGamepadGrabListener = grabListener;
|
||||
grabListener.onGrabState(mGrabState);
|
||||
}
|
||||
|
||||
// Cannot do it another way
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public void setGrabState(boolean newState) {
|
||||
mGrabState = newState;
|
||||
if(mGamepadGrabListener != null) mGamepadGrabListener.onGrabState(newState);
|
||||
if(mGrabState == mOldState) return;
|
||||
updateRealButtons();
|
||||
updateStickIcons();
|
||||
notifyDataSetChanged();
|
||||
mOldState = mGrabState;
|
||||
}
|
||||
}
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
package net.kdt.pojavlaunch.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import net.kdt.pojavlaunch.R;
|
||||
import net.kdt.pojavlaunch.customcontrols.gamepad.Gamepad;
|
||||
import net.kdt.pojavlaunch.customcontrols.gamepad.GamepadMapperAdapter;
|
||||
|
||||
import fr.spse.gamepad_remapper.RemapperManager;
|
||||
import fr.spse.gamepad_remapper.RemapperView;
|
||||
|
||||
public class GamepadMapperFragment extends Fragment implements
|
||||
View.OnKeyListener, View.OnGenericMotionListener, AdapterView.OnItemSelectedListener {
|
||||
public static final String TAG = "GamepadMapperFragment";
|
||||
private final RemapperView.Builder mRemapperViewBuilder = new RemapperView.Builder(null)
|
||||
.remapA(true)
|
||||
.remapB(true)
|
||||
.remapX(true)
|
||||
.remapY(true)
|
||||
.remapLeftJoystick(true)
|
||||
.remapRightJoystick(true)
|
||||
.remapStart(true)
|
||||
.remapSelect(true)
|
||||
.remapLeftShoulder(true)
|
||||
.remapRightShoulder(true)
|
||||
.remapLeftTrigger(true)
|
||||
.remapRightTrigger(true)
|
||||
.remapDpad(true);
|
||||
private final Handler mExitHandler = new Handler(Looper.getMainLooper());
|
||||
private final Runnable mExitRunnable = () -> {
|
||||
Activity activity = getActivity();
|
||||
if(activity == null) return;
|
||||
activity.onBackPressed();
|
||||
};
|
||||
private RemapperManager mInputManager;
|
||||
private GamepadMapperAdapter mMapperAdapter;
|
||||
private Gamepad mGamepad;
|
||||
public GamepadMapperFragment() {
|
||||
super(R.layout.fragment_controller_remapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
RecyclerView buttonRecyclerView = view.findViewById(R.id.gamepad_remapper_recycler);
|
||||
mMapperAdapter = new GamepadMapperAdapter(view.getContext());
|
||||
buttonRecyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
|
||||
buttonRecyclerView.setAdapter(mMapperAdapter);
|
||||
buttonRecyclerView.setOnKeyListener(this);
|
||||
buttonRecyclerView.setOnGenericMotionListener(this);
|
||||
buttonRecyclerView.requestFocus();
|
||||
mInputManager = new RemapperManager(view.getContext(), mRemapperViewBuilder);
|
||||
Spinner grabStateSpinner = view.findViewById(R.id.gamepad_remapper_mode_spinner);
|
||||
ArrayAdapter<String> mGrabStateAdapter = new ArrayAdapter<>(view.getContext(), R.layout.support_simple_spinner_dropdown_item);
|
||||
mGrabStateAdapter.addAll(getString(R.string.customctrl_visibility_in_menus), getString(R.string.customctrl_visibility_ingame));
|
||||
grabStateSpinner.setAdapter(mGrabStateAdapter);
|
||||
grabStateSpinner.setSelection(0);
|
||||
grabStateSpinner.setOnItemSelectedListener(this);
|
||||
}
|
||||
|
||||
private void createGamepad(View mainView, InputDevice inputDevice) {
|
||||
mGamepad = new Gamepad(mainView, inputDevice, mMapperAdapter, false) {
|
||||
@Override
|
||||
public void handleGamepadInput(int keycode, float value) {
|
||||
if(keycode == KeyEvent.KEYCODE_BUTTON_SELECT) {
|
||||
handleExitButton(value > 0.5);
|
||||
}
|
||||
super.handleGamepadInput(keycode, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void handleExitButton(boolean isPressed) {
|
||||
if(isPressed) mExitHandler.postDelayed(mExitRunnable, 400);
|
||||
else mExitHandler.removeCallbacks(mExitRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKey(View view, int i, KeyEvent keyEvent) {
|
||||
View mainView = getView();
|
||||
if(!Gamepad.isGamepadEvent(keyEvent) || mainView == null) return false;
|
||||
if(mGamepad == null) createGamepad(mainView, keyEvent.getDevice());
|
||||
mInputManager.handleKeyEventInput(mainView.getContext(), keyEvent, mGamepad);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onGenericMotion(View view, MotionEvent motionEvent) {
|
||||
View mainView = getView();
|
||||
if(!Gamepad.isGamepadEvent(motionEvent) || mainView == null) return false;
|
||||
if(mGamepad == null) createGamepad(mainView, motionEvent.getDevice());
|
||||
mInputManager.handleMotionEventInput(mainView.getContext(), motionEvent, mGamepad);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
boolean grab = i == 1;
|
||||
mMapperAdapter.setGrabState(grab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ public class MainMenuFragment extends Fragment {
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
Button mNewsButton = view.findViewById(R.id.news_button);
|
||||
Button mDiscordButton = view.findViewById(R.id.discord_button);
|
||||
Button mCustomControlButton = view.findViewById(R.id.custom_control_button);
|
||||
Button mInstallJarButton = view.findViewById(R.id.install_jar_button);
|
||||
Button mShareLogsButton = view.findViewById(R.id.share_logs_button);
|
||||
@@ -44,7 +43,6 @@ public class MainMenuFragment extends Fragment {
|
||||
mVersionSpinner = view.findViewById(R.id.mc_version_spinner);
|
||||
|
||||
mNewsButton.setOnClickListener(v -> Tools.openURL(requireActivity(), Tools.URL_HOME));
|
||||
mDiscordButton.setOnClickListener(v -> Tools.openURL(requireActivity(), getString(R.string.discord_invite)));
|
||||
mCustomControlButton.setOnClickListener(v -> startActivity(new Intent(requireContext(), CustomControlsActivity.class)));
|
||||
mInstallJarButton.setOnClickListener(v -> runInstallerWithConfirmation(false));
|
||||
mInstallJarButton.setOnLongClickListener(v->{
|
||||
@@ -58,7 +56,7 @@ public class MainMenuFragment extends Fragment {
|
||||
mShareLogsButton.setOnClickListener((v) -> shareLog(requireContext()));
|
||||
|
||||
mNewsButton.setOnLongClickListener((v)->{
|
||||
Tools.swapFragment(requireActivity(), GamepadMapperFragment.class, GamepadMapperFragment.TAG, null);
|
||||
Tools.swapFragment(requireActivity(), SearchModFragment.class, SearchModFragment.TAG, null);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package net.kdt.pojavlaunch.memory;
|
||||
|
||||
import net.kdt.pojavlaunch.Architecture;
|
||||
|
||||
public class MemoryHoleFinder implements SelfMapsParser.Callback {
|
||||
private long mPreviousEnd = 0;
|
||||
private long mLargestHole = -1;
|
||||
private final long mAddressingLimit = Architecture.getAddressSpaceLimit();
|
||||
@Override
|
||||
public boolean process(long begin, long end, String wholeLine) {
|
||||
if(begin >= mAddressingLimit) begin = mAddressingLimit;
|
||||
long holeSize = begin - mPreviousEnd;
|
||||
if(mLargestHole < holeSize) mLargestHole = holeSize;
|
||||
if(begin == mAddressingLimit) return false;
|
||||
mPreviousEnd = end;
|
||||
return true;
|
||||
}
|
||||
|
||||
public long getLargestHole() {
|
||||
return mLargestHole;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package net.kdt.pojavlaunch.memory;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class SelfMapsParser {
|
||||
private final Callback mCallback;
|
||||
public SelfMapsParser(Callback callback) {
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
public void run() throws IOException, NumberFormatException {
|
||||
try (FileInputStream fileInputStream = new FileInputStream("/proc/self/maps")) {
|
||||
Scanner scanner = new Scanner(fileInputStream);
|
||||
while(scanner.hasNextLine()) {
|
||||
if(!forEachLine(scanner.nextLine())) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean forEachLine(String line) throws NumberFormatException {
|
||||
int firstSpaceIndex = line.indexOf(' ');
|
||||
String addresses = line.substring(0, firstSpaceIndex);
|
||||
String[] addressArray = addresses.split("-");
|
||||
if(addressArray.length < 2) return true;
|
||||
long begin = Long.parseLong(addressArray[0], 16);
|
||||
long end = Long.parseLong(addressArray[1], 16);
|
||||
return mCallback.process(begin, end, line);
|
||||
}
|
||||
|
||||
public interface Callback {
|
||||
boolean process(long startAddress, long endAddress, String wholeLine);
|
||||
}
|
||||
}
|
||||
@@ -61,9 +61,7 @@ public class MultiRTUtils {
|
||||
|
||||
public static String getNearestJreName(int majorVersion) {
|
||||
List<Runtime> runtimes = getRuntimes();
|
||||
MathUtils.RankedValue<Runtime> nearestRankedRuntime = MathUtils.findNearestPositive(majorVersion, runtimes, (runtime)->runtime.javaVersion);
|
||||
if(nearestRankedRuntime == null) return null;
|
||||
Runtime nearestRuntime = nearestRankedRuntime.value;
|
||||
Runtime nearestRuntime = MathUtils.findNearestPositive(majorVersion, runtimes, (runtime)->runtime.javaVersion);
|
||||
if(nearestRuntime == null) return null;
|
||||
return nearestRuntime.name;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package net.kdt.pojavlaunch.services;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
@@ -45,13 +43,7 @@ public class GameService extends Service {
|
||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel, getString(R.string.notification_terminate), pendingKillIntent)
|
||||
.setSmallIcon(R.drawable.notif_icon)
|
||||
.setNotificationSilent();
|
||||
|
||||
Notification notification = notificationBuilder.build();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_GAME_SERVICE, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST);
|
||||
} else {
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_GAME_SERVICE, notification);
|
||||
}
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_GAME_SERVICE, notificationBuilder.build());
|
||||
return START_NOT_STICKY; // non-sticky so android wont try restarting the game after the user uses the "Quit" button
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package net.kdt.pojavlaunch.services;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.Process;
|
||||
@@ -66,12 +64,7 @@ public class ProgressService extends Service implements TaskCountListener {
|
||||
}
|
||||
Log.d("ProgressService", "Started!");
|
||||
mNotificationBuilder.setContentText(getString(R.string.progresslayout_tasks_in_progress, ProgressKeeper.getTaskCount()));
|
||||
Notification notification = mNotificationBuilder.build();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_PROGRESS_SERVICE, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST);
|
||||
} else {
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_PROGRESS_SERVICE, notification);
|
||||
}
|
||||
startForeground(NotificationUtils.NOTIFICATION_ID_PROGRESS_SERVICE, mNotificationBuilder.build());
|
||||
if(ProgressKeeper.getTaskCount() < 1) stopSelf();
|
||||
else ProgressKeeper.addTaskCountListener(this, false);
|
||||
|
||||
|
||||
@@ -293,18 +293,12 @@ public class JREUtils {
|
||||
purgeArg(userArgs, "-XX:+UseLargePagesInMetaspace");
|
||||
purgeArg(userArgs, "-XX:+UseLargePages");
|
||||
purgeArg(userArgs, "-Dorg.lwjgl.opengl.libname");
|
||||
// Don't let the user specify a custom Freetype library (as the user is unlikely to specify a version compiled for Android)
|
||||
purgeArg(userArgs, "-Dorg.lwjgl.freetype.libname");
|
||||
|
||||
//Add automatically generated args
|
||||
userArgs.add("-Xms" + LauncherPreferences.PREF_RAM_ALLOCATION + "M");
|
||||
userArgs.add("-Xmx" + LauncherPreferences.PREF_RAM_ALLOCATION + "M");
|
||||
if(LOCAL_RENDERER != null) userArgs.add("-Dorg.lwjgl.opengl.libname=" + graphicsLib);
|
||||
|
||||
// Force LWJGL to use the Freetype library intended for it, instead of using the one
|
||||
// that we ship with Java (since it may be older than what's needed)
|
||||
userArgs.add("-Dorg.lwjgl.freetype.libname="+ NATIVE_LIB_DIR+"/libfreetype.so");
|
||||
|
||||
userArgs.addAll(JVMArgs);
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, activity.getString(R.string.autoram_info_msg,LauncherPreferences.PREF_RAM_ALLOCATION), Toast.LENGTH_SHORT).show());
|
||||
System.out.println(JVMArgs);
|
||||
|
||||
@@ -21,11 +21,11 @@ public class MathUtils {
|
||||
* @param targetValue the target value
|
||||
* @param objects the list of objects that the search will be performed on
|
||||
* @param valueProvider the provider for each values
|
||||
* @return the RankedValue that wraps the object which has the closest value to targetValue, or null if values of all
|
||||
* @return the object which has the closest value to targetValue, or null if values of all
|
||||
* objects are less than targetValue
|
||||
* @param <T> the object type that is used for the search.
|
||||
*/
|
||||
public static <T> RankedValue<T> findNearestPositive(int targetValue, List<T> objects, ValueProvider<T> valueProvider) {
|
||||
public static <T> T findNearestPositive(int targetValue, List<T> objects, ValueProvider<T> valueProvider) {
|
||||
int delta = Integer.MAX_VALUE;
|
||||
T selectedObject = null;
|
||||
for(T object : objects) {
|
||||
@@ -33,47 +33,16 @@ public class MathUtils {
|
||||
if(objectValue < targetValue) continue;
|
||||
|
||||
int currentDelta = objectValue - targetValue;
|
||||
if(currentDelta == 0) return new RankedValue<>(object, 0);
|
||||
if(currentDelta == 0) return object;
|
||||
if(currentDelta >= delta) continue;
|
||||
|
||||
selectedObject = object;
|
||||
delta = currentDelta;
|
||||
}
|
||||
if(selectedObject == null) return null;
|
||||
return new RankedValue<>(selectedObject, delta);
|
||||
return selectedObject;
|
||||
}
|
||||
|
||||
public interface ValueProvider<T> {
|
||||
int getValue(T object);
|
||||
}
|
||||
|
||||
public static final class RankedValue<T> {
|
||||
public final T value;
|
||||
public final int rank;
|
||||
public RankedValue(T value, int rank) {
|
||||
this.value = value;
|
||||
this.rank = rank;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Out of two objects, select one with the lowest value.
|
||||
* @param object1 Object 1 for comparsion
|
||||
* @param object2 Object 2 for comparsion
|
||||
* @param valueProvider Value provider for the objects
|
||||
* @return If value of object 1 is lower than or equal to object 2, returns object 1
|
||||
* Otherwise, returns object 2
|
||||
* @param <T> Type of objects
|
||||
*/
|
||||
public static <T> T objectMin(T object1, T object2, ValueProvider<T> valueProvider) {
|
||||
if(object1 == null) return object2;
|
||||
if(object2 == null) return object1;
|
||||
int value1 = valueProvider.getValue(object1);
|
||||
int value2 = valueProvider.getValue(object2);
|
||||
if(value1 <= value2) {
|
||||
return object1;
|
||||
} else {
|
||||
return object2;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Executable → Regular
BIN
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable → Regular
BIN
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable → Regular
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable → Regular
BIN
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="67dp" android:viewportHeight="96.36" android:viewportWidth="127.14" android:width="88.40162dp">
|
||||
|
||||
<path android:fillColor="#5865f2" android:pathData="M107.7,8.07A105.15,105.15 0,0 0,81.47 0a72.06,72.06 0,0 0,-3.36 6.83A97.68,97.68 0,0 0,49 6.83,72.37 72.37,0 0,0 45.64,0 105.89,105.89 0,0 0,19.39 8.09C2.79,32.65 -1.71,56.6 0.54,80.21h0A105.73,105.73 0,0 0,32.71 96.36,77.7 77.7,0 0,0 39.6,85.25a68.42,68.42 0,0 1,-10.85 -5.18c0.91,-0.66 1.8,-1.34 2.66,-2a75.57,75.57 0,0 0,64.32 0c0.87,0.71 1.76,1.39 2.66,2a68.68,68.68 0,0 1,-10.87 5.19,77 77,0 0,0 6.89,11.1A105.25,105.25 0,0 0,126.6 80.22h0C129.24,52.84 122.09,29.11 107.7,8.07ZM42.45,65.69C36.18,65.69 31,60 31,53s5,-12.74 11.43,-12.74S54,46 53.89,53 48.84,65.69 42.45,65.69ZM84.69,65.69C78.41,65.69 73.25,60 73.25,53s5,-12.74 11.44,-12.74S96.23,46 96.12,53 91.08,65.69 84.69,65.69Z"/>
|
||||
|
||||
</vector>
|
||||
@@ -19,49 +19,20 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/center_guideline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.kdt.mcgui.LauncherMenuButton
|
||||
android:id="@+id/news_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:drawableStart="@drawable/ic_menu_news"
|
||||
android:text="@string/mcl_tab_wiki"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/social_divider"/>
|
||||
<View
|
||||
android:id="@+id/social_divider"
|
||||
android:layout_width="@dimen/padding_tiny"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/divider"
|
||||
android:layout_marginVertical="@dimen/padding_heavy"
|
||||
app:layout_constraintTop_toTopOf="@id/news_button"
|
||||
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
||||
app:layout_constraintEnd_toEndOf="@id/center_guideline"
|
||||
app:layout_constraintBottom_toBottomOf="@id/news_button"/>
|
||||
<com.kdt.mcgui.LauncherMenuButton
|
||||
android:id="@+id/discord_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:drawableStart="@drawable/ic_discord"
|
||||
android:text="@string/mcl_button_discord"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/social_divider"/>
|
||||
android:text="@string/mcl_tab_wiki" />
|
||||
|
||||
<com.kdt.mcgui.LauncherMenuButton
|
||||
android:id="@+id/custom_control_button"
|
||||
@@ -71,8 +42,7 @@
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:drawableStart="@drawable/ic_menu_custom_controls"
|
||||
android:text="@string/mcl_option_customcontrol"
|
||||
app:layout_constraintTop_toBottomOf="@id/news_button"/>
|
||||
android:text="@string/mcl_option_customcontrol" />
|
||||
|
||||
<com.kdt.mcgui.LauncherMenuButton
|
||||
android:id="@+id/install_jar_button"
|
||||
@@ -82,8 +52,7 @@
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:drawableStart="@drawable/ic_menu_install_jar"
|
||||
android:text="@string/main_install_jar_file"
|
||||
app:layout_constraintTop_toBottomOf="@id/custom_control_button"/>
|
||||
android:text="@string/main_install_jar_file" />
|
||||
|
||||
<com.kdt.mcgui.LauncherMenuButton
|
||||
android:id="@+id/share_logs_button"
|
||||
@@ -93,9 +62,8 @@
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:drawableStart="@android:drawable/ic_menu_share"
|
||||
android:text="@string/main_share_logs"
|
||||
app:layout_constraintTop_toBottomOf="@id/install_jar_button"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
android:text="@string/main_share_logs" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@
|
||||
android:id="@+id/visibility_textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/customctrl_visibility_title"
|
||||
android:text="Visibility"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editButtonOpacity_seekbar"
|
||||
tools:layout_editor_absoluteX="6dp" />
|
||||
|
||||
@@ -491,14 +491,14 @@
|
||||
android:id="@+id/visibility_game_checkbox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/customctrl_visibility_ingame"
|
||||
android:text="In game"
|
||||
app:layout_constraintTop_toBottomOf="@+id/visibility_textview" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/visibility_menu_checkbox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/customctrl_visibility_in_menus"
|
||||
android:text="In Menu"
|
||||
app:layout_constraintTop_toBottomOf="@+id/visibility_game_checkbox" />
|
||||
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background_app">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toTopOf="@+id/gamepad_remapper_recycler"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline4"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:text="@string/controller_remapper_exit_part1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView2"
|
||||
android:layout_width="30sp"
|
||||
android:layout_height="30sp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="@string/controller_button_select"
|
||||
app:srcCompat="@drawable/button_select" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:text="@string/controller_remapper_exit_part2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/gamepad_remapper_mode_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="@dimen/padding_heavy"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/guideline4"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gamepad_remapper_mode_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/controller_remapper_operating_mode"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/gamepad_remapper_mode_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/gamepad_remapper_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/padding_heavy"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/gamepad_remapper_mode_container" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -15,48 +15,20 @@
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/mc_version_spinner">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/center_guideline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<com.kdt.mcgui.LauncherMenuButton
|
||||
android:id="@+id/news_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_66sdp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
|
||||
android:text="@string/mcl_tab_wiki"
|
||||
android:drawableStart="@drawable/ic_menu_news"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/social_divider" />
|
||||
<View
|
||||
android:id="@+id/social_divider"
|
||||
android:layout_width="@dimen/padding_tiny"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/divider"
|
||||
android:layout_marginVertical="@dimen/padding_large"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/center_guideline"
|
||||
app:layout_constraintEnd_toEndOf="@id/center_guideline"
|
||||
app:layout_constraintBottom_toBottomOf="@id/news_button"/>
|
||||
<com.kdt.mcgui.LauncherMenuButton
|
||||
android:id="@+id/discord_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/_66sdp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
|
||||
android:text="@string/mcl_button_discord"
|
||||
android:drawableStart="@drawable/ic_discord"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/social_divider"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
/>
|
||||
|
||||
<com.kdt.mcgui.LauncherMenuButton
|
||||
android:id="@+id/custom_control_button"
|
||||
@@ -90,7 +62,7 @@
|
||||
|
||||
app:layout_constraintTop_toBottomOf="@id/install_jar_button"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
<com.kdt.mcgui.mcVersionSpinner
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
style="?android:attr/spinnerItemStyle"
|
||||
android:singleLine="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="inherit"
|
||||
android:gravity="center"
|
||||
android:minHeight="48dp"/>
|
||||
@@ -1,141 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/controller_mapper_default_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true">
|
||||
|
||||
<!-- Content description is set in ViewHolder -->
|
||||
<ImageView
|
||||
android:id="@+id/controller_mapper_button"
|
||||
android:layout_width="55dp"
|
||||
android:layout_height="55dp"
|
||||
android:layout_marginStart="@dimen/padding_moderate"
|
||||
android:layout_marginTop="@dimen/padding_small"
|
||||
android:layout_marginBottom="@dimen/padding_small"
|
||||
android:focusable="false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/button_a"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/controller_mapper_expand_button"
|
||||
android:layout_width="@dimen/padding_large"
|
||||
android:layout_height="@dimen/padding_large"
|
||||
android:layout_marginEnd="@dimen/padding_heavy"
|
||||
android:rotation="180"
|
||||
android:focusable="false"
|
||||
android:contentDescription="@string/controller_remapper_expand_entry"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/spinner_arrow" />
|
||||
<!-- Set in code -->
|
||||
<TextView
|
||||
android:id="@+id/controller_mapper_keycode_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/padding_large"
|
||||
android:maxLines="2"
|
||||
android:minLines="1"
|
||||
android:singleLine="false"
|
||||
android:ellipsize="end"
|
||||
tools:text="MOUSE_LEFT"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/controller_mapper_expand_button"
|
||||
app:layout_constraintStart_toEndOf="@+id/controller_mapper_button"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/controller_mapper_expanded_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/padding_medium"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/controller_mapper_key_spinner1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginHorizontal="@dimen/padding_moderate"
|
||||
android:background="@null"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/controller_mapper_plus_label1" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/controller_mapper_key_spinner2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginHorizontal="@dimen/padding_moderate"
|
||||
android:background="@null"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/controller_mapper_plus_label1"
|
||||
/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/controller_mapper_key_spinner3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="@dimen/padding_moderate"
|
||||
android:layout_marginHorizontal="@dimen/padding_moderate"
|
||||
android:background="@null"
|
||||
app:layout_constraintTop_toBottomOf="@id/controller_mapper_key_spinner1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/controller_mapper_plus_label2"/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/controller_mapper_key_spinner4"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="@dimen/padding_moderate"
|
||||
android:layout_marginHorizontal="@dimen/padding_moderate"
|
||||
android:background="@null"
|
||||
app:layout_constraintTop_toBottomOf="@id/controller_mapper_key_spinner2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/controller_mapper_plus_label2"/>
|
||||
|
||||
<!-- A single "plus" sign does not need translation -->
|
||||
<TextView
|
||||
android:id="@+id/controller_mapper_plus_label1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="+"
|
||||
android:textColor="@color/primary_text"
|
||||
app:layout_constraintBottom_toBottomOf="@id/controller_mapper_key_spinner1"
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline3"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline3"
|
||||
app:layout_constraintTop_toTopOf="@id/controller_mapper_key_spinner1"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_mapper_plus_label2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="+"
|
||||
android:textColor="@color/primary_text"
|
||||
app:layout_constraintBottom_toBottomOf="@id/controller_mapper_key_spinner3"
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline3"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline3"
|
||||
app:layout_constraintTop_toTopOf="@id/controller_mapper_key_spinner3"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -329,5 +329,4 @@
|
||||
<string name="newdl_starting">Чтение метаданных игры…</string>
|
||||
<string name="newdl_downloading_metadata">Загрузка метаданных игры (%s)</string>
|
||||
<string name="newdl_downloading_game_files">Загрузка файлов… (%d/%d, %.2f МБ)</string>
|
||||
<string name="discord_invite" translatable="false">https://discord.gg/pojavlauncher-sng-962263126647144449</string>
|
||||
</resources>
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
<color name="minebutton_color">#57CC33</color>
|
||||
<color name="background_app">#181818</color>
|
||||
<color name="divider">@color/background_overlay</color>
|
||||
<color name="background_overlay">#464646</color>
|
||||
<color name="background_status_bar">#242424</color>
|
||||
<color name="background_bottom_bar">#232323</color>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||
<resources>
|
||||
<!-- App name part -->
|
||||
<string name="app_name">PojavLauncher (Minecraft: Java Edition for Android)</string>
|
||||
<string name="app_short_name">PojavLauncher</string>
|
||||
@@ -172,7 +172,6 @@
|
||||
<string name="customctrl_forward_lock">Forward lock</string>
|
||||
<string name="customctrl_absolute_tracking">Absolute finger tracking</string>
|
||||
<string name="memory_warning_msg">The current amount of free RAM (%d) is lower than allocated RAM (%d), which may lead to crashes. Change the allocation if the game crashes.</string>
|
||||
<string name="address_memory_warning_msg">The current amount of free addressable RAM space (%d) is lower than the allocated RAM (%d), which will lead to crashes. Change the allocation if the game crashes.</string>
|
||||
<string name="mcl_memory_allocation">Memory allocation</string>
|
||||
<string name="mcl_memory_allocation_subtitle">Controls how much memory is given to Minecraft.</string>
|
||||
<string name="multirt_runtime_corrupt">Corrupted Java Runtime</string>
|
||||
@@ -185,7 +184,7 @@
|
||||
<string name="multirt_config_setdefault">Set default</string>
|
||||
<string name="multirt_config_setdefault_already">Default</string>
|
||||
<string name="multirt_config_removeerror_last">You must have at least one Java Runtime installed.</string>
|
||||
<string name="multirt_nocompatiblert">Can\'t find any compatible Java Runtime. This version requires Java %d or newer.</string>
|
||||
<string name="multirt_nocompatiblert">Can\'t find any compartible Java Runtime. This version requires Java %d or newer.</string>
|
||||
<string name="multirt_nojava8rt">Can\'t find Java 8. In order to use this option, you need to install Java 8.</string>
|
||||
<string name="multirt_delete_runtime">Delete runtime</string>
|
||||
<string name="pvc_gameDirectory">Game directory</string>
|
||||
@@ -382,37 +381,4 @@
|
||||
<string name="log_view_button_output_off">Output\nOFF</string>
|
||||
<string name="log_view_button_output_on">Output\nON</string>
|
||||
<string name="log_view_label_log_output">Log output:</string>
|
||||
<string name="execute_jar_failed_to_read_file">Failed to read the .jar file</string>
|
||||
<string name="execute_jar_incompatible_runtime">Execute .jar feature is not compatible with Java %d</string>
|
||||
<string name="controller_button_a">A</string>
|
||||
<string name="controller_button_b">B</string>
|
||||
<string name="controller_button_x">X</string>
|
||||
<string name="controller_button_y">Y</string>
|
||||
<string name="controller_button_start">Start</string>
|
||||
<string name="controller_button_select">Select</string>
|
||||
<string name="controller_button_trigger_left">Left Trigger</string>
|
||||
<string name="controller_button_trigger_right">Right Trigger</string>
|
||||
<string name="controller_button_shoulder_left">Left Shoulder</string>
|
||||
<string name="controller_button_shoulder_right">Right Shoulder</string>
|
||||
<string name="controller_direction_forward">Stick Up</string>
|
||||
<string name="controller_direction_backward">Stick Down</string>
|
||||
<string name="controller_direction_left">Stick Left</string>
|
||||
<string name="controller_direction_right">Stick Right</string>
|
||||
<string name="controller_stick_press_l">Left Thumbstick (click)</string>
|
||||
<string name="controller_stick_press_r">Right Thumbstick (click)</string>
|
||||
<string name="controller_dpad_up">D-Pad Up</string>
|
||||
<string name="controller_dpad_down">D-Pad Down</string>
|
||||
<string name="controller_dpad_left">D-Pad Left</string>
|
||||
<string name="controller_dpad_right">D-Pad Right</string>
|
||||
<string name="controller_remapper_exit_part1">Hold</string>
|
||||
<string name="controller_remapper_exit_part2">to exit</string>
|
||||
<string name="controller_remapper_operating_mode">Current mode</string>
|
||||
<string name="customctrl_visibility_title">Visibility</string>
|
||||
<string name="customctrl_visibility_ingame">In-game</string>
|
||||
<string name="customctrl_visibility_in_menus">In menus</string>
|
||||
<string name="controller_remapper_expand_entry">Expand to change keycodes</string>
|
||||
<string name="preference_remap_controller_title">Change controller key bindings</string>
|
||||
<string name="preference_remap_controller_description">Allows you to modify the keyboard keys bound to each controller button</string>
|
||||
<string name="mcl_button_discord">Discord</string>
|
||||
<string name="discord_invite" translatable="false">https://discord.gg/pojavlauncher-724163890803638273</string>
|
||||
</resources>
|
||||
@@ -132,10 +132,6 @@
|
||||
<PreferenceCategory
|
||||
android:title="@string/preference_category_controller_settings"
|
||||
>
|
||||
<Preference
|
||||
android:title="@string/preference_remap_controller_title"
|
||||
android:summary="@string/preference_remap_controller_description"
|
||||
android:fragment="net.kdt.pojavlaunch.fragments.GamepadMapperFragment"/>
|
||||
<net.kdt.pojavlaunch.prefs.GamepadRemapPreference
|
||||
android:title="@string/preference_wipe_controller_title"
|
||||
android:summary="@string/preference_wipe_controller_description"
|
||||
@@ -147,7 +143,6 @@
|
||||
app2:showSeekBarValue="true"
|
||||
app2:seekBarIncrement="5"
|
||||
/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
|
||||
@@ -3,5 +3,3 @@ org.gradle.configureondemand=true
|
||||
|
||||
android.useAndroidX=true
|
||||
android.bundle.language.enableSplit=false
|
||||
# Increase Gradle daemon RAM allocation
|
||||
org.gradle.jvmargs=-Xmx4096M
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user