aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs220
1 files changed, 105 insertions, 115 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs b/Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs
index dac776f2..329f2888 100644
--- a/Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs
+++ b/Ryujinx.HLE/HOS/Services/Lr/ILocationResolver.cs
@@ -1,8 +1,6 @@
using LibHac.Fs.NcaUtils;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
using System.Text;
using static Ryujinx.HLE.HOS.ErrorCode;
@@ -12,95 +10,89 @@ namespace Ryujinx.HLE.HOS.Services.Lr
{
class ILocationResolver : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
private StorageId _storageId;
public ILocationResolver(StorageId storageId)
{
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, ResolveProgramPath },
- { 1, RedirectProgramPath },
- { 2, ResolveApplicationControlPath },
- { 3, ResolveApplicationHtmlDocumentPath },
- { 4, ResolveDataPath },
- { 5, RedirectApplicationControlPath },
- { 6, RedirectApplicationHtmlDocumentPath },
- { 7, ResolveApplicationLegalInformationPath },
- { 8, RedirectApplicationLegalInformationPath },
- { 9, Refresh },
- { 10, SetProgramNcaPath2 },
- { 11, ClearLocationResolver2 },
- { 12, DeleteProgramNcaPath },
- { 13, DeleteControlNcaPath },
- { 14, DeleteDocHtmlNcaPath },
- { 15, DeleteInfoHtmlNcaPath }
- };
-
_storageId = storageId;
}
- // DeleteInfoHtmlNcaPath()
- public long DeleteInfoHtmlNcaPath(ServiceCtx context)
+ [Command(0)]
+ // ResolveProgramPath()
+ public long ResolveProgramPath(ServiceCtx context)
{
long titleId = context.RequestData.ReadInt64();
- DeleteContentPath(context, titleId, ContentType.Manual);
-
- return 0;
+ if (ResolvePath(context, titleId, ContentType.Program))
+ {
+ return 0;
+ }
+ else
+ {
+ return MakeError(ErrorModule.Lr, LrErr.ProgramLocationEntryNotFound);
+ }
}
- // DeleteDocHtmlNcaPath()
- public long DeleteDocHtmlNcaPath(ServiceCtx context)
+ [Command(1)]
+ // RedirectProgramPath()
+ public long RedirectProgramPath(ServiceCtx context)
{
long titleId = context.RequestData.ReadInt64();
- DeleteContentPath(context, titleId, ContentType.Manual);
+ RedirectPath(context, titleId, 0, ContentType.Program);
return 0;
}
- // DeleteControlNcaPath()
- public long DeleteControlNcaPath(ServiceCtx context)
+ [Command(2)]
+ // ResolveApplicationControlPath()
+ public long ResolveApplicationControlPath(ServiceCtx context)
{
long titleId = context.RequestData.ReadInt64();
- DeleteContentPath(context, titleId, ContentType.Control);
-
- return 0;
+ if (ResolvePath(context, titleId, ContentType.Control))
+ {
+ return 0;
+ }
+ else
+ {
+ return MakeError(ErrorModule.Lr, LrErr.AccessDenied);
+ }
}
- // DeleteProgramNcaPath()
- public long DeleteProgramNcaPath(ServiceCtx context)
+ [Command(3)]
+ // ResolveApplicationHtmlDocumentPath()
+ public long ResolveApplicationHtmlDocumentPath(ServiceCtx context)
{
long titleId = context.RequestData.ReadInt64();
- DeleteContentPath(context, titleId, ContentType.Program);
-
- return 0;
- }
-
- // ClearLocationResolver2()
- public long ClearLocationResolver2(ServiceCtx context)
- {
- context.Device.System.ContentManager.RefreshEntries(_storageId, 1);
-
- return 0;
+ if (ResolvePath(context, titleId, ContentType.Manual))
+ {
+ return 0;
+ }
+ else
+ {
+ return MakeError(ErrorModule.Lr, LrErr.AccessDenied);
+ }
}
- // SetProgramNcaPath2()
- public long SetProgramNcaPath2(ServiceCtx context)
+ [Command(4)]
+ // ResolveDataPath()
+ public long ResolveDataPath(ServiceCtx context)
{
long titleId = context.RequestData.ReadInt64();
- RedirectPath(context, titleId, 1, ContentType.Program);
-
- return 0;
+ if (ResolvePath(context, titleId, ContentType.Data) || ResolvePath(context, titleId, ContentType.PublicData))
+ {
+ return 0;
+ }
+ else
+ {
+ return MakeError(ErrorModule.Lr, LrErr.AccessDenied);
+ }
}
+ [Command(5)]
// RedirectApplicationControlPath()
public long RedirectApplicationControlPath(ServiceCtx context)
{
@@ -111,6 +103,7 @@ namespace Ryujinx.HLE.HOS.Services.Lr
return 0;
}
+ [Command(6)]
// RedirectApplicationHtmlDocumentPath()
public long RedirectApplicationHtmlDocumentPath(ServiceCtx context)
{
@@ -121,6 +114,23 @@ namespace Ryujinx.HLE.HOS.Services.Lr
return 0;
}
+ [Command(7)]
+ // ResolveApplicationLegalInformationPath()
+ public long ResolveApplicationLegalInformationPath(ServiceCtx context)
+ {
+ long titleId = context.RequestData.ReadInt64();
+
+ if (ResolvePath(context, titleId, ContentType.Manual))
+ {
+ return 0;
+ }
+ else
+ {
+ return MakeError(ErrorModule.Lr, LrErr.AccessDenied);
+ }
+ }
+
+ [Command(8)]
// RedirectApplicationLegalInformationPath()
public long RedirectApplicationLegalInformationPath(ServiceCtx context)
{
@@ -131,97 +141,77 @@ namespace Ryujinx.HLE.HOS.Services.Lr
return 0;
}
- // ResolveDataPath()
- public long ResolveDataPath(ServiceCtx context)
+ [Command(9)]
+ // Refresh()
+ public long Refresh(ServiceCtx context)
{
- long titleId = context.RequestData.ReadInt64();
+ context.Device.System.ContentManager.RefreshEntries(_storageId, 1);
- if (ResolvePath(context, titleId, ContentType.Data) || ResolvePath(context, titleId, ContentType.PublicData))
- {
- return 0;
- }
- else
- {
- return MakeError(ErrorModule.Lr, LrErr.AccessDenied);
- }
+ return 0;
}
- // ResolveApplicationHtmlDocumentPath()
- public long ResolveApplicationHtmlDocumentPath(ServiceCtx context)
+ [Command(10)]
+ // SetProgramNcaPath2()
+ public long SetProgramNcaPath2(ServiceCtx context)
{
long titleId = context.RequestData.ReadInt64();
- if (ResolvePath(context, titleId, ContentType.Manual))
- {
- return 0;
- }
- else
- {
- return MakeError(ErrorModule.Lr, LrErr.AccessDenied);
- }
+ RedirectPath(context, titleId, 1, ContentType.Program);
+
+ return 0;
}
- // ResolveApplicationLegalInformationPath()
- public long ResolveApplicationLegalInformationPath(ServiceCtx context)
+ [Command(11)]
+ // ClearLocationResolver2()
+ public long ClearLocationResolver2(ServiceCtx context)
{
- long titleId = context.RequestData.ReadInt64();
+ context.Device.System.ContentManager.RefreshEntries(_storageId, 1);
- if (ResolvePath(context, titleId, ContentType.Manual))
- {
- return 0;
- }
- else
- {
- return MakeError(ErrorModule.Lr, LrErr.AccessDenied);
- }
+ return 0;
}
- // ResolveApplicationControlPath()
- public long ResolveApplicationControlPath(ServiceCtx context)
+ [Command(12)]
+ // DeleteProgramNcaPath()
+ public long DeleteProgramNcaPath(ServiceCtx context)
{
long titleId = context.RequestData.ReadInt64();
- if (ResolvePath(context, titleId, ContentType.Control))
- {
- return 0;
- }
- else
- {
- return MakeError(ErrorModule.Lr, LrErr.AccessDenied);
- }
+ DeleteContentPath(context, titleId, ContentType.Program);
+
+ return 0;
}
- // RedirectProgramPath()
- public long RedirectProgramPath(ServiceCtx context)
+ [Command(13)]
+ // DeleteControlNcaPath()
+ public long DeleteControlNcaPath(ServiceCtx context)
{
long titleId = context.RequestData.ReadInt64();
- RedirectPath(context, titleId, 0, ContentType.Program);
+ DeleteContentPath(context, titleId, ContentType.Control);
return 0;
}
- // Refresh()
- public long Refresh(ServiceCtx context)
+ [Command(14)]
+ // DeleteDocHtmlNcaPath()
+ public long DeleteDocHtmlNcaPath(ServiceCtx context)
{
- context.Device.System.ContentManager.RefreshEntries(_storageId, 1);
+ long titleId = context.RequestData.ReadInt64();
+
+ DeleteContentPath(context, titleId, ContentType.Manual);
return 0;
}
- // ResolveProgramPath()
- public long ResolveProgramPath(ServiceCtx context)
+ [Command(15)]
+ // DeleteInfoHtmlNcaPath()
+ public long DeleteInfoHtmlNcaPath(ServiceCtx context)
{
long titleId = context.RequestData.ReadInt64();
- if (ResolvePath(context, titleId, ContentType.Program))
- {
- return 0;
- }
- else
- {
- return MakeError(ErrorModule.Lr, LrErr.ProgramLocationEntryNotFound);
- }
+ DeleteContentPath(context, titleId, ContentType.Manual);
+
+ return 0;
}
private void RedirectPath(ServiceCtx context, long titleId, int flag, ContentType contentType)