2017-08-29 03:26:07 +02:00
|
|
|
// Copyright 2017 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2017-11-06 21:12:15 +01:00
|
|
|
#include <cinttypes>
|
|
|
|
#include "core/hle/service/am/am.h"
|
2017-08-29 03:26:07 +02:00
|
|
|
#include "core/hle/service/ns/ns.h"
|
|
|
|
#include "core/hle/service/ns/ns_s.h"
|
2017-11-06 21:12:15 +01:00
|
|
|
#include "core/loader/loader.h"
|
2017-08-29 03:26:07 +02:00
|
|
|
|
|
|
|
namespace Service {
|
|
|
|
namespace NS {
|
|
|
|
|
2017-11-06 21:12:15 +01:00
|
|
|
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) {
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_NS, "Could not find .app for title 0x{:016x}", title_id);
|
2017-11-06 21:12:15 +01:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
Kernel::SharedPtr<Kernel::Process> process;
|
|
|
|
Loader::ResultStatus result = loader->Load(process);
|
|
|
|
|
|
|
|
if (result != Loader::ResultStatus::Success) {
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_NS, "Error loading .app for title 0x{:016x}", title_id);
|
2017-11-06 21:12:15 +01:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return process;
|
|
|
|
}
|
|
|
|
|
2017-08-29 03:26:07 +02:00
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
|
|
|
std::make_shared<NS_S>()->InstallAsService(service_manager);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace NS
|
|
|
|
} // namespace Service
|