mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 16:59:35 -04:00
2d1f7ec07f
feat: added threads inplementation on ps2 syscalls feat: patch entrypoint on recompiler feat: ps2 macros now is part of the runtime feat: use thread to hold game loop feat: sanitize functions like point out by chrisking1981 fix: fix old instructions cast fix: fix missing patch for opcode j
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#ifndef PS2RECOMP_ELF_PARSER_H
|
|
#define PS2RECOMP_ELF_PARSER_H
|
|
|
|
#include "ps2recomp/types.h"
|
|
#include <elfio/elfio.hpp>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
namespace ps2recomp
|
|
{
|
|
|
|
class ElfParser
|
|
{
|
|
public:
|
|
ElfParser(const std::string &filePath);
|
|
~ElfParser();
|
|
|
|
bool parse();
|
|
|
|
std::vector<Function> extractFunctions();
|
|
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);
|
|
uint32_t getSectionAddress(const std::string §ionName);
|
|
uint32_t getSectionSize(const std::string §ionName);
|
|
uint32_t getEntryPoint() const;
|
|
|
|
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;
|
|
|
|
void loadSections();
|
|
void loadSymbols();
|
|
void loadRelocations();
|
|
bool isExecutableSection(const ELFIO::section *section) const;
|
|
bool isDataSection(const ELFIO::section *section) const;
|
|
};
|
|
|
|
} // namespace ps2recomp
|
|
|
|
#endif // PS2RECOMP_ELF_PARSER_H
|