Implement hook insertion (#73)

* Implement function hook insertion

* Fix recompiled code indentation

* Add _matherr to renamed_funcs

* Replace after_vram by before_vram

* Emit dummy value if relocatable_sections_ordered is empty
This commit is contained in:
Gilles Siberlin 2024-06-01 05:31:50 +02:00 committed by GitHub
parent 5c687ee962
commit 6eb7d5bd3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 440 additions and 330 deletions

View file

@ -40,6 +40,12 @@ namespace RecompPort {
uint32_t value;
};
struct FunctionHook {
std::string func_name;
int32_t before_vram;
std::string text;
};
struct FunctionSize {
std::string func_name;
uint32_t size_bytes;
@ -71,6 +77,7 @@ namespace RecompPort {
std::vector<std::string> ignored_funcs;
DeclaredFunctionMap declared_funcs;
std::vector<InstructionPatch> instruction_patches;
std::vector<FunctionHook> function_hooks;
std::vector<FunctionSize> manual_func_sizes;
std::vector<ManualFunction> manual_functions;
std::string bss_section_suffix;
@ -110,6 +117,7 @@ namespace RecompPort {
bool ignored;
bool reimplemented;
bool stubbed;
std::unordered_map<int32_t, std::string> function_hooks;
Function(uint32_t vram, uint32_t rom, std::vector<uint32_t> words, std::string name, ELFIO::Elf_Half section_index, bool ignored = false, bool reimplemented = false, bool stubbed = false)
: vram(vram), rom(rom), words(std::move(words)), name(std::move(name)), section_index(section_index), ignored(ignored), reimplemented(reimplemented), stubbed(stubbed) {}