Ejemplo n.º 1
0
        /// <summary>
        /// Starts the game using the passed on launch option.
        /// </summary>
        /// <param name="option">Whether to run the executable or open the launcher url.</param>
        public void LaunchGame(LaunchOption option)
        {
            switch (option)
            {
            case LaunchOption.OpenURL:
                try
                {
                    Process.Start(this.LauncherURL);
                }
                catch
                {
                    MsgBox.Show("Couldn't start game", "Please make sure to provide a valid 'Launcher URL'.", System.Windows.Forms.MessageBoxIcon.Error);
                }
                break;

            case LaunchOption.RunExec:
                try
                {
                    Process pr = new Process();
                    pr.StartInfo.FileName         = Path.Combine(this.GamePath, this.ExecutableName);
                    pr.StartInfo.WorkingDirectory = this.GamePath;
                    pr.StartInfo.Arguments        = this.ExecParameters;
                    pr.StartInfo.UseShellExecute  = false;
                    pr.Start();
                }
                catch
                {
                    MsgBox.Show("Couldn't start game", "Please make sure that the game path and executable name are correct.", System.Windows.Forms.MessageBoxIcon.Error);
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void Button_Add_Click(object sender, RoutedEventArgs e)
        {
            LaunchOption opt = new LaunchOption(CoreManager.GetStringFromResource("/LaunchOptions/UnnamedOption"));

            opt.isPreview = true;

            OptionsView.OptListViewModel.OptionList.Add(opt);
            OptionsView.ListView.SelectedItem = opt;
        }
Ejemplo n.º 3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            LaunchOption launchOption = LaunchOption.Normal;

            if (value != null)
            {
                launchOption = (LaunchOption)value;
            }
            return(new EnumerationMember(launchOption, launchOption.GetDescription()));
        }
Ejemplo n.º 4
0
 public IDebugSessionLauncher Create(IDebugEngine3 debugEngine,
                                     LaunchOption launchOption, string coreFilePath,
                                     string executableFileName,
                                     string executableFullPath,
                                     IVsiGameLaunch gameLaunch) =>
 new DebugSessionLauncher(_taskContext, _lldbDebuggerFactory, _lldbListenerFactory,
                          _lldbPlatformFactory, _lldbPlatformConnectOptionsFactory,
                          _lldbPlatformShellCommandFactory, _attachedProgramFactory,
                          debugEngine, launchOption, _actionRecorder,
                          _moduleFileLoadRecorderFactory, coreFilePath,
                          executableFileName, executableFullPath,
                          _exceptionManagerFactory, _fileSystem,
                          _fastExpressionEvaluation, _moduleFileFinder,
                          _dumpModulesProvider, _moduleSearchLogHolder,
                          _symbolSettingsProvider, _warningDialog, gameLaunch);
        public async Task TestConnectRemoteCalledForLinuxWithCorrectUrlAsync(
            LaunchOption launchOption)
        {
            var connectRemoteRecorder = new PlatformFactoryFakeConnectRecorder();
            var launcherFactory       = CreateLauncherFactory(false, connectRemoteRecorder);
            var launcher = launcherFactory.Create(_debugEngine, launchOption, "", _gameBinary,
                                                  _gameBinary, _gameLaunch);
            ILldbAttachedProgram program = await LaunchAsync(launcher);

            Assert.That(connectRemoteRecorder.InvocationCount, Is.EqualTo(1));
            Assert.That(connectRemoteRecorder.InvocationOptions[0].GetUrl(),
                        Is.EqualTo("connect://localhost:10200"));
            Assert.That(program, Is.Not.Null);
            program.Stop();
        }
Ejemplo n.º 6
0
        private async void Button_Launch_Click(object sender, RoutedEventArgs e)
        {
            LaunchOption option = ViewModel.ListModel.SelectedOption;

            if (option == null)
            {
                return;
            }

            option.isReady  = false;
            option.lastUsed = DateTime.Now;
            await Launch(option);

            option.isReady = true;
            await CoreManager.SaveOptionList(ViewModel.ListModel.OptionList);
        }
Ejemplo n.º 7
0
        private async void Button_GameDir_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var folderPicker = new FolderPicker();
                folderPicker.SuggestedStartLocation = PickerLocationId.Desktop;
                folderPicker.FileTypeFilter.Add("*");

                StorageFolder folder = await folderPicker.PickSingleFolderAsync();

                if (folder != null)
                {
                    LaunchOption opt = OptionsView.ListView.SelectedItem as LaunchOption;
                    opt.gameDir = folder.Path;
                }
            }
            catch (Exception exp)
            {
                await __msgDialog.Show(CoreManager.GetStringFromResource("/LaunchOptions/GameDirSelectError"), exp.Message + "\r\n" + exp.StackTrace);
            }
        }
Ejemplo n.º 8
0
        private async void Button_JavaExt_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var filePicker = new FileOpenPicker();
                filePicker.SuggestedStartLocation = PickerLocationId.Desktop;
                filePicker.FileTypeFilter.Add(".exe");

                StorageFile file = await filePicker.PickSingleFileAsync();

                if (file != null)
                {
                    LaunchOption opt = OptionsView.ListView.SelectedItem as LaunchOption;
                    opt.javaExt = file.Path;
                }
            }
            catch (Exception exp)
            {
                await __msgDialog.Show(CoreManager.GetStringFromResource("/LaunchOptions/JavaExtSelectError"), exp.Message + "\r\n" + exp.StackTrace);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Sets the default settings (such as executable name, ini prefix, and launcher url) for the game edition.
        /// </summary>
        public void SetDefaultSettings(GameEdition edition)
        {
            switch (edition)
            {
            case GameEdition.Steam:
                this.ExecutableName        = "Fallout76.exe";
                this.IniPrefix             = "Fallout76";
                this.LauncherURL           = "steam://run/1151340";
                this.PreferredLaunchOption = LaunchOption.OpenURL;
                break;

            case GameEdition.BethesdaNet:
                this.ExecutableName        = "Fallout76.exe";
                this.IniPrefix             = "Fallout76";
                this.LauncherURL           = "bethesdanet://run/20";
                this.PreferredLaunchOption = LaunchOption.OpenURL;
                break;

            case GameEdition.BethesdaNetPTS:
                this.ExecutableName        = "Fallout76.exe";
                this.IniPrefix             = "Fallout76";
                this.LauncherURL           = "bethesdanet://run/57";
                this.PreferredLaunchOption = LaunchOption.OpenURL;
                break;

            case GameEdition.MSStore:
                this.ExecutableName        = "Project76_GamePass.exe";
                this.IniPrefix             = "Project76";
                this.LauncherURL           = "ms-windows-store://pdp/?ProductId=9nkgnmnk3k3z";
                this.PreferredLaunchOption = LaunchOption.OpenURL;
                break;

            default:
                this.ExecutableName        = "Fallout76.exe";
                this.IniPrefix             = "Fallout76";
                this.LauncherURL           = "";
                this.PreferredLaunchOption = LaunchOption.RunExec;
                break;
            }
        }
Ejemplo n.º 10
0
 public DebugSessionLauncher(
     JoinableTaskContext taskContext, GrpcDebuggerFactory lldbDebuggerFactory,
     GrpcListenerFactory lldbListenerFactory, GrpcPlatformFactory lldbPlatformFactory,
     GrpcPlatformConnectOptionsFactory lldbPlatformConnectOptionsFactory,
     GrpcPlatformShellCommandFactory lldbPlatformShellCommandFactory,
     ILldbAttachedProgramFactory attachedProgramFactory, IDebugEngine3 debugEngine,
     LaunchOption launchOption, ActionRecorder actionRecorder,
     ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
     string coreFilePath, string executableFileName, string executableFullPath,
     LldbExceptionManager.Factory exceptionManagerFactory, IFileSystem fileSystem,
     bool fastExpressionEvaluation, IModuleFileFinder moduleFileFinder,
     IDumpModulesProvider dumpModulesProvider, IModuleSearchLogHolder moduleSearchLogHolder,
     ISymbolSettingsProvider symbolSettingsProvider,
     CoreAttachWarningDialogUtil warningDialog, IVsiGameLaunch gameLaunch)
 {
     _taskContext         = taskContext;
     _lldbDebuggerFactory = lldbDebuggerFactory;
     _lldbListenerFactory = lldbListenerFactory;
     _lldbPlatformFactory = lldbPlatformFactory;
     _lldbPlatformConnectOptionsFactory = lldbPlatformConnectOptionsFactory;
     _lldbPlatformShellCommandFactory   = lldbPlatformShellCommandFactory;
     _attachedProgramFactory            = attachedProgramFactory;
     _debugEngine             = debugEngine;
     _exceptionManagerFactory = exceptionManagerFactory;
     _fileSystem = fileSystem;
     _fastExpressionEvaluation      = fastExpressionEvaluation;
     _launchOption                  = launchOption;
     _actionRecorder                = actionRecorder;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
     _coreFilePath                  = coreFilePath;
     _executableFileName            = executableFileName;
     _executableFullPath            = executableFullPath;
     _moduleFileFinder              = moduleFileFinder;
     _dumpModulesProvider           = dumpModulesProvider;
     _moduleSearchLogHolder         = moduleSearchLogHolder;
     _symbolSettingsProvider        = symbolSettingsProvider;
     _warningDialog                 = warningDialog;
     _gameLaunch = gameLaunch;
 }
        public async Task TestConnectRemoteCalledForStadiaWithScpCommandAsExtraArgAsync(
            LaunchOption launchOption)
        {
            var connectRemoteRecorder = new PlatformFactoryFakeConnectRecorder();
            var launcherFactory       = CreateLauncherFactory(true, connectRemoteRecorder);
            var launcher = launcherFactory.Create(_debugEngine, launchOption, "", _gameBinary,
                                                  _gameBinary, _gameLaunch);
            ILldbAttachedProgram program = await LaunchAsync(launcher);

            Assert.That(connectRemoteRecorder.InvocationCount, Is.EqualTo(1));
            Assert.That(connectRemoteRecorder.InvocationOptions.Count, Is.EqualTo(1));

            string connectRemoteUrl = connectRemoteRecorder.InvocationOptions[0].GetUrl();

            // argument for ConnectRemote should start with a standard value, ending with ';'
            // used as a separator between it and scp command.
            Assert.That(connectRemoteUrl, Does.StartWith("connect://localhost:10200;"));
            // path to the scp.exe should be quoted, to check this we add \" to the assertion.
            Assert.That(connectRemoteUrl, Does.Contain("scp.exe\""));
            Assert.That(connectRemoteUrl,
                        Does.Contain("-oStrictHostKeyChecking=yes -oUserKnownHostsFile"));
            Assert.That(program, Is.Not.Null);
            program.Stop();
        }
Ejemplo n.º 12
0
 internal static extern NotificationError SetAppControl(NotificationSafeHandle handle, LaunchOption type, SafeAppControlHandle appHandle);
        /// <summary>
        /// Sets the default settings (such as executable name, ini prefix, and launcher url) for the game edition.
        /// </summary>
        public void SetDefaultSettings(GameEdition edition)
        {
            switch (edition)
            {
            case GameEdition.Steam:
                this.ExecutableName        = "Fallout76.exe";
                this.IniPrefix             = "Fallout76";
                this.LauncherURL           = "steam://run/1151340";
                this.PreferredLaunchOption = LaunchOption.OpenURL;
                break;

            case GameEdition.BethesdaNet:
                this.ExecutableName        = "Fallout76.exe";
                this.IniPrefix             = "Fallout76";
                this.LauncherURL           = "bethesdanet://run/20";
                this.PreferredLaunchOption = LaunchOption.OpenURL;
                break;

            case GameEdition.BethesdaNetPTS:
                this.ExecutableName        = "Fallout76.exe";
                this.IniPrefix             = "Fallout76";
                this.LauncherURL           = "bethesdanet://run/57";
                this.PreferredLaunchOption = LaunchOption.OpenURL;
                break;

            case GameEdition.MSStore:
                this.ExecutableName = "Project76_GamePass.exe";
                this.IniPrefix      = "Project76";

                /*
                 * Store link: @"ms-windows-store://pdp/?ProductId=9nkgnmnk3k3z"
                 * Launch URL: @"shell:appsfolder\BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76"
                 *
                 * Found a solution to launch the Xbox version of Fallout 76:
                 * https://stackoverflow.com/questions/32074404/launching-windows-10-store-apps
                 * https://stackoverflow.com/a/67156442
                 *
                 * Enter in PowerShell:
                 *    PS C:\> Get-StartApps
                 *            ^ The above will return a list:
                 *
                 *    Name                                                 AppID
                 *    ----                                                 -----
                 *    ...
                 *    Fallout 76                                           BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76
                 *
                 * To start the app, enter in CMD:
                 *    C:\> explorer shell:appsfolder\BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76
                 *
                 * This also works with Process.Start(@"shell:appsfolder\BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76");
                 */
                this.LauncherURL           = @"shell:appsfolder\BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76";
                this.PreferredLaunchOption = LaunchOption.OpenURL;
                break;

            default:
                this.ExecutableName        = "Fallout76.exe";
                this.IniPrefix             = "Fallout76";
                this.LauncherURL           = "";
                this.PreferredLaunchOption = LaunchOption.RunExec;
                break;
            }
        }
Ejemplo n.º 14
0
        private async Task Launch(LaunchOption option)
        {
            //Check connection to launch agent
            if (AppServiceManager.appServiceConnection == null)
            {
                return;
            }

            List <MinecraftAssembly> missingLibs   = null; //include missing natives
            List <MinecraftAsset>    missingAssets = new List <MinecraftAsset>();

            #region Libraries and natives check
            ValueSet valueSet = new ValueSet();
            valueSet["type"]    = "librariesCheck";
            valueSet["version"] = option.versionId;
            AppServiceResponse response = await AppServiceManager.appServiceConnection.SendMessageAsync(valueSet);

            string responseJson = response.Message["value"].ToString();
            try
            {
                missingLibs = JsonConvert.DeserializeObject <List <MinecraftAssembly> >(responseJson);
            }
            catch (JsonException)
            { }
            #endregion

            #region Assets check
            valueSet            = new ValueSet();
            valueSet["type"]    = "assetsCheck";
            valueSet["version"] = option.versionId;
            response            = await AppServiceManager.appServiceConnection.SendMessageAsync(valueSet);

            object obj = null;
            response.Message.TryGetValue("index_path", out obj);
            // Asset index dose not exist or invalid
            if (obj != null)
            {
                string path = obj.ToString();
                string url  = response.Message["index_url"].ToString();

                try
                {
                    using (HttpClient client = new HttpClient())
                    {
                        string json = await client.GetStringAsync(url);

                        StorageFile file = await CoreManager.WorkDir.CreateFileAsync(path, CreationCollisionOption.ReplaceExisting);

                        await FileIO.WriteTextAsync(file, json);
                    }
                }
                catch (Exception e)
                {
                    await _msgDialog.Show(
                        CoreManager.GetStringFromResource("/StartPage/LaunchFailed"),
                        "Cannot fetch asset index \r\n " + e.Message + "\r\n" + e.StackTrace
                        );

                    return;
                }

                //Check again after asset index downloaded
                response = await AppServiceManager.appServiceConnection.SendMessageAsync(valueSet);

                obj = null;
                response.Message.TryGetValue("index_path", out obj);
                if (obj != null)
                {
                    await _msgDialog.Show(
                        CoreManager.GetStringFromResource("/StartPage/LaunchFailed"),
                        "Asset index validation failed");

                    return;
                }
            }

            responseJson = response.Message["missing_assets"].ToString();
            try
            {
                missingAssets = JsonConvert.DeserializeObject <List <MinecraftAsset> >(responseJson);
            }
            catch (JsonException) { }
            #endregion

            //Found missing libs, go to download.
            if ((missingLibs != null && missingLibs.Count > 0) || (missingAssets != null && missingAssets.Count > 0))
            {
                missingLibs.ForEach(lib =>
                {
                    DownloadItem item = new DownloadItem(lib.Name, lib.Path, lib.Url);
                    DownloadManager.DownloadQuene.Add(item);
                });
                missingAssets.ForEach(ass =>
                {
                    DownloadItem item = new DownloadItem(
                        string.Format("{0}: {1}", CoreManager.GetStringFromResource("/Resources/Asset"), ass.Hash),
                        ass.GetPath(),
                        ass.GetDownloadUrl()
                        );
                    DownloadManager.DownloadQuene.Add(item);
                });

                DownloadManager.StartDownload();
                await DownloadDialog.ShowAsync();

                return;
            }

            DebugWriteLine("Serializing launch message to json");

            string messageJson;
            try
            {
                LaunchOptionBase tmp = option as LaunchOptionBase;
                if (string.IsNullOrWhiteSpace(option.javaExt))
                {
                    tmp.javaExt = CoreManager.GlobalJVMPath;
                }
                messageJson = JsonConvert.SerializeObject(tmp);
            }
            catch (JsonSerializationException exp)
            {
                DebugWriteLine("ERROR: " + exp.Message);
                return;
            }

            DebugWriteLine(messageJson);

            //Check if the launch message was successfully generated
            if (!string.IsNullOrWhiteSpace(messageJson))
            {
                valueSet = new ValueSet();
                valueSet.Add("type", "launch");
                valueSet.Add("launch_option", messageJson);
                valueSet.Add("auth_type", CoreManager.AccountTypeTag);
                valueSet.Add("auth_username", CoreManager.Username);
                response = await AppServiceManager.appServiceConnection.SendMessageAsync(valueSet);

                //Display error
                obj = response.Message["result"];
                if (obj is bool && !((bool)obj))
                {
                    await _msgDialog.Show(
                        CoreManager.GetStringFromResource("/StartPage/LaunchFailed"),
                        response.Message["errorMessage"].ToString() + "\r\n" + response.Message["errorStack"]
                        );
                }
            }
        }
 internal static extern ErrorCode GetAppControl(NotificationSafeHandle handle, LaunchOption type, out SafeAppControlHandle appControlHandle);