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
data/lib/bayonetta/clh.rb
CHANGED
@@ -1,159 +1,159 @@
|
|
1
|
-
module Bayonetta
|
2
|
-
|
3
|
-
class CLHFile < LibBin::Structure
|
4
|
-
|
5
|
-
class FVector < LibBin::Structure
|
6
|
-
float :x
|
7
|
-
float :y
|
8
|
-
float :z
|
9
|
-
|
10
|
-
def from_bxm_vector(v)
|
11
|
-
@x, @y, @z = v.split(" ").collect(&:to_f)
|
12
|
-
self
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.from_bxm_vector(v)
|
16
|
-
nv = self::new
|
17
|
-
nv.from_bxm_vector(v)
|
18
|
-
nv
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
class ClothAT < LibBin::Structure
|
24
|
-
int16 :p1
|
25
|
-
int16 :p2
|
26
|
-
float :weight
|
27
|
-
float :radius
|
28
|
-
register_field :offset1, FVector
|
29
|
-
register_field :offset2, FVector
|
30
|
-
|
31
|
-
def from_bxm_cloth_at(h)
|
32
|
-
@p1 = h.at_css("p1").content.to_i
|
33
|
-
@p2 = h.at_css("p2").content.to_i
|
34
|
-
@weight = h.at_css("weight").content.to_f
|
35
|
-
@radius = h.at_css("radius").content.to_f
|
36
|
-
@offset1 = FVector.from_bxm_vector(h.at_css("offset1").content)
|
37
|
-
@offset2 = FVector.from_bxm_vector(h.at_css("offset2").content)
|
38
|
-
self
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.from_bxm_cloth_at(c)
|
42
|
-
clat = self::new
|
43
|
-
clat.from_bxm_cloth_at(c)
|
44
|
-
clat
|
45
|
-
end
|
46
|
-
|
47
|
-
def remap(map)
|
48
|
-
@p1 = check_and_remap_bone(map, @p1)
|
49
|
-
@p2 = check_and_remap_bone(map, @p2)
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
def check_and_remap_bone(map, no)
|
54
|
-
tmp = map[no]
|
55
|
-
raise "No bone found in map for #{no}!" unless tmp
|
56
|
-
tmp
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
int32 :cloth_at_num
|
62
|
-
register_field :cloth_at, ClothAT, count: 'cloth_at_num'
|
63
|
-
|
64
|
-
def was_big?
|
65
|
-
@__was_big
|
66
|
-
end
|
67
|
-
|
68
|
-
def remap(map)
|
69
|
-
@cloth_at.each { |c|
|
70
|
-
c.remap(map)
|
71
|
-
}
|
72
|
-
end
|
73
|
-
|
74
|
-
def self.load_bxm(input_name)
|
75
|
-
bxm = BXMFile::load(input_name)
|
76
|
-
clat = self::new
|
77
|
-
|
78
|
-
doc = bxm.to_xml
|
79
|
-
clat.cloth_at_num = doc.at_css("//CLOTH_AT//CLOTH_AT_NUM").content.to_i
|
80
|
-
|
81
|
-
clat.cloth_at = doc.css("//CLOTH_AT//CLOTH_AT_WK").collect { |c|
|
82
|
-
ClothAT.from_bxm_cloth_at(c)
|
83
|
-
}
|
84
|
-
clat
|
85
|
-
end
|
86
|
-
|
87
|
-
def self.is_big?(f)
|
88
|
-
f.rewind
|
89
|
-
f.size
|
90
|
-
block = lambda { |int|
|
91
|
-
num = f.read(4).unpack(int).first
|
92
|
-
( num >= 0 ) && ( num < 256 )
|
93
|
-
}
|
94
|
-
big = block.call("l>")
|
95
|
-
f.rewind
|
96
|
-
small = block.call("l<")
|
97
|
-
f.rewind
|
98
|
-
raise "Invalid data!" unless big ^ small
|
99
|
-
return big
|
100
|
-
end
|
101
|
-
|
102
|
-
def self.convert(input_name, output_name, output_big = false)
|
103
|
-
if input_name.respond_to?(:read) && input_name.respond_to?(:seek)
|
104
|
-
input = input_name
|
105
|
-
else
|
106
|
-
input = File.open(input_name, "rb")
|
107
|
-
end
|
108
|
-
input_big = is_big?(input)
|
109
|
-
|
110
|
-
if output_name.respond_to?(:write) && output_name.respond_to?(:seek)
|
111
|
-
output = output_name
|
112
|
-
else
|
113
|
-
output = File.open(output_name, "wb")
|
114
|
-
end
|
115
|
-
output.rewind
|
116
|
-
|
117
|
-
clp = self::new
|
118
|
-
clp.instance_variable_set(:@__was_big, input_big)
|
119
|
-
clp.__convert(input, output, input_big, output_big)
|
120
|
-
|
121
|
-
input.close unless input_name.respond_to?(:read) && input_name.respond_to?(:seek)
|
122
|
-
output.close unless output_name.respond_to?(:write) && output_name.respond_to?(:seek)
|
123
|
-
clp
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.load(input_name)
|
127
|
-
if input_name.respond_to?(:read) && input_name.respond_to?(:seek)
|
128
|
-
input = input_name
|
129
|
-
else
|
130
|
-
input = File.open(input_name, "rb")
|
131
|
-
end
|
132
|
-
input_big = is_big?(input)
|
133
|
-
|
134
|
-
clp = self::new
|
135
|
-
clp.instance_variable_set(:@__was_big, input_big)
|
136
|
-
clp.__load(input, input_big)
|
137
|
-
input.close unless input_name.respond_to?(:read) && input_name.respond_to?(:seek)
|
138
|
-
clp
|
139
|
-
end
|
140
|
-
|
141
|
-
def dump(output_name, output_big = false)
|
142
|
-
if output_name.respond_to?(:write) && output_name.respond_to?(:seek)
|
143
|
-
output = output_name
|
144
|
-
else
|
145
|
-
output = File.open(output_name, "wb")
|
146
|
-
end
|
147
|
-
output.rewind
|
148
|
-
|
149
|
-
__set_dump_state(output, output_big, nil, nil)
|
150
|
-
__dump_fields
|
151
|
-
__unset_dump_state
|
152
|
-
|
153
|
-
output.close unless output_name.respond_to?(:write) && output_name.respond_to?(:seek)
|
154
|
-
self
|
155
|
-
end
|
156
|
-
|
157
|
-
end
|
158
|
-
|
159
|
-
end
|
1
|
+
module Bayonetta
|
2
|
+
|
3
|
+
class CLHFile < LibBin::Structure
|
4
|
+
|
5
|
+
class FVector < LibBin::Structure
|
6
|
+
float :x
|
7
|
+
float :y
|
8
|
+
float :z
|
9
|
+
|
10
|
+
def from_bxm_vector(v)
|
11
|
+
@x, @y, @z = v.split(" ").collect(&:to_f)
|
12
|
+
self
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.from_bxm_vector(v)
|
16
|
+
nv = self::new
|
17
|
+
nv.from_bxm_vector(v)
|
18
|
+
nv
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
class ClothAT < LibBin::Structure
|
24
|
+
int16 :p1
|
25
|
+
int16 :p2
|
26
|
+
float :weight
|
27
|
+
float :radius
|
28
|
+
register_field :offset1, FVector
|
29
|
+
register_field :offset2, FVector
|
30
|
+
|
31
|
+
def from_bxm_cloth_at(h)
|
32
|
+
@p1 = h.at_css("p1").content.to_i
|
33
|
+
@p2 = h.at_css("p2").content.to_i
|
34
|
+
@weight = h.at_css("weight").content.to_f
|
35
|
+
@radius = h.at_css("radius").content.to_f
|
36
|
+
@offset1 = FVector.from_bxm_vector(h.at_css("offset1").content)
|
37
|
+
@offset2 = FVector.from_bxm_vector(h.at_css("offset2").content)
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.from_bxm_cloth_at(c)
|
42
|
+
clat = self::new
|
43
|
+
clat.from_bxm_cloth_at(c)
|
44
|
+
clat
|
45
|
+
end
|
46
|
+
|
47
|
+
def remap(map)
|
48
|
+
@p1 = check_and_remap_bone(map, @p1)
|
49
|
+
@p2 = check_and_remap_bone(map, @p2)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def check_and_remap_bone(map, no)
|
54
|
+
tmp = map[no]
|
55
|
+
raise "No bone found in map for #{no}!" unless tmp
|
56
|
+
tmp
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
int32 :cloth_at_num
|
62
|
+
register_field :cloth_at, ClothAT, count: 'cloth_at_num'
|
63
|
+
|
64
|
+
def was_big?
|
65
|
+
@__was_big
|
66
|
+
end
|
67
|
+
|
68
|
+
def remap(map)
|
69
|
+
@cloth_at.each { |c|
|
70
|
+
c.remap(map)
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.load_bxm(input_name)
|
75
|
+
bxm = BXMFile::load(input_name)
|
76
|
+
clat = self::new
|
77
|
+
|
78
|
+
doc = bxm.to_xml
|
79
|
+
clat.cloth_at_num = doc.at_css("//CLOTH_AT//CLOTH_AT_NUM").content.to_i
|
80
|
+
|
81
|
+
clat.cloth_at = doc.css("//CLOTH_AT//CLOTH_AT_WK").collect { |c|
|
82
|
+
ClothAT.from_bxm_cloth_at(c)
|
83
|
+
}
|
84
|
+
clat
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.is_big?(f)
|
88
|
+
f.rewind
|
89
|
+
f.size
|
90
|
+
block = lambda { |int|
|
91
|
+
num = f.read(4).unpack(int).first
|
92
|
+
( num >= 0 ) && ( num < 256 )
|
93
|
+
}
|
94
|
+
big = block.call("l>")
|
95
|
+
f.rewind
|
96
|
+
small = block.call("l<")
|
97
|
+
f.rewind
|
98
|
+
raise "Invalid data!" unless big ^ small
|
99
|
+
return big
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.convert(input_name, output_name, output_big = false)
|
103
|
+
if input_name.respond_to?(:read) && input_name.respond_to?(:seek)
|
104
|
+
input = input_name
|
105
|
+
else
|
106
|
+
input = File.open(input_name, "rb")
|
107
|
+
end
|
108
|
+
input_big = is_big?(input)
|
109
|
+
|
110
|
+
if output_name.respond_to?(:write) && output_name.respond_to?(:seek)
|
111
|
+
output = output_name
|
112
|
+
else
|
113
|
+
output = File.open(output_name, "wb")
|
114
|
+
end
|
115
|
+
output.rewind
|
116
|
+
|
117
|
+
clp = self::new
|
118
|
+
clp.instance_variable_set(:@__was_big, input_big)
|
119
|
+
clp.__convert(input, output, input_big, output_big)
|
120
|
+
|
121
|
+
input.close unless input_name.respond_to?(:read) && input_name.respond_to?(:seek)
|
122
|
+
output.close unless output_name.respond_to?(:write) && output_name.respond_to?(:seek)
|
123
|
+
clp
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.load(input_name)
|
127
|
+
if input_name.respond_to?(:read) && input_name.respond_to?(:seek)
|
128
|
+
input = input_name
|
129
|
+
else
|
130
|
+
input = File.open(input_name, "rb")
|
131
|
+
end
|
132
|
+
input_big = is_big?(input)
|
133
|
+
|
134
|
+
clp = self::new
|
135
|
+
clp.instance_variable_set(:@__was_big, input_big)
|
136
|
+
clp.__load(input, input_big)
|
137
|
+
input.close unless input_name.respond_to?(:read) && input_name.respond_to?(:seek)
|
138
|
+
clp
|
139
|
+
end
|
140
|
+
|
141
|
+
def dump(output_name, output_big = false)
|
142
|
+
if output_name.respond_to?(:write) && output_name.respond_to?(:seek)
|
143
|
+
output = output_name
|
144
|
+
else
|
145
|
+
output = File.open(output_name, "wb")
|
146
|
+
end
|
147
|
+
output.rewind
|
148
|
+
|
149
|
+
__set_dump_state(output, output_big, nil, nil)
|
150
|
+
__dump_fields
|
151
|
+
__unset_dump_state
|
152
|
+
|
153
|
+
output.close unless output_name.respond_to?(:write) && output_name.respond_to?(:seek)
|
154
|
+
self
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|