hle: Some cleanup (#3210)

* hle: Some cleanup

This PR cleaned up a bit the HLE folder and the VirtualFileSystem one, since we use LibHac, we can use some class of it directly instead of duplicate things. The "Content" of VFS folder is removed since it should be handled in the NCM service directly.
A larger cleanup should be done later since there is still be duplicated code here and there.

* Fix Headless.SDL2

* Addresses gdkchan feedback
This commit is contained in:
Ac_K 2022-03-22 20:46:16 +01:00 committed by GitHub
parent ba0171d054
commit e3b36db71c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 192 additions and 373 deletions

View file

@ -13,27 +13,17 @@ namespace Ryujinx.HLE
{
public class Switch : IDisposable
{
public HLEConfiguration Configuration { get; }
public HLEConfiguration Configuration { get; }
public IHardwareDeviceDriver AudioDeviceDriver { get; }
internal MemoryBlock Memory { get; }
public GpuContext Gpu { get; }
public VirtualFileSystem FileSystem => Configuration.VirtualFileSystem;
public Horizon System { get; }
public ApplicationLoader Application { get; }
public PerformanceStatistics Statistics { get; }
public Hid Hid { get; }
public TamperMachine TamperMachine { get; }
public IHostUiHandler UiHandler { get; }
public MemoryBlock Memory { get; }
public GpuContext Gpu { get; }
public VirtualFileSystem FileSystem { get; }
public Horizon System { get; }
public ApplicationLoader Application { get; }
public PerformanceStatistics Statistics { get; }
public Hid Hid { get; }
public TamperMachine TamperMachine { get; }
public IHostUiHandler UiHandler { get; }
public bool EnableDeviceVsync { get; set; } = true;
@ -55,47 +45,27 @@ namespace Ryujinx.HLE
}
Configuration = configuration;
FileSystem = Configuration.VirtualFileSystem;
UiHandler = Configuration.HostUiHandler;
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);
Statistics = new PerformanceStatistics();
Hid = new Hid(this, System.HidStorage);
Application = new ApplicationLoader(this);
TamperMachine = new TamperMachine();
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();
}
private void Initialize()
{
System.State.SetLanguage(Configuration.SystemLanguage);
System.State.SetRegion(Configuration.Region);
EnableDeviceVsync = Configuration.EnableVsync;
System.State.DockedMode = Configuration.EnableDockedMode;
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;
System.EnablePtc = Configuration.EnablePtc;
System.FsIntegrityCheckLevel = Configuration.FsIntegrityCheckLevel;
System.GlobalAccessLogMode = Configuration.FsGlobalAccessLogMode;
}
public void LoadCart(string exeFsDir, string romFsFile = null)
@ -132,7 +102,6 @@ namespace Ryujinx.HLE
{
Gpu.ProcessShaderCacheQueue();
Gpu.Renderer.PreFrame();
Gpu.GPFifo.DispatchCalls();
}
@ -182,9 +151,9 @@ namespace Ryujinx.HLE
{
System.Dispose();
AudioDeviceDriver.Dispose();
FileSystem.Unload();
FileSystem.Dispose();
Memory.Dispose();
}
}
}
}
}