Commit Graph

10682 Commits

Author SHA1 Message Date
Lord-McSweeney 20db9f8326
avm2: Implement XML.setName (#12979)
* avm2/tests: Implement XML.setName; add a test

* avm2: Basic support for QNames in XML.setName (no namespace support yet)

* avm2: Reorder order of Attribute/Element/PI checks in XML.setName

* avm2: Throw error #1117 when the name passed to XML.setName is not a valid XML name
2023-09-07 21:47:02 +02:00
Adrian Wielgosik 0e507e870d ci: Only run clippy on Linux 2023-09-07 18:51:00 +02:00
Adrian Wielgosik f1a8fa8840 ci: only save cache on master builds 2023-09-07 18:51:00 +02:00
sleepycatcoding 9c7eb90d69 avm2: Implement XML.prependChild 2023-09-07 01:13:16 +02:00
Kornelius Rohrschneider 53ba75d587 Move logarithmic volume transformation to AudioMixer
Previously, the volume transformation to adapt the volume for
logarithmic hearing has been performed in the VolumeControls Rust struct
and TypeScript class each.
Since this calculation is the same on desktop and web and should be
implemented in the audio backend, it has been moved into the
AudioMixer::mix_audio method.
The VolumeControls struct and class now only calculate the linear volume
out of the checkbox and the slider.
Player::set_volume and Player::volume now don't take and return the
adapted volume, but use the linear volume (which gets saved internally).
2023-09-07 00:51:58 +02:00
Kornelius Rohrschneider f04470247e web: Add web volume controls
The web version of Ruffle now has a volume controls window. It can be
accessed through the right-click menu (Right-click > Volume controls).
It contains a mute button and a slider from 0 to 100.

To achieve this, a new volume controls modal has been added to the
shadow template.
TypeScript is used to create texts, set the controls and add event
listeners to update the settings and controls when being changed.

The volume settings set in the GUI are saved in a new VolumeControls
class, which is also used to calculate the real volume (adapted for
logarithmic hearing) out of the entered volume and the mute checkbox.
As soon as the volume is changed in the GUI, the real volume will be set
in the Ruffle instance.

The existing ftl files have been adapted (and new ones have been
created) to include the new multilingual text in the right-click menu
and the volume controls window.

This closes #1771.
2023-09-07 00:51:58 +02:00
Kornelius Rohrschneider a550a998c3 desktop: Add desktop volume controls
The desktop version of Ruffle now has a volume controls window. It can
be accessed through the menu bar (Controls > Volume controls).
It contains a mute button and a slider from 0 to 100.

The volume settings set in the GUI are saved in a new VolumeControls
struct, which is also used to calculate the real volume (adapted for
logarithmic hearing) out of the entered volume and the mute checkbox.
As soon as the volume is changed in the GUI, the real volume will be set
in the player (if the player exists).

The player doesn't set its volume level according to the PlayerOptions
after its creation anymore. Instead, RuffleGui::on_player_created now
gets the player and sets its volume to the real volume set in the GUI.
The volume in the GUI itself defaults to the PlayerOptions value.
This also fixes the issue that the PlayerOptions volume has previously
not been adapted for logarithmic hearing.

The existing ftl files have been adapted (and new ones have been
created) to include the new multilingual text in the menu bar and the
volume controls window.
2023-09-07 00:51:58 +02:00
Crowdin Bot d195da59af chore: Update translations from Crowdin 2023-09-06 23:55:17 +02:00
Adrian Wielgosik c6bad73cb2 avm2: Use ArrayObject::empty() instead of array.construct() 2023-09-06 23:53:22 +02:00
Aaron Hill ee62044cad avm2: Implement avmplus.describeTypeJSON and use it for describeType
Some SWFS (in particular, anything using Unity) call
avmplus.describeTypeJSON, and rely on the behavior of the various
flags.

This PR changes our internal implementation to implement
describeTypeJSON (producing an `Object` with dynamic fields).
We then convert this to XML in `describeType`, using an implementation
inspired by avmplus.

The existing describeType tests are passing - in a follow-up PR,
I'll add tests for describeTypeJSON
2023-09-06 23:53:22 +02:00
Lord-McSweeney 2ccd45a2af avm2: Implement Array.insertAt 2023-09-06 23:03:57 +02:00
sleepycatcoding db60964e2b avm2: Bail early if character is smaller than range start 2023-09-06 23:01:34 +02:00
sleepycatcoding 936eb777e8 avm2: Implement isXMLName 2023-09-06 23:01:34 +02:00
Crowdin Bot 654799b1a9 chore: Update translations from Crowdin 2023-09-06 12:22:24 +02:00
Aaron Hill 62e9eb9d6f avm2: Remove unnecessary '&mut self' from Object methods 2023-09-05 17:30:28 -04:00
renovate[bot] dabc2d56b9 fix(deps): update rust dependencies 2023-09-04 10:25:24 +02:00
Crowdin Bot 2996f97578 chore: Update translations from Crowdin 2023-09-02 15:43:08 +02:00
renovate[bot] d14550e851 chore(deps): update node.js dependencies 2023-09-02 15:19:06 +02:00
renovate[bot] cbd0c89f9b chore(deps): update npm to v10 2023-09-02 15:10:07 +02:00
Lord-McSweeney 5edba670de tests: Add a test for using Shared Objects without a root movie 2023-08-31 19:58:53 -04:00
Lord-McSweeney c454faf064 avm2: SharedObject::get_local should use URL of root movie 2023-08-31 19:58:53 -04:00
Lord-McSweeney da402606e4 avm2: MovieClip::goto_frame should use the movie of the Abc method that called it 2023-08-31 19:58:53 -04:00
Lord-McSweeney 69cdb93d53 avm2: Store caller movie in Activation 2023-08-31 19:58:53 -04:00
Crowdin Bot cf9171cb78 chore: Update translations from Crowdin 2023-08-31 00:13:04 +02:00
Aaron Hill ccf42c3614 naga-pixelbender: Stub out Opcode::Loop
Some experimentation with Pixel Bender Studio shows
that Opcode::Loop has a 23-byte payload. I haven't tried to
figure out how to interpet the payload yet, but we can now
skip over the opcode instead of bailing out entirely.
2023-08-30 17:36:31 -04:00
Daniel Jacobs 7bef26d993 tests: Add test for avm2 Sound constructor with URLRequest parameter 2023-08-30 22:41:49 +02:00
Daniel Jacobs d2c68350c9 avm2: Fix context parameter retrieval for Sound.load 2023-08-30 22:12:33 +02:00
Aaron Hill 24d46e7daa avm2: Call Sound.load in constructor when passed a URLRequest 2023-08-30 21:02:41 +02:00
Abiel Deneke 0ed447b428 avm1: Set target clip to None if target is an undefined object
SetTarget currently sets the target clip to the base clip if the
target passed to tellTarget() is an undefined object. This causes
goto's to run on the base clip in Ruffle, when Adobe Flash Player
does not run the goto's at all.

Fixes #12389 and #12390
2023-08-29 01:23:52 +02:00
sleepycatcoding 4e6e28f78c avm2: Correct comment 2023-08-29 00:48:48 +02:00
sleepycatcoding 430c20dd66 avm2: Small cleanup 2023-08-29 00:48:48 +02:00
sleepycatcoding 49e3546379 chore: Appease Clippy 2023-08-29 00:48:48 +02:00
sleepycatcoding b60dd81d62 avm2: Remove parents from removed nodes 2023-08-29 00:48:48 +02:00
sleepycatcoding 80db9caf74 avm2: Implement XML.replace 2023-08-29 00:48:48 +02:00
sleepycatcoding b3af4320e7 avm2: Add deep_copy method to XmlListObject
Also changes existing AS3 copy method to use that instead.
Moved as other code needs to do the same operation.
2023-08-29 00:48:48 +02:00
sleepycatcoding fbaa02e295 avm2: Implement XML.insertChildAfter and XML.insertChildBefore 2023-08-29 00:48:48 +02:00
sleepycatcoding aa28e51a94 avm2: Add error 1118 2023-08-29 00:48:48 +02:00
sleepycatcoding 4671122dee avm2: Add a way to lookup E4XNode ancestors 2023-08-29 00:48:48 +02:00
TÖRÖK Attila 7dc70354bf tests: Exclude WARP from running acid_large, and allow acid_image and acid_gradient_* again 2023-08-28 21:24:01 +02:00
Aaron Hill 520045de46 wgpu: Disable Context3D.setRenderToTexture MSAA on WebGL
This is not supported under webgl, and results in a panic
"Tex storage 2D multisample is not supported" if we try to
do it.
2023-08-28 13:33:32 +02:00
renovate[bot] 4e75c3890a fix(deps): update rust dependencies 2023-08-28 07:39:35 +02:00
Aaron Hill 2f6f00179b avm2: Log an error when a symbol class lookup fails
This is almost guaranteed to cause problems, so it shouldn't
be a warning.
2023-08-27 21:15:34 -04:00
Aaron Hill 88acc96467 avm2: Fix XML/XMLDocument ignoreWhite handling for cdata
The ignoreWhite settings only affect text nodes, not cdata nodes.
Additionally, there should be no special case for empty text.
2023-08-27 20:28:20 -04:00
sleepycatcoding 33164d3f56 avm2: Preserve attribute flag when filling lazy multiname with QName
Fixes #12570
2023-08-27 19:40:00 -04:00
Aaron Hill 879dac347c avm2: Handle child being removing from `Loader`
`Loader` override `removeChild` and `removeChildAt` to try to prevent
user code from removing the loaded content child. However, this can be
bypassed by calling `otherContainer.addChild(loader.content)`, which
actually removes the child from the loader. Stealth Hunter 2 relies
on this behavior.

To make this work, `Loader.content` needs to go through
`contentLoaderInfo`, instead of relying on a child being present.
2023-08-27 19:13:45 -04:00
Nathan Adams 19ad492eaa avm2: Implement Graphics.cubicCurveTo and CUBIC_CURVE_TO 2023-08-27 20:17:43 +02:00
Nathan Adams eb2afb19c4 render: Add DrawCommand::CubicCurveTo 2023-08-27 20:17:43 +02:00
Nathan Adams 076977cc75 render: Rename DrawCommand::CurveTo to DrawCommand::QuadraticCurveTo 2023-08-27 20:17:43 +02:00
Aaron Hill 158beaffa5 wgpu: Bail out early when trying to set empty program constants
There's nothing to do in this case, and we want to avoid trying
to construct a `NonZeroU64` for the size.
2023-08-27 13:53:40 -04:00
TÖRÖK Attila d523be02e4 tests: Exclude WARP from running the acid_gradient_1 visual test ported from Shumway 2023-08-27 12:25:41 +02:00