also NTSC-J support

This commit is contained in:
ManDude
2022-06-22 00:01:39 +01:00
parent 85584b7616
commit 617f2c6f33
9 changed files with 4435 additions and 13 deletions
+1 -1
View File
@@ -138,7 +138,7 @@
"project" : "CMakeLists.txt",
"projectTarget" : "extractor.exe (bin\\extractor.exe)",
"name" : "Run - Extractor - Extract",
"args" : [ "\"C:\\Game\\PS2SMB\\DVD\\SCES_503.61.Jak & Daxter - TPL (PAL).iso\""]
"args" : [ "\"C:\\Game\\PS2SMB\\DVD\\SCPS_150.21.Jak & Daxter - TPL (NTSC-J).iso\""]
}
]
}
+116
View File
@@ -0,0 +1,116 @@
{
"game_version": 1,
"text_version": 11,
"game_name": "jak1_jp",
"expected_elf_name": "SCPS_150.21",
// if you want to filter to only some object names.
// it will make the decompiler much faster.
"allowed_objects": [],
"banned_objects": [],
////////////////////////////
// CODE ANALYSIS OPTIONS
////////////////////////////
// set to true to generate plain .asm files with MIPS disassembly, with no fancy decompilation.
// this is fast and should succeed 100% of the time.
"disassemble_code": false,
// Run the decompiler
"decompile_code": false,
// run the first pass of the decompiler
"find_functions": true,
////////////////////////////
// DATA ANALYSIS OPTIONS
////////////////////////////
// set to true to generate plain .asm files for data files.
// this will display most data as hex, but will add labels/references/type pointers/strings
// this generates a huge amount of output if you run it on the entire game.
"disassemble_data": false,
// unpack textures to assets folder
"process_tpages": true,
// unpack game text to assets folder
"process_game_text": true,
// unpack game count to assets folder
"process_game_count": true,
// write goal imports for art groups
"process_art_groups": true,
///////////////////////////
// WEIRD OPTIONS
///////////////////////////
// these options are used rarely and should usually be left at false
// generate the symbol_map.json file.
// this is a guess at where each symbol is first defined/used.
"generate_symbol_definition_map": false,
// debug option for instruction decoder
"write_hex_near_instructions": false,
// experimental tool to extract linked lists used for region scripting in Jak 2 and Jak 3.
"write_scripts": false,
// hex dump of code/data files.
"hexdump_code": false,
"hexdump_data": false,
// dump raw obj files
"dump_objs": true,
// print control flow graph
"print_cfgs": false,
// set to true for PAL versions. this will forcefully skip files that have some data missing at the end.
"is_pal": false,
////////////////////////////
// CONFIG FILES
////////////////////////////
"type_casts_file": "decompiler/config/jak1_pal/type_casts.jsonc",
"anonymous_function_types_file": "decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc",
"var_names_file": "decompiler/config/jak1_ntsc_black_label/var_names.jsonc",
"label_types_file": "decompiler/config/jak1_jp/label_types.jsonc",
"stack_structures_file": "decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc",
"hacks_file": "decompiler/config/jak1_pal/hacks.jsonc",
"inputs_file": "decompiler/config/jak1_ntsc_black_label/inputs.jsonc",
"art_info_file": "decompiler/config/jak1_ntsc_black_label/art_info.jsonc",
"import_deps_file": "decompiler/config/jak1_ntsc_black_label/import_deps.jsonc",
"all_types_file": "decompiler/config/all-types.gc",
// optional: a predetermined object file name map from a file.
// this will make decompilation naming consistent even if you only run on some objects.
"obj_file_name_map_file": "goal_src/build/all_objs_jak1_jp.json",
////////////////////////////
// LEVEL EXTRACTION
////////////////////////////
// turn this on to extract level background graphics data
"levels_extract": true,
// turn this on if you want extracted levels to be saved out as .obj files
"levels_convert_to_obj": false,
// should we extract collision meshes?
// these can be displayed in game, but makes the .fr3 files slightly larger
"extract_collision": true,
////////////////////////////
// PATCHING OPTIONS
////////////////////////////
// these are options related to xdelta3 patches on specific objects
// this allows us to get a more consistent input
// set to true to write new patch files
"write_patches": false,
// set to true to apply patch files
"apply_patches": true,
// what to patch an object to and the patch file is
"object_patches": {
}
}
File diff suppressed because it is too large Load Diff
+22 -9
View File
@@ -32,7 +32,7 @@ struct ISOMetadata {
// this will let the installer reject (or gracefully handle) jak2 isos on the jak1 page, etc.
// { SERIAL : { ELF_HASH : ISOMetadataDatabase } }
static std::map<std::string, std::map<xxh::hash64_t, ISOMetadata>> isoDatabase{
static const std::map<std::string, std::map<xxh::hash64_t, ISOMetadata>> isoDatabase{
{"SCUS-97124",
{{7280758013604870207U,
{"Jak & Daxter™: The Precursor Legacy (Black Label)", "NTSC-U", 337, 11363853835861842434U,
@@ -40,7 +40,11 @@ static std::map<std::string, std::map<xxh::hash64_t, ISOMetadata>> isoDatabase{
{"SCES-50361",
{{12150718117852276522U,
{"Jak & Daxter™: The Precursor Legacy (PAL)", "PAL", 338, 16850370297611763875U,
"jak1_pal"}}}}};
"jak1_pal"}}}},
{"SCPS-15021",
{{16909372048085114219U,
{"ジャックXダクスター  旧世界の遺産", "NTSC-J", 338, 1262350561338887717,
"jak1_jp"}}}}};
void setup_global_decompiler_stuff(std::optional<std::filesystem::path> project_path_override) {
decompiler::init_opcode_info();
@@ -113,8 +117,7 @@ ExtractorErrorCode validate(const IsoFile& iso_file,
}
// Find the game in our tracking database
auto dbEntry = isoDatabase.find(serial.value());
if (dbEntry == isoDatabase.end()) {
if (auto dbEntry = isoDatabase.find(serial.value()); dbEntry == isoDatabase.end()) {
fmt::print(stderr, "ERROR: Serial '{}' not found in the validation database\n", serial.value());
if (!error_code.has_value()) {
error_code = std::make_optional(ExtractorErrorCode::VALIDATION_SERIAL_MISSING_FROM_DB);
@@ -354,6 +357,12 @@ int main(int argc, char** argv) {
fmt::print("Running all steps, no flags provided!\n");
flag_runall = true;
}
if (flag_runall) {
flag_extract = true;
flag_decompile = true;
flag_compile = true;
flag_play = true;
}
// todo: print revision here.
if (!project_path_override.empty()) {
@@ -362,7 +371,11 @@ int main(int argc, char** argv) {
setup_global_decompiler_stuff(std::nullopt);
}
std::filesystem::path path_to_iso_files = file_util::get_jak_project_dir() / "iso_data" / "jak1";
std::filesystem::path path_to_iso_files = file_util::get_jak_project_dir() / "iso_data" / "_temp";
if (flag_extract && data_dir_path != path_to_iso_files) {
// in case input is also output, don't just wipe everything (weird)
std::filesystem::remove_all(path_to_iso_files);
}
std::filesystem::create_directories(path_to_iso_files);
// make sure the input looks right
@@ -371,7 +384,7 @@ int main(int argc, char** argv) {
return 1;
}
if (flag_runall || flag_extract) {
if (flag_extract) {
if (std::filesystem::is_regular_file(data_dir_path)) {
// it's a file, treat it as an ISO
auto iso_file = extract_files(data_dir_path, path_to_iso_files);
@@ -392,7 +405,7 @@ int main(int argc, char** argv) {
}
}
if (flag_runall || flag_decompile) {
if (flag_decompile) {
try {
decompile(path_to_iso_files);
} catch (std::exception& e) {
@@ -401,11 +414,11 @@ int main(int argc, char** argv) {
}
}
if (flag_runall || flag_compile) {
if (flag_compile) {
compile(path_to_iso_files);
}
if (flag_runall || flag_play) {
if (flag_play) {
launch_game();
}
File diff suppressed because it is too large Load Diff
+4 -3
View File
@@ -1068,8 +1068,8 @@
(sound-play "start-options")
(set! (-> obj next-display-state) (progress-screen memcard-creating))
)
;; PAL patch here
((and (= (-> obj display-state-stack 0) (progress-screen title)) (zero? (scf-get-territory)))
;; PAL & NTSC-J patch here
((= (-> obj display-state-stack 0) (progress-screen title))
(sound-play "cursor-options")
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
@@ -1169,7 +1169,8 @@
(sound-play "start-options")
(set! (-> obj next-display-state) (progress-screen memcard-formatting))
)
((and (= (-> obj display-state-stack 0) (progress-screen title)) (zero? (scf-get-territory)))
;; NTSC-J patch here
((= (-> obj display-state-stack 0) (progress-screen title))
(sound-play "start-options")
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
+4
View File
@@ -1326,6 +1326,10 @@
:to *entity-pool*
)
(sound-play "sagecage-open")
;; NTSC-J patch here
; (if (name= (-> self name) "citb-generator-1")
; (set-continue! *game-info* "citadel-elevator")
; )
(go citb-generator-broken)
(none)
)
+4
View File
@@ -0,0 +1,4 @@
@echo off
cd ..\..
out\build\Release\bin\decompiler decompiler\config\jak1_jp.jsonc iso_data decompiler_out\
pause