pgtools 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +25 -25
  3. data/bin/bxm_decoder +2 -2
  4. data/bin/bxm_encoder +2 -2
  5. data/bin/clh_convert +2 -2
  6. data/bin/clp_convert +2 -2
  7. data/bin/clw_convert +2 -2
  8. data/bin/dat_creator +2 -2
  9. data/bin/dat_extractor +2 -2
  10. data/bin/dat_ls +2 -2
  11. data/bin/eff_idd_creator +2 -2
  12. data/bin/eff_idd_extractor +2 -2
  13. data/bin/exp_convert_wiiu_pc +2 -2
  14. data/bin/exp_tool +2 -2
  15. data/bin/mot_convert_wiiu_pc +2 -2
  16. data/bin/mot_tool +2 -2
  17. data/bin/pkz_extractor +2 -2
  18. data/bin/scr_creator +2 -2
  19. data/bin/scr_extractor +2 -2
  20. data/bin/wmb_cleanup +2 -2
  21. data/bin/wmb_common_bones +2 -2
  22. data/bin/wmb_convert_pc_switch +2 -2
  23. data/bin/wmb_convert_wiiu_pc +2 -2
  24. data/bin/wmb_export_assimp +2 -2
  25. data/bin/wmb_get_bone_map +2 -2
  26. data/bin/wmb_import_assimp +2 -2
  27. data/bin/wmb_import_nier +2 -2
  28. data/bin/wmb_import_wiiu +2 -2
  29. data/bin/wtb_convert_wiiu_pc +2 -2
  30. data/bin/wtx_creator +2 -2
  31. data/bin/wtx_extractor +2 -2
  32. data/lib/bayonetta/alignment.rb +0 -0
  33. data/lib/bayonetta/bone.rb +0 -0
  34. data/lib/bayonetta/bxm.rb +180 -180
  35. data/lib/bayonetta/clh.rb +159 -159
  36. data/lib/bayonetta/clp.rb +212 -212
  37. data/lib/bayonetta/clw.rb +166 -166
  38. data/lib/bayonetta/dat.rb +261 -261
  39. data/lib/bayonetta/eff.rb +314 -314
  40. data/lib/bayonetta/endianness.rb +0 -0
  41. data/lib/bayonetta/exp.rb +768 -768
  42. data/lib/bayonetta/linalg.rb +416 -416
  43. data/lib/bayonetta/material_database.yaml +2581 -2581
  44. data/lib/bayonetta/mot.rb +763 -763
  45. data/lib/bayonetta/pkz.rb +63 -63
  46. data/lib/bayonetta/scr.rb +0 -0
  47. data/lib/bayonetta/tools/bxm_decoder.rb +23 -23
  48. data/lib/bayonetta/tools/bxm_encoder.rb +37 -37
  49. data/lib/bayonetta/tools/clh_convert.rb +60 -60
  50. data/lib/bayonetta/tools/clp_convert.rb +70 -70
  51. data/lib/bayonetta/tools/clw_convert.rb +60 -60
  52. data/lib/bayonetta/tools/dat_creator.rb +57 -57
  53. data/lib/bayonetta/tools/dat_extractor.rb +94 -94
  54. data/lib/bayonetta/tools/dat_ls.rb +106 -106
  55. data/lib/bayonetta/tools/eff_idd_creator.rb +66 -66
  56. data/lib/bayonetta/tools/eff_idd_extractor.rb +73 -73
  57. data/lib/bayonetta/tools/exp_convert_wiiu_pc.rb +33 -33
  58. data/lib/bayonetta/tools/exp_tool.rb +48 -48
  59. data/lib/bayonetta/tools/mot_convert_wiiu_pc.rb +33 -33
  60. data/lib/bayonetta/tools/mot_tool.rb +0 -0
  61. data/lib/bayonetta/tools/pkz_extractor.rb +75 -75
  62. data/lib/bayonetta/tools/scr_creator.rb +63 -63
  63. data/lib/bayonetta/tools/scr_extractor.rb +78 -78
  64. data/lib/bayonetta/tools/wmb_cleanup.rb +250 -250
  65. data/lib/bayonetta/tools/wmb_common_bones.rb +45 -45
  66. data/lib/bayonetta/tools/wmb_convert_pc_switch.rb +35 -35
  67. data/lib/bayonetta/tools/wmb_convert_wiiu_pc.rb +33 -33
  68. data/lib/bayonetta/tools/wmb_export_assimp.rb +479 -479
  69. data/lib/bayonetta/tools/wmb_get_bone_map.rb +50 -50
  70. data/lib/bayonetta/tools/wmb_import_assimp.rb +735 -735
  71. data/lib/bayonetta/tools/wmb_import_geometry_wiiu_pc.rb +472 -472
  72. data/lib/bayonetta/tools/wmb_import_nier.rb +309 -309
  73. data/lib/bayonetta/tools/wtb_convert_wiiu_pc.rb +95 -95
  74. data/lib/bayonetta/tools/wtb_import_textures.rb +103 -103
  75. data/lib/bayonetta/tools/wtx_creator.rb +69 -69
  76. data/lib/bayonetta/tools/wtx_extractor.rb +85 -85
  77. data/lib/bayonetta/vertex_types.yaml +0 -0
  78. data/lib/bayonetta/vertex_types2.yaml +0 -0
  79. data/lib/bayonetta/vertex_types_nier.yaml +145 -145
  80. data/lib/bayonetta/wmb.rb +2455 -2443
  81. data/lib/bayonetta/wmb3.rb +759 -759
  82. data/lib/bayonetta/wtb.rb +481 -481
  83. data/lib/bayonetta.rb +60 -60
  84. metadata +2 -2
data/lib/bayonetta/clw.rb CHANGED
@@ -1,166 +1,166 @@
1
- module Bayonetta
2
-
3
- class CLWFile < 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 ClothWind < LibBin::Structure
24
- int32 :wind_type
25
- int32 :parts_no
26
- register_field :offset, FVector
27
- register_field :offset2, FVector
28
- float :radius
29
- float :power
30
- float :timer
31
- float :swing_rate
32
- float :swing_spd
33
- float :delay_max
34
-
35
- def from_bxm_cloth_wind(h)
36
- @wind_type = h.at_css("WindType").content.to_i
37
- @parts_no = h.at_css("PartsNo").content.to_i
38
- @offset = FVector.from_bxm_vector(h.at_css("Offset").content)
39
- @offset2 = FVector.from_bxm_vector(h.at_css("Offset2").content)
40
- @radius = h.at_css("Radius").content.to_f
41
- @power = h.at_css("Power").content.to_f
42
- @timer = h.at_css("Timer").content.to_f
43
- @swing_rate = h.at_css("SwingRate").content.to_f
44
- @swing_spd = h.at_css("SwingSpd").content.to_f
45
- @delay_max = h.at_css("DelayMax").content.to_f
46
- self
47
- end
48
-
49
- def self.from_bxm_cloth_wind(c)
50
- clw = self::new
51
- clw.from_bxm_cloth_wind(c)
52
- clw
53
- end
54
-
55
- def remap(map)
56
- @parts_no = check_and_remap_bone(map, @parts_no)
57
- end
58
-
59
- private
60
- def check_and_remap_bone(map, no)
61
- tmp = map[no]
62
- raise "No bone found in map for #{no}!" unless tmp
63
- tmp
64
- end
65
-
66
- end
67
-
68
- int32 :cloth_wind_num
69
- register_field :cloth_wind, ClothWind, count: 'cloth_wind_num'
70
-
71
- def was_big?
72
- @__was_big
73
- end
74
-
75
- def remap(map)
76
- @cloth_wind.each { |c|
77
- c.remap(map)
78
- }
79
- end
80
-
81
- def self.load_bxm(input_name)
82
- bxm = BXMFile::load(input_name)
83
- clw = self::new
84
-
85
- doc = bxm.to_xml
86
- clw.cloth_wind_num = doc.at_css("//CLOTH_WIND//CLOTH_WIND_NUM").content.to_i
87
-
88
- clw.cloth_wind = doc.css("//CLOTH_WIND//CLOTH_WIND_WK").collect { |c|
89
- ClothWind.from_bxm_cloth_wind(c)
90
- }
91
- clw
92
- end
93
-
94
- def self.is_big?(f)
95
- f.rewind
96
- f.size
97
- block = lambda { |int|
98
- num = f.read(4).unpack(int).first
99
- ( num >= 0 ) && ( num < 256 )
100
- }
101
- big = block.call("l>")
102
- f.rewind
103
- small = block.call("l<")
104
- f.rewind
105
- raise "Invalid data!" unless big ^ small
106
- return big
107
- end
108
-
109
- def self.convert(input_name, output_name, output_big = false)
110
- if input_name.respond_to?(:read) && input_name.respond_to?(:seek)
111
- input = input_name
112
- else
113
- input = File.open(input_name, "rb")
114
- end
115
- input_big = is_big?(input)
116
-
117
- if output_name.respond_to?(:write) && output_name.respond_to?(:seek)
118
- output = output_name
119
- else
120
- output = File.open(output_name, "wb")
121
- end
122
- output.rewind
123
-
124
- clp = self::new
125
- clp.instance_variable_set(:@__was_big, input_big)
126
- clp.__convert(input, output, input_big, output_big)
127
-
128
- input.close unless input_name.respond_to?(:read) && input_name.respond_to?(:seek)
129
- output.close unless output_name.respond_to?(:write) && output_name.respond_to?(:seek)
130
- clp
131
- end
132
-
133
- def self.load(input_name)
134
- if input_name.respond_to?(:read) && input_name.respond_to?(:seek)
135
- input = input_name
136
- else
137
- input = File.open(input_name, "rb")
138
- end
139
- input_big = is_big?(input)
140
-
141
- clp = self::new
142
- clp.instance_variable_set(:@__was_big, input_big)
143
- clp.__load(input, input_big)
144
- input.close unless input_name.respond_to?(:read) && input_name.respond_to?(:seek)
145
- clp
146
- end
147
-
148
- def dump(output_name, output_big = false)
149
- if output_name.respond_to?(:write) && output_name.respond_to?(:seek)
150
- output = output_name
151
- else
152
- output = File.open(output_name, "wb")
153
- end
154
- output.rewind
155
-
156
- __set_dump_state(output, output_big, nil, nil)
157
- __dump_fields
158
- __unset_dump_state
159
-
160
- output.close unless output_name.respond_to?(:write) && output_name.respond_to?(:seek)
161
- self
162
- end
163
-
164
- end
165
-
166
- end
1
+ module Bayonetta
2
+
3
+ class CLWFile < 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 ClothWind < LibBin::Structure
24
+ int32 :wind_type
25
+ int32 :parts_no
26
+ register_field :offset, FVector
27
+ register_field :offset2, FVector
28
+ float :radius
29
+ float :power
30
+ float :timer
31
+ float :swing_rate
32
+ float :swing_spd
33
+ float :delay_max
34
+
35
+ def from_bxm_cloth_wind(h)
36
+ @wind_type = h.at_css("WindType").content.to_i
37
+ @parts_no = h.at_css("PartsNo").content.to_i
38
+ @offset = FVector.from_bxm_vector(h.at_css("Offset").content)
39
+ @offset2 = FVector.from_bxm_vector(h.at_css("Offset2").content)
40
+ @radius = h.at_css("Radius").content.to_f
41
+ @power = h.at_css("Power").content.to_f
42
+ @timer = h.at_css("Timer").content.to_f
43
+ @swing_rate = h.at_css("SwingRate").content.to_f
44
+ @swing_spd = h.at_css("SwingSpd").content.to_f
45
+ @delay_max = h.at_css("DelayMax").content.to_f
46
+ self
47
+ end
48
+
49
+ def self.from_bxm_cloth_wind(c)
50
+ clw = self::new
51
+ clw.from_bxm_cloth_wind(c)
52
+ clw
53
+ end
54
+
55
+ def remap(map)
56
+ @parts_no = check_and_remap_bone(map, @parts_no)
57
+ end
58
+
59
+ private
60
+ def check_and_remap_bone(map, no)
61
+ tmp = map[no]
62
+ raise "No bone found in map for #{no}!" unless tmp
63
+ tmp
64
+ end
65
+
66
+ end
67
+
68
+ int32 :cloth_wind_num
69
+ register_field :cloth_wind, ClothWind, count: 'cloth_wind_num'
70
+
71
+ def was_big?
72
+ @__was_big
73
+ end
74
+
75
+ def remap(map)
76
+ @cloth_wind.each { |c|
77
+ c.remap(map)
78
+ }
79
+ end
80
+
81
+ def self.load_bxm(input_name)
82
+ bxm = BXMFile::load(input_name)
83
+ clw = self::new
84
+
85
+ doc = bxm.to_xml
86
+ clw.cloth_wind_num = doc.at_css("//CLOTH_WIND//CLOTH_WIND_NUM").content.to_i
87
+
88
+ clw.cloth_wind = doc.css("//CLOTH_WIND//CLOTH_WIND_WK").collect { |c|
89
+ ClothWind.from_bxm_cloth_wind(c)
90
+ }
91
+ clw
92
+ end
93
+
94
+ def self.is_big?(f)
95
+ f.rewind
96
+ f.size
97
+ block = lambda { |int|
98
+ num = f.read(4).unpack(int).first
99
+ ( num >= 0 ) && ( num < 256 )
100
+ }
101
+ big = block.call("l>")
102
+ f.rewind
103
+ small = block.call("l<")
104
+ f.rewind
105
+ raise "Invalid data!" unless big ^ small
106
+ return big
107
+ end
108
+
109
+ def self.convert(input_name, output_name, output_big = false)
110
+ if input_name.respond_to?(:read) && input_name.respond_to?(:seek)
111
+ input = input_name
112
+ else
113
+ input = File.open(input_name, "rb")
114
+ end
115
+ input_big = is_big?(input)
116
+
117
+ if output_name.respond_to?(:write) && output_name.respond_to?(:seek)
118
+ output = output_name
119
+ else
120
+ output = File.open(output_name, "wb")
121
+ end
122
+ output.rewind
123
+
124
+ clp = self::new
125
+ clp.instance_variable_set(:@__was_big, input_big)
126
+ clp.__convert(input, output, input_big, output_big)
127
+
128
+ input.close unless input_name.respond_to?(:read) && input_name.respond_to?(:seek)
129
+ output.close unless output_name.respond_to?(:write) && output_name.respond_to?(:seek)
130
+ clp
131
+ end
132
+
133
+ def self.load(input_name)
134
+ if input_name.respond_to?(:read) && input_name.respond_to?(:seek)
135
+ input = input_name
136
+ else
137
+ input = File.open(input_name, "rb")
138
+ end
139
+ input_big = is_big?(input)
140
+
141
+ clp = self::new
142
+ clp.instance_variable_set(:@__was_big, input_big)
143
+ clp.__load(input, input_big)
144
+ input.close unless input_name.respond_to?(:read) && input_name.respond_to?(:seek)
145
+ clp
146
+ end
147
+
148
+ def dump(output_name, output_big = false)
149
+ if output_name.respond_to?(:write) && output_name.respond_to?(:seek)
150
+ output = output_name
151
+ else
152
+ output = File.open(output_name, "wb")
153
+ end
154
+ output.rewind
155
+
156
+ __set_dump_state(output, output_big, nil, nil)
157
+ __dump_fields
158
+ __unset_dump_state
159
+
160
+ output.close unless output_name.respond_to?(:write) && output_name.respond_to?(:seek)
161
+ self
162
+ end
163
+
164
+ end
165
+
166
+ end