2018-01-13 16:22:39 -05:00
|
|
|
// Copyright 2018 yuzu emulator team
|
2017-10-05 23:30:08 -04:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "core/hle/kernel/kernel.h"
|
|
|
|
#include "core/loader/linker.h"
|
|
|
|
#include "core/loader/loader.h"
|
|
|
|
|
|
|
|
namespace Loader {
|
|
|
|
|
|
|
|
/// Loads an NRO file
|
|
|
|
class AppLoader_NRO final : public AppLoader, Linker {
|
|
|
|
public:
|
2018-01-20 15:48:37 -05:00
|
|
|
AppLoader_NRO(FileUtil::IOFile&& file, std::string filepath);
|
2017-10-05 23:30:08 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the type of the file
|
|
|
|
* @param file FileUtil::IOFile open file
|
2018-01-20 14:55:54 -05:00
|
|
|
* @param filepath Path of the file that we are opening.
|
2017-10-05 23:30:08 -04:00
|
|
|
* @return FileType found, or FileType::Error if this loader doesn't know it
|
|
|
|
*/
|
2018-01-20 14:55:54 -05:00
|
|
|
static FileType IdentifyType(FileUtil::IOFile& file, const std::string& filepath);
|
2017-10-05 23:30:08 -04:00
|
|
|
|
|
|
|
FileType GetFileType() override {
|
2018-01-20 14:55:54 -05:00
|
|
|
return IdentifyType(file, filepath);
|
2017-10-05 23:30:08 -04:00
|
|
|
}
|
|
|
|
|
2017-10-09 23:56:20 -04:00
|
|
|
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
|
2017-10-05 23:30:08 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool LoadNro(const std::string& path, VAddr load_base);
|
|
|
|
|
|
|
|
std::string filepath;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Loader
|