#pragma once #include "pch.h" struct SwitchTable { size_t r; std::vector labels; }; struct Recompiler { Image image; std::vector functions; std::unordered_map switchTables; std::string out; size_t cppFileIndex = 0; std::vector temp; void LoadSwitchTables(const char* filePath); void LoadExecutable(const char* filePath); template void print(std::format_string fmt, Args&&... args) { std::vformat_to(std::back_inserter(out), fmt.get(), std::make_format_args(args...)); } template void println(std::format_string fmt, Args&&... args) { std::vformat_to(std::back_inserter(out), fmt.get(), std::make_format_args(args...)); out += '\n'; } bool Recompile(const Function& fn, uint32_t base, const ppc_insn& insn, std::unordered_map::iterator& switchTable); bool Recompile(const Function& fn); void Recompile(const char* directoryPath); void SaveCurrentOutData(const char* directoryPath, const std::string_view& name = std::string_view()); };