mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-28 00:55:40 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c75e17870 |
No files matched your search
@@ -25,7 +25,6 @@
|
||||
#include <gnu/lib-names.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#include <linux/futex.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/joystick.h>
|
||||
#include <linux/uinput.h>
|
||||
@@ -712,19 +711,6 @@ ring_header_is_valid(const FakeInputRingHeader *ring) {
|
||||
ring->capacity == FAKE_INPUT_RING_CAPACITY;
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static int ring_wait(const FakeInputRingHeader *ring, uint64_t seen, long ns) {
|
||||
struct timespec wait = {0, ns};
|
||||
if (syscall(SYS_futex, &ring->write_seq, FUTEX_WAIT, static_cast<uint32_t>(seen), &wait, nullptr, 0) == 0 ||
|
||||
errno == EAGAIN || errno == ETIMEDOUT)
|
||||
return 0;
|
||||
if (errno == EINTR) return -1;
|
||||
return nanosleep(&wait, nullptr);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static void ring_wake(const FakeInputRingHeader *ring) {
|
||||
syscall(SYS_futex, &ring->write_seq, FUTEX_WAKE, INT_MAX, nullptr, nullptr, 0);
|
||||
}
|
||||
|
||||
struct SnapshotState {
|
||||
uint64_t sequence = 0;
|
||||
uint64_t write_seq = 0;
|
||||
@@ -1181,7 +1167,6 @@ __attribute__((visibility("hidden"))) static void flush_uinput(UinputWriter &w)
|
||||
__atomic_thread_fence(__ATOMIC_RELEASE);
|
||||
__atomic_store_n(&ring->snapshot_seq, sequence + 2, __ATOMIC_RELEASE);
|
||||
__atomic_store_n(&ring->write_seq, write_seq, __ATOMIC_RELEASE);
|
||||
ring_wake(ring);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static ssize_t
|
||||
@@ -1555,12 +1540,6 @@ __attribute__((visibility("hidden"))) static void sleep_us(int us) {
|
||||
nanosleep(&interval, nullptr);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static void
|
||||
report_wait(const FakeInputRingHeader *ring, bool fresh, uint64_t seen, int us) {
|
||||
if (fresh) ring_wait(ring, seen, us * 1000L);
|
||||
else sleep_us(us);
|
||||
}
|
||||
|
||||
__attribute__((visibility("hidden"))) static uint64_t monotonic_us() {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
@@ -1733,8 +1712,7 @@ __attribute__((visibility("hidden"))) static void *deck_report_thread(void *arg)
|
||||
int32_t axes[8] = {};
|
||||
DeckExtras extras;
|
||||
while (live_pad_type() == PAD_TYPE_DECK) {
|
||||
bool fresh = read_snapshot(self->ring, snap);
|
||||
if (fresh && snap.generation == ring_generation(self->ring)) {
|
||||
if (read_snapshot(self->ring, snap) && snap.generation == ring_generation(self->ring)) {
|
||||
buttons = snap.buttons;
|
||||
memcpy(axes, snap.axes, sizeof(axes));
|
||||
}
|
||||
@@ -1744,7 +1722,7 @@ __attribute__((visibility("hidden"))) static void *deck_report_thread(void *arg)
|
||||
if (send(self->peer, report, sizeof(report), MSG_DONTWAIT | MSG_NOSIGNAL) < 0 &&
|
||||
errno != EAGAIN && errno != EWOULDBLOCK)
|
||||
break;
|
||||
report_wait(self->ring, fresh, snap.write_seq, controller_report_interval_us(DECK_REPORT_INTERVAL_US));
|
||||
sleep_us(controller_report_interval_us(DECK_REPORT_INTERVAL_US));
|
||||
}
|
||||
syscall(SYS_close, self->peer);
|
||||
munmap(self->ring, self->mapping_size);
|
||||
@@ -1850,8 +1828,7 @@ __attribute__((visibility("hidden"))) static void *sony_report_thread(void *arg)
|
||||
SonyTouch touch;
|
||||
const uint64_t start_us = monotonic_us();
|
||||
while (live_pad_type() == type) {
|
||||
bool fresh = read_snapshot(self->ring, snap);
|
||||
if (fresh && snap.generation == ring_generation(self->ring)) {
|
||||
if (read_snapshot(self->ring, snap) && snap.generation == ring_generation(self->ring)) {
|
||||
buttons = snap.buttons;
|
||||
memcpy(axes, snap.axes, sizeof(axes));
|
||||
}
|
||||
@@ -1861,7 +1838,7 @@ __attribute__((visibility("hidden"))) static void *sony_report_thread(void *arg)
|
||||
if (send(self->peer, report, sizeof(report), MSG_DONTWAIT | MSG_NOSIGNAL) < 0 &&
|
||||
errno != EAGAIN && errno != EWOULDBLOCK)
|
||||
break;
|
||||
report_wait(self->ring, fresh, snap.write_seq, controller_report_interval_us(DECK_REPORT_INTERVAL_US));
|
||||
sleep_us(controller_report_interval_us(DECK_REPORT_INTERVAL_US));
|
||||
}
|
||||
syscall(SYS_close, self->peer);
|
||||
munmap(self->ring, self->mapping_size);
|
||||
@@ -2060,8 +2037,7 @@ __attribute__((visibility("hidden"))) static void *triton_pad_thread(void *arg)
|
||||
DeckExtras extras;
|
||||
const uint64_t start_us = monotonic_us();
|
||||
while (live_pad_type() == PAD_TYPE_STEAM) {
|
||||
bool fresh = read_snapshot(self->ring, snap);
|
||||
if (fresh && snap.generation == ring_generation(self->ring)) {
|
||||
if (read_snapshot(self->ring, snap) && snap.generation == ring_generation(self->ring)) {
|
||||
buttons = snap.buttons;
|
||||
memcpy(axes, snap.axes, sizeof(axes));
|
||||
}
|
||||
@@ -2072,7 +2048,7 @@ __attribute__((visibility("hidden"))) static void *triton_pad_thread(void *arg)
|
||||
if (send(self->peer, report, sizeof(report), MSG_DONTWAIT | MSG_NOSIGNAL) < 0 &&
|
||||
errno != EAGAIN && errno != EWOULDBLOCK)
|
||||
break;
|
||||
report_wait(self->ring, fresh, snap.write_seq, controller_report_interval_us(TRITON_REPORT_INTERVAL_US));
|
||||
sleep_us(controller_report_interval_us(TRITON_REPORT_INTERVAL_US));
|
||||
}
|
||||
syscall(SYS_close, self->peer);
|
||||
munmap(self->ring, self->mapping_size);
|
||||
@@ -4040,7 +4016,6 @@ static ssize_t read_input(int fd, void *buf, size_t count) {
|
||||
errno = ENODEV;
|
||||
return -1;
|
||||
}
|
||||
bool idle = false;
|
||||
for (int attempt = 0; attempt < 8; ++attempt) {
|
||||
size_t requested = count / sizeof(struct input_event);
|
||||
if (fake.keyframe_remaining == 0) {
|
||||
@@ -4062,10 +4037,7 @@ static ssize_t read_input(int fd, void *buf, size_t count) {
|
||||
capture_keyframe(fake, snap);
|
||||
} else {
|
||||
size_t events = std::min<uint64_t>(requested, snap.write_seq - fake.read_seq);
|
||||
if (events == 0) {
|
||||
idle = true;
|
||||
break;
|
||||
}
|
||||
if (events == 0) break;
|
||||
const uint8_t *ring_events = reinterpret_cast<const uint8_t *>(fake.ring) +
|
||||
FAKE_INPUT_RING_HEADER_SIZE;
|
||||
std::vector<struct input_event> input_events(events);
|
||||
@@ -4111,14 +4083,9 @@ static ssize_t read_input(int fd, void *buf, size_t count) {
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
const FakeInputRingHeader *ring = fake.ring;
|
||||
uint64_t seen = fake.read_seq;
|
||||
guard.unlock();
|
||||
#ifdef __GLIBC__
|
||||
pthread_testcancel();
|
||||
#endif
|
||||
struct timespec sleep_time = {0, backoff_ns};
|
||||
int result = idle ? ring_wait(ring, seen, backoff_ns) : nanosleep(&sleep_time, nullptr);
|
||||
int result = nanosleep(&sleep_time, nullptr);
|
||||
guard.lock();
|
||||
if (result < 0) return -1;
|
||||
if (low_latency(LATENCY_CONTROLLER)) backoff_ns = kLowLatencyRingWaitUs * 1000;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#include <errno.h>
|
||||
#include <jni.h>
|
||||
#include <limits.h>
|
||||
#include <linux/futex.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -14,13 +11,6 @@ Java_com_droiddeck_launcher_input_FakeInputWriter_nativeStoreFence(JNIEnv *env,
|
||||
atomic_thread_fence(memory_order_release);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_droiddeck_launcher_input_FakeInputWriter_nativeWake(JNIEnv *env, jclass clazz, jobject buffer, jint offset) {
|
||||
(void)clazz;
|
||||
uint8_t *base = (*env)->GetDirectBufferAddress(env, buffer);
|
||||
if (base) syscall(SYS_futex, base + offset, FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_droiddeck_launcher_session_ThreadSignals_tgkill(JNIEnv *env, jclass clazz, jint tgid, jint tid, jint signal) {
|
||||
(void)env;
|
||||
|
||||
@@ -349,7 +349,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
private var gestureSettingsOpen by mutableStateOf(false)
|
||||
private var steamImportAsk by mutableStateOf<com.droiddeck.launcher.session.SteamImportPrompt.Ask?>(null)
|
||||
private var steamImportAnswered: String? = null
|
||||
private var directHoldBehavior by mutableStateOf(com.droiddeck.launcher.input.TouchGestureConfig.MOUSE_BEHAVIOR_CLICK)
|
||||
private var directHoldBehavior by mutableStateOf(com.droiddeck.launcher.input.TouchGestureConfig.MOUSE_BEHAVIOR_NONE)
|
||||
private var relativeMouseMode by mutableIntStateOf(0)
|
||||
@Volatile private var appliedRelativeMouseMode: Int? = null
|
||||
private val agentReadyListener: () -> Unit = {
|
||||
@@ -6960,7 +6960,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
if (!hasFocus && ::padMouse.isInitialized) padMouse.reset()
|
||||
if (runtimeRemovalBlocked) return
|
||||
if (!hasFocus) {
|
||||
cancelTouchGestures()
|
||||
if (::touchscreenGestures.isInitialized) touchscreenGestures.cancel()
|
||||
if (::touchpad.isInitialized) touchpad.cancel()
|
||||
if (::scrollTouch.isInitialized) scrollTouch.cancel()
|
||||
releaseHeldGuestInput()
|
||||
}
|
||||
if (hasFocus && !pipUi) {
|
||||
|
||||
@@ -235,6 +235,10 @@ object AgentPrefs {
|
||||
if (e is AgentException) throw e
|
||||
throw AgentException("INVALID_PREF", "The value is not a $type")
|
||||
}
|
||||
val stored = previous?.let(::typeOf)
|
||||
if (type != "remove" && stored != null && stored != type) {
|
||||
throw AgentException("INVALID_PREF", "$file/$key is stored as $stored; set it with type $stored, or remove it first")
|
||||
}
|
||||
if (!editor.commit()) throw AgentException("PREF_WRITE_FAILED", "Could not write $file/$key")
|
||||
return JSONObject().put("file", file).put("key", key).put("type", type)
|
||||
.put("previous", previous ?: JSONObject.NULL).put("value", prefs.all[key] ?: JSONObject.NULL)
|
||||
@@ -247,6 +251,15 @@ object AgentPrefs {
|
||||
return JSONObject().put("file", file).put("values", JSONObject(all.mapValues { it.value ?: JSONObject.NULL }))
|
||||
}
|
||||
|
||||
private fun typeOf(value: Any): String = when (value) {
|
||||
is Boolean -> "bool"
|
||||
is Int -> "int"
|
||||
is Long -> "long"
|
||||
is Float -> "float"
|
||||
is String -> "string"
|
||||
else -> "string set"
|
||||
}
|
||||
|
||||
private fun validateFile(file: String) {
|
||||
if (!Regex("[A-Za-z0-9_-][A-Za-z0-9._-]{0,127}").matches(file)) {
|
||||
throw AgentException("INVALID_PREF", "Preference files must be simple names")
|
||||
|
||||
@@ -23,7 +23,7 @@ class DirectTouchHold(
|
||||
private var downY = 0f
|
||||
private var downId = 0
|
||||
private var delayMs = 0L
|
||||
private var holdBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_CLICK
|
||||
private var holdBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_NONE
|
||||
private var forwarded = false
|
||||
private var forwardedAt = 0L
|
||||
private var held = false
|
||||
|
||||
@@ -149,8 +149,6 @@ public class FakeInputWriter {
|
||||
|
||||
private static native void nativeStoreFence();
|
||||
|
||||
private static native void nativeWake(ByteBuffer ring, int offset);
|
||||
|
||||
public static void storeFence() {
|
||||
nativeStoreFence();
|
||||
}
|
||||
@@ -457,7 +455,6 @@ public class FakeInputWriter {
|
||||
writeSnapshotLocked(ring);
|
||||
nativeStoreFence();
|
||||
ring.putLong(RING_WRITE_SEQ_OFFSET, writeSeq);
|
||||
nativeWake(ring, RING_WRITE_SEQ_OFFSET);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ data class TouchGestureConfig(
|
||||
val longPressAction: String = ACTION_RIGHT_CLICK,
|
||||
val longPressMouseBehavior: String = MOUSE_BEHAVIOR_HOLD,
|
||||
val longPressDelay: Int = DEFAULT_DELAY_MS,
|
||||
val directHoldBehavior: String = MOUSE_BEHAVIOR_CLICK,
|
||||
val directHoldBehavior: String = MOUSE_BEHAVIOR_NONE,
|
||||
val doubleTapEnabled: Boolean = true,
|
||||
val doubleTapDelay: Int = DEFAULT_DELAY_MS,
|
||||
val twoFingerDragEnabled: Boolean = true,
|
||||
@@ -167,7 +167,7 @@ data class TouchGestureConfig(
|
||||
),
|
||||
longPressDelay = obj.optInt(KEY_LONG_PRESS_DELAY, DEFAULT_DELAY_MS),
|
||||
directHoldBehavior = normalizeDirectHoldBehavior(
|
||||
obj.optString(KEY_DIRECT_HOLD_BEHAVIOR, MOUSE_BEHAVIOR_CLICK)
|
||||
obj.optString(KEY_DIRECT_HOLD_BEHAVIOR, MOUSE_BEHAVIOR_NONE)
|
||||
),
|
||||
doubleTapEnabled = obj.optBoolean(KEY_DOUBLE_TAP_ENABLED, true),
|
||||
doubleTapDelay = obj.optInt(KEY_DOUBLE_TAP_DELAY, DEFAULT_DELAY_MS),
|
||||
|
||||
@@ -24,7 +24,7 @@ internal object BuildWatermarkSetting {
|
||||
file(context).readFully().decodeToString() != "off"
|
||||
}
|
||||
} catch (_: java.io.IOException) {
|
||||
context.getSharedPreferences("session", Context.MODE_PRIVATE).getBoolean("buildWatermark", true)
|
||||
TolerantPrefs.session(context).getBoolean("buildWatermark", true)
|
||||
}
|
||||
|
||||
fun setEnabled(context: Context, on: Boolean) {
|
||||
|
||||
@@ -11,16 +11,15 @@ object EnhancedDiagnostics {
|
||||
const val MANIFEST_FILE = "enhanced-diagnostics.json"
|
||||
|
||||
private const val TAG = "EnhancedDiagnostics"
|
||||
private const val PREFS = "session"
|
||||
private const val ARMED = "enhancedDiagnosticsNext"
|
||||
private const val ACTIVE_RECORDS = "enhancedDiagnosticsActiveSessions"
|
||||
private const val SCHEMA = 1
|
||||
|
||||
fun isArmed(context: Context): Boolean =
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getBoolean(ARMED, false)
|
||||
TolerantPrefs.session(context).getBoolean(ARMED, false)
|
||||
|
||||
fun setArmed(context: Context, armed: Boolean): Boolean =
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putBoolean(ARMED, armed).commit()
|
||||
TolerantPrefs.session(context).edit().putBoolean(ARMED, armed).commit()
|
||||
|
||||
fun isActive(context: Context, folder: File?): Boolean = activeAt(context, folder) != null
|
||||
|
||||
@@ -84,7 +83,7 @@ object EnhancedDiagnostics {
|
||||
if (!File(known).isDirectory) records.remove(known)
|
||||
}
|
||||
records.put(path, activatedAt)
|
||||
return context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit()
|
||||
return TolerantPrefs.session(context).edit()
|
||||
.putString(ACTIVE_RECORDS, records.toString())
|
||||
.putBoolean(ARMED, false)
|
||||
.commit()
|
||||
@@ -108,11 +107,11 @@ object EnhancedDiagnostics {
|
||||
}
|
||||
|
||||
private fun records(context: Context): JSONObject {
|
||||
val text = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getString(ACTIVE_RECORDS, null)
|
||||
val text = TolerantPrefs.session(context).getString(ACTIVE_RECORDS, null)
|
||||
return runCatching { JSONObject(text ?: "{}") }.getOrDefault(JSONObject())
|
||||
}
|
||||
|
||||
private fun saveRecords(context: Context, records: JSONObject): Boolean =
|
||||
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit()
|
||||
TolerantPrefs.session(context).edit()
|
||||
.putString(ACTIVE_RECORDS, records.toString()).commit()
|
||||
}
|
||||
@@ -17,7 +17,7 @@ object OfflineMode {
|
||||
private val PERSONA = Regex(""""PersonaName"\s*"([^"]*)"""")
|
||||
private const val EVAL_TIMEOUT_MS = 10_000L
|
||||
|
||||
private fun prefs(context: Context) = context.getSharedPreferences("session", Context.MODE_PRIVATE)
|
||||
private fun prefs(context: Context) = TolerantPrefs.session(context)
|
||||
|
||||
private fun loginUsers(root: File) = File(root, "root/.local/share/Steam/config/loginusers.vdf")
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ object QuestExperimental {
|
||||
|
||||
fun initialize(context: Context) {
|
||||
if (!isSupported()) return
|
||||
val prefs = context.getSharedPreferences("session", Context.MODE_PRIVATE)
|
||||
val prefs = TolerantPrefs.session(context)
|
||||
val defaultsKey = if (isQuest2()) "quest2DefaultsV1" else "questDefaultsV1"
|
||||
if (!prefs.getBoolean(defaultsKey, false)) {
|
||||
prefs.edit()
|
||||
|
||||
@@ -48,7 +48,7 @@ object SessionPrefs {
|
||||
fun backActionsOrder(inverted: Boolean): Int =
|
||||
if (inverted) BACK_QAM_THEN_MENU else BACK_MENU_THEN_QAM
|
||||
|
||||
private fun prefs(context: Context) = context.getSharedPreferences("session", Context.MODE_PRIVATE)
|
||||
private fun prefs(context: Context) = TolerantPrefs.session(context)
|
||||
|
||||
val orientationOptions = listOf(
|
||||
ActivityInfo.SCREEN_ORIENTATION_USER to R.string.setup_launcher_orientation_auto,
|
||||
@@ -1735,7 +1735,6 @@ object SessionPrefs {
|
||||
signal = p.getInt("customThemeSignal", defaults.signal),
|
||||
good = p.getInt("customThemeGood", defaults.good),
|
||||
error = p.getInt("customThemeError", defaults.error),
|
||||
warning = p.getInt("customThemeWarning", defaults.warning),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1756,7 +1755,6 @@ object SessionPrefs {
|
||||
.putInt("customThemeSignal", colors.signal)
|
||||
.putInt("customThemeGood", colors.good)
|
||||
.putInt("customThemeError", colors.error)
|
||||
.putInt("customThemeWarning", colors.warning)
|
||||
.apply()
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
|
||||
internal class TolerantPrefs(private val base: SharedPreferences) : SharedPreferences by base {
|
||||
override fun getString(key: String?, defValue: String?): String? =
|
||||
read(key, defValue, { base.getString(key, defValue) }) { it }
|
||||
|
||||
override fun getStringSet(key: String?, defValues: MutableSet<String>?): MutableSet<String>? =
|
||||
try { base.getStringSet(key, defValues) } catch (_: ClassCastException) { defValues }
|
||||
|
||||
override fun getInt(key: String?, defValue: Int): Int =
|
||||
read(key, defValue, { base.getInt(key, defValue) }) { it.toIntOrNull() }
|
||||
|
||||
override fun getLong(key: String?, defValue: Long): Long =
|
||||
read(key, defValue, { base.getLong(key, defValue) }) { it.toLongOrNull() }
|
||||
|
||||
override fun getFloat(key: String?, defValue: Float): Float =
|
||||
read(key, defValue, { base.getFloat(key, defValue) }) { it.toFloatOrNull() }
|
||||
|
||||
override fun getBoolean(key: String?, defValue: Boolean): Boolean =
|
||||
read(key, defValue, { base.getBoolean(key, defValue) }) { it.toBooleanStrictOrNull() }
|
||||
|
||||
private inline fun <T> read(key: String?, defValue: T, typed: () -> T, parse: (String) -> T?): T =
|
||||
try {
|
||||
typed()
|
||||
} catch (_: ClassCastException) {
|
||||
base.all[key]?.toString()?.let(parse) ?: defValue
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun session(context: Context): SharedPreferences =
|
||||
TolerantPrefs(context.getSharedPreferences("session", Context.MODE_PRIVATE))
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.withFrameNanos
|
||||
import androidx.compose.runtime.withFrameMillis
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
@@ -99,7 +99,7 @@ private fun rememberMarkClock(avoid: Rect?): MarkClock {
|
||||
var vx = speed * 0.8f
|
||||
var vy = -speed * 0.6f
|
||||
while (true) {
|
||||
if (clock.page == Size.Zero) { withFrameNanos { }; continue }
|
||||
if (clock.page == Size.Zero) { withFrameMillis { }; continue }
|
||||
val f = MarkFrame(clock.page, Offset.Zero)
|
||||
if (clock.at == Offset.Unspecified) clock.at = Offset(clock.page.width * 0.64f, clock.page.height * 0.42f)
|
||||
if (Motion.scale == 0f) {
|
||||
@@ -108,13 +108,8 @@ private fun rememberMarkClock(avoid: Rect?): MarkClock {
|
||||
clock.wall = 0f
|
||||
return@LaunchedEffect
|
||||
}
|
||||
withFrameNanos { nanos ->
|
||||
val scale = Motion.scale
|
||||
if (scale == 0f) return@withFrameNanos
|
||||
val settled = clock.intro >= END && clock.ball >= IMPACT + REVEAL_MS && !clock.poked
|
||||
if (settled && last >= 0 && !IdleFrames.due(nanos)) return@withFrameNanos
|
||||
val now = nanos / 1_000_000L
|
||||
val dt = if (last < 0) 0f else min(50f, (now - last).toFloat()) / scale.coerceAtLeast(0.01f)
|
||||
withFrameMillis { now ->
|
||||
val dt = if (last < 0) 0f else min(50f, (now - last) / Motion.scale)
|
||||
last = now
|
||||
clock.intro += dt
|
||||
clock.wall += dt
|
||||
@@ -122,41 +117,34 @@ private fun rememberMarkClock(avoid: Rect?): MarkClock {
|
||||
val before = clock.ball
|
||||
clock.ball += dt
|
||||
|
||||
var x = clock.at.x
|
||||
var y = clock.at.y
|
||||
var x = clock.at.x + vx * dt / 1000f
|
||||
var y = clock.at.y + vy * dt / 1000f
|
||||
val hw = f.ball
|
||||
val hh = f.ball
|
||||
var left = dt
|
||||
do {
|
||||
val step = min(50f, left)
|
||||
left -= step
|
||||
x += vx * step / 1000f
|
||||
y += vy * step / 1000f
|
||||
if (x - hw < 0f) { x = hw; vx = abs(vx) }
|
||||
if (x + hw > clock.page.width) { x = clock.page.width - hw; vx = -abs(vx) }
|
||||
if (y - hh < 0f) { y = hh; vy = abs(vy) }
|
||||
if (y + hh > clock.page.height) { y = clock.page.height - hh; vy = -abs(vy) }
|
||||
keepOff?.inflate(clearance)?.let { r ->
|
||||
val nearX = x.coerceIn(r.left, r.right)
|
||||
val nearY = y.coerceIn(r.top, r.bottom)
|
||||
val gapX = x - nearX
|
||||
val gapY = y - nearY
|
||||
val gap = hypot(gapX, gapY)
|
||||
if (gap in 0.0001f..f.ball) {
|
||||
val nx = gapX / gap
|
||||
val ny = gapY / gap
|
||||
x = nearX + nx * f.ball
|
||||
y = nearY + ny * f.ball
|
||||
val into = vx * nx + vy * ny
|
||||
if (into < 0f) { vx -= 2f * into * nx; vy -= 2f * into * ny }
|
||||
} else if (gap <= 0.0001f) {
|
||||
val outX = if (x < r.center.x) r.left - f.ball - x else r.right + f.ball - x
|
||||
val outY = if (y < r.center.y) r.top - f.ball - y else r.bottom + f.ball - y
|
||||
if (abs(outX) < abs(outY)) { x += outX; vx = if (outX < 0) -abs(vx) else abs(vx) }
|
||||
else { y += outY; vy = if (outY < 0) -abs(vy) else abs(vy) }
|
||||
}
|
||||
if (x - hw < 0f) { x = hw; vx = abs(vx) }
|
||||
if (x + hw > clock.page.width) { x = clock.page.width - hw; vx = -abs(vx) }
|
||||
if (y - hh < 0f) { y = hh; vy = abs(vy) }
|
||||
if (y + hh > clock.page.height) { y = clock.page.height - hh; vy = -abs(vy) }
|
||||
keepOff?.inflate(clearance)?.let { r ->
|
||||
val nearX = x.coerceIn(r.left, r.right)
|
||||
val nearY = y.coerceIn(r.top, r.bottom)
|
||||
val gapX = x - nearX
|
||||
val gapY = y - nearY
|
||||
val gap = hypot(gapX, gapY)
|
||||
if (gap in 0.0001f..f.ball) {
|
||||
val nx = gapX / gap
|
||||
val ny = gapY / gap
|
||||
x = nearX + nx * f.ball
|
||||
y = nearY + ny * f.ball
|
||||
val into = vx * nx + vy * ny
|
||||
if (into < 0f) { vx -= 2f * into * nx; vy -= 2f * into * ny }
|
||||
} else if (gap <= 0.0001f) {
|
||||
val outX = if (x < r.center.x) r.left - f.ball - x else r.right + f.ball - x
|
||||
val outY = if (y < r.center.y) r.top - f.ball - y else r.bottom + f.ball - y
|
||||
if (abs(outX) < abs(outY)) { x += outX; vx = if (outX < 0) -abs(vx) else abs(vx) }
|
||||
else { y += outY; vy = if (outY < 0) -abs(vy) else abs(vy) }
|
||||
}
|
||||
} while (left > 0f)
|
||||
}
|
||||
clock.at = Offset(x, y)
|
||||
|
||||
if (before < IMPACT && clock.ball >= IMPACT) {
|
||||
|
||||
@@ -96,7 +96,8 @@ import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.layout.onPlaced
|
||||
import com.droiddeck.launcher.core.PhantomProcessLimit
|
||||
|
||||
internal val AttentionAmber: Color @Composable get() = LocalPalette.current.warning
|
||||
|
||||
internal val AttentionAmber = Color(0xFFFFB547)
|
||||
|
||||
@Composable
|
||||
internal fun BottomBar(
|
||||
@@ -307,7 +308,7 @@ private fun RailItem(
|
||||
}
|
||||
if (badge) Box(
|
||||
modifier = Modifier.align(Alignment.TopEnd).padding(top = if (iconOnly) 7.dp else 8.dp, end = if (iconOnly) 9.dp else 18.dp)
|
||||
.size(8.dp).clip(CircleShape).background(pal.warning),
|
||||
.size(8.dp).clip(CircleShape).background(AttentionAmber),
|
||||
)
|
||||
if (count > 0) Text(
|
||||
if (count > 9) "9+" else count.toString(),
|
||||
|
||||
@@ -1254,7 +1254,6 @@ private fun CustomColorRows() {
|
||||
Triple("signal", stringResource(R.string.theme_custom_signal), colors.signal),
|
||||
Triple("good", stringResource(R.string.theme_custom_good), colors.good),
|
||||
Triple("error", stringResource(R.string.theme_custom_error), colors.error),
|
||||
Triple("warning", stringResource(R.string.theme_custom_warning), colors.warning),
|
||||
)
|
||||
|
||||
rows.forEach { (key, label, argb) ->
|
||||
|
||||
@@ -333,7 +333,7 @@ class DrawerActions(
|
||||
val onInputSelection: (com.droiddeck.launcher.input.InputRole?) -> Unit = {},
|
||||
val onGestureSettings: () -> Unit = {},
|
||||
val touchActive: String = "",
|
||||
val directHoldBehavior: String = MOUSE_BEHAVIOR_CLICK,
|
||||
val directHoldBehavior: String = MOUSE_BEHAVIOR_NONE,
|
||||
val onDirectHoldBehavior: (String) -> Unit = {},
|
||||
val onFexPreset: (String) -> Unit,
|
||||
val onUpscaler: (Int) -> Unit = {},
|
||||
|
||||
@@ -82,18 +82,7 @@ import kotlinx.coroutines.withContext
|
||||
private const val WALL_MIN_GAMES = 4
|
||||
private const val WALL_DISTINCT = 40
|
||||
|
||||
private const val IDLE_FRAME_NS = 30_000_000L
|
||||
|
||||
internal object IdleFrames {
|
||||
private var shown = 0L
|
||||
|
||||
fun due(nanos: Long): Boolean {
|
||||
if (nanos == shown) return true
|
||||
if (nanos - shown < IDLE_FRAME_NS) return false
|
||||
shown = nanos
|
||||
return true
|
||||
}
|
||||
}
|
||||
private const val DRIFT_STEP_NS = 15_000_000L
|
||||
|
||||
@Composable
|
||||
internal fun SteamHome(s: FrontEndState, a: FrontEndActions, modifier: Modifier) {
|
||||
@@ -292,7 +281,7 @@ internal fun TiltedWall(
|
||||
var shown = 0L
|
||||
while (true) withFrameNanos { now ->
|
||||
if (shown == 0L) shown = now
|
||||
else if (IdleFrames.due(now)) {
|
||||
else if (now - shown >= DRIFT_STEP_NS) {
|
||||
drift.floatValue = ((drift.floatValue + (now - shown) / (period.value * 1_000_000.0 * Motion.scale)) % 1.0).toFloat()
|
||||
shown = now
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class Palette(
|
||||
val background: Color, val surface: Color, val surfaceVariant: Color, val line: Color, val line2: Color,
|
||||
val onBackground: Color, val onSurfaceVariant: Color,
|
||||
val primary: Color, val primary2: Color, val onPrimary: Color, val signal: Color,
|
||||
val good: Color, val error: Color = Color(0xFFFF8A80), val warning: Color = Color(0xFFFFB547),
|
||||
val good: Color, val error: Color = Color(0xFFFF8A80),
|
||||
)
|
||||
|
||||
data class CustomThemeColors(
|
||||
@@ -54,7 +54,6 @@ data class CustomThemeColors(
|
||||
val signal: Int = 0xFF1A9FFF.toInt(),
|
||||
val good: Int = 0xFF4CD37F.toInt(),
|
||||
val error: Int = 0xFFFF8A80.toInt(),
|
||||
val warning: Int = 0xFFFFB547.toInt(),
|
||||
)
|
||||
|
||||
object Themes {
|
||||
@@ -145,7 +144,6 @@ object Themes {
|
||||
"signal" -> current.copy(signal = color)
|
||||
"good" -> current.copy(good = color)
|
||||
"error" -> current.copy(error = color)
|
||||
"warning" -> current.copy(warning = color)
|
||||
else -> return
|
||||
}
|
||||
setCustomColors(context, updated)
|
||||
@@ -166,7 +164,6 @@ object Themes {
|
||||
signal = Color(colors.signal),
|
||||
good = Color(colors.good),
|
||||
error = Color(colors.error),
|
||||
warning = Color(colors.warning),
|
||||
)
|
||||
|
||||
fun current(context: Context): Palette {
|
||||
@@ -232,9 +229,7 @@ val Palette.onSignal: Color get() = if (signal.luminance() > 0.18f) Color(0xFF03
|
||||
|
||||
@Composable
|
||||
fun DroidDeckTheme(theme: String? = null, appScale: Int = AppUiPrefs.DEFAULT_SCALE, content: @Composable () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
remember(context) { Themes.loadGradient(context) }
|
||||
val id = theme ?: SessionPrefs.theme(context)
|
||||
val id = theme ?: SessionPrefs.theme(LocalContext.current)
|
||||
if (id == Themes.INNER_GAMER) InnerGamerHue(Themes.rgbSpeed)
|
||||
val p = Themes.byId(id)
|
||||
val scheme = darkColorScheme(
|
||||
|
||||
@@ -4299,7 +4299,6 @@
|
||||
<string name="theme_custom_signal">الإبرازات</string>
|
||||
<string name="theme_custom_good">نجاح</string>
|
||||
<string name="theme_custom_error">خطأ</string>
|
||||
<string name="theme_custom_warning">تحذير</string>
|
||||
<string name="hud_only_during_game">عرض HUD أثناء اللعب فقط</string>
|
||||
<string name="hud_only_during_game_hint">إخفاء HUD عند عدم اكتشاف إطارات اللعبة.</string>
|
||||
<string name="steam_store_close_steam">أغلق Steam أولاً</string>
|
||||
|
||||
@@ -4179,7 +4179,6 @@
|
||||
<string name="theme_custom_signal">Destacados</string>
|
||||
<string name="theme_custom_good">Éxito</string>
|
||||
<string name="theme_custom_error">Error</string>
|
||||
<string name="theme_custom_warning">Advertencia</string>
|
||||
<string name="hud_only_during_game">Mostrar el HUD solo durante una partida</string>
|
||||
<string name="hud_only_during_game_hint">Ocultar el HUD cuando no se detecten fotogramas del juego.</string>
|
||||
<string name="steam_store_close_steam">Cierra Steam primero</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Акценти</string>
|
||||
<string name="theme_custom_good">Успех</string>
|
||||
<string name="theme_custom_error">Грешка</string>
|
||||
<string name="theme_custom_warning">Предупреждение</string>
|
||||
<string name="hud_only_during_game">Показвай HUD само по време на игра</string>
|
||||
<string name="hud_only_during_game_hint">Скривай HUD, когато не се засичат кадри от играта.</string>
|
||||
<string name="steam_store_close_steam">Първо затворете Steam</string>
|
||||
|
||||
@@ -4219,7 +4219,6 @@
|
||||
<string name="theme_custom_signal">Zvýraznění</string>
|
||||
<string name="theme_custom_good">Úspěch</string>
|
||||
<string name="theme_custom_error">Chyba</string>
|
||||
<string name="theme_custom_warning">Varování</string>
|
||||
<string name="hud_only_during_game">Zobrazovat HUD pouze během hry</string>
|
||||
<string name="hud_only_during_game_hint">Skrýt HUD, když nejsou detekovány snímky hry.</string>
|
||||
<string name="steam_store_close_steam">Nejprve zavřete Steam</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Fremhævninger</string>
|
||||
<string name="theme_custom_good">Succes</string>
|
||||
<string name="theme_custom_error">Fejl</string>
|
||||
<string name="theme_custom_warning">Advarsel</string>
|
||||
<string name="hud_only_during_game">Vis kun HUD under spil</string>
|
||||
<string name="hud_only_during_game_hint">Skjul HUD, når der ikke registreres spilbilleder.</string>
|
||||
<string name="steam_store_close_steam">Luk Steam først</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Hervorhebungen</string>
|
||||
<string name="theme_custom_good">Erfolg</string>
|
||||
<string name="theme_custom_error">Fehler</string>
|
||||
<string name="theme_custom_warning">Warnung</string>
|
||||
<string name="hud_only_during_game">HUD nur während eines Spiels anzeigen</string>
|
||||
<string name="hud_only_during_game_hint">HUD ausblenden, wenn keine Spielframes erkannt werden.</string>
|
||||
<string name="steam_store_close_steam">Schließe zuerst Steam</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Επισημάνσεις</string>
|
||||
<string name="theme_custom_good">Επιτυχία</string>
|
||||
<string name="theme_custom_error">Σφάλμα</string>
|
||||
<string name="theme_custom_warning">Προειδοποίηση</string>
|
||||
<string name="hud_only_during_game">Εμφάνιση HUD μόνο κατά τη διάρκεια παιχνιδιού</string>
|
||||
<string name="hud_only_during_game_hint">Απόκρυψη HUD όταν δεν ανιχνεύονται καρέ παιχνιδιού.</string>
|
||||
<string name="steam_store_close_steam">Κλείστε πρώτα το Steam</string>
|
||||
|
||||
@@ -4179,7 +4179,6 @@
|
||||
<string name="theme_custom_signal">Destacados</string>
|
||||
<string name="theme_custom_good">Éxito</string>
|
||||
<string name="theme_custom_error">Error</string>
|
||||
<string name="theme_custom_warning">Advertencia</string>
|
||||
<string name="hud_only_during_game">Mostrar el HUD solo durante una partida</string>
|
||||
<string name="hud_only_during_game_hint">Ocultar el HUD cuando no se detecten fotogramas del juego.</string>
|
||||
<string name="steam_store_close_steam">Cierra Steam primero</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Korostukset</string>
|
||||
<string name="theme_custom_good">Onnistuminen</string>
|
||||
<string name="theme_custom_error">Virhe</string>
|
||||
<string name="theme_custom_warning">Varoitus</string>
|
||||
<string name="hud_only_during_game">Näytä HUD vain pelin aikana</string>
|
||||
<string name="hud_only_during_game_hint">Piilota HUD, kun pelin ruutuja ei havaita.</string>
|
||||
<string name="steam_store_close_steam">Sulje Steam ensin</string>
|
||||
|
||||
@@ -4178,7 +4178,6 @@
|
||||
<string name="theme_custom_signal">Mises en évidence</string>
|
||||
<string name="theme_custom_good">Succès</string>
|
||||
<string name="theme_custom_error">Erreur</string>
|
||||
<string name="theme_custom_warning">Avertissement</string>
|
||||
<string name="hud_only_during_game">Afficher le HUD uniquement pendant une partie</string>
|
||||
<string name="hud_only_during_game_hint">Masquer le HUD lorsqu’aucune image du jeu n’est détectée.</string>
|
||||
<string name="steam_store_close_steam">Fermez d\'abord Steam</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">हाइलाइट</string>
|
||||
<string name="theme_custom_good">सफलता</string>
|
||||
<string name="theme_custom_error">त्रुटि</string>
|
||||
<string name="theme_custom_warning">चेतावनी</string>
|
||||
<string name="hud_only_during_game">HUD केवल गेम के दौरान दिखाएँ</string>
|
||||
<string name="hud_only_during_game_hint">गेम के फ़्रेम का पता न चलने पर HUD छिपाएँ।</string>
|
||||
<string name="steam_store_close_steam">पहले Steam बंद करें</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Kiemelések</string>
|
||||
<string name="theme_custom_good">Siker</string>
|
||||
<string name="theme_custom_error">Hiba</string>
|
||||
<string name="theme_custom_warning">Figyelmeztetés</string>
|
||||
<string name="hud_only_during_game">HUD megjelenítése csak játék közben</string>
|
||||
<string name="hud_only_during_game_hint">HUD elrejtése, ha nem észlelhetők játék képkockái.</string>
|
||||
<string name="steam_store_close_steam">Előbb zárd be a Steamet</string>
|
||||
|
||||
@@ -4109,7 +4109,6 @@
|
||||
<string name="theme_custom_signal">Sorotan</string>
|
||||
<string name="theme_custom_good">Berhasil</string>
|
||||
<string name="theme_custom_error">Kesalahan</string>
|
||||
<string name="theme_custom_warning">Peringatan</string>
|
||||
<string name="hud_only_during_game">Tampilkan HUD hanya saat bermain</string>
|
||||
<string name="hud_only_during_game_hint">Sembunyikan HUD saat tidak ada frame game yang terdeteksi.</string>
|
||||
<string name="steam_store_close_steam">Tutup Steam terlebih dahulu</string>
|
||||
|
||||
@@ -4178,7 +4178,6 @@
|
||||
<string name="theme_custom_signal">Evidenziazioni</string>
|
||||
<string name="theme_custom_good">Successo</string>
|
||||
<string name="theme_custom_error">Errore</string>
|
||||
<string name="theme_custom_warning">Avviso</string>
|
||||
<string name="hud_only_during_game">Mostra l’HUD solo durante il gioco</string>
|
||||
<string name="hud_only_during_game_hint">Nascondi l’HUD quando non vengono rilevati fotogrammi del gioco.</string>
|
||||
<string name="steam_store_close_steam">Chiudi prima Steam</string>
|
||||
|
||||
@@ -4109,7 +4109,6 @@
|
||||
<string name="theme_custom_signal">強調表示</string>
|
||||
<string name="theme_custom_good">成功</string>
|
||||
<string name="theme_custom_error">エラー</string>
|
||||
<string name="theme_custom_warning">警告</string>
|
||||
<string name="hud_only_during_game">ゲーム中のみHUDを表示</string>
|
||||
<string name="hud_only_during_game_hint">ゲームのフレームが検出されないときはHUDを非表示にする。</string>
|
||||
<string name="steam_store_close_steam">先に Steam を閉じてください</string>
|
||||
|
||||
@@ -4109,7 +4109,6 @@
|
||||
<string name="theme_custom_signal">강조 표시</string>
|
||||
<string name="theme_custom_good">성공</string>
|
||||
<string name="theme_custom_error">오류</string>
|
||||
<string name="theme_custom_warning">경고</string>
|
||||
<string name="hud_only_during_game">게임 중에만 HUD 표시</string>
|
||||
<string name="hud_only_during_game_hint">게임 프레임이 감지되지 않으면 HUD 숨기기.</string>
|
||||
<string name="steam_store_close_steam">먼저 Steam을 닫으세요</string>
|
||||
|
||||
@@ -4109,7 +4109,6 @@
|
||||
<string name="theme_custom_signal">Sorotan</string>
|
||||
<string name="theme_custom_good">Berjaya</string>
|
||||
<string name="theme_custom_error">Ralat</string>
|
||||
<string name="theme_custom_warning">Amaran</string>
|
||||
<string name="hud_only_during_game">Paparkan HUD hanya semasa bermain</string>
|
||||
<string name="hud_only_during_game_hint">Sembunyikan HUD apabila bingkai permainan tidak dikesan.</string>
|
||||
<string name="steam_store_close_steam">Tutup Steam dahulu</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Uthevinger</string>
|
||||
<string name="theme_custom_good">Suksess</string>
|
||||
<string name="theme_custom_error">Feil</string>
|
||||
<string name="theme_custom_warning">Advarsel</string>
|
||||
<string name="hud_only_during_game">Vis HUD bare mens du spiller</string>
|
||||
<string name="hud_only_during_game_hint">Skjul HUD når ingen spillbilder registreres.</string>
|
||||
<string name="steam_store_close_steam">Lukk Steam først</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Accenten</string>
|
||||
<string name="theme_custom_good">Geslaagd</string>
|
||||
<string name="theme_custom_error">Fout</string>
|
||||
<string name="theme_custom_warning">Waarschuwing</string>
|
||||
<string name="hud_only_during_game">HUD alleen tijdens een game weergeven</string>
|
||||
<string name="hud_only_during_game_hint">Verberg de HUD wanneer er geen gameframes worden gedetecteerd.</string>
|
||||
<string name="steam_store_close_steam">Sluit eerst Steam</string>
|
||||
|
||||
@@ -4219,7 +4219,6 @@
|
||||
<string name="theme_custom_signal">Wyróżnienia</string>
|
||||
<string name="theme_custom_good">Sukces</string>
|
||||
<string name="theme_custom_error">Błąd</string>
|
||||
<string name="theme_custom_warning">Ostrzeżenie</string>
|
||||
<string name="hud_only_during_game">Pokazuj HUD tylko podczas gry</string>
|
||||
<string name="hud_only_during_game_hint">Ukryj HUD, gdy nie wykryto klatek gry.</string>
|
||||
<string name="steam_store_close_steam">Najpierw zamknij Steam</string>
|
||||
|
||||
@@ -1812,7 +1812,6 @@
|
||||
<string name="theme_custom_signal">Destaques e indicadores</string>
|
||||
<string name="theme_custom_good">Sucesso</string>
|
||||
<string name="theme_custom_error">Erro</string>
|
||||
<string name="theme_custom_warning">Aviso</string>
|
||||
<string name="pckb_key_esc">Esc</string>
|
||||
<string name="pckb_key_ins">Ins</string>
|
||||
<string name="pckb_key_del">Del</string>
|
||||
|
||||
@@ -1820,7 +1820,6 @@
|
||||
<string name="theme_custom_signal">Destaques e indicadores</string>
|
||||
<string name="theme_custom_good">Sucesso</string>
|
||||
<string name="theme_custom_error">Erro</string>
|
||||
<string name="theme_custom_warning">Aviso</string>
|
||||
<string name="pckb_key_esc">Esc</string>
|
||||
<string name="pckb_key_ins">Ins</string>
|
||||
<string name="pckb_key_del">Del</string>
|
||||
|
||||
@@ -4179,7 +4179,6 @@
|
||||
<string name="theme_custom_signal">Evidențieri</string>
|
||||
<string name="theme_custom_good">Succes</string>
|
||||
<string name="theme_custom_error">Eroare</string>
|
||||
<string name="theme_custom_warning">Avertisment</string>
|
||||
<string name="hud_only_during_game">Afișează HUD-ul doar în timpul jocului</string>
|
||||
<string name="hud_only_during_game_hint">Ascunde HUD-ul când nu sunt detectate cadre ale jocului.</string>
|
||||
<string name="steam_store_close_steam">Închide mai întâi Steam</string>
|
||||
|
||||
@@ -4220,7 +4220,6 @@
|
||||
<string name="theme_custom_signal">Выделения</string>
|
||||
<string name="theme_custom_good">Успех</string>
|
||||
<string name="theme_custom_error">Ошибка</string>
|
||||
<string name="theme_custom_warning">Предупреждение</string>
|
||||
<string name="hud_only_during_game">Показывать HUD только во время игры</string>
|
||||
<string name="hud_only_during_game_hint">Скрывать HUD, когда кадры игры не обнаруживаются.</string>
|
||||
<string name="steam_store_close_steam">Сначала закройте Steam</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Markeringar</string>
|
||||
<string name="theme_custom_good">Lyckades</string>
|
||||
<string name="theme_custom_error">Fel</string>
|
||||
<string name="theme_custom_warning">Varning</string>
|
||||
<string name="hud_only_during_game">Visa HUD endast under spel</string>
|
||||
<string name="hud_only_during_game_hint">Dölj HUD när inga spelbildrutor upptäcks.</string>
|
||||
<string name="steam_store_close_steam">Stäng Steam först</string>
|
||||
|
||||
@@ -4109,7 +4109,6 @@
|
||||
<string name="theme_custom_signal">จุดเน้น</string>
|
||||
<string name="theme_custom_good">สำเร็จ</string>
|
||||
<string name="theme_custom_error">ข้อผิดพลาด</string>
|
||||
<string name="theme_custom_warning">คำเตือน</string>
|
||||
<string name="hud_only_during_game">แสดง HUD เฉพาะขณะเล่นเกม</string>
|
||||
<string name="hud_only_during_game_hint">ซ่อน HUD เมื่อไม่พบเฟรมของเกม</string>
|
||||
<string name="steam_store_close_steam">ปิด Steam ก่อน</string>
|
||||
|
||||
@@ -4139,7 +4139,6 @@
|
||||
<string name="theme_custom_signal">Vurgular</string>
|
||||
<string name="theme_custom_good">Başarılı</string>
|
||||
<string name="theme_custom_error">Hata</string>
|
||||
<string name="theme_custom_warning">Uyarı</string>
|
||||
<string name="hud_only_during_game">HUD\'yi yalnızca oyun sırasında göster</string>
|
||||
<string name="hud_only_during_game_hint">Oyun kareleri algılanmadığında HUD\'yi gizle.</string>
|
||||
<string name="steam_store_close_steam">Önce Steam\'i kapatın</string>
|
||||
|
||||
@@ -4219,7 +4219,6 @@
|
||||
<string name="theme_custom_signal">Виділення</string>
|
||||
<string name="theme_custom_good">Успіх</string>
|
||||
<string name="theme_custom_error">Помилка</string>
|
||||
<string name="theme_custom_warning">Попередження</string>
|
||||
<string name="hud_only_during_game">Показувати HUD лише під час гри</string>
|
||||
<string name="hud_only_during_game_hint">Приховувати HUD, коли кадри гри не виявляються.</string>
|
||||
<string name="steam_store_close_steam">Спочатку закрийте Steam</string>
|
||||
|
||||
@@ -4109,7 +4109,6 @@
|
||||
<string name="theme_custom_signal">Điểm nhấn</string>
|
||||
<string name="theme_custom_good">Thành công</string>
|
||||
<string name="theme_custom_error">Lỗi</string>
|
||||
<string name="theme_custom_warning">Cảnh báo</string>
|
||||
<string name="hud_only_during_game">Chỉ hiển thị HUD khi đang chơi</string>
|
||||
<string name="hud_only_during_game_hint">Ẩn HUD khi không phát hiện khung hình trò chơi.</string>
|
||||
<string name="steam_store_close_steam">Hãy đóng Steam trước</string>
|
||||
|
||||
@@ -4109,7 +4109,6 @@
|
||||
<string name="theme_custom_signal">高亮</string>
|
||||
<string name="theme_custom_good">成功</string>
|
||||
<string name="theme_custom_error">错误</string>
|
||||
<string name="theme_custom_warning">警告</string>
|
||||
<string name="hud_only_during_game">仅在游戏期间显示 HUD</string>
|
||||
<string name="hud_only_during_game_hint">未检测到游戏帧时隐藏 HUD。</string>
|
||||
<string name="steam_store_close_steam">请先关闭 Steam</string>
|
||||
|
||||
@@ -4109,7 +4109,6 @@
|
||||
<string name="theme_custom_signal">重點標示</string>
|
||||
<string name="theme_custom_good">成功</string>
|
||||
<string name="theme_custom_error">錯誤</string>
|
||||
<string name="theme_custom_warning">警告</string>
|
||||
<string name="hud_only_during_game">只在遊戲期間顯示 HUD</string>
|
||||
<string name="hud_only_during_game_hint">未偵測到遊戲畫面時隱藏 HUD。</string>
|
||||
<string name="steam_store_close_steam">請先關閉 Steam</string>
|
||||
|
||||
@@ -4109,7 +4109,6 @@
|
||||
<string name="theme_custom_signal">醒目標示</string>
|
||||
<string name="theme_custom_good">成功</string>
|
||||
<string name="theme_custom_error">錯誤</string>
|
||||
<string name="theme_custom_warning">警告</string>
|
||||
<string name="hud_only_during_game">僅在遊戲期間顯示 HUD</string>
|
||||
<string name="hud_only_during_game_hint">未偵測到遊戲畫面時隱藏 HUD。</string>
|
||||
<string name="steam_store_close_steam">請先關閉 Steam</string>
|
||||
|
||||
@@ -2028,7 +2028,6 @@
|
||||
<string name="theme_custom_signal">Highlights</string>
|
||||
<string name="theme_custom_good">Success</string>
|
||||
<string name="theme_custom_error">Error</string>
|
||||
<string name="theme_custom_warning">Warning</string>
|
||||
<string name="pckb_key_esc">Esc</string>
|
||||
<string name="pckb_key_ins">Ins</string>
|
||||
<string name="pckb_key_del">Del</string>
|
||||
|
||||
@@ -333,6 +333,28 @@ class AgentSecurityTest {
|
||||
assertFalse(error.message!!.contains("synthetic-private-value"))
|
||||
}
|
||||
|
||||
@Test fun preferencesKeepTheTypeAStoredKeyHas() {
|
||||
AgentAccess.setCommandsEnabled(context, true)
|
||||
val session = context.getSharedPreferences("session", Context.MODE_PRIVATE)
|
||||
session.edit().clear().putBoolean("gameDebugLogsEnabled", false).putString("testText", "first").commit()
|
||||
|
||||
val error = refused("INVALID_PREF") { AgentPrefs.set(context, "session", "gameDebugLogsEnabled", "string", "true") }
|
||||
assertTrue(error.message!!.contains("bool"))
|
||||
assertEquals(false, session.all["gameDebugLogsEnabled"])
|
||||
refused("INVALID_PREF") { AgentPrefs.set(context, "session", "testText", "bool", "true") }
|
||||
assertEquals("first", session.all["testText"])
|
||||
|
||||
assertEquals(true, AgentPrefs.set(context, "session", "gameDebugLogsEnabled", "bool", "true").get("value"))
|
||||
assertEquals("second", AgentPrefs.set(context, "session", "testText", "string", "second").get("value"))
|
||||
assertEquals("fresh", AgentPrefs.set(context, "session", "unsetKey", "string", "fresh").get("value"))
|
||||
|
||||
session.edit().putString("gameDebugLogsEnabled", "true").commit()
|
||||
AgentPrefs.set(context, "session", "gameDebugLogsEnabled", "remove", null)
|
||||
assertEquals(false, AgentPrefs.set(context, "session", "gameDebugLogsEnabled", "bool", "false").get("value"))
|
||||
assertEquals(false, session.all["gameDebugLogsEnabled"])
|
||||
session.edit().clear().commit()
|
||||
}
|
||||
|
||||
@Test fun overrideRefusesLinksAndTraversalNames() {
|
||||
AgentAccess.setCommandsEnabled(context, true)
|
||||
for (name in listOf(".", "..", "../gamescope")) refused("INVALID_NAME") { AgentEnv.override(context, name) }
|
||||
|
||||
@@ -29,7 +29,7 @@ class DirectTouchHoldTest {
|
||||
override fun move(pointerId: Int, x: Float, y: Float) { touches += "move $pointerId at $x,$y" }
|
||||
override fun up(pointerId: Int, x: Float, y: Float) { touches += "up $pointerId at $x,$y" }
|
||||
override fun cancel() { touches += "cancel" }
|
||||
}).also { it.configure(TouchGestureConfig(longPressEnabled = true, longPressDelay = 500)) }
|
||||
}).also { it.configure(TouchGestureConfig(longPressDelay = 500, directHoldBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_CLICK)) }
|
||||
|
||||
@Test fun holdClicksRightWithoutTouchingTheGame() {
|
||||
touch(MotionEvent.ACTION_DOWN)
|
||||
@@ -87,18 +87,49 @@ class DirectTouchHoldTest {
|
||||
assertEquals(listOf("down 0 at 40.0,30.0", "up 0 at 44.0,30.0"), touches)
|
||||
}
|
||||
|
||||
@Test fun stillHoldClicksRightWithTheDefaultConfig() {
|
||||
@Test fun stillHoldStaysHeldWithTheDefaultConfig() {
|
||||
hold.configure(TouchGestureConfig())
|
||||
touch(MotionEvent.ACTION_DOWN)
|
||||
assertEquals(listOf("down 0 at 40.0,30.0"), touches)
|
||||
advance(2000)
|
||||
touch(MotionEvent.ACTION_MOVE)
|
||||
assertEquals(listOf("true at 40.0,30.0", "false at 40.0,30.0"), buttons)
|
||||
touch(MotionEvent.ACTION_UP)
|
||||
assertEquals(listOf("down 0 at 40.0,30.0", "up 0 at 40.0,30.0"), touches)
|
||||
assertTrue(buttons.isEmpty())
|
||||
}
|
||||
|
||||
@Test fun aSavedRightClickChoiceIsKept() {
|
||||
val saved = TouchGestureConfig.fromJson(
|
||||
TouchGestureConfig(directHoldBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_CLICK).toJson())
|
||||
assertEquals(TouchGestureConfig.MOUSE_BEHAVIOR_CLICK, saved.directHoldBehavior)
|
||||
hold.configure(saved)
|
||||
touch(MotionEvent.ACTION_DOWN)
|
||||
advance(2000)
|
||||
touch(MotionEvent.ACTION_UP)
|
||||
assertEquals(listOf("true at 40.0,30.0", "false at 40.0,30.0"), buttons)
|
||||
assertTrue(touches.isEmpty())
|
||||
}
|
||||
|
||||
@Test fun aHeldTouchLiftsAtOnce() {
|
||||
hold.configure(TouchGestureConfig())
|
||||
touch(MotionEvent.ACTION_DOWN)
|
||||
advance(80)
|
||||
touch(MotionEvent.ACTION_UP)
|
||||
assertEquals(listOf("down 0 at 40.0,30.0", "up 0 at 40.0,30.0"), touches)
|
||||
}
|
||||
|
||||
@Test fun aShortTapStaysPressedLongEnoughToBeSeen() {
|
||||
hold.configure(TouchGestureConfig())
|
||||
touch(MotionEvent.ACTION_DOWN)
|
||||
advance(10)
|
||||
touch(MotionEvent.ACTION_UP)
|
||||
advance(39)
|
||||
assertEquals(listOf("down 0 at 40.0,30.0"), touches)
|
||||
advance(1)
|
||||
assertEquals(listOf("down 0 at 40.0,30.0", "up 0 at 40.0,30.0"), touches)
|
||||
}
|
||||
|
||||
@Test fun longPressFollowsTheConfiguredDelay() {
|
||||
hold.configure(TouchGestureConfig(longPressEnabled = true, longPressDelay = 800))
|
||||
hold.configure(TouchGestureConfig(longPressDelay = 800, directHoldBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_CLICK))
|
||||
touch(MotionEvent.ACTION_DOWN)
|
||||
advance(700)
|
||||
assertTrue(buttons.isEmpty())
|
||||
@@ -201,25 +232,6 @@ class DirectTouchHoldTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test fun aDragLiftsAtOnce() {
|
||||
touch(MotionEvent.ACTION_DOWN)
|
||||
touch(MotionEvent.ACTION_MOVE, 80f)
|
||||
advance(80)
|
||||
touches.clear()
|
||||
touch(MotionEvent.ACTION_UP, 80f)
|
||||
assertEquals(listOf("up 0 at 80.0,30.0"), touches)
|
||||
}
|
||||
|
||||
@Test fun aTapStaysPressedLongEnoughToBeSeen() {
|
||||
touch(MotionEvent.ACTION_DOWN)
|
||||
advance(10)
|
||||
touch(MotionEvent.ACTION_UP)
|
||||
advance(49)
|
||||
assertEquals(listOf("down 0 at 40.0,30.0"), touches)
|
||||
advance(1)
|
||||
assertEquals(listOf("down 0 at 40.0,30.0", "up 0 at 40.0,30.0"), touches)
|
||||
}
|
||||
|
||||
private fun advance(ms: Long) = shadowOf(Looper.getMainLooper()).idleFor(Duration.ofMillis(ms))
|
||||
private fun touch(action: Int, x: Float = 40f): Boolean {
|
||||
val event = MotionEvent.obtain(0, 0, action, x, 30f, 0)
|
||||
|
||||
@@ -152,7 +152,8 @@ class SessionGestureRoutingTest {
|
||||
|
||||
@Test fun pausingCancelsPendingHoldsInBothTouchModes() {
|
||||
for (mode in listOf(SessionPrefs.TOUCH_GESTURES, SessionPrefs.TOUCH_DIRECT)) {
|
||||
prepare(mode, TouchGestureConfig(longPressEnabled = true, longPressAction = "key_E"))
|
||||
prepare(mode, TouchGestureConfig(longPressEnabled = true, longPressAction = "key_E",
|
||||
directHoldBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_CLICK))
|
||||
val now = SystemClock.uptimeMillis()
|
||||
val event = MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, 400f, 300f, 0)
|
||||
try { assertTrue(activity.onTouchEvent(event)) } finally { event.recycle() }
|
||||
@@ -167,7 +168,8 @@ class SessionGestureRoutingTest {
|
||||
for (mode in listOf(SessionPrefs.TOUCH_GESTURES, SessionPrefs.TOUCH_DIRECT)) {
|
||||
keys.clear()
|
||||
directButtons.clear()
|
||||
prepare(mode, TouchGestureConfig(longPressEnabled = true, longPressAction = "key_E"))
|
||||
prepare(mode, TouchGestureConfig(longPressEnabled = true, longPressAction = "key_E",
|
||||
directHoldBehavior = TouchGestureConfig.MOUSE_BEHAVIOR_CLICK))
|
||||
val now = SystemClock.uptimeMillis()
|
||||
val event = MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, 400f, 300f, 0)
|
||||
try { assertTrue(activity.onTouchEvent(event)) } finally { event.recycle() }
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.droiddeck.launcher.session
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [34], manifest = Config.NONE, application = Application::class)
|
||||
class TolerantPrefsTest {
|
||||
private val context get() = RuntimeEnvironment.getApplication()
|
||||
private val raw get() = context.getSharedPreferences("session", Context.MODE_PRIVATE)
|
||||
|
||||
@Before fun reset() {
|
||||
raw.edit().clear().commit()
|
||||
}
|
||||
|
||||
@After fun cleanup() {
|
||||
raw.edit().clear().commit()
|
||||
}
|
||||
|
||||
@Test fun aSwitchStoredAsTextReadsAsItsValue() {
|
||||
raw.edit().putString("gameDebugLogsEnabled", "true").putString("logs", "false").commit()
|
||||
|
||||
assertTrue(SessionPrefs.gameDebugLogsEnabled(context))
|
||||
assertFalse(SessionPrefs.logsEnabled(context))
|
||||
}
|
||||
|
||||
@Test fun unreadableTextFallsBackToTheDefault() {
|
||||
raw.edit().putString("gameDebugLogsEnabled", "yes").putString("logs", "").commit()
|
||||
|
||||
assertFalse(SessionPrefs.gameDebugLogsEnabled(context))
|
||||
assertTrue(SessionPrefs.logsEnabled(context))
|
||||
}
|
||||
|
||||
@Test fun everyTypedReadToleratesAnotherStoredType() {
|
||||
raw.edit()
|
||||
.putString("count", "7")
|
||||
.putString("big", "8000000000")
|
||||
.putString("ratio", "1.5")
|
||||
.putBoolean("label", true)
|
||||
.putInt("names", 3)
|
||||
.commit()
|
||||
val prefs = TolerantPrefs.session(context)
|
||||
|
||||
assertEquals(7, prefs.getInt("count", 0))
|
||||
assertEquals(8_000_000_000L, prefs.getLong("big", 0L))
|
||||
assertEquals(1.5f, prefs.getFloat("ratio", 0f), 0f)
|
||||
assertEquals("true", prefs.getString("label", null))
|
||||
assertEquals(setOf("x"), prefs.getStringSet("names", mutableSetOf("x")))
|
||||
assertEquals(0, prefs.getInt("ratio", 0))
|
||||
}
|
||||
|
||||
@Test fun correctlyTypedSettingsAreUnchanged() {
|
||||
raw.edit().putBoolean("gameDebugLogsEnabled", true).putBoolean("logs", false).putString("theme", "paper").commit()
|
||||
|
||||
assertTrue(SessionPrefs.gameDebugLogsEnabled(context))
|
||||
assertFalse(SessionPrefs.logsEnabled(context))
|
||||
assertEquals("paper", SessionPrefs.theme(context))
|
||||
}
|
||||
|
||||
@Test fun aSessionEndRepairsTheStoredType() {
|
||||
raw.edit().putString("gameDebugLogsEnabled", "true").commit()
|
||||
|
||||
SessionPrefs.expireGameDebugLogs(context)
|
||||
|
||||
assertEquals(false, raw.all["gameDebugLogsEnabled"])
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.droiddeck.launcher.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class IdleFramesTest {
|
||||
@Test
|
||||
fun idleLoopsDrawThirtyFramesASecondAndShareEachOne() {
|
||||
val start = 5_000_000_000L
|
||||
val frame = 8_333_333L
|
||||
val drawn = (0 until 120).count { IdleFrames.due(start + it * frame) }
|
||||
assertEquals(30, drawn)
|
||||
|
||||
val later = start + 1_000_000_000L
|
||||
assertEquals(listOf(true, true, true), List(3) { IdleFrames.due(later) })
|
||||
assertEquals(listOf(false, false), List(2) { IdleFrames.due(later + frame) })
|
||||
assertEquals(listOf(true, true), List(2) { IdleFrames.due(later + 4 * frame) })
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,10 @@ Player controls and observations work over authorized ADB on any build: `state`,
|
||||
**Setup > Developer > Debugging tools** is off by default in every build, including debug builds.
|
||||
It enables `run`, `guest`, `cdp`, all `env` operations, `override`, `prefs`, and `glasses raw`. The
|
||||
toggle switches directly without a confirmation dialog. The bridge refuses to change it through `ui`
|
||||
or preference writes. The existing preference key, `setting-agent-commands` test tag, JSON command
|
||||
names, and `AGENT_COMMANDS_DISABLED` error code are unchanged. Refusals exit 7; `droiddeckctl access`
|
||||
reports whether commands are enabled.
|
||||
or preference writes. `prefs set` refuses to change the type a key is stored as; remove the key
|
||||
first. The existing preference key, `setting-agent-commands` test tag, JSON command names, and
|
||||
`AGENT_COMMANDS_DISABLED` error code are unchanged. Refusals exit 7; `droiddeckctl access` reports
|
||||
whether commands are enabled.
|
||||
|
||||
Disabling the toggle clears queued and persistent agent environment settings and installed binary
|
||||
overrides. Disabled settings cannot apply at the next session start. Already running commands and
|
||||
@@ -165,6 +166,7 @@ tools/droiddeckctl proot-profile disable
|
||||
tools/droiddeckctl proot-profile report ./session.log --sort wall
|
||||
tools/droiddeckctl prefs get session
|
||||
tools/droiddeckctl prefs set session some_key true --type bool
|
||||
tools/droiddeckctl prefs set session some_key --type remove
|
||||
|
||||
tools/droiddeckctl logs latest ./session-artifacts
|
||||
tools/droiddeckctl screenshot ./screen.png --display 4
|
||||
|
||||
Reference in new issue
Block a user