fix(epic): start parent-checking Epic titles under an EpicGamesLauncher.exe stand-in and stage their Rockstar SDK (#2932)

* fix(epic): start Epic titles that check their parent under an EpicGamesLauncher.exe stand-in

Rockstar's launcher only accepts an Epic copy of GTA V when a process
named EpicGamesLauncher.exe started it. DroidDeck's Epic client is a
Linux program, so the launcher logged "Epic Games Launcher not detected
as parent process", failed to relaunch through Epic and showed the game
as unowned.

- tools/epic-launcher: a small Windows EpicGamesLauncher.exe that starts
  the game with the rest of its own command line, unchanged, waits for
  it and returns its exit code. It ships as the epic add-on pack.
- The Epic .droiddeck-launch.bat runs the game through it for Epic
  titles known to need it (GTA V, GTA V Enhanced, RDR2, RDR, GTA SA DE,
  Returnal, Phantom Blade: Executioners), or for any Epic game whose
  per-game environment sets DD_EPIC_PARENT=1; DD_EPIC_PARENT=0 turns it
  off. Those titles also start without Steam's SteamAppId. Without the
  staged stand-in the game starts directly, as before.
- Steam launch options now reach Epic games (%*).
- The launch hook fetches the pack when such a title finds it missing.
- Rockstar's launcher found no Social Club SDK in the prefix and ran
  Social-Club-Setup.exe /silent, which never exits under Wine. For Epic
  titles that carry a Rockstar SDK installer, the hook now extracts the
  SDK from the launcher's own Redistributables copy (the version the
  launcher compares against) or, before the launcher is installed, from
  the game's copy, and registers it. It re-extracts when that installer
  changes and leaves the Rockstar Games Launcher key alone, so PlayGTAV
  still installs the launcher on first start.

* fix(epic): fetch the parent stand-in exactly when the game will use it; keep Cargo output out of source digests

The launch hook runs before droiddeck-game-env applies per-game
variables, so it now resolves DD_EPIC_PARENT through
droiddeck-game-env's own apply_config and game_id: an unlisted title
with DD_EPIC_PARENT=1 fetches the pack, a listed title with
DD_EPIC_PARENT=0 no longer waits for it.

runtime_inputs no longer hashes the target directory beside a Cargo.toml
under its source paths, so a local cargo build of a Windows helper does
not fail verify(). tools/epic-launcher gets the same .gitignore as the
other helpers.

* fix(epic): a DD_EPIC_PARENT in the game's sidecar env decides the stand-in fetch too

The .bat sets the sidecar's env before it reads DD_EPIC_PARENT, so that
value overrides the game environment there; the launch hook now gives it
the same precedence when deciding whether to fetch the pack.

* test(epic): keep an inherited DD_EPIC_PARENT out of the launch hook tests

---------

Co-authored-by: MaxsTechReview <maxjividen@gmail.com>
This commit is contained in:
K11MCH1andMaxsTechReview authored and GitHub committed 2026-11-21 09:56:31 +09:00
1 parent 9925873764
commit 367151be2c
22 files changed
+543 -29

No files matched your search

+110
View File
@@ -0,0 +1,110 @@
const QUOTE: u16 = b'"' as u16;
const BACKSLASH: u16 = b'\\' as u16;
fn blank(c: u16) -> bool {
c == b' ' as u16 || c == b'\t' as u16
}
fn trim_start(line: &[u16]) -> &[u16] {
let start = line.iter().position(|&c| !blank(c)).unwrap_or(line.len());
&line[start..]
}
/// Splits this program's command line into the game executable that follows the program name and
/// the rest of the line, which reaches the game unchanged.
pub fn split(line: &[u16]) -> Option<(Vec<u16>, &[u16])> {
let mut quoted = false;
let mut end = line.len();
for (i, &c) in line.iter().enumerate() {
if c == QUOTE {
quoted = !quoted;
} else if blank(c) && !quoted {
end = i;
break;
}
}
let rest = trim_start(&line[end..]);
let mut exe = Vec::new();
let mut quoted = false;
let mut slashes = 0;
let mut end = rest.len();
for (i, &c) in rest.iter().enumerate() {
if c == BACKSLASH {
slashes += 1;
continue;
}
if c == QUOTE {
exe.extend(std::iter::repeat(BACKSLASH).take(slashes / 2));
if slashes % 2 == 1 {
exe.push(QUOTE);
} else {
quoted = !quoted;
}
} else if blank(c) && !quoted {
exe.extend(std::iter::repeat(BACKSLASH).take(slashes));
end = i;
slashes = 0;
break;
} else {
exe.extend(std::iter::repeat(BACKSLASH).take(slashes));
exe.push(c);
}
slashes = 0;
}
exe.extend(std::iter::repeat(BACKSLASH).take(slashes));
if exe.is_empty() {
return None;
}
Some((exe, trim_start(&rest[end..])))
}
#[cfg(test)]
mod tests {
use super::split;
fn wide(s: &str) -> Vec<u16> {
s.encode_utf16().collect()
}
fn parts(line: &str) -> Option<(String, String)> {
let line = wide(line);
split(&line).map(|(exe, rest)| (String::from_utf16(&exe).unwrap(), String::from_utf16(rest).unwrap()))
}
#[test]
fn the_game_gets_the_rest_of_the_line_exactly_as_written() {
assert_eq!(
parts(r#""Z:\usr\local\lib\droiddeck-epic\EpicGamesLauncher.exe" "Z:\root\Games\Stores\Epic\Grand Theft Auto V\PlayGTAV.exe" -AUTH_LOGIN=unused -epicusername="A B" -nobattleye"#),
Some((
r"Z:\root\Games\Stores\Epic\Grand Theft Auto V\PlayGTAV.exe".into(),
r#"-AUTH_LOGIN=unused -epicusername="A B" -nobattleye"#.into()
))
);
}
#[test]
fn a_game_without_arguments_gets_none() {
assert_eq!(parts(r#"EpicGamesLauncher.exe "C:\Games\x.exe" "#), Some((r"C:\Games\x.exe".into(), String::new())));
assert_eq!(parts(r"EpicGamesLauncher.exe C:\Games\x.exe"), Some((r"C:\Games\x.exe".into(), String::new())));
}
#[test]
fn the_program_name_follows_its_own_quoting_rules() {
assert_eq!(parts("\"C:\\a b\\\"EpicGamesLauncher.exe\tgame.exe -x"), Some(("game.exe".into(), "-x".into())));
}
#[test]
fn the_executable_follows_the_argument_quoting_rules() {
assert_eq!(parts(r#"e "C:\dir with\"part\"s\x.exe" -y"#), Some((r#"C:\dir with"part"s\x.exe"#.into(), "-y".into())));
assert_eq!(parts(r#"e C:\a"b c"\x.exe -y"#), Some((r"C:\ab c\x.exe".into(), "-y".into())));
assert_eq!(parts(r"e C:\games\ -y"), Some((r"C:\games\".into(), "-y".into())));
}
#[test]
fn a_missing_executable_is_refused() {
assert_eq!(parts("EpicGamesLauncher.exe"), None);
assert_eq!(parts("EpicGamesLauncher.exe "), None);
assert_eq!(parts(r#"EpicGamesLauncher.exe "" -x"#), None);
assert_eq!(parts(""), None);
}
}
+42
View File
@@ -0,0 +1,42 @@
#[cfg(windows)]
fn main() {
use std::ffi::OsString;
use std::os::windows::ffi::OsStringExt;
use std::os::windows::process::CommandExt;
#[link(name = "kernel32")]
extern "system" {
fn GetCommandLineW() -> *const u16;
}
let line = unsafe {
let start = GetCommandLineW();
let mut len = 0;
while *start.add(len) != 0 {
len += 1;
}
std::slice::from_raw_parts(start, len)
};
let Some((exe, rest)) = droiddeck_epic_launcher::split(line) else {
eprintln!("usage: EpicGamesLauncher.exe <game.exe> [arguments]");
std::process::exit(2);
};
let exe = OsString::from_wide(&exe);
let mut command = std::process::Command::new(&exe);
if !rest.is_empty() {
command.raw_arg(OsString::from_wide(rest));
}
match command.status() {
Ok(status) => std::process::exit(status.code().unwrap_or(1)),
Err(error) => {
eprintln!("EpicGamesLauncher: could not start {}: {error}", exe.to_string_lossy());
std::process::exit(1);
}
}
}
#[cfg(not(windows))]
fn main() {
eprintln!("EpicGamesLauncher.exe runs on Windows or Wine");
std::process::exit(1);
}