2018-01-20 20:59:17 +01:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "common/common_types.h"
|
2018-02-25 11:35:07 +01:00
|
|
|
#include "core/file_sys/program_metadata.h"
|
2018-08-02 04:40:00 +02:00
|
|
|
#include "core/hle/kernel/object.h"
|
2018-01-20 20:59:17 +01:00
|
|
|
#include "core/loader/loader.h"
|
|
|
|
|
|
|
|
namespace Loader {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class loads a "deconstructed ROM directory", which are the typical format we see for Switch
|
|
|
|
* game dumps. The path should be a "main" NSO, which must be in a directory that contains the other
|
|
|
|
* standard ExeFS NSOs (e.g. rtld, sdk, etc.). It will automatically find and load these.
|
2018-02-05 09:01:10 +01:00
|
|
|
* Furthermore, it will look for the first .romfs file (optionally) and use this for the RomFS.
|
2018-01-20 20:59:17 +01:00
|
|
|
*/
|
|
|
|
class AppLoader_DeconstructedRomDirectory final : public AppLoader {
|
|
|
|
public:
|
2018-07-19 03:07:11 +02:00
|
|
|
explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile main_file);
|
2018-01-20 20:59:17 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the type of the file
|
2018-07-19 03:07:11 +02:00
|
|
|
* @param file std::shared_ptr<VfsFile> open file
|
2018-01-20 20:59:17 +01:00
|
|
|
* @return FileType found, or FileType::Error if this loader doesn't know it
|
|
|
|
*/
|
2018-07-19 03:07:11 +02:00
|
|
|
static FileType IdentifyType(const FileSys::VirtualFile& file);
|
2018-01-20 20:59:17 +01:00
|
|
|
|
|
|
|
FileType GetFileType() override {
|
2018-07-19 03:07:11 +02:00
|
|
|
return IdentifyType(file);
|
2018-01-20 20:59:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
|
|
|
|
|
2018-07-19 03:07:11 +02:00
|
|
|
ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override;
|
2018-07-08 05:24:51 +02:00
|
|
|
|
2018-01-20 20:59:17 +01:00
|
|
|
private:
|
2018-02-25 11:35:07 +01:00
|
|
|
FileSys::ProgramMetadata metadata;
|
2018-07-19 03:07:11 +02:00
|
|
|
FileSys::VirtualFile romfs;
|
2018-01-20 20:59:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Loader
|