Commit Graph

5482 Commits

Author SHA1 Message Date
iwannabethedev 1bd9f82496 core: Implements `BitmapData.pixelDissolve()` for AVM2.
The changes have automated tests for them.

The implementation has not been implemented or tested for AVM1 yet.
2023-05-21 01:47:06 +02:00
Aaron Hill ad77cb0209 core: Refactor Loader to properly load images
We now run all of the completion logic (including adding
the new DisplayObject as a child) in `Loader::movie_loader_complete`.
Previously, some of this logic was run from `Loader::preload_tick`,
which meant that loaded images did not have the logic run.

Also, `BitmapData` and `Bitmap` instances (with corresponding AVM2
objects) are now properly constructed for loaded images.
2023-05-20 18:35:10 -05:00
Toad06 b88e19ef6c avm1: Filter buttons that use a `keyPress` event 2023-05-21 01:13:26 +02:00
Aaron Hill 5d62ef90f2 wgpu: Use intermediate buffer for Context3DCommand::CopyBitmapToTexture
In a previous PR, I introduced an optimization that used
`copy_texture_to_texture` to copy directly from a BitmapData GPU
texture to a Stage3D GPU texture.

Unfortunately, this optimization is incorrect. A BitmapData GPU
texture can be modified at any time by normal AVM2 code - in
particular, in might be modified before we submit the encoded
`copy_texture_to_texture` command. This shows up in Sniper Team,
which re-uses BitmapData objects for multiple distinct textures.
The previous 'optimization' resulted in the wrong BitmapData contents
getting uploaded to a texture (since it was changed before the copy
command was submitted).
2023-05-20 17:38:26 -05:00
Aaron Hill 0864853d44 avm2: Allow passing `null` to `Context3D.setProgram`
This clears the vertex and fragment shader programs
(bringing the Context3D back to its initial state).
2023-05-20 16:23:03 -05:00
EmperorBale 53acdee979 avm2: Remove NOPMD comments 2023-05-20 13:59:12 -07:00
EmperorBale 78c8aa2a0d core: Remove linter code 2023-05-20 13:59:12 -07:00
Tom Schuster 2af58dc832 avm2: Support set on XMLList with a single child
XMLList with a single child should behave like an XML object.
2023-05-19 20:10:47 -05:00
Lord-McSweeney 0948bf7bbd avm2: Implement Capabilities.playerType and Capabilities.version (and mark the other Capabilities getters as stubs) 2023-05-19 16:54:46 -05:00
Aaron Hill 6025878aab avm2: Respect SKIP_INVISIBLE for DisplayObject
Previously, we allowed mouse picks of certain invisible
DisplayObjects, even when HitTestOptions::SKIP_INVISIBLE
was set.
2023-05-19 08:12:00 -05:00
Aaron Hill 5c68bceb7b avm2: Set 'bubbles' to 'false' for rollOut and rollOver events
This matches the Flash Player documentation. Since we were
manually traversing the displayobject hierarching when firing
the event, we ended up firing duplicate events to parents
because bubbling was enabled.
2023-05-18 19:01:55 -05:00
Aaron Hill 7004e98b23 avm2: Don't validate Context3DVertexBufferFormat when buffer is null
This matches Flash Player's behavior - some SWFS try to pass in 'null'
for both the buffer and format.
2023-05-18 15:14:29 -05:00
renovate[bot] f969bdce71 fix(deps): update wasm-bindgen 2023-05-17 06:44:50 +03:00
Aaron Hill 75569e1311 avm2: Throw error for invalid Stage3D back buffer size 2023-05-16 17:36:22 -05:00
Aaron Hill 12e815d383 core: Take 'self' instead of '&mut self' in `replace_with_movie` 2023-05-15 20:01:02 +03:00
renovate[bot] 5b26d1b2ee fix(deps): update wasm-bindgen 2023-05-15 10:00:49 +03:00
Lord-McSweeney b24fc7c07f avm2: Improve Shader stub 2023-05-15 09:40:43 +03:00
iwannabethedev d0f8061c85 core: documentation changes. 2023-05-15 00:51:54 +02:00
iwannabethedev 8c92cecb60 core: Add documentation to Color. 2023-05-15 00:51:54 +02:00
iwannabethedev 9de2abe8b8 core: Fix wrong color form used. 2023-05-15 00:51:54 +02:00
relrelb 4a26ceb14b render: Use `swf::Point<Twips>` in more places 2023-05-14 22:48:41 +03:00
relrelb 220f8cd1cf render: Use `swf::Point<Twips>` in `shape_hit_test()` 2023-05-14 22:48:41 +03:00
relrelb 598c8cde0e render: Use `swf::Point<Twips>` in `DrawCommand::CurveTo` 2023-05-14 22:48:41 +03:00
relrelb 544e445d2f render: Use `swf::Point<Twips>` in `DrawCommand::LineTo` 2023-05-14 22:48:41 +03:00
relrelb e5c7d70f3f render: Use `swf::Point<Twips>` in `DrawCommand::MoveTo` 2023-05-14 22:48:41 +03:00
Lord-McSweeney 3079ae30a5 avm2: Stub SharedObject.setProperty 2023-05-14 19:01:24 +03:00
Nathan Adams a9ba46594f chore: Updated translations from Crowdin 2023-05-14 13:31:32 +02:00
Lord-McSweeney 017a44084f avm2: nit: Provide error number (2025) in error message for validate_remove_operation 2023-05-13 21:30:47 +03:00
Aaron Hill 729d5a2c65 avm2: Don't overwrite existing entry in `export_class`
This makes the behavior consistent with `export_definition`
2023-05-13 11:15:54 +03:00
Aaron Hill 3c6820c6e1 avm2: Check length and copy vector in Matrix3D constructor 2023-05-13 11:00:31 +03:00
iwannabethedev 476ff4aeef core: Fix drawing on cpu with color transform.
Taken directly from this commit, credits to Dinnerbone:
9b76090e1f
2023-05-12 22:42:44 +02:00
Toad06 2e972b8f32 avm1: `button.useHandCursor` can hold any value 2023-05-12 01:13:28 +03:00
iwannabethedev 93450b28b0 avm2: Add 'static length' for most types. 2023-05-11 22:16:55 +02:00
relrelb 660acac427 swf: Use `PointDelta<Twips>` in `ShapeRecord` 2023-05-11 08:55:44 +03:00
relrelb b93a32af0f swf: Use `Point<Twips>` in `StyleChangeData::move_to`
No functionality change.
2023-05-11 08:55:44 +03:00
Aaron Hill e488cc9f7a wgpu: Allow unaligned writes to IndexBuffer3D
wgpu requires buffer copy sizes and offsets to be 4-byte aligned.
Unfortunately, ActionScript can perform 2-byte aligned uploads
into an IndexBuffer3D.

To support this, we now keep a copy of the IndexBuffer3D on the CPU.
When performing an upload to the buffer, we round the offset down
and the size up to the nearest 4-byte aligned value. The cpu buffer
is used to fill out the write with existing data, so that we don't
corrupt the contents of the GPU buffer.

To avoid introducing a new RefCell, I've changed IndexBuffer3D
to use a `Box` instead of an `Rc` to store the trait object.
This allows us to pass a mutable reference down to the backend.
2023-05-10 18:20:29 -05:00
Huw Pritchard b79b192a58 avm2: Implement PrintJobOptions 2023-05-09 20:51:44 -05:00
Nathan Adams fc96fdf1cc chore: Update translations from Crowdin 2023-05-10 00:29:13 +02:00
Nathan Adams fd5a7cdbc2 core: Rename text to core_text just to avoid confusion if used from another crate with its own text methods 2023-05-09 00:06:49 +02:00
Nathan Adams e6ea074a3f core: Made context menu items translatable 2023-05-09 00:06:49 +02:00
Nathan Adams 229c301e18 core: Add i18n module using Fluent 2023-05-09 00:06:49 +02:00
Aaron Hill 1908d85f65 avm2: Initialize `Object` instance vtable before other classes
Early class construction is tricky - `Object` defines properties
that need to get copied into subclass instance vtables, but `Class`
defines `prototype`, which needs to be copied into the *class* vtable
of `Object`.

To accomplish this, I've split out instance vtable initialization
into a separate `init_instance_vtable`. We call
`object_class.init_instance_vtable` before
`class_class.init_instance_vtable`, but do things in the opposite
order for `into_finished_class` (`class_class.into_finished_class` is
called before `object_class.into_finished_class`)
2023-05-07 07:46:30 -05:00
iwannabethedev 724df48186 avm2: Add AS 'length()' to XML. 2023-05-06 12:02:06 -05:00
Lord-McSweeney 4b9430c2cb avm2: Stub flash.system.fscommand 2023-05-06 09:52:30 +03:00
Toad06 8377fe0233 web: Support copying to clipboard 2023-05-05 21:58:41 +02:00
nosamu 0633b4cdfe core: Improve compatibility rule for Kongregate 2023-05-05 10:44:57 +03:00
friedkeenan bfe84c3685 Rename 'name_array' to 'name_vector'.
The '_array' suffix was from a previous iteration as I tried to figure out how to return a vector.
2023-05-04 19:51:04 -05:00
friedkeenan 24e0e0102c avm2: Implement ApplicationDomain::getQualifiedDefinitionNames 2023-05-04 19:51:04 -05:00
Tom Schuster f6c0685992 avm2: Allow setting XML methods as properties 2023-05-04 19:34:14 -05:00
Lord-McSweeney f78ce82f90
avm2: Socket should implement IDataOutput and IDataInput 2023-05-05 00:13:45 +03:00