diff --git a/stratosphere/fs_mitm/source/fsmitm_service.cpp b/stratosphere/fs_mitm/source/fsmitm_service.cpp index 75e575067..a9f1e30a5 100644 --- a/stratosphere/fs_mitm/source/fsmitm_service.cpp +++ b/stratosphere/fs_mitm/source/fsmitm_service.cpp @@ -96,7 +96,7 @@ Result FsMitmService::OpenDataStorageByCurrentProcess(Out> out_storage, u64 sid, u64 data_id) { +Result FsMitmService::OpenDataStorageByDataId(Out> out_storage, u64 data_id, u8 sid) { FsStorageId storage_id = (FsStorageId)sid; FsStorage data_storage; FsFile data_file; diff --git a/stratosphere/fs_mitm/source/fsmitm_service.hpp b/stratosphere/fs_mitm/source/fsmitm_service.hpp index c1bf4e9a8..75dc7b426 100644 --- a/stratosphere/fs_mitm/source/fsmitm_service.hpp +++ b/stratosphere/fs_mitm/source/fsmitm_service.hpp @@ -47,7 +47,7 @@ class FsMitmService : public IMitmServiceObject { protected: /* Overridden commands. */ Result OpenDataStorageByCurrentProcess(Out> out); - Result OpenDataStorageByDataId(Out> out, u64 storage_id, u64 data_id); + Result OpenDataStorageByDataId(Out> out, u64 data_id, u8 storage_id); public: DEFINE_SERVICE_DISPATCH_TABLE { MakeServiceCommandMeta(), diff --git a/stratosphere/libstratosphere/include/stratosphere/ipc/ipc_serialization.hpp b/stratosphere/libstratosphere/include/stratosphere/ipc/ipc_serialization.hpp index 93c894af3..2de8f6dfb 100644 --- a/stratosphere/libstratosphere/include/stratosphere/ipc/ipc_serialization.hpp +++ b/stratosphere/libstratosphere/include/stratosphere/ipc/ipc_serialization.hpp @@ -174,19 +174,83 @@ struct RawSizeElementAdder { }; template -struct GetRawDataSize; +struct RawDataHelper; template -struct GetRawDataSize> { - static constexpr size_t Size() { - if constexpr (sizeof...(Ts) == 0) { - return 0; - } else { - size_t s = 0; - size_t ends[] = { RawSizeElementAdder::GetUpdateElementSize(s)... }; - return (ends[sizeof...(Ts)-1] + 3) & ~3; +struct RawDataHelper> { + /* https://referencesource.microsoft.com/#System.Core/System/Linq/Enumerable.cs,2604 */ + static constexpr void QuickSort(std::array &map, std::array &values, int left, int right) { + do { + int i = left; + int j = right; + int x = map[i + ((j - i) >> 1)]; + do { + while (i < static_cast(sizeof...(Ts)) && values[x] > values[map[i]]) i++; + while (j >= 0 && values[x] < values[map[j]]) j--; + if (i > j) break; + if (i < j) { + const size_t temp = map[i]; + map[i] = map[j]; + map[j] = temp; + } + i++; + j--; + } while (i <= j); + if (j - left <= right - i) { + if (left < j) QuickSort(map, values, left, j); + left = i; + } else { + if (i < right) QuickSort(map, values, i, right); + right = j; + } + } while (left < right); + } + + static constexpr void StableSort(std::array &map, std::array &values) { + /* First, quicksort a copy of the map. */ + std::array map_unstable(map); + QuickSort(map_unstable, values, 0, sizeof...(Ts)-1); + + /* Now, create stable sorted map from unstably quicksorted indices (via repeated insertion sort on element runs). */ + for (size_t i = 0; i < sizeof...(Ts); i++) { + map[i] = map_unstable[i]; + for (ssize_t j = i-1; j >= 0 && values[map[j]] == values[map[j+1]] && map[j] > map[j+1]; j--) { + const size_t temp = map[j]; + map[j] = map[j+1]; + map[j+1] = temp; + } } } + + static constexpr std::array GetOffsets() { + std::array offsets = {}; + offsets[0] = 0; + if constexpr (sizeof...(Ts) > 0) { + /* Get size, alignment for each type. */ + std::array sizes = { RawDataHelper::size... }; + std::array aligns = { RawDataHelper::align... }; + + /* We want to sort...by alignment. */ + std::array map = {}; + for (size_t i = 0; i < sizeof...(Ts); i++) { map[i] = i; } + StableSort(map, aligns); + + /* Iterate over sorted types. */ + size_t cur_offset = 0; + for (size_t i = 0; i < sizeof...(Ts); i++) { + const size_t align = aligns[map[i]]; + if (cur_offset % align != 0) { + cur_offset += align - (cur_offset % align); + } + offsets[map[i]] = cur_offset; + cur_offset += sizes[map[i]]; + } + offsets[sizeof...(Ts)] = cur_offset; + } + return offsets; + } + + static constexpr std::array offsets = GetOffsets(); }; template @@ -236,10 +300,12 @@ struct CommandMetaInfo, _ReturnType> { static_assert(NumInHandles <= 8, "Methods can take in <= 8 Handles!"); static_assert(NumOutHandles + NumOutSessions <= 8, "Methods can only return <= 8 Handles+Sessions!"); - static constexpr size_t InRawArgSize = GetRawDataSize::Size(); + static constexpr std::array InDataOffsets = RawDataHelper::offsets; + static constexpr size_t InRawArgSize = InDataOffsets[NumInDatas]; static constexpr size_t InRawArgSizeWithOutPointers = ((InRawArgSize + NumClientSizeOutPointers * sizeof(u16)) + 3) & ~3; - static constexpr size_t OutRawArgSize = GetRawDataSize::Size(); + static constexpr std::array OutDataOffsets = RawDataHelper::offsets; + static constexpr size_t OutRawArgSize = OutDataOffsets[NumOutDatas]; }; @@ -335,10 +401,11 @@ struct Validator { /* ================================================================================= */ /* Decoder. */ +template struct Decoder { template - static constexpr T DecodeCommandArgument(IpcResponseContext *ctx, size_t& a_index, size_t& b_index, size_t& x_index, size_t& c_index, size_t& in_h_index, size_t& out_h_index, size_t& out_obj_index, size_t& in_rd_offset, size_t& out_rd_offset, size_t& pb_offset, size_t& c_sz_offset) { + static constexpr T DecodeCommandArgument(IpcResponseContext *ctx, size_t& a_index, size_t& b_index, size_t& x_index, size_t& c_index, size_t& in_h_index, size_t& out_h_index, size_t& out_obj_index, size_t& in_data_index, size_t& out_data_index, size_t& pb_offset, size_t& c_sz_offset) { constexpr ArgType argT = GetArgType(); if constexpr (argT == ArgType::InBuffer) { const T& value = T(ctx->request.Buffers[a_index], ctx->request.BufferSizes[a_index], ctx->request.BufferTypes[a_index]); @@ -357,36 +424,18 @@ struct Decoder { } else if constexpr (argT == ArgType::OutHandle) { return T(&ctx->out_handles[out_h_index++]); } else if constexpr (argT == ArgType::PidDesc) { - constexpr size_t t_align = RawDataHelper::align; - constexpr size_t t_size = RawDataHelper::size; - if (in_rd_offset % t_align) { - in_rd_offset += (t_align - (in_rd_offset % t_align)); - } - uintptr_t ptr = ((uintptr_t)ctx->request.Raw + 0x10 + in_rd_offset); - in_rd_offset += t_size; + uintptr_t ptr = ((uintptr_t)ctx->request.Raw + 0x10 + MetaInfo::InDataOffsets[in_data_index++]); *(u64 *)ptr = ctx->request.Pid; return T(ctx->request.Pid); } else if constexpr (argT == ArgType::InData) { - constexpr size_t t_align = RawDataHelper::align; - constexpr size_t t_size = RawDataHelper::size; - if (in_rd_offset % t_align) { - in_rd_offset += (t_align - (in_rd_offset % t_align)); - } - uintptr_t ptr = ((uintptr_t)ctx->request.Raw + 0x10 + in_rd_offset); - in_rd_offset += t_size; + uintptr_t ptr = ((uintptr_t)ctx->request.Raw + 0x10 + MetaInfo::InDataOffsets[in_data_index++]); if constexpr (std::is_same_v) { return *((u8 *)ptr) & 1; } else { return *((T *)ptr); } } else if constexpr (argT == ArgType::OutData) { - constexpr size_t t_align = RawDataHelper::align; - constexpr size_t t_size = RawDataHelper::size; - if (out_rd_offset % t_align) { - out_rd_offset += (t_align - (out_rd_offset % t_align)); - } - uintptr_t ptr = ((uintptr_t)ctx->out_data + out_rd_offset); - out_rd_offset += t_size; + uintptr_t ptr = ((uintptr_t)ctx->out_data + MetaInfo::OutDataOffsets[out_data_index++]); return T(reinterpret_cast::type *>(ptr)); } else if constexpr (argT == ArgType::OutPointerClientSize || argT == ArgType::OutPointerServerSize) { u16 sz; @@ -418,21 +467,20 @@ struct Decoder { template struct DecodeTuple> { - static constexpr std::tuple GetArgs(IpcResponseContext *ctx, size_t& a_index, size_t& b_index, size_t& x_index, size_t& c_index, size_t& in_h_index, size_t& out_h_index, size_t& out_obj_index, size_t& in_rd_offset, size_t& out_rd_offset, size_t& pb_offset, size_t& c_sz_offset) { + static constexpr std::tuple GetArgs(IpcResponseContext *ctx, size_t& a_index, size_t& b_index, size_t& x_index, size_t& c_index, size_t& in_h_index, size_t& out_h_index, size_t& out_obj_index, size_t& in_data_index, size_t& out_data_index, size_t& pb_offset, size_t& c_sz_offset) { return std::tuple { - DecodeCommandArgument(ctx, a_index, b_index, x_index, c_index, in_h_index, out_h_index, out_obj_index, in_rd_offset, out_rd_offset, pb_offset, c_sz_offset) + DecodeCommandArgument(ctx, a_index, b_index, x_index, c_index, in_h_index, out_h_index, out_obj_index, in_data_index, out_data_index, pb_offset, c_sz_offset) ... }; } }; - template static constexpr typename MetaInfo::Args Decode(IpcResponseContext *ctx) { size_t a_index = 0, b_index = MetaInfo::NumInBuffers, x_index = 0, c_index = 0, in_h_index = 0, out_h_index = 0, out_obj_index = 0; - size_t in_rd_offset = 0x0, out_rd_offset = 0, pb_offset = 0; + size_t in_data_index = 0x0, out_data_index = 0, pb_offset = 0; size_t c_sz_offset = MetaInfo::InRawArgSize + (0x10 - ((uintptr_t)ctx->request.Raw - (uintptr_t)ctx->request.RawWithoutPadding)); - return DecodeTuple::GetArgs(ctx, a_index, b_index, x_index, c_index, in_h_index, out_h_index, out_obj_index, in_rd_offset, out_rd_offset, pb_offset, c_sz_offset); + return DecodeTuple::GetArgs(ctx, a_index, b_index, x_index, c_index, in_h_index, out_h_index, out_obj_index, in_data_index, out_data_index, pb_offset, c_sz_offset); } }; @@ -594,7 +642,7 @@ constexpr Result WrapIpcCommandImpl(IpcResponseContext *ctx) { }; if (R_SUCCEEDED(rc)) { - auto args = Decoder::Decode(ctx); + auto args = Decoder::Decode(ctx); if constexpr (CommandMetaData::ReturnsResult) { rc = std::apply( [=](auto&&... args) { return (this_ptr->*IpcCommandImpl)(args...); }, args); diff --git a/stratosphere/loader/source/ldr_debug_monitor.cpp b/stratosphere/loader/source/ldr_debug_monitor.cpp index 01fd0497b..d7dd77489 100644 --- a/stratosphere/loader/source/ldr_debug_monitor.cpp +++ b/stratosphere/loader/source/ldr_debug_monitor.cpp @@ -22,9 +22,9 @@ #include "ldr_launch_queue.hpp" #include "ldr_registration.hpp" -Result DebugMonitorService::AddTitleToLaunchQueue(u64 args_size, u64 tid, InPointer args) { - fprintf(stderr, "Add to launch queue: %p, %zX\n", args.pointer, std::min(args_size, args.num_elements)); - return LaunchQueue::Add(tid, args.pointer, std::min(args_size, args.num_elements)); +Result DebugMonitorService::AddTitleToLaunchQueue(u64 tid, InPointer args, u32 args_size) { + if (args.num_elements < args_size) args_size = args.num_elements; + return LaunchQueue::Add(tid, args.pointer, args_size); } void DebugMonitorService::ClearLaunchQueue() { diff --git a/stratosphere/loader/source/ldr_debug_monitor.hpp b/stratosphere/loader/source/ldr_debug_monitor.hpp index 167b2872f..fa466706d 100644 --- a/stratosphere/loader/source/ldr_debug_monitor.hpp +++ b/stratosphere/loader/source/ldr_debug_monitor.hpp @@ -29,7 +29,7 @@ enum DebugMonitorServiceCmd { class DebugMonitorService final : public IServiceObject { private: /* Actual commands. */ - Result AddTitleToLaunchQueue(u64 args_size, u64 tid, InPointer args); + Result AddTitleToLaunchQueue(u64 tid, InPointer args, u32 args_size); void ClearLaunchQueue(); Result GetNsoInfo(Out count, OutPointerWithClientSize out, u64 pid); public: diff --git a/stratosphere/loader/source/ldr_process_manager.cpp b/stratosphere/loader/source/ldr_process_manager.cpp index 3f50cf8a2..b1cae6ac4 100644 --- a/stratosphere/loader/source/ldr_process_manager.cpp +++ b/stratosphere/loader/source/ldr_process_manager.cpp @@ -22,13 +22,13 @@ #include "ldr_content_management.hpp" #include "ldr_npdm.hpp" -Result ProcessManagerService::CreateProcess(Out proc_h, u64 flags, u64 index, CopiedHandle reslimit_h) { +Result ProcessManagerService::CreateProcess(Out proc_h, u64 index, u32 flags, CopiedHandle reslimit_h) { Result rc; Registration::TidSid tid_sid; LaunchQueue::LaunchItem *launch_item; char nca_path[FS_MAX_PATH] = {0}; - fprintf(stderr, "CreateProcess(%016lx, %016lx, %08x);\n", flags, index, reslimit_h.handle); + fprintf(stderr, "CreateProcess(%016lx, %08x, %08x);\n", index, flags, reslimit_h.handle); rc = Registration::GetRegisteredTidSid(index, &tid_sid); if (R_FAILED(rc)) { @@ -54,7 +54,7 @@ Result ProcessManagerService::CreateProcess(Out proc_h, u64 flags, return rc; } -Result ProcessManagerService::GetProgramInfo(Registration::TidSid tid_sid, OutPointerWithServerSize out_program_info) { +Result ProcessManagerService::GetProgramInfo(OutPointerWithServerSize out_program_info, Registration::TidSid tid_sid) { Result rc; char nca_path[FS_MAX_PATH] = {0}; /* Zero output. */ diff --git a/stratosphere/loader/source/ldr_process_manager.hpp b/stratosphere/loader/source/ldr_process_manager.hpp index 65c68b3e3..7cb4bc85e 100644 --- a/stratosphere/loader/source/ldr_process_manager.hpp +++ b/stratosphere/loader/source/ldr_process_manager.hpp @@ -45,8 +45,8 @@ class ProcessManagerService final : public IServiceObject { static_assert(sizeof(ProcessManagerService::ProgramInfo) == 0x400, "Incorrect ProgramInfo definition."); private: /* Actual commands. */ - Result CreateProcess(Out proc_h, u64 flags, u64 index, CopiedHandle reslimit_h); - Result GetProgramInfo(Registration::TidSid tid_sid, OutPointerWithServerSize out_program_info); + Result CreateProcess(Out proc_h, u64 index, u32 flags, CopiedHandle reslimit_h); + Result GetProgramInfo(OutPointerWithServerSize out_program_info, Registration::TidSid tid_sid); Result RegisterTitle(Out index, Registration::TidSid tid_sid); Result UnregisterTitle(u64 index); diff --git a/stratosphere/loader/source/ldr_shell.cpp b/stratosphere/loader/source/ldr_shell.cpp index 1a7c913eb..4574c5af4 100644 --- a/stratosphere/loader/source/ldr_shell.cpp +++ b/stratosphere/loader/source/ldr_shell.cpp @@ -20,9 +20,9 @@ #include "ldr_launch_queue.hpp" #include "ldr_content_management.hpp" -Result ShellService::AddTitleToLaunchQueue(u64 args_size, u64 tid, InPointer args) { - fprintf(stderr, "Add to launch queue: %p, %zX\n", args.pointer, std::min(args_size, args.num_elements)); - return LaunchQueue::Add(tid, args.pointer, std::min(args_size, args.num_elements)); +Result ShellService::AddTitleToLaunchQueue(u64 tid, InPointer args, u32 args_size) { + if (args.num_elements < args_size) args_size = args.num_elements; + return LaunchQueue::Add(tid, args.pointer, args_size); } void ShellService::ClearLaunchQueue() { diff --git a/stratosphere/loader/source/ldr_shell.hpp b/stratosphere/loader/source/ldr_shell.hpp index 1094a9e08..69d6f2107 100644 --- a/stratosphere/loader/source/ldr_shell.hpp +++ b/stratosphere/loader/source/ldr_shell.hpp @@ -28,7 +28,7 @@ enum ShellServiceCmd { class ShellService final : public IServiceObject { private: /* Actual commands. */ - Result AddTitleToLaunchQueue(u64 args_size, u64 tid, InPointer args); + Result AddTitleToLaunchQueue(u64 tid, InPointer args, u32 args_size); void ClearLaunchQueue(); /* Atmosphere commands. */ diff --git a/stratosphere/pm/source/pm_boot_mode.cpp b/stratosphere/pm/source/pm_boot_mode.cpp index 7268660cc..b8158acf9 100644 --- a/stratosphere/pm/source/pm_boot_mode.cpp +++ b/stratosphere/pm/source/pm_boot_mode.cpp @@ -20,7 +20,7 @@ static bool g_is_maintenance_boot = false; -void BootModeService::GetBootMode(Out out) { +void BootModeService::GetBootMode(Out out) { out.SetValue(g_is_maintenance_boot); } diff --git a/stratosphere/pm/source/pm_boot_mode.hpp b/stratosphere/pm/source/pm_boot_mode.hpp index 96572797f..1aadf8c42 100644 --- a/stratosphere/pm/source/pm_boot_mode.hpp +++ b/stratosphere/pm/source/pm_boot_mode.hpp @@ -26,7 +26,7 @@ enum BootModeCmd { class BootModeService final : public IServiceObject { private: /* Actual commands. */ - void GetBootMode(Out out); + void GetBootMode(Out out); void SetMaintenanceBoot(); public: DEFINE_SERVICE_DISPATCH_TABLE { diff --git a/stratosphere/pm/source/pm_shell.cpp b/stratosphere/pm/source/pm_shell.cpp index aa03b0c68..a1e6dbd12 100644 --- a/stratosphere/pm/source/pm_shell.cpp +++ b/stratosphere/pm/source/pm_shell.cpp @@ -23,7 +23,7 @@ static bool g_has_boot_finished = false; -Result ShellService::LaunchProcess(Out pid, u64 launch_flags, Registration::TidSid tid_sid) { +Result ShellService::LaunchProcess(Out pid, Registration::TidSid tid_sid, u32 launch_flags) { return Registration::LaunchProcessByTidSid(tid_sid, launch_flags, pid.GetPointer()); } diff --git a/stratosphere/pm/source/pm_shell.hpp b/stratosphere/pm/source/pm_shell.hpp index b488107fd..cd707a510 100644 --- a/stratosphere/pm/source/pm_shell.hpp +++ b/stratosphere/pm/source/pm_shell.hpp @@ -49,7 +49,7 @@ enum ShellCmd_5X { class ShellService final : public IServiceObject { private: /* Actual commands. */ - Result LaunchProcess(Out pid, u64 launch_flags, Registration::TidSid tid_sid); + Result LaunchProcess(Out pid, Registration::TidSid tid_sid, u32 launch_flags); Result TerminateProcessId(u64 pid); Result TerminateTitleId(u64 tid); void GetProcessWaitEvent(Out event); diff --git a/stratosphere/sm/source/sm_types.hpp b/stratosphere/sm/source/sm_types.hpp new file mode 100644 index 000000000..6ac9bce92 --- /dev/null +++ b/stratosphere/sm/source/sm_types.hpp @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2018 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +struct SmServiceName { + char name[sizeof(u64)]; +}; + +static_assert(__alignof__(SmServiceName) == 1, "SmServiceName definition!"); \ No newline at end of file diff --git a/stratosphere/sm/source/sm_user_service.cpp b/stratosphere/sm/source/sm_user_service.cpp index 40079ec15..138ceac8c 100644 --- a/stratosphere/sm/source/sm_user_service.cpp +++ b/stratosphere/sm/source/sm_user_service.cpp @@ -25,17 +25,17 @@ Result UserService::Initialize(PidDescriptor pid) { return 0; } -Result UserService::GetService(Out out_h, u64 service) { +Result UserService::GetService(Out out_h, SmServiceName service) { Handle session_h = 0; Result rc = 0x415; #ifdef SM_ENABLE_SMHAX if (!this->has_initialized) { - rc = Registration::GetServiceForPid(Registration::GetInitialProcessId(), service, &session_h); + rc = Registration::GetServiceForPid(Registration::GetInitialProcessId(), smEncodeName(service.name), &session_h); } #endif if (this->has_initialized) { - rc = Registration::GetServiceForPid(this->pid, service, &session_h); + rc = Registration::GetServiceForPid(this->pid, smEncodeName(service.name), &session_h); } if (R_SUCCEEDED(rc)) { @@ -44,16 +44,16 @@ Result UserService::GetService(Out out_h, u64 service) { return rc; } -Result UserService::RegisterService(Out out_h, u64 service, u8 is_light, u32 max_sessions) { +Result UserService::RegisterService(Out out_h, SmServiceName service, u32 max_sessions, bool is_light) { Handle service_h = 0; Result rc = 0x415; #ifdef SM_ENABLE_SMHAX if (!this->has_initialized) { - rc = Registration::RegisterServiceForPid(Registration::GetInitialProcessId(), service, max_sessions, (is_light & 1) != 0, &service_h); + rc = Registration::RegisterServiceForPid(Registration::GetInitialProcessId(), smEncodeName(service.name), max_sessions, (is_light & 1) != 0, &service_h); } #endif if (this->has_initialized) { - rc = Registration::RegisterServiceForPid(this->pid, service, max_sessions, (is_light & 1) != 0, &service_h); + rc = Registration::RegisterServiceForPid(this->pid, smEncodeName(service.name), max_sessions, (is_light & 1) != 0, &service_h); } if (R_SUCCEEDED(rc)) { @@ -62,25 +62,25 @@ Result UserService::RegisterService(Out out_h, u64 service, u8 is_l return rc; } -Result UserService::UnregisterService(u64 service) { +Result UserService::UnregisterService(SmServiceName service) { Result rc = 0x415; #ifdef SM_ENABLE_SMHAX if (!this->has_initialized) { - rc = Registration::UnregisterServiceForPid(Registration::GetInitialProcessId(), service); + rc = Registration::UnregisterServiceForPid(Registration::GetInitialProcessId(), smEncodeName(service.name)); } #endif if (this->has_initialized) { - rc = Registration::UnregisterServiceForPid(this->pid, service); + rc = Registration::UnregisterServiceForPid(this->pid, smEncodeName(service.name)); } return rc; } -Result UserService::AtmosphereInstallMitm(Out srv_h, Out qry_h, u64 service) { +Result UserService::AtmosphereInstallMitm(Out srv_h, Out qry_h, SmServiceName service) { Handle service_h = 0; Handle query_h = 0; Result rc = 0x415; if (this->has_initialized) { - rc = Registration::InstallMitmForPid(this->pid, service, &service_h, &query_h); + rc = Registration::InstallMitmForPid(this->pid, smEncodeName(service.name), &service_h, &query_h); } if (R_SUCCEEDED(rc)) { @@ -90,10 +90,10 @@ Result UserService::AtmosphereInstallMitm(Out srv_h, Outhas_initialized) { - rc = Registration::UninstallMitmForPid(this->pid, service); + rc = Registration::UninstallMitmForPid(this->pid, smEncodeName(service.name)); } return rc; } diff --git a/stratosphere/sm/source/sm_user_service.hpp b/stratosphere/sm/source/sm_user_service.hpp index 206b4f771..f99f65bc2 100644 --- a/stratosphere/sm/source/sm_user_service.hpp +++ b/stratosphere/sm/source/sm_user_service.hpp @@ -17,6 +17,7 @@ #pragma once #include #include +#include "sm_types.hpp" enum UserServiceCmd { User_Cmd_Initialize = 0, @@ -36,13 +37,13 @@ class UserService final : public IServiceObject { /* Actual commands. */ virtual Result Initialize(PidDescriptor pid); - virtual Result GetService(Out out_h, u64 service); - virtual Result RegisterService(Out out_h, u64 service, u8 is_light, u32 max_sessions); - virtual Result UnregisterService(u64 service); + virtual Result GetService(Out out_h, SmServiceName service); + virtual Result RegisterService(Out out_h, SmServiceName service, u32 max_sessions, bool is_light); + virtual Result UnregisterService(SmServiceName service); /* Atmosphere commands. */ - virtual Result AtmosphereInstallMitm(Out srv_h, Out qry_h, u64 service); - virtual Result AtmosphereUninstallMitm(u64 service); + virtual Result AtmosphereInstallMitm(Out srv_h, Out qry_h, SmServiceName service); + virtual Result AtmosphereUninstallMitm(SmServiceName service); virtual Result AtmosphereAssociatePidTidForMitm(u64 pid, u64 tid); public: DEFINE_SERVICE_DISPATCH_TABLE {