From fed1518fb5487e57580d367f5d5c6d3f1b2da987 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 29 Jul 2021 01:15:02 -0700 Subject: [PATCH] cs: fix launching of tio server --- .../libstratosphere/include/stratosphere/scs/scs_shell.hpp | 6 +++++- .../libstratosphere/source/cs/cs_target_io_server.cpp | 2 +- libraries/libstratosphere/source/scs/scs_shell.cpp | 7 +++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libraries/libstratosphere/include/stratosphere/scs/scs_shell.hpp b/libraries/libstratosphere/include/stratosphere/scs/scs_shell.hpp index 07036c781..7ce19c7a3 100644 --- a/libraries/libstratosphere/include/stratosphere/scs/scs_shell.hpp +++ b/libraries/libstratosphere/include/stratosphere/scs/scs_shell.hpp @@ -29,7 +29,11 @@ namespace ams::scs { Result RegisterSocket(s32 socket, u64 id); void UnregisterSocket(s32 socket); - Result LaunchProgram(os::ProcessId *out, ncm::ProgramId program_id, const void *args, size_t args_size, u32 process_flags); + Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, const void *args, size_t args_size, u32 process_flags); + + inline Result LaunchProgram(os::ProcessId *out, ncm::ProgramId program_id, const void *args, size_t args_size, u32 process_flags) { + return LaunchProgram(out, ncm::ProgramLocation::Make(program_id, ncm::StorageId::BuiltInSystem), args, args_size, process_flags); + } Result SubscribeProcessEvent(s32 socket, bool is_register, u64 id); diff --git a/libraries/libstratosphere/source/cs/cs_target_io_server.cpp b/libraries/libstratosphere/source/cs/cs_target_io_server.cpp index 284b8fb04..f33e174d8 100644 --- a/libraries/libstratosphere/source/cs/cs_target_io_server.cpp +++ b/libraries/libstratosphere/source/cs/cs_target_io_server.cpp @@ -20,7 +20,7 @@ namespace ams::cs { void InitializeTargetIoServer() { /* Launch target io server. */ os::ProcessId process_id; - scs::LaunchProgram(std::addressof(process_id), ncm::SystemProgramId::DevServer, nullptr, 0, 0); + scs::LaunchProgram(std::addressof(process_id), ncm::ProgramLocation::Make(ncm::SystemProgramId::DevServer, ncm::StorageId::None), nullptr, 0, 0); } } diff --git a/libraries/libstratosphere/source/scs/scs_shell.cpp b/libraries/libstratosphere/source/scs/scs_shell.cpp index 9b4ac078c..7f1b14d4a 100644 --- a/libraries/libstratosphere/source/scs/scs_shell.cpp +++ b/libraries/libstratosphere/source/scs/scs_shell.cpp @@ -380,15 +380,14 @@ namespace ams::scs { return g_socket_info_manager.Unregister(socket); } - Result LaunchProgram(os::ProcessId *out, ncm::ProgramId program_id, const void *args, size_t args_size, u32 process_flags) { + Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, const void *args, size_t args_size, u32 process_flags) { /* Set up the arguments. */ - PrepareToLaunchProgram(program_id, args, args_size); + PrepareToLaunchProgram(loc.program_id, args, args_size); /* Ensure arguments are managed correctly. */ - ON_SCOPE_EXIT { FlushProgramArgument(program_id); }; + ON_SCOPE_EXIT { FlushProgramArgument(loc.program_id); }; /* Launch the program. */ - const ncm::ProgramLocation loc = ncm::ProgramLocation::Make(program_id, ncm::StorageId::BuiltInSystem); R_TRY(pgl::LaunchProgram(out, loc, process_flags | pm::LaunchFlags_SignalOnExit, 0)); return ResultSuccess();