2018-09-07 17:00:13 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Atmosphère-NX
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-05-05 04:16:40 +02:00
|
|
|
#include <switch.h>
|
|
|
|
#include "pm_registration.hpp"
|
|
|
|
#include "pm_info.hpp"
|
|
|
|
|
|
|
|
Result InformationService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) {
|
|
|
|
Result rc = 0xF601;
|
2018-05-07 12:45:44 +02:00
|
|
|
|
2018-05-05 04:16:40 +02:00
|
|
|
switch ((InformationCmd)cmd_id) {
|
|
|
|
case Information_Cmd_GetTitleId:
|
|
|
|
rc = WrapIpcCommandImpl<&InformationService::get_title_id>(this, r, out_c, pointer_buffer, pointer_buffer_size);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2018-05-07 12:45:44 +02:00
|
|
|
|
2018-05-05 04:16:40 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
Result InformationService::handle_deferred() {
|
|
|
|
/* This service is never deferrable. */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::tuple<Result, u64> InformationService::get_title_id(u64 pid) {
|
2018-07-02 16:10:57 +02:00
|
|
|
auto auto_lock = Registration::GetProcessListUniqueLock();
|
2018-05-05 04:16:40 +02:00
|
|
|
|
2018-06-15 08:47:07 +02:00
|
|
|
std::shared_ptr<Registration::Process> proc = Registration::GetProcess(pid);
|
2018-05-05 04:16:40 +02:00
|
|
|
if (proc != NULL) {
|
|
|
|
return {0x0, proc->tid_sid.title_id};
|
|
|
|
} else {
|
|
|
|
return {0x20F, 0x0};
|
|
|
|
}
|
|
|
|
}
|