Commit Graph

53 Commits

Author SHA1 Message Date
Nathan Adams 1f8abc92fd core: Keep track of cursor position in drawings 2020-05-21 18:38:10 +02:00
Nathan Adams 5098eb079d avm1: Implement most of flash.geom.Matrix (#303) 2020-05-20 14:54:41 +02:00
Nathan Adams eda862c719 swf: Merged core::Matrix into swf::Matrix 2020-05-20 14:54:41 +02:00
Mike Welsh 081f6a556a swf: Avoid undefined behavior in write_fbits 2020-05-13 02:41:50 -07:00
Mike Welsh deef891c30 swf: Don't error if both libflate and flate2 features are enabled
Fixes errors I was getting from rust-analyzer checking with all
features enabled.
2020-05-13 00:16:50 -07:00
Nathan Adams 5767fb1772 swf: Added utility method for `Color::from_rgb(rgb, alpha)` 2020-05-10 22:03:56 -07:00
dependabot-preview[bot] 08a786a213 build(deps): bump libflate from 0.1.27 to 1.0.0
Bumps [libflate](https://github.com/sile/libflate) from 0.1.27 to 1.0.0.
- [Release notes](https://github.com/sile/libflate/releases)
- [Commits](https://github.com/sile/libflate/compare/0.1.27...1.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-05 08:12:26 +00:00
Mike Welsh b7d464f367 chore: Bump enumset to 1.0.0 2020-04-13 04:14:29 -07:00
dependabot-preview[bot] 3f28554285 build(deps): bump enumset from 0.4.4 to 0.4.5
Bumps [enumset](https://github.com/Lymia/enumset) from 0.4.4 to 0.4.5.
- [Release notes](https://github.com/Lymia/enumset/releases)
- [Changelog](https://github.com/Lymia/enumset/blob/master/RELEASES.md)
- [Commits](https://github.com/Lymia/enumset/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-02 18:14:25 +00:00
David Wendt 5ed5876e9a Merge SWF data and version into a single structure. Refactor everything that interacts with it to use `SwfSlice`s. 2020-02-21 23:57:53 -05:00
dependabot-preview[bot] 6681e843a9 build(deps): bump byteorder from 1.3.2 to 1.3.4
Bumps [byteorder](https://github.com/BurntSushi/byteorder) from 1.3.2 to 1.3.4.
- [Release notes](https://github.com/BurntSushi/byteorder/releases)
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.3.2...1.3.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 00:57:11 +00:00
David Wendt 63b7d172f4 `TextRecord.height` is also in `Twips`.
Notably, the `Text` rendering code does not appear to actually work in pixel scale.
2020-02-03 14:46:34 -05:00
David Wendt fde7715fb8 `EditText.height` is in `Twips` 2020-02-03 14:46:33 -05:00
David Wendt 93b06483c8 Fix misparsing of `ActionGetURL2`.
Adobe's documentation has the flags in opposite order to what they should be. This fixes that.
2020-01-16 17:09:56 -08:00
Mike Welsh bc872cbf9c swf: Clean up DefineButtonCxform tag 2019-12-20 19:20:25 -08:00
Mike Welsh 4026e22bbf core: Handle DefineButtonSound SWF tag
This plays sounds whenever a button is hovered/clicked. Fixes
gun sounds in Pico's School.
2019-12-20 01:08:28 -08:00
Mike Welsh 4cb2cefc5b swf: Switch depth to u16 2019-12-17 02:48:55 -08:00
Mike Welsh 24d8fa6298 swf: Add public method for read_export_assets 2019-12-16 19:32:34 -08:00
Mike Welsh da13b36e47 swf: Use EnumSet for ClipEventFlag 2019-12-15 19:00:16 -08:00
Mike Welsh e5472aab91 avm2: Improve error when reading invalid opcode 2019-12-10 11:26:58 -08:00
Mike Welsh 0f9895cfa5 avm2: Don't parse the opcode stream when parsing ABC 2019-12-10 11:26:58 -08:00
dependabot-preview[bot] c3c82ffbe4 build(deps): bump num-derive from 0.2.5 to 0.3.0
Bumps [num-derive](https://github.com/rust-num/num-derive) from 0.2.5 to 0.3.0.
- [Release notes](https://github.com/rust-num/num-derive/releases)
- [Changelog](https://github.com/rust-num/num-derive/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-num/num-derive/compare/num-derive-0.2.5...num-derive-0.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-22 17:13:32 +00:00
Mike Welsh e315fcb6b3 swf: Store register count from DefineFunction2
Also update avm1::Function to use register_count.
2019-10-15 17:09:14 -07:00
Mike Welsh 2b90c61a69 core: Fix error message when LZMA feature is disabled 2019-10-12 00:09:10 -07:00
Mike Welsh 1ab5211bfe swf: Fix compiling with lzma feature 2019-10-11 23:18:57 -07:00
Mike Welsh 160ec4d0c3 swf: > to >= in read_button_action 2019-10-11 17:57:23 -07:00
Mike Welsh d9facdd89b swf: Fix underflow in parsing corrupt DefineButton2 tags
401799_pre_Scene_1.swf has a DefineButton2 tag with an invalid
CondActionSize field (it should be at least 4). It's unclear how
Flash handles this. For now, avoid the underflow and return an
error instead.

Fixes #92.
2019-10-11 17:55:38 -07:00
Mike Welsh 7a5b2607d4 chore: Renormalize line endings in misc files 2019-10-11 16:53:36 -07:00
Mike Welsh d95e31905e swf: Handle missing null byte on metadata tag 2019-10-10 21:52:41 -07:00
Mike Welsh ae0bf52a53 swf: Handle shortened DefineButtonSound tag 2019-10-10 21:52:41 -07:00
Mike Welsh b0aa2ff952 tests: Use pretty printing on failure 2019-10-10 21:52:41 -07:00
Mike Welsh 8fc0ae3630 tests: Add swf tests for PlaceObject3 image tag 2019-10-10 21:52:41 -07:00
Mike Welsh 3609095b97 swf: Fix parsing image PlaceObject3 tags 2019-10-10 21:52:41 -07:00
Mike Welsh 58642d0e0e tests: Add swf tests for DefineMorphShape gradient flags 2019-10-10 21:52:41 -07:00
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