pgtools 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +25 -25
- data/bin/bxm_decoder +2 -2
- data/bin/bxm_encoder +2 -2
- data/bin/clh_convert +2 -2
- data/bin/clp_convert +2 -2
- data/bin/clw_convert +2 -2
- data/bin/dat_creator +2 -2
- data/bin/dat_extractor +2 -2
- data/bin/dat_ls +2 -2
- data/bin/eff_idd_creator +2 -2
- data/bin/eff_idd_extractor +2 -2
- data/bin/exp_convert_wiiu_pc +2 -2
- data/bin/exp_tool +2 -2
- data/bin/mot_convert_wiiu_pc +2 -2
- data/bin/mot_tool +2 -2
- data/bin/pkz_extractor +2 -2
- data/bin/scr_creator +2 -2
- data/bin/scr_extractor +2 -2
- data/bin/wmb_cleanup +2 -2
- data/bin/wmb_common_bones +2 -2
- data/bin/wmb_convert_pc_switch +2 -2
- data/bin/wmb_convert_wiiu_pc +2 -2
- data/bin/wmb_export_assimp +2 -2
- data/bin/wmb_get_bone_map +2 -2
- data/bin/wmb_import_assimp +2 -2
- data/bin/wmb_import_nier +2 -2
- data/bin/wmb_import_wiiu +2 -2
- data/bin/wtb_convert_wiiu_pc +2 -2
- data/bin/wtx_creator +2 -2
- data/bin/wtx_extractor +2 -2
- data/lib/bayonetta/alignment.rb +0 -0
- data/lib/bayonetta/bone.rb +0 -0
- data/lib/bayonetta/bxm.rb +180 -180
- data/lib/bayonetta/clh.rb +159 -159
- data/lib/bayonetta/clp.rb +212 -212
- data/lib/bayonetta/clw.rb +166 -166
- data/lib/bayonetta/dat.rb +261 -261
- data/lib/bayonetta/eff.rb +314 -314
- data/lib/bayonetta/endianness.rb +0 -0
- data/lib/bayonetta/exp.rb +768 -768
- data/lib/bayonetta/linalg.rb +416 -416
- data/lib/bayonetta/material_database.yaml +2581 -2581
- data/lib/bayonetta/mot.rb +763 -763
- data/lib/bayonetta/pkz.rb +63 -63
- data/lib/bayonetta/scr.rb +0 -0
- data/lib/bayonetta/tools/bxm_decoder.rb +23 -23
- data/lib/bayonetta/tools/bxm_encoder.rb +37 -37
- data/lib/bayonetta/tools/clh_convert.rb +60 -60
- data/lib/bayonetta/tools/clp_convert.rb +70 -70
- data/lib/bayonetta/tools/clw_convert.rb +60 -60
- data/lib/bayonetta/tools/dat_creator.rb +57 -57
- data/lib/bayonetta/tools/dat_extractor.rb +94 -94
- data/lib/bayonetta/tools/dat_ls.rb +106 -106
- data/lib/bayonetta/tools/eff_idd_creator.rb +66 -66
- data/lib/bayonetta/tools/eff_idd_extractor.rb +73 -73
- data/lib/bayonetta/tools/exp_convert_wiiu_pc.rb +33 -33
- data/lib/bayonetta/tools/exp_tool.rb +48 -48
- data/lib/bayonetta/tools/mot_convert_wiiu_pc.rb +33 -33
- data/lib/bayonetta/tools/mot_tool.rb +0 -0
- data/lib/bayonetta/tools/pkz_extractor.rb +75 -75
- data/lib/bayonetta/tools/scr_creator.rb +63 -63
- data/lib/bayonetta/tools/scr_extractor.rb +78 -78
- data/lib/bayonetta/tools/wmb_cleanup.rb +250 -250
- data/lib/bayonetta/tools/wmb_common_bones.rb +45 -45
- data/lib/bayonetta/tools/wmb_convert_pc_switch.rb +35 -35
- data/lib/bayonetta/tools/wmb_convert_wiiu_pc.rb +33 -33
- data/lib/bayonetta/tools/wmb_export_assimp.rb +479 -479
- data/lib/bayonetta/tools/wmb_get_bone_map.rb +50 -50
- data/lib/bayonetta/tools/wmb_import_assimp.rb +735 -735
- data/lib/bayonetta/tools/wmb_import_geometry_wiiu_pc.rb +472 -472
- data/lib/bayonetta/tools/wmb_import_nier.rb +309 -309
- data/lib/bayonetta/tools/wtb_convert_wiiu_pc.rb +95 -95
- data/lib/bayonetta/tools/wtb_import_textures.rb +103 -103
- data/lib/bayonetta/tools/wtx_creator.rb +69 -69
- data/lib/bayonetta/tools/wtx_extractor.rb +85 -85
- data/lib/bayonetta/vertex_types.yaml +0 -0
- data/lib/bayonetta/vertex_types2.yaml +0 -0
- data/lib/bayonetta/vertex_types_nier.yaml +145 -145
- data/lib/bayonetta/wmb.rb +2455 -2443
- data/lib/bayonetta/wmb3.rb +759 -759
- data/lib/bayonetta/wtb.rb +481 -481
- data/lib/bayonetta.rb +60 -60
- metadata +2 -2
@@ -1,73 +1,73 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'yaml'
|
3
|
-
require_relative '../../bayonetta'
|
4
|
-
|
5
|
-
$options = {
|
6
|
-
output: nil
|
7
|
-
}
|
8
|
-
|
9
|
-
OptionParser.new do |opts|
|
10
|
-
opts.banner = <<EOF
|
11
|
-
Usage: eff_idd_extractor file
|
12
|
-
EOF
|
13
|
-
opts.on("-h", "--help", "Prints this help") do
|
14
|
-
puts opts
|
15
|
-
exit
|
16
|
-
end
|
17
|
-
|
18
|
-
opts.on("-o", "--output=dirname", "directory to output result") do |name|
|
19
|
-
$options[:output] = name
|
20
|
-
end
|
21
|
-
|
22
|
-
end.parse!
|
23
|
-
|
24
|
-
save_pwd = Dir.pwd
|
25
|
-
|
26
|
-
raise "Invalid output directory #{$options[:output]}" if $options[:output] && !Dir.exist?($options[:output])
|
27
|
-
|
28
|
-
filename = ARGV[0]
|
29
|
-
raise "Invalid file: #{filename}!" unless filename && File.exist?(filename)
|
30
|
-
directory = File.dirname(filename)
|
31
|
-
name = File.basename(filename)
|
32
|
-
ext_name = File.extname(name)
|
33
|
-
|
34
|
-
raise "Invalid file: #{filename}!" unless ext_name == ".eff" || ext_name == ".idd"
|
35
|
-
|
36
|
-
f = File::open(filename, "rb")
|
37
|
-
|
38
|
-
if $options[:output]
|
39
|
-
Dir.chdir(save_pwd)
|
40
|
-
Dir.chdir($options[:output])
|
41
|
-
else
|
42
|
-
Dir.chdir(directory)
|
43
|
-
end
|
44
|
-
dir_name = File.basename(name, ext_name) + "#{ext_name.gsub(".","_")}"
|
45
|
-
Dir.mkdir(dir_name) unless Dir.exist?(dir_name)
|
46
|
-
Dir.chdir(dir_name)
|
47
|
-
|
48
|
-
eff = Bayonetta::EFFFile::new(f)
|
49
|
-
|
50
|
-
eff.each_directory { |id, dir|
|
51
|
-
Dir.mkdir(dir.name) unless Dir.exist?(dir.name)
|
52
|
-
dir.each { |fname, f2|
|
53
|
-
File::open("#{dir.name}/#{fname}", "wb") { |f3|
|
54
|
-
f2.rewind
|
55
|
-
f3.write(f2.read)
|
56
|
-
}
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
Dir.mkdir(".metadata") unless Dir.exist?(".metadata")
|
61
|
-
Dir.chdir(".metadata")
|
62
|
-
File::open("id.yaml", "w") { |fl|
|
63
|
-
fl.print YAML::dump( eff.id )
|
64
|
-
}
|
65
|
-
File::open("layout.yaml", "w") { |fl|
|
66
|
-
fl.print YAML::dump( eff.layout )
|
67
|
-
}
|
68
|
-
File::open("extension.yaml", "w") { |fl|
|
69
|
-
fl.print YAML::dump( ext_name )
|
70
|
-
}
|
71
|
-
File::open("big.yaml","w") { |fl|
|
72
|
-
fl.print YAML::dump( eff.big )
|
73
|
-
}
|
1
|
+
require 'optparse'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative '../../bayonetta'
|
4
|
+
|
5
|
+
$options = {
|
6
|
+
output: nil
|
7
|
+
}
|
8
|
+
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = <<EOF
|
11
|
+
Usage: eff_idd_extractor file
|
12
|
+
EOF
|
13
|
+
opts.on("-h", "--help", "Prints this help") do
|
14
|
+
puts opts
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on("-o", "--output=dirname", "directory to output result") do |name|
|
19
|
+
$options[:output] = name
|
20
|
+
end
|
21
|
+
|
22
|
+
end.parse!
|
23
|
+
|
24
|
+
save_pwd = Dir.pwd
|
25
|
+
|
26
|
+
raise "Invalid output directory #{$options[:output]}" if $options[:output] && !Dir.exist?($options[:output])
|
27
|
+
|
28
|
+
filename = ARGV[0]
|
29
|
+
raise "Invalid file: #{filename}!" unless filename && File.exist?(filename)
|
30
|
+
directory = File.dirname(filename)
|
31
|
+
name = File.basename(filename)
|
32
|
+
ext_name = File.extname(name)
|
33
|
+
|
34
|
+
raise "Invalid file: #{filename}!" unless ext_name == ".eff" || ext_name == ".idd"
|
35
|
+
|
36
|
+
f = File::open(filename, "rb")
|
37
|
+
|
38
|
+
if $options[:output]
|
39
|
+
Dir.chdir(save_pwd)
|
40
|
+
Dir.chdir($options[:output])
|
41
|
+
else
|
42
|
+
Dir.chdir(directory)
|
43
|
+
end
|
44
|
+
dir_name = File.basename(name, ext_name) + "#{ext_name.gsub(".","_")}"
|
45
|
+
Dir.mkdir(dir_name) unless Dir.exist?(dir_name)
|
46
|
+
Dir.chdir(dir_name)
|
47
|
+
|
48
|
+
eff = Bayonetta::EFFFile::new(f)
|
49
|
+
|
50
|
+
eff.each_directory { |id, dir|
|
51
|
+
Dir.mkdir(dir.name) unless Dir.exist?(dir.name)
|
52
|
+
dir.each { |fname, f2|
|
53
|
+
File::open("#{dir.name}/#{fname}", "wb") { |f3|
|
54
|
+
f2.rewind
|
55
|
+
f3.write(f2.read)
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
Dir.mkdir(".metadata") unless Dir.exist?(".metadata")
|
61
|
+
Dir.chdir(".metadata")
|
62
|
+
File::open("id.yaml", "w") { |fl|
|
63
|
+
fl.print YAML::dump( eff.id )
|
64
|
+
}
|
65
|
+
File::open("layout.yaml", "w") { |fl|
|
66
|
+
fl.print YAML::dump( eff.layout )
|
67
|
+
}
|
68
|
+
File::open("extension.yaml", "w") { |fl|
|
69
|
+
fl.print YAML::dump( ext_name )
|
70
|
+
}
|
71
|
+
File::open("big.yaml","w") { |fl|
|
72
|
+
fl.print YAML::dump( eff.big )
|
73
|
+
}
|
@@ -1,33 +1,33 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require_relative '../../bayonetta'
|
3
|
-
include Bayonetta
|
4
|
-
|
5
|
-
$options = {
|
6
|
-
output: nil
|
7
|
-
}
|
8
|
-
|
9
|
-
OptionParser.new do |opts|
|
10
|
-
opts.banner = <<EOF
|
11
|
-
Usage: exp_convert_wiiu_pc target_file
|
12
|
-
EOF
|
13
|
-
opts.on("-h", "--help", "Prints this help") do
|
14
|
-
puts opts
|
15
|
-
exit
|
16
|
-
end
|
17
|
-
|
18
|
-
opts.on("-o", "--output=filename", "file to output result") do |name|
|
19
|
-
$options[:output] = name
|
20
|
-
end
|
21
|
-
|
22
|
-
end.parse!
|
23
|
-
|
24
|
-
input_file = ARGV[0]
|
25
|
-
|
26
|
-
raise "Invalid file #{input_file}" unless input_file && File::file?(input_file)
|
27
|
-
|
28
|
-
output_file = $options[:output]
|
29
|
-
if !output_file
|
30
|
-
Dir.mkdir("exp_output") unless Dir.exist?("exp_output")
|
31
|
-
output_file = File.join("exp_output", File.basename(input_file))
|
32
|
-
end
|
33
|
-
EXPFile::convert(input_file, output_file)
|
1
|
+
require 'optparse'
|
2
|
+
require_relative '../../bayonetta'
|
3
|
+
include Bayonetta
|
4
|
+
|
5
|
+
$options = {
|
6
|
+
output: nil
|
7
|
+
}
|
8
|
+
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = <<EOF
|
11
|
+
Usage: exp_convert_wiiu_pc target_file
|
12
|
+
EOF
|
13
|
+
opts.on("-h", "--help", "Prints this help") do
|
14
|
+
puts opts
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on("-o", "--output=filename", "file to output result") do |name|
|
19
|
+
$options[:output] = name
|
20
|
+
end
|
21
|
+
|
22
|
+
end.parse!
|
23
|
+
|
24
|
+
input_file = ARGV[0]
|
25
|
+
|
26
|
+
raise "Invalid file #{input_file}" unless input_file && File::file?(input_file)
|
27
|
+
|
28
|
+
output_file = $options[:output]
|
29
|
+
if !output_file
|
30
|
+
Dir.mkdir("exp_output") unless Dir.exist?("exp_output")
|
31
|
+
output_file = File.join("exp_output", File.basename(input_file))
|
32
|
+
end
|
33
|
+
EXPFile::convert(input_file, output_file)
|
@@ -1,48 +1,48 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'yaml'
|
3
|
-
require_relative '../../bayonetta.rb'
|
4
|
-
include Bayonetta
|
5
|
-
|
6
|
-
$options = {
|
7
|
-
:add => false,
|
8
|
-
:overwrite => false,
|
9
|
-
:swap => false
|
10
|
-
}
|
11
|
-
|
12
|
-
OptionParser.new do |opts|
|
13
|
-
opts.banner = "Usage: exp_tool.rb target_file [options]"
|
14
|
-
|
15
|
-
opts.on("-a", "--add=HASH", "Add entries for the give type example: --add={2=>1, 3=>2} 1 type 2 entry and 2 type 3") { |add|
|
16
|
-
$options[:add] = eval(add).to_h
|
17
|
-
}
|
18
|
-
|
19
|
-
opts.on("--overwrite", "Overwrite input file") do |overwrite|
|
20
|
-
$options[:overwrite] = overwrite
|
21
|
-
end
|
22
|
-
|
23
|
-
opts.on("-e", "--swap-endianness", "Swap endianness") do |swap|
|
24
|
-
$options[:swap] = swap
|
25
|
-
end
|
26
|
-
|
27
|
-
opts.on("-h", "--help", "Prints this help") do
|
28
|
-
puts opts
|
29
|
-
exit
|
30
|
-
end
|
31
|
-
|
32
|
-
end.parse!
|
33
|
-
|
34
|
-
Dir.mkdir("exp_output") unless Dir.exist?("exp_output")
|
35
|
-
input_file = ARGV[0]
|
36
|
-
raise "Invalid file #{input_file}" unless File::file?(input_file)
|
37
|
-
|
38
|
-
exp = EXPFile::load(input_file)
|
39
|
-
|
40
|
-
exp.add_entries($options[:add]) if $options[:add]
|
41
|
-
|
42
|
-
exp.recompute_layout
|
43
|
-
|
44
|
-
if $options[:overwrite]
|
45
|
-
exp.dump(input_file, $options[:swap] ? !exp.was_big? : exp.was_big? )
|
46
|
-
else
|
47
|
-
exp.dump("exp_output/"+File.basename(input_file), $options[:swap] ? !exp.was_big? : exp.was_big? )
|
48
|
-
end
|
1
|
+
require 'optparse'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative '../../bayonetta.rb'
|
4
|
+
include Bayonetta
|
5
|
+
|
6
|
+
$options = {
|
7
|
+
:add => false,
|
8
|
+
:overwrite => false,
|
9
|
+
:swap => false
|
10
|
+
}
|
11
|
+
|
12
|
+
OptionParser.new do |opts|
|
13
|
+
opts.banner = "Usage: exp_tool.rb target_file [options]"
|
14
|
+
|
15
|
+
opts.on("-a", "--add=HASH", "Add entries for the give type example: --add={2=>1, 3=>2} 1 type 2 entry and 2 type 3") { |add|
|
16
|
+
$options[:add] = eval(add).to_h
|
17
|
+
}
|
18
|
+
|
19
|
+
opts.on("--overwrite", "Overwrite input file") do |overwrite|
|
20
|
+
$options[:overwrite] = overwrite
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on("-e", "--swap-endianness", "Swap endianness") do |swap|
|
24
|
+
$options[:swap] = swap
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on("-h", "--help", "Prints this help") do
|
28
|
+
puts opts
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
|
32
|
+
end.parse!
|
33
|
+
|
34
|
+
Dir.mkdir("exp_output") unless Dir.exist?("exp_output")
|
35
|
+
input_file = ARGV[0]
|
36
|
+
raise "Invalid file #{input_file}" unless File::file?(input_file)
|
37
|
+
|
38
|
+
exp = EXPFile::load(input_file)
|
39
|
+
|
40
|
+
exp.add_entries($options[:add]) if $options[:add]
|
41
|
+
|
42
|
+
exp.recompute_layout
|
43
|
+
|
44
|
+
if $options[:overwrite]
|
45
|
+
exp.dump(input_file, $options[:swap] ? !exp.was_big? : exp.was_big? )
|
46
|
+
else
|
47
|
+
exp.dump("exp_output/"+File.basename(input_file), $options[:swap] ? !exp.was_big? : exp.was_big? )
|
48
|
+
end
|
@@ -1,33 +1,33 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require_relative '../../bayonetta'
|
3
|
-
include Bayonetta
|
4
|
-
|
5
|
-
$options = {
|
6
|
-
output: nil
|
7
|
-
}
|
8
|
-
|
9
|
-
OptionParser.new do |opts|
|
10
|
-
opts.banner = <<EOF
|
11
|
-
Usage: mot_convert_wiiu_pc target_file
|
12
|
-
EOF
|
13
|
-
opts.on("-h", "--help", "Prints this help") do
|
14
|
-
puts opts
|
15
|
-
exit
|
16
|
-
end
|
17
|
-
|
18
|
-
opts.on("-o", "--output=filename", "file to output result") do |name|
|
19
|
-
$options[:output] = name
|
20
|
-
end
|
21
|
-
|
22
|
-
end.parse!
|
23
|
-
|
24
|
-
input_file = ARGV[0]
|
25
|
-
|
26
|
-
raise "Invalid file #{input_file}" unless input_file && File::file?(input_file)
|
27
|
-
|
28
|
-
output_file = $options[:output]
|
29
|
-
if !output_file
|
30
|
-
Dir.mkdir("mot_output") unless Dir.exist?("mot_output")
|
31
|
-
output_file = File.join("mot_output", File.basename(input_file))
|
32
|
-
end
|
33
|
-
MOTFile::convert(input_file, output_file)
|
1
|
+
require 'optparse'
|
2
|
+
require_relative '../../bayonetta'
|
3
|
+
include Bayonetta
|
4
|
+
|
5
|
+
$options = {
|
6
|
+
output: nil
|
7
|
+
}
|
8
|
+
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = <<EOF
|
11
|
+
Usage: mot_convert_wiiu_pc target_file
|
12
|
+
EOF
|
13
|
+
opts.on("-h", "--help", "Prints this help") do
|
14
|
+
puts opts
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on("-o", "--output=filename", "file to output result") do |name|
|
19
|
+
$options[:output] = name
|
20
|
+
end
|
21
|
+
|
22
|
+
end.parse!
|
23
|
+
|
24
|
+
input_file = ARGV[0]
|
25
|
+
|
26
|
+
raise "Invalid file #{input_file}" unless input_file && File::file?(input_file)
|
27
|
+
|
28
|
+
output_file = $options[:output]
|
29
|
+
if !output_file
|
30
|
+
Dir.mkdir("mot_output") unless Dir.exist?("mot_output")
|
31
|
+
output_file = File.join("mot_output", File.basename(input_file))
|
32
|
+
end
|
33
|
+
MOTFile::convert(input_file, output_file)
|
File without changes
|
@@ -1,75 +1,75 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'zstd-ruby'
|
4
|
-
require 'oodle-kraken-ruby'
|
5
|
-
require_relative '../../bayonetta'
|
6
|
-
|
7
|
-
$options = {
|
8
|
-
output: nil
|
9
|
-
}
|
10
|
-
|
11
|
-
OptionParser.new do |opts|
|
12
|
-
opts.banner = <<EOF
|
13
|
-
Usage: pkz_extractor [pkz_file [pkz_file2 ...]]
|
14
|
-
EOF
|
15
|
-
opts.on("-h", "--help", "Prints this help") do
|
16
|
-
puts opts
|
17
|
-
exit
|
18
|
-
end
|
19
|
-
|
20
|
-
opts.on("-o", "--output=dirname", "directory to output result") do |name|
|
21
|
-
$options[:output] = name
|
22
|
-
end
|
23
|
-
|
24
|
-
end.parse!
|
25
|
-
|
26
|
-
save_pwd = Dir.pwd
|
27
|
-
|
28
|
-
raise "Invalid output directory #{$options[:output]}" if $options[:output] && !Dir.exist?($options[:output])
|
29
|
-
|
30
|
-
ARGV.each { |filename|
|
31
|
-
raise "Invalid file: #{filename}!" unless File.exist?(filename)
|
32
|
-
directory = File.dirname(filename)
|
33
|
-
name = File.basename(filename)
|
34
|
-
ext_name = File.extname(name)
|
35
|
-
raise "Invalid file (#{name})!" unless ext_name == ".pkz"
|
36
|
-
|
37
|
-
f = File::open(filename, "rb")
|
38
|
-
|
39
|
-
if $options[:output]
|
40
|
-
Dir.chdir(save_pwd)
|
41
|
-
Dir.chdir($options[:output])
|
42
|
-
else
|
43
|
-
Dir.chdir(directory)
|
44
|
-
end
|
45
|
-
pkz = Bayonetta::PKZFile::load(f)
|
46
|
-
|
47
|
-
pkz.file_descriptors.each { |d|
|
48
|
-
f.seek(d.offset)
|
49
|
-
fname = d.name[0..-2]
|
50
|
-
compression = d.compression[0..-2]
|
51
|
-
dirname = File.dirname(fname)
|
52
|
-
unless File.directory?(dirname)
|
53
|
-
FileUtils.mkdir_p(dirname)
|
54
|
-
end
|
55
|
-
case compression
|
56
|
-
when "ZStandard"
|
57
|
-
File::open(fname, "wb") { |nf|
|
58
|
-
nf.write Zstd.decompress(f.read(d.compressed_size))
|
59
|
-
raise "Decompression error!" if nf.size != d.size
|
60
|
-
}
|
61
|
-
when "OodleKraken"
|
62
|
-
File::open(fname, "wb") { |nf|
|
63
|
-
nf.write OodleKraken.decompress(f.read(d.compressed_size), d.size)
|
64
|
-
}
|
65
|
-
when "None"
|
66
|
-
File::open(fname, "wb") { |nf|
|
67
|
-
nf.write f.read(d.compressed_size)
|
68
|
-
}
|
69
|
-
else
|
70
|
-
warn "Unsupported compression format for #{fname}: #{compression}!"
|
71
|
-
end
|
72
|
-
}
|
73
|
-
Dir.chdir(save_pwd)
|
74
|
-
f.close
|
75
|
-
}
|
1
|
+
require 'optparse'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'zstd-ruby'
|
4
|
+
require 'oodle-kraken-ruby'
|
5
|
+
require_relative '../../bayonetta'
|
6
|
+
|
7
|
+
$options = {
|
8
|
+
output: nil
|
9
|
+
}
|
10
|
+
|
11
|
+
OptionParser.new do |opts|
|
12
|
+
opts.banner = <<EOF
|
13
|
+
Usage: pkz_extractor [pkz_file [pkz_file2 ...]]
|
14
|
+
EOF
|
15
|
+
opts.on("-h", "--help", "Prints this help") do
|
16
|
+
puts opts
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("-o", "--output=dirname", "directory to output result") do |name|
|
21
|
+
$options[:output] = name
|
22
|
+
end
|
23
|
+
|
24
|
+
end.parse!
|
25
|
+
|
26
|
+
save_pwd = Dir.pwd
|
27
|
+
|
28
|
+
raise "Invalid output directory #{$options[:output]}" if $options[:output] && !Dir.exist?($options[:output])
|
29
|
+
|
30
|
+
ARGV.each { |filename|
|
31
|
+
raise "Invalid file: #{filename}!" unless File.exist?(filename)
|
32
|
+
directory = File.dirname(filename)
|
33
|
+
name = File.basename(filename)
|
34
|
+
ext_name = File.extname(name)
|
35
|
+
raise "Invalid file (#{name})!" unless ext_name == ".pkz"
|
36
|
+
|
37
|
+
f = File::open(filename, "rb")
|
38
|
+
|
39
|
+
if $options[:output]
|
40
|
+
Dir.chdir(save_pwd)
|
41
|
+
Dir.chdir($options[:output])
|
42
|
+
else
|
43
|
+
Dir.chdir(directory)
|
44
|
+
end
|
45
|
+
pkz = Bayonetta::PKZFile::load(f)
|
46
|
+
|
47
|
+
pkz.file_descriptors.each { |d|
|
48
|
+
f.seek(d.offset)
|
49
|
+
fname = d.name[0..-2]
|
50
|
+
compression = d.compression[0..-2]
|
51
|
+
dirname = File.dirname(fname)
|
52
|
+
unless File.directory?(dirname)
|
53
|
+
FileUtils.mkdir_p(dirname)
|
54
|
+
end
|
55
|
+
case compression
|
56
|
+
when "ZStandard"
|
57
|
+
File::open(fname, "wb") { |nf|
|
58
|
+
nf.write Zstd.decompress(f.read(d.compressed_size))
|
59
|
+
raise "Decompression error!" if nf.size != d.size
|
60
|
+
}
|
61
|
+
when "OodleKraken"
|
62
|
+
File::open(fname, "wb") { |nf|
|
63
|
+
nf.write OodleKraken.decompress(f.read(d.compressed_size), d.size)
|
64
|
+
}
|
65
|
+
when "None"
|
66
|
+
File::open(fname, "wb") { |nf|
|
67
|
+
nf.write f.read(d.compressed_size)
|
68
|
+
}
|
69
|
+
else
|
70
|
+
warn "Unsupported compression format for #{fname}: #{compression}!"
|
71
|
+
end
|
72
|
+
}
|
73
|
+
Dir.chdir(save_pwd)
|
74
|
+
f.close
|
75
|
+
}
|
@@ -1,63 +1,63 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'yaml'
|
3
|
-
require_relative '../../bayonetta'
|
4
|
-
|
5
|
-
$options = {
|
6
|
-
output: nil
|
7
|
-
}
|
8
|
-
OptionParser.new do |opts|
|
9
|
-
opts.banner = <<EOF
|
10
|
-
Usage: scr_creator target_directory
|
11
|
-
EOF
|
12
|
-
opts.on("-h", "--help", "Prints this help") do
|
13
|
-
puts opts
|
14
|
-
exit
|
15
|
-
end
|
16
|
-
|
17
|
-
opts.on("-o", "--output=filename", "file to output result") do |name|
|
18
|
-
$options[:output] = name
|
19
|
-
end
|
20
|
-
|
21
|
-
end.parse!
|
22
|
-
|
23
|
-
input_dir = ARGV[0]
|
24
|
-
|
25
|
-
raise "Not a directory: #{input_dir}!" unless input_dir && File.directory?(input_dir)
|
26
|
-
|
27
|
-
pwd = Dir.pwd
|
28
|
-
Dir.chdir(input_dir)
|
29
|
-
Dir.mkdir("scr_output") unless Dir.exist?("scr_output")
|
30
|
-
|
31
|
-
big = YAML::load_file(".metadata/big.yaml")
|
32
|
-
bayo2 = YAML::load_file(".metadata/bayo2.yaml")
|
33
|
-
|
34
|
-
if bayo2
|
35
|
-
scr = Bayonetta::SCR2File::new(nil, big)
|
36
|
-
else
|
37
|
-
scr = Bayonetta::SCRFile::new(nil, big)
|
38
|
-
end
|
39
|
-
|
40
|
-
scr.models_metadata = YAML::load_file(".metadata/models_metadata.yaml")
|
41
|
-
scr.unknown = YAML::load_file(".metadata/unknown.yaml")
|
42
|
-
|
43
|
-
files = Dir.entries(".")
|
44
|
-
models = files.select { |name| name.match "wmb" }
|
45
|
-
models.sort!
|
46
|
-
textures = files.select { |name| name.match "wtb" }.first
|
47
|
-
|
48
|
-
models.each { |name|
|
49
|
-
scr.push_model(File::new(name, "rb"))
|
50
|
-
}
|
51
|
-
|
52
|
-
scr.textures = File::new("000.wtb", "rb") unless bayo2
|
53
|
-
|
54
|
-
output_file = $options[:output]
|
55
|
-
if !output_file
|
56
|
-
Dir.mkdir("scr_output") unless Dir.exist?("scr_output")
|
57
|
-
Dir.chdir("scr_output")
|
58
|
-
output_file = "#{File.basename(input_dir).gsub("_scr", ".scr")}"
|
59
|
-
else
|
60
|
-
Dir.chdir(pwd)
|
61
|
-
end
|
62
|
-
|
63
|
-
scr.dump(output_file)
|
1
|
+
require 'optparse'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative '../../bayonetta'
|
4
|
+
|
5
|
+
$options = {
|
6
|
+
output: nil
|
7
|
+
}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = <<EOF
|
10
|
+
Usage: scr_creator target_directory
|
11
|
+
EOF
|
12
|
+
opts.on("-h", "--help", "Prints this help") do
|
13
|
+
puts opts
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on("-o", "--output=filename", "file to output result") do |name|
|
18
|
+
$options[:output] = name
|
19
|
+
end
|
20
|
+
|
21
|
+
end.parse!
|
22
|
+
|
23
|
+
input_dir = ARGV[0]
|
24
|
+
|
25
|
+
raise "Not a directory: #{input_dir}!" unless input_dir && File.directory?(input_dir)
|
26
|
+
|
27
|
+
pwd = Dir.pwd
|
28
|
+
Dir.chdir(input_dir)
|
29
|
+
Dir.mkdir("scr_output") unless Dir.exist?("scr_output")
|
30
|
+
|
31
|
+
big = YAML::load_file(".metadata/big.yaml")
|
32
|
+
bayo2 = YAML::load_file(".metadata/bayo2.yaml")
|
33
|
+
|
34
|
+
if bayo2
|
35
|
+
scr = Bayonetta::SCR2File::new(nil, big)
|
36
|
+
else
|
37
|
+
scr = Bayonetta::SCRFile::new(nil, big)
|
38
|
+
end
|
39
|
+
|
40
|
+
scr.models_metadata = YAML::load_file(".metadata/models_metadata.yaml")
|
41
|
+
scr.unknown = YAML::load_file(".metadata/unknown.yaml")
|
42
|
+
|
43
|
+
files = Dir.entries(".")
|
44
|
+
models = files.select { |name| name.match "wmb" }
|
45
|
+
models.sort!
|
46
|
+
textures = files.select { |name| name.match "wtb" }.first
|
47
|
+
|
48
|
+
models.each { |name|
|
49
|
+
scr.push_model(File::new(name, "rb"))
|
50
|
+
}
|
51
|
+
|
52
|
+
scr.textures = File::new("000.wtb", "rb") unless bayo2
|
53
|
+
|
54
|
+
output_file = $options[:output]
|
55
|
+
if !output_file
|
56
|
+
Dir.mkdir("scr_output") unless Dir.exist?("scr_output")
|
57
|
+
Dir.chdir("scr_output")
|
58
|
+
output_file = "#{File.basename(input_dir).gsub("_scr", ".scr")}"
|
59
|
+
else
|
60
|
+
Dir.chdir(pwd)
|
61
|
+
end
|
62
|
+
|
63
|
+
scr.dump(output_file)
|