2022-04-23 08:59:50 +00:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-09-30 02:13:15 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-10-09 17:39:23 +00:00
|
|
|
#include <array>
|
2018-09-30 02:13:15 +00:00
|
|
|
#include <memory>
|
2018-10-09 17:39:23 +00:00
|
|
|
#include <vector>
|
2018-09-30 02:13:15 +00:00
|
|
|
|
2018-10-09 17:39:23 +00:00
|
|
|
#include "common/common_types.h"
|
2018-09-30 02:13:15 +00:00
|
|
|
#include "core/file_sys/vfs.h"
|
|
|
|
|
|
|
|
namespace FileSys {
|
|
|
|
|
|
|
|
VirtualFile PatchIPS(const VirtualFile& in, const VirtualFile& ips);
|
|
|
|
|
2018-09-30 22:13:22 +00:00
|
|
|
class IPSwitchCompiler {
|
|
|
|
public:
|
|
|
|
explicit IPSwitchCompiler(VirtualFile patch_text);
|
2018-10-01 21:17:08 +00:00
|
|
|
~IPSwitchCompiler();
|
|
|
|
|
2018-09-30 22:13:22 +00:00
|
|
|
std::array<u8, 0x20> GetBuildID() const;
|
|
|
|
bool IsValid() const;
|
|
|
|
VirtualFile Apply(const VirtualFile& in) const;
|
|
|
|
|
|
|
|
private:
|
2018-10-09 17:39:23 +00:00
|
|
|
struct IPSwitchPatch;
|
|
|
|
|
2018-10-04 16:23:18 +00:00
|
|
|
void ParseFlag(const std::string& flag);
|
2018-09-30 22:13:22 +00:00
|
|
|
void Parse();
|
|
|
|
|
2018-10-01 21:17:08 +00:00
|
|
|
bool valid = false;
|
2018-09-30 22:13:22 +00:00
|
|
|
|
|
|
|
VirtualFile patch_text;
|
|
|
|
std::vector<IPSwitchPatch> patches;
|
2018-10-01 21:17:08 +00:00
|
|
|
std::array<u8, 0x20> nso_build_id{};
|
|
|
|
bool is_little_endian = false;
|
|
|
|
s64 offset_shift = 0;
|
|
|
|
bool print_values = false;
|
|
|
|
std::string last_comment = "";
|
2018-09-30 22:13:22 +00:00
|
|
|
};
|
|
|
|
|
2018-09-30 02:13:15 +00:00
|
|
|
} // namespace FileSys
|