diff --git a/stratosphere/loader/source/ldr_debug_monitor.cpp b/stratosphere/loader/source/ldr_debug_monitor.cpp index 722e191..f7d838f 100644 --- a/stratosphere/loader/source/ldr_debug_monitor.cpp +++ b/stratosphere/loader/source/ldr_debug_monitor.cpp @@ -25,9 +25,9 @@ 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 2cc9d1d..80b4a96 100644 --- a/stratosphere/loader/source/ldr_debug_monitor.hpp +++ b/stratosphere/loader/source/ldr_debug_monitor.hpp @@ -24,7 +24,7 @@ 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 cf58656..86b6964 100644 --- a/stratosphere/loader/source/ldr_nso.cpp +++ b/stratosphere/loader/source/ldr_nso.cpp @@ -141,6 +141,7 @@ /* 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 03cbefd..56ba05a 100644 --- a/stratosphere/loader/source/ldr_process_creation.cpp +++ b/stratosphere/loader/source/ldr_process_creation.cpp @@ -142,7 +142,7 @@ 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 d28fecd..27d3c7e 100644 --- a/stratosphere/loader/source/ldr_shell.cpp +++ b/stratosphere/loader/source/ldr_shell.cpp @@ -20,9 +20,9 @@ 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 1548374..c424826 100644 --- a/stratosphere/loader/source/ldr_shell.hpp +++ b/stratosphere/loader/source/ldr_shell.hpp @@ -21,6 +21,6 @@ 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); };