Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for legacy DoABC tag.

  • Loading branch information...
commit 0a0906fcaa6cf19ded6d8b42a8cf7c92af376e93 1 parent 649634e
@grindars grindars authored
View
6 bin/furnace-swf
@@ -68,12 +68,12 @@ case subcommand
when 'abclist'
puts "ABC tags:"
- swf.stream.tags(SWF::DoABCTag).each do |tag|
+ swf.stream.tags(SWF::DoABCTag, SWF::DoABC2Tag).each do |tag|
puts " #{tag.name.inspect}: #{tag.bytecode.length} byte(s)"
end
when 'abcextract'
- if tag = swf.stream.tags(SWF::DoABCTag).find { |tag| tag.name == subopts[:name] }
+ if tag = swf.stream.tags(SWF::DoABCTag, SWF::DoABC2Tag).find { |tag| tag.name == subopts[:name] }
File.open(subopts[:output], 'w') do |f|
f.write tag.bytecode
end
@@ -83,7 +83,7 @@ when 'abcextract'
end
when 'abcreplace'
- if tag = swf.stream.tags(SWF::DoABCTag).find { |tag| tag.name == subopts[:name] }
+ if tag = swf.stream.tags(SWF::DoABCTag, SWF::DoABC2Tag).find { |tag| tag.name == subopts[:name] }
tag.bytecode = subopts[:input].read
File.open(subopts[:output], 'w') do |f|
View
4 lib/furnace-swf/swf/stream.rb
@@ -14,8 +14,8 @@ def frame_rate
BigDecimal.new(frame_rate_lo) / 100
end
- def tags(type)
- tag_wrappers.select { |tw| tw.content.is_a? type }.map(&:content)
+ def tags(*types)
+ tag_wrappers.select { |tw| types.any? { |type| tw.content.is_a? type } }.map(&:content)
end
def real_num_bytes
View
9 lib/furnace-swf/swf/tags/do_abc2_tag.rb
@@ -0,0 +1,9 @@
+module Furnace::SWF
+ class DoABC2Tag < Tag
+ type 82
+
+ uint32 :flags
+ stringz :name
+ string :bytecode, :read_length => lambda { parent.real_length - 4 - name.length - 1 }
+ end
+end
View
14 lib/furnace-swf/swf/tags/do_abc_tag.rb
@@ -1,9 +1,15 @@
module Furnace::SWF
class DoABCTag < Tag
- type 82
+ type 72
- uint32 :flags
- stringz :name
- string :bytecode, :read_length => lambda { parent.real_length - 4 - name.length - 1 }
+ string :bytecode, :read_length => lambda { parent.real_length }
+
+ def name
+ "<DoABCTag>"
+ end
+
+ def flags
+ 0
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.