mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-11 02:51:10 +00:00
* 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
83 lines
2.8 KiB
C
83 lines
2.8 KiB
C
#include <sys/resource.h>
|
|
#include <string.h>
|
|
|
|
static __thread uintptr_t svc_stack_low __attribute__((tls_model("initial-exec")));
|
|
static __thread uintptr_t svc_stack_high __attribute__((tls_model("initial-exec")));
|
|
static __thread uintptr_t svc_stack_gap __attribute__((tls_model("initial-exec")));
|
|
static __thread int svc_stack_main __attribute__((tls_model("initial-exec")));
|
|
|
|
static int svc_hex(const char **text, uintptr_t *value) {
|
|
const char *p = *text;
|
|
uintptr_t n = 0;
|
|
int digits = 0;
|
|
for (;; p++) {
|
|
unsigned c = (unsigned char)*p;
|
|
unsigned d = c >= '0' && c <= '9' ? c - '0' : c >= 'a' && c <= 'f' ? c - 'a' + 10 : 16;
|
|
if (d == 16) break;
|
|
if (++digits > (int)(2 * sizeof n)) return 0;
|
|
n = (n << 4) | d;
|
|
}
|
|
*text = p;
|
|
*value = n;
|
|
return digits > 0;
|
|
}
|
|
|
|
static int svc_stack_line(const char *line, uintptr_t sp, uintptr_t *low, uintptr_t *high) {
|
|
uintptr_t a, b;
|
|
if (!svc_hex(&line, &a) || *line++ != '-' || !svc_hex(&line, &b) ||
|
|
*line++ != ' ' || line[0] != 'r' || line[1] != 'w' || a >= b || sp < a || sp >= b) return 0;
|
|
*low = a;
|
|
*high = b;
|
|
return 1;
|
|
}
|
|
|
|
static __attribute__((noinline)) int svc_stack_find(uintptr_t sp) {
|
|
char chunk[512], line[96];
|
|
size_t at = 0;
|
|
long fd = sc(SYS_openat, AT_FDCWD, (long)"/proc/self/maps", O_RDONLY | O_CLOEXEC, 0, 0);
|
|
if (fd < 0) return 0;
|
|
long n;
|
|
uintptr_t low = 0, high = 0, previous = 0;
|
|
int found = 0;
|
|
while (!found && (n = sc(SYS_read, fd, (long)chunk, sizeof chunk, 0, 0)) > 0) {
|
|
for (long i = 0; i < n; i++) {
|
|
if (chunk[i] == '\n') {
|
|
line[at] = 0;
|
|
found = svc_stack_line(line, sp, &low, &high);
|
|
if (!found) {
|
|
const char *p = line;
|
|
uintptr_t a, b;
|
|
if (svc_hex(&p, &a) && *p++ == '-' && svc_hex(&p, &b) && b <= sp) previous = b;
|
|
}
|
|
at = 0;
|
|
if (found) break;
|
|
} else if (at < sizeof line - 1) line[at++] = chunk[i];
|
|
}
|
|
}
|
|
sc(SYS_close, fd, 0, 0, 0, 0);
|
|
if (found) {
|
|
svc_stack_low = 0;
|
|
svc_stack_high = high;
|
|
svc_stack_main = strstr(line, "[stack]") != NULL;
|
|
svc_stack_gap = previous < low && low - previous > 16 * 1024 * 1024 ? previous + 16 * 1024 * 1024 : low;
|
|
svc_stack_low = low;
|
|
}
|
|
return found;
|
|
}
|
|
|
|
static int svc_stack_room(uintptr_t sp) {
|
|
stack_t alt;
|
|
if (sc(SYS_sigaltstack, 0, (long)&alt, 0, 0, 0) < 0 || (alt.ss_flags & SS_ONSTACK)) return 0;
|
|
if (!svc_stack_low || sp < svc_stack_low || sp >= svc_stack_high)
|
|
if (!svc_stack_find(sp)) return 0;
|
|
uintptr_t low = svc_stack_low;
|
|
if (svc_stack_main) {
|
|
struct rlimit limit;
|
|
if (sc(SYS_prlimit64, 0, RLIMIT_STACK, 0, (long)&limit, 0) < 0) return 0;
|
|
uintptr_t grow = limit.rlim_cur >= svc_stack_high ? 0 : svc_stack_high - limit.rlim_cur;
|
|
if (grow < svc_stack_gap) grow = svc_stack_gap;
|
|
if (grow < low) low = grow;
|
|
}
|
|
return sp - low >= 96 * 1024;
|
|
}
|