mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-04 07:38:47 +00:00 
			
		
		
		
	HLE: Move NS:S into APT and remove NS
This commit is contained in:
		
							parent
							
								
									84b40f2da6
								
							
						
					
					
						commit
						b62ca12e88
					
				
					 8 changed files with 43 additions and 80 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -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},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue