aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-01-04 20:01:44 -0300
committerGitHub <noreply@github.com>2023-01-05 00:01:44 +0100
commitfc4b7cba2c083b3920f2d74e0cb4b08cf7a5a278 (patch)
treebaa5d9a71ee011ecbaeee9a67e037cb399eb7d0e /Ryujinx.HLE/HOS/ArmProcessContextFactory.cs
parent08831eecf77cedd3c4192ebab5a9c485fb15d51e (diff)
Make PPTC state non-static (#4157)1.1.507
* Make PPTC state non-static * DiskCacheLoadState can be null
Diffstat (limited to 'Ryujinx.HLE/HOS/ArmProcessContextFactory.cs')
-rw-r--r--Ryujinx.HLE/HOS/ArmProcessContextFactory.cs33
1 files changed, 30 insertions, 3 deletions
diff --git a/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs b/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs
index 7d1c4e1d..5ecaf38e 100644
--- a/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs
+++ b/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs
@@ -13,11 +13,30 @@ namespace Ryujinx.HLE.HOS
{
private readonly ICpuEngine _cpuEngine;
private readonly GpuContext _gpu;
+ private readonly string _titleIdText;
+ private readonly string _displayVersion;
+ private readonly bool _diskCacheEnabled;
+ private readonly ulong _codeAddress;
+ private readonly ulong _codeSize;
- public ArmProcessContextFactory(ICpuEngine cpuEngine, GpuContext gpu)
+ public IDiskCacheLoadState DiskCacheLoadState { get; private set; }
+
+ public ArmProcessContextFactory(
+ ICpuEngine cpuEngine,
+ GpuContext gpu,
+ string titleIdText,
+ string displayVersion,
+ bool diskCacheEnabled,
+ ulong codeAddress,
+ ulong codeSize)
{
_cpuEngine = cpuEngine;
_gpu = gpu;
+ _titleIdText = titleIdText;
+ _displayVersion = displayVersion;
+ _diskCacheEnabled = diskCacheEnabled;
+ _codeAddress = codeAddress;
+ _codeSize = codeSize;
}
public IProcessContext Create(KernelContext context, ulong pid, ulong addressSpaceSize, InvalidAccessHandler invalidAccessHandler, bool for64Bit)
@@ -29,21 +48,29 @@ namespace Ryujinx.HLE.HOS
mode = MemoryManagerMode.SoftwarePageTable;
}
+ IArmProcessContext processContext;
+
switch (mode)
{
case MemoryManagerMode.SoftwarePageTable:
var memoryManager = new MemoryManager(context.Memory, addressSpaceSize, invalidAccessHandler);
- return new ArmProcessContext<MemoryManager>(pid, _cpuEngine, _gpu, memoryManager, for64Bit);
+ processContext = new ArmProcessContext<MemoryManager>(pid, _cpuEngine, _gpu, memoryManager, for64Bit);
+ break;
case MemoryManagerMode.HostMapped:
case MemoryManagerMode.HostMappedUnsafe:
bool unsafeMode = mode == MemoryManagerMode.HostMappedUnsafe;
var memoryManagerHostMapped = new MemoryManagerHostMapped(context.Memory, addressSpaceSize, unsafeMode, invalidAccessHandler);
- return new ArmProcessContext<MemoryManagerHostMapped>(pid, _cpuEngine, _gpu, memoryManagerHostMapped, for64Bit);
+ processContext = new ArmProcessContext<MemoryManagerHostMapped>(pid, _cpuEngine, _gpu, memoryManagerHostMapped, for64Bit);
+ break;
default:
throw new ArgumentOutOfRangeException();
}
+
+ DiskCacheLoadState = processContext.Initialize(_titleIdText, _displayVersion, _diskCacheEnabled, _codeAddress, _codeSize);
+
+ return processContext;
}
}
}