HLE: Move NS:S into APT and remove NS

This commit is contained in:
James Rowe 2018-11-28 00:27:21 -07:00
parent 84b40f2da6
commit b62ca12e88
8 changed files with 43 additions and 80 deletions

View file

@ -12,12 +12,14 @@
#include "core/hle/kernel/mutex.h"
#include "core/hle/kernel/shared_memory.h"
#include "core/hle/romfs.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/apt/applet_manager.h"
#include "core/hle/service/apt/apt.h"
#include "core/hle/service/apt/apt_a.h"
#include "core/hle/service/apt/apt_s.h"
#include "core/hle/service/apt/apt_u.h"
#include "core/hle/service/apt/bcfnt/bcfnt.h"
#include "core/hle/service/apt/ns_s.h"
#include "core/hle/service/cfg/cfg.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/ptm/ptm.h"
@ -878,6 +880,31 @@ void InstallInterfaces(Core::System& system) {
std::make_shared<APT_U>(apt)->InstallAsService(service_manager);
std::make_shared<APT_S>(apt)->InstallAsService(service_manager);
std::make_shared<APT_A>(apt)->InstallAsService(service_manager);
std::make_shared<Service::NS::NS_S>(apt)->InstallAsService(service_manager);
}
} // namespace Service::APT
namespace Service::NS {
Kernel::SharedPtr<Kernel::Process> LaunchTitle(FS::MediaType media_type, u64 title_id) {
std::string path = AM::GetTitleContentPath(media_type, title_id);
auto loader = Loader::GetLoader(path);
if (!loader) {
LOG_WARNING(Service_NS, "Could not find .app for title 0x{:016x}", title_id);
return nullptr;
}
Kernel::SharedPtr<Kernel::Process> process;
Loader::ResultStatus result = loader->Load(process);
if (result != Loader::ResultStatus::Success) {
LOG_WARNING(Service_NS, "Error loading .app for title 0x{:016x}", title_id);
return nullptr;
}
return process;
}
} // namespace Service::NS

View file

@ -8,6 +8,7 @@
#include <vector>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "core/hle/service/fs/archive.h"
#include "common/swap.h"
#include "core/hle/service/service.h"
@ -625,3 +626,8 @@ private:
void InstallInterfaces(Core::System& system);
} // namespace Service::APT
namespace Service::NS {
/// Loads and launches the title identified by title_id in the specified media type.
Kernel::SharedPtr<Kernel::Process> LaunchTitle(FS::MediaType media_type, u64 title_id);
} // namespace Service::NS

View file

@ -0,0 +1,31 @@
// Copyright 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/service/apt/ns_s.h"
namespace Service::NS {
NS_S::NS_S(std::shared_ptr<Service::APT::Module> apt)
: Service::APT::Module::Interface(std::move(apt), "NS:S", Service::APT::MaxAPTSessions) {
static const FunctionInfo functions[] = {
{0x000100C0, nullptr, "LaunchFIRM"},
{0x000200C0, nullptr, "LaunchTitle"},
{0x00030000, nullptr, "TerminateApplication"},
{0x00040040, nullptr, "TerminateProcess"},
{0x000500C0, nullptr, "LaunchApplicationFIRM"},
{0x00060042, nullptr, "SetFIRMParams4A0"},
{0x00070042, nullptr, "CardUpdateInitialize"},
{0x00080000, nullptr, "CardUpdateShutdown"},
{0x000D0140, nullptr, "SetTWLBannerHMAC"},
{0x000E0000, nullptr, "ShutdownAsync"},
{0x00100180, nullptr, "RebootSystem"},
{0x00110100, nullptr, "TerminateTitle"},
{0x001200C0, nullptr, "SetApplicationCpuTimeLimit"},
{0x00150140, nullptr, "LaunchApplication"},
{0x00160000, nullptr, "RebootSystemClean"},
};
RegisterHandlers(functions);
}
} // namespace Service::NS

View file

@ -0,0 +1,19 @@
// Copyright 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "core/hle/kernel/kernel.h"
#include "core/hle/service/apt/apt.h"
#include "core/hle/service/service.h"
namespace Service::NS {
/// Interface to "ns:s" service
class NS_S final : public Service::APT::Module::Interface {
public:
explicit NS_S(std::shared_ptr<Service::APT::Module> apt);
};
} // namespace Service::NS