Пример #1
0
def launch_with_epic_login_trick(ideal_args: List[str]) -> bool:
    """
    This needs to fail gracefully! Sometimes people only have the Steam version,
    so we want to be able to fall back to Steam if Epic is going nowhere.
    """
    try:
        logger = get_logger(DEFAULT_LOGGER)

        if not launch_with_epic_simple(ideal_args):
            return False

        process = None
        while True:
            sleep(1)
            process = get_process('RocketLeague.exe', 'RocketLeague.exe',
                                  set())
            if process is not None:
                break
            logger.info("Waiting for RocketLeague.exe to start...")

        while True:
            all_args = get_auth_args_from_process()
            if all_args is not None:
                break
            all_args = get_auth_args_from_logs()
            if all_args is not None:
                break
            time.sleep(1)
            logger.info("Waiting for Rocket League args...")

        process = get_process('RocketLeague.exe', 'RocketLeague.exe', set())
        if process:
            try:
                process.kill()
            except psutil.NoSuchProcess:
                # the process killed itself before we did, but result is the same.
                pass
        modified_args = ideal_args + all_args
        logger.info(
            f"Killed old rocket league, reopening with {modified_args}")
        launch_with_epic_simple(modified_args)
        return True
    except Exception as ex:
        logger.warn(f"Trouble with epic launch: {ex}")
        return False
Пример #2
0
def get_auth_args_from_process() -> Union[List[str], None]:
    process = get_process('RocketLeague.exe', 'RocketLeague.exe', set())
    if process is not None:
        try:
            all_args = process.cmdline()
        except psutil.NoSuchProcess:
            return None
        if args_contain_auth_info(all_args):
            return all_args[1:]  # Snip off the executable arg
    return None
Пример #3
0
def get_auth_args_from_logs() -> Union[List[str], None]:
    # Log: Command line: -AUTH_LOGIN=unused -AUTH_PASSWORD=f7a32f56ea -AUTH_TYPE=exchangecode -epicapp=Sugar -epicenv=Prod -EpicPortal  -epicusername="******" -epicuserid=41276a00c2c54f -epiclocale=en -epicsandboxid=9773aa1aa54f4f
    process = get_process('RocketLeague.exe', 'RocketLeague.exe', set())
    if process is not None:
        log_file = get_rocket_league_log_path()
        if log_file.exists():
            log_text = log_file.read_text()
            match = re.search("^Log: Command line: (.*)$", log_text,
                              re.MULTILINE)
            if match is not None:
                args_str = match.group(1)
                all_args = args_str.split(' ')
                if args_contain_auth_info(all_args):
                    return all_args
    return None