mirror of
https://github.com/citra-mirror/citra.git
synced 2024-08-19 18:13:21 +02:00
HLE: Remove BaseInterface and add ns.cpp back
This commit is contained in:
parent
f2167d76a8
commit
6c8faaf2c2
@ -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.cpp
|
||||
hle/service/apt/ns.h
|
||||
hle/service/apt/ns_s.cpp
|
||||
hle/service/apt/ns_s.h
|
||||
hle/service/apt/bcfnt/bcfnt.cpp
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include "core/hle/applets/applet.h"
|
||||
#include "core/hle/service/apt/applet_manager.h"
|
||||
#include "core/hle/service/apt/errors.h"
|
||||
#include "core/hle/service/apt/ns.h"
|
||||
#include "core/hle/service/cfg/cfg.h"
|
||||
#include "core/hle/service/ns/ns.h"
|
||||
|
||||
namespace Service::APT {
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
namespace Service::APT {
|
||||
|
||||
Module::NSInterface::NSInterface(std::shared_ptr<Module> apt, const char* name, u32 max_session)
|
||||
: ServiceFramework(name, max_session), BaseInterface(std::move(apt)) {}
|
||||
: ServiceFramework(name, max_session), apt(std::move(apt)) {}
|
||||
|
||||
Module::NSInterface::~NSInterface() = default;
|
||||
|
||||
@ -860,7 +860,7 @@ void Module::APTInterface::CheckNew3DS(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
Module::APTInterface::APTInterface(std::shared_ptr<Module> apt, const char* name, u32 max_session)
|
||||
: ServiceFramework(name, max_session), BaseInterface(std::move(apt)) {}
|
||||
: ServiceFramework(name, max_session), apt(std::move(apt)) {}
|
||||
|
||||
Module::APTInterface::~APTInterface() = default;
|
||||
|
||||
@ -889,27 +889,3 @@ void InstallInterfaces(Core::System& system) {
|
||||
}
|
||||
|
||||
} // 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
|
||||
|
@ -60,21 +60,16 @@ public:
|
||||
explicit Module(Core::System& system);
|
||||
~Module();
|
||||
|
||||
class BaseInterface {
|
||||
public:
|
||||
explicit BaseInterface(std::shared_ptr<Module> apt) : apt(apt) {}
|
||||
|
||||
protected:
|
||||
std::shared_ptr<Module> apt;
|
||||
};
|
||||
|
||||
class NSInterface : public ServiceFramework<NSInterface>, public BaseInterface {
|
||||
class NSInterface : public ServiceFramework<NSInterface> {
|
||||
public:
|
||||
NSInterface(std::shared_ptr<Module> apt, const char* name, u32 max_session);
|
||||
~NSInterface();
|
||||
|
||||
private:
|
||||
std::shared_ptr<Module> apt;
|
||||
};
|
||||
|
||||
class APTInterface : public ServiceFramework<APTInterface>, public BaseInterface {
|
||||
class APTInterface : public ServiceFramework<APTInterface> {
|
||||
public:
|
||||
APTInterface(std::shared_ptr<Module> apt, const char* name, u32 max_session);
|
||||
~APTInterface();
|
||||
@ -608,6 +603,7 @@ public:
|
||||
|
||||
private:
|
||||
bool application_reset_prepared{};
|
||||
std::shared_ptr<Module> apt;
|
||||
};
|
||||
|
||||
private:
|
||||
@ -639,8 +635,3 @@ 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
|
||||
|
33
src/core/hle/service/apt/ns.cpp
Normal file
33
src/core/hle/service/apt/ns.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
// 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/apt/ns.h"
|
||||
#include "core/loader/loader.h"
|
||||
|
||||
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
|
20
src/core/hle/service/apt/ns.h
Normal file
20
src/core/hle/service/apt/ns.h
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2017 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#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.
|
||||
Kernel::SharedPtr<Kernel::Process> LaunchTitle(FS::MediaType media_type, u64 title_id);
|
||||
|
||||
} // namespace Service::NS
|
Loading…
Reference in New Issue
Block a user