public Switch(IGalRenderer Renderer, IAalOutput AudioOut) { if (Renderer == null) { throw new ArgumentNullException(nameof(Renderer)); } if (AudioOut == null) { throw new ArgumentNullException(nameof(AudioOut)); } this.AudioOut = AudioOut; Log = new Logger(); Gpu = new NvGpu(Renderer); VFs = new VirtualFileSystem(); Os = new Horizon(this); Settings = new SystemSettings(); Statistics = new PerformanceStatistics(); Hid = new Hid(Log); Font = new SharedFontManager(Log, VFs.GetSystemPath()); Os.HidSharedMem.MemoryMapped += Hid.ShMemMap; Os.HidSharedMem.MemoryUnmapped += Hid.ShMemUnmap; Os.FontSharedMem.MemoryMapped += Font.ShMemMap; Os.FontSharedMem.MemoryUnmapped += Font.ShMemUnmap; }
public ScreenTexture(Switch Ns, IGalRenderer Renderer, int Width, int Height) { this.Ns = Ns; this.Renderer = Renderer; this.Width = Width; this.Height = Height; Pixels = new int[Width * Height]; TexHandle = GL.GenTexture(); GL.BindTexture(TextureTarget.Texture2D, TexHandle); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, Width, Height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero); }
private MainWindow(Builder builder) : base(builder.GetObject("_mainWin").Handle) { builder.Autoconnect(this); DeleteEvent += Window_Close; ApplicationLibrary.ApplicationAdded += Application_Added; _gameTable.ButtonReleaseEvent += Row_Clicked; _renderer = new OglRenderer(); _audioOut = InitializeAudioEngine(); // TODO: Initialization and dispose of HLE.Switch when starting/stoping emulation. _device = InitializeSwitchInstance(); _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 }
private MainWindow(Builder builder, string[] args, Application gtkApplication) : base(builder.GetObject("_mainWin").Handle) { _renderer = new OglRenderer(); _audioOut = InitializeAudioEngine(); _device = new HLE.Switch(_renderer, _audioOut); Configuration.Load(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json")); Configuration.InitialConfigure(_device); ApplicationLibrary.Init(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage); _gtkApplication = gtkApplication; ApplyTheme(); if (DiscordIntegrationEnabled) { DiscordClient = new DiscordRpcClient("568815339807309834"); DiscordPresence = new RichPresence { Assets = new Assets { LargeImageKey = "ryujinx", LargeImageText = "Ryujinx is an emulator for the Nintendo Switch" }, Details = "Main Menu", State = "Idling", Timestamps = new Timestamps(DateTime.UtcNow) }; DiscordClient.Initialize(); DiscordClient.SetPresence(DiscordPresence); } builder.Autoconnect(this); DeleteEvent += Window_Close; _mainWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png"); _stopEmulation.Sensitive = false; if (SwitchSettings.SwitchConfig.GuiColumns[0]) { _iconToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns[1]) { _titleToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns[2]) { _developerToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns[3]) { _versionToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns[4]) { _timePlayedToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns[5]) { _lastPlayedToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns[6]) { _fileExtToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns[7]) { _fileSizeToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns[8]) { _pathToggle.Active = true; } if (args.Length == 1) { // Temporary code section start, remove this section when game is rendered to the GLArea in the GUI _box.Remove(_glScreen); if (SwitchSettings.SwitchConfig.GuiColumns[0]) { _gameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 0); } if (SwitchSettings.SwitchConfig.GuiColumns[1]) { _gameTable.AppendColumn("Application", new CellRendererText(), "text", 1); } if (SwitchSettings.SwitchConfig.GuiColumns[2]) { _gameTable.AppendColumn("Developer", new CellRendererText(), "text", 2); } if (SwitchSettings.SwitchConfig.GuiColumns[3]) { _gameTable.AppendColumn("Version", new CellRendererText(), "text", 3); } if (SwitchSettings.SwitchConfig.GuiColumns[4]) { _gameTable.AppendColumn("Time Played", new CellRendererText(), "text", 4); } if (SwitchSettings.SwitchConfig.GuiColumns[5]) { _gameTable.AppendColumn("Last Played", new CellRendererText(), "text", 5); } if (SwitchSettings.SwitchConfig.GuiColumns[6]) { _gameTable.AppendColumn("File Ext", new CellRendererText(), "text", 6); } if (SwitchSettings.SwitchConfig.GuiColumns[7]) { _gameTable.AppendColumn("File Size", new CellRendererText(), "text", 7); } if (SwitchSettings.SwitchConfig.GuiColumns[8]) { _gameTable.AppendColumn("Path", new CellRendererText(), "text", 8); } _tableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); _gameTable.Model = _tableStore; UpdateGameTable(); // Temporary code section end } else { _box.Remove(_glScreen); if (SwitchSettings.SwitchConfig.GuiColumns[0]) { _gameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 0); } if (SwitchSettings.SwitchConfig.GuiColumns[1]) { _gameTable.AppendColumn("Application", new CellRendererText(), "text", 1); } if (SwitchSettings.SwitchConfig.GuiColumns[2]) { _gameTable.AppendColumn("Developer", new CellRendererText(), "text", 2); } if (SwitchSettings.SwitchConfig.GuiColumns[3]) { _gameTable.AppendColumn("Version", new CellRendererText(), "text", 3); } if (SwitchSettings.SwitchConfig.GuiColumns[4]) { _gameTable.AppendColumn("Time Played", new CellRendererText(), "text", 4); } if (SwitchSettings.SwitchConfig.GuiColumns[5]) { _gameTable.AppendColumn("Last Played", new CellRendererText(), "text", 5); } if (SwitchSettings.SwitchConfig.GuiColumns[6]) { _gameTable.AppendColumn("File Ext", new CellRendererText(), "text", 6); } if (SwitchSettings.SwitchConfig.GuiColumns[7]) { _gameTable.AppendColumn("File Size", new CellRendererText(), "text", 7); } if (SwitchSettings.SwitchConfig.GuiColumns[8]) { _gameTable.AppendColumn("Path", new CellRendererText(), "text", 8); } _tableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string)); _gameTable.Model = _tableStore; UpdateGameTable(); } }
private MainWindow(Builder builder) : base(builder.GetObject("_mainWin").Handle) { builder.Autoconnect(this); DeleteEvent += Window_Close; ApplicationLibrary.ApplicationAdded += Application_Added; _renderer = new OglRenderer(); _audioOut = InitializeAudioEngine(); _device = new HLE.Switch(_renderer, _audioOut); _treeView = _gameTable; Configuration.Load(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json")); Configuration.InitialConfigure(_device); ApplyTheme(); if (DiscordIntegrationEnabled) { DiscordClient = new DiscordRpcClient("568815339807309834"); DiscordPresence = new RichPresence { Assets = new Assets { LargeImageKey = "ryujinx", LargeImageText = "Ryujinx is an emulator for the Nintendo Switch" }, Details = "Main Menu", State = "Idling", Timestamps = new Timestamps(DateTime.UtcNow) }; DiscordClient.Initialize(); DiscordClient.SetPresence(DiscordPresence); } _mainWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"); _stopEmulation.Sensitive = false; if (SwitchSettings.SwitchConfig.GuiColumns.FavColumn) { _favToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns.IconColumn) { _iconToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns.AppColumn) { _appToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns.DevColumn) { _developerToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns.VersionColumn) { _versionToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns.TimePlayedColumn) { _timePlayedToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns.LastPlayedColumn) { _lastPlayedToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns.FileExtColumn) { _fileExtToggle.Active = true; } if (SwitchSettings.SwitchConfig.GuiColumns.FileSizeColumn) { _fileSizeToggle.Active = true; } if (SwitchSettings.SwitchConfig.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 }