2019-04-21 02:37:01 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2019 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/>.
|
|
|
|
*/
|
2019-06-20 21:00:32 +01:00
|
|
|
|
2019-04-21 02:37:01 +01:00
|
|
|
#pragma once
|
|
|
|
#include <stratosphere.hpp>
|
|
|
|
|
2019-10-24 10:30:10 +01:00
|
|
|
namespace ams::ro {
|
2019-04-21 10:09:08 +01:00
|
|
|
|
2019-06-24 10:05:51 +01:00
|
|
|
/* Access utilities. */
|
|
|
|
void SetDevelopmentHardware(bool is_development_hardware);
|
|
|
|
void SetDevelopmentFunctionEnabled(bool is_development_function_enabled);
|
2019-04-21 02:37:01 +01:00
|
|
|
|
2019-10-11 07:49:28 +01:00
|
|
|
class Service final : public sf::IServiceObject {
|
2019-06-24 10:05:51 +01:00
|
|
|
protected:
|
|
|
|
enum class CommandId {
|
|
|
|
LoadNro = 0,
|
|
|
|
UnloadNro = 1,
|
|
|
|
LoadNrr = 2,
|
|
|
|
UnloadNrr = 3,
|
|
|
|
Initialize = 4,
|
|
|
|
LoadNrrEx = 10,
|
|
|
|
};
|
|
|
|
private:
|
|
|
|
size_t context_id;
|
|
|
|
ModuleType type;
|
|
|
|
public:
|
|
|
|
explicit Service(ModuleType t);
|
2019-10-11 07:49:28 +01:00
|
|
|
virtual ~Service();
|
2019-06-24 10:05:51 +01:00
|
|
|
private:
|
|
|
|
/* Actual commands. */
|
2019-10-11 07:49:28 +01:00
|
|
|
Result LoadNro(sf::Out<u64> out_load_address, const sf::ClientProcessId &client_pid, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size);
|
|
|
|
Result UnloadNro(const sf::ClientProcessId &client_pid, u64 nro_address);
|
|
|
|
Result LoadNrr(const sf::ClientProcessId &client_pid, u64 nrr_address, u64 nrr_size);
|
|
|
|
Result UnloadNrr(const sf::ClientProcessId &client_pid, u64 nrr_address);
|
|
|
|
Result Initialize(const sf::ClientProcessId &client_pid, sf::CopyHandle process_h);
|
|
|
|
Result LoadNrrEx(const sf::ClientProcessId &client_pid, u64 nrr_address, u64 nrr_size, sf::CopyHandle process_h);
|
2019-06-24 10:05:51 +01:00
|
|
|
public:
|
|
|
|
DEFINE_SERVICE_DISPATCH_TABLE {
|
2019-10-11 07:49:28 +01:00
|
|
|
MAKE_SERVICE_COMMAND_META(LoadNro),
|
|
|
|
MAKE_SERVICE_COMMAND_META(UnloadNro),
|
|
|
|
MAKE_SERVICE_COMMAND_META(LoadNrr),
|
|
|
|
MAKE_SERVICE_COMMAND_META(UnloadNrr),
|
|
|
|
MAKE_SERVICE_COMMAND_META(Initialize),
|
|
|
|
MAKE_SERVICE_COMMAND_META(LoadNrrEx, hos::Version_700),
|
2019-06-24 10:05:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|