aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services
diff options
context:
space:
mode:
authorBaronKiko <BaronKiko@users.noreply.github.com>2019-04-16 00:22:55 +0100
committerjduncanator <1518948+jduncanator@users.noreply.github.com>2019-04-16 09:22:55 +1000
commitb2e88b04a85b41cc60af3485d88c90429e84a218 (patch)
tree77368650d0a1adf0fda2dbb61a6fe00e1b7e3f56 /Ryujinx.HLE/HOS/Services
parent233fc95e1e656f3932f57005d24b76fb750e7704 (diff)
Config option to ignore missing services (#658)
* Implemented config option to ignore missing services * Removed unused using statement * Resolved comments from review
Diffstat (limited to 'Ryujinx.HLE/HOS/Services')
-rw-r--r--Ryujinx.HLE/HOS/Services/DummyService.cs20
-rw-r--r--Ryujinx.HLE/HOS/Services/IpcService.cs22
-rw-r--r--Ryujinx.HLE/HOS/Services/ServiceFactory.cs12
3 files changed, 51 insertions, 3 deletions
diff --git a/Ryujinx.HLE/HOS/Services/DummyService.cs b/Ryujinx.HLE/HOS/Services/DummyService.cs
new file mode 100644
index 00000000..28087bdf
--- /dev/null
+++ b/Ryujinx.HLE/HOS/Services/DummyService.cs
@@ -0,0 +1,20 @@
+using Ryujinx.HLE.HOS.Ipc;
+using System.Collections.Generic;
+
+namespace Ryujinx.HLE.HOS.Services
+{
+ class DummyService : IpcService
+ {
+ private Dictionary<int, ServiceProcessRequest> _commands;
+
+ public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
+
+ public string ServiceName { get; set; }
+
+ public DummyService(string serviceName)
+ {
+ _commands = new Dictionary<int, ServiceProcessRequest>();
+ ServiceName = serviceName;
+ }
+ }
+}
diff --git a/Ryujinx.HLE/HOS/Services/IpcService.cs b/Ryujinx.HLE/HOS/Services/IpcService.cs
index 71683ce3..2a4a9319 100644
--- a/Ryujinx.HLE/HOS/Services/IpcService.cs
+++ b/Ryujinx.HLE/HOS/Services/IpcService.cs
@@ -89,13 +89,29 @@ namespace Ryujinx.HLE.HOS.Services
long sfciMagic = context.RequestData.ReadInt64();
int commandId = (int)context.RequestData.ReadInt64();
- if (service.Commands.TryGetValue(commandId, out ServiceProcessRequest processRequest))
+ bool serviceExists = service.Commands.TryGetValue(commandId, out ServiceProcessRequest processRequest);
+
+ if (ServiceConfiguration.IgnoreMissingServices || serviceExists)
{
+ long result = 0;
+
context.ResponseData.BaseStream.Seek(_isDomain ? 0x20 : 0x10, SeekOrigin.Begin);
- Logger.PrintDebug(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Method.Name}");
+ if (serviceExists)
+ {
+ Logger.PrintDebug(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Method.Name}");
- long result = processRequest(context);
+ result = processRequest(context);
+ }
+ else
+ {
+ string serviceName;
+ DummyService dummyService = service as DummyService;
+
+ serviceName = (dummyService == null) ? service.GetType().FullName : dummyService.ServiceName;
+
+ Logger.PrintWarning(LogClass.KernelIpc, $"Missing service {serviceName}: {commandId} ignored");
+ }
if (_isDomain)
{
diff --git a/Ryujinx.HLE/HOS/Services/ServiceFactory.cs b/Ryujinx.HLE/HOS/Services/ServiceFactory.cs
index 83a217a5..113bbe51 100644
--- a/Ryujinx.HLE/HOS/Services/ServiceFactory.cs
+++ b/Ryujinx.HLE/HOS/Services/ServiceFactory.cs
@@ -1,3 +1,4 @@
+using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Services.Acc;
using Ryujinx.HLE.HOS.Services.Am;
using Ryujinx.HLE.HOS.Services.Apm;
@@ -30,6 +31,11 @@ using System;
namespace Ryujinx.HLE.HOS.Services
{
+ public static class ServiceConfiguration
+ {
+ public static bool IgnoreMissingServices { get; set; }
+ }
+
static class ServiceFactory
{
public static IpcService MakeService(Horizon system, string name)
@@ -209,6 +215,12 @@ namespace Ryujinx.HLE.HOS.Services
return new IApplicationRootService();
}
+ if (ServiceConfiguration.IgnoreMissingServices)
+ {
+ Logger.PrintWarning(LogClass.Service, $"Missing service {name} ignored");
+ return new DummyService(name);
+ }
+
throw new NotImplementedException(name);
}
}