From 271ad42187f73a1a3aa508f5617fae08a1748d67 Mon Sep 17 00:00:00 2001 From: angie Date: Sun, 12 May 2024 13:00:38 -0400 Subject: [PATCH 1/4] stuff --- src/main.cpp | 12 ++++++++++++ src/recompilation.cpp | 1 + 2 files changed, 13 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index ed5be02..833d278 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -505,6 +505,9 @@ std::unordered_set ignored_funcs { "__divdi3", "__udivdi3", "__umoddi3", + "div64_64", + "div64_32", + "__moddi3", // ido math routines "__ll_div", "__ll_lshift", @@ -543,6 +546,7 @@ std::unordered_set renamed_funcs{ "sqrtf", "memcpy", "memset", + "memmove", "strcmp", "strcat", "strcpy", @@ -562,6 +566,8 @@ std::unordered_set renamed_funcs{ "floor", "floorf", "fmodf", + "fmod", + "modf", "lround", "lroundf", "nearbyint", @@ -575,6 +581,8 @@ std::unordered_set renamed_funcs{ "malloc", "free", "realloc", + "rand", + "srand", }; bool read_symbols(RecompPort::Context& context, const ELFIO::elfio& elf_file, ELFIO::section* symtab_section, uint32_t entrypoint, bool has_entrypoint, bool use_absolute_symbols) { @@ -1249,6 +1257,8 @@ int main(int argc, char** argv) { std::ofstream func_header_file{ config.output_func_path / "funcs.h" }; fmt::print(func_header_file, + "#ifndef __RECOMPED_FUNCS_H__\n" + "#define __RECOMPED_FUNCS_H__\n" "#include \"recomp.h\"\n" "\n" "#ifdef __cplusplus\n" @@ -1453,6 +1463,8 @@ int main(int argc, char** argv) { "#ifdef __cplusplus\n" "}}\n" "#endif\n" + "\n" + "#endif\n" ); { diff --git a/src/recompilation.cpp b/src/recompilation.cpp index 8c5bf4e..87fba47 100644 --- a/src/recompilation.cpp +++ b/src/recompilation.cpp @@ -1067,6 +1067,7 @@ bool RecompPort::recompile_function(const RecompPort::Context& context, const Re // Write the file header fmt::print(output_file, "#include \"recomp.h\"\n" + "#include \"funcs.h\"\n" "#include \"disable_warnings.h\"\n" "\n"); } From cdaf6ba3a7689868a65c72e9528a1dcd214c087b Mon Sep 17 00:00:00 2001 From: Angie Date: Sun, 12 May 2024 21:55:40 -0400 Subject: [PATCH 2/4] more funcs --- src/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 833d278..3dde52e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -583,6 +583,10 @@ std::unordered_set renamed_funcs{ "realloc", "rand", "srand", + "random", + "gcvt", + "fcvt", + "ecvt", }; bool read_symbols(RecompPort::Context& context, const ELFIO::elfio& elf_file, ELFIO::section* symtab_section, uint32_t entrypoint, bool has_entrypoint, bool use_absolute_symbols) { From 706a1935d49e7b65c51e35b36a65f1cc974608c3 Mon Sep 17 00:00:00 2001 From: Angie Date: Mon, 13 May 2024 23:07:28 -0400 Subject: [PATCH 3/4] Add more functions --- src/main.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3dde52e..5cf14ed 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -537,13 +537,21 @@ std::unordered_set ignored_funcs { }; std::unordered_set renamed_funcs{ + // Math "sincosf", "sinf", "cosf", "__sinf", "__cosf", + "asinf", + "acosf", + "atanf", + "atan2f", + "tanf", "sqrt", "sqrtf", + + // Memory "memcpy", "memset", "memmove", @@ -557,8 +565,12 @@ std::unordered_set renamed_funcs{ "bzero", "bcopy", "bcmp", + + // long jumps "setjmp", "longjmp", + + // Math 2 "ldiv", "lldiv", "ceil", @@ -576,17 +588,43 @@ std::unordered_set renamed_funcs{ "roundf", "trunc", "truncf", + + // printf family "vsprintf", - "__assert", - "malloc", - "free", - "realloc", - "rand", - "srand", - "random", "gcvt", "fcvt", "ecvt", + + "__assert", + + // allocations + "malloc", + "free", + "realloc", + "calloc", + + // rand + "rand", + "srand", + "random", + + // gzip + "huft_build", + "huft_free", + "inflate_codes", + "inflate_stored", + "inflate_fixed", + "inflate_dynamic", + "inflate_block", + "inflate", + "expand_gzip", + "auRomDataRead" + "data_write", + "unzip", + "updcrc", + "clear_bufs", + "fill_inbuf", + "flush_window", }; bool read_symbols(RecompPort::Context& context, const ELFIO::elfio& elf_file, ELFIO::section* symtab_section, uint32_t entrypoint, bool has_entrypoint, bool use_absolute_symbols) { From 0d22dfa21f5bc4dcade7b2354c829bd54183b0a8 Mon Sep 17 00:00:00 2001 From: angie Date: Tue, 14 May 2024 10:28:38 -0400 Subject: [PATCH 4/4] Add memcmp --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index 5cf14ed..562e260 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -555,6 +555,7 @@ std::unordered_set renamed_funcs{ "memcpy", "memset", "memmove", + "memcmp", "strcmp", "strcat", "strcpy",