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