Commit Graph

169 Commits

Author SHA1 Message Date
Mike Welsh 1b7449e651 swf: Fix reading DefineMorphShape gradient flags
The interpolation and spread modes of morph shape gradients were
not being properly parsed. Fixed this and cleaned up some of the
gradient parsing code.
2019-10-10 21:52:41 -07:00
Mike Welsh bb4b931610 swf: Allow for missing latency seek value in SoundStreamHead
Some software would export SWFs with a missing LatencySeek field
in SoundStreamHead (e.g., CoffeeCup Firestarter). Silently ignore
this error if the field is missing.
2019-10-10 21:52:41 -07:00
Mike Welsh 9957a4b8ae swf: Add test for DefineFont3 w/ device font 2019-10-10 21:52:41 -07:00
Mike Welsh 657a0baec0 swf: Fix incorrect parsing of DefineFont2/3 with device fonts 2019-10-10 21:52:41 -07:00
Mike Welsh 614903bdec swf: Remove panic when data left over in tag 2019-10-10 21:52:41 -07:00
Mike Welsh 800147043a swf: Try to recover from incorrect zlib streams
Some SWFs are compressed incorrectly, often with incorrect
compressed/uncompressed lengths, causing the zlib decoders
to vomit if you try to decompress them fully. However, often times
the data still decompresses all the way to the End tag, and we
still want to try to play it even if it's corrupt.
Now these errors only omit a warning, and we'll continue to run
the SWF.

Addresses #86.
2019-10-10 13:41:43 -07:00
Mike Welsh 93a221aea4 swf: Add tests for errors on incorrect parse 2019-10-10 00:55:09 -07:00
Mike Welsh 3058b88011 swf: Add custom error type for SWF/AVM1 parse errors
Improves the error handling for the swf crate:

 * Custom swf::error::Error type added to handle various errors
   in SWF parsing.
 * Invalid parsing of tags/AVM1 ops results in a Error::ParseError
   that can include info about the underlying failure.
 * Implement Display for these errors. Output descriptive
   names for the tag/opcode when it fails to parse.
 * Handle out of bounds reads in avm1::Reader::read_slice.
   Previously this would panic, now it returns an io::Error.

Closes #85.
2019-10-10 00:55:09 -07:00
Mike Welsh 3fddb659fb swf: Fix incorrect parsing of clip actions in SWFv5
Clip action flags in SWFv5 are only 2 bytes big.
2019-10-08 02:13:53 -07:00
Mike Welsh 782174aa75 swf: Make read_define_edit_text public 2019-10-07 23:23:45 -07:00
Will Brindle 2ff0522509 chore: combine DefineText functions into 1 and paramterise 2019-10-05 06:49:03 +01:00
Will Brindle 8844e1b48d chore: follow naming conventions for functions 2019-10-04 22:18:37 +01:00
Will Brindle 1b6848d060 swf: implement DefineText2 2019-10-04 21:09:24 +01:00
Mike Welsh 6650a7a924 swf: Remove stale build badge from README 2019-10-03 02:31:11 -07:00
Mike Welsh 862120dac0 swf: Use consistent naming for test SWF filenames 2019-10-03 02:18:09 -07:00
Mike Welsh e0015c9d14 swf: cargo fmt 2019-10-03 00:46:38 -07:00
Mike Welsh 65866842a7 swf: Change respoitory URL in swf crate 2019-10-03 00:27:47 -07:00
Mike Welsh 336eace45e chore: Delete old dotfiles from swf-rs 2019-10-03 00:26:23 -07:00
Mike Welsh 0de44d61b3 Merge swf-rs into ruffle repo
git-subtree-dir: swf
git-subtree-mainline: 2740f3ccc1
git-subtree-split: 1b04015326
2019-10-02 17:25:30 -07:00