Files
PS2Recomp/ps2xRecomp/include/ps2recomp/ps2_recompiler.h
T
M. Sami Gürpınar c218c64348 Made member methods const (#34)
* refactor: update function name checks to use contains method

* refactor: update code generation to use static_cast

* refactor: made member methods const

* refactor: made range-based loop

* refactor: make one variable constructor explicit

* refactor: remove redundant else

* refactor: turn includes to forward declarations

* refactor: brace placements turned into allman style
2026-01-31 13:14:56 -03:00

61 lines
1.9 KiB
C++

#ifndef PS2RECOMP_PS2_RECOMPILER_H
#define PS2RECOMP_PS2_RECOMPILER_H
#include "code_generator.h"
#include "config_manager.h"
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <filesystem>
namespace ps2recomp
{
class R5900Decoder;
class ElfParser;
class PS2Recompiler
{
public:
explicit PS2Recompiler(const std::string &configPath);
~PS2Recompiler();
bool initialize();
bool recompile();
void generateOutput();
private:
ConfigManager m_configManager;
std::unique_ptr<ElfParser> m_elfParser;
std::unique_ptr<R5900Decoder> m_decoder;
std::unique_ptr<CodeGenerator> m_codeGenerator;
RecompilerConfig m_config;
std::vector<Function> m_functions;
std::vector<Symbol> m_symbols;
std::vector<Section> m_sections;
std::vector<Relocation> m_relocations;
std::unordered_map<uint32_t, std::vector<Instruction>> m_decodedFunctions;
std::unordered_map<std::string, bool> m_skipFunctions;
std::unordered_set<std::string> m_stubFunctions;
std::map<uint32_t, std::string> m_generatedStubs;
std::unordered_map<uint32_t, std::string> m_functionRenames;
CodeGenerator::BootstrapInfo m_bootstrapInfo;
bool decodeFunction(Function &function);
void discoverAdditionalEntryPoints();
bool shouldSkipFunction(const std::string &name) const;
bool isStubFunction(const std::string &name) const;
std::string generateRuntimeHeader() const;
bool generateFunctionHeader();
bool generateStubHeader();
bool writeToFile(const std::string &path, const std::string &content);
std::filesystem::path getOutputPath(const Function &function) const;
std::string sanitizeFunctionName(const std::string &name) const;
};
}
#endif