From 774e7deae8655a6f09530770c56ae2e75d55309b Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 23 Sep 2017 20:32:18 -0500 Subject: HLE/Archives: Allow multiple loaded applications to access their SelfNCCH archive independently. The loaders now register each loaded ROM with the SelfNCCH factory, which keeps the data around for the duration of the emulation session. When opening the SelfNCCH archive, the factory queries the current program's programid and uses that as a key to the map that contains the NCCHData structure (RomFS, Icon, Banner, etc). 3dsx files do not have a programid and will use a default of 0 for this value, thus, only 1 3dsx file with RomFS is loadable at the same time. --- src/core/file_sys/archive_selfncch.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys/archive_selfncch.h') diff --git a/src/core/file_sys/archive_selfncch.h b/src/core/file_sys/archive_selfncch.h index f1c659948..0d6d6766e 100644 --- a/src/core/file_sys/archive_selfncch.h +++ b/src/core/file_sys/archive_selfncch.h @@ -6,6 +6,7 @@ #include #include +#include #include #include "common/common_types.h" #include "core/file_sys/archive_backend.h" @@ -33,7 +34,10 @@ struct NCCHData { /// File system interface to the SelfNCCH archive class ArchiveFactory_SelfNCCH final : public ArchiveFactory { public: - explicit ArchiveFactory_SelfNCCH(Loader::AppLoader& app_loader); + ArchiveFactory_SelfNCCH() = default; + + /// Registers a loaded application so that we can open its SelfNCCH archive when requested. + void Register(Loader::AppLoader& app_loader); std::string GetName() const override { return "SelfNCCH"; @@ -43,7 +47,8 @@ public: ResultVal GetFormatInfo(const Path& path) const override; private: - NCCHData ncch_data; + /// Mapping of ProgramId -> NCCHData + std::unordered_map ncch_data; }; } // namespace FileSys -- cgit v1.2.3