2022-04-23 11:59:50 +03:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-08-17 00:02:31 +03:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "core/loader/loader.h"
|
2018-08-19 04:16:20 +03:00
|
|
|
|
2020-09-16 15:19:25 +03:00
|
|
|
namespace Core {
|
|
|
|
class System;
|
|
|
|
}
|
2018-08-19 04:16:20 +03:00
|
|
|
|
2020-09-16 15:19:25 +03:00
|
|
|
namespace FileSys {
|
2018-08-19 04:16:20 +03:00
|
|
|
class NAX;
|
|
|
|
} // namespace FileSys
|
2018-08-17 00:02:31 +03:00
|
|
|
|
|
|
|
namespace Loader {
|
|
|
|
|
2018-08-19 04:16:20 +03:00
|
|
|
class AppLoader_NCA;
|
|
|
|
|
2018-08-17 00:02:31 +03:00
|
|
|
/// Loads a NAX file
|
|
|
|
class AppLoader_NAX final : public AppLoader {
|
|
|
|
public:
|
2021-04-27 19:05:34 +03:00
|
|
|
explicit AppLoader_NAX(FileSys::VirtualFile file_);
|
2018-08-19 04:16:20 +03:00
|
|
|
~AppLoader_NAX() override;
|
2018-08-17 00:02:31 +03:00
|
|
|
|
|
|
|
/**
|
2021-04-27 19:05:34 +03:00
|
|
|
* Identifies whether or not the given file is a NAX file.
|
|
|
|
*
|
|
|
|
* @param nax_file The file to identify.
|
|
|
|
*
|
|
|
|
* @return FileType::NAX, or FileType::Error if the file is not a NAX file.
|
2018-08-17 00:02:31 +03:00
|
|
|
*/
|
2021-04-27 19:05:34 +03:00
|
|
|
static FileType IdentifyType(const FileSys::VirtualFile& nax_file);
|
2018-08-17 00:02:31 +03:00
|
|
|
|
2018-12-06 01:42:41 +03:00
|
|
|
FileType GetFileType() const override;
|
2018-08-17 00:02:31 +03:00
|
|
|
|
2021-04-24 08:04:28 +03:00
|
|
|
LoadResult Load(Kernel::KProcess& process, Core::System& system) override;
|
2018-08-17 00:02:31 +03:00
|
|
|
|
|
|
|
ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override;
|
2018-09-25 16:17:14 +03:00
|
|
|
u64 ReadRomFSIVFCOffset() const override;
|
2018-08-17 00:02:31 +03:00
|
|
|
ResultStatus ReadProgramId(u64& out_program_id) override;
|
|
|
|
|
2019-01-15 23:56:52 +03:00
|
|
|
ResultStatus ReadBanner(std::vector<u8>& buffer) override;
|
|
|
|
ResultStatus ReadLogo(std::vector<u8>& buffer) override;
|
|
|
|
|
2019-05-26 18:40:41 +03:00
|
|
|
ResultStatus ReadNSOModules(Modules& modules) override;
|
|
|
|
|
2018-08-17 00:02:31 +03:00
|
|
|
private:
|
|
|
|
std::unique_ptr<FileSys::NAX> nax;
|
|
|
|
std::unique_ptr<AppLoader_NCA> nca_loader;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Loader
|