Commit Graph

7405 Commits

Author SHA1 Message Date
David Wendt 3c0b9b9f62 avm1: Implement `ActionWaitForFrame` and `ActionWaitForFrame2`. 2022-09-15 19:14:41 -06:00
David Wendt aa9e24fb9d core: Limit gotos to the currently loaded frame count 2022-09-15 19:14:41 -06:00
David Wendt c7e29e4173 chore: Various nitpicks and compilation fixes 2022-09-15 19:14:41 -06:00
David Wendt 613564baf7 tests: Adopt new expected images as the SWF stage size changed when I moved these tests to Flex/Flash Builder 2022-09-15 19:14:41 -06:00
David Wendt af9db3e9c7 docs: Drop "action" language for `ExecutionLimit` as that is confusable for AVM actions.
We now call them "operations" and clarify that they could be either AVM actions or SWF bytes.
2022-09-15 19:14:41 -06:00
David Wendt 44f1cdfdec avm2: `LoaderInfo` reports correct total size for SWFs loaded in-memory 2022-09-15 19:14:41 -06:00
David Wendt f3ca7f7673 avm2: Still-loading SWFs do not report a `url` 2022-09-15 19:14:41 -06:00
David Wendt 8f5afe09a1 core: Refactor `movie_loader` and its `loadBytes` variant to call into the same code. 2022-09-15 19:14:41 -06:00
David Wendt 86ecf6076e core: `loadBytes` does not emit `open` 2022-09-15 19:14:41 -06:00
David Wendt 0912ee4dff tests: Add an events test for `loadBytes` 2022-09-15 19:14:41 -06:00
TÖRÖK Attila d0277f7fe8 avm2: Add `Loader.loadBytes` 2022-09-15 19:14:41 -06:00
David Wendt 006269e1f8 core: Delay completion events until after the SWF is reported as fully loaded. 2022-09-15 19:14:41 -06:00
David Wendt 0a25f265d6 core: `LoaderInfo` now optionally contains a reference to the root clip in the not-loaded state so that things like `bytesLoaded` work 2022-09-15 19:14:41 -06:00
David Wendt 4976dc973d core: Emit a progress event after every preload tick.
This does not cover root movies, which already get progress events as part of a prior commit.
2022-09-15 19:14:41 -06:00
David Wendt e589df650f core: Centralize compressed length calculations into `movieclip.rs` 2022-09-15 19:14:41 -06:00
David Wendt 1323355a69 avm2: Fire progress events when the root movie is preloaded.
This is currently somewhat buggy, `homestuck_02791.swf` stops at 12% for some reason. I tried handing it both compressed and uncompressed lengths with no luck.
2022-09-15 19:14:41 -06:00
David Wendt 07bd7dda2e core: Do not overflow when querying loaded bytes on a fully-loaded movie. 2022-09-15 19:14:41 -06:00
David Wendt 029fecaa94 avm2: Implement `LoaderInfo.bytesLoaded`.
This requires estimating a count of bytes loaded of the original compressed stream, even though we only have uncompressed byte totals at this point. I instead rescale the uncompressed bytes by the compressed count to roughly estimate what would be the `bytesLoaded` had we been actually streaming bytes in and preloading them synchronously.
2022-09-15 19:14:41 -06:00
David Wendt bd08a6ebfe avm1: Expose preload progress to AVM1 via `getBytesLoaded` 2022-09-15 19:14:41 -06:00
David Wendt 0eff0bf91a core: Remove all synchronous preloading from core.
Backends that need synchronous preload behavior now explicitly ask for it as follows:

 * `tests` - repeatedly call `preload` in a loop with an exhausted execution limit to stress-test the chunked preload
 * `exporter`, `scanner` - synchronous/unlimited preload to match prior behavior

These may change in the future.
2022-09-15 19:14:41 -06:00
David Wendt 3d799acd96 core: Report to callers of preload if all preloading work was done or not. 2022-09-15 19:14:41 -06:00
David Wendt 10e944a911 core: Turns out this is NOT redundant, I just misread the loop points 2022-09-15 19:14:41 -06:00
David Wendt 15b781ff04 chore: Remove old version of code left behind during rebasing 2022-09-15 19:14:41 -06:00
David Wendt 89fcca4f0b core: Only mark the end of the frame if we hit the end of the tag stream. 2022-09-15 19:14:41 -06:00
David Wendt f272cba7e6 core: If we're marked as finished, set the preload position to `u64::MAX` so that the repeated call protection trips 2022-09-15 19:14:41 -06:00
David Wendt 31802ea96f chore: Reduce the number of necessary reads of the preload progress 2022-09-15 19:14:41 -06:00
David Wendt ea284ed6bf core: Preload should always start from the place we left off from. 2022-09-15 19:14:41 -06:00
David Wendt afd29d19a4 core: Don't do any work if a clip is preloaded after finishing preload. 2022-09-15 19:14:41 -06:00
David Wendt 86f9ee4821 core: Add a "preload everything we know about" method 2022-09-15 19:14:41 -06:00
David Wendt 940de4bb7e core: Add a special loader state for "downloaded but still parsing", and a function that ticks the preload.
Currently we do this automatically with no execution limit.
2022-09-15 19:14:41 -06:00
David Wendt 70e638b21f core: Actually decrease the current action limit correctly 2022-09-15 19:14:41 -06:00
David Wendt a05827eb90 core: Add a concept of an `ExecutionLimit` that checks both actions and runtime.
Actions are abstract; here we're using it to count bytes loaded (as a proxy for execution time). AVM code could potentially be adapted to count operations run instead.
2022-09-15 19:14:41 -06:00
David Wendt c80abff3a9 core: Allow chunked preloading within a `DefineSprite` tag 2022-09-15 19:14:41 -06:00
David Wendt 3a265adcc4 core: Ensure empty movie clips are born preloaded.
An "empty clip" is any clip created by the `new` or `new_with_avm2` function, intended for dynamically-created movie clips with no association to a movie symbol.
2022-09-15 19:14:41 -06:00
David Wendt f96017e6f3 avm2: Preload dynamically created movie clips
If we don't preload every movie clip we make, then they'll indicate themselves as not having been fully loaded yet, even though they are.
2022-09-15 19:14:41 -06:00
David Wendt 0f2237e171 core: Make frame loaded count no longer be off by one
The preload frame counting logic starts from one and continues to the end of the file, which results in a completely preloaded movie having one more frame "loaded" than there is in the file. This fixes that.
2022-09-15 19:14:41 -06:00
David Wendt 079b20a4f2 core: On unexpected EOF, mark the clip preload as completed 2022-09-15 19:14:41 -06:00
David Wendt 85cf383c84 core: Allow callers of `decode_tags` to flag when they would like decoding to stop 2022-09-15 19:14:41 -06:00
David Wendt f7f5316b71 core: Prohibit playing movie clip frames that haven't been preloaded yet. 2022-09-15 19:14:41 -06:00
David Wendt 0ab10d9ab0 core: Make the preload chunk size configurable per caller.
Right now, we do not actually set a chunk limit, as we still need infrastructure for backgrounding the preload calls.
2022-09-15 19:14:41 -06:00
David Wendt b5cbfaf093 core: When preloading other movie clips, forcibly preload them synchronously. 2022-09-15 19:14:41 -06:00
David Wendt 4e9bb3a173 core: Implement chunked decoding infrastructure.
We currently do not actually enforce a decoding limit; just add the functionality necessary to do so.
2022-09-15 19:14:41 -06:00
golfinq c63f915ae2 avm2: Implement missing enums 2022-09-15 15:42:29 -07:00
Daniel Jacobs cf721d45f9 Revert "web: Bump `wasm-bindgen` to 0.2.83"
This reverts commit 084b252030.
2022-09-15 22:33:07 +02:00
relrelb 084b252030 web: Bump `wasm-bindgen` to 0.2.83
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.

Due to https://github.com/rustwasm/wasm-bindgen/pull/3031, use the
`serde-wasm-bindgen` crate as a replacement to the deprecated
`JsValue::from_serde` function.
2022-09-14 09:03:31 +03:00
Aaron Hill e08f8d47ab Allow clippy::needless_lifetimes to keep explicit 'gc parameter
This makes it clear what the lifetime is used for.
2022-09-13 18:55:08 -05:00
Aaron Hill c4ce06a500 avm2: Use Box<dyn std::error::Error> for FromWStr impl
We don't currently have an `Activation` available in this
method, and we can't specify a 'gc lifetime without modifying
the trait itself.
2022-09-13 18:55:08 -05:00
Aaron Hill 3e65a554fa avm2: Add 'gc lifetime parameter to avm2::Error 2022-09-13 18:55:08 -05:00
relrelb b1760063ec avm2: Implement `flash.filters.DisplacementMapFilterMode` 2022-09-13 21:20:55 +03:00
relrelb 5d5093f0fd avm2: Implement `flash.filters.BitmapFilterType` 2022-09-13 21:20:55 +03:00