protected override async Task<IEnumerable<string>> GetStartupParameters(IRealVirtualityLauncher launcher, ILaunchContentAction<IContent> action) { var defParams = await base.GetStartupParameters(launcher, action).ConfigureAwait(false); return /*Settings.ServerMode ||*/ !_settings.LaunchThroughBattlEye || !GetBattleEyeClientExectuable().Exists ? defParams : AddBattleEyeLaunchParameters(defParams); }
protected override async Task <Process> LaunchImpl(IGameLauncherFactory factory, ILaunchContentAction <IContent> action) { var launcher = factory.Create <IRealVirtualityLauncher>(this); var launchAction = _shouldLaunchAsDedicatedServer.Value ? LaunchAction.LaunchAsDedicatedServer : action.Action; var ls = new LaunchState(GetLaunchExecutable(launchAction), GetExecutable(launchAction), await GetStartupParameters(launcher, action, launchAction).ConfigureAwait(false), launchAction); if (launchAction.IsAsServer()) { Tools.FileUtil.Ops.CreateDirectoryAndSetACLWithFallbackAndRetry(KeysPath); } var launchables = action.GetLaunchables() .OfType <IModContent>() .Select(c => new RvMod(this, c)); foreach (var mod in launchables) { await mod.PreLaunch(action.Action).ConfigureAwait(false); } return(await InitiateLaunch(launcher, ls).ConfigureAwait(false)); }
// TODO: Enter content into LAUNCHING state, then once completed, back to the content's state. public async Task <int> Launch(IGameLauncherFactory factory, ILaunchContentAction <Content> launchContentAction) { var pid = await LaunchInternal(factory, launchContentAction).ConfigureAwait(false); PrepareEvent(new LaunchActionCompleted(this, pid)); return(pid); }
protected override async Task <IReadOnlyCollection <string> > GetStartupParameters( IRealVirtualityLauncher launcher, ILaunchContentAction <IContent> action, LaunchAction launchAction) { var defParams = await base.GetStartupParameters(launcher, action, launchAction).ConfigureAwait(false); return(LaunchNormally(GetBattleEyeClientExectuable(), launchAction) ? defParams : AddBattleEyeLaunchParameters(defParams).ToArray()); }
protected override Task <Process> LaunchImpl(IGameLauncherFactory factory, ILaunchContentAction <IContent> action) { var launcher = factory.Create(this); return(InitiateLaunch(launcher, new LaunchState(GetLaunchExecutable(action.Action), GetExecutable(action.Action), GetStartupParameters(action).ToArray(), action.Action))); }
private IEnumerable <string> GetAdvancedStartupParameters(ILaunchContentAction <IContent> action) { var launchables = action.GetLaunchables(); var server = GetServerOverride(action) ?? GetServer(launchables, action.Action); if (server != null) { // join friend would be :steamid_{id} yield return($"+platform:connect:address_{server.Address}"); // TODO: PW } }
protected override Task EnableMods(ILaunchContentAction <IContent> launchContentAction) { var content = launchContentAction.Content.SelectMany(x => x.Content.GetLaunchables(x.Constraint)).ToArray(); var packages = content.OfType <IHavePackageName>() .Select(x => x.PackageName) .Distinct() .ToArray(); HandleModDirectory(packages); HandleNMSEDirectory(); return(EnableModsInternal(content.OfType <IModContent>().Select(CreateMod), m => m.Install(false))); }
protected CollectionServer GetServerOverride(ILaunchContentAction <IContent> action) { if (action.Action == LaunchAction.Default) { return action.ServerAddress == null ? null : new CollectionServer { Address = action.ServerAddress } } ; return(action.Action == LaunchAction.Join ? new CollectionServer { Address = action.ServerAddress } : null); }
protected override Task EnableMods(ILaunchContentAction<IContent> launchContentAction) { var pluginList = GetLocalAppDataFolder().GetChildFileWithName("plugins.txt"); var loadOrder = GetLocalAppDataFolder().GetChildFileWithName("loadorder.txt"); var contentList = new[] {"Skyrim.esm", "Update.esm"}.Concat( launchContentAction.Content.Select(x => x.Content) .OfType<IModContent>() .Select(CreateMod) .Select(x => x.GetEsmFileName()) .Where(x => x != null)) .ToArray(); // todo; backup and keep load order pluginList.WriteText(string.Join(Environment.NewLine, contentList)); loadOrder.WriteText(string.Join(Environment.NewLine, contentList)); return TaskExt.Default; }
protected override Task EnableMods(ILaunchContentAction <IContent> launchContentAction) { var pluginList = GetLocalAppDataFolder().GetChildFileWithName("plugins.txt"); var loadOrder = GetLocalAppDataFolder().GetChildFileWithName("loadorder.txt"); var contentList = new[] { "Fallout4.esm", "Update.esm" }.Concat( launchContentAction.Content.Select(x => x.Content) .OfType <IModContent>() .Select(CreateMod) .Select(x => x.GetEsmFileName()) .Where(x => x != null)) .ToArray(); // todo; backup and keep load order pluginList.WriteText(string.Join(Environment.NewLine, contentList)); loadOrder.WriteText(string.Join(Environment.NewLine, contentList)); return(TaskExt.Default); }
StartupBuilderSpec GetStartupSpec(ILaunchContentAction <IContent> action, LaunchAction launchAction) { var content = GetLaunchables(action); return(new StartupBuilderSpec { GamePath = InstalledState.Directory, SteamWorkshopPath = SteamDirectories.IsValid ? SteamDirectories.Workshop.ContentPath : null, LaunchType = launchAction == LaunchAction.LaunchAsServer ? LaunchType.Multiplayer : action.LaunchType, ModPath = ContentPaths.Path, GameVersion = InstalledState.Version, InputMods = content.OfType <IModContent>().Select(x => new RvMod(this, x)).ToList(), //.Where(x => x.Controller.Exists), AdditionalLaunchMods = GetAdditionalLaunchMods(), //Mission = CalculatedSettings.Mission, Server = GetServerOverride(action) ?? GetServerFromContent(content, launchAction), // TODO: Or configurable by user? StartupParameters = Settings.StartupParameters.Get(), UseParFile = true }); }
async Task <int> LaunchInternal(IGameLauncherFactory factory, ILaunchContentAction <IContent> action) { ConfirmLaunch(); await BeforeLaunch(action).ConfigureAwait(false); int id; using (var p = await LaunchImpl(factory, action).ConfigureAwait(false)) id = p?.Id ?? -1; LastPlayed = Tools.Generic.GetCurrentUtcDateTime; PrepareEvent(new GameLaunched(this, id)); if (Metadata.AfterLaunchDelay.HasValue) { await Task.Delay(Metadata.AfterLaunchDelay.Value, action.CancelToken).ConfigureAwait(false); } return(id); }
protected override async Task EnableMods(ILaunchContentAction <IContent> launchContentAction) { var sf = GetDocumentsDirectory().GetChildFileWithName("settings.txt"); new SettingsWriter(sf).Write(GetMods(launchContentAction)); }
private IEnumerable <StellarisMod> GetMods(ILaunchContentAction <IContent> launchContentAction) => launchContentAction.Content.Select(x => x.Content).OfType <IModContent>().Select(CreateMod);
public void Use(ILaunchContentAction <IContent> action) { RecentInfo = new RecentInfo(action.LaunchType); PrepareEvent(new ContentUsed(this, action)); }
//private static readonly string[] defaultStartupParameters = {"-noworkshop"}; protected override IEnumerable <string> GetStartupParameters(ILaunchContentAction <IContent> action) => GetAdvancedStartupParameters(action).Concat(base.GetStartupParameters(action));
Tuple <string[], string[]> RvStartupParameters(IRealVirtualityLauncher launcher, ILaunchContentAction <IContent> action, LaunchAction launchAction) => GetStartupBuilder().GetStartupParameters(GetStartupSpec(action, launchAction));
protected abstract Task EnableMods(ILaunchContentAction <IContent> launchContentAction);
private IEnumerable<StellarisMod> GetMods(ILaunchContentAction<IContent> launchContentAction) => launchContentAction.Content.Select(x => x.Content).OfType<IModContent>().Select(CreateMod);
protected abstract Task <Process> LaunchImpl(IGameLauncherFactory factory, ILaunchContentAction <IContent> action);
protected virtual IReadOnlyCollection <ILaunchableContent> GetLaunchables(ILaunchContentAction <IContent> action) => action.GetLaunchables().ToArray();
protected virtual IEnumerable <string> GetStartupParameters(ILaunchContentAction <IContent> action) => Settings.StartupParameters.Get();
protected override Task EnableMods(ILaunchContentAction<IContent> launchContentAction) { throw new NotImplementedException(); }
protected override IReadOnlyCollection<ILaunchableContent> GetLaunchables( ILaunchContentAction<IContent> action) => HandleAia(base.GetLaunchables(action));
protected virtual async Task BeforeLaunch(ILaunchContentAction <IContent> action) { }
protected virtual async Task <IReadOnlyCollection <string> > GetStartupParameters(IRealVirtualityLauncher launcher, ILaunchContentAction <IContent> action, LaunchAction launchAction) { var startupInfo = RvStartupParameters(launcher, action, launchAction); var startupParameters = startupInfo.Item1.ToList(); var parData = startupInfo.Item2; if (!parData.Any()) { return(startupParameters); } try { var parPath = await launcher.WriteParFile(new WriteParFileInfo(Id, string.Join("\n", parData) //, new ShortGuid(Settings.CurrentProfile).ToString() )) .ConfigureAwait(false); startupParameters.Insert(0, "-par=" + parPath); } catch (Exception e) { throw new ParFileException(e.Message, e); } return(startupParameters); }
protected override async Task EnableMods(ILaunchContentAction<IContent> launchContentAction) { var sf = GetDocumentsDirectory().GetChildFileWithName("settings.txt"); new SettingsWriter(sf).Write(GetMods(launchContentAction)); }
// Temporary disabled because of server join testing // Don't launch with Steam because we don't want the Steam workshop mods supported //protected override bool ShouldLaunchWithSteam(LaunchState ls) => false; protected override Task EnableMods(ILaunchContentAction<IContent> launchContentAction) { // TODO: PublisherId var content = launchContentAction.Content.SelectMany(x => x.Content.GetLaunchables(x.Constraint)).ToArray(); var packages = content.OfType<IHavePackageName>() .Select(x => x.PackageName) .Distinct() .ToArray(); HandleModDirectory(packages); return EnableModsInternal(content.OfType<IModContent>().Select(CreateMod), m => m.Enable()); }
protected override async Task BeforeLaunch(ILaunchContentAction <IContent> action) { await EnableMods(action).ConfigureAwait(false); await base.BeforeLaunch(action).ConfigureAwait(false); }
//private static readonly string[] defaultStartupParameters = {"-noworkshop"}; protected override IEnumerable<string> GetStartupParameters(ILaunchContentAction<IContent> action) => GetAdvancedStartupParameters(action).Concat(base.GetStartupParameters(action));
protected override Task EnableMods(ILaunchContentAction <IContent> launchContentAction) { throw new NotImplementedException(); }
private IEnumerable<string> GetAdvancedStartupParameters(ILaunchContentAction<IContent> action) { var launchables = action.GetLaunchables(); var server = GetServerOverride(action) ?? GetServer(launchables, action.Action); if (server != null) { // join friend would be :steamid_{id} yield return $"+platform:connect:address_{server.Address}"; // TODO: PW } }
public static IEnumerable <ILaunchableContent> GetLaunchables(this ILaunchContentAction <IContent> action) => action.Content.SelectMany(x => x.Content.GetLaunchables(x.Constraint)).Distinct();
protected override IReadOnlyCollection <ILaunchableContent> GetLaunchables( ILaunchContentAction <IContent> action) => HandleAia(base.GetLaunchables(action));