mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
chore: remove source comments and unused code, translate every missing string (#1965)
* chore(i18n): translate every missing string in all locales Adds the 87 strings the bottom-screen Dashboard and in-game stats pages introduced to all 32 locales, plus the 51 older settings strings Japanese and the 50 Chinese locales were still missing. Every locale now has all 3456 translatable strings with the same placeholders as English. Also translates 36 entries that were still English where the language does not use the English word, and makes es-419 touch_app_id use the same %1$s placeholder as English. * chore(patches): drop comments from the lines downstream patches add Removes comment lines and trailing comments from lines our patches add, with hunk headers recounted. Lines that a later patch uses as context and the upstream backport 0123 are left as they are. The gamescope, FEX, proot and xodus series still apply to their pinned sources, and the patched trees differ only in those comments. test_hud_frames now finds the HUD writer by its first declaration. * docs: credit Greenlight, Better xCloud, viture-v2, GameNative and DiRTTelemetryErrorFix These were credited only in source headers and NOTICE files. * chore: remove source comments and unused functions Removes explanatory comments from first-party Kotlin, Java, C, C++, Rust, TypeScript, Python, shell, Gradle, CMake and workflow files. License and attribution headers stay, and vendored third-party trees, generated files and license files are untouched. A shellcheck directive is kept, and udevmon's fallthrough comments became fallthrough attributes. Syntax trees and token streams match the previous sources apart from the comments and Python docstrings. Module docstrings that argparse prints are kept, and device-smoke.sh prints the same --help text from a heredoc. Also removes 37 functions and 4 fields that nothing referenced. * chore: remove comments from the Syncthing integration and the latest main sources * docs: credit Syncthing and the syncthing-android fork * chore(i18n): translate the Syncthing strings in all locales The 107 strings the Syncthing integration added are now in all 32 locales. sync_web_path_locked names the Syncthing tab by its label. * docs: credit @xXJSONDeruloXx for the HUD metric readers The CPU, GPU load, thermal and battery readers come from their PerformanceHudView pull requests #777, #877, #991, #1406 and #1573. The FusionHUD credit line is unchanged. * docs: credit the HUD metric readers to @xXJSONDeruloXx's work
This commit is contained in:
1 parent
d730f0fa8b
commit
c5577478ca
511 files changed
+6813
-4068
No files matched your search
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Bundles the cloud player page script with esbuild 0.24.0 (ESBUILD=/path/to/esbuild, default: esbuild on PATH).
|
||||
set -euo pipefail
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
repo=$(cd "$here/../.." && pwd)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// DroidDeck cloud player page: runs one Xbox Cloud Gaming session. Every request to Microsoft goes
|
||||
// through the app (DDCloud), which holds the tokens; this page only does WebRTC, video, sound and input.
|
||||
import xCloudPlayer from './greenlight/lib/player'
|
||||
import Gamepad from './greenlight/lib/input/gamepad'
|
||||
import { EffectRenderer, Effects, needsRenderer } from './renderer'
|
||||
@@ -9,21 +7,19 @@ import { capVideoBitrate, preferH264Profile } from './sdp-tweaks'
|
||||
interface Reply { status: number, body: string }
|
||||
declare const DDCloud: { call(id: number, op: string, arg: string): void, status(text: string): void, failed(stage: string, detail: string): void, playing(): void, log(text: string): void, settings(): string }
|
||||
|
||||
/** The player settings the app hands over (XboxCloudSettings.toJson); stream-start ones are applied by the app. */
|
||||
interface Settings extends Effects {
|
||||
bitrateMbps: number // 0 = Microsoft's own limit
|
||||
codec: string // 'default' | 'high' | 'normal' | 'low'
|
||||
bitrateMbps: number
|
||||
codec: string
|
||||
preventDrops: boolean
|
||||
statsLevel: number // 0 off, 1 fps, 2 basic, 3 detailed, 4 full
|
||||
statsLayout: string // 'horizontal' | 'vertical'
|
||||
statsCorner: string // 'right' | 'left'
|
||||
server: string // the region's host, for the full overlay
|
||||
volume: number // 100..300 %
|
||||
rumble: number // 0..100 %
|
||||
statsLevel: number
|
||||
statsLayout: string
|
||||
statsCorner: string
|
||||
server: string
|
||||
volume: number
|
||||
rumble: number
|
||||
}
|
||||
let settings: Settings = JSON.parse(DDCloud.settings())
|
||||
|
||||
// Codec profile and bitrate cap go into our offer (Better xCloud's approach).
|
||||
const nativeSetLocalDescription = RTCPeerConnection.prototype.setLocalDescription
|
||||
RTCPeerConnection.prototype.setLocalDescription = function (this: RTCPeerConnection, description?: RTCLocalSessionDescriptionInit) {
|
||||
if (description?.sdp) {
|
||||
@@ -34,7 +30,6 @@ RTCPeerConnection.prototype.setLocalDescription = function (this: RTCPeerConnect
|
||||
} as typeof RTCPeerConnection.prototype.setLocalDescription
|
||||
;(window as any).__ddRumble = settings.rumble / 100
|
||||
|
||||
// Page errors go to the app's Xbox log (no tokens ever reach this page).
|
||||
window.addEventListener('error', event => DDCloud.log(`error: ${event.message} @${event.lineno}`))
|
||||
window.addEventListener('unhandledrejection', event => DDCloud.log(`rejection: ${String(event.reason).slice(0, 200)}`))
|
||||
window.addEventListener('gamepadconnected', event => DDCloud.log(`controller: ${event.gamepad.id.slice(0, 60)} mapping=${event.gamepad.mapping || 'none'} buttons=${event.gamepad.buttons.length} axes=${event.gamepad.axes.length}`))
|
||||
@@ -112,8 +107,6 @@ async function run() {
|
||||
player.init()
|
||||
const pc = player._peerConnection
|
||||
|
||||
// "Stop quality drops": report a short decode time so the server does not lower the resolution
|
||||
// for a slow decoder (Better xCloud's patchStreamMetadata).
|
||||
const input = player._channels.input as any
|
||||
const queueMetadata = input.queueMetadataFrame.bind(input)
|
||||
input.queueMetadataFrame = (frame: any) => {
|
||||
@@ -125,7 +118,6 @@ async function run() {
|
||||
queueMetadata(frame)
|
||||
}
|
||||
|
||||
// Volume above 100 %: the stream's sound goes through a gain node instead of the <audio> element.
|
||||
let gain: GainNode | undefined
|
||||
let audioStream: MediaStream | undefined
|
||||
const applyVolume = () => {
|
||||
@@ -154,7 +146,6 @@ async function run() {
|
||||
catch (error) { DDCloud.log(`effects unavailable: ${String(error).slice(0, 200)}`) }
|
||||
} else renderer.resume(settings)
|
||||
}
|
||||
// Live changes from the in-player menu.
|
||||
;(window as any).__ddApply = (json: string) => {
|
||||
settings = JSON.parse(json)
|
||||
;(window as any).__ddRumble = settings.rumble / 100
|
||||
@@ -166,7 +157,6 @@ async function run() {
|
||||
if (pc.connectionState === 'connected') {
|
||||
show(''); DDCloud.playing()
|
||||
stats.show(settings.statsLevel, settings.statsLayout === 'vertical', settings.server, settings.statsCorner === 'left')
|
||||
// The video element exists once its track arrived; give it a moment for its first frame.
|
||||
setTimeout(applyEffects, 500)
|
||||
}
|
||||
else if (pc.connectionState === 'failed') DDCloud.failed('webrtc', 'connection failed')
|
||||
@@ -186,8 +176,6 @@ async function run() {
|
||||
const ice = expect('ice', await call('ice', local))
|
||||
player.setRemoteIceCandidates(JSON.parse(JSON.parse(ice.body).exchangeResponse))
|
||||
|
||||
// The control channel's authorization (sent on the message handshake) announces controller 0 and
|
||||
// then removes it, clearing any handler attached before; attach the controller after that.
|
||||
const handshake = Date.now()
|
||||
while (!player._channels.message._handshakeCompleted && Date.now() - handshake < 20_000) await sleep(100)
|
||||
DDCloud.log(`handshake ${player._channels.message._handshakeCompleted ? 'done' : 'missing'} after ${Date.now() - handshake} ms`)
|
||||
@@ -195,15 +183,12 @@ async function run() {
|
||||
const pad = new Gamepad(0, { enable_keyboard: false })
|
||||
pad.attach(player)
|
||||
DDCloud.log(`controllers at attach: ${Array.from(navigator.getGamepads()).filter(Boolean).length}`)
|
||||
// The app's "Xbox button" (in the leave dialog) presses Nexus for a moment.
|
||||
;(window as any).__ddNexus = () => { pad.sendButtonState('Nexus', 1); setTimeout(() => pad.sendButtonState('Nexus', 0), 200) }
|
||||
// The app's menu button / a controller's Guide button: Nexus follows the physical button.
|
||||
;(window as any).__ddButton = (name: string, value: number) => pad.sendButtonState(name, value)
|
||||
// The in-player menu pauses controller input to the game while it is open.
|
||||
;(window as any).__ddInput = (enabled: boolean) => { if (enabled) pad.onWindowFocus(); else pad.onWindowBlur() }
|
||||
|
||||
setInterval(() => { call('keepalive') }, 30_000)
|
||||
;(window as any).__ddStop = () => { try { renderer?.destroy(); stats.destroy(); pad.detach(); player.destroy() } catch (e) { /* closing anyway */ } }
|
||||
;(window as any).__ddStop = () => { try { renderer?.destroy(); stats.destroy(); pad.detach(); player.destroy() } catch (e) { } }
|
||||
}
|
||||
|
||||
run().catch((error: unknown) => {
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
// Picture effects for the stream: the video is drawn through WebGL2 shaders onto a canvas over it.
|
||||
// Base pass: sharpening (CAS / unsharp mask, from Better xCloud by redphx, MIT) plus DroidDeck's colour
|
||||
// grading (brightness, contrast, saturation, gamma) and deband dither. Extra passes are DroidDeck's own
|
||||
// screen effects (FXAA, Toon, CRT, NTSC, from Bannerlator). Off (no canvas) when nothing is set.
|
||||
// Sharpening (CAS and unsharp mask) from Better xCloud by redphx, MIT. Screen effects from Bannerlator.
|
||||
|
||||
export interface Effects {
|
||||
brightness: number // -50..50 (DroidDeck's slider units)
|
||||
contrast: number // -100..100
|
||||
gamma: number // 0.5..3
|
||||
saturation: number // 0..200 %
|
||||
sharpen: number // 0..10
|
||||
sharpenMode: string // 'cas' | 'usm'
|
||||
deband: number // 0..8 (dither amplitude in 8-bit steps)
|
||||
brightness: number
|
||||
contrast: number
|
||||
gamma: number
|
||||
saturation: number
|
||||
sharpen: number
|
||||
sharpenMode: string
|
||||
deband: number
|
||||
fxaa: boolean
|
||||
toon: boolean
|
||||
crt: boolean
|
||||
ntsc: boolean
|
||||
maxFps: number // 0 = every frame
|
||||
maxFps: number
|
||||
}
|
||||
|
||||
export function needsRenderer(e: Effects): boolean {
|
||||
@@ -82,7 +79,6 @@ void main() {
|
||||
fragColor = vec4(color, 1.0);
|
||||
}`
|
||||
|
||||
// Screen-effect shaders from Bannerlator (GLSL ES 1.00), unchanged.
|
||||
const FXAA = `precision highp float;
|
||||
#define FXAA_MIN_REDUCE (1.0 / 128.0)
|
||||
#define FXAA_MUL_REDUCE (1.0 / 8.0)
|
||||
@@ -246,7 +242,6 @@ export class EffectRenderer {
|
||||
|
||||
update(effects: Effects) { this.effects = effects }
|
||||
|
||||
// Turning effects off hides the canvas but keeps the GL context: losing and recreating it can stall the stream.
|
||||
pause() { if (this.idle || this.stopped) return; this.idle = true; this.canvas.style.display = 'none' }
|
||||
|
||||
resume(effects: Effects) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Offer tweaks after Better xCloud by redphx (MIT, src/utils/sdp.ts): prefer an H.264 profile, cap bitrate.
|
||||
// Offer tweaks after Better xCloud by redphx (MIT, src/utils/sdp.ts).
|
||||
|
||||
/** Moves the H.264 payloads of the chosen profile to the front of the video m-line. */
|
||||
export function preferH264Profile(sdp: string, profile: 'high' | 'normal' | 'low'): string {
|
||||
const prefix = profile === 'high' ? '4d' : (profile === 'low' ? '420' : '42e')
|
||||
const preferred: string[] = []
|
||||
@@ -17,7 +16,6 @@ export function preferH264Profile(sdp: string, profile: 'high' | 'normal' | 'low
|
||||
return lines.join('\r\n')
|
||||
}
|
||||
|
||||
/** Sets b=AS (kbit/s) on the video m-section. */
|
||||
export function capVideoBitrate(sdp: string, kbps: number): string {
|
||||
const lines = sdp.split('\r\n')
|
||||
const start = lines.findIndex(line => line.startsWith('m=video'))
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
// Performance overlay in the top-right or top-left corner, from WebRTC getStats. Levels: 1 fps; 2 + ping, resolution;
|
||||
// 3 + bitrate, decode time, packet loss; 4 + codec, jitter, dropped frames, server. Horizontal or vertical.
|
||||
|
||||
export class StreamStats {
|
||||
private element: HTMLDivElement
|
||||
private timer: ReturnType<typeof setInterval> | undefined
|
||||
@@ -22,7 +19,6 @@ export class StreamStats {
|
||||
|
||||
show(level: number, vertical: boolean, server: string, left = false) {
|
||||
this.level = level; this.vertical = vertical; this.server = server; this.left = left
|
||||
// Top left keeps clear of the clock Xbox draws top right while its guide is open.
|
||||
Object.assign(this.element.style, left ? { left: '8px', right: '', textAlign: 'left' } : { left: '', right: '8px', textAlign: 'right' })
|
||||
this.element.style.display = level > 0 ? 'block' : 'none'
|
||||
if (level > 0 && this.timer === undefined) { this.timer = setInterval(() => this.update(), 1000); this.update() }
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
// Stand-in for the "uuid" package (only v4 is used by the Greenlight player).
|
||||
export function v4(): string { return crypto.randomUUID() }
|
||||
Reference in new issue
Block a user