2018-04-18 10:57:18 +01:00
|
|
|
#include <switch.h>
|
2018-06-12 23:00:09 +01:00
|
|
|
#include <stratosphere.hpp>
|
2018-04-18 10:57:18 +01:00
|
|
|
#include "ldr_shell.hpp"
|
|
|
|
#include "ldr_launch_queue.hpp"
|
|
|
|
|
2018-04-21 02:34:29 +01:00
|
|
|
Result ShellService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) {
|
2018-04-18 10:57:18 +01:00
|
|
|
|
|
|
|
Result rc = 0xF601;
|
2018-04-19 06:00:10 +01:00
|
|
|
|
2018-04-18 10:57:18 +01:00
|
|
|
switch ((ShellServiceCmd)cmd_id) {
|
2018-04-19 06:15:17 +01:00
|
|
|
case Shell_Cmd_AddTitleToLaunchQueue:
|
2018-04-21 02:34:29 +01:00
|
|
|
rc = WrapIpcCommandImpl<&ShellService::add_title_to_launch_queue>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
2018-04-18 10:57:18 +01:00
|
|
|
break;
|
2018-04-19 06:15:17 +01:00
|
|
|
case Shell_Cmd_ClearLaunchQueue:
|
2018-04-22 04:15:54 +01:00
|
|
|
rc = WrapIpcCommandImpl<&ShellService::clear_launch_queue>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
2018-04-18 10:57:18 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2018-06-25 04:39:05 +01:00
|
|
|
std::tuple<Result> ShellService::add_title_to_launch_queue(u64 args_size, u64 tid, InPointer<char> 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))};
|
2018-04-18 10:57:18 +01:00
|
|
|
}
|
|
|
|
|
2018-04-21 02:34:29 +01:00
|
|
|
std::tuple<Result> ShellService::clear_launch_queue(u64 dat) {
|
|
|
|
fprintf(stderr, "Clear launch queue: %lx\n", dat);
|
2018-04-18 10:57:18 +01:00
|
|
|
LaunchQueue::clear();
|
2018-05-05 19:41:39 +01:00
|
|
|
return {0};
|
|
|
|
}
|