mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-30 18:30:51 +00:00
672bcbae01
this PR reworks IPS parser to be less stupid what do i mean by this? well generally give it a bit of love so it doesn't do a lot of unsound allocations also simplify the logic greatly (and use memcmp() string idiom instead of trusting the compiler so blindly...) no this doesn't mean to uber optimize IPS to handle 999 gb/s it's more so it doesn't outright crash with edge cases as the previous codebase was quite spaghetty also the major overhead is obviously the vector shenanigans and the I/O -- but thats out of scope Test that IPSwitch mods still properly work WITH ANY GAME IF THERE IS ANY REGRESSION IN SOME GAME/MOD THEN TELL ME Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3911 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
40 lines
919 B
C++
40 lines
919 B
C++
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
#include <vector>
|
|
#include <span>
|
|
|
|
#include "common/common_types.h"
|
|
#include "core/file_sys/vfs/vfs.h"
|
|
|
|
namespace FileSys {
|
|
|
|
VirtualFile PatchIPS(const VirtualFile& in, const VirtualFile& ips);
|
|
|
|
class IPSwitchCompiler {
|
|
public:
|
|
explicit IPSwitchCompiler(VirtualFile patch_text);
|
|
~IPSwitchCompiler();
|
|
|
|
std::array<u8, 0x20> GetBuildID() const;
|
|
VirtualFile Apply(const VirtualFile& in) const;
|
|
|
|
private:
|
|
struct IPSwitchPatch;
|
|
|
|
void ParseFlag(const std::string& flag);
|
|
void Parse(std::span<u8 const> bytes);
|
|
|
|
VirtualFile patch_text;
|
|
std::vector<IPSwitchPatch> patches;
|
|
std::array<u8, 0x20> nso_build_id{};
|
|
};
|
|
|
|
} // namespace FileSys
|