Просмотр исходного кода

Loader: Add a GetFileType method to get the type of a loaded file

Emmanuel Gil Peyrot 10 лет назад
Родитель
Сommit
9a35d1fb4a
4 измененных файлов с 30 добавлено и 0 удалено
  1. 8 0
      src/core/loader/3dsx.h
  2. 8 0
      src/core/loader/elf.h
  3. 6 0
      src/core/loader/loader.h
  4. 8 0
      src/core/loader/ncch.h

+ 8 - 0
src/core/loader/3dsx.h

@@ -27,6 +27,14 @@ public:
      */
     static FileType IdentifyType(FileUtil::IOFile& file);
 
+    /**
+     * Returns the type of this file
+     * @return FileType corresponding to the loaded file
+     */
+    FileType GetFileType() override {
+        return IdentifyType(file);
+    }
+
     /**
      * Load the bootable file
      * @return ResultStatus result of function

+ 8 - 0
src/core/loader/elf.h

@@ -27,6 +27,14 @@ public:
      */
     static FileType IdentifyType(FileUtil::IOFile& file);
 
+    /**
+     * Returns the type of this file
+     * @return FileType corresponding to the loaded file
+     */
+    FileType GetFileType() override {
+        return IdentifyType(file);
+    }
+
     /**
      * Load the bootable file
      * @return ResultStatus result of function

+ 6 - 0
src/core/loader/loader.h

@@ -131,6 +131,12 @@ public:
     AppLoader(FileUtil::IOFile&& file) : file(std::move(file)) { }
     virtual ~AppLoader() { }
 
+    /**
+     * Returns the type of this file
+     * @return FileType corresponding to the loaded file
+     */
+    virtual FileType GetFileType() = 0;
+
     /**
      * Load the application
      * @return ResultStatus result of function

+ 8 - 0
src/core/loader/ncch.h

@@ -173,6 +173,14 @@ public:
      */
     static FileType IdentifyType(FileUtil::IOFile& file);
 
+    /**
+     * Returns the type of this file
+     * @return FileType corresponding to the loaded file
+     */
+    FileType GetFileType() override {
+        return IdentifyType(file);
+    }
+
     /**
      * Load the application
      * @return ResultStatus result of function