From c385b7767d32eccabbfeaa12764310cfc3d113b9 Mon Sep 17 00:00:00 2001 From: condut Date: Fri, 10 Jul 2015 00:55:23 +0300 Subject: FS: Stream RomFS from file instead of loading all of it to memory --- src/core/loader/ncch.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/core/loader/ncch.h') diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index 29e39d2c0..d180e77ed 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -163,7 +163,8 @@ namespace Loader { /// Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI) class AppLoader_NCCH final : public AppLoader { public: - AppLoader_NCCH(std::unique_ptr&& file) : AppLoader(std::move(file)) { } + AppLoader_NCCH(std::unique_ptr&& file, const std::string& filepath) + : AppLoader(std::move(file)), filepath(filepath) { } /** * Returns the type of the file @@ -211,7 +212,7 @@ public: * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadRomFS(std::vector& buffer) const override; + ResultStatus ReadRomFS(std::shared_ptr& romfs_file, u64& offset, u64& size) const override; private: @@ -244,6 +245,8 @@ private: NCCH_Header ncch_header; ExeFs_Header exefs_header; ExHeader_Header exheader_header; + + std::string filepath; }; } // namespace Loader -- cgit v1.2.3 From 2d7299a86fdc4ba2485042f950d864e063be5e97 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 11 Jul 2015 19:16:33 -0300 Subject: Loader: Remove unnecessary pointer indirection to IOFile --- src/core/loader/ncch.h | 16 ++++++++-------- 1 file changed, 8 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 d180e77ed..b4374a476 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -163,7 +163,7 @@ namespace Loader { /// Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI) class AppLoader_NCCH final : public AppLoader { public: - AppLoader_NCCH(std::unique_ptr&& file, const std::string& filepath) + AppLoader_NCCH(FileUtil::IOFile&& file, const std::string& filepath) : AppLoader(std::move(file)), filepath(filepath) { } /** @@ -184,35 +184,35 @@ public: * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadCode(std::vector& buffer) const override; + ResultStatus ReadCode(std::vector& buffer) 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 override; + ResultStatus ReadIcon(std::vector& buffer) 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 override; + ResultStatus ReadBanner(std::vector& buffer) 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 override; + ResultStatus ReadLogo(std::vector& buffer) override; /** * Get the RomFS of the application * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - ResultStatus ReadRomFS(std::shared_ptr& romfs_file, u64& offset, u64& size) const override; + ResultStatus ReadRomFS(std::shared_ptr& romfs_file, u64& offset, u64& size) override; private: @@ -222,13 +222,13 @@ private: * @param buffer Vector to read data into * @return ResultStatus result of function */ - ResultStatus LoadSectionExeFS(const char* name, std::vector& buffer) const; + ResultStatus LoadSectionExeFS(const char* name, std::vector& buffer); /** * Loads .code section into memory for booting * @return ResultStatus result of function */ - ResultStatus LoadExec() const; + ResultStatus LoadExec(); bool is_compressed = false; -- cgit v1.2.3