Mike Welsh
7cf217a911
swf: Use lzma-rs for LZMA SWFs ( fix #405 )
...
Pure Rust decoder that functions on desktop and wasm.
Enable lzma feature by default.
TODO: Switch to lzma-rs streaming API when stable on crates.io.
Currently decodes entire stream at once.
2020-12-17 16:40:21 -08:00
Adrian Wielgosik
484bd2c11a
avm1: Revert #1470 to improve wasm performance
2020-12-17 12:47:22 -08:00
Mike Welsh
cec0ca74e1
chore: Fix swf doctests working directory
...
Rust 12-09 nightly changed the working dir of doctests to be the
workspace root instead of the subcrate root. This broke the
doctests for swf. Now do some setup to ensure the same working
directory on both stable and nightly.
cc https://github.com/rust-lang/cargo/pull/8954
2020-12-10 12:25:02 -08:00
David Wendt
0069d51dad
swf: `pushshort` should be read as a `u30` and then cast to an `i16` as it's parsed representation.
2020-12-09 14:00:06 -08:00
David Wendt
3225cd40e2
core: Avoid panic when display objects are manipulated in clearly invalid ways.
2020-12-09 14:00:06 -08:00
jmckiern
3cab11d18e
avm1: Implement TextField.textColor ( close #1863 )
2020-12-07 15:09:36 -08:00
Mike Welsh
2757bc4dad
chore: Appease clippy
...
Allow suspicious_operation_groupings for Matrix.
2020-12-07 10:14:31 -08:00
dependabot-preview[bot]
f45fa80e29
build(deps): bump smallvec from 1.5.0 to 1.5.1
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.5.0...v1.5.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-04 17:54:47 -08:00
Mike Welsh
53212f192c
chore: Appease clippy, squelch unnecessary_wraps lint
2020-11-24 18:59:42 -08:00
Mike Welsh
eb0b16790c
swf: Allow construct clip events in SWFv6
2020-11-22 19:34:29 -08:00
dependabot-preview[bot]
6bfa3144c3
build(deps): bump smallvec from 1.4.2 to 1.5.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.4.2...v1.5.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-18 16:30:15 -08:00
Mike Welsh
316bc4e920
chore: Appease clippy
2020-11-09 01:52:57 -08:00
Mike Welsh
0c38dafd0d
avm1: Switch to SmallVec for ActionPush
...
While switching swf to return slices, I noticed ActionPush was
potentially allocating a huge vector by mistake.
Switch to SmallVec<[Value; 4]> to fix this and avoid the
allocation in general (this was fairly high up in the profiler).
TODO: Return an iterator instead of any sort of vec.
2020-11-03 13:47:12 -08:00
dependabot-preview[bot]
55d16c200a
build(deps): bump approx from 0.3.2 to 0.4.0
...
Bumps [approx](https://github.com/brendanzab/approx ) from 0.3.2 to 0.4.0.
- [Release notes](https://github.com/brendanzab/approx/releases )
- [Commits](https://github.com/brendanzab/approx/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-25 12:07:13 -07:00
relrelb
083e2a2ff5
core: Implement getBytes{Loaded,Total} (simpler approach)
2020-10-23 13:13:00 -07:00
relrelb
14a71b69cc
core: Implement getBytes{Loaded,Total}
2020-10-23 13:13:00 -07:00
Mike Welsh
a6b952e44e
core: Switch from libflate to flate2
2020-10-12 13:47:35 -07:00
Mike Welsh
4467ccf7e3
tests: Add swf test for bitmap line style
2020-10-10 16:35:37 -07:00
Mike Welsh
ed99a15dee
swf: Fill styles are byte aligned
...
A bitmap fill style ends in a matrix, but the overall type should
still be byte aligned. This could cause certain shapes with bitmap
line styles to be incorrectly parsed. Fixes #1192 .
2020-10-10 16:35:37 -07:00
Luca Weiss
d5cb396331
*: fix spelling mistakes
2020-09-19 16:17:58 -07:00
Mike Welsh
5ea06b0ce6
swf: Use Option for more PlaceObject parameters
...
There is a difference between empty/default (change value to default)
and none (don't modify), so make this explicit for some PlaceObject
parameters where it wasn't.
Fixes #1104 .
2020-09-03 19:09:48 -07:00
Mike Welsh
d7a186b2cd
avm1: Implement shape hit testing
2020-09-02 17:51:55 -07:00
David Wendt
345a244ed4
`read_i32` no longer panics if more than 28 bits are defined within the read-in integer constant.
...
The underlying problem is actually shift overflow - on the fifth byte in the sequence, it attempts to mask bits by shifting them off the left of the value, which doesn't work here, as we'll be shifting by -3. For those unaware, shifting by a negative does NOT shift in the opposite direction, it instead gives your C compiler permission to stuff demons up your nose.
I wouldn't be surprised if this is just outright UB in Flash Player.
2020-08-10 16:38:04 -07:00
David Wendt
95ca978034
f64 constants in ABC files are not stored in Flash mixed-endian.
2020-08-10 16:38:04 -07:00
dependabot-preview[bot]
04b146ffc4
build(deps): bump enumset from 1.0.0 to 1.0.1
...
Bumps [enumset](https://github.com/Lymia/enumset ) from 1.0.0 to 1.0.1.
- [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-08-09 13:15:38 -07:00
Mike Welsh
4680b01f03
swf: Allow StyleChangeRecord in DefineShape v1
...
The spec says that StyleChangeRecord is only supported in
DefineShape2+, but SWFs exist with StyleChangeRecord in
DefineShape1 tags, and these play correctly in the Flash Player.
(see #929 HAGIMURA_EXTREME.swf).
2020-07-24 18:46:18 -07:00
David Wendt
ccacc540bf
Remove dead code on all now-in-use structs and methods.
2020-07-18 16:12:24 -04:00
David Wendt
a44e700e81
Sign extend negative `s24` values correctly.
2020-07-13 17:44:30 -04:00
David Wendt
9c5ea1d30c
Implement `jump`, `iftrue`, `iffalse`, `ifstricteq`, and `ifstrictne`.
2020-07-13 17:44:30 -04:00
David Wendt
7f60fab1e5
Add the bare minimum necessary to get opcodes out of an ABC and into an interpreter loop.
...
Surprisingly enough, the "bare minimum" includes a stack, object model, and values already.
2020-07-13 17:42:45 -04:00
Mike Welsh
08569ae979
core: Limit tag parsing to slice of tag data
2020-07-03 18:52:26 -07:00
Nathan Adams
e01f78df61
swf: Fixed parsing of try {...} blocks
2020-07-01 17:30:56 -07:00
Mike Welsh
12d9ba4583
chore: Fix swf clippy lint
2020-05-30 02:53:25 -07:00
Nathan Adams
4c1ce6d765
core: Print swf version on startup, and warn when we run into avm2
2020-05-30 02:48:54 -07:00
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