diff --git a/_build_translation_patch.pl b/_build_translation_patch.pl index ed65950..bf0216c 100644 --- a/_build_translation_patch.pl +++ b/_build_translation_patch.pl @@ -19,7 +19,7 @@ sub run { call "translate_utf8_binary.pl @opt"; call "modify_fonts_and_inject.pl"; call "mod_textures.pl"; - call "copy_xml_to_modded.pl"; + call "copy_unmodded_files.pl"; call "import_files_to_assets.pl"; try_copy(); diff --git a/copy_unmodded_files.pl b/copy_unmodded_files.pl new file mode 100644 index 0000000..7e2edd4 --- /dev/null +++ b/copy_unmodded_files.pl @@ -0,0 +1,27 @@ +use 5.020; +use strictures 2; +use IO::All -binary; +use Capture::Tiny 'capture'; + +$|++; +run(); + +sub run { + say "copying translated unmodded files"; + for my $set ( # + [ "xml", "en/Xml/tables/master", "Media/StreamingAssets/Xml/tables/master/" ], + [ "png", "en/sce_sys", "sce_sys/" ], + [ "png", "en/sce_sys/livearea/contents", "sce_sys/livearea/contents/" ], + ) + { + my ( $ext, $src, $tgt ) = $set->@*; + my @files = grep /\.$ext$/, io($src)->all_files; + for my $file (@files) { + die "didn't find file '$file' in original game" if !-e "../kc_original/$tgt" . $file->filename; + my $target_file = "../kc_original_unpack_modded/$tgt" . $file->filename; + io( io->file($target_file)->filepath )->mkpath; + $file->copy($target_file); + } + } + say "done"; +} diff --git a/copy_xml_to_modded.pl b/copy_xml_to_modded.pl deleted file mode 100644 index 71e153c..0000000 --- a/copy_xml_to_modded.pl +++ /dev/null @@ -1,17 +0,0 @@ -use 5.020; -use strictures 2; -use IO::All -binary; -use Capture::Tiny 'capture'; - -$|++; -run(); - -sub run { - say "copying translated xml files"; - my @xmls = grep /\.xml$/, io("en/Xml")->All_Files; - for my $xml (@xmls) { - my $target_xml = "../kc_original_unpack_modded/Media/StreamingAssets/Xml/tables/master/" . $xml->filename; - io( io->file($target_xml)->filepath )->mkpath; - $xml->copy($target_xml); - } -} diff --git a/import_files_to_assets.pl b/import_files_to_assets.pl index 37b32bc..9730ae7 100644 --- a/import_files_to_assets.pl +++ b/import_files_to_assets.pl @@ -62,7 +62,7 @@ sub run { my $sub_path = "repatch/PCSG00684/"; say "moving to $sub_path"; io("$target_dir/$sub_path/")->mkpath; - io($media_dir)->rename("$target_dir/$sub_path/Media"); + $_->rename( "$target_dir/$sub_path/" . $_->filename ) for io($target_dir)->all_dirs; say "done"; return;