aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs
diff options
context:
space:
mode:
authorThomas Guillemard <thog@protonmail.com>2019-02-14 01:44:39 +0100
committerjduncanator <1518948+jduncanator@users.noreply.github.com>2019-02-14 11:44:39 +1100
commitb126ea48c63a3de8da8f3b817860c0323f2621ef (patch)
treeeb58d7b31719050da390e2b79824d6e931b85da8 /Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs
parent7e9f5555747315d142e1ae20266cb581647db0cd (diff)
Support HomeBrew Loader (#577)
* Make it possibles to load hb-loader and hb-menu One issue remains with hb-menu homebrew icons because of SIMD issues (libjpeg-turbo related) and netloader doesn't work. * Implement GetApplicationControlData * Fix shared fonts for NSO/NRO * Add homebrew NRO romfs support This readd the NRO support by parsing the ASET header * Address comments about HomebrewRomFs * override Dispose in homebrew romfs stream * Use a struct for file timestamp * Simplify positional increments in GetApplicationControlData * Address comments * improve readability of the memory permission check in SetProcessMemoryPermission * Fix previous broken check * Add address space checks in SetProcessMemoryPermission
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs37
1 files changed, 34 insertions, 3 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs
index 6940bfc8..914862f1 100644
--- a/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs
+++ b/Ryujinx.HLE/HOS/Services/Sm/IUserInterface.cs
@@ -23,9 +23,10 @@ namespace Ryujinx.HLE.HOS.Services.Sm
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
- { 0, Initialize },
- { 1, GetService },
- { 2, RegisterService }
+ { 0, Initialize },
+ { 1, GetService },
+ { 2, RegisterService },
+ { 3, UnregisterService }
};
_registeredServices = new ConcurrentDictionary<string, KPort>();
@@ -128,6 +129,36 @@ namespace Ryujinx.HLE.HOS.Services.Sm
return 0;
}
+ public long UnregisterService(ServiceCtx context)
+ {
+ if (!_isInitialized)
+ {
+ return ErrorCode.MakeError(ErrorModule.Sm, SmErr.NotInitialized);
+ }
+
+ long namePosition = context.RequestData.BaseStream.Position;
+
+ string name = ReadName(context);
+
+ context.RequestData.BaseStream.Seek(namePosition + 8, SeekOrigin.Begin);
+
+ bool isLight = (context.RequestData.ReadInt32() & 1) != 0;
+
+ int maxSessions = context.RequestData.ReadInt32();
+
+ if (name == string.Empty)
+ {
+ return ErrorCode.MakeError(ErrorModule.Sm, SmErr.InvalidName);
+ }
+
+ if (!_registeredServices.TryRemove(name, out _))
+ {
+ return ErrorCode.MakeError(ErrorModule.Sm, SmErr.NotRegistered);
+ }
+
+ return 0;
+ }
+
private static string ReadName(ServiceCtx context)
{
string name = string.Empty;