mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-19 10:21:09 +00:00
HLE/NS: Added a function to launch titles installed to the virtual NAND/SD card.
It uses AM::GetTitleContentPath to retrieve the path of the program to launch.
This commit is contained in:
parent
ccd0710e5b
commit
191565a1b8
@ -2,12 +2,35 @@
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cinttypes>
|
||||
#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 {
|
||||
namespace 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%016" PRIx64, 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%016" PRIx64, title_id);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return process;
|
||||
}
|
||||
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
||||
std::make_shared<NS_S>()->InstallAsService(service_manager);
|
||||
}
|
||||
|
@ -4,11 +4,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Service {
|
||||
namespace 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);
|
||||
|
||||
/// Registers all NS services with the specified service manager.
|
||||
void InstallInterfaces(SM::ServiceManager& service_manager);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user