profiles;
@@ -41,11 +43,6 @@ public static boolean isBuiltinProfile(ControlsProfile profile) {
return profile != null && profile.id <= LAST_BUILTIN_PROFILE_ID;
}
- public static boolean isLegacyLabelOnlyProfile(ControlsProfile profile) {
- if (profile == null) return false;
- return profile.id == LEGACY_PS_PROFILE_ID || profile.id == LEGACY_XBOX_PROFILE_ID;
- }
-
public InputControlsManager(Context context) {
this.context = context;
}
@@ -124,6 +121,14 @@ private void copyAssetProfilesIfNeeded() {
.putInt("inputcontrols_asset_sync_revision", ASSET_PROFILE_SYNC_REVISION)
.apply();
+ for (int id : RETIRED_PROFILE_IDS) {
+ ControlsProfile.getProfileFile(context, id).delete();
+ getBackupFile(context, id).delete();
+ }
+ for (int id : REFRESHED_PROFILE_IDS) {
+ ControlsProfile.getProfileFile(context, id).delete();
+ }
+
try {
AssetManager assetManager = context.getAssets();
String[] assetFiles = assetManager.list("inputcontrols/profiles");
diff --git a/app/src/main/runtime/input/controls/LabelTheme.java b/app/src/main/runtime/input/controls/LabelTheme.java
deleted file mode 100644
index 73404a9e4..000000000
--- a/app/src/main/runtime/input/controls/LabelTheme.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package com.winlator.cmod.runtime.input.controls;
-
-import android.graphics.Color;
-import com.winlator.cmod.runtime.input.ui.InputControlsView;
-
-public enum LabelTheme {
- DEFAULT,
- XBOX,
- PLAYSTATION;
-
- public static LabelTheme fromPreference(String name) {
- if (name == null) return DEFAULT;
- try {
- return LabelTheme.valueOf(name);
- } catch (IllegalArgumentException e) {
- return DEFAULT;
- }
- }
-
- public static String[] displayNames() {
- return new String[] {"Original", "Xbox", "PlayStation"};
- }
-
- public int colorFor(InputControlsView view, Binding binding) {
- if (this == DEFAULT || binding == null || view == null) return 0;
- InputControlsManager manager = view.getInputControlsManager();
- if (manager == null) return 0;
-
- int profileId = -1;
- if (this == XBOX) {
- profileId = InputControlsManager.LEGACY_XBOX_PROFILE_ID;
- } else if (this == PLAYSTATION) {
- profileId = InputControlsManager.LEGACY_PS_PROFILE_ID;
- }
-
- if (profileId != -1) {
- ControlsProfile p = manager.getProfile(profileId);
- if (p != null) {
- if (!p.isElementsLoaded()) p.loadElements(view);
- int color = p.findColorForBinding(binding);
- if (color != -1) return color;
- }
- }
-
- switch (this) {
- case XBOX:
- switch (binding) {
- case GAMEPAD_BUTTON_A:
- return 0xFF22A348; // Xbox green
- case GAMEPAD_BUTTON_B:
- return 0xFFE13C3C; // Xbox red
- case GAMEPAD_BUTTON_X:
- return 0xFF1976D2; // Xbox blue
- case GAMEPAD_BUTTON_Y:
- return 0xFFE9B007; // Xbox yellow
- default:
- return 0;
- }
- case PLAYSTATION:
- switch (binding) {
- case GAMEPAD_BUTTON_A:
- return 0xFF5C8DEC; // Cross — blue
- case GAMEPAD_BUTTON_B:
- return 0xFFE34A4A; // Circle — red
- case GAMEPAD_BUTTON_X:
- return 0xFFD66ED1; // Square — pink/magenta
- case GAMEPAD_BUTTON_Y:
- return 0xFF34BFA0; // Triangle — teal
- default:
- return 0;
- }
- default:
- return 0;
- }
- }
-
- public String labelFor(Binding binding) {
- if (this == DEFAULT || binding == null) return null;
- switch (this) {
- case XBOX:
- switch (binding) {
- case GAMEPAD_BUTTON_A:
- return "A";
- case GAMEPAD_BUTTON_B:
- return "B";
- case GAMEPAD_BUTTON_X:
- return "X";
- case GAMEPAD_BUTTON_Y:
- return "Y";
- case GAMEPAD_BUTTON_L1:
- return "LB";
- case GAMEPAD_BUTTON_R1:
- return "RB";
- case GAMEPAD_BUTTON_L2:
- return "LT";
- case GAMEPAD_BUTTON_R2:
- return "RT";
- case GAMEPAD_BUTTON_L3:
- return "L3";
- case GAMEPAD_BUTTON_R3:
- return "R3";
- case GAMEPAD_BUTTON_START:
- return "≡";
- case GAMEPAD_BUTTON_SELECT:
- return "❐";
- default:
- return null;
- }
- case PLAYSTATION:
- switch (binding) {
- case GAMEPAD_BUTTON_A:
- return "✕";
- case GAMEPAD_BUTTON_B:
- return "○";
- case GAMEPAD_BUTTON_X:
- return "▢";
- case GAMEPAD_BUTTON_Y:
- return "△";
- case GAMEPAD_BUTTON_L1:
- return "L1";
- case GAMEPAD_BUTTON_R1:
- return "R1";
- case GAMEPAD_BUTTON_L2:
- return "L2";
- case GAMEPAD_BUTTON_R2:
- return "R2";
- case GAMEPAD_BUTTON_L3:
- return "L3";
- case GAMEPAD_BUTTON_R3:
- return "R3";
- case GAMEPAD_BUTTON_START:
- return "≡";
- case GAMEPAD_BUTTON_SELECT:
- return "❐";
- default:
- return null;
- }
- default:
- return null;
- }
- }
-
- public boolean overridesColor(InputControlsView view, Binding binding) {
- return colorFor(view, binding) != 0;
- }
-
- public static int safeColor(int themedColor, int fallback) {
- return themedColor != 0 ? themedColor : fallback;
- }
-}
diff --git a/app/src/main/runtime/input/controls/RangeScroller.java b/app/src/main/runtime/input/controls/RangeScroller.java
index dd992e36f..7cef17463 100644
--- a/app/src/main/runtime/input/controls/RangeScroller.java
+++ b/app/src/main/runtime/input/controls/RangeScroller.java
@@ -14,6 +14,7 @@ public class RangeScroller {
private float lastPosition;
private long touchTime;
private Binding binding = Binding.NONE;
+ private int bindingIndex = -1;
private boolean isActionDown = false;
private boolean scrolling = false;
private Timer timer;
@@ -44,16 +45,15 @@ public byte[] getRangeIndex() {
return new byte[] {from, to};
}
- private Binding getBindingByPosition(float x, float y) {
- Rect boundingBox = element.getBoundingBox();
- ControlElement.Range range = element.getRange();
- float offset =
- element.getOrientation() == 0
- ? x - boundingBox.left - currentOffset
- : y - boundingBox.top - currentOffset;
- int index = (int) Math.floor((offset / getElementSize()) % range.max);
- if (index < 0) index = range.max + index;
+ public int getBindingIndex() {
+ return bindingIndex;
+ }
+
+ public boolean isScrolling() {
+ return scrolling;
+ }
+ private static Binding bindingForIndex(ControlElement.Range range, int index) {
switch (range) {
case FROM_A_TO_Z:
return Binding.valueOf("KEY_" + ((char) (65 + index)));
@@ -68,6 +68,19 @@ private Binding getBindingByPosition(float x, float y) {
}
}
+ private Binding getBindingByPosition(float x, float y) {
+ Rect boundingBox = element.getBoundingBox();
+ ControlElement.Range range = element.getRange();
+ float offset =
+ element.getOrientation() == 0
+ ? x - boundingBox.left - currentOffset
+ : y - boundingBox.top - currentOffset;
+ int index = (int) Math.floor((offset / getElementSize()) % range.max);
+ if (index < 0) index = range.max + index;
+ bindingIndex = index;
+ return bindingForIndex(range, index);
+ }
+
private boolean isTap() {
return (System.currentTimeMillis() - touchTime) < TouchpadView.MAX_TAP_MILLISECONDS;
}
diff --git a/app/src/main/runtime/input/controls/VisualStyle.java b/app/src/main/runtime/input/controls/VisualStyle.java
index 0c226297d..796149da3 100644
--- a/app/src/main/runtime/input/controls/VisualStyle.java
+++ b/app/src/main/runtime/input/controls/VisualStyle.java
@@ -1,28 +1,26 @@
package com.winlator.cmod.runtime.input.controls;
-/**
- * Visual rendering style for on-screen virtual gamepad elements.
- *
- * ORIGINAL preserves the historic Winlator look (translucent white strokes, lightly filled when
- * engaged). GAMEHUB mimics the dark glass aesthetic used by the GameHub launcher: dark translucent
- * fill, light white rim, brighter rim and inner fill when pressed, with a soft drop shadow.
- *
- *
The actual drawing branches on this enum inside {@link ControlElement#draw}.
- */
+/** Rendering styles for the on-screen controls; enum order is the picker order and drawing branches on this in {@link ControlElement#draw}. */
public enum VisualStyle {
- ORIGINAL,
- GAMEHUB;
+ SLATE,
+ GAMEHUB,
+ HALO,
+ GLINT,
+ SHADOW,
+ RETICLE,
+ NEON,
+ ORIGINAL;
public static VisualStyle fromPreference(String name) {
- if (name == null) return ORIGINAL;
+ if (name == null) return SLATE;
try {
return VisualStyle.valueOf(name);
} catch (IllegalArgumentException e) {
- return ORIGINAL;
+ return SLATE;
}
}
public static String[] displayNames() {
- return new String[] {"Original", "GameHub"};
+ return new String[] {"Slate", "Glass", "Halo", "Glint", "Shadow", "Reticle", "Neon", "Original"};
}
}
diff --git a/app/src/main/runtime/input/ui/InputControlsView.java b/app/src/main/runtime/input/ui/InputControlsView.java
index 89b0473ba..46c07633b 100644
--- a/app/src/main/runtime/input/ui/InputControlsView.java
+++ b/app/src/main/runtime/input/ui/InputControlsView.java
@@ -36,6 +36,7 @@
import com.winlator.cmod.runtime.display.winhandler.WinHandler;
import com.winlator.cmod.runtime.display.xserver.Pointer;
import com.winlator.cmod.runtime.display.xserver.XServer;
+import com.winlator.cmod.runtime.input.controls.AccentTheme;
import com.winlator.cmod.runtime.input.controls.Binding;
import com.winlator.cmod.runtime.input.controls.ControlElement;
import com.winlator.cmod.runtime.input.controls.ControlsProfile;
@@ -43,7 +44,6 @@
import com.winlator.cmod.runtime.input.controls.ExternalControllerBinding;
import com.winlator.cmod.runtime.input.controls.GamepadState;
import com.winlator.cmod.runtime.input.controls.InputControlsManager;
-import com.winlator.cmod.runtime.input.controls.LabelTheme;
import com.winlator.cmod.runtime.input.controls.VisualStyle;
import com.winlator.cmod.shared.math.Mathf;
import java.io.IOException;
@@ -75,8 +75,8 @@ public class InputControlsView extends View {
private volatile float mouseMoveOffsetX = 0f;
private volatile float mouseMoveOffsetY = 0f;
private boolean showTouchscreenControls = false;
- private VisualStyle visualStyle = VisualStyle.ORIGINAL;
- private LabelTheme labelTheme = LabelTheme.DEFAULT;
+ private VisualStyle visualStyle = VisualStyle.SLATE;
+ private AccentTheme accentTheme = AccentTheme.CYAN;
private InputControlsManager inputControlsManager;
private Handler timeoutHandler; // Reference to the activity's timeout handler
@@ -187,29 +187,23 @@ public VisualStyle getVisualStyle() {
}
public void setVisualStyle(VisualStyle style) {
- this.visualStyle = style != null ? style : VisualStyle.ORIGINAL;
+ this.visualStyle = style != null ? style : VisualStyle.SLATE;
invalidate();
}
- /** Same as {@link #setVisualStyle} but without {@link #invalidate()}, for internal draw-time
- * fallbacks where requesting another redraw would loop. */
- public void setVisualStyleSilent(VisualStyle style) {
- this.visualStyle = style != null ? style : VisualStyle.ORIGINAL;
+ public AccentTheme getAccentTheme() {
+ return accentTheme;
}
- public LabelTheme getLabelTheme() {
- return labelTheme;
+ public void setAccentTheme(AccentTheme theme) {
+ this.accentTheme = theme != null ? theme : AccentTheme.CYAN;
+ invalidate();
}
public InputControlsManager getInputControlsManager() {
return inputControlsManager;
}
- public void setLabelTheme(LabelTheme theme) {
- this.labelTheme = theme != null ? theme : LabelTheme.DEFAULT;
- invalidate();
- }
-
public int getSnappingSize() {
return snappingSize;
}