Commit Graph

7587 Commits

Author SHA1 Message Date
relrelb 2c50a04e37 avm1: Remove `Value::to_primitive_num`
Use `Value::to_primitive` instead.
2022-09-22 22:40:07 +03:00
relrelb d5209c4c43 core: Refactor `Percent` type
Unconditionally represet percentages as `f64` between `0.0` and `100.0`.
2022-09-22 04:17:44 +03:00
relrelb c31e9e2b11 render: Random cleanups
Avoid some `Vec::with_capacity` and de-duplicate code.
2022-09-22 03:00:02 +03:00
relrelb 9d4ab37ef6 core: Replace consecutive `push`es with `extend`
This should be slightly more efficient.
2022-09-22 03:00:02 +03:00
EmperorBale e40229d90b tests: Add test for ByteArray.writeObject 2022-09-21 13:39:58 -07:00
EmperorBale fe951b4989 avm2: Implement ByteArray.writeObject
While doing this I also noticed that we were incorrectly producing AmfValue::Integer if our
target AMF version is AMF0. This is incorrect because AMF0 is based on AS2, which does not
recognise Integer as a valid type, and therefore must be represented with Number instead.
2022-09-21 13:39:58 -07:00
Daniel Jacobs eefaca1e05 avm2: Add a few missed ActionScript enums 2022-09-21 20:54:36 +02:00
Aaron Hill 6ad72d0ef9 avm2: Assign 'prototype.name' through class object
This makes the files compile under mxmlc
2022-09-21 12:37:37 -05:00
Aaron Hill e99c7fa4af Add size assertions for Result<Value, Error> and Value 2022-09-21 12:37:37 -05:00
Aaron Hill 93b7de2fe6 avm2: Use custom Error instead of std::error::Error 2022-09-21 12:37:37 -05:00
Adrian Wielgosik d1ffaad927 avm2: Support enumerating null/undefined 2022-09-21 00:03:44 +02:00
Aaron Hill 9b9c95bfe2 avm2: Add GameInput and GameInputEvent 2022-09-18 11:37:02 -05:00
EmperorBale bfca30fed7 avm2: Implement IDataOutput 2022-09-17 12:31:43 -07:00
EmperorBale b1aff49673 avm2: Implement IDataInput 2022-09-17 12:31:43 -07:00
EmperorBale 7aa821da4f core: Use class index for `class_id`, instead of slot_id 2022-09-17 12:31:43 -07:00
EmperorBale e1eaa9770a avm2: Switch ByteArray to AS
avm2: Fix ByteArray

avm2: Implement ByteArray.defaultObjectEncoding

avm2: Rename ByteArray allocator
2022-09-17 12:31:43 -07:00
David Wendt f101160abc tests: Add a test for all `Stage.loaderInfo` properties that we weren't already testing for. 2022-09-17 12:32:15 -06:00
David Wendt 173b04cc5c avm2: Allow access to `Stage.loaderInfo.url` 2022-09-17 12:32:15 -06:00
David Wendt 0925412110 avm2: `LoaderInfo` needs to specifically know if it's the stage's loader or not. 2022-09-17 12:32:15 -06:00
Aaron Hill 423d7e4cc4 render: Treat `update_texture` with invalid `BitmapHandle` as an error
This should be impossible to trigger from ActionScript, so
we shouldn't ignore it.
2022-09-16 22:03:15 -06:00
David Wendt dbe6eb324c avm2: Explicitly delay all frame construction until the first frame is loaded.
This prevents the root from being constructed until we know its `SymbolClass`, and is roughly equivalent to delaying the work until `ShowFrame`. (We don't actually run any work on `ShowFrame` in our current movieclip impl.)
2022-09-16 21:44:11 -06:00
David Wendt 247a28d7e9 avm2: Impl `Sprite.useHandCursor` 2022-09-16 19:25:46 -06:00
David Wendt 6f1509d4cd avm2: Don't attempt to print registers that are out-of-bounds. 2022-09-16 15:46:36 -06:00
David Wendt 38c6369f6e avm2: Fix `avm_debug` not printing debugging information 2022-09-16 15:46:36 -06:00
David Wendt 187352b1db chore: Fix stubs to use the new `Error<'gc>` property 2022-09-15 20:25:21 -06:00
David Wendt e7379a26e9 docs: Mark `z` as needing a version-gate once we have that set up 2022-09-15 20:25:21 -06:00
David Wendt eefe398f7c tests: `as3_bitmap_embedded` has a different stage size 2022-09-15 20:25:21 -06:00
David Wendt 2b2089e9cb docs: Bitmap subclasses tickle the "initialized by movie" code path because the DisplayObject code actually does its job here 2022-09-15 20:25:21 -06:00
David Wendt cf82a9d1c4 tests: Add a test for properties on Flex-style assets
We also re-enable the `bitmapdata_embedded` test now that we have a real renderer to work with.
2022-09-15 20:25:21 -06:00
David Wendt bd8ff4f024 avm2: Add support for Bitmaps being associated to subclasses of `flash.display.Bitmap` 2022-09-15 20:25:21 -06:00
David Wendt fc02715faa avm2: Stub `z`, `scaleZ`, and all 3D rotation properties 2022-09-15 20:25:21 -06:00
David Wendt 2174c55d76 tests: Add a test for Flex-style image embeds. 2022-09-15 20:25:21 -06:00
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