Commit Graph

1253 Commits

Author SHA1 Message Date
David Wendt b611067bc5 First pass on a more-optimized render path that uses canvas draw commands directly rather than precompiling SVGs as images. 2020-01-29 14:19:18 -05:00
David Wendt 4ee60d9214 Make `swf_shape_to_svg` output the entire `ShapeData` list itself, and also it's not called that anymore. 2020-01-29 14:19:18 -05:00
David Wendt 70cdcb60a7 Break shape data up into a series of canvas commands, including direct fills and strokes. 2020-01-29 14:19:18 -05:00
dependabot-preview[bot] dc8858505d build(deps): bump smallvec from 1.1.0 to 1.2.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.1.0...v1.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-29 18:42:28 +00:00
Mike Welsh 003cc414aa core: Create clips in execution order during a goto
The list of goto commands is now a Vec that will already be in order
of creation. This ensures that subsequent ActionScript in these clips
runs in the correct order.
2020-01-28 04:15:08 -08:00
Mike Welsh 81a1c05682 tests: Add goto_execution_order2 regression test
Tests execution order of children added during a goto.
2020-01-28 04:15:08 -08:00
Mike Welsh 7532e89aff avm1: Use `resolve_target_display_object` in `Color`
Fixes the boss damage blinking in Alien Hominid. Target was a path
string.
2020-01-27 23:35:41 -08:00
Mike Welsh 69f19f03c4 avm1: Output trace warning for invalid SetTarget (fix #332) 2020-01-27 23:35:41 -08:00
Mike Welsh a0032b9aa1 avm1: Better handling of movie clip paths strings (fix #317)
Ops and functions that take a movie clip path in String form have
a very forgiving syntax. These include:
 * `SetTarget`
 * `CloneSprite`
 * `RemoveSprite`
 * `swapDepths`

This change adds `Avm1::resolve_target_display_object` to parse
these paths correctly, along with `target_paths` test to test a
wide variety of formats.

This also applies to `GetVariable`/`SetVariable`, which accept
target paths to variables and is used by some SWF4/5 content.
(fixes #324, #337).
2020-01-27 23:35:41 -08:00
Mike Welsh 2751b89d4e avm1: Root clip should not have a name
Previously we set the name of the root clip to `_level0`. Top-level
clips should actually have no name (`_root._name` returns `""`).

However, when constructing a dot path, `_level0` still gets inserted
by `DisplayObject::path` for the top-level, so that `trace(_root)`
still correctly prints `_level0`.

TODO: When `loadMovieNum` gets merged in, the proper level # needs
to be returned by `.DisplayObject::path`.
2020-01-27 23:35:41 -08:00
Mike Welsh 0446644742 tests: Add target_path test 2020-01-27 23:35:41 -08:00
Mike Welsh f29cb8793c
avm1: Merge #149, Function methods
Implements Function and associated methods
2020-01-27 20:45:59 -08:00
David Wendt db51ec9e3c Implement a separate `Object` impl for functions that holds an `Executable`. 2020-01-27 21:57:32 -05:00
David Wendt 8eeb9a5c60 This technically isn't a test of `toString`, so remove stuff from the test that it relies upon. 2020-01-27 21:50:11 -05:00
David Wendt d217f51c6c Don't crash if `Function.prototype.call` is called without arguments. 2020-01-27 21:50:10 -05:00
David Wendt 0470b8d0a7 Add a test for `Function.call` and `Function.apply` 2020-01-27 21:50:10 -05:00
David Wendt 2c0d892154 Implement Function.call/apply 2020-01-27 21:50:09 -05:00
Mike Welsh 1223de9e94 web: Draw masks with 100% alpha (fix #348) 2020-01-22 12:08:57 -08:00
Mike Welsh 4b7bac706b avm1: ActionNewMethod supports auto-boxing values
This allows `new ("FOO".bar)()`, although there is probably no
good reason to do this. :-)
2020-01-21 18:24:49 -08:00
Mike Welsh 70bec9437f tests: Boolean() returns undefined 2020-01-21 18:24:49 -08:00
Mike Welsh d9e7a6a960 avm1: Implement Boolean class 2020-01-21 18:24:49 -08:00
Mike Welsh e71099edd5 tests: Add primitive_type_globals test 2020-01-21 18:24:49 -08:00
Mike Welsh 8263d13fd0 avm1: Implement Number class 2020-01-21 18:24:49 -08:00
Mike Welsh b49357e46f avm1: Boxing a value calls the object constructor 2020-01-21 18:24:49 -08:00
Mike Welsh ccf62979a1 avm1: Implement String methods 2020-01-21 18:24:49 -08:00
Mike Welsh 5f12ce78b6 tests: Add string method tests 2020-01-21 18:24:49 -08:00
David Wendt 2f9d50cdb8 Very rudimentary/basic/not-good implementation of `String`, plus auto-boxing for primitive strings getting their methods taken. 2020-01-21 18:24:49 -08:00
David Wendt 4d1e49882b Add another object class for boxed primitive values, because the language demands it. 2020-01-21 18:24:49 -08:00
dependabot-preview[bot] 92c1abdcd9 build(deps): bump csv from 1.1.2 to 1.1.3
Bumps [csv](https://github.com/BurntSushi/rust-csv) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/BurntSushi/rust-csv/releases)
- [Commits](https://github.com/BurntSushi/rust-csv/compare/1.1.2...1.1.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-21 18:56:34 +00:00
Mike Welsh 13b4cd4c1b avm1: Add Value::coerce_to_i32/u32/u16 methods
Add these methods that will explicilty coerce a value to an int,
following the wrapping behavior in the ECMAScript specs (ToInt32,
ToUInt32, ToUInt16).

This also fixed an off-by-one error for negative numbers in the
previous implementation.

These will call `valueOf` if necessary. AVM code that requires an
integer will probably use one of these (`coerce_to_i32` usually).
2020-01-20 13:28:27 -08:00
dependabot-preview[bot] 87e96212e4 build(deps): bump syn from 1.0.13 to 1.0.14
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.13 to 1.0.14.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.13...1.0.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-20 18:56:56 +00:00
dependabot-preview[bot] fdc37ec44f build(deps): bump structopt from 0.3.7 to 0.3.8
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.7 to 0.3.8.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-20 07:24:58 +00:00
Nathan Adams 4ad6ef8b83 core: Implemented Key.getCode() 2020-01-17 15:11:38 -08:00
Nathan Adams adceceed5d avm1: Removed redundant double registration of Key 2020-01-17 15:11:38 -08:00
Nathan Adams cef7d3eba2 avm1: Implement Key constants 2020-01-17 15:11:38 -08:00
Mike Welsh 8cb4278903 tests: Use pretty_assertions for nice output on test fail 2020-01-17 13:54:39 -08:00
Nathan Adams f747caf30c desktop: Add swf filename to window title (closes #318) 2020-01-17 13:54:25 -08: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 bb27d6712a web: Add content hash to core.ruffle.js filename 2020-01-16 11:59:58 -08:00
Mike Welsh cf7a564f2c core: Fix properties not resetting in goto when rewinding
Properties of a display object would not reset when rewinding if
it existed in both the initial and final frames of the goto.
This fixes the weapons toggles in UFA.
2020-01-16 09:58:33 -08:00
Mike Welsh 881581eed5 web: Resize canvas when devicePixelRatio changes (fix #322) 2020-01-15 21:34:22 -08:00
Mike Welsh f983af3f65 web: Fix decoding of PCM sounds 2020-01-15 21:12:45 -08:00
Mike Welsh ad719ad586 web: Fix timing of sound envelopes
The endTime parameter of AudioParam.linearRampToValueAtTime is
on the global AudioContext's timeline, not local to the sound.
Adding the sound's start time to the parameter fixes sound
envelopes not playing back correctly.
2020-01-15 20:38:43 -08:00
Mike Welsh 12ee4c7432 web: Duplicate left channel when playing a mono sound with envelope (fix #323) 2020-01-15 20:36:05 -08:00
Mike Welsh b57c827e23 web: Use proper key code for Enter key 2020-01-14 16:18:42 -08:00
dependabot-preview[bot] 89a0b82e6e build(deps): bump image from 0.22.3 to 0.22.4
Bumps [image](https://github.com/image-rs/image) from 0.22.3 to 0.22.4.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-14 19:16:45 +00:00
Mike Welsh 8448fc80ef avm1: Don't panic when calling ActionRandom with <= 0 2020-01-14 00:05:13 -08:00
Mike Welsh 4eef8a1821 tests: Add test for ActionCall 2020-01-14 00:04:11 -08:00
Mike Welsh 2d3801dac8 avm1: Implement ActionCall opcode 2020-01-14 00:04:11 -08:00
Nathan Adams fdf1d38d21 avm1: Implement remainder of Math 2020-01-13 15:57:56 -08:00