services: Pass FileSystemController as reference to services that need it

This commit is contained in:
Zach Hilman 2019-04-22 17:53:58 -04:00
parent 1b04b72653
commit 4b91057688
11 changed files with 47 additions and 20 deletions

View file

@ -617,7 +617,7 @@ public:
}
};
void InstallInterfaces(SM::ServiceManager& service_manager) {
void InstallInterfaces(SM::ServiceManager& service_manager, FileSystem::FileSystemController& fsc) {
std::make_shared<NS>("ns:am2")->InstallAsService(service_manager);
std::make_shared<NS>("ns:ec")->InstallAsService(service_manager);
std::make_shared<NS>("ns:rid")->InstallAsService(service_manager);
@ -628,7 +628,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<NS_SU>()->InstallAsService(service_manager);
std::make_shared<NS_VM>()->InstallAsService(service_manager);
std::make_shared<PL_U>()->InstallAsService(service_manager);
std::make_shared<PL_U>(fsc)->InstallAsService(service_manager);
}
} // namespace Service::NS

View file

@ -6,7 +6,13 @@
#include "core/hle/service/service.h"
namespace Service::NS {
namespace Service {
namespace FileSystem {
class FileSystemController;
} // namespace FileSystem
namespace NS {
class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> {
public:
@ -91,6 +97,8 @@ private:
};
/// Registers all NS services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& service_manager);
void InstallInterfaces(SM::ServiceManager& service_manager, FileSystem::FileSystemController& fsc);
} // namespace Service::NS
} // namespace NS
} // namespace Service

View file

@ -150,7 +150,8 @@ struct PL_U::Impl {
std::vector<FontRegion> shared_font_regions;
};
PL_U::PL_U() : ServiceFramework("pl:u"), impl{std::make_unique<Impl>()} {
PL_U::PL_U(FileSystem::FileSystemController& fsc)
: ServiceFramework("pl:u"), impl{std::make_unique<Impl>()} {
static const FunctionInfo functions[] = {
{0, &PL_U::RequestLoad, "RequestLoad"},
{1, &PL_U::GetLoadState, "GetLoadState"},
@ -161,7 +162,7 @@ PL_U::PL_U() : ServiceFramework("pl:u"), impl{std::make_unique<Impl>()} {
};
RegisterHandlers(functions);
// Attempt to load shared font data from disk
const auto* nand = FileSystem::GetSystemNANDContents();
const auto* nand = fsc.GetSystemNANDContents();
std::size_t offset = 0;
// Rebuild shared fonts from data ncas
if (nand->HasEntry(static_cast<u64>(FontArchives::Standard),

View file

@ -7,11 +7,17 @@
#include <memory>
#include "core/hle/service/service.h"
namespace Service::NS {
namespace Service {
namespace FileSystem {
class FileSystemController;
} // namespace FileSystem
namespace NS {
class PL_U final : public ServiceFramework<PL_U> {
public:
PL_U();
PL_U(FileSystem::FileSystemController& fsc);
~PL_U() override;
private:
@ -26,4 +32,6 @@ private:
std::unique_ptr<Impl> impl;
};
} // namespace Service::NS
} // namespace NS
} // namespace Service