mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 14:26:00 +00:00
perf(epic): keep the hidden launcher from loading its store and Fab pages, and compress it while games run (#1764)
* perf(epic): keep the hidden launcher from loading its store and Fab pages, and compress it while games run The hidden Epic Games Launcher that stays up for sign-in while a game runs pre-warmed its store and Fab pages on a display nobody sees. Under FEX each page used about one core and grew past a gigabyte, crashing and reloading in a loop. The hidden instance now skips the store pre-warm, gets a blank page in place of Fab, and is paged out to zRAM with the Steam client once a game has focus. The visible launcher is unchanged. * test(zram): keep the scan fixture PIDs above the kernel PID range
This commit is contained in:
1 parent
29c83976d0
commit
9f7f6d821d
7 files changed
+184
-8
No files matched your search
@@ -22,6 +22,7 @@ extern void webkit_web_view_run_javascript(void *view, const char *script, void
|
||||
extern WebKitUserScript *webkit_user_script_new(const char *source, int frames, int time,
|
||||
const char *const *allow, const char *const *block) __attribute__((weak));
|
||||
extern void webkit_user_script_unref(WebKitUserScript *script) __attribute__((weak));
|
||||
extern const char *g_getenv(const char *name) __attribute__((weak));
|
||||
|
||||
static const char NAV_SCRIPT[] =
|
||||
"(()=>{let open=-1e9,arrowAt=-1e9,ringed=null,ringOutline='',ringOffset='',settleTimer=0,settling=false,redirecting=false;"
|
||||
@@ -196,3 +197,45 @@ __attribute__((visibility("default"))) void webkit_user_content_manager_add_scri
|
||||
}
|
||||
next(manager, script);
|
||||
}
|
||||
|
||||
static int starts(const char *text, const char *prefix)
|
||||
{
|
||||
while (*prefix)
|
||||
if (*text++ != *prefix++)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int fab_uri(const char *uri)
|
||||
{
|
||||
if (!uri)
|
||||
return 0;
|
||||
if (starts(uri, "https://"))
|
||||
uri += 8;
|
||||
else if (starts(uri, "http://"))
|
||||
uri += 7;
|
||||
else
|
||||
return 0;
|
||||
if (starts(uri, "www."))
|
||||
uri += 4;
|
||||
if (!starts(uri, "fab.com"))
|
||||
return 0;
|
||||
uri += 7;
|
||||
return !*uri || *uri == '/' || *uri == '?' || *uri == '#' || *uri == ':';
|
||||
}
|
||||
|
||||
static int hidden_launcher(void)
|
||||
{
|
||||
const char *hidden = g_getenv ? g_getenv("DROIDDECK_EPIC_HIDDEN") : 0;
|
||||
return hidden && hidden[0] == '1' && !hidden[1];
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) void webkit_web_view_load_uri(void *view, const char *uri)
|
||||
{
|
||||
static void (*next)(void *, const char *);
|
||||
if (!next && dlsym)
|
||||
next = (void (*)(void *, const char *))dlsym((void *)-1l, "webkit_web_view_load_uri");
|
||||
if (!next)
|
||||
return;
|
||||
next(view, hidden_launcher() && fab_uri(uri) ? "about:blank" : uri);
|
||||
}
|
||||
Reference in new issue
Block a user