mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-10-08 20:21:02 -04:00
Feature/better analyzer v1 (#39)
* feat: pin dependencies * feat: dwarf parse * fix duplicated functions * feat: small code cleanup * feat: crash prevent * feat: modernize code * feat: split m_libFunctions from m_knownLibNames * feat: added ghidra loader * feat: auto bootstrap name for recompiler
This commit is contained in:
@@ -29,6 +29,7 @@ namespace ps2recomp
|
||||
uint32_t bssStart = 0;
|
||||
uint32_t bssEnd = 0;
|
||||
uint32_t gp = 0;
|
||||
std::string entryName;
|
||||
};
|
||||
|
||||
std::string generateFunction(const Function &function, const std::vector<Instruction> &instructions, const bool &useHeaders);
|
||||
@@ -121,8 +122,8 @@ namespace ps2recomp
|
||||
const std::vector<JumpTableEntry> &entries);
|
||||
std::string generateBootstrapFunction() const;
|
||||
|
||||
Symbol *findSymbolByAddress(uint32_t address);
|
||||
std::string getFunctionName(uint32_t address);
|
||||
const Symbol *findSymbolByAddress(uint32_t address) const;
|
||||
std::string getFunctionName(uint32_t address) const;
|
||||
std::string getGeneratedFunctionName(const Function &function);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
|
||||
namespace ps2recomp
|
||||
{
|
||||
|
||||
class ConfigManager
|
||||
{
|
||||
public:
|
||||
explicit ConfigManager(const std::string &configPath);
|
||||
explicit ConfigManager(const std::string &configPath);
|
||||
~ConfigManager();
|
||||
|
||||
RecompilerConfig loadConfig() const;
|
||||
|
||||
@@ -8,46 +8,50 @@
|
||||
|
||||
namespace ps2recomp
|
||||
{
|
||||
struct Relocation;
|
||||
struct Section;
|
||||
struct Function;
|
||||
struct Symbol;
|
||||
struct Relocation;
|
||||
struct Section;
|
||||
struct Function;
|
||||
struct Symbol;
|
||||
|
||||
class ElfParser
|
||||
{
|
||||
public:
|
||||
explicit ElfParser(const std::string &filePath);
|
||||
~ElfParser();
|
||||
class ElfParser
|
||||
{
|
||||
public:
|
||||
explicit ElfParser(const std::string &filePath);
|
||||
~ElfParser();
|
||||
|
||||
bool parse();
|
||||
bool parse();
|
||||
|
||||
std::vector<Function> extractFunctions() const;
|
||||
std::vector<Symbol> extractSymbols();
|
||||
std::vector<Section> getSections();
|
||||
std::vector<Relocation> getRelocations();
|
||||
bool loadGhidraFunctionMap(const std::string &mapPath);
|
||||
std::vector<Function> extractFunctions() const;
|
||||
std::vector<Function> extractExtraFunctions() const;
|
||||
std::vector<Symbol> extractSymbols();
|
||||
std::vector<Section> getSections();
|
||||
std::vector<Relocation> getRelocations();
|
||||
|
||||
// Helper methods
|
||||
bool isValidAddress(uint32_t address) const;
|
||||
uint32_t readWord(uint32_t address) const;
|
||||
uint8_t *getSectionData(const std::string §ionName) const;
|
||||
uint32_t getSectionAddress(const std::string §ionName) const;
|
||||
uint32_t getSectionSize(const std::string §ionName) const;
|
||||
uint32_t getEntryPoint() const;
|
||||
// Helper methods
|
||||
bool isValidAddress(uint32_t address) const;
|
||||
uint32_t readWord(uint32_t address) const;
|
||||
uint8_t *getSectionData(const std::string §ionName) const;
|
||||
uint32_t getSectionAddress(const std::string §ionName) const;
|
||||
uint32_t getSectionSize(const std::string §ionName) const;
|
||||
uint32_t getEntryPoint() const;
|
||||
|
||||
private:
|
||||
std::string m_filePath;
|
||||
std::unique_ptr<ELFIO::elfio> m_elf;
|
||||
private:
|
||||
std::string m_filePath;
|
||||
std::unique_ptr<ELFIO::elfio> m_elf;
|
||||
|
||||
std::vector<Section> m_sections;
|
||||
std::vector<Symbol> m_symbols;
|
||||
std::vector<Relocation> m_relocations;
|
||||
std::vector<Section> m_sections;
|
||||
std::vector<Symbol> m_symbols;
|
||||
std::vector<Relocation> m_relocations;
|
||||
std::vector<Function> m_extraFunctions;
|
||||
|
||||
void loadSections();
|
||||
void loadSymbols();
|
||||
void loadRelocations();
|
||||
bool isExecutableSection(const ELFIO::section *section) const;
|
||||
bool isDataSection(const ELFIO::section *section) const;
|
||||
};
|
||||
void loadSections();
|
||||
void loadSymbols();
|
||||
void loadRelocations();
|
||||
void loadDebugFunctions();
|
||||
bool isExecutableSection(const ELFIO::section *section) const;
|
||||
bool isDataSection(const ELFIO::section *section) const;
|
||||
};
|
||||
|
||||
} // namespace ps2recomp
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ namespace ps2recomp
|
||||
{
|
||||
std::string inputPath;
|
||||
std::string outputPath;
|
||||
std::string ghidraMapPath;
|
||||
bool singleFileOutput;
|
||||
std::vector<std::string> skipFunctions;
|
||||
std::unordered_map<uint32_t, std::string> patches;
|
||||
|
||||
Reference in New Issue
Block a user