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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20836 additions and 17 deletions

View File

@ -15,6 +15,8 @@ tasks:
- 'python ./scripts/tasks/update-env.py --game jak1'
set-game-jak2:
- 'python ./scripts/tasks/update-env.py --game jak2'
set-game-jak3:
- 'python ./scripts/tasks/update-env.py --game jak3'
set-decomp-ntscv1:
desc: "aka black label"
cmds:

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;

View File

@ -39,9 +39,9 @@
// unpack game count to assets folder
"process_game_count": false,
// write goal imports for art groups
"process_art_groups": true,
"process_art_groups": false,
// write out a json file containing the art info mapping, run this with all objects allowed
"dump_art_group_info": true,
"dump_art_group_info": false,
// write out a json file containing the joint node mapping, run this with all objects allowed
"dump_joint_geo_info": false,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -34,11 +34,12 @@ if args.info:
print(file)
sys.exit(0)
valid_games = ["jak1", "jak2"]
valid_games = ["jak1", "jak2", "jak3"]
decomp_config_map = {
"jak1": "jak1/jak1_config.jsonc",
"jak2": "jak2/jak2_config.jsonc",
"jak3": "jak3/jak3_config.jsonc"
}
decomp_config_version_map = {
@ -54,12 +55,17 @@ decomp_config_version_map = {
"pal": "pal",
"ntscjp": "jp",
"ntscko": "kor"
},
# TODO other versions
"jak3": {
"ntscv1": "ntsc_v1"
}
}
default_config_version_map = {
"jak1": "ntsc_v1",
"jak2": "ntsc_v1"
"jak2": "ntsc_v1",
"jak3": "ntsc_v1"
}
if args.game: