Commit Graph

7151 Commits

Author SHA1 Message Date
David Wendt 2c93da9a70 docs: Add comments documenting subtle points of AS3 loop & tag queueing behavior 2022-08-25 19:24:56 -06:00
David Wendt 074f2ff76f core: Replace `Vec` of queued tags with a more restrictive enum that enforces our queueing invariants 2022-08-25 19:24:56 -06:00
David Wendt 59623a8452 core: Fix a potential stack overflow caused by gotos triggering frame scripts on one another. 2022-08-25 19:24:56 -06:00
David Wendt 4510d51e18 tests: Fix regression in `as3_loaderinfo_events` caused by the frame lifecycle fixes 2022-08-25 19:24:56 -06:00
David Wendt 05caa0fceb core: Explicit gotos drain the tag queue of any prior operations.
This is in keeping with the whole idea of a "recursive frame": gotos run the entire frame lifecycle on the target clip, including broadcasts for `frameConstructed` and `exitFrame`.
2022-08-25 19:24:56 -06:00
David Wendt 6f0de246ed core: Clear queued tags if AS3 attempts a goto in the middle of a loop. 2022-08-25 19:24:56 -06:00
David Wendt ed28578c12 core: Fast-forwarding gotos should run frame scripts on all removed children 2022-08-25 19:24:56 -06:00
David Wendt bcb1030883 core: Only `Construct` and `Enter` phases want forced script frames on gotos 2022-08-25 19:24:56 -06:00
David Wendt 3677a0107b core: Only force-queue frame scripts if the goto is not a no-op. 2022-08-25 19:24:56 -06:00
David Wendt ac2b82f26e core: Gotos *always* queue the target frame's scripts on the target clip, even if we already executed that script beforehand. 2022-08-25 19:24:56 -06:00
David Wendt 9bff6406d1 core: Allow queueing both a remove and a place tag at the same depth, in that order only. 2022-08-25 19:24:56 -06:00
David Wendt 2929681a93 core: No-op gotos should be treated as rewinding. 2022-08-25 19:24:56 -06:00
David Wendt 7a09bbfaab core: In AVM2, run removals before frame advance.
We still retain the queue system as events are fired at removal time, and those events can trigger more gotos. If such a goto happens, AS3 code will hit a clip still in the old state rather than an inconsistent one. I don't have test coverage for this exact scenario just yet.
2022-08-25 19:24:56 -06:00
David Wendt d691543c4c core: Child removals appear to resolve in reverse render order. 2022-08-25 19:24:56 -06:00
David Wendt 8feb3fc7b0 core: Fast-forward removals as the result of a goto happen before the frame number advances. 2022-08-25 19:24:56 -06:00
David Wendt 66c24ff188 core: Queue new object placement at loop time on the tag queue. 2022-08-25 19:24:56 -06:00
David Wendt 0353d176e4 core: Movie clip rewinds should not remove any children until after the new timeline position has been set. 2022-08-25 19:24:56 -06:00
David Wendt 99003643ac core: Same-frame gotos should only proceed on AVM2. 2022-08-25 19:24:56 -06:00
David Wendt cdfc6f5eae core: Explicit gotos must run even if they are no-ops. 2022-08-25 19:24:56 -06:00
David Wendt cb86340fb1 core: `frameConstructed` during a goto fires after the goto commands have fully completed. 2022-08-25 19:24:56 -06:00
David Wendt 51401ae660 core: Remove AVM2 compatibility hacks surrounding place frame.
They are no longer needed, frame advance happens at enterframe time.
2022-08-25 19:24:56 -06:00
David Wendt 1eef8a47c9 core: Movie clips run all their tags at `enter_frame`, and place/remove actions are queued until later.
This prevents repeated place/remove actions at the same depth from resulting in repeated event dispatches.
2022-08-25 19:24:56 -06:00
David Wendt 963144e59c core: Centralize all the various calls to `enter_frame`/`construct_frame` into a single method, `catchup_display_object_to_frame`.
The rationale for the catch-up logic is as follows:

 * We must always enter-frame and construct objects, even if those respective display events haven't happened yet.
 * Display objects created in event handlers still need to run catchup phases, otherwise they will tag-stream desync
 * Frame scripts are never triggered by catchup phases
 * `exit_frame` is not a catchup phase as it is *only* an event broadcast currently
2022-08-25 19:24:56 -06:00
David Wendt 0400d4dee4 core: `Player` should start in the `Idle` phase 2022-08-25 19:24:56 -06:00
David Wendt f0ef8adb42 core: Add a new frame phase to represent non-frame work such as input event handlers. 2022-08-25 19:24:56 -06:00
David Wendt ae530b5d6b core: Track what part of the frame processing loop we're in 2022-08-25 19:24:56 -06:00
David Wendt ee2454e09f core: Frame actions should start with `enterFrame`; not `exitFrame`. 2022-08-25 19:24:56 -06:00
David Wendt 1f0b8bdda4 core: In AVM2, movie clips process `RemoveObject` before any other frame actions are done. 2022-08-25 19:24:56 -06:00
David Wendt 318b018da8 core: `enter_frame` should be an event that all display objects get and can respond to 2022-08-25 19:24:56 -06:00
David Wendt beb0545b11 tests: Add tests for gotos interacting with frame scripts. 2022-08-25 19:24:56 -06:00
David Wendt 6569edda88 tests: Add a goto-and-stop test that inspects the children after the goto. 2022-08-25 19:24:56 -06:00
David Wendt c3add3db93 tests: Ignore the `as3_simplebutton_constr_childevents` test as it is broken by fixes I moved to another PR 2022-08-25 19:24:56 -06:00
David Wendt 38f28ce80c tests: Add a second, more thorough `clickgoto2` test 2022-08-25 19:24:56 -06:00
David Wendt f16b76866a tests: Add timeline and stage manipulation tests at user event time. 2022-08-25 19:24:56 -06:00
David Wendt 81eb5ed8ac tests: Add tests for symbol instantiation in `enterFrame`, `exitFrame`, and `frameConstructed` 2022-08-25 19:24:56 -06:00
David Wendt 27d509f169 tests: Extend the goto tests with more non-looping jumps 2022-08-25 19:24:56 -06:00
David Wendt 4d3788bfe1 tests: Add tests for AS3 gotos during `enterFrame`, `frameConstructed`, and/or `exitFrame` 2022-08-25 19:24:56 -06:00
David Wendt c10417ddb8 tests: `as3_movieclip_displayevents_timeline` should log events on the root movie clip too 2022-08-25 19:24:56 -06:00
David Wendt f1d203311f tests: `as3_movieclip_displayevents_looping` should have a `RemoveObject` in it 2022-08-25 19:24:56 -06:00
David Wendt ee1f39bba7 tests: `as3_movieclip_displayevents_xyzframeplay` tests should also list what children are on the timeline 2022-08-25 19:24:56 -06:00
David Wendt b3793f9b4c tests: Oops, forgot to recompile the exitframe play test. 2022-08-25 19:24:56 -06:00
David Wendt 10955c3a03 tests: Add tests for playing and pausing a movie clip in `enterFrame`, `frameConstructed`, and `exitFrame` 2022-08-25 19:24:56 -06:00
David Wendt 795dafa46a tests: Fix the test output for `as3_movieclip_displayevents_dblhandler`.
The test output for this test is sensitive to where we cut off each frame, because it doesn't stop all of it's handlers at the end of the test. Flash Player will just print lines forever so the end of the test is entirely arbitrary.
2022-08-25 19:24:56 -06:00
David Wendt 1a4b977325 tests: `as3_movieclip_displayevents_timeline` now explicitly winds a clip back and forth to better demonstrate a bug I ran into with frame numbering 2022-08-25 19:24:56 -06:00
David Wendt 0c18e8e99a tests: Log `this.currentFrame` on every event watcher we can. 2022-08-25 19:24:56 -06:00
David Wendt 72f878bb9d tests: Add a test for the order of events surrounding `gotoAndStop` 2022-08-25 19:24:56 -06:00
relrelb d152cc3e64 avm2: Port `Math` to ActionScript 2022-08-25 16:03:08 -07:00
relrelb 4e9cc919a1 avm2: Fix bindings of empty namespace
Previously native functions defined inside a `package {}` block
(without a package name) would cause a syntax error by two consecutive
`::`.
2022-08-25 16:03:08 -07:00
Aaron Hill 91247f5779 tests: Only require `ruffle_render_wgpu` dependency with 'imgtests'
This should speed up developer workflows when working on non-image
related changes. CI will still run all image tests.
2022-08-25 15:11:18 -07:00
= 211a64b402 webgl: Replace Box<dyn Error> with actual Error enum 2022-08-25 23:43:21 +02:00