예제 #1
0
        private void CreateGameWindow(HLE.Switch device)
        {
            ControllerType type = (Ryujinx.Configuration.Hid.ControllerType)ConfigurationState.Instance.Hid.ControllerType switch {
                Ryujinx.Configuration.Hid.ControllerType.ProController => ControllerType.ProController,
                Ryujinx.Configuration.Hid.ControllerType.Handheld => ControllerType.Handheld,
                Ryujinx.Configuration.Hid.ControllerType.NpadPair => ControllerType.JoyconPair,
                Ryujinx.Configuration.Hid.ControllerType.NpadLeft => ControllerType.JoyconLeft,
                Ryujinx.Configuration.Hid.ControllerType.NpadRight => ControllerType.JoyconRight,
                _ => ControllerType.Handheld
            };

            device.Hid.Npads.AddControllers(new ControllerConfig {
                PlayerId = HidControllerID.Player1,
                Type     = type
            });

            _gLWidget = new GLRenderer(_emulationContext);

            Application.Invoke(delegate
            {
                _viewBox.Remove(_gameTableWindow);
                _gLWidget.Expand = true;
                _viewBox.Child   = _gLWidget;

                _gLWidget.ShowAll();
                EditFooterForGameRender();
            });

            _gLWidget.WaitEvent.WaitOne();

            _gLWidget.Start();

            device.Dispose();
            _deviceExitStatus.Set();

            // NOTE: Everything that is here will not be executed when you close the UI.
            Application.Invoke(delegate
            {
                _viewBox.Remove(_gLWidget);
                _gLWidget.Exit();

                if (_gLWidget.Window != this.Window && _gLWidget.Window != null)
                {
                    _gLWidget.Window.Dispose();
                }

                _gLWidget.Dispose();

                _viewBox.Add(_gameTableWindow);

                _gameTableWindow.Expand = true;

                this.Window.Title = $"Ryujinx {Program.Version}";

                _emulationContext = null;
                _gameLoaded       = false;
                _gLWidget         = null;

                DiscordIntegrationModule.SwitchToMainMenu();

                RecreateFooterForMenu();

                UpdateColumns();
                UpdateGameTable();

                Task.Run(RefreshFirmwareLabel);

                _stopEmulation.Sensitive            = false;
                _firmwareInstallFile.Sensitive      = true;
                _firmwareInstallDirectory.Sensitive = true;
            });
        }
예제 #2
0
        private void CreateGameWindow(HLE.Switch device)
        {
            device.Hid.InitializePrimaryController(ConfigurationState.Instance.Hid.ControllerType);

            _gLWidget?.Exit();
            _gLWidget?.Dispose();
            _gLWidget = new GLRenderer(_emulationContext);

            Application.Invoke(delegate
            {
                _viewBox.Remove(_gameTableWindow);
                _gLWidget.Expand = true;
                _viewBox.Child   = _gLWidget;

                _gLWidget.ShowAll();
                _listStatusBox.Hide();
            });

            _gLWidget.WaitEvent.WaitOne();

            _gLWidget.Start();

            Application.Invoke(delegate
            {
                _viewBox.Remove(_gLWidget);
                _gLWidget.Exit();

                if (_gLWidget.Window != this.Window && _gLWidget.Window != null)
                {
                    _gLWidget.Window.Dispose();
                }

                _viewBox.Add(_gameTableWindow);

                _gameTableWindow.Expand = true;

                this.Window.Title = "Ryujinx";

                _listStatusBox.ShowAll();

                UpdateColumns();
                UpdateGameTable();

                Task.Run(RefreshFirmwareLabel);
            });

            device.Dispose();

            _emulationContext = null;
            _gameLoaded       = false;
            _gLWidget         = null;

            DiscordIntegrationModule.SwitchToMainMenu();

            Application.Invoke(delegate
            {
                _stopEmulation.Sensitive            = false;
                _firmwareInstallFile.Sensitive      = true;
                _firmwareInstallDirectory.Sensitive = true;
            });

            _screenExitStatus.Set();
        }