mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
99ceb03a1c
This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
62 lines
1.5 KiB
C++
62 lines
1.5 KiB
C++
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "common/common_types.h"
|
|
#include "core/loader/loader.h"
|
|
|
|
namespace Core {
|
|
class System;
|
|
}
|
|
|
|
namespace FileSys {
|
|
class NACP;
|
|
}
|
|
|
|
namespace Kernel {
|
|
class KProcess;
|
|
}
|
|
|
|
namespace Loader {
|
|
|
|
/// Loads an NRO file
|
|
class AppLoader_NRO final : public AppLoader {
|
|
public:
|
|
explicit AppLoader_NRO(FileSys::VirtualFile file_);
|
|
~AppLoader_NRO() override;
|
|
|
|
/**
|
|
* Identifies whether or not the given file is an NRO file.
|
|
*
|
|
* @param nro_file The file to identify.
|
|
*
|
|
* @return FileType::NRO, or FileType::Error if the file is not an NRO file.
|
|
*/
|
|
static FileType IdentifyType(const FileSys::VirtualFile& nro_file);
|
|
|
|
FileType GetFileType() const override {
|
|
return IdentifyType(file);
|
|
}
|
|
|
|
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
|
|
|
ResultStatus ReadIcon(std::vector<u8>& buffer) override;
|
|
ResultStatus ReadProgramId(u64& out_program_id) override;
|
|
ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override;
|
|
ResultStatus ReadTitle(std::string& title) override;
|
|
ResultStatus ReadControlData(FileSys::NACP& control) override;
|
|
bool IsRomFSUpdatable() const override;
|
|
|
|
private:
|
|
bool LoadNro(Kernel::KProcess& process, const FileSys::VfsFile& nro_file);
|
|
|
|
std::vector<u8> icon_data;
|
|
std::unique_ptr<FileSys::NACP> nacp;
|
|
FileSys::VirtualFile romfs;
|
|
};
|
|
|
|
} // namespace Loader
|