diff --git a/.vs/launch.vs.json b/.vs/launch.vs.json index d44c9fd7ea..fe373a718f 100644 --- a/.vs/launch.vs.json +++ b/.vs/launch.vs.json @@ -56,6 +56,20 @@ "jak1" ] }, + { + "type": "default", + "project": "CMakeLists.txt", + "projectTarget": "offline-test.exe (bin\\offline-test.exe)", + "name": "Tests - Offline Tests - Jak 2 - Specific File", + "args": [ + "--iso_data_path", + "${workspaceRoot}/iso_data/jak2", + "--game", + "jak2", + "--file", + "progress-static" + ] + }, { "type": "default", "project": "CMakeLists.txt", diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 7515d922df..b6d5fc20e9 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -29087,10 +29087,13 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (deftype hud-scene-info (basic) - ((name basic :offset-assert 4) - (continue basic :offset-assert 8) - (info basic :offset-assert 12) - (text uint32 :offset-assert 16) + ((name string :offset-assert 4) + (continue string :offset-assert 8) + ;; TODO - the decompiler currently doesn't properly handle overlay fields from static data + (info object :offset-assert 12) + (info-str string :offset 12) + (info-list pair :offset 12) ;; a list of strings + (text uint32 :offset-assert 16) ) :method-count-assert 9 :size-assert #x14 diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 7036c1c1c6..682e8b5e56 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -971,7 +971,7 @@ goos::Object decompile_structure(const TypeSpec& type, // first, let's see if it's a value or reference auto field_type_info = ts.lookup_type_allow_partial_def(field.type()); - if (!field_type_info->is_reference()) { + if (!field_type_info->is_reference() && field.type() != TypeSpec("object")) { // value type. need to get bytes. ASSERT(!field.is_inline()); if (field.is_array()) { @@ -1159,9 +1159,15 @@ goos::Object decompile_structure(const TypeSpec& type, if (field.type() == TypeSpec("symbol")) { continue; } - field_defs_out.emplace_back( - field.name(), decompile_at_label(field.type(), labels.at(word.label_id()), labels, - words, ts, file)); + if (field.type() == TypeSpec("object")) { + field_defs_out.emplace_back( + field.name(), + decompile_at_label_guess_type(labels.at(word.label_id()), labels, words, ts, file)); + } else { + field_defs_out.emplace_back( + field.name(), decompile_at_label(field.type(), labels.at(word.label_id()), labels, + words, ts, file)); + } } else if (word.kind() == LinkedWord::PLAIN_DATA && word.data == 0) { // do nothing, the default is zero? field_defs_out.emplace_back(field.name(), pretty_print::to_symbol("0")); @@ -1560,8 +1566,9 @@ goos::Object decompile_pair(const DecompilerLabel& label, } else { auto& word = words.at(label.target_segment).at(label.offset / 4); if (word.kind() != LinkedWord::EMPTY_PTR) { - throw std::runtime_error( - fmt::format("Based on alignment, expected to get empty list for pair, but didn't")); + throw std::runtime_error(fmt::format( + "Based on alignment, expected to get empty list for pair, but didn't. Label - {}", + label.name)); } return pretty_print::to_symbol("'()"); } diff --git a/goalc/compiler/compilation/Static.cpp b/goalc/compiler/compilation/Static.cpp index b5e1b26b2c..080368d68f 100644 --- a/goalc/compiler/compilation/Static.cpp +++ b/goalc/compiler/compilation/Static.cpp @@ -140,7 +140,7 @@ void Compiler::compile_static_structure_inline(const goos::Object& form, } } else if (is_structure(field_info.type) || is_pair(field_info.type) || - is_symbol(field_info.type)) { + is_symbol(field_info.type) || field_info.type == TypeSpec("object")) { if (is_pair(field_info.type)) { ASSERT(!field_info.field.is_inline()); }