From d16bafc99d792cd120cea194048aa4802c4a67eb Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Fri, 19 Oct 2018 03:41:35 -0400
Subject: [PATCH] ns: Update service function table

Updated based off information provided by Switchbrew.
---
 src/core/hle/service/ns/ns.cpp | 55 ++++++++++++++++++++++++++++++----
 1 file changed, 49 insertions(+), 6 deletions(-)

diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp
index 98017267ca..07c1381feb 100644
--- a/src/core/hle/service/ns/ns.cpp
+++ b/src/core/hle/service/ns/ns.cpp
@@ -93,13 +93,23 @@ public:
             {86, nullptr, "EnableApplicationCrashReport"},
             {87, nullptr, "IsApplicationCrashReportEnabled"},
             {90, nullptr, "BoostSystemMemoryResourceLimit"},
+            {91, nullptr, "Unknown1"},
+            {92, nullptr, "Unknown2"},
+            {93, nullptr, "GetMainApplicationProgramIndex"},
+            {94, nullptr, "LaunchApplication2"},
+            {95, nullptr, "GetApplicationLaunchInfo"},
+            {96, nullptr, "AcquireApplicationLaunchInfo"},
+            {97, nullptr, "GetMainApplicationProgramIndex2"},
+            {98, nullptr, "EnableApplicationAllThreadDumpOnCrash"},
             {100, nullptr, "ResetToFactorySettings"},
             {101, nullptr, "ResetToFactorySettingsWithoutUserSaveData"},
             {102, nullptr, "ResetToFactorySettingsForRefurbishment"},
             {200, nullptr, "CalculateUserSaveDataStatistics"},
             {201, nullptr, "DeleteUserSaveDataAll"},
             {210, nullptr, "DeleteUserSystemSaveData"},
+            {211, nullptr, "DeleteSaveData"},
             {220, nullptr, "UnregisterNetworkServiceAccount"},
+            {221, nullptr, "UnregisterNetworkServiceAccountWithUserSaveDataDeletion"},
             {300, nullptr, "GetApplicationShellEvent"},
             {301, nullptr, "PopApplicationShellEventInfo"},
             {302, nullptr, "LaunchLibraryApplet"},
@@ -114,6 +124,7 @@ public:
             {403, nullptr, "GetMaxApplicationControlCacheCount"},
             {404, nullptr, "InvalidateApplicationControlCache"},
             {405, nullptr, "ListApplicationControlCacheEntryInfo"},
+            {406, nullptr, "GetApplicationControlProperty"},
             {502, nullptr, "RequestCheckGameCardRegistration"},
             {503, nullptr, "RequestGameCardRegistrationGoldPoint"},
             {504, nullptr, "RequestRegisterGameCard"},
@@ -129,6 +140,7 @@ public:
             {604, nullptr, "RegisterContentsExternalKey"},
             {605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"},
             {606, nullptr, "GetContentMetaStorage"},
+            {607, nullptr, "ListAvailableAddOnContent"},
             {700, nullptr, "PushDownloadTaskList"},
             {701, nullptr, "ClearTaskStatusList"},
             {702, nullptr, "RequestDownloadTaskList"},
@@ -148,6 +160,9 @@ public:
             {907, nullptr, "WithdrawApplicationUpdateRequest"},
             {908, nullptr, "ListApplicationRecordInstalledContentMeta"},
             {909, nullptr, "WithdrawCleanupAddOnContentsWithNoRightsRecommendation"},
+            {910, nullptr, "Unknown3"},
+            {911, nullptr, "SetPreInstalledApplication"},
+            {912, nullptr, "ClearPreInstalledApplicationFlag"},
             {1000, nullptr, "RequestVerifyApplicationDeprecated"},
             {1001, nullptr, "CorruptApplicationForDebug"},
             {1002, nullptr, "RequestVerifyAddOnContentsRights"},
@@ -162,6 +177,8 @@ public:
             {1305, nullptr, "TryDeleteRunningApplicationEntity"},
             {1306, nullptr, "TryDeleteRunningApplicationCompletely"},
             {1307, nullptr, "TryDeleteRunningApplicationContentEntities"},
+            {1308, nullptr, "DeleteApplicationCompletelyForDebug"},
+            {1309, nullptr, "CleanupUnavailableAddOnContents"},
             {1400, nullptr, "PrepareShutdown"},
             {1500, nullptr, "FormatSdCard"},
             {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"},
@@ -199,6 +216,28 @@ public:
             {2015, nullptr, "CompareSystemDeliveryInfo"},
             {2016, nullptr, "ListNotCommittedContentMeta"},
             {2017, nullptr, "CreateDownloadTask"},
+            {2018, nullptr, "Unknown4"},
+            {2050, nullptr, "Unknown5"},
+            {2100, nullptr, "Unknown6"},
+            {2101, nullptr, "Unknown7"},
+            {2150, nullptr, "CreateRightsEnvironment"},
+            {2151, nullptr, "DestroyRightsEnvironment"},
+            {2152, nullptr, "ActivateRightsEnvironment"},
+            {2153, nullptr, "DeactivateRightsEnvironment"},
+            {2154, nullptr, "ForceActivateRightsContextForExit"},
+            {2160, nullptr, "AddTargetApplicationToRightsEnvironment"},
+            {2161, nullptr, "SetUsersToRightsEnvironment"},
+            {2170, nullptr, "GetRightsEnvironmentStatus"},
+            {2171, nullptr, "GetRightsEnvironmentStatusChangedEvent"},
+            {2180, nullptr, "RequestExtendRightsInRightsEnvironment"},
+            {2181, nullptr, "GetLastResultOfExtendRightsInRightsEnvironment"},
+            {2182, nullptr, "SetActiveRightsContextUsingStateToRightsEnvironment"},
+            {2190, nullptr, "GetRightsEnvironmentHandleForApplication"},
+            {2199, nullptr, "GetRightsEnvironmentCountForDebug"},
+            {2200, nullptr, "Unknown8"},
+            {2201, nullptr, "Unknown9"},
+            {2250, nullptr, "Unknown10"},
+            {2300, nullptr, "Unknown11"},
         };
         // clang-format on
 
@@ -348,12 +387,15 @@ public:
             {0, nullptr, "LaunchProgram"},
             {1, nullptr, "TerminateProcess"},
             {2, nullptr, "TerminateProgram"},
-            {3, nullptr, "GetShellEventHandle"},
-            {4, nullptr, "GetShellEventInfo"},
-            {5, nullptr, "TerminateApplication"},
-            {6, nullptr, "PrepareLaunchProgramFromHost"},
-            {7, nullptr, "LaunchApplication"},
-            {8, nullptr, "LaunchApplicationWithStorageId"},
+            {4, nullptr, "GetShellEventHandle"},
+            {5, nullptr, "GetShellEventInfo"},
+            {6, nullptr, "TerminateApplication"},
+            {7, nullptr, "PrepareLaunchProgramFromHost"},
+            {8, nullptr, "LaunchApplication"},
+            {9, nullptr, "LaunchApplicationWithStorageId"},
+            {10, nullptr, "TerminateApplication2"},
+            {11, nullptr, "GetRunningApplicationProcessId"},
+            {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActive"},
         };
         // clang-format on
 
@@ -388,6 +430,7 @@ public:
             {19, nullptr, "GetReceivedEulaDataSize"},
             {20, nullptr, "GetReceivedEulaData"},
             {21, nullptr, "SetupToReceiveSystemUpdate"},
+            {22, nullptr, "RequestCheckLatestUpdateIncludesRebootlessUpdate"},
         };
         // clang-format on