Commit Graph

4713 Commits

Author SHA1 Message Date
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