public void Update(Hid hleHid, TamperMachine tamperMachine) { lock (_lock) { List <GamepadInput> hleInputStates = new List <GamepadInput>(); List <SixAxisInput> hleMotionStates = new List <SixAxisInput>(NpadDevices.MaxControllers); KeyboardInput?hleKeyboardInput = null; foreach (InputConfig inputConfig in _inputConfig) { GamepadInput inputState = default; SixAxisInput motionState = default; NpadController controller = _controllers[(int)inputConfig.PlayerIndex]; // Do we allow input updates and is a controller connected? if (!_blockInputUpdates && controller != null) { DriverConfigurationUpdate(ref controller, inputConfig); controller.UpdateUserConfiguration(inputConfig); controller.Update(); inputState = controller.GetHLEInputState(); inputState.Buttons |= hleHid.UpdateStickButtons(inputState.LStick, inputState.RStick); motionState = controller.GetHLEMotionState(); if (ConfigurationState.Instance.Hid.EnableKeyboard) { hleKeyboardInput = controller.GetHLEKeyboardInput(); } } else { // Ensure that orientation isn't null motionState.Orientation = new float[9]; } inputState.PlayerId = (Ryujinx.HLE.HOS.Services.Hid.PlayerIndex)inputConfig.PlayerIndex; motionState.PlayerId = (Ryujinx.HLE.HOS.Services.Hid.PlayerIndex)inputConfig.PlayerIndex; hleInputStates.Add(inputState); hleMotionStates.Add(motionState); } hleHid.Npads.Update(hleInputStates); hleHid.Npads.UpdateSixAxis(hleMotionStates); if (hleKeyboardInput.HasValue) { hleHid.Keyboard.Update(hleKeyboardInput.Value); } tamperMachine.UpdateInput(hleInputStates); } }
public Switch(HLEConfiguration configuration) { if (configuration.GpuRenderer == null) { throw new ArgumentNullException(nameof(configuration.GpuRenderer)); } if (configuration.AudioDeviceDriver == null) { throw new ArgumentNullException(nameof(configuration.AudioDeviceDriver)); } if (configuration.UserChannelPersistence == null) { throw new ArgumentNullException(nameof(configuration.UserChannelPersistence)); } Configuration = configuration; FileSystem = Configuration.VirtualFileSystem; UiHandler = Configuration.HostUiHandler; MemoryAllocationFlags memoryAllocationFlags = configuration.MemoryManagerMode == MemoryManagerMode.SoftwarePageTable ? MemoryAllocationFlags.Reserve : MemoryAllocationFlags.Reserve | MemoryAllocationFlags.Mirrorable; AudioDeviceDriver = new CompatLayerHardwareDeviceDriver(Configuration.AudioDeviceDriver); Memory = new MemoryBlock(Configuration.MemoryConfiguration.ToDramSize(), memoryAllocationFlags); Gpu = new GpuContext(Configuration.GpuRenderer); System = new Horizon(this); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidStorage); Application = new ApplicationLoader(this); TamperMachine = new TamperMachine(); System.State.SetLanguage(Configuration.SystemLanguage); System.State.SetRegion(Configuration.Region); EnableDeviceVsync = Configuration.EnableVsync; System.State.DockedMode = Configuration.EnableDockedMode; System.PerformanceState.PerformanceMode = System.State.DockedMode ? PerformanceMode.Boost : PerformanceMode.Default; System.EnablePtc = Configuration.EnablePtc; System.FsIntegrityCheckLevel = Configuration.FsIntegrityCheckLevel; System.GlobalAccessLogMode = Configuration.FsGlobalAccessLogMode; }
public Switch(HLEConfiguration configuration) { if (configuration.GpuRenderer == null) { throw new ArgumentNullException(nameof(configuration.GpuRenderer)); } if (configuration.AudioDeviceDriver == null) { throw new ArgumentNullException(nameof(configuration.AudioDeviceDriver)); } if (configuration.UserChannelPersistence == null) { throw new ArgumentNullException(nameof(configuration.UserChannelPersistence)); } Configuration = configuration; UiHandler = configuration.HostUiHandler; AudioDeviceDriver = new CompatLayerHardwareDeviceDriver(configuration.AudioDeviceDriver); Memory = new MemoryBlock(configuration.MemoryConfiguration.ToDramSize(), MemoryAllocationFlags.Reserve); Gpu = new GpuContext(configuration.GpuRenderer); System = new Horizon(this); System.InitializeServices(); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidStorage); Hid.InitDevices(); Application = new ApplicationLoader(this); TamperMachine = new TamperMachine(); Initialize(); }
public Switch( VirtualFileSystem fileSystem, ContentManager contentManager, AccountManager accountManager, UserChannelPersistence userChannelPersistence, IRenderer renderer, IHardwareDeviceDriver audioDeviceDriver, MemoryConfiguration memoryConfiguration) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } if (audioDeviceDriver == null) { throw new ArgumentNullException(nameof(audioDeviceDriver)); } if (userChannelPersistence == null) { throw new ArgumentNullException(nameof(userChannelPersistence)); } UserChannelPersistence = userChannelPersistence; _memoryConfiguration = memoryConfiguration; AudioDeviceDriver = new CompatLayerHardwareDeviceDriver(audioDeviceDriver); Memory = new MemoryBlock(memoryConfiguration.ToDramSize(), MemoryAllocationFlags.Reserve); Gpu = new GpuContext(renderer); MemoryAllocator = new NvMemoryAllocator(); 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, accountManager, memoryConfiguration); System.InitializeServices(); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidStorage); Hid.InitDevices(); Application = new ApplicationLoader(this, fileSystem, contentManager); TamperMachine = new TamperMachine(); }
public Switch(HLEConfiguration configuration) { if (configuration.GpuRenderer == null) { throw new ArgumentNullException(nameof(configuration.GpuRenderer)); } if (configuration.AudioDeviceDriver == null) { throw new ArgumentNullException(nameof(configuration.AudioDeviceDriver)); } if (configuration.UserChannelPersistence == null) { throw new ArgumentNullException(nameof(configuration.UserChannelPersistence)); } Configuration = configuration; UiHandler = configuration.HostUiHandler; AudioDeviceDriver = new CompatLayerHardwareDeviceDriver(configuration.AudioDeviceDriver); Memory = new MemoryBlock(configuration.MemoryConfiguration.ToDramSize()); Gpu = new GpuContext(configuration.GpuRenderer); MemoryAllocator = new NvMemoryAllocator(); 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(); } }; System = new Horizon(this); System.InitializeServices(); Statistics = new PerformanceStatistics(); Hid = new Hid(this, System.HidBaseAddress); Hid.InitDevices(); Application = new ApplicationLoader(this); TamperMachine = new TamperMachine(); Initialize(); }