mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-14 23:24:26 -04:00
Stratosphere: Add WrapIpcCommandImpl templating.
This commit is contained in:
parent
b5d3ce04e8
commit
7a2cfa4d60
80 changed files with 6694 additions and 162 deletions
|
@ -3,43 +3,22 @@
|
|||
#include "ldr_registration.hpp"
|
||||
#include "ldr_launch_queue.hpp"
|
||||
|
||||
Result ProcessManagerService::dispatch(IpcParsedCommand *r, IpcCommand *out_c, u32 *cmd_buf, u32 cmd_id, u32 *in_rawdata, u32 in_rawdata_size, u32 *out_rawdata, u32 *out_raw_data_count) {
|
||||
Result ProcessManagerService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) {
|
||||
|
||||
Result rc = 0xF601;
|
||||
|
||||
switch ((ProcessManagerServiceCmd)cmd_id) {
|
||||
case Pm_Cmd_CreateProcess:
|
||||
/* TODO */
|
||||
rc = WrapIpcCommandImpl<&ProcessManagerService::create_process>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
case Pm_Cmd_GetProgramInfo:
|
||||
/* TODO */
|
||||
rc = WrapIpcCommandImpl<&ProcessManagerService::get_program_info>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
case Pm_Cmd_RegisterTitle:
|
||||
/* Validate arguments. */
|
||||
if (in_rawdata_size < 0x10 || r->HasPid || r->NumHandles != 0 || r->NumBuffers != 0 || r->NumStatics != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
u64 out_index;
|
||||
rc = register_title((Registration::TidSid *)in_rawdata, &out_index);
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
((u64 *)out_rawdata)[0] = out_index;
|
||||
*out_raw_data_count = 2;
|
||||
} else {
|
||||
((u64 *)out_rawdata)[0] = 0;
|
||||
*out_raw_data_count = 0;
|
||||
}
|
||||
|
||||
case Pm_Cmd_RegisterTitle:
|
||||
rc = WrapIpcCommandImpl<&ProcessManagerService::register_title>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
case Pm_Cmd_UnregisterTitle:
|
||||
/* Validate arguments. */
|
||||
if (in_rawdata_size < 0x8 || r->HasPid || r->NumHandles != 0 || r->NumBuffers != 0 || r->NumStatics != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
rc = unregister_title(((u64 *)in_rawdata)[0]);
|
||||
*out_raw_data_count = 0;
|
||||
|
||||
rc = WrapIpcCommandImpl<&ProcessManagerService::unregister_title>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -47,28 +26,29 @@ Result ProcessManagerService::dispatch(IpcParsedCommand *r, IpcCommand *out_c, u
|
|||
return rc;
|
||||
}
|
||||
|
||||
Result ProcessManagerService::create_process() {
|
||||
std::tuple<Result> ProcessManagerService::create_process() {
|
||||
/* TODO */
|
||||
return 0xF601;
|
||||
return std::make_tuple(0xF601);
|
||||
}
|
||||
|
||||
Result ProcessManagerService::get_program_info() {
|
||||
std::tuple<Result> ProcessManagerService::get_program_info() {
|
||||
/* TODO */
|
||||
return 0xF601;
|
||||
return std::make_tuple(0xF601);
|
||||
}
|
||||
|
||||
Result ProcessManagerService::register_title(const Registration::TidSid *tid_sid, u64 *out_index) {
|
||||
if (Registration::register_tid_sid(tid_sid, out_index)) {
|
||||
return 0;
|
||||
std::tuple<Result, u64> ProcessManagerService::register_title(Registration::TidSid tid_sid) {
|
||||
u64 out_index = 0;
|
||||
if (Registration::register_tid_sid(&tid_sid, &out_index)) {
|
||||
return std::make_tuple(0, out_index);
|
||||
} else {
|
||||
return 0xE09;
|
||||
return std::make_tuple(0xE09, out_index);
|
||||
}
|
||||
}
|
||||
|
||||
Result ProcessManagerService::unregister_title(u64 index) {
|
||||
std::tuple<Result> ProcessManagerService::unregister_title(u64 index) {
|
||||
if (Registration::unregister_index(index)) {
|
||||
return 0;
|
||||
return std::make_tuple(0);
|
||||
} else {
|
||||
return 0x1009;
|
||||
return std::make_tuple(0x1009);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue