2018-01-14 00:22:39 +03:00
|
|
|
// Copyright 2018 yuzu emulator team
|
2017-09-24 18:08:31 +03:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-09-30 21:15:09 +03:00
|
|
|
#include <map>
|
2017-09-24 18:08:31 +03:00
|
|
|
#include <string>
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "common/file_util.h"
|
2017-09-30 21:15:09 +03:00
|
|
|
#include "core/hle/kernel/kernel.h"
|
2017-10-06 06:30:08 +03:00
|
|
|
#include "core/loader/linker.h"
|
2017-09-24 18:08:31 +03:00
|
|
|
#include "core/loader/loader.h"
|
|
|
|
|
|
|
|
namespace Loader {
|
|
|
|
|
|
|
|
/// Loads an NSO file
|
2017-10-06 06:30:08 +03:00
|
|
|
class AppLoader_NSO final : public AppLoader, Linker {
|
2017-09-24 18:08:31 +03:00
|
|
|
public:
|
2017-10-10 04:39:32 +03:00
|
|
|
AppLoader_NSO(FileUtil::IOFile&& file, std::string filepath)
|
|
|
|
: AppLoader(std::move(file)), filepath(std::move(filepath)) {
|
2017-09-30 21:15:09 +03:00
|
|
|
}
|
2017-09-24 18:08:31 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the type of the file
|
|
|
|
* @param file FileUtil::IOFile open file
|
|
|
|
* @return FileType found, or FileType::Error if this loader doesn't know it
|
|
|
|
*/
|
|
|
|
static FileType IdentifyType(FileUtil::IOFile& file);
|
|
|
|
|
|
|
|
FileType GetFileType() override {
|
|
|
|
return IdentifyType(file);
|
|
|
|
}
|
|
|
|
|
2017-10-10 06:56:20 +03:00
|
|
|
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;
|
2017-09-24 18:08:31 +03:00
|
|
|
|
|
|
|
private:
|
2017-10-10 04:39:32 +03:00
|
|
|
VAddr LoadNso(const std::string& path, VAddr load_base, bool relocate = false);
|
2017-09-30 21:15:09 +03:00
|
|
|
|
2017-09-24 18:08:31 +03:00
|
|
|
std::string filepath;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Loader
|