Commit Graph

707 Commits

Author SHA1 Message Date
Nathan Adams a550c877f6 tests: Update avm2/simplebutton_constr_params test to check the button on frame 2 2023-02-22 18:49:04 +01:00
Nathan Adams aef466f8f3 avm2: Implemented BitmapData.drawWithQuality 2023-02-22 17:36:55 +01:00
Lord-McSweeney 74640ed44e
tests: Remove ^M characters from Dictionary tests (#9656)
* Remove ^M characters from Dictionary test

Using Github's automatic line ending conversion to CRLF.

* Remove ^M characters from dictionary_delete test

* Remove ^M characters from dictionary_in test
2023-02-22 09:57:50 +02:00
nosamu 1e2ab9cd0e tests: Add new clipDepth test 2023-02-21 16:39:42 +02:00
EmperorBale fa6d01c505 tests: Extend `movielcip.gotoAndPlay` test 2023-02-17 18:46:43 -08:00
EmperorBale 46bd6bbee9 tests: Add test for scopechain resolution order 2023-02-18 01:37:12 +01:00
CUB3D f7b0c021a9 avm1: The this property should be mutable 2023-02-17 14:39:10 -06:00
Aaron Hill 4149913967
core: Introduce dedicated avm2 mouse picking logic (#9565)
The mouse picking behavior in AVM2 interacts in complicated
ways with `mouseEnabled` and `mouseChildren.` It's sufficiently
different from AVM1 that I decided to split the logic into separate
`mouse_pick_avm1` and `mouse_pick_avm2` methods.

The `mouseChildren` property is now fully implemented.
Additionally, the `click_block` tests now work correctly
under Ruffle.

Combined with the orphan-movie PR, this is enough to make
SteamBirds fully playable (though performance greatly degrades
over a course of a level).
2023-02-17 19:04:52 +00:00
TÖRÖK Attila c9864bbeb4 tests: Require the "mp3" feature of core as well, just to be sure. 2023-02-16 06:23:35 +01:00
TÖRÖK Attila 0e1bddff65 tests: Fix build when running from inside the `tests` folder. 2023-02-16 06:23:35 +01:00
Aaron Hill 4e25a4fcae avm1: Add ignored test for strange rewind behavior
Ruffle doesn't correctly remove certain objects from the stage
when processing an AVM1 rewind goto.
2023-02-15 15:21:29 -06:00
EmperorBale 1e12f2d49b tests: Add test for finddef opcode 2023-02-14 14:22:02 -08:00
TÖRÖK Attila 35e21ce51d tests: Add a regression test for SoundMixer.computeSpectrum() 2023-02-14 18:47:33 +01:00
TÖRÖK Attila 4d0fee0cf8 tests: Add TestAudioBackend, used only on request 2023-02-14 18:47:33 +01:00
Adrian Wielgosik 5eb887c628 avm2: Stub describeType to have .@name work 2023-02-13 23:55:00 +01:00
Aaron Hill a52a41de97 core: Fix stageX and stageY getters for MouseEvent
These getters were previously calling `local_to_global`
with the unused localX/localY coordinate set to 0. Howver,
`local_to_global` does a matrix multiplication, which in general
will depend on both the x and y values. This was causing the getters
to return incorrect results when any of the `transform.matrix` values
included a non-diagonal matrix.

We now call `local_to_transform` with the real `localX` and `localY`
values.
2023-02-13 21:19:20 +01:00
Aaron Hill c597f9f996 core: Fix Clippy lints on nightly 2023-02-13 03:38:54 +01:00
Bale 73e9fd55fb
avm2: Make sure scripts get initialized after all scripts have been loaded when lazy init is disabled (#9478)
* avm2: Initialize scripts **after** all scripts have been loaded

* tests: Add test for eager initialization
2023-02-11 00:38:38 +00:00
Aaron Hill 4b76d1b32a
core: Support using URLVariables as a POST request body (#9489)
This is needed by the Newgrounds API. We don't have the ability
to make fake requests to HTTP urls in our test frameworks,
so I haven't added any tests for this. However, I tested locally
that this allows the Newgrounds API to work (and got a medal
in Cloud Wars).
2023-02-11 00:18:10 +00:00
nosamu a2cd3ee06e tests: Update fills_and_lines expected image 2023-02-10 23:43:01 +01:00
golfinq 37ec94f95b Avm2: Implement Stage.invalidate 2023-02-08 17:47:21 -07:00
Adrian Wielgosik 61a5161a20 avm2: Convert most errors in get/set/initproperty to AVM errors 2023-02-07 18:50:15 -06:00
Adrian Wielgosik c844d2ab6f avm2: Only store actually-passed arguments to 'arguments' 2023-02-07 18:35:30 -06:00
Nathan Adams dff558170e avm2: Implement BitmapData.getPixels() 2023-02-07 19:10:25 +01:00
Nathan Adams 43d9c3deed avm2: Make sure SoundChannel.soundTransform always returns a value 2023-02-07 18:26:27 +01:00
Nathan Adams bc7773596b avm2: addFrameScript allows null to unset the script, and only allows one script per frame 2023-02-07 18:26:27 +01:00
CUB3D 48f4df51a5 avm1: Correct depth calculation for AVM1 clips pending removal and add tests 2023-02-06 10:53:45 -07:00
CUB3D 6b6e07c7cb test: Update unload fla 2023-02-06 10:53:45 -07:00
CUB3D 2d11a250da avm1: Retrieving the child of a container should prioritise lowest depth 2023-02-06 10:53:45 -07:00
CUB3D a356be15fe avm1: Only delay removals on AVM1, check for dynamic unload handlers 2023-02-06 10:53:45 -07:00
CUB3D 755425ebfa avm1: Delay clip removals when a child has an unload listener
When removing a clip, first check if it has an unload event listener somewhere
it's hierarchy.
If it does, enqueue the removal to happen on the next frame, by moving it to a negative depth.
2023-02-06 10:53:45 -07:00
Nathan Adams a220703618 core: Made PlayerBuilder take quality instead of setting it after the Player was made 2023-02-06 16:08:04 +01:00
Nathan Adams 1cb3ea7bf9 wgpu: Store quality, not sample_count, and calculate the correct sample count per format 2023-02-06 16:08:04 +01:00
Nathan Adams 00c7e8f634 avm2: Fixed bytearray compress/decompress methods setting position of resulting bytearray 2023-02-05 19:22:01 +01:00
Nathan Adams e73389aa71 wgpu: Implement blur filter 2023-02-05 18:41:43 +01:00
Nathan Adams 284a58c817 avm2: Implement BitmapData.apply_filter for ColorMatrixFilter 2023-02-05 18:41:43 +01:00
Nathan Adams 5e2f1a66eb tests: Enable tests that no longer need to be ignored 2023-02-04 15:26:45 -06:00
Nathan Adams 06361ce01d tests: Add overlay_onto_stage test to ensure blend buffers are cleared before use 2023-01-29 20:45:01 +01:00
Moulins e36b03bce9 core::html: correctly encode text in FormatSpans::to_html
Fixes issue #9327
2023-01-29 11:19:16 -06:00
CUB3D f829157deb avm1: Defining a local that already exists on the target of a with scope, defines it on the target not the parent 2023-01-29 18:05:25 +01:00
Nathan Adams 7b1c101c81 wgpu: Fix repeat & reflect gradients 2023-01-29 17:17:44 +01:00
Nathan Adams 85dc100ee9 avm2: Implement Sprite.dropTarget - though it's wrong right now 2023-01-29 00:52:52 +01:00
Nathan Adams d918d47f66 tests: Temporarily remove EditText from text_blocks_clicks as it's broken in ruffle atm 2023-01-29 00:39:06 +01:00
Nathan Adams 8108e64bfa tests: Add avm1 text_blocks_clicks test 2023-01-29 00:39:06 +01:00
Aaron Hill 184734267d tests: Deny unknown fields when deserializing test.toml files
This will catch typos and misplaced options when modifying tests.
2023-01-28 16:27:43 -06:00
Nathan Adams b14831417a tests: Added avm2 click_test test from #9287, ignored as it fails 2023-01-28 13:13:37 -07:00
Nathan Adams 666a55e503 tests: Added avm1 click_test test from #9287, ignored as it fails 2023-01-28 13:13:37 -07:00
Aaron Hill daeb132e53 tests: Handle trailing newlines more consistently
Previously, we would strip trailing newlines from the contents
of 'output.txt' files, and skip adding a trailing newline after
the final recorded `trace` call.

To reduce the amount of processing we do of expected/ruffle output,
and to make fpcompare tests easier, I've removed the special handling
of newlines. When recording `trace` calls, we now build up a single
large `String`, with a newline after every `trace` message. When
reading in an 'output.txt' file, we do not strip any newlines.

This required adding trailings newlines to lots of 'output.txt' files,
to match the behavior of Ruffle and Flash (the last 'trace' message
ends with a newline, just like every other 'trace' message).
2023-01-28 13:59:00 -06:00
Nathan Adams 48c9cdd5ad tests: Ported visual tests from ruffle-rs/visual-tests repo 2023-01-28 12:15:59 -07:00
Nathan Adams a6c6ae13fe tests: Adjust tolerance of existing image tests 2023-01-28 12:15:59 -07:00
Nathan Adams 051927775c tests: Clippy lint 2023-01-28 12:15:59 -07:00
Nathan Adams 9c4190b20b tests: Readd suffix to actual/difference files 2023-01-28 12:15:59 -07:00
Nathan Adams 67ec70d960 tests: Set default log filter to warn for wgpu 2023-01-28 12:15:59 -07:00
Nathan Adams cdb2c5fe04 tests: Allow image tolerance & max_outliers on image comparison tests. Changed all existing image tests to use 1 sample count since this changes them all anyway 2023-01-28 12:15:59 -07:00
Nathan Adams d70d9067ec tests: Fix clippy lints 2023-01-28 12:15:59 -07:00
Nathan Adams 4ef88eaaa0 tests: Fix imgchecks feature compiling 2023-01-28 12:15:59 -07:00
Nathan Adams c73aa5b9d5 tests: Add sample_count to render options 2023-01-28 12:15:59 -07:00
Nathan Adams cbe17c4455 tests: Filter early to avoid creating test info (and thus wgpu) for tests that won't run 2023-01-28 12:15:59 -07:00
Nathan Adams 9b43836d1d tests: Allow executing of with_renderer tests always, but image comparison is still gated 2023-01-28 12:15:59 -07:00
Nathan Adams 836468b6dd tests: Add player_options.with_renderer option, automatically set when image = true 2023-01-28 12:15:59 -07:00
Nathan Adams 6acf6009ef tests: Made PlayerOptions non optional (just empty default), and it works with a PlayerBuilder instead of a Player 2023-01-28 12:15:59 -07:00
Nathan Adams e614f788af tests: Refactor code so all testing goes through Test::test(), allows for approximations with custom hooks 2023-01-28 12:15:59 -07:00
Nathan Adams 8b02045c6b tests: Readd custom assert_eq 2023-01-28 12:15:59 -07:00
Nathan Adams a340318486 tests: Refactor runner methods to take in &Test and not direct values 2023-01-28 12:15:59 -07:00
Nathan Adams 56bc2b5051 tests: Added Test::should_run() 2023-01-28 12:15:59 -07:00
Nathan Adams dda8debadc tests: Move shared object tests to their own file 2023-01-28 12:15:59 -07:00
Nathan Adams 792d68d370 tests: Move TestLogBackend to runner 2023-01-28 12:15:59 -07:00
Nathan Adams 99da686822 tests: Move external interface tests to their own file 2023-01-28 12:15:59 -07:00
Nathan Adams ccc7c0a424 tests: Move ExternalInterfaceTestProvider to its own mod 2023-01-28 12:15:59 -07:00
Nathan Adams c5ab440083 tests: Move run_test(test) to Test::run() 2023-01-28 12:15:59 -07:00
Nathan Adams 6384034e47 tests: Move test_swf_with_hooks to util/runner 2023-01-28 12:15:59 -07:00
Nathan Adams ce8cb9501b tests: Move test_swf_approx to util/runner 2023-01-28 12:15:59 -07:00
Nathan Adams 818897b74e tests: Move run_swf to util/runner 2023-01-28 12:15:59 -07:00
Nathan Adams 4418431bfe tests: Move assert_eq to utils 2023-01-28 12:15:59 -07:00
Nathan Adams a741f373b4 tests: Take in a &Path for various paths 2023-01-28 12:15:59 -07:00
Nathan Adams 83af3e6b4e tests: Extract Test struct that contains all the info for a test 2023-01-28 12:15:59 -07:00
Nathan Adams ff8506d351 tests: Extract TestOptions::read() for parsing a file 2023-01-28 12:15:59 -07:00
Nathan Adams 316df5b415 tests: Extract TestOptions into its own file 2023-01-28 12:15:59 -07:00
Nathan Adams 7d234956eb tests: Move tests away from giant macro to individual test.toml files that describe the test 2023-01-27 13:53:43 +01:00
Aaron Hill 6fe7af58d5 Move back to upstream wgpu repository
We're relying on unreleased changes, so we depend on the latest commit
from their repository.
2023-01-23 11:31:04 +01:00
EmperorBale 954a7513f8 tests: Update date tests 2023-01-16 21:48:00 +01:00
Nathan Adams 8db8e4669a wgpu: Implement Multiply blend mode as a trivial blend 2023-01-12 10:54:03 -05:00
Nathan Adams 09608c2abc wgpu: Implement Screen blend mode as a trivial blend 2023-01-12 10:54:03 -05:00
dependabot[bot] b7986406a8 build(deps): bump regex from 1.7.0 to 1.7.1
Bumps [regex](https://github.com/rust-lang/regex) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.7.0...1.7.1)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-12 14:27:19 +02:00
MrCheeze d1b01c9db7 tests: Update AVM2 currentLabels test for case insensitivity 2023-01-10 11:28:56 -05:00
CUB3D ea6ea8074a tests: Add tests for BitmapData.threshold, fix issues found as a result 2023-01-10 13:59:06 +01:00
MrCheeze c2ad376e2c tests: Add test for AVM2 hitTestPoint (without shapeFlag) and hitTestObject.
This is a port of a similar regression test written for AVM1.
AVM1 also has a test for hitTestPoint with shapeFlag=true, but it can't
be ported for now, because the implementation of AVM2 hit testing is not
yet accurate enough for it.
2023-01-10 12:53:20 +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
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
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
Nathan Adams c6045a4f24 wgpu: Multiply can't be trivial blend mode because of 0 alpha 2023-01-03 03:39:13 +01:00
Nathan Adams df8ead3f96 tests: New multiply blend mode image 2023-01-03 03:39:13 +01:00
Nathan Adams 81f4741300 wgpu: Default msaa on mobiles to 2x, same as webgl backend 2023-01-03 03:39:13 +01:00
Nathan Adams 864f404f2f tests: Add blendmode visual tests 2023-01-03 03:39:13 +01:00
Nathan Adams 45339e037e tests: Added new output of bitmapdata_draw tests for github agents. Seems visually identical. 2023-01-03 03:39:13 +01:00
EmperorBale 0e2fbe4cf7 tests: Update date tests 2023-01-02 11:43:03 -08:00
EmperorBale 8b9bae8ca6 tests: Add test for LoaderContext.applicationDomain 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 54bae0265b tests: `instantiation_on_enterframe_gotoandstop` is missing a line of output 2022-12-27 20:15:49 -07:00
David Wendt 534f1cf06c tests: Adrian's tests look like they want 2 frames of execution 2022-12-27 20:15:49 -07:00
Adrian Wielgosik 825613ec8c tests: Add tests for various PlaceObject situations we didn't catch before.
There is no source as these SWFs were handmade in JPEXS.
2022-12-27 20:15:49 -07:00
dependabot[bot] c7ba2d4e87 build(deps): bump serde_json from 1.0.89 to 1.0.91
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.89 to 1.0.91.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.89...v1.0.91)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 08:35:32 +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
CUB3D acfb149316 tests: Add tests for button hittests, update hitTestPoint with onStage tests 2022-12-18 13:32:24 -07: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 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 bd9078addf chore: Fix `clippy::uninlined_format_args` lints 2022-12-15 08:59:38 +02: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
Adrian Wielgosik 7b64fcf5fa avm2: Fix indirect event dispatching 2022-12-06 00:44:17 +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
Adrian Wielgosik 0861153626 swf: make Clippy happy 2022-12-03 22:18: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
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
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
dependabot[bot] cf8217f2ff build(deps): bump serde_json from 1.0.87 to 1.0.88
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.87...v1.0.88)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 16:31:02 -07:00
David Wendt 4c0099c39c tests: Reduce the epsilons on `as3_edittext_getlinemetrics` and `gettextextent` to more reasonable values 2022-11-20 17:13:48 -07:00
David Wendt 728b198c9d tests: Re-run the `gettextextent` in an environment that actually sees Noto Sans as a system font. 2022-11-20 17:13:48 -07:00
David Wendt 51d8a196a4 tests: `gettextextent` should be an approx test.
Also, yes, `TextFormat.getTextExtent` returns a bare object.
2022-11-20 17:13:48 -07:00
David Wendt 6590f58efe tests: Make `edittext_getlinemetrics` an approximate test with a tolerance of a quarter pixel. 2022-11-20 17:13:48 -07:00
David Wendt 1952870ed1 tests: Include tests for empty newlines in the `as3_edittext_getlinemetrics` test. 2022-11-20 17:13:48 -07:00
David Wendt c0b6496b96 tests: Add tests for AVM1 `gettextextent` and AVM2 `TextField.getLineMetrics`. 2022-11-20 17:13:48 -07:00
dependabot[bot] 4c34fa361d build(deps): bump image from 0.24.4 to 0.24.5
Bumps [image](https://github.com/image-rs/image) from 0.24.4 to 0.24.5.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.24.4...v0.24.5)

---
updated-dependencies:
- dependency-name: image
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 08:12:38 +02:00
dependabot[bot] 8f214ff9a3 build(deps): bump regex from 1.6.0 to 1.7.0
Bumps [regex](https://github.com/rust-lang/regex) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.6.0...1.7.0)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-07 23:37:56 +02:00
dependabot[bot] 52f692c0e1 build(deps): bump env_logger from 0.9.1 to 0.9.3
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.9.1 to 0.9.3.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.9.1...v0.9.3)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-07 23:02:47 +02:00
Aaron Hill 68471723b3 core: Fix clippy format string lint 2022-10-27 08:49:39 +03:00
dependabot[bot] 01967e4865 build(deps): bump serde_json from 1.0.86 to 1.0.87
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.86 to 1.0.87.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.86...v1.0.87)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 10:59:40 +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
Aaron Hill d0230a2bea render: Add 'naga-agal' crate to compile AGAL shaders to Naga
This is the first part of the Stage3D implementation, and can
be reviewed independently.

Stage3D shaders use the Adobe Graphics Assembly Language (AGAL),
which is a binary shader format. It supports vertex attributes,
varying registers, program constants (uniforms), and texture sampling.

This PR only implements a few parts of AGAL:
* The 'mov' and 'm44' opcodes
* Vertex attributes, varying registers, program constants, and 'output'
 registers (position or color, depending on shader type)

This is sufficient to get a non-trivial Stage3D program
running (the rotating cube demo from the Adobe docs).

The output of `naga-agal` is a `naga::Module`. This can be passed
directly to wgpu, or compiled into a shader language using
a Naga backend (glsl, wgsl, SPIR-V, etc). The test suite
output WGSL files, and uses the 'insta' crate to compare against
saved files on disk.

Currently, the only real way to write AGAL bytecode is using
the Adobe-provided 'AGALMiniAssembler' flash class.
This class assembles the textual reprentation of AGAL into
the binary format.

To make writing tests easier, I've added a 'agal_compiler' test, which
can easily be modified to add more Agal textual assembly.
2022-10-17 13:22:02 -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
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 77dadd7844 tests: Test the default values for Normal antialiasing, too. 2022-10-16 14:55:07 -06:00
David Wendt ca8f9c1103 tests: Add tests for `TextField.antiAliasType` and related properties for AVM1 and AVM2. 2022-10-16 14:55:07 -06: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 183b8adbf0 wgpu: Bump to `0.14.0`
Also bump `raw-window-handle` to `0.5`, as now required.
2022-10-14 21:49:40 +03:00
relrelb 4b334ce03a tests: Rewrite `Date` tests 2022-10-13 01:06:17 +03:00
relrelb a59114d569 tests: Expand `primitive_type_globals`
Cover the now-correct `NaN.toString(x)` cases.
2022-10-13 00:05:25 +03:00
dependabot[bot] 1d3412cce0 build(deps): bump serde_json from 1.0.85 to 1.0.86
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.85 to 1.0.86.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.85...v1.0.86)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 01:29:10 +03:00
EmperorBale bbeea8715c tests: Add test for SWZ parsing 2022-10-10 12:48:35 -07:00
relrelb bf0ace0b88 chore: Appease clippy 2022-10-09 13:46:28 +05:45
David Wendt 066ca11cff tests: Add a test for AS3 `BitmapData.clone()` 2022-10-07 01:41:48 -05: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
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
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] fbba7744e7 build(deps): bump env_logger from 0.9.0 to 0.9.1
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.9.0 to 0.9.1.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.9.0...v0.9.1)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 02:47:48 +03:00
dependabot[bot] 103f384a08 build(deps): bump image from 0.24.3 to 0.24.4
Bumps [image](https://github.com/image-rs/image) from 0.24.3 to 0.24.4.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.24.3...v0.24.4)

---
updated-dependencies:
- dependency-name: image
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 00:49:25 +03: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
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
Aaron Hill dddc9e954a avm2: Add tests for looking up properties on Class objects 2022-09-25 15:37:50 -05: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
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
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
David Wendt 293d52048b chore: Don't ask me how this `s` got in the output file 2022-09-23 11:45:52 -06:00
David Wendt 5a9f0ea099 tests: Add a test for `WaitForFrame`'s clamping behavior. 2022-09-23 11:45:52 -06:00
EmperorBale bfaedcf321 tests: Add test for checkfilter opcode 2022-09-22 15:18:23 -07:00
EmperorBale e40229d90b tests: Add test for ByteArray.writeObject 2022-09-21 13:39:58 -07: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
EmperorBale e1eaa9770a avm2: Switch ByteArray to AS
avm2: Fix ByteArray

avm2: Implement ByteArray.defaultObjectEncoding

avm2: Rename ByteArray allocator
2022-09-17 12:31:43 -07:00
David Wendt f101160abc tests: Add a test for all `Stage.loaderInfo` properties that we weren't already testing for. 2022-09-17 12:32:15 -06:00
David Wendt eefe398f7c tests: `as3_bitmap_embedded` has a different stage size 2022-09-15 20:25:21 -06:00
David Wendt cf82a9d1c4 tests: Add a test for properties on Flex-style assets
We also re-enable the `bitmapdata_embedded` test now that we have a real renderer to work with.
2022-09-15 20:25:21 -06:00
David Wendt 2174c55d76 tests: Add a test for Flex-style image embeds. 2022-09-15 20:25:21 -06:00
David Wendt 613564baf7 tests: Adopt new expected images as the SWF stage size changed when I moved these tests to Flex/Flash Builder 2022-09-15 19:14:41 -06:00
David Wendt 0912ee4dff tests: Add an events test for `loadBytes` 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
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
Nathan Adams b2ecd39648 wgpu: Enable MSAA for offscreen textures 2022-09-11 09:07:53 +02:00
Nathan Adams c7f420dde5 wgpu: Moved WgpuRenderBackend into backend.rs 2022-09-11 09:07:53 +02: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 2f81f5814d render: Add `premultiplied_alpha` parameter for image capture
When rendering offscreen, we want the resulting image to use
premultiplied alpha, since the image will be stored in a texture.

However, when capturing an image in the exporter or test framework,
we want to use straight alpha, so that the resulting image can
be saved as a PNG.

Previously, we incorrectly used straight alpha everywhere, resulting
in incorrect output when using BitmapData.draw with transparency.
2022-09-09 15:46:48 -07: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 974738fe10 tests: Add BitmapData.copyPixels image test from PR #2488 2022-09-08 19:52:48 -05:00
EmperorBale 5791423d43 tests: Enable avm_debug for regression tests 2022-09-07 13:54:33 -07:00
EmperorBale a5c3c0cab5 tests: Add test for Error.getStackTrace 2022-09-07 13:54:33 -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
dowgird 53ed748a54 avm2: added flash.utils.escapeMultiByte 2022-09-06 19:44:48 -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 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] 9b37c072db build(deps): bump pretty_assertions from 1.2.1 to 1.3.0
Bumps [pretty_assertions](https://github.com/rust-pretty-assertions/rust-pretty-assertions) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/rust-pretty-assertions/rust-pretty-assertions/releases)
- [Changelog](https://github.com/rust-pretty-assertions/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-pretty-assertions/rust-pretty-assertions/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-05 23:30:37 +03:00
onkrot 1e0b59dbad avm2: Implement `String`.`localeCompare`, `search`, `toLocaleLowerCase`, `toLocaleUpperCase` methods. 2022-09-05 12:15:53 -07:00
Adrian Wielgosik 31780f15d8 tests: Add extra case to int_edge_cases test 2022-09-05 11:55:16 -07:00
= 91ae384682 tests: Removed software video impl for tests - it isn't used and adds a lot to compile time 2022-09-04 17:46:58 -07:00
Adrian Wielgosik 4707e4b6a8 tests: Add tests for int conversion edge cases 2022-09-04 08:57:18 +03:00
Mike Welsh c17da6e91a core: Fix some issues with `hitTest`
Fixes some issues with our winding # calculation which would cause
incorrect results for hitTest.

  * The convention for handling an intersection at endpoints was
    not the same between lines and bezier curves.
  * The bezier curve winding # function was not properly handling
    some cases where the curve was strictly y-monotonic.
  * Simplify the code a bit so that ray-curve intersections are
    returned in a consistent order based on upward/downward crossing.
2022-09-02 14:51:46 -07:00