From d8da707bb90c233d5e815a508bea3473e6e50afa Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 27 Jun 2014 15:33:23 -0400 Subject: Loader: Refactored interface such that data is no longer stored by loader. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NCCH: Removed extra qualification ‘Loader::AppLoader_NCCH::’. --- src/core/loader/ncch.h | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'src/core/loader/ncch.h') diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index bf65425a4..99753b244 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -158,38 +158,38 @@ public: /** * Get the code (typically .code section) of the application - * @param error ResultStatus result of function - * @return Reference to code buffer + * @param buffer Reference to buffer to store data + * @return ResultStatus result of function */ - const std::vector& ReadCode(ResultStatus& error); + ResultStatus ReadCode(std::vector& buffer); /** * Get the icon (typically icon section) of the application - * @param error ResultStatus result of function - * @return Reference to icon buffer + * @param buffer Reference to buffer to store data + * @return ResultStatus result of function */ - const std::vector& ReadIcon(ResultStatus& error); + ResultStatus ReadIcon(std::vector& buffer); /** * Get the banner (typically banner section) of the application - * @param error ResultStatus result of function - * @return Reference to banner buffer + * @param buffer Reference to buffer to store data + * @return ResultStatus result of function */ - const std::vector& ReadBanner(ResultStatus& error); + ResultStatus ReadBanner(std::vector& buffer); /** * Get the logo (typically logo section) of the application - * @param error ResultStatus result of function - * @return Reference to logo buffer + * @param buffer Reference to buffer to store data + * @return ResultStatus result of function */ - const std::vector& ReadLogo(ResultStatus& error); + ResultStatus ReadLogo(std::vector& buffer); /** - * Get the RomFs archive of the application - * @param error ResultStatus result of function - * @return Reference to RomFs archive buffer + * Get the RomFS of the application + * @param buffer Reference to buffer to store data + * @return ResultStatus result of function */ - const std::vector& ReadRomFS(ResultStatus& error); + ResultStatus ReadRomFS(std::vector& buffer); private: @@ -197,11 +197,9 @@ private: * Reads an application ExeFS section of an NCCH file into AppLoader (e.g. .code, .logo, etc.) * @param name Name of section to read out of NCCH file * @param buffer Vector to read data into - * @param error ResultStatus result of function - * @return Reference to buffer of data that was read + * @return ResultStatus result of function */ - const std::vector& LoadSectionExeFS(const char* name, std::vector& buffer, - ResultStatus& error); + ResultStatus LoadSectionExeFS(const char* name, std::vector& buffer); /** * Loads .code section into memory for booting -- cgit v1.2.3 From 2c62d9255160b7302942d536c9c990b86c7fb907 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 4 Jul 2014 13:11:09 -0400 Subject: Loader: Updated read methods to be const - Required "file" handle to be made local and explicitly opened/closed as needed --- src/core/loader/ncch.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/core/loader/ncch.h') diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index 99753b244..c9a35228e 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -161,35 +161,35 @@ public: * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadCode(std::vector& buffer); + ResultStatus ReadCode(std::vector& buffer) const; /** * Get the icon (typically icon section) of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadIcon(std::vector& buffer); + ResultStatus ReadIcon(std::vector& buffer) const; /** * Get the banner (typically banner section) of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadBanner(std::vector& buffer); + ResultStatus ReadBanner(std::vector& buffer) const; /** * Get the logo (typically logo section) of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadLogo(std::vector& buffer); + ResultStatus ReadLogo(std::vector& buffer) const; /** * Get the RomFS of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadRomFS(std::vector& buffer); + ResultStatus ReadRomFS(std::vector& buffer) const; private: @@ -199,15 +199,14 @@ private: * @param buffer Vector to read data into * @return ResultStatus result of function */ - ResultStatus LoadSectionExeFS(const char* name, std::vector& buffer); + ResultStatus LoadSectionExeFS(const char* name, std::vector& buffer) const; /** * Loads .code section into memory for booting * @return ResultStatus result of function */ - ResultStatus LoadExec(); + ResultStatus LoadExec() const; - File::IOFile file; std::string filename; bool is_loaded; -- cgit v1.2.3 From 2d734bb6c5cf1a428f8ce2a6d13955ee4ff872eb Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 4 Jul 2014 13:20:40 -0400 Subject: Marked AppLoader_ELF, AppLoader_NCCH, and Archive_RomFS classes as "final" --- src/core/loader/ncch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/loader/ncch.h') diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index c9a35228e..de89280ea 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -145,7 +145,7 @@ struct ExHeader_Header{ namespace Loader { /// Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI) -class AppLoader_NCCH : public AppLoader { +class AppLoader_NCCH final : public AppLoader { public: AppLoader_NCCH(const std::string& filename); ~AppLoader_NCCH(); -- cgit v1.2.3 From 1099d83455153f9d81b10b54a788bc9fe91f33e9 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 4 Jul 2014 13:25:30 -0400 Subject: Marked AppLoader_ELF, AppLoader_NCCH, and Archive_RomFS virtual functions as "override". --- src/core/loader/ncch.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/core/loader/ncch.h') diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index de89280ea..29b59aa11 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -148,48 +148,48 @@ namespace Loader { class AppLoader_NCCH final : public AppLoader { public: AppLoader_NCCH(const std::string& filename); - ~AppLoader_NCCH(); + ~AppLoader_NCCH() override; /** * Load the application * @return ResultStatus result of function */ - ResultStatus Load(); + ResultStatus Load() override; /** * Get the code (typically .code section) of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadCode(std::vector& buffer) const; + ResultStatus ReadCode(std::vector& buffer) const override; /** * Get the icon (typically icon section) of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadIcon(std::vector& buffer) const; + ResultStatus ReadIcon(std::vector& buffer) const override; /** * Get the banner (typically banner section) of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadBanner(std::vector& buffer) const; + ResultStatus ReadBanner(std::vector& buffer) const override; /** * Get the logo (typically logo section) of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadLogo(std::vector& buffer) const; + ResultStatus ReadLogo(std::vector& buffer) const override; /** * Get the RomFS of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadRomFS(std::vector& buffer) const; + ResultStatus ReadRomFS(std::vector& buffer) const override; private: -- cgit v1.2.3