예제 #1
0
파일: MainWindow.cs 프로젝트: thubn/Ryujinx
        internal void LoadApplication(string path)
        {
            if (_gameLoaded)
            {
                GtkDialog.CreateDialog("Ryujinx", "A game has already been loaded", "Please close it first and try again.");
            }
            else
            {
                Logger.RestartTime();

                HLE.Switch device = InitializeSwitchInstance();

                // TODO: Move this somewhere else + reloadable?
                Graphics.Gpu.GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;

                if (Directory.Exists(path))
                {
                    string[] romFsFiles = Directory.GetFiles(path, "*.istorage");

                    if (romFsFiles.Length == 0)
                    {
                        romFsFiles = Directory.GetFiles(path, "*.romfs");
                    }

                    if (romFsFiles.Length > 0)
                    {
                        Logger.PrintInfo(LogClass.Application, "Loading as cart with RomFS.");
                        device.LoadCart(path, romFsFiles[0]);
                    }
                    else
                    {
                        Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS.");
                        device.LoadCart(path);
                    }
                }
                else if (File.Exists(path))
                {
                    switch (System.IO.Path.GetExtension(path).ToLowerInvariant())
                    {
                    case ".xci":
                        Logger.PrintInfo(LogClass.Application, "Loading as XCI.");
                        device.LoadXci(path);
                        break;

                    case ".nca":
                        Logger.PrintInfo(LogClass.Application, "Loading as NCA.");
                        device.LoadNca(path);
                        break;

                    case ".nsp":
                    case ".pfs0":
                        Logger.PrintInfo(LogClass.Application, "Loading as NSP.");
                        device.LoadNsp(path);
                        break;

                    default:
                        Logger.PrintInfo(LogClass.Application, "Loading as homebrew.");
                        try
                        {
                            device.LoadProgram(path);
                        }
                        catch (ArgumentOutOfRangeException)
                        {
                            Logger.PrintError(LogClass.Application, "The file which you have specified is unsupported by Ryujinx.");
                        }
                        break;
                    }
                }
                else
                {
                    Logger.PrintWarning(LogClass.Application, "Please specify a valid XCI/NCA/NSP/PFS0/NRO file.");
                    End(device);
                }

                _emulationContext = device;

                _deviceExitStatus.Reset();

#if MACOS_BUILD
                CreateGameWindow(device);
#else
                var windowThread = new Thread(() =>
                {
                    CreateGameWindow(device);
                })
                {
                    Name = "GUI.WindowThread"
                };

                windowThread.Start();
#endif

                _gameLoaded = true;
                _stopEmulation.Sensitive = true;

                _firmwareInstallFile.Sensitive      = false;
                _firmwareInstallDirectory.Sensitive = false;

                DiscordIntegrationModule.SwitchToPlayingState(device.System.TitleIdText, device.System.TitleName);

                ApplicationLibrary.LoadAndSaveMetaData(device.System.TitleIdText, appMetadata =>
                {
                    appMetadata.LastPlayed = DateTime.UtcNow.ToString();
                });
            }
        }
예제 #2
0
        internal void LoadApplication(string path)
        {
            if (_gameLoaded)
            {
                GtkDialog.CreateDialog("Ryujinx", "A game has already been loaded", "Please close it first and try again.");
            }
            else
            {
                if (ConfigurationState.Instance.Logger.EnableDebug.Value)
                {
                    MessageDialog debugWarningDialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo, null)
                    {
                        Title         = "Ryujinx - Warning",
                        Text          = "You have debug logging enabled, which is designed to be used by developers only.",
                        SecondaryText = "For optimal performance, it's recommended to disable debug logging. Would you like to disable debug logging now?"
                    };

                    if (debugWarningDialog.Run() == (int)ResponseType.Yes)
                    {
                        ConfigurationState.Instance.Logger.EnableDebug.Value = false;
                        SaveConfig();
                    }

                    debugWarningDialog.Dispose();
                }

                if (!string.IsNullOrWhiteSpace(ConfigurationState.Instance.Graphics.ShadersDumpPath.Value))
                {
                    MessageDialog shadersDumpWarningDialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo, null)
                    {
                        Title         = "Ryujinx - Warning",
                        Text          = "You have shader dumping enabled, which is designed to be used by developers only.",
                        SecondaryText = "For optimal performance, it's recommended to disable shader dumping. Would you like to disable shader dumping now?"
                    };

                    if (shadersDumpWarningDialog.Run() == (int)ResponseType.Yes)
                    {
                        ConfigurationState.Instance.Graphics.ShadersDumpPath.Value = "";
                        SaveConfig();
                    }

                    shadersDumpWarningDialog.Dispose();
                }

                Logger.RestartTime();

                HLE.Switch device = InitializeSwitchInstance();

                // TODO: Move this somewhere else + reloadable?
                Graphics.Gpu.GraphicsConfig.MaxAnisotropy   = ConfigurationState.Instance.Graphics.MaxAnisotropy;
                Graphics.Gpu.GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;

                if (Directory.Exists(path))
                {
                    string[] romFsFiles = Directory.GetFiles(path, "*.istorage");

                    if (romFsFiles.Length == 0)
                    {
                        romFsFiles = Directory.GetFiles(path, "*.romfs");
                    }

                    if (romFsFiles.Length > 0)
                    {
                        Logger.PrintInfo(LogClass.Application, "Loading as cart with RomFS.");
                        device.LoadCart(path, romFsFiles[0]);
                    }
                    else
                    {
                        Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS.");
                        device.LoadCart(path);
                    }
                }
                else if (File.Exists(path))
                {
                    switch (System.IO.Path.GetExtension(path).ToLowerInvariant())
                    {
                    case ".xci":
                        Logger.PrintInfo(LogClass.Application, "Loading as XCI.");
                        device.LoadXci(path);
                        break;

                    case ".nca":
                        Logger.PrintInfo(LogClass.Application, "Loading as NCA.");
                        device.LoadNca(path);
                        break;

                    case ".nsp":
                    case ".pfs0":
                        Logger.PrintInfo(LogClass.Application, "Loading as NSP.");
                        device.LoadNsp(path);
                        break;

                    default:
                        Logger.PrintInfo(LogClass.Application, "Loading as homebrew.");
                        try
                        {
                            device.LoadProgram(path);
                        }
                        catch (ArgumentOutOfRangeException)
                        {
                            Logger.PrintError(LogClass.Application, "The file which you have specified is unsupported by Ryujinx.");
                        }
                        break;
                    }
                }
                else
                {
                    Logger.PrintWarning(LogClass.Application, "Please specify a valid XCI/NCA/NSP/PFS0/NRO file.");
                    device.Dispose();

                    return;
                }

                _emulationContext = device;

                _deviceExitStatus.Reset();

#if MACOS_BUILD
                CreateGameWindow(device);
#else
                var windowThread = new Thread(() =>
                {
                    CreateGameWindow(device);
                })
                {
                    Name = "GUI.WindowThread"
                };

                windowThread.Start();
#endif

                _gameLoaded = true;
                _stopEmulation.Sensitive = true;

                _firmwareInstallFile.Sensitive      = false;
                _firmwareInstallDirectory.Sensitive = false;

                DiscordIntegrationModule.SwitchToPlayingState(device.System.TitleIdText, device.System.TitleName);

                ApplicationLibrary.LoadAndSaveMetaData(device.System.TitleIdText, appMetadata =>
                {
                    appMetadata.LastPlayed = DateTime.UtcNow.ToString();
                });
            }
        }
예제 #3
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 {
                Player = PlayerIndex.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;
            });
        }
예제 #4
0
 public void ExecuteProgram(HLE.Switch device, ProgramSpecifyKind kind, ulong value)
 {
     device.UserChannelPersistence.ExecuteProgram(kind, value);
     ((MainWindow)_parent).RendererWidget?.Exit();
 }
예제 #5
0
파일: MainWindow.cs 프로젝트: sgnls/Ryujinx
        private void CreateGameWindow(HLE.Switch device)
        {
            device.Hid.Npads.AddControllers(ConfigurationState.Instance.Hid.InputConfig.Value.Select(inputConfig =>
                                                                                                     new HLE.HOS.Services.Hid.ControllerConfig
            {
                Player = (PlayerIndex)inputConfig.PlayerIndex,
                Type   = (ControllerType)inputConfig.ControllerType
            }
                                                                                                     ).ToArray());

            _glWidget = new GlRenderer(_emulationContext);

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

                _glWidget.ShowAll();
                EditFooterForGameRender();

                if (this.Window.State.HasFlag(Gdk.WindowState.Fullscreen))
                {
                    ToggleExtraWidgets(false);
                }
            });

            _glWidget.WaitEvent.WaitOne();

            _glWidget.Start();

            Ptc.Close();
            PtcProfiler.Stop();

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

            // NOTE: Everything that is here will not be executed when you close the UI.
            Application.Invoke(delegate
            {
                if (this.Window.State.HasFlag(Gdk.WindowState.Fullscreen))
                {
                    ToggleExtraWidgets(true);
                }

                _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;
            });
        }
예제 #6
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();
        }
예제 #7
0
 public void ExecuteProgram(HLE.Switch device, ProgramSpecifyKind kind, ulong value)
 {
     device.UserChannelPersistence.ExecuteProgram(kind, value);
     MainWindow.GlWidget?.Exit();
 }
예제 #8
0
        private void CreateGameWindow()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                _windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1);
            }

            GlRendererWidget = new GlRenderer(_emulationContext, ConfigurationState.Instance.Logger.GraphicsDebugLevel);

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

                GlRendererWidget.ShowAll();
                EditFooterForGameRenderer();

                if (Window.State.HasFlag(Gdk.WindowState.Fullscreen))
                {
                    ToggleExtraWidgets(false);
                }
                else if (ConfigurationState.Instance.Ui.StartFullscreen.Value)
                {
                    FullScreen_Toggled(null, null);
                }
            });

            GlRendererWidget.WaitEvent.WaitOne();

            GlRendererWidget.Start();

            Ptc.Close();
            PtcProfiler.Stop();

            _emulationContext.Dispose();
            _deviceExitStatus.Set();

            // NOTE: Everything that is here will not be executed when you close the UI.
            Application.Invoke(delegate
            {
                if (Window.State.HasFlag(Gdk.WindowState.Fullscreen))
                {
                    ToggleExtraWidgets(true);
                }

                _viewBox.Remove(GlRendererWidget);
                GlRendererWidget.Exit();

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

                GlRendererWidget.Dispose();

                _windowsMultimediaTimerResolution?.Dispose();
                _windowsMultimediaTimerResolution = null;

                _viewBox.Add(_gameTableWindow);

                _gameTableWindow.Expand = true;

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

                _emulationContext = null;
                _gameLoaded       = false;
                GlRendererWidget  = null;

                DiscordIntegrationModule.SwitchToMainMenu();

                RecreateFooterForMenu();

                UpdateColumns();
                UpdateGameTable();

                Task.Run(RefreshFirmwareLabel);
                Task.Run(HandleRelaunch);

                _stopEmulation.Sensitive            = false;
                _simulateWakeUpMessage.Sensitive    = false;
                _firmwareInstallFile.Sensitive      = true;
                _firmwareInstallDirectory.Sensitive = true;
            });
        }
예제 #9
0
        private MainWindow(Builder builder) : base(builder.GetObject("_mainWin").Handle)
        {
            builder.Autoconnect(this);

            DeleteEvent += Window_Close;

            ApplicationLibrary.ApplicationAdded += Application_Added;

            _gameTable.ButtonReleaseEvent += Row_Clicked;

            bool continueWithStartup = Migration.PromptIfMigrationNeededForStartup(this, out bool migrationNeeded);

            if (!continueWithStartup)
            {
                End();
            }

            _renderer = new Renderer();

            _audioOut = InitializeAudioEngine();

            // TODO: Initialization and dispose of HLE.Switch when starting/stoping emulation.
            _device = InitializeSwitchInstance();

            if (migrationNeeded)
            {
                bool migrationSuccessful = Migration.DoMigrationForStartup(this, _device);

                if (!migrationSuccessful)
                {
                    End();
                }
            }

            _treeView = _gameTable;

            ApplyTheme();

            _mainWin.Icon            = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");
            _stopEmulation.Sensitive = false;

            if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn)
            {
                _favToggle.Active = true;
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn)
            {
                _iconToggle.Active = true;
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.AppColumn)
            {
                _appToggle.Active = true;
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.DevColumn)
            {
                _developerToggle.Active = true;
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.VersionColumn)
            {
                _versionToggle.Active = true;
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn)
            {
                _timePlayedToggle.Active = true;
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn)
            {
                _lastPlayedToggle.Active = true;
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn)
            {
                _fileExtToggle.Active = true;
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn)
            {
                _fileSizeToggle.Active = true;
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn)
            {
                _pathToggle.Active = true;
            }

            _gameTable.Model = _tableStore = new ListStore(
                typeof(bool),
                typeof(Gdk.Pixbuf),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string),
                typeof(string));

            _tableStore.SetSortFunc(5, TimePlayedSort);
            _tableStore.SetSortFunc(6, LastPlayedSort);
            _tableStore.SetSortFunc(8, FileSizeSort);
            _tableStore.SetSortColumnId(0, SortType.Descending);

            UpdateColumns();
#pragma warning disable CS4014
            UpdateGameTable();
#pragma warning restore CS4014

            Task.Run(RefreshFirmwareLabel);
        }
예제 #10
0
        private SwitchSettings(Builder builder, HLE.Switch device) : base(builder.GetObject("_settingsWin").Handle)
        {
            Device = device;

            builder.Autoconnect(this);

            _settingsWin.Icon       = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png");
            _controllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500);

            //Bind Events
            _lStickUp1.Clicked     += (o, args) => Button_Pressed(o, args, _lStickUp1);
            _lStickDown1.Clicked   += (o, args) => Button_Pressed(o, args, _lStickDown1);
            _lStickLeft1.Clicked   += (o, args) => Button_Pressed(o, args, _lStickLeft1);
            _lStickRight1.Clicked  += (o, args) => Button_Pressed(o, args, _lStickRight1);
            _lStickButton1.Clicked += (o, args) => Button_Pressed(o, args, _lStickButton1);
            _dpadUp1.Clicked       += (o, args) => Button_Pressed(o, args, _dpadUp1);
            _dpadDown1.Clicked     += (o, args) => Button_Pressed(o, args, _dpadDown1);
            _dpadLeft1.Clicked     += (o, args) => Button_Pressed(o, args, _dpadLeft1);
            _dpadRight1.Clicked    += (o, args) => Button_Pressed(o, args, _dpadRight1);
            _minus1.Clicked        += (o, args) => Button_Pressed(o, args, _minus1);
            _l1.Clicked            += (o, args) => Button_Pressed(o, args, _l1);
            _zL1.Clicked           += (o, args) => Button_Pressed(o, args, _zL1);
            _rStickUp1.Clicked     += (o, args) => Button_Pressed(o, args, _rStickUp1);
            _rStickDown1.Clicked   += (o, args) => Button_Pressed(o, args, _rStickDown1);
            _rStickLeft1.Clicked   += (o, args) => Button_Pressed(o, args, _rStickLeft1);
            _rStickRight1.Clicked  += (o, args) => Button_Pressed(o, args, _rStickRight1);
            _rStickButton1.Clicked += (o, args) => Button_Pressed(o, args, _rStickButton1);
            _a1.Clicked            += (o, args) => Button_Pressed(o, args, _a1);
            _b1.Clicked            += (o, args) => Button_Pressed(o, args, _b1);
            _x1.Clicked            += (o, args) => Button_Pressed(o, args, _x1);
            _y1.Clicked            += (o, args) => Button_Pressed(o, args, _y1);
            _plus1.Clicked         += (o, args) => Button_Pressed(o, args, _plus1);
            _r1.Clicked            += (o, args) => Button_Pressed(o, args, _r1);
            _zR1.Clicked           += (o, args) => Button_Pressed(o, args, _zR1);

            //Setup Currents
            if (SwitchConfig.EnableFileLog)
            {
                _fileLogToggle.Click();
            }
            if (SwitchConfig.LoggingEnableError)
            {
                _errorLogToggle.Click();
            }
            if (SwitchConfig.LoggingEnableWarn)
            {
                _warningLogToggle.Click();
            }
            if (SwitchConfig.LoggingEnableInfo)
            {
                _infoLogToggle.Click();
            }
            if (SwitchConfig.LoggingEnableStub)
            {
                _stubLogToggle.Click();
            }
            if (SwitchConfig.LoggingEnableDebug)
            {
                _debugLogToggle.Click();
            }
            if (SwitchConfig.LoggingEnableGuest)
            {
                _guestLogToggle.Click();
            }
            if (SwitchConfig.LoggingEnableFsAccessLog)
            {
                _fsAccessLogToggle.Click();
            }
            if (SwitchConfig.DockedMode)
            {
                _dockedModeToggle.Click();
            }
            if (SwitchConfig.EnableDiscordIntegration)
            {
                _discordToggle.Click();
            }
            if (SwitchConfig.EnableVsync)
            {
                _vSyncToggle.Click();
            }
            if (SwitchConfig.EnableMulticoreScheduling)
            {
                _multiSchedToggle.Click();
            }
            if (SwitchConfig.EnableFsIntegrityChecks)
            {
                _fsicToggle.Click();
            }
            if (SwitchConfig.IgnoreMissingServices)
            {
                _ignoreToggle.Click();
            }
            if (SwitchConfig.EnableKeyboard)
            {
                _directKeyboardAccess.Click();
            }
            if (SwitchConfig.EnableCustomTheme)
            {
                _custThemeToggle.Click();
            }

            _systemLanguageSelect.SetActiveId(SwitchConfig.SystemLanguage.ToString());
            _controller1Type.SetActiveId(SwitchConfig.ControllerType.ToString());

            _lStickUp1.Label     = SwitchConfig.KeyboardControls.LeftJoycon.StickUp.ToString();
            _lStickDown1.Label   = SwitchConfig.KeyboardControls.LeftJoycon.StickDown.ToString();
            _lStickLeft1.Label   = SwitchConfig.KeyboardControls.LeftJoycon.StickLeft.ToString();
            _lStickRight1.Label  = SwitchConfig.KeyboardControls.LeftJoycon.StickRight.ToString();
            _lStickButton1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickButton.ToString();
            _dpadUp1.Label       = SwitchConfig.KeyboardControls.LeftJoycon.DPadUp.ToString();
            _dpadDown1.Label     = SwitchConfig.KeyboardControls.LeftJoycon.DPadDown.ToString();
            _dpadLeft1.Label     = SwitchConfig.KeyboardControls.LeftJoycon.DPadLeft.ToString();
            _dpadRight1.Label    = SwitchConfig.KeyboardControls.LeftJoycon.DPadRight.ToString();
            _minus1.Label        = SwitchConfig.KeyboardControls.LeftJoycon.ButtonMinus.ToString();
            _l1.Label            = SwitchConfig.KeyboardControls.LeftJoycon.ButtonL.ToString();
            _zL1.Label           = SwitchConfig.KeyboardControls.LeftJoycon.ButtonZl.ToString();
            _rStickUp1.Label     = SwitchConfig.KeyboardControls.RightJoycon.StickUp.ToString();
            _rStickDown1.Label   = SwitchConfig.KeyboardControls.RightJoycon.StickDown.ToString();
            _rStickLeft1.Label   = SwitchConfig.KeyboardControls.RightJoycon.StickLeft.ToString();
            _rStickRight1.Label  = SwitchConfig.KeyboardControls.RightJoycon.StickRight.ToString();
            _rStickButton1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickButton.ToString();
            _a1.Label            = SwitchConfig.KeyboardControls.RightJoycon.ButtonA.ToString();
            _b1.Label            = SwitchConfig.KeyboardControls.RightJoycon.ButtonB.ToString();
            _x1.Label            = SwitchConfig.KeyboardControls.RightJoycon.ButtonX.ToString();
            _y1.Label            = SwitchConfig.KeyboardControls.RightJoycon.ButtonY.ToString();
            _plus1.Label         = SwitchConfig.KeyboardControls.RightJoycon.ButtonPlus.ToString();
            _r1.Label            = SwitchConfig.KeyboardControls.RightJoycon.ButtonR.ToString();
            _zR1.Label           = SwitchConfig.KeyboardControls.RightJoycon.ButtonZr.ToString();

            _custThemePath.Buffer.Text           = SwitchConfig.CustomThemePath;
            _graphicsShadersDumpPath.Buffer.Text = SwitchConfig.GraphicsShadersDumpPath;
            _fsLogSpinAdjustment.Value           = SwitchConfig.FsGlobalAccessLogMode;

            _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
            _gameDirsBoxStore  = new ListStore(typeof(string));
            _gameDirsBox.Model = _gameDirsBoxStore;
            foreach (string gameDir in SwitchConfig.GameDirs)
            {
                _gameDirsBoxStore.AppendValues(gameDir);
            }

            if (_custThemeToggle.Active == false)
            {
                _custThemePath.Sensitive      = false;
                _custThemePathLabel.Sensitive = false;
                _browseThemePath.Sensitive    = false;
            }

            _logPath.Buffer.Text = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log");

            _listeningForKeypress = false;
        }
예제 #11
0
 public SwitchSettings(HLE.Switch device) : this(new Builder("Ryujinx.Ui.SwitchSettings.glade"), device)
 {
 }
예제 #12
0
        private void CreateGameWindow(HLE.Switch device)
        {
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                _windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1);
            }

            _glWidget = new GlRenderer(_emulationContext, ConfigurationState.Instance.Logger.GraphicsDebugLevel);

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

                _glWidget.ShowAll();
                EditFooterForGameRender();

                if (this.Window.State.HasFlag(Gdk.WindowState.Fullscreen))
                {
                    ToggleExtraWidgets(false);
                }
            });

            _glWidget.WaitEvent.WaitOne();

            _glWidget.Start();

            Ptc.Close();
            PtcProfiler.Stop();

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

            // NOTE: Everything that is here will not be executed when you close the UI.
            Application.Invoke(delegate
            {
                if (this.Window.State.HasFlag(Gdk.WindowState.Fullscreen))
                {
                    ToggleExtraWidgets(true);
                }

                _viewBox.Remove(_glWidget);
                _glWidget.Exit();

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

                _glWidget.Dispose();
                _windowsMultimediaTimerResolution?.Dispose();
                _windowsMultimediaTimerResolution = null;

                _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;
            });
        }