2022-06-25 21:26:15 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
2022-08-05 17:39:32 -04:00
|
|
|
#include <decompiler/ObjectFile/ObjectFileDB.h>
|
2022-06-25 21:26:15 -04:00
|
|
|
#include "decompiler/Function/Function.h"
|
|
|
|
#include "decompiler/util/DecompilerTypeSystem.h"
|
|
|
|
|
|
|
|
namespace decompiler {
|
|
|
|
|
2022-07-05 15:30:42 -04:00
|
|
|
struct TypeInspectorResult {
|
|
|
|
bool success = false;
|
|
|
|
int type_size = -1;
|
|
|
|
int type_method_count = -1;
|
|
|
|
int parent_method_count = 9;
|
2022-08-05 17:39:32 -04:00
|
|
|
std::optional<int> type_heap_base = {};
|
2022-07-05 15:30:42 -04:00
|
|
|
|
|
|
|
std::string warnings;
|
|
|
|
std::vector<Field> fields_of_type;
|
|
|
|
bool is_basic = false;
|
|
|
|
bool found_flags = false;
|
|
|
|
|
|
|
|
std::string type_name;
|
|
|
|
std::string parent_type_name;
|
2022-08-05 17:39:32 -04:00
|
|
|
u64 flags;
|
2022-07-05 15:30:42 -04:00
|
|
|
|
|
|
|
std::string print_as_deftype(
|
|
|
|
StructureType* old_game_type,
|
2022-08-05 17:39:32 -04:00
|
|
|
std::unordered_map<std::string, TypeInspectorResult>& previous_results,
|
|
|
|
DecompilerTypeSystem& previous_game_ts,
|
|
|
|
ObjectFileDB::PerObjectAllTypeInfo& object_file_meta);
|
2022-07-05 15:30:42 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TypeInspectorCache {
|
|
|
|
std::unordered_map<std::string, TypeInspectorResult> previous_results;
|
|
|
|
};
|
|
|
|
|
2022-06-25 21:26:15 -04:00
|
|
|
std::string inspect_inspect_method(Function& inspect_method,
|
|
|
|
const std::string& type_name,
|
|
|
|
DecompilerTypeSystem& dts,
|
|
|
|
LinkedObjectFile& file,
|
2022-08-05 17:39:32 -04:00
|
|
|
DecompilerTypeSystem& previous_game_ts,
|
|
|
|
TypeInspectorCache& ti_cache,
|
|
|
|
ObjectFileDB::PerObjectAllTypeInfo& object_file_meta);
|
2022-06-25 21:26:15 -04:00
|
|
|
|
2022-08-06 12:17:24 -04:00
|
|
|
void inspect_top_level_for_metadata(Function& top_level,
|
|
|
|
LinkedObjectFile& file,
|
|
|
|
DecompilerTypeSystem& dts,
|
|
|
|
DecompilerTypeSystem& previous_game_ts,
|
|
|
|
ObjectFileDB::PerObjectAllTypeInfo& object_file_meta);
|
2022-08-05 17:39:32 -04:00
|
|
|
|
|
|
|
std::string inspect_top_level_symbol_defines(Function& top_level,
|
2022-06-25 21:26:15 -04:00
|
|
|
LinkedObjectFile& file,
|
|
|
|
DecompilerTypeSystem& dts,
|
2022-08-05 17:39:32 -04:00
|
|
|
DecompilerTypeSystem& previous_game_ts,
|
|
|
|
ObjectFileDB::PerObjectAllTypeInfo& object_file_meta);
|
2022-06-25 21:26:15 -04:00
|
|
|
|
2022-08-05 17:39:32 -04:00
|
|
|
} // namespace decompiler
|