pgtools 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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 +474 -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,95 +1,95 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require_relative '../../bayonetta'
|
3
|
-
require 'shellwords'
|
4
|
-
include Bayonetta
|
5
|
-
|
6
|
-
# https://stackoverflow.com/a/5471032
|
7
|
-
def which(cmd)
|
8
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
9
|
-
exe = File.join(path, cmd)
|
10
|
-
return exe if File.executable?(exe) && !File.directory?(exe)
|
11
|
-
end
|
12
|
-
nil
|
13
|
-
end
|
14
|
-
|
15
|
-
$options = {
|
16
|
-
output: nil
|
17
|
-
}
|
18
|
-
|
19
|
-
OptionParser.new do |opts|
|
20
|
-
opts.banner = <<EOF
|
21
|
-
Usage: wtb_convert_wiiu_pc target_file
|
22
|
-
EOF
|
23
|
-
opts.on("-h", "--help", "Prints this help") do
|
24
|
-
puts opts
|
25
|
-
exit
|
26
|
-
end
|
27
|
-
|
28
|
-
opts.on("-o", "--output=filename", "file to output result") do |name|
|
29
|
-
$options[:output] = name
|
30
|
-
end
|
31
|
-
|
32
|
-
end.parse!
|
33
|
-
|
34
|
-
input_file = ARGV[0]
|
35
|
-
|
36
|
-
raise "Invalid file #{input_file}" unless input_file && File::file?(input_file)
|
37
|
-
|
38
|
-
if File.extname(input_file) == ".wta"
|
39
|
-
fl = WTBFile::new(File::new(input_file, "rb"), true, File::new(input_file.gsub(/wta\z/,"wtp"), "rb"))
|
40
|
-
else
|
41
|
-
fl = WTBFile::new(File::new(input_file, "rb"))
|
42
|
-
end
|
43
|
-
Dir.mkdir("tex_output") unless Dir.exist?("tex_output")
|
44
|
-
prefix = File.join("tex_output", File.basename(input_file, ".wtb"))
|
45
|
-
texs = fl.each.each_with_index.collect { |info_f, i|
|
46
|
-
info, f = info_f
|
47
|
-
ext, flags, idx = info
|
48
|
-
tex_name = "#{prefix}_#{"%03d"%i}#{ext}"
|
49
|
-
File::open(tex_name, "wb") { |f2|
|
50
|
-
f.rewind
|
51
|
-
f2.write(f.read)
|
52
|
-
}
|
53
|
-
[tex_name, [flags, idx]]
|
54
|
-
}
|
55
|
-
|
56
|
-
tex_conv_path = which("TexConv2.exe")
|
57
|
-
if !tex_conv_path
|
58
|
-
tex_conv_path = File.join(".", "TexConv2.exe")
|
59
|
-
if (!File.exist?(tex_conv_path))
|
60
|
-
tex_conv_path = File.join(File.expand_path(File.join(File.dirname(__FILE__), *[".."]*3)), "TexConv2.exe")
|
61
|
-
if (!File.exist?(tex_conv_path))
|
62
|
-
tex_conv_path = nil
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
fl2 = WTBFile::new
|
68
|
-
fl2.unknown = fl.unknown
|
69
|
-
|
70
|
-
texs.each { |name, info|
|
71
|
-
flags, idx = info
|
72
|
-
if File.extname(input_file) == ".wta"
|
73
|
-
flags &= 0xffffffdf #remove 0x20 flag
|
74
|
-
if flags == 0x70000000
|
75
|
-
flags = 0x10000000
|
76
|
-
else
|
77
|
-
flags = 0x20000000
|
78
|
-
end
|
79
|
-
else
|
80
|
-
flags &= 0xfffffffd #remove 0x2 flag
|
81
|
-
end
|
82
|
-
new_name = name.gsub("gtx","dds")
|
83
|
-
raise "could not locate TexConv2.exe, put it in your PATH" unless tex_conv_path
|
84
|
-
res = `#{Shellwords.escape tex_conv_path} -i #{Shellwords.escape name} -o #{Shellwords.escape new_name}`
|
85
|
-
raise "could not execute TexConv2.exe:\n#{res}" if !$?.success?
|
86
|
-
fl2.push( File::new(new_name, "rb"), flags, idx )
|
87
|
-
}
|
88
|
-
|
89
|
-
output_file = $options[:output]
|
90
|
-
if !output_file
|
91
|
-
Dir.mkdir("wtb_output") unless Dir.exist?("wtb_output")
|
92
|
-
output_file = File.join("wtb_output", "#{File.basename(input_file.gsub(/wta\z/,"wtb"))}")
|
93
|
-
end
|
94
|
-
fl2.dump(output_file)
|
95
|
-
|
1
|
+
require 'optparse'
|
2
|
+
require_relative '../../bayonetta'
|
3
|
+
require 'shellwords'
|
4
|
+
include Bayonetta
|
5
|
+
|
6
|
+
# https://stackoverflow.com/a/5471032
|
7
|
+
def which(cmd)
|
8
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
9
|
+
exe = File.join(path, cmd)
|
10
|
+
return exe if File.executable?(exe) && !File.directory?(exe)
|
11
|
+
end
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
|
15
|
+
$options = {
|
16
|
+
output: nil
|
17
|
+
}
|
18
|
+
|
19
|
+
OptionParser.new do |opts|
|
20
|
+
opts.banner = <<EOF
|
21
|
+
Usage: wtb_convert_wiiu_pc target_file
|
22
|
+
EOF
|
23
|
+
opts.on("-h", "--help", "Prints this help") do
|
24
|
+
puts opts
|
25
|
+
exit
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on("-o", "--output=filename", "file to output result") do |name|
|
29
|
+
$options[:output] = name
|
30
|
+
end
|
31
|
+
|
32
|
+
end.parse!
|
33
|
+
|
34
|
+
input_file = ARGV[0]
|
35
|
+
|
36
|
+
raise "Invalid file #{input_file}" unless input_file && File::file?(input_file)
|
37
|
+
|
38
|
+
if File.extname(input_file) == ".wta"
|
39
|
+
fl = WTBFile::new(File::new(input_file, "rb"), true, File::new(input_file.gsub(/wta\z/,"wtp"), "rb"))
|
40
|
+
else
|
41
|
+
fl = WTBFile::new(File::new(input_file, "rb"))
|
42
|
+
end
|
43
|
+
Dir.mkdir("tex_output") unless Dir.exist?("tex_output")
|
44
|
+
prefix = File.join("tex_output", File.basename(input_file, ".wtb"))
|
45
|
+
texs = fl.each.each_with_index.collect { |info_f, i|
|
46
|
+
info, f = info_f
|
47
|
+
ext, flags, idx = info
|
48
|
+
tex_name = "#{prefix}_#{"%03d"%i}#{ext}"
|
49
|
+
File::open(tex_name, "wb") { |f2|
|
50
|
+
f.rewind
|
51
|
+
f2.write(f.read)
|
52
|
+
}
|
53
|
+
[tex_name, [flags, idx]]
|
54
|
+
}
|
55
|
+
|
56
|
+
tex_conv_path = which("TexConv2.exe")
|
57
|
+
if !tex_conv_path
|
58
|
+
tex_conv_path = File.join(".", "TexConv2.exe")
|
59
|
+
if (!File.exist?(tex_conv_path))
|
60
|
+
tex_conv_path = File.join(File.expand_path(File.join(File.dirname(__FILE__), *[".."]*3)), "TexConv2.exe")
|
61
|
+
if (!File.exist?(tex_conv_path))
|
62
|
+
tex_conv_path = nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
fl2 = WTBFile::new
|
68
|
+
fl2.unknown = fl.unknown
|
69
|
+
|
70
|
+
texs.each { |name, info|
|
71
|
+
flags, idx = info
|
72
|
+
if File.extname(input_file) == ".wta"
|
73
|
+
flags &= 0xffffffdf #remove 0x20 flag
|
74
|
+
if flags == 0x70000000
|
75
|
+
flags = 0x10000000
|
76
|
+
else
|
77
|
+
flags = 0x20000000
|
78
|
+
end
|
79
|
+
else
|
80
|
+
flags &= 0xfffffffd #remove 0x2 flag
|
81
|
+
end
|
82
|
+
new_name = name.gsub("gtx","dds")
|
83
|
+
raise "could not locate TexConv2.exe, put it in your PATH" unless tex_conv_path
|
84
|
+
res = `#{Shellwords.escape tex_conv_path} -i #{Shellwords.escape name} -o #{Shellwords.escape new_name}`
|
85
|
+
raise "could not execute TexConv2.exe:\n#{res}" if !$?.success?
|
86
|
+
fl2.push( File::new(new_name, "rb"), flags, idx )
|
87
|
+
}
|
88
|
+
|
89
|
+
output_file = $options[:output]
|
90
|
+
if !output_file
|
91
|
+
Dir.mkdir("wtb_output") unless Dir.exist?("wtb_output")
|
92
|
+
output_file = File.join("wtb_output", "#{File.basename(input_file.gsub(/wta\z/,"wtb"))}")
|
93
|
+
end
|
94
|
+
fl2.dump(output_file)
|
95
|
+
|
@@ -1,103 +1,103 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require_relative '../../bayonetta.rb'
|
3
|
-
require 'shellwords'
|
4
|
-
include Bayonetta
|
5
|
-
|
6
|
-
# https://stackoverflow.com/a/5471032
|
7
|
-
def which(cmd)
|
8
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
9
|
-
exe = File.join(path, cmd)
|
10
|
-
return exe if File.executable?(exe) && !File.directory?(exe)
|
11
|
-
end
|
12
|
-
nil
|
13
|
-
end
|
14
|
-
|
15
|
-
$options = {}
|
16
|
-
|
17
|
-
OptionParser.new do |opts|
|
18
|
-
opts.banner = "Usage: wtb_import_textures.rb target_file source_file [options]"
|
19
|
-
|
20
|
-
opts.on("-o", "--[no-]overwrite", "Overwrite destination file") do |overwrite|
|
21
|
-
$options[:overwrite] = overwrite
|
22
|
-
end
|
23
|
-
|
24
|
-
opts.on("-h", "--help", "Prints this help") do
|
25
|
-
puts opts
|
26
|
-
exit
|
27
|
-
end
|
28
|
-
|
29
|
-
end.parse!
|
30
|
-
|
31
|
-
input_file1 = ARGV[0]
|
32
|
-
input_file2 = ARGV[1]
|
33
|
-
raise "Invalid file #{input_file1}" unless File::file?(input_file1)
|
34
|
-
fl0 = WTBFile::new(File::new(input_file1, "rb"))
|
35
|
-
|
36
|
-
|
37
|
-
raise "Invalid file #{input_file2}" unless File::file?(input_file2)
|
38
|
-
if File.extname(input_file2) == ".wta"
|
39
|
-
fl = WTBFile::new(File::new(input_file2, "rb"), true, File::new(input_file2.gsub(/wta\z/,"wtp"), "rb"))
|
40
|
-
else
|
41
|
-
fl = WTBFile::new(File::new(input_file2, "rb"))
|
42
|
-
end
|
43
|
-
Dir.mkdir("tex_output") unless Dir.exist?("tex_output")
|
44
|
-
prefix = File.join("tex_output", File.basename(input_file2, ".wtb"))
|
45
|
-
texs = fl.each.each_with_index.collect { |info_f, i|
|
46
|
-
info, f = info_f
|
47
|
-
ext, flags, idx = info
|
48
|
-
tex_name = "#{prefix}_#{"%03d"%i}#{ext}"
|
49
|
-
File::open(tex_name, "wb") { |f2|
|
50
|
-
f.rewind
|
51
|
-
f2.write(f.read)
|
52
|
-
}
|
53
|
-
[tex_name, [flags, idx]]
|
54
|
-
}
|
55
|
-
|
56
|
-
tex_conv_path = which("TexConv2.exe")
|
57
|
-
if !tex_conv_path
|
58
|
-
tex_conv_path = File.join(".", "TexConv2.exe")
|
59
|
-
if (!File.exist?(tex_conv_path))
|
60
|
-
tex_conv_path = File.join(File.expand_path(File.join(File.dirname(__FILE__), *[".."]*3)), "TexConv2.exe")
|
61
|
-
if (!File.exist?(tex_conv_path))
|
62
|
-
tex_conv_path = nil
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
fl2 = WTBFile::new
|
68
|
-
fl2.unknown = fl.unknown
|
69
|
-
|
70
|
-
fl0.each { |info, f|
|
71
|
-
ext, flags, idx = info
|
72
|
-
fl2.push( f, flags, idx )
|
73
|
-
}
|
74
|
-
|
75
|
-
texs.each { |name, info|
|
76
|
-
flags, idx = info
|
77
|
-
if File.extname(input_file2) == ".wta"
|
78
|
-
flags &= 0xffffffdf #remove 0x20 flag
|
79
|
-
if flags == 0x70000000
|
80
|
-
flags = 0x10000000
|
81
|
-
else
|
82
|
-
flags = 0x20000000
|
83
|
-
end
|
84
|
-
elsif fl.big
|
85
|
-
flags &= 0xfffffffd #remove 0x2 flag
|
86
|
-
end
|
87
|
-
if File.extname(name) == ".gtx"
|
88
|
-
new_name = name.gsub("gtx","dds")
|
89
|
-
raise "could not locate TexConv2.exe, put it in your PATH" unless tex_conv_path
|
90
|
-
res = `#{Shellwords.escape tex_conv_path} -i #{Shellwords.escape name} -o #{Shellwords.escape new_name}`
|
91
|
-
raise "could not execute TexConv2.exe:\n#{res}" if !$?.success?
|
92
|
-
else
|
93
|
-
new_name = name
|
94
|
-
end
|
95
|
-
fl2.push( File::new(new_name, "rb"), flags, nil )
|
96
|
-
}
|
97
|
-
|
98
|
-
if $options[:overwrite]
|
99
|
-
fl2.dump(input_file1)
|
100
|
-
else
|
101
|
-
Dir.mkdir("wtb_output") unless Dir.exist?("wtb_output")
|
102
|
-
fl2.dump(File.join("wtb_output", File.basename(input_file1)))
|
103
|
-
end
|
1
|
+
require 'optparse'
|
2
|
+
require_relative '../../bayonetta.rb'
|
3
|
+
require 'shellwords'
|
4
|
+
include Bayonetta
|
5
|
+
|
6
|
+
# https://stackoverflow.com/a/5471032
|
7
|
+
def which(cmd)
|
8
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
9
|
+
exe = File.join(path, cmd)
|
10
|
+
return exe if File.executable?(exe) && !File.directory?(exe)
|
11
|
+
end
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
|
15
|
+
$options = {}
|
16
|
+
|
17
|
+
OptionParser.new do |opts|
|
18
|
+
opts.banner = "Usage: wtb_import_textures.rb target_file source_file [options]"
|
19
|
+
|
20
|
+
opts.on("-o", "--[no-]overwrite", "Overwrite destination file") do |overwrite|
|
21
|
+
$options[:overwrite] = overwrite
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on("-h", "--help", "Prints this help") do
|
25
|
+
puts opts
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
|
29
|
+
end.parse!
|
30
|
+
|
31
|
+
input_file1 = ARGV[0]
|
32
|
+
input_file2 = ARGV[1]
|
33
|
+
raise "Invalid file #{input_file1}" unless File::file?(input_file1)
|
34
|
+
fl0 = WTBFile::new(File::new(input_file1, "rb"))
|
35
|
+
|
36
|
+
|
37
|
+
raise "Invalid file #{input_file2}" unless File::file?(input_file2)
|
38
|
+
if File.extname(input_file2) == ".wta"
|
39
|
+
fl = WTBFile::new(File::new(input_file2, "rb"), true, File::new(input_file2.gsub(/wta\z/,"wtp"), "rb"))
|
40
|
+
else
|
41
|
+
fl = WTBFile::new(File::new(input_file2, "rb"))
|
42
|
+
end
|
43
|
+
Dir.mkdir("tex_output") unless Dir.exist?("tex_output")
|
44
|
+
prefix = File.join("tex_output", File.basename(input_file2, ".wtb"))
|
45
|
+
texs = fl.each.each_with_index.collect { |info_f, i|
|
46
|
+
info, f = info_f
|
47
|
+
ext, flags, idx = info
|
48
|
+
tex_name = "#{prefix}_#{"%03d"%i}#{ext}"
|
49
|
+
File::open(tex_name, "wb") { |f2|
|
50
|
+
f.rewind
|
51
|
+
f2.write(f.read)
|
52
|
+
}
|
53
|
+
[tex_name, [flags, idx]]
|
54
|
+
}
|
55
|
+
|
56
|
+
tex_conv_path = which("TexConv2.exe")
|
57
|
+
if !tex_conv_path
|
58
|
+
tex_conv_path = File.join(".", "TexConv2.exe")
|
59
|
+
if (!File.exist?(tex_conv_path))
|
60
|
+
tex_conv_path = File.join(File.expand_path(File.join(File.dirname(__FILE__), *[".."]*3)), "TexConv2.exe")
|
61
|
+
if (!File.exist?(tex_conv_path))
|
62
|
+
tex_conv_path = nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
fl2 = WTBFile::new
|
68
|
+
fl2.unknown = fl.unknown
|
69
|
+
|
70
|
+
fl0.each { |info, f|
|
71
|
+
ext, flags, idx = info
|
72
|
+
fl2.push( f, flags, idx )
|
73
|
+
}
|
74
|
+
|
75
|
+
texs.each { |name, info|
|
76
|
+
flags, idx = info
|
77
|
+
if File.extname(input_file2) == ".wta"
|
78
|
+
flags &= 0xffffffdf #remove 0x20 flag
|
79
|
+
if flags == 0x70000000
|
80
|
+
flags = 0x10000000
|
81
|
+
else
|
82
|
+
flags = 0x20000000
|
83
|
+
end
|
84
|
+
elsif fl.big
|
85
|
+
flags &= 0xfffffffd #remove 0x2 flag
|
86
|
+
end
|
87
|
+
if File.extname(name) == ".gtx"
|
88
|
+
new_name = name.gsub("gtx","dds")
|
89
|
+
raise "could not locate TexConv2.exe, put it in your PATH" unless tex_conv_path
|
90
|
+
res = `#{Shellwords.escape tex_conv_path} -i #{Shellwords.escape name} -o #{Shellwords.escape new_name}`
|
91
|
+
raise "could not execute TexConv2.exe:\n#{res}" if !$?.success?
|
92
|
+
else
|
93
|
+
new_name = name
|
94
|
+
end
|
95
|
+
fl2.push( File::new(new_name, "rb"), flags, nil )
|
96
|
+
}
|
97
|
+
|
98
|
+
if $options[:overwrite]
|
99
|
+
fl2.dump(input_file1)
|
100
|
+
else
|
101
|
+
Dir.mkdir("wtb_output") unless Dir.exist?("wtb_output")
|
102
|
+
fl2.dump(File.join("wtb_output", File.basename(input_file1)))
|
103
|
+
end
|
@@ -1,69 +1,69 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'yaml'
|
3
|
-
require_relative '../../bayonetta'
|
4
|
-
include Bayonetta
|
5
|
-
|
6
|
-
$options = {
|
7
|
-
output: nil
|
8
|
-
}
|
9
|
-
OptionParser.new do |opts|
|
10
|
-
opts.banner = <<EOF
|
11
|
-
Usage: wtx_creator target_directory
|
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_dir = ARGV[0]
|
25
|
-
|
26
|
-
raise "Not a directory: #{input_dir}!" unless input_dir && File.directory?(input_dir)
|
27
|
-
|
28
|
-
files = Dir.entries(input_dir)
|
29
|
-
pwd = Dir.pwd
|
30
|
-
Dir.chdir(input_dir)
|
31
|
-
files.select! { |f| File.file?(f) && [".gtx", ".dds", ".bntx", ".xt1"].include?( File.extname(f) ) }
|
32
|
-
files.sort!
|
33
|
-
puts files
|
34
|
-
files.collect! { |fname| File::new(fname, "rb") }
|
35
|
-
|
36
|
-
big = false
|
37
|
-
big = YAML::load_file(".metadata/big.yaml") if File.exist?(".metadata/big.yaml")
|
38
|
-
extension = ".wtb"
|
39
|
-
extension = YAML::load_file(".metadata/extension.yaml") if File.exist?(".metadata/extension.yaml")
|
40
|
-
flags = []
|
41
|
-
flags = YAML::load_file(".metadata/texture_flags.yaml") if File.exist?(".metadata/texture_flags.yaml")
|
42
|
-
idx = []
|
43
|
-
idx = YAML::load_file(".metadata/texture_idx.yaml") if File.exist?(".metadata/texture_idx.yaml")
|
44
|
-
infos = []
|
45
|
-
infos = YAML::load_file(".metadata/texture_infos.yaml") if File.exist?(".metadata/texture_infos.yaml")
|
46
|
-
unknown = 0
|
47
|
-
unknown = YAML::load_file(".metadata/unknown.yaml") if File.exist?(".metadata/unknown.yaml")
|
48
|
-
|
49
|
-
|
50
|
-
wtb = WTBFile::new(nil, big, extension == ".wta")
|
51
|
-
files.each { |f|
|
52
|
-
wtb.push(f)
|
53
|
-
}
|
54
|
-
wtb.texture_flags = flags
|
55
|
-
wtb.texture_infos = infos
|
56
|
-
wtb.texture_idx = idx
|
57
|
-
wtb.unknown = unknown
|
58
|
-
|
59
|
-
output_file = $options[:output]
|
60
|
-
if !output_file
|
61
|
-
Dir.mkdir("wtx_output") unless Dir.exist?("wtx_output")
|
62
|
-
Dir.chdir("wtx_output")
|
63
|
-
output_file = File.basename(ARGV[0]).gsub("_wta","").gsub("_wtb", "") << extension
|
64
|
-
else
|
65
|
-
Dir.chdir(pwd)
|
66
|
-
end
|
67
|
-
|
68
|
-
wtb.dump(output_file)
|
69
|
-
|
1
|
+
require 'optparse'
|
2
|
+
require 'yaml'
|
3
|
+
require_relative '../../bayonetta'
|
4
|
+
include Bayonetta
|
5
|
+
|
6
|
+
$options = {
|
7
|
+
output: nil
|
8
|
+
}
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = <<EOF
|
11
|
+
Usage: wtx_creator target_directory
|
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_dir = ARGV[0]
|
25
|
+
|
26
|
+
raise "Not a directory: #{input_dir}!" unless input_dir && File.directory?(input_dir)
|
27
|
+
|
28
|
+
files = Dir.entries(input_dir)
|
29
|
+
pwd = Dir.pwd
|
30
|
+
Dir.chdir(input_dir)
|
31
|
+
files.select! { |f| File.file?(f) && [".gtx", ".dds", ".bntx", ".xt1"].include?( File.extname(f) ) }
|
32
|
+
files.sort!
|
33
|
+
puts files
|
34
|
+
files.collect! { |fname| File::new(fname, "rb") }
|
35
|
+
|
36
|
+
big = false
|
37
|
+
big = YAML::load_file(".metadata/big.yaml") if File.exist?(".metadata/big.yaml")
|
38
|
+
extension = ".wtb"
|
39
|
+
extension = YAML::load_file(".metadata/extension.yaml") if File.exist?(".metadata/extension.yaml")
|
40
|
+
flags = []
|
41
|
+
flags = YAML::load_file(".metadata/texture_flags.yaml") if File.exist?(".metadata/texture_flags.yaml")
|
42
|
+
idx = []
|
43
|
+
idx = YAML::load_file(".metadata/texture_idx.yaml") if File.exist?(".metadata/texture_idx.yaml")
|
44
|
+
infos = []
|
45
|
+
infos = YAML::load_file(".metadata/texture_infos.yaml") if File.exist?(".metadata/texture_infos.yaml")
|
46
|
+
unknown = 0
|
47
|
+
unknown = YAML::load_file(".metadata/unknown.yaml") if File.exist?(".metadata/unknown.yaml")
|
48
|
+
|
49
|
+
|
50
|
+
wtb = WTBFile::new(nil, big, extension == ".wta")
|
51
|
+
files.each { |f|
|
52
|
+
wtb.push(f)
|
53
|
+
}
|
54
|
+
wtb.texture_flags = flags
|
55
|
+
wtb.texture_infos = infos
|
56
|
+
wtb.texture_idx = idx
|
57
|
+
wtb.unknown = unknown
|
58
|
+
|
59
|
+
output_file = $options[:output]
|
60
|
+
if !output_file
|
61
|
+
Dir.mkdir("wtx_output") unless Dir.exist?("wtx_output")
|
62
|
+
Dir.chdir("wtx_output")
|
63
|
+
output_file = File.basename(ARGV[0]).gsub("_wta","").gsub("_wtb", "") << extension
|
64
|
+
else
|
65
|
+
Dir.chdir(pwd)
|
66
|
+
end
|
67
|
+
|
68
|
+
wtb.dump(output_file)
|
69
|
+
|