1
0
Fork 0

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

@ -205,6 +205,8 @@ add_library(core STATIC
hle/service/apt/apt_s.h
hle/service/apt/apt_u.cpp
hle/service/apt/apt_u.h
hle/service/apt/ns_s.cpp
hle/service/apt/ns_s.h
hle/service/apt/bcfnt/bcfnt.cpp
hle/service/apt/bcfnt/bcfnt.h
hle/service/apt/errors.h
@ -326,10 +328,6 @@ add_library(core STATIC
hle/service/nim/nim_s.h
hle/service/nim/nim_u.cpp
hle/service/nim/nim_u.h
hle/service/ns/ns.cpp
hle/service/ns/ns.h
hle/service/ns/ns_s.cpp
hle/service/ns/ns_s.h
hle/service/nwm/nwm.cpp
hle/service/nwm/nwm.h
hle/service/nwm/nwm_cec.cpp

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

@ -2,11 +2,12 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/service/ns/ns_s.h"
#include "core/hle/service/apt/ns_s.h"
namespace Service::NS {
NS_S::NS_S() : ServiceFramework("ns:s", 2) {
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"},
@ -27,6 +28,4 @@ NS_S::NS_S() : ServiceFramework("ns:s", 2) {
RegisterHandlers(functions);
}
NS_S::~NS_S() = default;
} // namespace Service::NS

View File

@ -4,15 +4,16 @@
#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 ServiceFramework<NS_S> {
class NS_S final : public Service::APT::Module::Interface {
public:
NS_S();
~NS_S();
explicit NS_S(std::shared_ptr<Service::APT::Module> apt);
};
} // namespace Service::NS

View File

@ -1,39 +0,0 @@
// Copyright 2017 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <cinttypes>
#include "core/core.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/ns/ns.h"
#include "core/hle/service/ns/ns_s.h"
#include "core/loader/loader.h"
namespace Service::NS {
std::shared_ptr<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;
}
std::shared_ptr<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;
}
void InstallInterfaces(Core::System& system) {
auto& service_manager = system.ServiceManager();
std::make_shared<NS_S>()->InstallAsService(service_manager);
}
} // namespace Service::NS

View File

@ -1,24 +0,0 @@
// Copyright 2017 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include "core/hle/kernel/process.h"
#include "core/hle/service/fs/archive.h"
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::NS {
/// Loads and launches the title identified by title_id in the specified media type.
std::shared_ptr<Kernel::Process> LaunchTitle(FS::MediaType media_type, u64 title_id);
/// Registers all NS services with the specified service manager.
void InstallInterfaces(Core::System& system);
} // namespace Service::NS

View File

@ -40,7 +40,6 @@
#include "core/hle/service/news/news.h"
#include "core/hle/service/nfc/nfc.h"
#include "core/hle/service/nim/nim.h"
#include "core/hle/service/ns/ns.h"
#include "core/hle/service/nwm/nwm.h"
#include "core/hle/service/pm/pm.h"
#include "core/hle/service/ps/ps_ps.h"
@ -86,11 +85,7 @@ const std::array<ServiceModuleInfo, 40> service_module_map{
{"NEWS", 0x00040130'00003502, NEWS::InstallInterfaces},
{"NFC", 0x00040130'00004002, NFC::InstallInterfaces},
{"NIM", 0x00040130'00002C02, NIM::InstallInterfaces},
{"NS", 0x00040130'00008002,
[](Core::System& system) {
NS::InstallInterfaces(system);
APT::InstallInterfaces(system);
}},
{"NS", 0x00040130'00008002, APT::InstallInterfaces},
{"NWM", 0x00040130'00002D02, NWM::InstallInterfaces},
{"PTM", 0x00040130'00002202, PTM::InstallInterfaces},
{"QTM", 0x00040130'00004202, QTM::InstallInterfaces},