瀏覽代碼

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

Emmanuel Gil Peyrot 10 年之前
父節點
當前提交
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