MartySVK
ad688b45da
avm2: added Stage.fullScreenSourceRect stub ( #9265 )
...
* avm2: added Stage.fullScreenSourceRect
* fixing checks I hope
2023-01-22 16:29:12 -05:00
Aaron Hill
e2954821ea
core: Take two - delay reading image back from render backend using `SyncHandle` ( #9184 )
...
* Take two: Delay reading image back from render backend using `SyncHandle`
This allows us to avoid blocking immediately after a `BitmapData.draw` call.
Instead, we only attempt to use the `SyncHandle` when performing an operation
that requires the CPU-side pixels (e.g. BitmapData.getPixel or BitmapData.setPixel).
In the best case, the SWF will never explicitly access the pixels of
the target BitmapData, removing the need to ever copy back the render backend
image to our BitmapData. If the SWF doesn't require access to the pixels immediately,
we can delay copying the pixels until they're actually needed, hopefully allowing
the render backend to finish processing the BitmapData.draw operation in
the backenground before we need the result.
Now that the CPU and GPU pixels can be intentionally out of sync with
each other, we need to ensure that we don't accidentally expose 'stale'
CPU-side pixels to ActionScript (which needs to remain unaware of
our internal laziness). We now use a wrapper type `BitmapDataWrapper`
to enforce that the `SyncHandle` is consumed before accessing the
underlying `BitmapData.
* core: Skip GPU->CPU sync for source and target BitmapData during draw
* Introduce DirtyState enum
2023-01-21 21:08:04 +00:00
MartySVK
6d5f6385a5
avm2: added TextField.restrict stub ( #9218 )
...
* added TextField.restrict stub
Co-authored-by: Martin Mravec <marty.devil@gmail.com>
2023-01-19 22:23:33 -05:00
Adrian Wielgosik
fb4d2d3f04
avm2: Implement TextField.maxChars
2023-01-19 01:24:47 +01:00
Nathan Adams
5f72ebaef9
core: Don't call avm2 callstack method if there's no callstack
2023-01-19 00:50:56 +01:00
Nathan Adams
f5d69f5ad8
avm2: Corrected panic messages in date code
2023-01-16 21:48:00 +01:00
EmperorBale
3287173da3
avm2: Fix edge case when setting fullYear of date
2023-01-16 21:48:00 +01:00
EmperorBale
6bb079cc60
avm2: Remove some useless else statements in date
2023-01-16 21:48:00 +01:00
MrCheeze
ebe5eed143
avm2: Fix corner case when goto same frame multiple times ( close #9018 )
...
This change makes it so that if there is a goto to a specific frame,
then a frame script is registered for that frame, and then a goto to the
same frame again, the frame script will not be skipped. At least one movie
appears to depend on this behaviour.
2023-01-16 18:37:19 +01:00
nosamu
952aa2d5f9
avm2: Correct name of rollover event
2023-01-14 20:04:33 +01:00
Aaron Hill
3a6c8d9796
core: Use BitmapData instead of separate `initial_data` field
...
Now that a `Bitmap` always stores a `BitmapData`, we can read the pixels
directly from the `BitmapData`, instead of duplicating them in an
`initial_data` field
2023-01-14 01:28:22 -05:00
Aaron Hill
b5796f9016
core: Derive Default for FramePhase
2023-01-13 20:37:52 +01:00
Calvin304
6c71f5b2a6
avm2: Naive DefineButtonSound impl for Avm2Button
2023-01-11 17:45:39 -05:00
Nathan Adams
9cd850d30e
render: Make render_offscreen return a sync handle which can be used to get the texture at a later time
2023-01-11 16:53:33 -05:00
Nathan Adams
133044b06b
avm2: Fix start_drag with negative width or height
2023-01-11 00:09:01 +01:00
MrCheeze
0597ae56e6
core: Make AVM2 frame labels case sensitive
2023-01-10 11:28:56 -05:00
renovate[bot]
630558a936
fix(deps): update rust dependencies
2023-01-10 16:37:40 +01:00
Moulins
3b1c981d25
Clears the AVM1 stack after executing bytecode
...
AVM1 bytecode may leave the operand stack unbalanced, and this will
cause a slow memory leak if the stack is never cleared.
2023-01-10 14:14:17 +01:00
CUB3D
c6bd431864
avm1: Deduplicate threshold operations
2023-01-10 13:59:06 +01:00
CUB3D
ea6ea8074a
tests: Add tests for BitmapData.threshold, fix issues found as a result
2023-01-10 13:59:06 +01:00
CUB3D
70f071b347
avm1: Implement Bitmapdata.threshold
2023-01-10 13:59:06 +01:00
CUB3D
8db909a7d4
desktop: Allow specifying player version
2023-01-10 13:13:30 +01:00
MrCheeze
bf6342bd4b
avm2: Fix hitTestPoint not transforming coordinates to world space
...
This behaviour is essentially copied from avm1 movie_clip.rs's hit_test.
Seems to fix several flashes that had broken collision until now.
2023-01-10 12:53:20 +01:00
Nathan Adams
724609e323
audio: Don't panic when reading an invalid mp3, bubble the error up
2023-01-10 11:10:46 +01:00
Nathan Adams
3b24d849e7
audio: Removed unwraps in mixer.rs and replaced with reasoned expects
2023-01-10 11:10:46 +01:00
Nathan Adams
7a9e8b4771
core: Made NullNavigatorBackend no longer use unwraps
2023-01-10 11:10:46 +01:00
CUB3D
84d0111a14
avm1: Add test for with scope nesting
2023-01-10 10:34:10 +01:00
CUB3D
ca82ff65de
avm1: Defining a local in a with scope should actually define it on the parent scope
2023-01-10 10:34:10 +01:00
Nathan Adams
a37e070724
core: Use Color::WHITE for draw_rect when we don't care, as it's just identity color transform and thus cheaper
2023-01-10 09:39:28 +01:00
Nathan Adams
53d6fa4d8b
render: Make render commands take in an actual value, not ref for immediate cloning
2023-01-10 09:39:28 +01:00
Adrian Wielgosik
14ee9b43fb
avm2: Replace ok_or by ok_or_else
2023-01-09 21:01:39 +01:00
Aaron Hill
40d8751d67
avm2: Implement clipRect parameter for BitmapData.draw
2023-01-08 16:11:55 -05:00
Aaron Hill
1b71e288fd
Remove 'gc_context lifetime
...
The latest `gc-arena` makes this unnecessary - we can just
use our `'a` lifetime for `MutationContext`
2023-01-06 19:20:39 -05:00
Moulins
d332a174c3
Bump `gc-arena` to current master revision
...
This required small changes to some Debug impls that were missed in #8964
2023-01-06 18:22:43 -05:00
Nathan Adams
a7738bec69
core: Added a few simple tracing::instruments
2023-01-06 04:25:22 +01:00
Nathan Adams
13fd830e7c
core: Switch from log to tracing
2023-01-06 04:25:22 +01:00
MrCheeze
71fcd383a3
avm2: Add ctrlKey, altKey, shiftKey, controlKey properties to KeyboardEvent
2023-01-04 16:27:09 -05:00
Nathan Adams
4d948616db
avm1: Implement BitmapData.draw with blend mode, fixes #8920
2023-01-04 12:09:08 -05:00
Nathan Adams
cd550457e1
core: Made TDisplayObject::movie() no longer an Option<>
2023-01-04 08:20:08 +01:00
Nathan Adams
40a7bb04d6
core: Removed default impl of TDisplayObject::movie(), implement it everywhere
2023-01-04 08:20:08 +01:00
Aaron Hill
10491a1be9
core: Store data in `BitmapData` instead of `Bitmap`
...
This makes `Bitmap` delegate to `BitmapData` for
all of the bitmap-related information (handle, width, and height).
As a result, we now unconditionally store a `BitmapData` in `Bitmap`.
As a result, swapping the underling `BitmapData` instance will
automatically change the properties (and rendered image) of a `Bitmap`.
This required some refactoring in the render backends in order to
get access to a `BitmapHandle` through `BitmapData`.
2023-01-03 18:01:41 -07:00
MrCheeze
41df7fdc59
avm2: For old swf versions, invalid goto labels jump to frame 1 ( fix #8954 )
...
The regression test for this was edited directly in JPEXS, so there is
no corresponding fla to compile into the swf.
2023-01-03 17:10:06 -07:00
MrCheeze
77104ca473
avm2: Improve accuracy of gotoAndPlay / gotoAndStop (partially fix #8954 )
...
Partially based on AVM1 implementation, partially based on the new
regression tests added in this commit.
2023-01-03 17:10:06 -07:00
nosamu
664a86161a
avm2: Fix `for each..in` loops over Dictionary values
2023-01-03 16:52:15 -07:00
Moulins
27307d847a
core: Replace some derived Debug impls with manual ones
...
In future versions of `gc-arena`, the `Debug` impl. of `Gc`
and `GcCell` will print the pointed-to value, which will cause
derived `Debug` impls. to enter an infinite recursion.
As such, this manually implements `Debug` on types wrapping a
`Gc/GcCell` to maintain the current behavior.
2023-01-03 18:03:23 -05:00
Nathan Adams
5a7ec70254
core: Remove blend mode unsupported message
2023-01-03 03:39:13 +01:00
Nathan Adams
ded46e20e7
render: Replace PushBlendMode/PopBlendMode with Blend
2023-01-03 03:39:13 +01:00
EmperorBale
a51ffd0e9f
avm2: Strings passed to date constructor should be parsed
2023-01-02 11:43:03 -08:00
EmperorBale
ab3a1e6148
avm2: Move date parsing into a separate function
2023-01-02 11:43:03 -08:00
MrCheeze
bf18334294
avm2: Fix calling setTextFormat without providing a beginIndex and EndIndex
...
Previous behaviour defaulted to undefined and applied the format to the
range [0,0) instead of defaulting to -1 and applying the format to the
full length of the TextField.
2023-01-01 21:03:12 -08:00
Aaron Hill
9d6763510b
core: Remove redundant 'clone' calls
2022-12-31 17:13:55 -05:00
nosamu
89e01b5598
avm2: Throw error in Loader.unload stub
2022-12-29 10:50:35 +01:00
EmperorBale
ac4d74b9ed
core: Use applicationDomain specified in context if available
2022-12-28 17:25:11 -05:00
EmperorBale
7e5018331d
core: Add new `context` parameter to loader
2022-12-28 17:25:11 -05:00
dependabot[bot]
6f430bb40d
build(deps): bump serde from 1.0.151 to 1.0.152
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.151 to 1.0.152.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.151...v1.0.152 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-28 10:55:35 +02:00
David Wendt
08fed6aeaa
core: Don't attempt to set properties on parents after construction unless the child has an explicit name.
...
This already was implemented, but the prior commits broke it.
2022-12-27 20:15:49 -07:00
David Wendt
7eb0ca8ecc
core: Unconstructed display objects should be `null`, not `undefined`.
2022-12-27 20:15:49 -07:00
David Wendt
cbf2e94aba
core: Fix AVM2 buttons getting constructed with the wrong initial state.
...
This code was always wrong; and only saved from breaking by other wrong code elsewhere. Specifically:
* `SimpleButton.construct_frame` sets the wrong initial state
* but `MovieClip.instantiate_child` fires frame events before `post_instantiation`
* and `SimpleButton.post_instantiation` sets the correct state
2022-12-27 20:15:49 -07:00
David Wendt
eb0eede07d
chore: Remove unused/superceded event issue code
2022-12-27 20:15:49 -07:00
David Wendt
b6aa035663
core: Instantiating display objects on the timeline should no longer construct them.
...
This works now because all object placement and removal happens in `enter_frame`. Constructing those objects right away causes them to drop added events.
We cannot remove other instances of `construct_frame`, however - those are in places where we actually do expect constructors to run, not just see things get placed.
2022-12-27 20:15:49 -07:00
David Wendt
4b71fff745
core: Children added to AVM2 buttons should not emit added events
2022-12-27 20:15:49 -07:00
David Wendt
0d7e9cd30e
core: All display objects that can be placed by timeline need to add themselves to their parent object.
...
This also centralizes all the code we added in the prior commit into `on_construction_complete`, which should be called whenever an AVM2 object finishes construction.
2022-12-27 20:15:49 -07:00
David Wendt
1c5e97ccc6
core: Move AVM2 `PlaceObject` processing to `enter_frame`.
...
This has a few other knock-on effects:
* AVM2 added-to-timeline events are fired by each object after it constructs its AVM2 side. This is opposed to before when we fired them after object instantiation and placement. This also gets rid of a prior hack we had for the AVM2 root movie getting added to the stage - or, more accurately, adopts it for everything.
* The supercall constructor for `DisplayObject` runs `construct_frame` on all children. This matches Flash Player behavior.
NOTE: This currently breaks the `placed_with_name` check, so there's going to be a lot of spurious can't set warnings
2022-12-27 20:15:49 -07:00
dependabot[bot]
664c67ea27
build(deps): bump clap from 4.0.29 to 4.0.32
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.29 to 4.0.32.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.29...v4.0.32 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 22:04:33 +01:00
Aaron Hill
6dc628e49f
core: Remove some manual `Collect` impls
...
Some were completely unused, while others could be replaced
with a `#[derive(Collect)]`
2022-12-24 00:33:25 -06:00
Adrian Wielgosik
7a09dd5639
avm2: Convert FrameLabel to AS3, remove define_indirect_properties
2022-12-22 00:45:02 +01:00
Adrian Wielgosik
e6e9c9edc2
avm2: Convert Dictionary to AS3
2022-12-21 23:56:48 +01:00
Adrian Wielgosik
e90d595cb3
avm2: Convert SharedObject to AS3
2022-12-21 22:21:23 +01:00
Adrian Wielgosik
f3ebb0c297
avm2: Convert JSON class to AS3
2022-12-21 22:21:23 +01:00
Lord-McSweeney
5cf5c8d5e5
Update Loader.as
...
Stub `flash.display.Loader.unload`
2022-12-20 16:58:55 -06:00
dependabot[bot]
d12e1ebd6e
build(deps): bump syn from 1.0.105 to 1.0.107
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.105 to 1.0.107.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.105...1.0.107 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 07:52:42 +02:00
dependabot[bot]
5383ae296d
build(deps): bump quote from 1.0.21 to 1.0.23
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.21 to 1.0.23.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.21...1.0.23 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 07:29:38 +02:00
dependabot[bot]
9db6ace65f
build(deps): bump serde from 1.0.150 to 1.0.151
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.150 to 1.0.151.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.150...v1.0.151 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 00:48:45 +01:00
dependabot[bot]
08566ed4ba
build(deps): bump proc-macro2 from 1.0.47 to 1.0.49
...
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2 ) from 1.0.47 to 1.0.49.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.47...1.0.49 )
---
updated-dependencies:
- dependency-name: proc-macro2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 00:20:20 +01:00
dependabot[bot]
502b03a882
build(deps): bump rustversion from 1.0.9 to 1.0.11
...
Bumps [rustversion](https://github.com/dtolnay/rustversion ) from 1.0.9 to 1.0.11.
- [Release notes](https://github.com/dtolnay/rustversion/releases )
- [Commits](https://github.com/dtolnay/rustversion/compare/1.0.9...1.0.11 )
---
updated-dependencies:
- dependency-name: rustversion
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 21:37:54 +01:00
CUB3D
7b564ccd97
avm2: Stub registerClassAlias
2022-12-19 11:06:52 -08:00
Adrian Wielgosik
24a6f74b3c
avm2: Convert Proxy to AS3
2022-12-19 18:25:25 +01:00
Adrian Wielgosik
96950f424e
avm2: Stub InteractiveObject.focusRect
2022-12-18 14:36:08 -07:00
CUB3D
80cf98f501
avm2: Check for state parent in hit_test_shape as well as mouse_pick
2022-12-18 13:32:24 -07:00
CUB3D
2edbe3092b
avm2: Ignore mouse_pick on static text
2022-12-18 13:32:24 -07:00
CUB3D
b46a4186ab
chore: Fmt
2022-12-18 13:32:24 -07:00
CUB3D
6f214c2165
chore: Fix clippy lint
2022-12-18 13:32:24 -07:00
CUB3D
ef9483d961
avm2: hitTestPoint requires do to be on stage, only if shape_flag=true
2022-12-18 13:32:24 -07:00
CUB3D
d7156e9a58
avm2: Dont transform mouse_pick point in button if hit_area has a parent
2022-12-18 13:32:24 -07:00
CUB3D
55926932e0
avm2: MouseUpInside clip events should be handled by avm2 buttons
2022-12-18 13:32:24 -07:00
CUB3D
8ddba5432c
avm2: hitTestPoint requires the object to be on the stage
2022-12-18 13:32:24 -07:00
CUB3D
1013a6a162
avm2: Button bounds_with_transform should include bounds of current state child
2022-12-18 13:32:24 -07:00
CUB3D
391b3a9dfb
avm2: Selecting the child of a SimpleButton should select the button, not the child
...
This fixes ingame menu buttons in BLOCnog
2022-12-18 13:32:24 -07:00
CUB3D
fa44d61bc5
avm2: MouseEnabled shouldn't affect abillity to select children
...
Fixes #8694
2022-12-18 13:32:24 -07:00
CUB3D
690191dbdf
avm2: Fix SimpleButton bounds
2022-12-18 13:32:24 -07:00
CUB3D
f1401d6837
avm2: Fix hittests on depth=0 children
2022-12-18 13:32:24 -07:00
Mike Welsh
c30eb38741
audio: Rename symphonia feature to mp3
2022-12-17 22:48:42 -08:00
Mike Welsh
d162363c2f
audio: Remove minimp3 feature
2022-12-17 22:48:42 -08:00
Moulins
625f09a91a
avm1: remove unused GcCell in ArrayObject and SuperObject
2022-12-17 21:12:43 -08:00
Moulins
62e64c714e
avm1: remove most of the contents of impl_custom_object! macro
...
The delegating methods are moved to default implementations on the
TObject trait, delegating to self.raw_script_object()
2022-12-17 21:12:43 -08:00
Moulins
eadbf92454
avm1: rename TObject::{as => raw}_script_object & remove Option in ret. type
...
Usage of TObject::as_script_object was always followed by an unwrap, and
only SuperObject returned None.
The name change is intended to make clearer the fact that using the
returned object may bypass special behavior.
2022-12-17 21:12:43 -08:00
David Wendt
1255bf1c59
core: Don't fire init events on AVM2 until the first frame has been constructed.
2022-12-17 20:47:49 -08:00
Mike Welsh
696c9062d3
chore: Inherit cargo metadata from workspace
...
Use workspace inheritance added in Rust 1.64 to de-duplicate
various settings across all packages.
2022-12-16 15:53:59 -08:00
Adrian Wielgosik
870745e0ef
avm2: Make pop_stack #[must_use]
2022-12-16 14:40:22 -08:00
Adrian Wielgosik
7df920b255
avm2: Support indexing with QNames
2022-12-16 14:40:22 -08:00
Adrian Wielgosik
d2dfdb9a0b
avm2: Collapse PackageNamespace to Namespace
2022-12-16 12:51:01 -08:00
relrelb
14747f26fd
chore: Fix `clippy::uninlined_format_args` for `avm_debug!`
...
Though this is not currently enforced by Clippy.
2022-12-15 08:59:38 +02:00
relrelb
bd9078addf
chore: Fix `clippy::uninlined_format_args` lints
2022-12-15 08:59:38 +02:00
nosamu
f904f20796
avm2: Stub SharedObject.clear and SharedObject.size
2022-12-15 08:41:28 +02:00
Adrian Wielgosik
92998e2c91
avm2: Translate ExternalInterface to AS
2022-12-14 17:57:45 +01:00
Adrian Wielgosik
5e115ed038
avm2: Stub more parts of LocalConnection and UrlRequest
2022-12-13 10:22:20 +01:00
Adrian Wielgosik
c8314da8d3
avm2: Fix aliasing in BitmapData.copyChannel
2022-12-13 01:24:49 +01:00
Callum Thomson
20c9a3d765
AVM2: Implement System.setClipboard ( #8751 )
...
* avm2: Implement System.setClipboard
* web: Add comment to set_clipboard_content
2022-12-13 01:05:23 +01:00
CUB3D
02360b28dc
avm2: Implement basic flash.net.navigateToURL
2022-12-13 00:34:10 +01:00
dependabot[bot]
b1c4e6f143
build(deps): bump serde from 1.0.149 to 1.0.150
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.149 to 1.0.150.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.149...v1.0.150 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-12 21:21:45 +01:00
nosamu
1aaaf6d421
avm2: Stub SharedObject.close
2022-12-10 21:38:19 -06:00
Adrian Wielgosik
2bb4e2e549
core: Fix failing builds without avm_debug feature
2022-12-07 00:34:01 +01:00
David Wendt
8678325686
core: `Loader` must pass enter/construct frame lifecycle events to children or loaded SWFs won't work
2022-12-06 20:10:30 +01:00
Adrian Wielgosik
e351f9f19b
core: use ctrl+alt+f to dump DO render tree
2022-12-05 19:49:41 -07:00
Adrian Wielgosik
7b64fcf5fa
avm2: Fix indirect event dispatching
2022-12-06 00:44:17 +01:00
dependabot[bot]
061f261c50
build(deps): bump syn from 1.0.104 to 1.0.105
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.104 to 1.0.105.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.104...1.0.105 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 23:15:10 +01:00
dependabot[bot]
3b285f8cf2
build(deps): bump serde from 1.0.148 to 1.0.149
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.148 to 1.0.149.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.148...v1.0.149 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 22:35:48 +01:00
kmeisthax
f79208c75f
avm2: Fix no-op gotos ( #8667 )
...
* tests: Add a test for issue #8630
* core: No-op gotos in AS3 do not actually do anything, even though they emit events
Fixes issue #8630
* tests: Add more tests for various #8630-adjacent cases
* tests: Ignore the tests with script removal as they expect MovieClip children to be nulled upon removal
* chore: Case sensitive filesystem fix
Co-authored-by: Adrian Wielgosik <adrian.wielgosik@gmail.com>
2022-12-05 18:19:29 +01:00
wsxarcher
c8e39da1e0
avm2: Implement filefilter filereference
2022-12-04 15:10:48 +01:00
Toad06
dcf1fb4ffd
avm1: Various minor fixes in filters
2022-12-04 14:19:41 +01:00
Aaron Hill
1b3070ab85
core: Make `BitmapHandle` hold a trait object instead of an id
...
`BitmapHandle` now holds `Arc<dyn BitmapHandleImpl>`.
This allows us to move all of the per-bitmap backend data into
`BitmapHandle`, instead of holding an id to a backend-specific
hashmap.
This fixes the memory leak issue with bitmaps. Once the AVM side of a
bitmap (`Bitmap`/`BitmapData`) gets garbage-collected, the
`BitmapHandle` will get dropped, freeing all of the GPU resources
assoicated with the bitmap.
2022-12-03 19:44:44 -06:00
Adrian Wielgosik
0861153626
swf: make Clippy happy
2022-12-03 22:18:22 +01:00
David Wendt
ce35313094
Revert "Revert "avm2: Implement `TextField` scrolling parameters""
...
This reverts commit f08aa19cb7
.
2022-12-02 21:41:20 -05:00
Adrian Wielgosik
f08aa19cb7
Revert "avm2: Implement `TextField` scrolling parameters"
...
This reverts commit 230ef315a2
.
2022-12-02 18:22:19 -07:00
David Wendt
230ef315a2
avm2: Implement `TextField` scrolling parameters
2022-12-02 22:40:22 +01:00
Marco Bartoli
f2080e6d57
avm2: implement get and set of displayobject filters ( #8623 )
2022-12-01 02:31:35 +01:00
dependabot[bot]
83487ae5d1
build(deps): bump serde from 1.0.147 to 1.0.148
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.147 to 1.0.148.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.147...v1.0.148 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-30 10:04:26 +01:00
dependabot[bot]
e3923e0d3d
build(deps): bump syn from 1.0.103 to 1.0.104
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.103 to 1.0.104.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.103...1.0.104 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 20:47:36 -07:00
Calvin304
5d5a56a7a3
avm2: Address feedback to DropShadowFilter stub
2022-11-27 09:46:18 -05:00
Calvin304
e46fc4fe8a
avm2: stub DropShadowFilter
2022-11-27 09:46:18 -05:00
Marco Grassi
0c851ecfde
don't include all the features in chrono to avoid including the vulnerable time dependency
2022-11-26 14:04:59 -05:00
Marco Grassi
ad81b3bf14
upgrade lock and toml dependencies
2022-11-26 14:04:59 -05:00
Aaron Hill
b8745f0ff1
avm2: Partially implement Stage3D for wgpu backend
...
This PR implements core 'stage3D' APIs. We are now able
to render at least two demos from the Context3D docs - a simple
triangle render, and a rotating cube.
Implemented in this PR:
* Stage3D access and Context3D creation
* IndexBuffer3D and VertexBuffer3D creation, uploading, and usage
* Program3D uploading and usage (via `naga-agal`)
* Context3D: configureBackBuffer, clear, drawTriangles, and present
Not yet implemented:
* Any 'dispose()' methods
* Depth and stencil buffers
* Context3D texture apis
* Scissor rectangle
General implementation strategy:
A new `Object` variant is added for each of the Stage3D objects
(VertexBuffer3D, Program3D, etc). This stores a handle to the
parent `Context3D`, and (depending on the object) a handle
to the underlying native resource, via `Rc<dyn
SomeRenderBackendTrait>`).
Calling methods on Context3D does not usually result in an immediate
call to a `wgpu` method. Instead, we queue up commands in our
`Context3D` instance, and execute them all on a call to `present`.
This avoids some nasty wgpu lifetime issues, and is very similar
to the approah we use for normal rendering.
The actual rendering happens on a `Texture`, with dimensions
determined by `createBackBuffer`. During 'Stage' rendering,
we render all of these Stage3D textures *behind* the normal
stage (but in front of the overall stage background color).
2022-11-25 21:43:00 -07:00
Toad06
460458812b
avm1: Correct some properties in SWFv4
2022-11-25 20:35:59 -07:00
Aaron Hill
3bef8c4fd6
render: Remove `get_bitmap_pixels` and store data in `Character::Bitmap`
...
We only called `get_bitmap_pixels` when creating a `BitmapData`
for an SWF-provided `Bitmap`. We now store the initial pixels
in `Character::Bitmap`, and use them to initialize a `BitmapData`
when needed.
This lets us simplify the wgpu backend, which no longer needs
to store a `Bitmap` object. In addition to saving space for
`BitmapData` objects that lack an SWF `Bitmap`, this will make
it easier to move data from `bitmap_registry` into `BitmapHandle`
itself.
2022-11-25 16:08:42 -07:00
Mark Richins
d345523d02
Fix conflicts
2022-11-23 20:45:37 -07:00
Mark Richins
9941701b3a
Fix: change twips_2d to use x and y and fix bug
2022-11-23 20:45:37 -07:00
Mark Richins
63a291ac4b
Fix promblems caused by moving Twips
2022-11-23 20:45:37 -07:00
EmperorBale
7a0f3d5d32
chore: Formatting
2022-11-23 17:28:28 -07:00
EmperorBale
e922a118d8
avm2: Improve inlining of stack related functions
2022-11-23 17:28:28 -07:00
EmperorBale
c919890a1e
chore: Use if/else instead of matching cmp
2022-11-23 17:28:28 -07:00
EmperorBale
657f54b2f1
chore: Cleanup clippy lint
2022-11-23 17:28:28 -07:00
EmperorBale
35219cf592
avm2: `op_get_scope_object` should start at the scope depth.
2022-11-23 17:28:28 -07:00
EmperorBale
eb9ce4073e
avm2: Clear stack & scope when execution is complete.
2022-11-23 17:28:28 -07:00
EmperorBale
4d151931f8
chore: Improve doc comments
2022-11-23 17:28:28 -07:00
EmperorBale
601f36df33
avm2: Introduce `clear_stack` & `clear_scope`.
2022-11-23 17:28:28 -07:00
EmperorBale
98d3b8f3c1
avm2: Enforce max scope depth & minimum scope depth
...
when pushing/popping from scope stack.
2022-11-23 17:28:28 -07:00
EmperorBale
7a48014d36
avm2: Enforce max stack & stack depth when pushing/popping from stack
2022-11-23 17:28:28 -07:00
EmperorBale
d46b2c39ca
avm2: Share scope stack across AVM2
2022-11-23 17:28:28 -07:00
EmperorBale
16805a350b
avm2: Store stack information in activations
2022-11-23 17:28:28 -07:00
Moulins
c10244b0a4
core: Only unload D.O.s when they are removed from the render list
...
D.O.s removed by the timeline may only be removed from the depth list
(if they were manipulated by AS3 scripts), but their unload method
would still be called, which is wrong.
2022-11-23 16:44:38 -07:00
Moulins
53010544db
core: Simplify core::do::container::Lists bitflags into boolean enum
...
Callsites only ever used two values, as children in the display list are
always in the render list.
2022-11-23 16:44:38 -07:00
Moulins
58e39623a5
core: Make all ChildContainer's methods private
...
And also, remove some dead code
2022-11-23 16:44:38 -07:00
Aaron Hill
4b8cd45f4b
avm2: Partially implement StaticText ( #8343 )
...
This is linked to the legacy DisplayObject::Text, which can
only be created by Flash CS6 (but is allowed in AVM2 swfs).
The 'StaticText' class cannot be constructed from ActionScript.
To support this, I've added support for native initializers to
playerglobal. This allows us to throw an exception in the
ActionScript constructor in Test.as, and do nothing in the native
intiializer (so that we can construct it from a DisplayObject).
I've left StaticText.text unimplemented for now, since it will require
dealing with Glyphs
Co-authored-by: kmeisthax <dcrkid@yahoo.com>
2022-11-23 18:30:47 -05:00
Moulins
9529a1cbdb
avm1: address Scope nitpicks
2022-11-23 15:50:45 -07:00
Moulins
05e3e6434b
avm1: Remove all allocations in `Activation::from_nothing`
...
This is done by:
- using the global constant pool instead of a fresh empty one:
- OK, as no call-site is directly executing arbitrary bytecode that
could care about the contents of the constant pool.
- pre-allocating the global scope object in the `Avm1` context
- using the global scope directly instead of allocating a local scope:
- OK, because no call-site is directly defining locals on the
returned Activation's scope.
2022-11-23 15:50:45 -07:00
Moulins
5faba34eb2
avm1: remove 'globals' parameter from Activation::from_nothing
...
Across all invocations, this is always set to the global object so it
can be hard-coded inside the call.
2022-11-23 15:50:45 -07:00
Moulins
ea03aa04b8
avm1: make scope references immutable; they were never actually modified
...
Rewrite Scope::new_target_scope, as the previous approach is unusable
now that Scope doesn't have interior mutability anymore.
2022-11-23 15:50:45 -07:00
Moulins
8cb0b47d1f
avm1: make constant pool reference immutable; it was never actually modified
2022-11-23 15:50:45 -07:00
TÖRÖK Attila
a9c94513a0
avm2,audio: Implement leftPeak and rightPeak in SoundChannel
2022-11-23 15:38:41 -07:00
michiel2005
50724448c8
Update array.rs
2022-11-23 15:19:07 -07:00
michiel2005
7c5f2805ef
Avoid code duplication
...
Avoided code duplication in avm1 array.rs as asked
2022-11-23 15:19:07 -07:00
Moulins
2fa3d31732
Appease Clippy on nightly
2022-11-23 22:39:45 +01:00
Toad06
eb2ee06588
avm1: Fix `ExternalInterface.call` with blank strings in SWFv8
2022-11-22 16:51:59 -07:00
Aaron Hill
bdadb17a95
render: Don't use BitmapHandle in tessellator
...
Currently, we rely on ShapeTessellator being able to get a BitmapHandle
without a RenderBackend. With the upcoming BitmapData refactor,
we will always need a RenderBackend to get a BitmapHandle, which creates
borrow-checker issues in ShapeTessellator (which is stored in a
RenderBackend).
To solve this, we split BitmapSource.bitmap into two methods -
BitmapSource.bitmap and BitmapSource.bitmap_handle. ShapeTessellator
continues to use BitmapSource.bitmap, and uses the u16 bitmap id
instead of a BitmapHandle. The BitmapSource.bitmap_handle method
is used inside each render backend to convert the id to a BitmapHandle,
avoiding borrow-checker issues.
2022-11-21 21:04:40 -07:00
David Wendt
0aec23b468
chore: Upgrade deprecated timezone code.
...
This doesn't actually add any new places for code to panic, since the deprecated functions all `unwrap`'d internally.
2022-11-21 18:50:46 -07:00
dependabot[bot]
1b6e91393e
build(deps): bump indexmap from 1.9.1 to 1.9.2
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.9.1 to 1.9.2.
- [Release notes](https://github.com/bluss/indexmap/releases )
- [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.md )
- [Commits](https://github.com/bluss/indexmap/compare/1.9.1...1.9.2 )
---
updated-dependencies:
- dependency-name: indexmap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 18:27:58 -07:00
dependabot[bot]
ccb1fa1b1b
build(deps): bump clap from 4.0.24 to 4.0.26
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.24 to 4.0.26.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.24...v4.0.26 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 18:07:28 -07:00
dependabot[bot]
25664778f3
build(deps): bump bitstream-io from 1.5.0 to 1.6.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/compare/v1.5.0...v1.6.0 )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 17:16:38 -07:00
Toad06
caecc519cd
avm1: Minimal implementation of `LoadVars.getBytesTotal` and `LoadVars.getBytesLoaded`
2022-11-20 22:00:36 -07:00
David Wendt
ecdef4c6f4
core: Empty text lines should still have a height.
2022-11-20 17:13:48 -07:00
David Wendt
425bea45f8
avm1: `TextFormat.getTextExtent` uses the height of all boxes in the layout
2022-11-20 17:13:48 -07:00
David Wendt
66bf03908b
avm1: Implement `TextFormat.getTextExtent`
2022-11-20 17:13:48 -07:00
David Wendt
83db53202e
core: Add empty boxes for empty lines *without* breaking multiple-format lines.
2022-11-20 17:13:48 -07:00
David Wendt
88c3cf0c72
core: The leading for a given line is stated using the text format's leading, not the font's leading.
2022-11-20 17:13:48 -07:00
David Wendt
59f01a40f1
core: Empty lines should also generate a layout box.
2022-11-20 17:13:48 -07:00
David Wendt
5f7344259a
avm2: Impl `TextField.numLines` and `.getLineMetrics`
2022-11-20 17:13:48 -07:00
David Wendt
1efa29baa6
core: Add methods for introspecting text metrics on an `EditText`.
2022-11-20 17:13:48 -07:00
Adrian Wielgosik
7e2b876ab3
avm2: Refactor context menu field bool checks into macro
2022-11-17 22:03:54 -05:00
Adrian Wielgosik
e840d1f71c
core: Support AVM2 context menu (sans callbacks)
2022-11-17 22:03:54 -05:00
Toad06
182c3b78e4
avm1: onData fails if the loaded data is an empty string
2022-11-17 20:51:11 -05:00
dependabot[bot]
b3debc96af
build(deps): bump clap from 4.0.22 to 4.0.24
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.22 to 4.0.24.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.22...v4.0.24 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 09:33:20 +02:00
TÖRÖK Attila
08270efee7
avm2: Implement SoundMixer.computeSpectrum()
2022-11-10 19:11:29 -05:00
TÖRÖK Attila
2b4d8d9c6e
core,desktop: Add and implement AudioBackend::get_sample_history()
2022-11-10 19:11:29 -05:00
Moulins
fb8caad783
core: rename TInteractiveObject::{ibase => raw_interactive}(_mut)
...
To match with TDisplayObjectContainer::raw_container(_mut) introduced
in previous commit.
2022-11-09 23:39:15 -05:00
Moulins
0bc01c239f
core: remove impl_display_object_container! macro
...
It is replaced by two accessor methods on the trait + default
implementations of all other methods.
2022-11-09 23:39:15 -05:00
dependabot[bot]
9303304e3b
build(deps): bump clap from 4.0.18 to 4.0.22
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.18 to 4.0.22.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.18...v4.0.22 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 00:25:12 +02:00
relrelb
c516fef65d
swf: Simplify read of `PlaceObject` tags
...
`tag_length` isn't really necessary since each tag is read using
a dedicated `swf::Reader`, which keeps track of the tag boundary
internally.
As a result, `tag_len` can be avoided passed around many times in
`movie_clip.rs`.
2022-11-08 00:05:41 +02:00
moulins
8cbd527e4c
avm1: Small cleanups in ActionQueue ( #8486 )
...
- Use a fixed-size array instead of a Vec for the queues
- Remove unwanted plurals in methods and types names
2022-11-06 07:39:11 +02:00
Moulins
e121c82b10
avm1: remove manual bit-wrangling in declare_properties! macro
...
Now that the relevant compiler ICE is fixed, we can use the Attribute
constants directly
2022-11-03 09:19:11 +02:00
Adrian Wielgosik
3458cd92e4
avm2: Support DO.getBounds, (partial) getRect
2022-11-01 22:46:34 +01:00
relrelb
89f3445d62
swf: Introduce and use `Rectangle::width()` and `Rectangle::height()`
2022-11-01 09:49:04 +02:00
Aaron Hill
68471723b3
core: Fix clippy format string lint
2022-10-27 08:49:39 +03:00
relrelb
fb7ba9c9a0
core: Extract `Graphic::drawing`
...
That returns a non-`Option` `Drawing`, and has no `.unwrap()`s.
2022-10-26 09:05:42 +03:00
relrelb
7dfc5b6e2e
core: Extract `MovieClip::drawing`
...
That returns a non-`Option` `Drawing`. This avoids many `.unwrap()`s
in AVM1.
2022-10-26 09:05:42 +03:00
relrelb
d3c6d9d148
avm1: Require a `MovieClip` in `MovieClip.duplicateMovie`
...
A `MovieClip` must be instantiated from an ID of a `MovieClip`.
2022-10-26 09:05:42 +03:00
dependabot[bot]
d589130634
build(deps): bump serde from 1.0.145 to 1.0.147
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.145 to 1.0.147.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.145...v1.0.147 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:54:26 +03:00
dependabot[bot]
3c7e9235f6
build(deps): bump futures from 0.3.24 to 0.3.25
...
Bumps [futures](https://github.com/rust-lang/futures-rs ) from 0.3.24 to 0.3.25.
- [Release notes](https://github.com/rust-lang/futures-rs/releases )
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.24...0.3.25 )
---
updated-dependencies:
- dependency-name: futures
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:19:27 +03:00
dependabot[bot]
c9f5524748
build(deps): bump clap from 4.0.15 to 4.0.18
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.15 to 4.0.18.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.15...v4.0.18 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:00:26 +03:00
dependabot[bot]
6cedd3c04d
build(deps): bump syn from 1.0.102 to 1.0.103
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.102 to 1.0.103.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.102...1.0.103 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 01:14:33 +02:00
Aaron Hill
7dcb333991
avm2: Remove dead code from MovieClip constructor
...
The call to `super_init` will initialize a `DisplayObject` (if unset)
in the `Sprite` constructor, using exactly the same logic that we're
attempting to use. The code in `MovieClip` is unreachable, and can
be deleted.
2022-10-24 11:46:20 -05:00
DragonGamesStudios
84f3739ece
core: Fixed a typo in messages on pressing Ctrl+Alt+D ( #8360 )
2022-10-23 16:44:33 +03:00
Aaron Hill
919b38f20b
avm2: Stub Graphics.beginGradientFill
2022-10-22 17:58:13 -05:00
Aaron Hill
9dd0914bda
core: Add root movie URL spoofing (desktop only).
...
The desktop player now takes a `--spoof-url` argument, which overrides
the movie URL provided to ActionScript. This does not affect non-root
movies loaded through `Loader`.
2022-10-22 15:24:14 -05:00
Adrian Wielgosik
7ccf7a4c69
avm2: Add missing set_object2 impl to Bitmap
2022-10-22 19:42:24 +02:00
Aaron Hill
4cb122461e
avm2: Implement DisplayObject.cacheAsBitmap
...
The underlying flag currently does nothing, but this allows
SWFs to continue executing.
2022-10-20 18:37:35 -05:00
David Wendt
058a7a8b66
desktop: Allow specifying the load behavior for desktop
2022-10-18 16:47:49 -06:00
David Wendt
74d77a3df0
core: Add a player setting for if movies are allowed to execute before loading finishes
2022-10-18 16:47:49 -06:00
dependabot[bot]
71a4f569af
build(deps): bump proc-macro2 from 1.0.46 to 1.0.47
...
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2 ) from 1.0.46 to 1.0.47.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.46...1.0.47 )
---
updated-dependencies:
- dependency-name: proc-macro2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-18 07:28:01 +03:00
Adrian Wielgosik
bdc041677a
render: Bail on attempts on panicking recursive render, part 2.
2022-10-17 18:02:21 -05:00
Aaron Hill
45515be0a3
render: Improve support for BitmapData.draw
...
This PR fixes a numbe of interconnected bugs:
* We weren't consistently uploading a dirty BitmapData to the render
backend before drawing to/from it.
* BitmapData.draw should *not* add a fill color - it should draw over
the current contents of the BitmapData
* After drawing to a non-transparent BitmapData, we need to manually
set the opacity back to 255 for each pixel (the drawing process
takes transparency into account, but the opacity information is
thrown away at the end).
2022-10-17 12:53:38 -05:00
relrelb
86ef4bd7fe
core: Simplify `Bitmap` creation
...
Change `Bitmap::new()` to accept a `ruffle_render::bitmap::Bitmap`
directly, instead of `width`, `height` and `bitmap_handle`. As a
consequence, all `RenderBackend::register_bitmap_*` methods are no
longer necessary - we can use `ruffle_redner::utils::*` to obtain
a `ruffle_render::bitmap::Bitmap` right before calling `Bitmap::new()`.
2022-10-17 20:05:30 +03:00
David Wendt
36844e5e2f
chore: Use explicit `.clamp`
...
Also, update the tests to confirm that this doesn't break NaN handling.
2022-10-16 14:55:07 -06:00
David Wendt
10ad603566
avm1: Implement `TextField.antiAliasType`, `.gridFitType`, `.sharpness`, and `.thickness`.
...
Notably this required removing a few parameter checks from core that turned out to be AS3-only.
2022-10-16 14:55:07 -06:00
David Wendt
7155f88601
avm2: Implement `TextField.antiAliasType`, `.gridFitType`, `.sharpness`, and `.thickness`.
2022-10-16 14:55:07 -06:00
David Wendt
b8693a3932
core: Retain Advanced render settings in Normal mode, even though they won't be used there.
2022-10-16 14:55:07 -06:00
relrelb
760f9e29df
avm1: Migrate `BevelFilter` to `NativeObject`
2022-10-16 11:48:59 +03:00
relrelb
1cbc906b04
avm1: Migrate `BlurFilter` to `NativeObject`
2022-10-15 16:00:30 +03:00
relrelb
178bf4fe24
chore: Extract Cargo `edition` to `[workspace.package]`
...
This is possible since Rust 1.64.0: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds
2022-10-14 22:13:29 +03:00
relrelb
dbfd28e708
web: Bump `wasm-bindgen` to 0.2.83
...
This restores commit 084b252030
.
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
2022-10-14 21:49:40 +03:00
David Wendt
81ed624c26
avm2: Loaders should not be opaque to mouse events.
2022-10-14 12:27:31 -05:00
Tal Hayon
052ec75e2a
avm2: BitmapData.perlinNoise and DisplacementMapFilter
2022-10-14 11:22:26 -05:00
relrelb
bc73301592
avm1: Require some more prototypes
...
Since they are never `None`.
2022-10-14 00:23:12 +03:00
Aaron Hill
feda41d6c1
avm2: Add LoaderInfo.uncaughtErrorEvents
...
We don't currently fire any events, but we store the object
so that listeners will be correctly registered.
2022-10-12 17:26:14 -05:00
relrelb
967ff56e3b
avm1: Rewrite `Date` implementation
...
The new implementation is simpler, and supports many AVM1 quirks not
supported before.
In addition, migrate `Date` to `NativeObject`.
2022-10-13 00:49:50 +03:00
relrelb
21e24936b7
avm1: Correct `Number.toString` edge-case
...
`NaN` and large numbers are actually treated like `i32::MIN`. As described
in https://github.com/ruffle-rs/ruffle/issues/7772#issuecomment-1235977709 ,
Flash (at least 7+) fails to convert `i32::MIN` to a string due to a bug.
Since `i32::MIN` has no `i32` positive counterpart, digits extracted using
modulo are actually negative and characters before ASCII `'0'` are selected.
Flash 6- somehow return just `0` in those cases. This was Ruffle's behavior
up until this commit. This commit matches Ruffle behavior to latest Flash
Player, as we usually prefer. A `TODO` is still there in case we ever add
player version emulation.
2022-10-13 00:05:25 +03:00
relrelb
f504804379
avm1: Require `fn_proto` in `FunctionObject::bare_function`
...
It was never `None`, except for 3 tests in `script_object.rs`,
which now use `activation.context.avm1.prototypes().function`.
2022-10-12 21:01:18 +03:00
dependabot[bot]
76f18cbc37
build(deps): bump clap from 4.0.9 to 4.0.12
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.9 to 4.0.12.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.9...v4.0.12 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 00:32:53 +03:00
dependabot[bot]
bdd7c27965
build(deps): bump syn from 1.0.101 to 1.0.102
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.101 to 1.0.102.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.101...1.0.102 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-10 23:42:49 +03:00
EmperorBale
d72ef587f2
avm2: Add digest property to URLRequest
2022-10-10 12:48:35 -07:00
EmperorBale
5c9bf3ffc0
swf: Support SWZ files
2022-10-10 12:48:35 -07:00
Adrian Wielgosik
10c19fef57
render: Bail on attempts on panicking recursive render. ( #8248 )
2022-10-09 14:33:57 -05:00
relrelb
bf0ace0b88
chore: Appease clippy
2022-10-09 13:46:28 +05:45
relrelb
5c94714363
avm2: Port `flash.ui.Keyboard` to ActionScript
2022-10-07 12:27:56 +03:00
David Wendt
23b5eb6d72
avm2: Implement `BitmapData.clone`.
2022-10-07 01:41:48 -05:00
David Wendt
1b0d23e569
core: Don't desync on frames with no audio blocks.
...
Fixes regression caused by me in 85cf383c84
2022-10-06 21:41:59 -06:00
Tal Hayon
a8b96b676a
avm2: Add More BitMapData methods
...
This also fixes a small bug in copyChannels
2022-10-06 18:53:06 -06:00
Aaron Hill
4b2907ead5
avm2: Fix 'hasDefinition' and 'getDefinition' for ApplicationDomain
...
These methods were incorrectly treating the argument as a local name,
instead of a qualified name. Additionally, 'getDefinition' now throws
an AVM error.
2022-10-05 16:45:29 -05:00
relrelb
a9dedf759a
chore: Fix `clap` update
...
As described in https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#400---2022-09-28 .
2022-10-05 21:33:34 +03:00
dependabot[bot]
32a370f803
build(deps): bump clap from 3.2.20 to 4.0.9
...
Bumps [clap](https://github.com/clap-rs/clap ) from 3.2.20 to 4.0.9.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.20...v4.0.9 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-05 21:33:34 +03:00
Aaron Hill
9b055645d3
avm2: Support calling 'new Function()' objects
...
This appears to create a dummy function, which ignores all
of its arguments and always returned `undefined`
2022-10-05 08:57:12 -05:00
Adrian Wielgosik
4745a897eb
avm2: Add MovieClip::enabled
2022-10-04 20:14:09 +02:00
Adrian Wielgosik
0ac3341d57
avm2: Fix typing of add/removeChild methods
2022-10-04 19:51:26 +02:00
dependabot[bot]
ac93f9d295
build(deps): bump serde from 1.0.144 to 1.0.145
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.144 to 1.0.145.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.144...v1.0.145 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 16:17:36 +03:00
dependabot[bot]
0547155749
build(deps): bump proc-macro2 from 1.0.43 to 1.0.46
...
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2 ) from 1.0.43 to 1.0.46.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.43...1.0.46 )
---
updated-dependencies:
- dependency-name: proc-macro2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 14:14:35 +03:00
dependabot[bot]
356877c88e
build(deps): bump enumset from 1.0.11 to 1.0.12
...
Bumps [enumset](https://github.com/Lymia/enumset ) from 1.0.11 to 1.0.12.
- [Release notes](https://github.com/Lymia/enumset/releases )
- [Changelog](https://github.com/Lymia/enumset/blob/master/RELEASES.md )
- [Commits](https://github.com/Lymia/enumset/compare/v1.0.11...v1.0.12 )
---
updated-dependencies:
- dependency-name: enumset
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 12:52:47 +03:00
dependabot[bot]
dbac0ca420
build(deps): bump syn from 1.0.99 to 1.0.101
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.99 to 1.0.101.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.99...1.0.101 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 12:22:45 +03:00
David Wendt
7861dfff79
avm2: Stub `tabChildren`, `tabIndex`, and `tabEnabled`.
2022-10-04 01:06:25 -05:00
dependabot[bot]
a0ef304ae9
build(deps): bump smallvec from 1.9.0 to 1.10.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.9.0...v1.10.0 )
---
updated-dependencies:
- dependency-name: smallvec
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 01:44:21 +03:00
Aaron Hill
046ed2c0ba
avm2: Stub Graphics.beginBitmapFill
...
This is needed by Pixel Legions
2022-10-03 15:01:01 -05:00
Adrian Wielgosik
286755962f
avm2: Array push/unshift return new length, like Vector
2022-10-02 17:52:25 +02:00
Aaron Hill
8f72842b2f
avm2: Stub LocalConnection
2022-09-28 13:46:25 -05:00
dowgird
5ac4f4358d
avm2: Added flash.net.URLVariables
2022-09-27 13:43:30 -05:00
Aaron Hill
53f42e0bec
avm2: Fix getQualifiedClassName for null and undefined
2022-09-27 00:05:06 -05:00
nosamu
66fa67cdcc
Revert "avm1: Remove `Value::to_primitive_num`"
...
This reverts commit 2c50a04e37
.
2022-09-26 18:40:39 -05:00
Aaron Hill
f5b59f869c
avm2: Show native method names in stack trace
...
Previously, we would display an empty string for the method name.
We can now store a `&'static str` again in `NativeMethod`,
instead of needing a `Cow`
2022-09-26 14:13:48 -05:00
relrelb
65ecb4fe8f
avm2: Remove `From<Box<dyn std::error::Error>> for Error<'gc>`
2022-09-26 19:51:38 +03:00
relrelb
cc531ff7db
avm2: `playerglobal.swf` should be valid
2022-09-26 19:51:38 +03:00
relrelb
1f6368b946
avm2: Ignore `write!()` errors
...
As it cannot fail.
2022-09-26 19:51:38 +03:00
relrelb
e3e4aeb248
avm2: Throw `flash.errors.IOError` from `ByteArray`
...
Instead of propagating the underlying compression library errors.
Also, make `ByteArray.deflate` and `ByteArray.inflate` pure-ActionScript
methods that call into the native `ByteArray.compress` and `ByteArray.uncompress`
native methods, respectively.
2022-09-26 19:51:38 +03:00
relrelb
95de87ad0a
avm2: Throw `VerifyError` for invalid ABC files
2022-09-26 19:51:38 +03:00
relrelb
a894ec5ca8
avm2: JSON serialization cannot fail
2022-09-26 19:51:38 +03:00
relrelb
a8f869329e
web: Fix config with `serde-wasm-bindgen`
...
Since `serde-wasm-bindgen` doesn't support `#[serde(default)]` (https://github.com/cloudflare/serde-wasm-bindgen/issues/20 ),
we no longer able to deserialize a partial `Config` object. As a solution,
take care to pass a full object from the TypeScript side.
2022-09-26 17:23:32 +03:00
relrelb
c9ca7e2095
avm2: Port `flash.ui.Mouse` to ActionScript
2022-09-25 16:50:03 +03:00
relrelb
e1d01b0a5e
swf: Extract `Rectangle` to a separate file
...
And make it generic, as a first step towards making it a general-purpose
data structure for the whole codebase. Some potential replacements are:
* `BoundingBox` in `render/src/bounding_box.rs`.
* `BoxBounds` in `core/src/html/dimensions.rs`.
* Parameters to a bunch of `BitmapData` methods in
`core/src/bitmap/bitmap_data.rs`.
2022-09-25 10:37:56 +03:00
relrelb
898ccfba5d
avm1: Migrate `ColorTransform` to `NativeObject`
2022-09-25 02:43:53 +03:00
golfinq
ceb877c55f
avm2: Implement error types for avm2
2022-09-25 02:27:59 +03:00
dowgird
e448f5e027
avm2: implemented flash.utils.unescapeMultiByte
2022-09-25 01:19:11 +03:00
relrelb
c532d70844
avm2: Port `flash.net.ObjectEncoding` to ActionScript
...
Along with the `flash.net.IDynamicPropertyOutput` and `flash.net.IDynamicPropertyWriter`
interfaces.
2022-09-25 00:36:31 +03:00
EmperorBale
98edcc4dc0
avm2: Add non-debug version of ErrorObject::display_full
2022-09-24 22:29:55 +02:00
Aaron Hill
66df5ea3de
avm2: Implement typed 'catch' blocks
...
Now that we have a custom `Error` enum, this is very straightforwawrd.
I've converted `getDefinitionByName` return an AVM error, since this
is commonly used by games to test for a class.
2022-09-24 13:03:29 -05:00
relrelb
b5084eef25
Revert "web: Bump `wasm-bindgen` to 0.2.83"
...
This reverts commit 1954f6162f
.
2022-09-24 09:52:25 +03:00
Aaron Hill
b571b43375
avm2: Fix some `avm_debug!` calls.
...
These were debug-printing `Gc<Multiname>` instead of `Multiname`
2022-09-24 09:16:35 +03:00
Aaron Hill
7b0bc0fb74
avm2: Implement undocumented 'Function.length' property
...
This returns the function's parameter count, and is used by the Starling
framework to implement a custom event dispatcher.
2022-09-23 18:36:23 -05:00
Aaron Hill
25f176995a
avm2: Stub flash.ui.Multitouch
...
This is needed by Starling
2022-09-23 16:04:30 -05:00
kmeisthax
d09ea7514e
chore: Oops, I meant to clamp to total frames.
...
Pointed out by @n0samu
2022-09-23 11:45:52 -06:00
David Wendt
aca1c0fb50
avm1: Clamp `WaitForFrame` ops to the total frame count of the movie clip being tested.
2022-09-23 11:45:52 -06:00
relrelb
1954f6162f
web: Bump `wasm-bindgen` to 0.2.83
...
This reverts commit cf721d45f9
and restores
commit 084b252030
, this time without updating
`web-sys`, due to being coupled to `wgpu`.
2022-09-23 17:23:35 +03:00
relrelb
4828a9c5cf
avm1: Remove `get_` prefix from `ColorTransformObject` getters
...
To match Rust naming conventions.
2022-09-23 11:10:12 +03:00
relrelb
e7643c731b
core: `ColorTransform` cleanup
...
Main changes:
* Merge `ColorTransformParams` into `ColorTransformObject`, as it's only relevant for AVM1.
* Make `BitmapData::color_transform` work with a generic `ColorTransform`, which uses fixed-point
arithmetic.
Note that Ruffle still calculates color transforms slightly different from Flash. This is probably
caused by inaccuracy of the current `ColorTransformObject` to `ColorTransform` conversion and/or the
`ColorTransform` application logic itself. Since this requires further research, it'll be fixed in a
future PR.
2022-09-23 11:10:12 +03:00
EmperorBale
a17352a01a
avm2: Switch XML & XMLList to actionscript
2022-09-22 15:18:23 -07:00
EmperorBale
1cc765d675
avm2: Implement checkfilter opcode
2022-09-22 15:18:23 -07:00
EmperorBale
6dea1fa264
avm2: Implement TypeError
2022-09-22 15:18:23 -07:00
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
9d4ab37ef6
core: Replace consecutive `push`es with `extend`
...
This should be slightly more efficient.
2022-09-22 03:00:02 +03: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
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
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
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
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
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
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
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
dependabot[bot]
cf26158030
build(deps): bump url from 2.2.2 to 2.3.1
...
Bumps [url](https://github.com/servo/rust-url ) from 2.2.2 to 2.3.1.
- [Release notes](https://github.com/servo/rust-url/releases )
- [Commits](https://github.com/servo/rust-url/compare/v2.2.2...v2.3.1 )
---
updated-dependencies:
- dependency-name: url
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 09:42:27 +03:00
dependabot[bot]
69a43297df
build(deps): bump convert_case from 0.5.0 to 0.6.0
...
Bumps [convert_case](https://github.com/rutrum/convert-case ) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/rutrum/convert-case/releases )
- [Commits](https://github.com/rutrum/convert-case/commits )
---
updated-dependencies:
- dependency-name: convert_case
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 09:20:12 +03:00
dependabot[bot]
e86b3f0efb
build(deps): bump percent-encoding from 2.1.0 to 2.2.0
...
Bumps [percent-encoding](https://github.com/servo/rust-url ) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/servo/rust-url/releases )
- [Commits](https://github.com/servo/rust-url/compare/percent-encoding-v2.1.0...v2.2.0 )
---
updated-dependencies:
- dependency-name: percent-encoding
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 08:45:46 +03:00
Adrian Wielgosik
1c940009a1
avm2: Convert Capabilities, System to AS
2022-09-12 02:03:34 +02:00
TÖRÖK Attila
866f5c83c5
avm2: Add `flash.filters.BitmapFilterQuality`
2022-09-11 22:05:15 +02:00
Aaron Hill
fbcefc49dc
avm2: Fix "Property does not exist" error message
...
The `multiname` is now a `Gc`, so we need to dereference it
to get a useful Debug impl.
2022-09-11 11:34:52 -05:00
Aaron Hill
81a5f3f10a
core: Always check mergeAlpha in BitmapData.copyPixels
...
Previously, we would only use mergeAlpha if alphaBitmapData
and alphaPoint. However, mergeAlpha can be used even when
those parameters are null.
Some of the AVM1 argument handling was also incorrect - I've fixed
it, and extended the existing test with the output-based test
added for AVM2.
2022-09-11 11:12:09 -05:00
Aaron Hill
1d6b3b6f57
chore: Fix Clippy lints and allow `clippy::bool_to_int_with_if`
...
In several cases, the current code seems preferable to the
code required by `clippy::bool_to_int_with_if`. Let's suppress
this for now to get the build passing, and decide later if this
is something that we want to enable.
2022-09-11 13:31:46 +02:00
Nathan Adams
267ea0fd13
render: Introduced render commands, moved to a command list model instead of direct rendering
2022-09-11 09:07:53 +02:00
Aaron Hill
a638b0498e
core: Render Bitmap even if bitmap_data is None
...
We only need to access bitmap_data to check if we need to
update a dirty texture.
2022-09-11 07:06:11 +03:00
Aaron Hill
8370bc792d
core: Use correct background alpha in BitmapData.draw
...
Previously, we would always use a transparent background,
even if the BitmapData is not transparent. This would normally
be corrected on the next frame when we copied the pixels to the
CPU. However, if an SWF ran `BitmapData.draw` on every frame,
this would never be corrected.
2022-09-09 19:24:21 -05:00
Aaron Hill
5de21428f5
core: Update dirty BitmapData before rendering
...
We now have a `MutationContext` available, so this doesn't need
to be done in `run_frame`
2022-09-09 16:36:40 -07:00
Adrian Wielgosik
4421fbff6a
avm2: Convert all Qname::new(...).into() to Multiname::new() ( #7930 )
2022-09-09 23:33:30 +02:00
Aaron Hill
ca030169f7
avm2: Implement BitmapData.rect and stub BitmapData.applyFilter
...
These are the last BitmapData methods needed for Solarmax
(the victory screen after beating the last level now renders).
2022-09-09 13:05:13 -05:00
Aaron Hill
bb138d9082
avm2: Implement some of SharedObject
...
Our AVM2 `SharedObject` support is now *almost* equivalent
to our avm1 `SharedObject` support. We implement serialization
and deserialization for primitives, arrays, and `Object` instances
with local properties. We also implement serialization for `Date`,
but not `Xml` (since our AVM2 `Xml` class is just a stub at the moment).
This is enough to make 'This is the only level too' save level
progress to disk.
Currently, we always serialize to AMF3. When we implement
the `defaultObjectEncoding` and `objectEncoding`, we'll need
to adjust this.
2022-09-08 21:22:05 -05:00
Aaron Hill
c090fe30ad
core: Mark DisplayObject as non-removed when added to display list
...
An AVM2 movie can repeatedly remove and add a DisplayObject from/to
a parent. This was causing SolarMax to stop working after advancing
to the next level.
2022-09-08 18:19:25 -05:00
relrelb
7ec587355b
text: Store background and border colors as `swf::Color`
...
Instead of `u32`.
2022-09-08 08:44:50 +03:00
EmperorBale
ece4b9a76d
avm2: Small cleanup
2022-09-07 13:54:33 -07:00
EmperorBale
7da912bbb4
avm2: Only store stack traces if avm_debug is enabled
2022-09-07 13:54:33 -07:00
EmperorBale
a9d95b7d4e
core: Fix code generator creating invalid code
2022-09-07 13:54:33 -07:00
EmperorBale
53ae55ff6f
avm2: Improve stack trace output
2022-09-07 13:54:33 -07:00
EmperorBale
7fa19c2ea3
avm2: Store stack trace in Error objects
2022-09-07 13:54:33 -07:00
relrelb
e0aba46bb2
chore: Remove unused `image` dependency
...
This basically reverts #7254 for all `.toml` files, except for `wgpu`
where it's actually needed on both desktop and web.
2022-09-07 13:09:29 -07:00
Aaron Hill
7218146e04
avm2: Implement BitmapData.dispose
...
We now check if a BitmapData has been disposed by checking
for a zero width or height (which cannot happen otherwise).
As a result, we no longer need the 'disposed' field on the AVM1
BitmapData object.
2022-09-07 11:02:53 -07:00
Aaron Hill
b764c4f6c1
avm2: Implement BitmapData.fillRect and BitmapData.getPixel32
2022-09-07 12:29:49 -05:00
Mike Welsh
2ffbd8a1c7
core: Remove EditTextStaticData
2022-09-06 20:02:23 -07:00
Mike Welsh
459a19f146
core: Use bitflags for EditText
2022-09-06 20:02:23 -07:00
Mike Welsh
b1404edfdc
swf: Use bitflags for EditText
2022-09-06 20:02:23 -07:00
dowgird
53ed748a54
avm2: added flash.utils.escapeMultiByte
2022-09-06 19:44:48 -07:00
Mike Welsh
f438e2032f
avm1: Add is_streaming flag to Sound
...
`Sound.loadSound` with `isStreaming` of true causes any previously
playing audio on the same object to be stopped.
2022-09-06 19:04:16 -07:00
Mike Welsh
dec4e30655
avm2: Add SoundLoaderContext
2022-09-06 19:04:16 -07:00
Mike Welsh
e2f1f0174b
audio: Implement Mp3Decoder::seek_to_sample_frame
2022-09-06 19:04:16 -07:00
Mike Welsh
fe46d5046a
avm2: Implement Sound.load
2022-09-06 19:04:16 -07:00
Mike Welsh
4a04923d04
audio: Add mp3_metadata function
2022-09-06 19:04:16 -07:00
Mike Welsh
3137306975
audio: Support loading external MP3s
2022-09-06 19:04:16 -07:00
Aaron Hill
93607aa86e
avm2: Implement `BitmapData.draw` for `wgpu` backend ( #7254 )
...
* avm2: Implement `BitmapData.draw` for `wgpu` backend
This method requires us to have the ability to render directly to a
texture. Fortunately, the `wgpu` backend already supports this in
the form of `TextureTarget`. However, the rendering code required
some refactoring in order to avoid creating duplicate `wgpu` resources.
The current implementation blocks on copying the pixels back
from the GPU to the CPU, so that we can immediately set them in
the Ruffle `BitmapData`. This is likely very inefficient, but will
work for a first implementation.
In the future, we could explore allowing the CPU image data and GPU
texture to be out of sync, and only synchronized when explicitly
necessary (e.g. on `getPixel` or `setPixel` calls).
* Rename `with_offscreen_backend` to `render_offscreen` and use Bitmap
* Don't panic when backend doesn't implement `render_offscreen`
2022-09-06 16:38:48 -05:00
Aaron Hill
54bf3d25f8
avm2: Remove `GcCell` from `local_registers`
...
We already have `&mut self` available whenever we write to it,
and we never made use of the `Clone` impl. As far as I can tell,
we don't have any unimplemented features that would require a `GcCell`.
2022-09-05 20:47:50 -07:00
Aaron Hill
45960de7dc
avm2: Correctly implement DisplayObject.mask
...
The stub implementation was breaking code that relied on being
able to set a value for 'mask' and then retrieve it
(which used to work on a dynamic class like `MovieClip`).
2022-09-05 16:43:20 -07:00
dependabot[bot]
7f40b42131
build(deps): bump serde-xml-rs from 0.5.1 to 0.6.0
...
Bumps [serde-xml-rs](https://github.com/RReverser/serde-xml-rs ) from 0.5.1 to 0.6.0.
- [Release notes](https://github.com/RReverser/serde-xml-rs/releases )
- [Commits](https://github.com/RReverser/serde-xml-rs/compare/0.5.1...0.6.0 )
---
updated-dependencies:
- dependency-name: serde-xml-rs
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-05 16:27:37 -07:00
dependabot[bot]
aacc3c231a
build(deps): bump clap from 3.2.18 to 3.2.20
...
Bumps [clap](https://github.com/clap-rs/clap ) from 3.2.18 to 3.2.20.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/v3.2.20/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.18...v3.2.20 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-05 14:47:03 -07:00
onkrot
1e0b59dbad
avm2: Implement `String`.`localeCompare`, `search`, `toLocaleLowerCase`, `toLocaleUpperCase` methods.
2022-09-05 12:15:53 -07:00
=
2b3249c9a4
core: Made core no longer depend on software video decoders
2022-09-04 17:46:58 -07:00
=
f0013bdec8
video: Moved individual decoders to software video backend
2022-09-04 17:46:58 -07:00
=
bf242bfb09
video: Moved SoftwareVideoBackend to software decoder crate
2022-09-04 17:46:58 -07:00
=
7c839ef8ae
video: Add software video crate, moved VideoDecoder to it
2022-09-04 17:46:58 -07:00
=
8b12185d61
video: Moved NullVideoBackend from core to video
2022-09-04 17:46:58 -07:00
=
aff49cd891
video: Moved VideoBackend from core to video
2022-09-04 17:46:58 -07:00
=
7c464295e2
video: Moved VideoStreamHandle from core to video
2022-09-04 17:46:58 -07:00
=
fd7086adef
video: Moved EncodedFrame, DecodedFrame and FrameDependency from core to video
2022-09-04 17:46:58 -07:00
=
b7cf800f88
video: Made ruffle_video crate, moved core video Error to it
2022-09-04 17:46:58 -07:00
=
72da1535b7
core: Made video::Error not depend on invidiaul codecs
2022-09-04 17:46:58 -07:00
Adrian Wielgosik
acdb767862
avm2: Swap Multiname flags to bitflags
2022-09-04 16:56:32 -07:00
Adrian Wielgosik
782f670c39
avm2: Store uninitialized Multinames in txunit, behind Gc
2022-09-04 16:56:32 -07:00
Adrian Wielgosik
c28549ed9e
avm2: Store multi-namespaces behind Gc And single namespaces directly
2022-09-04 16:56:32 -07:00
EmperorBale
dd2bc1ea78
avm2: Add automatic linting for AS3 playerglobals
2022-09-04 16:33:35 -07:00
=
ce0752c225
avm1: Removed export of SystemPrototypes and SharedObject
2022-09-04 12:27:29 -07:00
=
6ed1dd5942
avm1: Replace avm1::AvmString with string::AvmString
2022-09-04 12:27:29 -07:00
=
ddaee950f8
avm1: Removed all public access into Avm1 modules, export only what's needed
2022-09-04 12:27:29 -07:00
=
7d7309d165
avm1: Moved start_drag from Avm1 root to activation module
2022-09-04 12:27:29 -07:00
=
f2c9ae7c50
avm1: Moved root_error_handler from avm1 root to runtime module
2022-09-04 12:27:29 -07:00
=
7645c84980
avm1: Moved skip_actions from avm1 root to runtime module
2022-09-04 12:27:29 -07:00
=
2d24ed539e
avm1: Moved Avm1 struct into its own file, fixing field access as needed
2022-09-04 12:27:29 -07:00
Adrian Wielgosik
9cf6f64d06
avm2: Guarantee that int+/-int makes an int
2022-09-04 08:57:18 +03:00
Adrian Wielgosik
cc6abab72f
avm2: Remove Value::Unsigned, add minimal implicit int->float conversion
2022-09-04 08:57:18 +03:00
TÖRÖK Attila
2b681e85b2
avm2: Remove unnecessary `extends Object` from some class stubs
...
As it's implicit.
2022-09-03 10:43:33 -07:00
TÖRÖK Attila
27b67d01d0
avm2: `Vector` -> `Vector.<Number>` in `ShaderEvent`
2022-09-03 10:43:33 -07:00
TÖRÖK Attila
92a2b6206e
avm2: Fix the stub for `Vector`
2022-09-03 10:43:33 -07:00
relrelb
32c55dda22
core: Avoid some clones of `Matrix` and `ColorTransform`
...
Change `set_matrix` and `set_color_transform` to accept owned structs,
instead of references. This allows callers that already have an owned
struct to pass it directly, thus saving an unnecessary borrow + clone.
This also aligns with other methods, such as `set_sound_transform`,
which currently accepts an owned struct.
2022-09-03 09:36:51 -07:00
TÖRÖK Attila
2e3fad9165
core: Log errors coming from timer callbacks
2022-09-02 22:22:03 -07:00
TÖRÖK Attila
89434d65e8
core: Don't panic when an error occurs in an AVM2 timer callback
2022-09-02 22:22:03 -07:00
TÖRÖK Attila
f75eee389a
core/mp3: More lenient MP3 buffer underrun detection
2022-09-02 20:38:24 -07:00
relrelb
fb39bb2b71
swf: Remove `Copy` from `Rectangle`
...
Use `.clone()` explicitly where needed.
2022-09-02 18:21:13 -07:00
relrelb
299da43c16
swf: Extract `ShapeFlag`
2022-09-02 18:21:13 -07:00
Aaron Hill
ae452d29b8
avm2: Stub DisplayObject.mask getter/setter
...
This allows the loaded ArmorGames API swf to run in
'This is the only level too'
2022-09-02 17:12:18 -07:00
relrelb
af006a3053
avm1: Introduce `NativeObject`
...
The existing `Object` enum representation is problematic for inherited
native objects, since "regular" `ScriptObject`s cannot be turned into
native objects, but rather a completely new native object needs to be
created. `TObject::create_bare_object` is an attempt to aid this
situation, but it works only for `ActionExtends` inheritance, and not
when the user manually wires up `prototype`/`__proto__` (#701 ).
In Flash, it seems like derived constructors initially have a "regular"
`this` object. But once the `super()` constructor is invoked, the same
`this` object becomes a native object.
To allow this in Ruffle, introduce a new `NativeObject` enum, and
store it as a member in `ScriptObject`. For a start, move `TextFormatObject`
from the `Object` enum to `NativeObject`. The plan is to gradually
move all `Object` enum variants to `NativeObject`, except for `ScriptObject`.
2022-09-02 16:41:27 -07:00
golfinq
08917b49cb
avm2: Add actionscript event classes
2022-09-02 14:35:01 -07:00
Aaron Hill
7a7ea87679
avm2: Implement Sprite.startDrag and Sprite.stopDrag
...
For now, I've left 'dropTarget' unimplemented - unlike in
AVM1, the drop target can be non-interactive objects like `Shape`,
so we'll need additional refactoring to implement it.
This allows 'This is the only level too' to be playable
2022-09-02 13:03:14 -07:00
relrelb
d2a463b08f
core: Remove unused parameter of `MovieClip::show_frame`
2022-09-02 10:42:09 -07:00
relrelb
16a1b7b832
swf: Remove `length` parameter of `read_frame_label`
...
Use `unwrap_or_default()` to optionally read a byte.
Also remove unused `context` parameter of `MovieClip::frame_label`.
2022-09-02 10:42:09 -07:00
relrelb
9ec3137891
swf: Remove `tag_length` parameter of `read_define_button_cxform`
...
It was not needed since `Reader` accounts for it internally.
2022-09-02 10:42:09 -07:00
relrelb
3da3567365
core: Avoid some allocations on JPEG tags
...
Read a slice instead of allocating a new `Vec`.
2022-09-02 10:42:09 -07:00
relrelb
cc166439d8
avm2: `Activation::is_of_type` is infallible
2022-09-02 10:10:40 -07:00
relrelb
ce5bf557f5
avm2: `ExternalValue::from_avm2` is infallible
2022-09-02 10:10:40 -07:00
relrelb
c2e78ffead
chore: Appease clippy
...
Resolve 2 instances of `only_used_in_recursion`.
2022-09-02 10:10:40 -07:00
relrelb
0d6462cfab
render: Remove `gc-arena` dependency
...
It was only used to make structs `#[derive(gc_arena::Collect)]`, and
generally it doesn't make much sense that `render` needs to be GC-aware.
So instead annotate `render` fields in `core` with `#[collect(require_static)]`.
2022-09-02 09:49:18 -07:00
Aaron Hill
cc9e283191
avm2: Improve Debug impl for EventObject
2022-08-30 09:35:20 -05:00
Aaron Hill
1a7c5339a7
avm2: Implement DisplayObject.localToGlobal and DisplayObject.globalToLocal
...
While writing tests for these methods, I discovered and fixed some
issues with how 'scrollRect' interacted with 'dobj.transform.matrix'
2022-08-29 23:12:40 -05:00
relrelb
3645061910
core: Simplify `DisplayObjectContainer::highest_depth`
...
The `less_than` parameter remained just `Depth::MAX` since #7199 ,
which makes it useless. As such it can be removed.
2022-08-29 17:26:15 -06:00
Aaron Hill
e9697439de
avm2: Skip over holes during array enumeration
...
This brings us closer to matching the Flash Player
enumeration behavior. Unfortunately, the precise enumeration
order for ScriptObject properties depends on the precise
order in the internal avmplus hashmap. This order is deterministic,
but adding/removing a property effectively randomizes it. Hopefully
there aren't any SWFS that depend on the *exact* order.
2022-08-29 15:53:44 -07:00
dependabot[bot]
802de0e7d1
build(deps): bump futures from 0.3.23 to 0.3.24
...
Bumps [futures](https://github.com/rust-lang/futures-rs ) from 0.3.23 to 0.3.24.
- [Release notes](https://github.com/rust-lang/futures-rs/releases )
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.23...0.3.24 )
---
updated-dependencies:
- dependency-name: futures
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-29 23:38:43 +03:00
Toad06
c4e64c5e26
avm1: Function calls in SWF4 bump the version to 5
2022-08-29 02:17:09 -07:00
TÖRÖK Attila
e86efd5c63
avm2: Add flash.utils.[set|clear][Timeout|Interval](...)
2022-08-29 01:44:57 -07:00
relrelb
5c29da6707
avm1: Implement `MovieClip.scrollRect`
...
The core functionality and AVM2 bindings were implemented in #7739 .
2022-08-28 22:18:33 -07:00
=
f180183ec5
core: Add audio feature, made dasp optional
2022-08-28 21:10:05 -07:00
=
c6c22cebc9
core: Make nellymoser optional, enable on desktop and web
2022-08-28 21:10:05 -07:00
=
f5245d72da
core: Make core not use minimp3 by default - only desktop uses it
2022-08-28 21:10:05 -07:00
relrelb
81f803d77e
avm1: Remove `DisplayObject::prev_avm1_clip`
...
It is no longer needed.
2022-08-28 19:21:03 -06:00
relrelb
de6163569e
avm1: Simplify frame execution logic
...
Handle removed clips inline in `Avm1::run_frame`, such that
`DisplayObject::prev_avm1_clip` is no longer used. Thus it can be
removed in a follow-up commit.
2022-08-28 19:21:03 -06:00
relrelb
0b7d8ea007
avm1: Move frame lifecycle logic to `Avm1::run_frame`
...
This allows better encapsulation of AVM1.
2022-08-28 19:21:03 -06:00
Aaron Hill
397de91a2a
core: Do not run sounds on no-op goto.
...
When we run a 'goto' where the initial and target frame are the same,
we need to skip triggering any sounds in the target frame.
Some games like 'This is the only level too' rely on this behavior:
they repeatedly run 'movieClip.gotoAndStop(current_frame_id)',
where 'current_frame_id' is the id of a frame that starts playing
a sound. Without this change, the sound will restart every frame
intead of playing exactly once.
2022-08-28 18:55:29 -06:00
David Wendt
e353553835
core: When reporting errors in the AVM2 constructor from MovieClip, also report the name of the class being constructed.
2022-08-28 18:17:57 -06:00
David Wendt
4b9ee55b56
avm2: The failsafe for self-referencing class properties should allow the use of `null` and `undefined`.
2022-08-28 17:54:22 -06:00
Aaron Hill
ae8e5b2f33
avm2: Don't error when executing 'null as SomeType'
...
We previously used 'coerce_to_object', which produced
an error with `Value::Null`. Instead, we can just ues
`value.as_type_of`, which will correctly handle `null`
2022-08-28 16:33:15 -05:00
Aaron Hill
c531994b1c
avm2: Fire KeyboardEvent.KEY_UP and KeyboardEvent.KEY_DOWN
...
The 'charCode' and 'keyCode' properties are now implemented
on `KeyboardEvent`
The input injection code we use does not support keyboard events,
so we can't yet write a regression test for this. However,
both 'You need to burn the rope' and 'This is the Only Level TOO'
now properly handle keyboard events with this PR.
2022-08-28 14:15:57 -05:00
Aaron Hill
e3e0488ed4
avm2: Delete enumerant when property is deleted
2022-08-28 12:03:19 -05:00
Aaron Hill
1296121dc5
avm2: Make 'set_local_property_is_enumerable` infallible
...
We always returned `Ok(())`
2022-08-28 12:03:19 -05:00
EmperorBale
f8289b47d8
avm2: Implement call stack & stack traces ( #7564 )
...
* avm2: Implement call stack
* avm2: Class traits should have a special prefix
* avm2: Stack tracebacks should also contain error message
* avm2: Move method naming to Executable
* avm2: Handle getter and setter methods in tracebacks
* chore: Formatting
* chore: Add comments
* avm2: Make full_name write to a string, instead of creating a new one
* core: Make GcArena publicly accessible
* core: Add Deref impl for Either type
* desktop: Add AVM2 call stack to panic message
* avm2: Prefix native methods with a `/`
* chore: Appease clippy
* avm2: Check if method actually contains bytecode instead of unwrapping
* web: Add AVM2 stack trace to panic message
* chore: Formatting
* chore: Clippy
* avm2: Fix stack traces for free standing functions
* core: Remove global data from context
* core: Rename GcGlobalData to GcCallstack
* core: Introduce StaticCallstack, make GcArena private again
Co-authored-by: Adrian Wielgosik <4729533+adrian17@users.noreply.github.com>
2022-08-28 18:30:20 +02:00
Aaron Hill
6a01fa93c5
avm2: Implement `String.toLowerCase` and `String.toUpperCase`
...
These are implemented in the same way as in AVM1. Testing
in Flash Player shows that the behavior is the same.
2022-08-28 01:32:53 -05:00
Aaron Hill
576c35a768
avm2: Declare 'Array.concat' as a public method
...
Previously, it was only declared in the AS3 namespace. However,
some SWFs look it up as a public method.
2022-08-27 20:20:19 -05:00
relrelb
2f106da04c
avm2: Port toplevel constants to ActionScript
...
Declare `NaN`, `Infinity` and `undefined` in ActionScript, similarly
to how `avmplus` does in its `actionscript.lang.as`.
Note that `null` is only removed, without an ActionScript declaration,
as it seems like `avmplus` neither declares it. Probably `null` is
only usable as a compile-time constant.
2022-08-26 15:45:36 -07:00
Callum Thomson
046514eeb9
avm1: Enumerate should push Undefined if the target isn't an object
2022-08-26 14:01:42 -07:00
Aaron Hill
249648674c
Fix bounds computation
2022-08-26 13:04:01 -07:00
Aaron Hill
5fb95e6961
Use round-to-even for scrollRect
2022-08-26 13:04:01 -07:00
Aaron Hill
fa0c843a4d
avm2: Implement DisplayObject.scrollRect
...
This property causes a DisplayObject to be both translated
and cropped.
2022-08-26 13:04:01 -07:00
relrelb
72d8c152b9
core: Make `Player::load_device_font` infallible
...
It is always called with the same known data, which should parse
successfully.
2022-08-26 12:24:15 -07:00
relrelb
ad84c2bbcb
avm2: Rename `Avm2::load_abc` to `Avm2::do_abc`
...
This aligns with the name of `DoAbc` tags.
2022-08-26 11:37:04 -07:00
relrelb
ad91992cb5
swf: Simplify `DoAbc` tag handling
...
Extract `swf::Reader::read_do_abc()` which, as the name suggests,
reads a `DoAbc` tag, and use it before calling to `Avm2::load_abc`.
Finally, introduce `DoAbcFlag` using `bitflags`.
This greatly simplifies the ABC loading code.
2022-08-26 11:37:04 -07:00
EmperorBale
18bd7879e5
core: Add better error message when java could not be found
2022-08-26 10:11:35 +02:00
Aaron Hill
c4157fd0ce
Miscellaneous stubs
...
This gets Solarmax to the main level select screen
(once BitmapData.draw support is added)
2022-08-25 19:57:03 -07:00
Aaron Hill
61d0f73fdb
core: Use catchup_display_object_to_frame in Loader
2022-08-25 19:24:56 -06:00
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
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