diff --git a/stratosphere/loader/source/ldr_debug_monitor.cpp b/stratosphere/loader/source/ldr_debug_monitor.cpp index 722e19118..f7d838f8f 100644 --- a/stratosphere/loader/source/ldr_debug_monitor.cpp +++ b/stratosphere/loader/source/ldr_debug_monitor.cpp @@ -25,9 +25,9 @@ Result DebugMonitorService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 return rc; } -std::tuple DebugMonitorService::add_title_to_launch_queue(u64 tid, InPointer args) { - fprintf(stderr, "Add to launch queue: %p, %zX\n", args.pointer, args.num_elements); - return {LaunchQueue::add(tid, args.pointer, args.num_elements)}; +std::tuple DebugMonitorService::add_title_to_launch_queue(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))}; } std::tuple DebugMonitorService::clear_launch_queue(u64 dat) { diff --git a/stratosphere/loader/source/ldr_debug_monitor.hpp b/stratosphere/loader/source/ldr_debug_monitor.hpp index 2cc9d1dba..80b4a966c 100644 --- a/stratosphere/loader/source/ldr_debug_monitor.hpp +++ b/stratosphere/loader/source/ldr_debug_monitor.hpp @@ -24,7 +24,7 @@ class DebugMonitorService final : public IServiceObject { private: /* Actual commands. */ - std::tuple add_title_to_launch_queue(u64 tid, InPointer args); + std::tuple add_title_to_launch_queue(u64 args_size, u64 tid, InPointer args); std::tuple clear_launch_queue(u64 dat); std::tuple get_nso_info(u64 pid, OutPointerWithClientSize out); }; diff --git a/stratosphere/loader/source/ldr_nso.cpp b/stratosphere/loader/source/ldr_nso.cpp index cf58656b9..86b696454 100644 --- a/stratosphere/loader/source/ldr_nso.cpp +++ b/stratosphere/loader/source/ldr_nso.cpp @@ -141,6 +141,7 @@ Result NsoUtils::CalculateNsoLoadExtents(u32 addspace_type, u32 args_size, NsoLo /* What the fuck? Where does 0x9007 come from? */ extents->args_size = (2 * args_size + 0x9007); extents->args_size &= ~0xFFFULL; + extents->total_size += extents->args_size; } } } diff --git a/stratosphere/loader/source/ldr_process_creation.cpp b/stratosphere/loader/source/ldr_process_creation.cpp index 03cbefd3e..56ba05af2 100644 --- a/stratosphere/loader/source/ldr_process_creation.cpp +++ b/stratosphere/loader/source/ldr_process_creation.cpp @@ -142,7 +142,7 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc if (R_FAILED(rc)) { goto CREATE_PROCESS_END; } - + /* Figure out where NSOs will be mapped, and how much space they (and arguments) will take up. */ rc = NsoUtils::CalculateNsoLoadExtents(process_info.process_flags, launch_item != NULL ? launch_item->arg_size : 0, &nso_extents); if (R_FAILED(rc)) { diff --git a/stratosphere/loader/source/ldr_shell.cpp b/stratosphere/loader/source/ldr_shell.cpp index d28fecd07..27d3c7e9c 100644 --- a/stratosphere/loader/source/ldr_shell.cpp +++ b/stratosphere/loader/source/ldr_shell.cpp @@ -20,9 +20,9 @@ Result ShellService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id return rc; } -std::tuple ShellService::add_title_to_launch_queue(u64 tid, InPointer args) { - fprintf(stderr, "Add to launch queue: %p, %zX\n", args.pointer, args.num_elements); - return {LaunchQueue::add(tid, args.pointer, args.num_elements)}; +std::tuple ShellService::add_title_to_launch_queue(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))}; } std::tuple ShellService::clear_launch_queue(u64 dat) { diff --git a/stratosphere/loader/source/ldr_shell.hpp b/stratosphere/loader/source/ldr_shell.hpp index 154837405..c4248269f 100644 --- a/stratosphere/loader/source/ldr_shell.hpp +++ b/stratosphere/loader/source/ldr_shell.hpp @@ -21,6 +21,6 @@ class ShellService final : public IServiceObject { private: /* Actual commands. */ - std::tuple add_title_to_launch_queue(u64 tid, InPointer args); + std::tuple add_title_to_launch_queue(u64 args_size, u64 tid, InPointer args); std::tuple clear_launch_queue(u64 dat); };