Commit Graph

4919 Commits

Author SHA1 Message Date
David Wendt ec1b5c457e Allow activations to hold their own private register set. 2019-10-06 13:02:31 -07:00
David Wendt d822a35404 Fix `ActionIf` and `ActionJump` 2019-10-06 13:02:31 -07:00
David Wendt 171cb9f014 GetMember needs to support string coercions (e.g. `array[1]` should work) 2019-10-06 13:02:31 -07:00
David Wendt deecd85c81 Implement `SetMember` 2019-10-06 13:02:31 -07:00
David Wendt 697a02bd05 Implement `GetMember` 2019-10-06 13:02:31 -07:00
David Wendt 51a7b426fd Implement registers, including register pushes and `ActionStoreRegister`. 2019-10-06 13:02:31 -07:00
David Wendt 582b3a8968 Adjust GetVariable/SetVariable based on test results 2019-10-06 13:02:31 -07:00
David Wendt 17482b8810 ActionDelete and ActionDelete2 return a bool 2019-10-06 13:02:31 -07:00
David Wendt 002dd9904c Implement `ActionDelete` / `ActionDelete2` 2019-10-06 13:02:31 -07:00
David Wendt 9b81a92516 Fix a number of bugs preventing the with-scope test from working at all:
1. We no longer implicitly return Undefined unless we're specifically returning from a function (this also keeps actions from filling the stack with Undefined)
2. With scopes are now always inserted behind the current set of locals rather than overriding them
3. `ActionSubtract` now subtracts (instead of adds)
2019-10-06 13:02:31 -07:00
David Wendt fc1ce7692b Implement ActionWith 2019-10-06 13:02:31 -07:00
David Wendt 7bf6e22714 Minor refactor/adjustment of GetVariable/SetVariable impl to explicitly check for slashpaths 2019-10-06 13:02:31 -07:00
David Wendt face06f268 Impl `ActionEnumerate` 2019-10-06 13:02:31 -07:00
David Wendt 22f75b7a4c Implement closure scope 2019-10-06 13:02:31 -07:00
David Wendt d757ce0cd2 Implement arguments object. 2019-10-06 13:02:31 -07:00
David Wendt 90b0140ac2 Don't lock up when running scope operations 2019-10-06 13:02:31 -07:00
David Wendt 9ede91df4f Move `this` into the activation object.
Also, change the implicit `this` on functions to `active_clip` as per the `ActionContext` docstrings.
2019-10-06 13:02:31 -07:00
David Wendt ca1fb713a3 Execute actions in MovieClip scope 2019-10-06 13:02:31 -07:00
David Wendt 215d4f2df4 Provide arguments as local variables as some functions look for these 2019-10-06 13:02:31 -07:00
David Wendt 3ab2eecc3c Support implicit return via boundary break 2019-10-06 13:02:31 -07:00
David Wendt f3d83908ab All activation frames share the same stack (and can see each other's garbage). 2019-10-06 13:02:31 -07:00
David Wendt 667b30f4b5 Add scope chains for local variable resolution. 2019-10-06 13:02:31 -07:00
David Wendt 13a88143d6 Off-the-end execution should implicitly return undefined if there's another stack frame to run. 2019-10-06 13:02:31 -07:00
David Wendt edc37dee5d Add support for calling bare functions and returning from them. 2019-10-06 13:02:31 -07:00
David Wendt 00b5d9ecf5 Implement DefineFunction 2019-10-06 13:02:31 -07:00
David Wendt 83c832ce86 Distinguish between Native and ActionScript functions. 2019-10-06 13:02:31 -07:00
David Wendt 728c3d18db Allow stack frames to hold SwfSlices, which are `Rc` already.
Functions that manipulate the stack now run inside of `with_current_reader_mut`, which calls a given function with a Reader for the current stack frame. If the stack frame still exists after that code runs, we update it's PC with the Reader's position.
2019-10-06 13:02:31 -07:00
David Wendt 617b493733 Give AVM1 the notion of a stack frame.
This necessitates the use of a copy of SWF data into the GC arena, along with unsafe (and possibly unsound) pointer manipulation to get the action reader to hold a GC pointer.
2019-10-06 13:02:30 -07:00
David Wendt 693e791d75 Make `do_action` execute out of a code stack. 2019-10-06 13:02:30 -07:00
Will Brindle 06c81d6cc1 chore: combine DefineText functions into 1 and paramterise 2019-10-06 13:02:30 -07:00
Will Brindle acfe0cc478 chore: follow naming conventions for functions 2019-10-06 13:02:30 -07:00
Will Brindle b0f25c9266 swf: implement DefineText2 2019-10-06 13:02:30 -07:00
Mike Welsh fe309858de
swf: Merge #76, add DefineText2 support
DefineText2 Support
2019-10-05 15:17:41 -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 c408f56e1a web: Fix looping sounds not ending 2019-10-03 16:30:33 -07:00
Mike Welsh c2ddb5a26f web: Clamp stroke width to 1 pixel minimum
Many SWFs use "hairline" strokes which are 1 twip wide, but Flash
renders strokes with a minimum width of 1 pixel (20 twips).
SVG has no minimum, resulting in faint lines for the "hairline"
strokes. Clamp the minimum stroke width to 1 pixel to more closely
match the Flash Player.
2019-10-03 03:15:10 -07:00
Will Brindle 06b0d42c8b core: Add matrix tests (#72)
* Add matrix tests. Requires the approx crate
2019-10-03 02:44:26 -07: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 52b6832db2 chore: Move swf-rs to ruffle workspace
Move the swf-rs crate into the Ruffle workspace proper instead of
having a separate repo. This makes it easier to make changes to
the SWF parsing code during development. swf-rs can still be
published as its own crate from the subfolder.
2019-10-02 18:58:58 -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
Mike Welsh 2740f3ccc1 chore: Globally allow clippy::unneeded_field_pattern
Often times we want to explicty destructure instead of using ..
because the compiler will emit errors if the structure changes.

(see https://github.com/rust-lang/rust-clippy/issues/1741 and #69)
2019-10-02 12:57:58 -07:00
Mike Welsh 8a43523c27
Merge pull request #69 from Dinnerbone/feature/virtual_properties
Allow for dynamic properties in Object
2019-10-02 12:46:46 -07:00
Mike Welsh b157354fef chore: Fix clippy lints 2019-10-02 12:39:04 -07:00
Nathan Adams 2b54791cbb Changed storage of object values to allow for dynamic (vs stored) properties 2019-10-02 10:49:08 -07:00