mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-26 00:06:02 +00:00
fix: give the QAM chord a Guide lead that stretches with slow frames so A is not taken as a press (#70)
* fix: give the QAM chord a Guide lead that stretches with slow frames so A is not taken as a press * fix: start the QAM Guide lead at 80 ms and stretch it only when frames are slow * fix: set the QAM Guide lead minimum to 80 ms * fix: use Android's 300 ms double-tap window for Back so the single-press action comes sooner * fix: keep the 500 ms Back double-press window
This commit is contained in:
1 parent
32930e704e
commit
d4636afa97
2 files changed
+48
-6
No files matched your search
@@ -67,9 +67,30 @@ public final class WaylandCompositor {
|
||||
if (l != null) l.onGameSurface(window, gpuName);
|
||||
}
|
||||
|
||||
private static volatile long lastFrameNanos;
|
||||
private static volatile long frameIntervalNanos;
|
||||
|
||||
/**
|
||||
* How long frames are taking to arrive right now, in ms, or -1 before the first: the smoothed
|
||||
* interval, or the time since the last frame when that is longer (a session that has stalled).
|
||||
*/
|
||||
public static long recentFrameIntervalMs() {
|
||||
long last = lastFrameNanos;
|
||||
if (last == 0) return -1;
|
||||
return Math.max(frameIntervalNanos, System.nanoTime() - last) / 1_000_000;
|
||||
}
|
||||
|
||||
/** Invoked from native (banner_on_game_frame) for every frame of the HUD's window. */
|
||||
@SuppressWarnings("unused")
|
||||
static void onGameFrame() {
|
||||
long now = System.nanoTime();
|
||||
long previous = lastFrameNanos;
|
||||
lastFrameNanos = now;
|
||||
if (previous != 0) {
|
||||
long interval = now - previous;
|
||||
long smoothed = frameIntervalNanos;
|
||||
frameIntervalNanos = smoothed == 0 ? interval : (smoothed * 3 + interval) / 4;
|
||||
}
|
||||
com.droiddeck.launcher.session.PerfHints.onFrame();
|
||||
GameListener l = gameListener;
|
||||
if (l != null) l.onGameFrame();
|
||||
|
||||
Reference in new issue
Block a user