Move the loader backing out of the main loader class

The presence of a backing is an implementation detail.
This commit is contained in:
Billy Laws 2020-06-26 13:23:29 +01:00 committed by ◱ PixelyIon
parent 3a23ec06a4
commit b94248cec0
5 changed files with 6 additions and 9 deletions

View File

@ -32,8 +32,6 @@ namespace skyline::loader {
size_t size; //!< The total size of the loaded executable size_t size; //!< The total size of the loaded executable
}; };
std::shared_ptr<vfs::Backing> backing; //!< The backing of the loader
/** /**
* @brief This loads an executable into memory * @brief This loads an executable into memory
* @param process The process to load the executable into * @param process The process to load the executable into
@ -47,11 +45,6 @@ namespace skyline::loader {
std::shared_ptr<vfs::NACP> nacp; //!< The NACP of the current application std::shared_ptr<vfs::NACP> nacp; //!< The NACP of the current application
std::shared_ptr<vfs::Backing> romFs; //!< The RomFS of the current application std::shared_ptr<vfs::Backing> romFs; //!< The RomFS of the current application
/**
* @param backing The backing for the NRO
*/
Loader(const std::shared_ptr<vfs::Backing> &backing) : backing(backing) {}
virtual ~Loader() = default; virtual ~Loader() = default;
/** /**

View File

@ -9,7 +9,7 @@
#include "nro.h" #include "nro.h"
namespace skyline::loader { namespace skyline::loader {
NroLoader::NroLoader(const std::shared_ptr<vfs::Backing> &backing) : Loader(backing) { NroLoader::NroLoader(const std::shared_ptr<vfs::Backing> &backing) : backing(backing) {
backing->Read(&header); backing->Read(&header);
if (header.magic != util::MakeMagic<u32>("NRO0")) if (header.magic != util::MakeMagic<u32>("NRO0"))

View File

@ -66,6 +66,8 @@ namespace skyline::loader {
NroAssetSection romFs; //!< The header describing the location of the RomFS NroAssetSection romFs; //!< The header describing the location of the RomFS
} assetHeader{}; } assetHeader{};
std::shared_ptr<vfs::Backing> backing; //!< The backing of the NRO loader
/** /**
* @brief This reads the data of the specified segment * @brief This reads the data of the specified segment
* @param segment The header of the segment to read * @param segment The header of the segment to read

View File

@ -8,7 +8,7 @@
#include "nso.h" #include "nso.h"
namespace skyline::loader { namespace skyline::loader {
NsoLoader::NsoLoader(const std::shared_ptr<vfs::Backing> &backing) : Loader(backing) { NsoLoader::NsoLoader(const std::shared_ptr<vfs::Backing> &backing) : backing(backing) {
u32 magic{}; u32 magic{};
backing->Read(&magic); backing->Read(&magic);

View File

@ -67,6 +67,8 @@ namespace skyline::loader {
}; };
static_assert(sizeof(NsoHeader) == 0x100); static_assert(sizeof(NsoHeader) == 0x100);
std::shared_ptr<vfs::Backing> backing; //!< The backing of the NSO loader
/** /**
* @brief This reads the specified segment from the backing and decompresses it if needed * @brief This reads the specified segment from the backing and decompresses it if needed
* @param segment The header of the segment to read * @param segment The header of the segment to read