mirror of
https://github.com/open-goal/jak-project
synced 2026-09-06 19:21:00 -04:00
[decompiler/compiler] Fixes for task-control (#668)
* fix decompiler for task control * support in compiler * changelog * typo
This commit is contained in:
@@ -104,7 +104,11 @@ Function& LinkedObjectFile::get_function_at_label(int label_id) {
|
||||
* Get the function starting at this label, or nullptr if there is none.
|
||||
*/
|
||||
const Function* LinkedObjectFile::try_get_function_at_label(int label_id) const {
|
||||
auto& label = labels.at(label_id);
|
||||
const auto& label = labels.at(label_id);
|
||||
return try_get_function_at_label(label);
|
||||
}
|
||||
|
||||
const Function* LinkedObjectFile::try_get_function_at_label(const DecompilerLabel& label) const {
|
||||
for (auto& func : functions_by_seg.at(label.target_segment)) {
|
||||
// + 4 to skip past type tag to the first word, which is were the label points.
|
||||
if (func.start_word * 4 + 4 == label.offset) {
|
||||
|
||||
@@ -40,6 +40,7 @@ class LinkedObjectFile {
|
||||
void symbol_link_offset(int source_segment, int source_offset, const char* name);
|
||||
Function& get_function_at_label(int label_id);
|
||||
const Function* try_get_function_at_label(int label_id) const;
|
||||
const Function* try_get_function_at_label(const DecompilerLabel& label) const;
|
||||
std::string get_label_name(int label_id) const;
|
||||
uint32_t set_ordered_label_names();
|
||||
void find_code();
|
||||
|
||||
@@ -160,6 +160,8 @@ ObjectFileDB::ObjectFileDB(const std::vector<std::string>& _dgos,
|
||||
"No object files have been added. Check that there are input files and the allowed_objects "
|
||||
"list.");
|
||||
}
|
||||
|
||||
dts.bad_format_strings = config.bad_format_strings;
|
||||
}
|
||||
|
||||
void ObjectFileDB::load_map_file(const std::string& map_data) {
|
||||
@@ -639,7 +641,7 @@ void ObjectFileDB::analyze_functions_ir1(const Config& config) {
|
||||
|
||||
auto& func = data.linked_data.functions_by_seg.at(2).front();
|
||||
assert(func.guessed_name.empty());
|
||||
func.guessed_name.set_as_top_level();
|
||||
func.guessed_name.set_as_top_level(data.to_unique_name());
|
||||
func.find_global_function_defs(data.linked_data, dts);
|
||||
func.find_type_defs(data.linked_data, dts);
|
||||
func.find_method_defs(data.linked_data, dts);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "decompiler/analysis/expression_build.h"
|
||||
#include "decompiler/analysis/inline_asm_rewrite.h"
|
||||
#include "decompiler/analysis/stack_spill.h"
|
||||
#include "decompiler/analysis/anonymous_function_def.h"
|
||||
#include "decompiler/analysis/static_refs.h"
|
||||
#include "decompiler/analysis/symbol_def_map.h"
|
||||
#include "common/goos/PrettyPrinter.h"
|
||||
#include "decompiler/IR2/Form.h"
|
||||
@@ -96,7 +96,7 @@ void ObjectFileDB::ir2_top_level_pass(const Config& config) {
|
||||
|
||||
auto& func = data.linked_data.functions_by_seg.at(2).front();
|
||||
assert(func.guessed_name.empty());
|
||||
func.guessed_name.set_as_top_level();
|
||||
func.guessed_name.set_as_top_level(data.to_unique_name());
|
||||
func.find_global_function_defs(data.linked_data, dts);
|
||||
func.find_type_defs(data.linked_data, dts);
|
||||
func.find_method_defs(data.linked_data, dts);
|
||||
@@ -602,7 +602,7 @@ void ObjectFileDB::ir2_insert_anonymous_functions() {
|
||||
(void)segment_id;
|
||||
(void)data;
|
||||
if (func.ir2.top_form && func.ir2.env.has_type_analysis()) {
|
||||
total += insert_anonymous_functions(func.ir2.top_form, *func.ir2.form_pool, func, dts);
|
||||
total += insert_static_refs(func.ir2.top_form, *func.ir2.form_pool, func, dts);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user