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(); Memory = new DeviceMemory(); Gpu = new NvGpu(Renderer); FileSystem = new VirtualFileSystem(); System = new Horizon(this); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidSharedMem.PA); }
public Switch(VirtualFileSystem fileSystem, ContentManager contentManager, IRenderer renderer, IAalOutput audioOut) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } if (audioOut == null) { throw new ArgumentNullException(nameof(audioOut)); } AudioOut = audioOut; Memory = new DeviceMemory(); Gpu = new GpuContext(renderer); FileSystem = fileSystem; System = new Horizon(this, contentManager); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidBaseAddress); Hid.InitDevices(); }
public IAudioRenderer(AMemory Memory, IAalOutput AudioOut, AudioRendererParameter Params) { m_Commands = new Dictionary <int, ServiceProcessRequest>() { { 4, RequestUpdateAudioRenderer }, { 5, StartAudioRenderer }, { 6, StopAudioRenderer }, { 7, QuerySystemEvent } }; UpdateEvent = new KEvent(); this.Memory = Memory; this.AudioOut = AudioOut; this.Params = Params; Track = AudioOut.OpenTrack( AudioConsts.HostSampleRate, AudioConsts.HostChannelsCount, AudioCallback); MemoryPools = CreateArray <MemoryPoolContext>(Params.EffectCount + Params.VoiceCount * 4); Voices = CreateArray <VoiceContext>(Params.VoiceCount); InitializeAudioOut(); }
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; Memory = new DeviceMemory(); Gpu = new NvGpu(Renderer); FileSystem = new VirtualFileSystem(); System = new Horizon(this); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidBaseAddress); VsyncEvent = new AutoResetEvent(true); }
public IAudioRenderer( Horizon system, MemoryManager memory, IAalOutput audioOut, AudioRendererParameter rendererParams) { _updateEvent = new KEvent(system.KernelContext); _memory = memory; _audioOut = audioOut; _params = rendererParams; _track = audioOut.OpenTrack( AudioRendererConsts.HostSampleRate, AudioRendererConsts.HostChannelsCount, AudioCallback); _memoryPools = CreateArray <MemoryPoolContext>(rendererParams.EffectCount + rendererParams.VoiceCount * 4); _voices = CreateArray <VoiceContext>(rendererParams.VoiceCount); _effects = CreateArray <EffectContext>(rendererParams.EffectCount); _elapsedFrameCount = 0; InitializeAudioOut(); _playState = PlayState.Stopped; }
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); Os.HidSharedMem.MemoryMapped += Hid.ShMemMap; Os.HidSharedMem.MemoryUnmapped += Hid.ShMemUnmap; }
public Switch(VirtualFileSystem fileSystem, ContentManager contentManager, UserChannelPersistence userChannelPersistence, IRenderer renderer, IAalOutput audioOut) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } if (audioOut == null) { throw new ArgumentNullException(nameof(audioOut)); } if (userChannelPersistence == null) { throw new ArgumentNullException(nameof(userChannelPersistence)); } UserChannelPersistence = userChannelPersistence; AudioOut = audioOut; Memory = new MemoryBlock(1UL << 32); Gpu = new GpuContext(renderer); Host1x = new Host1xDevice(Gpu.Synchronization); var nvdec = new NvdecDevice(Gpu.MemoryManager); var vic = new VicDevice(Gpu.MemoryManager); Host1x.RegisterDevice(ClassId.Nvdec, nvdec); Host1x.RegisterDevice(ClassId.Vic, vic); nvdec.FrameDecoded += (FrameDecodedEventArgs e) => { // FIXME: // Figure out what is causing frame ordering issues on H264. // For now this is needed as workaround. if (e.CodecId == CodecId.H264) { vic.SetSurfaceOverride(e.LumaOffset, e.ChromaOffset, 0); } else { vic.DisableSurfaceOverride(); } }; FileSystem = fileSystem; System = new Horizon(this, contentManager); System.InitializeServices(); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidBaseAddress); Hid.InitDevices(); Application = new ApplicationLoader(this, fileSystem, contentManager); }
public IAudioOut(KernelContext kernelContext, IAalOutput audioOut, KEvent releaseEvent, int track, int clientHandle) { _kernelContext = kernelContext; _audioOut = audioOut; _releaseEvent = releaseEvent; _track = track; _clientHandle = clientHandle; }
public long OpenAudioOut(ServiceCtx Context) { IAalOutput AudioOut = Context.Ns.AudioOut; string DeviceName = AMemoryHelper.ReadAsciiString( Context.Memory, Context.Request.SendBuff[0].Position, Context.Request.SendBuff[0].Size); if (DeviceName == string.Empty) { DeviceName = "FIXME"; } long DeviceNamePosition = Context.Request.ReceiveBuff[0].Position; long DeviceNameSize = Context.Request.ReceiveBuff[0].Size; byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DeviceName); if (DeviceName.Length <= DeviceNameSize) { AMemoryHelper.WriteBytes(Context.Memory, DeviceNamePosition, DeviceNameBuffer); } int SampleRate = Context.RequestData.ReadInt32(); int Channels = Context.RequestData.ReadInt32(); Channels = (ushort)(Channels >> 16); if (SampleRate == 0) { SampleRate = 48000; } if (Channels < 1 || Channels > 2) { Channels = 2; } KEvent ReleaseEvent = new KEvent(); ReleaseCallback Callback = () => { ReleaseEvent.WaitEvent.Set(); }; int Track = AudioOut.OpenTrack(SampleRate, Channels, Callback, out AudioFormat Format); MakeObject(Context, new IAudioOut(AudioOut, ReleaseEvent, Track)); Context.ResponseData.Write(SampleRate); Context.ResponseData.Write(Channels); Context.ResponseData.Write((int)Format); Context.ResponseData.Write((int)PlaybackState.Stopped); return(0); }
public void OpenAudioOutMethod(ServiceCtx Context, long SendPosition, long SendSize, long ReceivePosition, long ReceiveSize) { IAalOutput AudioOut = Context.Ns.AudioOut; string DeviceName = AMemoryHelper.ReadAsciiString( Context.Memory, SendPosition, SendSize ); if (DeviceName == string.Empty) { DeviceName = DefaultAudioOutput; } byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DeviceName + "\0"); if ((ulong)DeviceNameBuffer.Length <= (ulong)ReceiveSize) { Context.Memory.WriteBytes(ReceivePosition, DeviceNameBuffer); } else { Context.Ns.Log.PrintError(LogClass.ServiceAudio, $"Output buffer size {ReceiveSize} too small!"); } int SampleRate = Context.RequestData.ReadInt32(); int Channels = Context.RequestData.ReadInt32(); Channels = (ushort)(Channels >> 16); if (SampleRate == 0) { SampleRate = 48000; } if (Channels < 1 || Channels > 2) { Channels = 2; } KEvent ReleaseEvent = new KEvent(); ReleaseCallback Callback = () => { ReleaseEvent.WaitEvent.Set(); }; int Track = AudioOut.OpenTrack(SampleRate, Channels, Callback, out AudioFormat Format); MakeObject(Context, new IAudioOut(AudioOut, ReleaseEvent, Track)); Context.ResponseData.Write(SampleRate); Context.ResponseData.Write(Channels); Context.ResponseData.Write((int)Format); Context.ResponseData.Write((int)PlaybackState.Stopped); }
public long OpenAudioRenderer(ServiceCtx Context) { IAalOutput AudioOut = Context.Device.AudioOut; AudioRendererParameter Params = GetAudioRendererParameter(Context); MakeObject(Context, new IAudioRenderer(Context.Memory, AudioOut, Params)); return(0); }
public long OpenAudioRenderer(ServiceCtx context) { IAalOutput audioOut = context.Device.AudioOut; AudioRendererParameter Params = GetAudioRendererParameter(context); MakeObject(context, new IAudioRenderer( context.Device.System, context.Memory, audioOut, Params)); return(0); }
public AalHardwareDevice(int bufferTag, IAalOutput output, uint channelCount, uint sampleRate) { _bufferTag = bufferTag; _channelCount = channelCount; _sampleRate = sampleRate; _output = output; _releaseEvent = new AutoResetEvent(true); _trackId = _output.OpenTrack((int)sampleRate, (int)channelCount, AudioCallback); _releasedTags = new Queue <long>(); _buffer = new short[RendererConstants.TargetSampleCount * channelCount]; _output.Start(_trackId); }
public IAudioOut(IAalOutput AudioOut, KEvent ReleaseEvent, int Track) { m_Commands = new Dictionary <int, ServiceProcessRequest>() { { 0, GetAudioOutState }, { 1, StartAudioOut }, { 2, StopAudioOut }, { 3, AppendAudioOutBuffer }, { 4, RegisterBufferEvent }, { 5, GetReleasedAudioOutBuffer }, { 6, ContainsAudioOutBuffer }, { 7, AppendAudioOutBufferAuto }, { 8, GetReleasedAudioOutBufferAuto } }; this.AudioOut = AudioOut; this.ReleaseEvent = ReleaseEvent; this.Track = Track; }
public IAudioOut(IAalOutput audioOut, KEvent releaseEvent, int track) { _commands = new Dictionary <int, ServiceProcessRequest> { { 0, GetAudioOutState }, { 1, StartAudioOut }, { 2, StopAudioOut }, { 3, AppendAudioOutBuffer }, { 4, RegisterBufferEvent }, { 5, GetReleasedAudioOutBuffer }, { 6, ContainsAudioOutBuffer }, { 7, AppendAudioOutBufferAuto }, { 8, GetReleasedAudioOutBufferAuto } }; _audioOut = audioOut; _releaseEvent = releaseEvent; _track = track; }
public IAudioRenderer( Horizon system, MemoryManager memory, IAalOutput audioOut, AudioRendererParameter Params) { _commands = new Dictionary <int, ServiceProcessRequest> { { 0, GetSampleRate }, { 1, GetSampleCount }, { 2, GetMixBufferCount }, { 3, GetState }, { 4, RequestUpdateAudioRenderer }, { 5, StartAudioRenderer }, { 6, StopAudioRenderer }, { 7, QuerySystemEvent } }; _updateEvent = new KEvent(system); _memory = memory; _audioOut = audioOut; _params = Params; _track = audioOut.OpenTrack( AudioConsts.HostSampleRate, AudioConsts.HostChannelsCount, AudioCallback); _memoryPools = CreateArray <MemoryPoolContext>(Params.EffectCount + Params.VoiceCount * 4); _voices = CreateArray <VoiceContext>(Params.VoiceCount); InitializeAudioOut(); _playState = PlayState.Stopped; }
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 }
static void Main(string[] args) { Console.Title = "Ryujinx Console"; IGalRenderer renderer = new OGLRenderer(); IAalOutput audioOut = InitializeAudioEngine(); Switch device = new Switch(renderer, audioOut); Configuration.Load(Path.Combine(ApplicationDirectory, "Config.jsonc")); Configuration.Configure(device); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; if (args.Length == 1) { if (Directory.Exists(args[0])) { string[] romFsFiles = Directory.GetFiles(args[0], "*.istorage"); if (romFsFiles.Length == 0) { romFsFiles = Directory.GetFiles(args[0], "*.romfs"); } if (romFsFiles.Length > 0) { Logger.PrintInfo(LogClass.Application, "Loading as cart with RomFS."); device.LoadCart(args[0], romFsFiles[0]); } else { Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS."); device.LoadCart(args[0]); } } else if (File.Exists(args[0])) { switch (Path.GetExtension(args[0]).ToLowerInvariant()) { case ".xci": Logger.PrintInfo(LogClass.Application, "Loading as XCI."); device.LoadXci(args[0]); break; case ".nca": Logger.PrintInfo(LogClass.Application, "Loading as NCA."); device.LoadNca(args[0]); break; case ".nsp": case ".pfs0": Logger.PrintInfo(LogClass.Application, "Loading as NSP."); device.LoadNsp(args[0]); break; default: Logger.PrintInfo(LogClass.Application, "Loading as homebrew."); device.LoadProgram(args[0]); break; } } else { Logger.PrintWarning(LogClass.Application, "Please specify a valid XCI/NCA/NSP/PFS0/NRO file"); } } else { Logger.PrintWarning(LogClass.Application, "Please specify the folder with the NSOs/IStorage or a NSO/NRO."); } using (GlScreen screen = new GlScreen(device, renderer)) { screen.MainLoop(); device.Dispose(); } audioOut.Dispose(); Logger.Shutdown(); }
static void Main(string[] args) { Console.Title = "Ryujinx Console"; IGalRenderer renderer = new OglRenderer(); IAalOutput audioOut = InitializeAudioEngine(); Switch device = new Switch(renderer, audioOut); Configuration.Load(Path.Combine(ApplicationDirectory, "Config.jsonc")); Configuration.Configure(device); Profile.Initalize(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; if (device.System.State.DiscordIntergrationEnabled == true) { DiscordClient = new DiscordRpcClient("568815339807309834"); DiscordPresence = new RichPresence { Assets = new Assets { LargeImageKey = "ryujinx", LargeImageText = "Ryujinx is an emulator for the Nintendo Switch" } }; DiscordClient.Initialize(); DiscordClient.SetPresence(DiscordPresence); } if (args.Length == 1) { if (Directory.Exists(args[0])) { string[] romFsFiles = Directory.GetFiles(args[0], "*.istorage"); if (romFsFiles.Length == 0) { romFsFiles = Directory.GetFiles(args[0], "*.romfs"); } if (romFsFiles.Length > 0) { Logger.PrintInfo(LogClass.Application, "Loading as cart with RomFS."); device.LoadCart(args[0], romFsFiles[0]); } else { Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS."); device.LoadCart(args[0]); } } else if (File.Exists(args[0])) { switch (Path.GetExtension(args[0]).ToLowerInvariant()) { case ".xci": Logger.PrintInfo(LogClass.Application, "Loading as XCI."); device.LoadXci(args[0]); break; case ".nca": Logger.PrintInfo(LogClass.Application, "Loading as NCA."); device.LoadNca(args[0]); break; case ".nsp": case ".pfs0": Logger.PrintInfo(LogClass.Application, "Loading as NSP."); device.LoadNsp(args[0]); break; default: Logger.PrintInfo(LogClass.Application, "Loading as homebrew."); device.LoadProgram(args[0]); break; } } else { Logger.PrintWarning(LogClass.Application, "Please specify a valid XCI/NCA/NSP/PFS0/NRO file"); } } else { Logger.PrintWarning(LogClass.Application, "Please specify the folder with the NSOs/IStorage or a NSO/NRO."); } if (device.System.State.DiscordIntergrationEnabled == true) { if (File.ReadAllLines(Path.Combine(ApplicationDirectory, "RPsupported.dat")).Contains(device.System.TitleID)) { DiscordPresence.Assets.LargeImageKey = device.System.TitleID; } DiscordPresence.Details = $"Playing {device.System.TitleName}"; DiscordPresence.State = device.System.TitleID.ToUpper(); DiscordPresence.Assets.LargeImageText = device.System.TitleName; DiscordPresence.Assets.SmallImageKey = "ryujinx"; DiscordPresence.Assets.SmallImageText = "Ryujinx is an emulator for the Nintendo Switch"; DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow); DiscordClient.SetPresence(DiscordPresence); } using (GlScreen screen = new GlScreen(device, renderer)) { screen.MainLoop(); Profile.FinishProfiling(); device.Dispose(); } audioOut.Dispose(); Logger.Shutdown(); DiscordClient.Dispose(); }
private ResultCode OpenAudioOutImpl(ServiceCtx context, long sendPosition, long sendSize, long receivePosition, long receiveSize) { string deviceName = MemoryHelper.ReadAsciiString( context.Memory, sendPosition, sendSize); if (deviceName == string.Empty) { deviceName = DefaultAudioOutput; } if (deviceName != DefaultAudioOutput) { Logger.PrintWarning(LogClass.Audio, "Invalid device name!"); return(ResultCode.DeviceNotFound); } byte[] deviceNameBuffer = Encoding.ASCII.GetBytes(deviceName + "\0"); if ((ulong)deviceNameBuffer.Length <= (ulong)receiveSize) { context.Memory.Write((ulong)receivePosition, deviceNameBuffer); } else { Logger.PrintError(LogClass.ServiceAudio, $"Output buffer size {receiveSize} too small!"); } int sampleRate = context.RequestData.ReadInt32(); int channels = context.RequestData.ReadInt32(); if (sampleRate == 0) { sampleRate = DefaultSampleRate; } if (sampleRate != DefaultSampleRate) { Logger.PrintWarning(LogClass.Audio, "Invalid sample rate!"); return(ResultCode.UnsupportedSampleRate); } channels = (ushort)channels; if (channels == 0) { channels = DefaultChannelsCount; } KEvent releaseEvent = new KEvent(context.Device.System.KernelContext); ReleaseCallback callback = () => { releaseEvent.ReadableEvent.Signal(); }; IAalOutput audioOut = context.Device.AudioOut; int track = audioOut.OpenTrack(sampleRate, channels, callback); MakeObject(context, new IAudioOut(audioOut, releaseEvent, track)); context.ResponseData.Write(sampleRate); context.ResponseData.Write(channels); context.ResponseData.Write((int)SampleFormat.PcmInt16); context.ResponseData.Write((int)PlaybackState.Stopped); return(ResultCode.Success); }
private long OpenAudioOutImpl(ServiceCtx Context, long SendPosition, long SendSize, long ReceivePosition, long ReceiveSize) { string DeviceName = AMemoryHelper.ReadAsciiString( Context.Memory, SendPosition, SendSize); if (DeviceName == string.Empty) { DeviceName = DefaultAudioOutput; } if (DeviceName != DefaultAudioOutput) { Logger.PrintWarning(LogClass.Audio, "Invalid device name!"); return(MakeError(ErrorModule.Audio, AudErr.DeviceNotFound)); } byte[] DeviceNameBuffer = Encoding.ASCII.GetBytes(DeviceName + "\0"); if ((ulong)DeviceNameBuffer.Length <= (ulong)ReceiveSize) { Context.Memory.WriteBytes(ReceivePosition, DeviceNameBuffer); } else { Logger.PrintError(LogClass.ServiceAudio, $"Output buffer size {ReceiveSize} too small!"); } int SampleRate = Context.RequestData.ReadInt32(); int Channels = Context.RequestData.ReadInt32(); if (SampleRate == 0) { SampleRate = DefaultSampleRate; } if (SampleRate != DefaultSampleRate) { Logger.PrintWarning(LogClass.Audio, "Invalid sample rate!"); return(MakeError(ErrorModule.Audio, AudErr.UnsupportedSampleRate)); } Channels = (ushort)Channels; if (Channels == 0) { Channels = DefaultChannelsCount; } KEvent ReleaseEvent = new KEvent(Context.Device.System); ReleaseCallback Callback = () => { ReleaseEvent.ReadableEvent.Signal(); }; IAalOutput AudioOut = Context.Device.AudioOut; int Track = AudioOut.OpenTrack(SampleRate, Channels, Callback); MakeObject(Context, new IAudioOut(AudioOut, ReleaseEvent, Track)); Context.ResponseData.Write(SampleRate); Context.ResponseData.Write(Channels); Context.ResponseData.Write((int)SampleFormat.PcmInt16); Context.ResponseData.Write((int)PlaybackState.Stopped); return(0); }
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 }
public IAudioOut(IAalOutput audioOut, KEvent releaseEvent, int track) { _audioOut = audioOut; _releaseEvent = releaseEvent; _track = track; }
static void Main(string[] args) { Console.Title = "Ryujinx Console"; IGalRenderer renderer = new OGLRenderer(); IAalOutput audioOut = InitializeAudioEngine(); Switch device = new Switch(renderer, audioOut); Config.Read(device); Logger.Updated += Log.LogMessage; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; if (args.Length == 1) { if (Directory.Exists(args[0])) { string[] romFsFiles = Directory.GetFiles(args[0], "*.istorage"); if (romFsFiles.Length == 0) { romFsFiles = Directory.GetFiles(args[0], "*.romfs"); } if (romFsFiles.Length > 0) { Console.WriteLine("Loading as cart with RomFS."); device.LoadCart(args[0], romFsFiles[0]); } else { Console.WriteLine("Loading as cart WITHOUT RomFS."); device.LoadCart(args[0]); } } else if (File.Exists(args[0])) { switch (Path.GetExtension(args[0]).ToLowerInvariant()) { case ".xci": Console.WriteLine("Loading as XCI."); device.LoadXci(args[0]); break; case ".nca": Console.WriteLine("Loading as NCA."); device.LoadNca(args[0]); break; case ".nsp": case ".pfs0": Console.WriteLine("Loading as NSP."); device.LoadNsp(args[0]); break; default: Console.WriteLine("Loading as homebrew."); device.LoadProgram(args[0]); break; } } } else { Console.WriteLine("Please specify the folder with the NSOs/IStorage or a NSO/NRO."); } using (GlScreen screen = new GlScreen(device, renderer)) { screen.MainLoop(); device.Dispose(); } audioOut.Dispose(); }