From b94248cec0a169ecc24d4b2e1b2013ae6a7cc222 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Fri, 26 Jun 2020 13:23:29 +0100 Subject: [PATCH] Move the loader backing out of the main loader class The presence of a backing is an implementation detail. --- app/src/main/cpp/skyline/loader/loader.h | 7 ------- app/src/main/cpp/skyline/loader/nro.cpp | 2 +- app/src/main/cpp/skyline/loader/nro.h | 2 ++ app/src/main/cpp/skyline/loader/nso.cpp | 2 +- app/src/main/cpp/skyline/loader/nso.h | 2 ++ 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/src/main/cpp/skyline/loader/loader.h b/app/src/main/cpp/skyline/loader/loader.h index 7c3cb08c..1fe4baf1 100644 --- a/app/src/main/cpp/skyline/loader/loader.h +++ b/app/src/main/cpp/skyline/loader/loader.h @@ -32,8 +32,6 @@ namespace skyline::loader { size_t size; //!< The total size of the loaded executable }; - std::shared_ptr backing; //!< The backing of the loader - /** * @brief This loads an executable into memory * @param process The process to load the executable into @@ -47,11 +45,6 @@ namespace skyline::loader { std::shared_ptr nacp; //!< The NACP of the current application std::shared_ptr romFs; //!< The RomFS of the current application - /** - * @param backing The backing for the NRO - */ - Loader(const std::shared_ptr &backing) : backing(backing) {} - virtual ~Loader() = default; /** diff --git a/app/src/main/cpp/skyline/loader/nro.cpp b/app/src/main/cpp/skyline/loader/nro.cpp index e7c1bf8f..b8c3c89a 100644 --- a/app/src/main/cpp/skyline/loader/nro.cpp +++ b/app/src/main/cpp/skyline/loader/nro.cpp @@ -9,7 +9,7 @@ #include "nro.h" namespace skyline::loader { - NroLoader::NroLoader(const std::shared_ptr &backing) : Loader(backing) { + NroLoader::NroLoader(const std::shared_ptr &backing) : backing(backing) { backing->Read(&header); if (header.magic != util::MakeMagic("NRO0")) diff --git a/app/src/main/cpp/skyline/loader/nro.h b/app/src/main/cpp/skyline/loader/nro.h index 91f044cd..355c7062 100644 --- a/app/src/main/cpp/skyline/loader/nro.h +++ b/app/src/main/cpp/skyline/loader/nro.h @@ -66,6 +66,8 @@ namespace skyline::loader { NroAssetSection romFs; //!< The header describing the location of the RomFS } assetHeader{}; + std::shared_ptr backing; //!< The backing of the NRO loader + /** * @brief This reads the data of the specified segment * @param segment The header of the segment to read diff --git a/app/src/main/cpp/skyline/loader/nso.cpp b/app/src/main/cpp/skyline/loader/nso.cpp index 3f74c1f1..754953ba 100644 --- a/app/src/main/cpp/skyline/loader/nso.cpp +++ b/app/src/main/cpp/skyline/loader/nso.cpp @@ -8,7 +8,7 @@ #include "nso.h" namespace skyline::loader { - NsoLoader::NsoLoader(const std::shared_ptr &backing) : Loader(backing) { + NsoLoader::NsoLoader(const std::shared_ptr &backing) : backing(backing) { u32 magic{}; backing->Read(&magic); diff --git a/app/src/main/cpp/skyline/loader/nso.h b/app/src/main/cpp/skyline/loader/nso.h index 66f283b0..96d6efb5 100644 --- a/app/src/main/cpp/skyline/loader/nso.h +++ b/app/src/main/cpp/skyline/loader/nso.h @@ -67,6 +67,8 @@ namespace skyline::loader { }; static_assert(sizeof(NsoHeader) == 0x100); + std::shared_ptr backing; //!< The backing of the NSO loader + /** * @brief This reads the specified segment from the backing and decompresses it if needed * @param segment The header of the segment to read