decompiler: fix for v5 art group info dump, update taskfile for jak 3 (#3077)

This commit is contained in:
Hat Kid
2023-10-11 10:17:46 +02:00
committed by GitHub
parent cfce5e5916
commit 6285c61662
8 changed files with 20836 additions and 17 deletions
+24 -11
View File
@@ -884,7 +884,12 @@ struct JointGeo {
void get_joint_info(ObjectFileDB& db, ObjectFileData& obj, JointGeo jg) {
const auto& words = obj.linked_data.words_by_seg.at(MAIN_SEGMENT);
for (size_t i = 0; i < jg.length; ++i) {
const auto& label = words.at((jg.offset / 4) + 7 + i).label_id();
u32 label = 0x0;
if (db.version() == GameVersion::Jak3) {
label = words.at((jg.offset / 4) + 11 + i).label_id();
} else {
label = words.at((jg.offset / 4) + 7 + i).label_id();
}
const auto& joint = obj.linked_data.labels.at(label);
const auto& name =
obj.linked_data.get_goal_string_by_label(words.at(joint.offset / 4).label_id());
@@ -894,7 +899,7 @@ void get_joint_info(ObjectFileDB& db, ObjectFileData& obj, JointGeo jg) {
}
void get_art_info(ObjectFileDB& db, ObjectFileData& obj) {
if (obj.obj_version == 4) {
if (obj.obj_version == 4 || (obj.obj_version == 5 && obj.linked_data.segments == 1)) {
const auto& words = obj.linked_data.words_by_seg.at(MAIN_SEGMENT);
if (words.at(0).kind() == LinkedWord::Kind::TYPE_PTR &&
words.at(0).symbol_name() == "art-group") {
@@ -940,6 +945,9 @@ void get_art_info(ObjectFileDB& db, ObjectFileData& obj) {
} else if (elt_type == "art-joint-anim") {
// the animations!
unique_name += "-ja";
} else if (elt_type == "art-cloth-geo") {
// cloth geometry (jak 3)
unique_name += "-cg";
} else {
// the something idk!
throw std::runtime_error(
@@ -981,20 +989,25 @@ void ObjectFileDB::dump_art_info(const fs::path& output_dir) {
if (!dts.art_group_info.empty() || !dts.jg_info.empty()) {
file_util::create_dir_if_needed(output_dir / "import");
}
auto ag_fpath = output_dir / "import" / "art-elts.gc";
std::string ag_result;
for (const auto& [ag_name, info] : dts.art_group_info) {
auto ag_fname = ag_name + ".gc";
auto filename = output_dir / "import" / ag_fname;
std::string result = ";;-*-Lisp-*-\n";
result += "(in-package goal)\n\n";
result += fmt::format(";; {} - art group OpenGOAL import file\n", ag_fname);
result += ";; THIS FILE IS AUTOMATICALLY GENERATED!\n\n";
// auto ag_fname = ag_name + ".gc";
// auto filename = output_dir / "import" / ag_fname;
// std::string result = ";;-*-Lisp-*-\n";
// result += "(in-package goal)\n\n";
// result += fmt::format(";; {} - art group OpenGOAL import file\n", ag_fname);
// result += ";; THIS FILE IS AUTOMATICALLY GENERATED!\n\n";
for (const auto& [idx, elt_name] : info) {
result += print_art_elt_for_dump(ag_name, elt_name, idx);
ag_result += print_art_elt_for_dump(ag_name, elt_name, idx);
}
result += "\n";
file_util::write_text_file(filename, result);
ag_result += "\n";
}
file_util::write_text_file(ag_fpath, ag_result);
auto jg_fpath = output_dir / "import" / "joint-nodes.gc";
std::string jg_result;