HLEConfiguration.cs
1 using LibHac.Tools.FsSystem; 2 using Ryujinx.Audio.Integration; 3 using Ryujinx.Common.Configuration; 4 using Ryujinx.Common.Configuration.Multiplayer; 5 using Ryujinx.Graphics.GAL; 6 using Ryujinx.HLE.FileSystem; 7 using Ryujinx.HLE.HOS; 8 using Ryujinx.HLE.HOS.Services.Account.Acc; 9 using Ryujinx.HLE.HOS.SystemState; 10 using Ryujinx.HLE.UI; 11 using System; 12 13 namespace Ryujinx.HLE 14 { 15 /// <summary> 16 /// HLE configuration. 17 /// </summary> 18 public class HLEConfiguration 19 { 20 /// <summary> 21 /// The virtual file system used by the FS service. 22 /// </summary> 23 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 24 internal readonly VirtualFileSystem VirtualFileSystem; 25 26 /// <summary> 27 /// The manager for handling a LibHac Horizon instance. 28 /// </summary> 29 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 30 internal readonly LibHacHorizonManager LibHacHorizonManager; 31 32 /// <summary> 33 /// The account manager used by the account service. 34 /// </summary> 35 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 36 internal readonly AccountManager AccountManager; 37 38 /// <summary> 39 /// The content manager used by the NCM service. 40 /// </summary> 41 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 42 internal readonly ContentManager ContentManager; 43 44 /// <summary> 45 /// The persistent information between run for multi-application capabilities. 46 /// </summary> 47 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 48 public readonly UserChannelPersistence UserChannelPersistence; 49 50 /// <summary> 51 /// The GPU renderer to use for all GPU operations. 52 /// </summary> 53 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 54 internal readonly IRenderer GpuRenderer; 55 56 /// <summary> 57 /// The audio device driver to use for all audio operations. 58 /// </summary> 59 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 60 internal readonly IHardwareDeviceDriver AudioDeviceDriver; 61 62 /// <summary> 63 /// The handler for various UI related operations needed outside of HLE. 64 /// </summary> 65 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 66 internal readonly IHostUIHandler HostUIHandler; 67 68 /// <summary> 69 /// Control the memory configuration used by the emulation context. 70 /// </summary> 71 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 72 internal readonly MemoryConfiguration MemoryConfiguration; 73 74 /// <summary> 75 /// The system language to use in the settings service. 76 /// </summary> 77 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 78 internal readonly SystemLanguage SystemLanguage; 79 80 /// <summary> 81 /// The system region to use in the settings service. 82 /// </summary> 83 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 84 internal readonly RegionCode Region; 85 86 /// <summary> 87 /// Control the initial state of the vertical sync in the SurfaceFlinger service. 88 /// </summary> 89 internal readonly bool EnableVsync; 90 91 /// <summary> 92 /// Control the initial state of the docked mode. 93 /// </summary> 94 internal readonly bool EnableDockedMode; 95 96 /// <summary> 97 /// Control if the Profiled Translation Cache (PTC) should be used. 98 /// </summary> 99 internal readonly bool EnablePtc; 100 101 /// <summary> 102 /// Control if the guest application should be told that there is a Internet connection available. 103 /// </summary> 104 public bool EnableInternetAccess { internal get; set; } 105 106 /// <summary> 107 /// Control LibHac's integrity check level. 108 /// </summary> 109 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 110 internal readonly IntegrityCheckLevel FsIntegrityCheckLevel; 111 112 /// <summary> 113 /// Control LibHac's global access logging level. Value must be between 0 and 3. 114 /// </summary> 115 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 116 internal readonly int FsGlobalAccessLogMode; 117 118 /// <summary> 119 /// The system time offset to apply to the time service steady and local clocks. 120 /// </summary> 121 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 122 internal readonly long SystemTimeOffset; 123 124 /// <summary> 125 /// The system timezone used by the time service. 126 /// </summary> 127 /// <remarks>This cannot be changed after <see cref="Switch"/> instantiation.</remarks> 128 internal readonly string TimeZone; 129 130 /// <summary> 131 /// Type of the memory manager used on CPU emulation. 132 /// </summary> 133 public MemoryManagerMode MemoryManagerMode { internal get; set; } 134 135 /// <summary> 136 /// Control the initial state of the ignore missing services setting. 137 /// If this is set to true, when a missing service is encountered, it will try to automatically handle it instead of throwing an exception. 138 /// </summary> 139 /// TODO: Update this again. 140 public bool IgnoreMissingServices { internal get; set; } 141 142 /// <summary> 143 /// Aspect Ratio applied to the renderer window by the SurfaceFlinger service. 144 /// </summary> 145 public AspectRatio AspectRatio { get; set; } 146 147 /// <summary> 148 /// The audio volume level. 149 /// </summary> 150 public float AudioVolume { get; set; } 151 152 /// <summary> 153 /// Use Hypervisor over JIT if available. 154 /// </summary> 155 internal readonly bool UseHypervisor; 156 157 /// <summary> 158 /// Multiplayer LAN Interface ID (device GUID) 159 /// </summary> 160 public string MultiplayerLanInterfaceId { internal get; set; } 161 162 /// <summary> 163 /// Multiplayer Mode 164 /// </summary> 165 public MultiplayerMode MultiplayerMode { internal get; set; } 166 167 /// <summary> 168 /// An action called when HLE force a refresh of output after docked mode changed. 169 /// </summary> 170 public Action RefreshInputConfig { internal get; set; } 171 172 public HLEConfiguration(VirtualFileSystem virtualFileSystem, 173 LibHacHorizonManager libHacHorizonManager, 174 ContentManager contentManager, 175 AccountManager accountManager, 176 UserChannelPersistence userChannelPersistence, 177 IRenderer gpuRenderer, 178 IHardwareDeviceDriver audioDeviceDriver, 179 MemoryConfiguration memoryConfiguration, 180 IHostUIHandler hostUIHandler, 181 SystemLanguage systemLanguage, 182 RegionCode region, 183 bool enableVsync, 184 bool enableDockedMode, 185 bool enablePtc, 186 bool enableInternetAccess, 187 IntegrityCheckLevel fsIntegrityCheckLevel, 188 int fsGlobalAccessLogMode, 189 long systemTimeOffset, 190 string timeZone, 191 MemoryManagerMode memoryManagerMode, 192 bool ignoreMissingServices, 193 AspectRatio aspectRatio, 194 float audioVolume, 195 bool useHypervisor, 196 string multiplayerLanInterfaceId, 197 MultiplayerMode multiplayerMode) 198 { 199 VirtualFileSystem = virtualFileSystem; 200 LibHacHorizonManager = libHacHorizonManager; 201 AccountManager = accountManager; 202 ContentManager = contentManager; 203 UserChannelPersistence = userChannelPersistence; 204 GpuRenderer = gpuRenderer; 205 AudioDeviceDriver = audioDeviceDriver; 206 MemoryConfiguration = memoryConfiguration; 207 HostUIHandler = hostUIHandler; 208 SystemLanguage = systemLanguage; 209 Region = region; 210 EnableVsync = enableVsync; 211 EnableDockedMode = enableDockedMode; 212 EnablePtc = enablePtc; 213 EnableInternetAccess = enableInternetAccess; 214 FsIntegrityCheckLevel = fsIntegrityCheckLevel; 215 FsGlobalAccessLogMode = fsGlobalAccessLogMode; 216 SystemTimeOffset = systemTimeOffset; 217 TimeZone = timeZone; 218 MemoryManagerMode = memoryManagerMode; 219 IgnoreMissingServices = ignoreMissingServices; 220 AspectRatio = aspectRatio; 221 AudioVolume = audioVolume; 222 UseHypervisor = useHypervisor; 223 MultiplayerLanInterfaceId = multiplayerLanInterfaceId; 224 MultiplayerMode = multiplayerMode; 225 } 226 } 227 }