refactor re_mode to function_trace_mode

This commit is contained in:
LittleCube 2024-12-23 23:09:18 -05:00
parent 7e04b95d71
commit da5ec4c824
5 changed files with 9 additions and 9 deletions

View file

@ -217,7 +217,7 @@ namespace N64Recomp {
std::vector<EventSymbol> event_symbols; std::vector<EventSymbol> event_symbols;
// Causes functions to print their name to the console the first time they're called. // Causes functions to print their name to the console the first time they're called.
bool re_mode; bool function_trace_mode;
// Imports sections and function symbols from a provided context into this context's reference sections and reference functions. // Imports sections and function symbols from a provided context into this context's reference sections and reference functions.
bool import_reference_context(const Context& reference_context); bool import_reference_context(const Context& reference_context);

View file

@ -414,15 +414,15 @@ N64Recomp::Config::Config(const char* path) {
} }
// Use RE mode if enabled (optional) // Use RE mode if enabled (optional)
std::optional<bool> re_mode_opt = input_data["re_mode"].value<bool>(); std::optional<bool> function_trace_mode_opt = input_data["function_trace_mode"].value<bool>();
if (re_mode_opt.has_value()) { if (function_trace_mode_opt.has_value()) {
re_mode = re_mode_opt.value(); function_trace_mode = function_trace_mode_opt.value();
if (re_mode) { if (function_trace_mode) {
recomp_include += "\n#include <stdio.h>\n#include <stdlib.h>"; recomp_include += "\n#include <stdio.h>\n#include <stdlib.h>";
} }
} }
else { else {
re_mode = false; function_trace_mode = false;
} }
// Function reference symbols file (optional) // Function reference symbols file (optional)

View file

@ -42,7 +42,7 @@ namespace N64Recomp {
bool single_file_output; bool single_file_output;
bool use_absolute_symbols; bool use_absolute_symbols;
bool unpaired_lo16_warnings; bool unpaired_lo16_warnings;
bool re_mode; bool function_trace_mode;
bool allow_exports; bool allow_exports;
bool strict_patch_mode; bool strict_patch_mode;
std::filesystem::path elf_path; std::filesystem::path elf_path;

View file

@ -509,7 +509,7 @@ int main(int argc, char** argv) {
} }
// Propogate the re_mode parameter. // Propogate the re_mode parameter.
context.re_mode = config.re_mode; context.function_trace_mode = config.function_trace_mode;
// Apply any single-instruction patches. // Apply any single-instruction patches.
for (const N64Recomp::InstructionPatch& patch : config.instruction_patches) { for (const N64Recomp::InstructionPatch& patch : config.instruction_patches) {

View file

@ -745,7 +745,7 @@ bool N64Recomp::recompile_function(const N64Recomp::Context& context, const N64R
" int c1cs = 0;\n", // cop1 conditional signal " int c1cs = 0;\n", // cop1 conditional signal
func.name); func.name);
if (context.re_mode) { if (context.function_trace_mode) {
fmt::print(output_file, fmt::print(output_file,
" static int {0}_was_called = 0;\n" " static int {0}_was_called = 0;\n"
" if ({0}_was_called == 0) {{\n" " if ({0}_was_called == 0) {{\n"