using LibHac.Tools.FsSystem; using Ryujinx.Audio.Integration; using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration.Multiplayer; using Ryujinx.Graphics.GAL; using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS; using Ryujinx.HLE.HOS.Services.Account.Acc; using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.UI; using System; namespace Ryujinx.HLE { /// /// HLE configuration. /// public class HleConfiguration { /// /// The virtual file system used by the FS service. /// /// This cannot be changed after instantiation. internal VirtualFileSystem VirtualFileSystem { get; private set; } /// /// The manager for handling a LibHac Horizon instance. /// /// This cannot be changed after instantiation. internal LibHacHorizonManager LibHacHorizonManager { get; private set; } /// /// The account manager used by the account service. /// /// This cannot be changed after instantiation. internal AccountManager AccountManager { get; private set; } /// /// The content manager used by the NCM service. /// /// This cannot be changed after instantiation. internal ContentManager ContentManager { get; private set; } /// /// The persistent information between run for multi-application capabilities. /// /// This cannot be changed after instantiation. public UserChannelPersistence UserChannelPersistence { get; private set; } /// /// The GPU renderer to use for all GPU operations. /// /// This cannot be changed after instantiation. internal IRenderer GpuRenderer { get; private set; } /// /// The audio device driver to use for all audio operations. /// /// This cannot be changed after instantiation. internal IHardwareDeviceDriver AudioDeviceDriver { get; private set; } /// /// The handler for various UI related operations needed outside of HLE. /// /// This cannot be changed after instantiation. internal IHostUIHandler HostUIHandler { get; private set; } /// /// Control the memory configuration used by the emulation context. /// /// This cannot be changed after instantiation. internal readonly MemoryConfiguration MemoryConfiguration; /// /// The system language to use in the settings service. /// /// This cannot be changed after instantiation. internal readonly SystemLanguage SystemLanguage; /// /// The system region to use in the settings service. /// /// This cannot be changed after instantiation. internal readonly RegionCode Region; /// /// Control the initial state of the present interval in the SurfaceFlinger service (previously Vsync). /// internal readonly VSyncMode VSyncMode; /// /// Control the custom VSync interval, if enabled and active. /// internal readonly int CustomVSyncInterval; /// /// Control the initial state of the docked mode. /// internal readonly bool EnableDockedMode; /// /// Control if the Profiled Translation Cache (PTC) should be used. /// internal readonly bool EnablePtc; /// /// Control if the guest application should be told that there is a Internet connection available. /// public bool EnableInternetAccess { internal get; set; } /// /// Control LibHac's integrity check level. /// /// This cannot be changed after instantiation. internal readonly IntegrityCheckLevel FsIntegrityCheckLevel; /// /// Control LibHac's global access logging level. Value must be between 0 and 3. /// /// This cannot be changed after instantiation. internal readonly int FsGlobalAccessLogMode; /// /// The system time offset to apply to the time service steady and local clocks. /// /// This cannot be changed after instantiation. internal readonly long SystemTimeOffset; /// /// The system timezone used by the time service. /// /// This cannot be changed after instantiation. internal readonly string TimeZone; /// /// Type of the memory manager used on CPU emulation. /// public MemoryManagerMode MemoryManagerMode { internal get; set; } #if DEBUG /// /// Control the initial state of the ignore missing services setting. /// If this is set to true, when a missing service is encountered, it will try to automatically handle it instead of throwing an exception. /// /// TODO: Update this again. public bool IgnoreMissingServices { get; set; } #endif /// /// Aspect Ratio applied to the renderer window by the SurfaceFlinger service. /// public AspectRatio AspectRatio { get; set; } /// /// The audio volume level. /// public float AudioVolume { get; set; } /// /// Use Hypervisor over JIT if available. /// internal readonly bool UseHypervisor; /// /// Multiplayer LAN Interface ID (device GUID) /// public string MultiplayerLanInterfaceId { internal get; set; } /// /// Multiplayer Mode /// public MultiplayerMode MultiplayerMode { internal get; set; } /// /// Disable P2P mode /// public bool MultiplayerDisableP2p { internal get; set; } /// /// Multiplayer Passphrase /// public string MultiplayerLdnPassphrase { internal get; set; } /// /// LDN Server /// public string MultiplayerLdnServer { internal get; set; } /// /// An action called when HLE force a refresh of output after docked mode changed. /// public Action RefreshInputConfig { internal get; set; } /// /// The desired hacky workarounds. /// /// This cannot be changed after instantiation. public EnabledDirtyHack[] Hacks { internal get; set; } public HleConfiguration(MemoryConfiguration memoryConfiguration, SystemLanguage systemLanguage, RegionCode region, VSyncMode vSyncMode, bool enableDockedMode, bool enablePtc, bool enableInternetAccess, IntegrityCheckLevel fsIntegrityCheckLevel, int fsGlobalAccessLogMode, long systemTimeOffset, string timeZone, MemoryManagerMode memoryManagerMode, #if DEBUG bool ignoreMissingServices, #endif AspectRatio aspectRatio, float audioVolume, bool useHypervisor, string multiplayerLanInterfaceId, MultiplayerMode multiplayerMode, bool multiplayerDisableP2p, string multiplayerLdnPassphrase, string multiplayerLdnServer, int customVSyncInterval, EnabledDirtyHack[] dirtyHacks = null) { MemoryConfiguration = memoryConfiguration; SystemLanguage = systemLanguage; Region = region; VSyncMode = vSyncMode; CustomVSyncInterval = customVSyncInterval; EnableDockedMode = enableDockedMode; EnablePtc = enablePtc; EnableInternetAccess = enableInternetAccess; FsIntegrityCheckLevel = fsIntegrityCheckLevel; FsGlobalAccessLogMode = fsGlobalAccessLogMode; SystemTimeOffset = systemTimeOffset; TimeZone = timeZone; MemoryManagerMode = memoryManagerMode; #if DEBUG IgnoreMissingServices = ignoreMissingServices; #endif AspectRatio = aspectRatio; AudioVolume = audioVolume; UseHypervisor = useHypervisor; MultiplayerLanInterfaceId = multiplayerLanInterfaceId; MultiplayerMode = multiplayerMode; MultiplayerDisableP2p = multiplayerDisableP2p; MultiplayerLdnPassphrase = multiplayerLdnPassphrase; MultiplayerLdnServer = multiplayerLdnServer; Hacks = dirtyHacks ?? []; } /// /// Set the pre-configured services to use for this instance. /// public HleConfiguration Configure( VirtualFileSystem virtualFileSystem, LibHacHorizonManager libHacHorizonManager, ContentManager contentManager, AccountManager accountManager, UserChannelPersistence userChannelPersistence, IRenderer gpuRenderer, IHardwareDeviceDriver audioDeviceDriver, IHostUIHandler hostUIHandler ) { VirtualFileSystem = virtualFileSystem; LibHacHorizonManager = libHacHorizonManager; AccountManager = accountManager; ContentManager = contentManager; UserChannelPersistence = userChannelPersistence; GpuRenderer = gpuRenderer; AudioDeviceDriver = audioDeviceDriver; HostUIHandler = hostUIHandler; return this; } } }