David Wendt
a92190a456
Support pre-resolving `_parent`
2019-10-12 10:39:52 -04:00
David Wendt
0f04d97002
Move `_global` and `_root` to the MovieClip object, and implement `_parent` while we're in here.
2019-10-12 10:39:52 -04:00
David Wendt
d35e36def5
Allow overwriting virtual properties via setting `set` to `None`.
2019-10-12 10:39:52 -04:00
David Wendt
feaa3dd203
Add a version parameter to every DisplayObject impl
2019-10-12 10:39:52 -04:00
David Wendt
8668d47403
Add a player version parameter and expose it to AVM
2019-10-12 10:39:51 -04:00
David Wendt
2f257c83e8
Remove the representation split between functions defined with `DefineFunction` and `DefineFunction2`. Both are now represented with a single struct and enum.
2019-10-12 10:39:51 -04:00
David Wendt
caa36bfecc
Add `closure_scope` and `variable_args` tests.
2019-10-12 10:39:51 -04:00
David Wendt
b4ddd323f2
Use the same methodology to construct new scopes for tellTarget.
2019-10-12 10:39:51 -04:00
David Wendt
1b62ead082
Construct the closure scope chain in one pass, which lets us skip the vec allocation.
2019-10-12 10:39:50 -04:00
Mike Welsh
2b90c61a69
core: Fix error message when LZMA feature is disabled
2019-10-12 00:09:10 -07:00
Mike Welsh
3b42c70e48
core: Disable LZMA support by default
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
1ec90b8a14
chore: Add gitattributes to normalize line endings
2019-10-11 16:53:36 -07:00
Nathan Adams
59d39d6572
Added a bulk swf scanning tool
2019-10-11 16:37:15 -07:00
Mike Welsh
4aec120ffb
core: Add Bitmap display object
...
Converts the Bitmap character to a proper display object. This can
be instantiated directly in a PlaceObject tag in SWFv9 movies,
compared to the previous versions which indirectly references
bitmaps from Shape tags.
2019-10-11 16:33:58 -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
40722dcef0
avm1: Merge#81, add property attributes
...
Added object property attributes
2019-10-09 10:24:21 -07:00
Mike Welsh
8063d9e55c
avm1: Merge #83 , add better support for comparison ops
...
Enhanced comparison support
2019-10-09 10:15:47 -07:00
Will Brindle
ba939fc00b
chore: add comment explaining the weird NaN situation
2019-10-09 06:17:41 +01:00
Will Brindle
32554e271f
chore: remove trailing whitespace
2019-10-08 21:40:15 +01:00
Will Brindle
f84f807bf1
core: refactor to make use of equality implementation
2019-10-08 21:36:50 +01:00
Will Brindle
70b7b1c807
chore: fix clippy & fmt issues
2019-10-08 21:04:26 +01:00
Will Brindle
6508ec6b6c
core: nan equality
2019-10-08 20:51:21 +01:00
Will Brindle
0814b17fd8
chore: add tests for equality and greaterthan
2019-10-08 20:45:39 +01:00
Will Brindle
e2c7af5cda
core: fix boolean strict comparison
2019-10-08 19:59:32 +01:00
Will Brindle
9cf381b0e0
core: add support for actions GreaterThan, StringGreaterThan and StrictEquals
2019-10-08 19:59:32 +01:00
Nathan Adams
d697d03cf0
Drop the `Attribute::` everywhere
2019-10-08 20:35:23 +02:00
Mike Welsh
fb442688cb
chore: Change edit_text.rs to LF line endings
2019-10-08 11:15:15 -07:00
Nathan Adams
3d09ec81e2
Add Attribute::DontEnum
2019-10-08 16:36:39 +02:00
Nathan Adams
f782aaee18
Add Attribute::ReadOnly
2019-10-08 15:24:57 +02:00
Nathan Adams
f2a4000ee2
Added object property attributes (initially just DontDelete)
2019-10-08 14:30:36 +02:00
Will Brindle
4856efe7d8
chore: add integration tests for typeof
2019-10-08 02:59:26 -07:00
Will Brindle
2e3748438a
core: define globals for NaN, Infinity, -Infinity. Should fix `typeof NaN`
2019-10-08 02:59:26 -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