Commit Graph

4777 Commits

Author SHA1 Message Date
Aaron Hill c6eb25194e core: Bump flash-lso to latest commit
This deduplicates some dependencies, and removes
a future-incompat warning from `nom`.
2023-01-29 17:31:10 +01:00
Nathan Adams 85dc100ee9 avm2: Implement Sprite.dropTarget - though it's wrong right now 2023-01-29 00:52:52 +01:00
Daniel Jacobs 6697848b92 avm1: Don't ignore mouse_pick on static text (fix #9274) 2023-01-29 00:39:06 +01:00
Daniel Jacobs b00628f45d avm2: Add warning to MouseEvent.updateAfterEvent 2023-01-28 14:31:52 -06:00
Daniel Jacobs 65a0aaeb7b avm2: Stub MouseEvent.updateAfterEvent
Basically a direct copy of https://github.com/ruffle-rs/ruffle/pull/7653
2023-01-28 14:31:52 -06:00
Aaron Hill 7ba960987c core: Display class name in ErrorObject debug impl
This lets us know something about the type of error
that was thrown, and doesn't require an Activation/UpdateContext.
2023-01-24 20:38:45 -06:00
TÖRÖK Attila e77b1e379c core/audio: mp3: Use MpaReader instead of the deprecated Mp3Reader from Symphonia 2023-01-24 20:10:40 -06:00
renovate[bot] 8b6eef1715 fix(deps): update rust dependencies 2023-01-24 20:10:40 -06:00
Daniel Jacobs 0a04b22a79 avm2: Stub simple flash.text.engine enums 2023-01-23 13:51:26 -06:00
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