2020-09-13 21:32:55 -04:00
|
|
|
#pragma once
|
|
|
|
|
2020-08-22 23:30:17 -04:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <unordered_set>
|
2020-12-17 15:48:07 -05:00
|
|
|
#include <unordered_map>
|
2021-02-27 14:40:18 -05:00
|
|
|
#include <optional>
|
2020-12-17 15:48:07 -05:00
|
|
|
#include "decompiler/Disasm/Register.h"
|
|
|
|
|
2021-01-06 20:04:15 -05:00
|
|
|
namespace decompiler {
|
2020-12-17 15:48:07 -05:00
|
|
|
struct TypeHint {
|
|
|
|
Register reg;
|
|
|
|
std::string type_name;
|
|
|
|
};
|
2020-08-22 23:30:17 -04:00
|
|
|
|
2021-02-20 11:42:46 -05:00
|
|
|
struct LabelType {
|
|
|
|
std::string type_name;
|
|
|
|
bool is_const = false;
|
2021-02-27 14:40:18 -05:00
|
|
|
std::optional<int> array_size;
|
2021-02-20 11:42:46 -05:00
|
|
|
};
|
|
|
|
|
2020-08-22 23:30:17 -04:00
|
|
|
struct Config {
|
|
|
|
int game_version = -1;
|
|
|
|
std::vector<std::string> dgo_names;
|
2020-11-19 21:22:16 -05:00
|
|
|
std::vector<std::string> object_file_names;
|
2020-11-21 15:58:51 -05:00
|
|
|
std::vector<std::string> str_file_names;
|
2020-10-24 22:51:40 -04:00
|
|
|
std::unordered_set<std::string> bad_inspect_types;
|
2020-10-24 14:27:50 -04:00
|
|
|
std::string obj_file_name_map_file;
|
2020-08-22 23:30:17 -04:00
|
|
|
bool write_disassembly = false;
|
|
|
|
bool write_hexdump = false;
|
|
|
|
bool write_scripts = false;
|
|
|
|
bool write_hexdump_on_v3_only = false;
|
|
|
|
bool disassemble_objects_without_functions = false;
|
|
|
|
bool write_hex_near_instructions = false;
|
2020-11-16 19:57:45 -05:00
|
|
|
bool analyze_functions = false;
|
|
|
|
bool process_tpages = false;
|
2020-11-19 21:22:16 -05:00
|
|
|
bool process_game_text = false;
|
2020-11-24 20:48:38 -05:00
|
|
|
bool process_game_count = false;
|
|
|
|
bool dump_objs = false;
|
2020-11-27 16:38:36 -05:00
|
|
|
bool write_func_json = false;
|
2020-11-28 15:35:38 -05:00
|
|
|
bool function_type_prop = false;
|
2020-12-17 15:48:07 -05:00
|
|
|
bool analyze_expressions = false;
|
2020-08-22 23:30:17 -04:00
|
|
|
std::unordered_set<std::string> asm_functions_by_name;
|
2020-11-28 15:35:38 -05:00
|
|
|
std::unordered_set<std::string> pair_functions_by_name;
|
2020-12-17 15:48:07 -05:00
|
|
|
std::unordered_set<std::string> no_type_analysis_functions_by_name;
|
2021-02-01 20:41:37 -05:00
|
|
|
std::unordered_set<std::string> allowed_objects;
|
2020-12-17 15:48:07 -05:00
|
|
|
std::unordered_map<std::string, std::unordered_map<int, std::vector<TypeHint>>>
|
|
|
|
type_hints_by_function_by_idx;
|
2020-12-26 11:09:59 -05:00
|
|
|
std::unordered_map<std::string, std::unordered_map<int, std::string>>
|
|
|
|
anon_function_types_by_obj_by_id;
|
2021-02-09 20:59:14 -05:00
|
|
|
std::unordered_map<std::string, std::vector<std::string>> function_arg_names;
|
|
|
|
std::unordered_map<std::string, std::unordered_map<std::string, std::string>> function_var_names;
|
2021-02-20 11:42:46 -05:00
|
|
|
|
|
|
|
std::unordered_map<std::string, std::unordered_map<std::string, LabelType>> label_types;
|
2021-01-09 20:01:48 -05:00
|
|
|
bool run_ir2 = false;
|
2020-08-22 23:30:17 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Config& get_config();
|
|
|
|
void set_config(const std::string& path_to_config_file);
|
2021-01-06 20:04:15 -05:00
|
|
|
} // namespace decompiler
|