mirror of
https://github.com/N64Recomp/N64Recomp.git
synced 2026-07-15 08:12:01 -05:00
* Initial implementation of binary operation table * Initial implementation of unary operation table * More binary op types, moved binary expression string generation into separate function * Added and implemented conditional branch instruction table * Fixed likely swap on bgezal, fixed extra indent branch close and missing indent on branch statement * Add operands for other uses of float registers * Added CHECK_FR generation to binary operation processing, moved float comparison instructions to binary op table * Finished moving float arithmetic instructions to operation tables * Added store instruction operation table * Created Generator interface, separated operation types and tables and C generation code into new files * Fix mov.d using the wrong input operand * Move recompiler core logic into a core library and make the existing CLI consume the core library * Removed unnecessary config input to recompilation functions * Moved parts of recomp_port.h into new internal headers in src folder * Changed recomp port naming to N64Recomp * Remove some unused code and document which Context fields are actually required for recompilation * Implement mod symbol parsing * Restructure mod symbols to make replacements global instead of per-section * Refactor elf parsing into static Context method for reusability * Move elf parsing into a separate library * WIP elf to mod tool, currently working without relocations or API exports/imports * Make mod tool emit relocs and patch binary for non-relocatable symbol references as needed * Implemented writing import and exports in the mod tool * Add dependencies to the mod symbol format, finish exporting and importing of mod symbols * Add first pass offline mod recompiler (generates C from mods that can be compiled and linked into a dynamic library) * Add strict mode and ability to generate exports for normal recompilation (for patches) * Move mod context fields into base context, move import symbols into separate vector, misc cleanup * Some cleanup by making some Context members private * Add events (from dependencies and exported) and callbacks to the mod symbol format and add support to them in elf parsing * Add runtime-driven fields to offline mod recompiler, fix event symbol relocs using the wrong section in the mod tool * Move file header writing outside of function recompilation * Allow cross-section relocations, encode exact target section in mod relocations, add way to tag reference symbol relocations * Add local symbol addresses array to offline mod recompiler output and rename original one to reference section addresses * Add more comments to the offline mod recompiler's output * Fix handling of section load addresses to match objcopy behavior, added event parsing to dependency tomls, minor cleanup * Fixed incorrect size used for finding section segments * Add missing includes for libstdc++ * Rework callbacks and imports to use the section name for identifying the dependency instead of relying on per-dependency tomls
72 lines
2.2 KiB
C++
72 lines
2.2 KiB
C++
#ifndef __RECOMP_CONFIG_H__
|
|
#define __RECOMP_CONFIG_H__
|
|
|
|
#include <cstdint>
|
|
#include <filesystem>
|
|
#include <vector>
|
|
|
|
namespace N64Recomp {
|
|
struct InstructionPatch {
|
|
std::string func_name;
|
|
int32_t vram;
|
|
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;
|
|
|
|
FunctionSize(const std::string& func_name, uint32_t size_bytes) : func_name(std::move(func_name)), size_bytes(size_bytes) {}
|
|
};
|
|
|
|
struct ManualFunction {
|
|
std::string func_name;
|
|
std::string section_name;
|
|
uint32_t vram;
|
|
uint32_t size;
|
|
|
|
ManualFunction(const std::string& func_name, std::string section_name, uint32_t vram, uint32_t size) : func_name(std::move(func_name)), section_name(std::move(section_name)), vram(vram), size(size) {}
|
|
};
|
|
|
|
struct Config {
|
|
int32_t entrypoint;
|
|
int32_t functions_per_output_file;
|
|
bool has_entrypoint;
|
|
bool uses_mips3_float_mode;
|
|
bool single_file_output;
|
|
bool use_absolute_symbols;
|
|
bool unpaired_lo16_warnings;
|
|
bool allow_exports;
|
|
bool strict_patch_mode;
|
|
std::filesystem::path elf_path;
|
|
std::filesystem::path symbols_file_path;
|
|
std::filesystem::path func_reference_syms_file_path;
|
|
std::vector<std::filesystem::path> data_reference_syms_file_paths;
|
|
std::filesystem::path rom_file_path;
|
|
std::filesystem::path output_func_path;
|
|
std::filesystem::path relocatable_sections_path;
|
|
std::filesystem::path output_binary_path;
|
|
std::vector<std::string> stubbed_funcs;
|
|
std::vector<std::string> ignored_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;
|
|
std::string recomp_include;
|
|
|
|
Config(const char* path);
|
|
bool good() { return !bad; }
|
|
private:
|
|
bool bad;
|
|
};
|
|
}
|
|
|
|
#endif
|