Commit Graph

8580 Commits

Author SHA1 Message Date
Tom Schuster f53c83cfa4 Partly implement XML child and elements
This makes #3294 (rollercoaster-creator-2) fully playable.

Missing is any (*) matching for child()/elements() and the existing attributes() method.
Also missing is support for number indexes with child().
2023-03-12 18:06:13 -05:00
TÖRÖK Attila ea3fdfa27e tests: Add a visual test for gradient focal point clamping 2023-03-12 23:54:59 +01:00
TÖRÖK Attila 109e151fa6 render/all: Clamp gradient focal point to be between -/+0.98 2023-03-12 23:54:59 +01:00
Oleksandr Kalko 1b3f23a750 chore: Upgrade Node.js dependencies 2023-03-12 23:36:09 +01:00
TÖRÖK Attila 0f7c362069 wgpu: Update to wgpu 0.15.1, naga 0.11.0, and naga_oil 0.5.0 2023-03-12 16:30:13 -05:00
TÖRÖK Attila 7d3a2d14b7 render/wgpu: Delete the now unused buffer bug detection shader 2023-03-12 15:53:16 -05:00
Jay Sackwild 1deebc87e8
Support click events on movie clips containing text fields (#9995)
Remove code that prevents click events from working on text fields within movie clips
2023-03-11 22:19:48 +00:00
TÖRÖK Attila 3a8ee003e4 web/audio: Make buffer size adaptive 2023-03-11 22:34:54 +01:00
TÖRÖK Attila b87fe2d335 tests: Add visual tests for basic video decoding and color conversion
Including source files and notes on how the SWFs were made.
2023-03-11 21:32:18 +01:00
TÖRÖK Attila b661e16927 tests: Add `with_video` option to build video decoders into the visual test runner 2023-03-11 21:32:18 +01:00
Lord-McSweeney 120f24b2ba avm2: Implement flash.text.CSMSettings 2023-03-11 12:27:28 -06:00
Marty_SVK 8668d83ea6 progresses Resort Empire
now it is blocked by unimplemented BitmapData.threshold
2023-03-11 15:41:46 +01:00
nosamu be153b2417 avm2: Stub Stage.fullScreenWidth and fullScreenHeight 2023-03-11 15:02:03 +01:00
Oleksandr Kalko e16ff7d677 web: Remove `stylelint-config-prettier` package
From package npm page:

> As of Stylelint v15 all style-related rules have been deprecated. If you are using v15 or higher and are not making use of these deprecated rules, this plugin is no longer necessary.

Stylelint was upgraded to 15.0.0 on 68078dc commit
2023-03-11 13:34:14 +01:00
TÖRÖK Attila 65dc3dd6a5 chore: Run cargo update 2023-03-11 13:15:23 +01:00
TÖRÖK Attila 8f9d639e96 chore: Bump h263-rs to current master 2023-03-11 13:15:23 +01:00
Aaron Hill 7b932ca84b avm2: Implement special XML/XMLList method calling behavior
When an XML object has simple content, you can call non-XML
methods directly on it - it will internally be stringified,
and the method will be called on the resulting string.
This lets `new XML("<p>Some content</p>".split(' ')` work.

Similarly, an XMLList object with a single XML child will
forward non-XML method calls to that object.

This PR implements this logic (based heavily on avmplus)
2023-03-11 00:51:45 -06:00
Aaron Hill a8198c0fab avm2: Remove `run_frame_avm2` and FramePhase::Update
These were unused for all AVM2 objects.
I've renamed the `run_frame` method to `run_frame_avm1`,
as it's only used for AVM1-specific logic.
2023-03-10 19:37:19 -07:00
David Wendt 6fd6279344 web: Fix copy-pasted code that breaks in sign_xpi.js 2023-03-10 18:09:58 -07:00
David Wendt f4354a638e web: Remove the find-the-version-ID extra step and use the version number directly
Mozilla actually added this feature in the middle of me building out this PR. How handy!
2023-03-10 16:38:01 -07:00
David Wendt e276b8cedb web: Since we don't get version IDs for newly-submitted extensions, search the Mozilla API for the given version instead. 2023-03-10 16:38:01 -07:00
David Wendt a39036102d web: First attempt at hacking in source code upload to Mozilla's signing tool.
We're abusing their v4 API implementation to make v5 API requests, which might not work; hopefully the authentication scheme is the same.

Furthermore, I'm assuming that the v4 sign response gives you a version ID that is valid for v5 `/addons/addon` requests.
2023-03-10 16:38:01 -07:00
Aaron Hill 80b98a055e avm2: Stub NetConnection and Responder
These are needed for BTD5
2023-03-10 16:58:15 -06:00
Lord-McSweeney 522e781e3c avm2: Fix stub types for Font 2023-03-10 20:55:54 +01:00
Aaron Hill 8c91c734c3 core: Only apply 'unload' and 'removed' logic to AVM1
I've also renamed these methods to 'avm1_unload' and
'avm1_removed', to make it clear that they don't
apply to AVM2.

This was causing us to incorrectly skip mouse picks,
and remove masks.
2023-03-09 12:34:16 -06:00
Aaron Hill fc223e959b avm2: Implement avmplus.getQualifiedClassName
This appears to be the same function as
'flash.utils.getQualifiedClassName'
2023-03-08 16:59:40 -06:00
Aaron Hill 8ac64289b3 avm2: Handle coercing to a class while it's being initialized
I think this might have been broken by
https://github.com/ruffle-rs/ruffle/pull/9506, but we didn't have
proper test coverage.

If we execute a 'coerce' opcode for a class while it's being
initialized (which can happen by running a method from a static
initializer), we'll be unable to resolve the ClassObject using
`resolve_type`.

This is the only case where this can happen - any
superinterfaces/superclass will already be fully initialized
when we're running a class initializer. Therefore, we can
try to lookup the class from the `Domain`, and check if it
directly matches the class of the object we're coercing
(ignoring superclasses and interfaces).
2023-03-08 16:38:24 -06:00
Aaron Hill c6c021f7f6 core: Fix setting certain DisplayObject properties to NaN
This doesn't perfectly match Flash's behavior - I haven't been
able to reproduce the values produces when the DisplayObject
starts out with certain 'Matrix' values (a non-zero 'b' or 'd').

Howver, when the 'b' and 'd' matrix values are both 0, setting
'dobj.rotation = NaN' has no effect on the matrix, while
'dobj.scaleX = NaN' and 'dobj.scaleY = NaN' both treat 'NaN'
as 0 for the purposes of updating the matrix.

This fixes the tack shooter in Bloons Tower Defense 3, which
tries to set 'rotation = NaN' for spawned tacks.
2023-03-08 16:17:38 -06:00
Aaron Hill 2c1936db18 avm2: Fix QName::from_qualified_name for Vector.<some_ns::Type>
We weren't handling names like
`__AS3__.vec::Vector.<rs.ruffle.CustomClass>`
2023-03-08 15:15:55 -06:00
EmperorBale 613d4e3160 tests: Add test for `unescape` 2023-03-07 23:49:55 -08:00
EmperorBale 683f6cc890 avm2: Implement `unescape` 2023-03-07 23:49:55 -08:00
EmperorBale cbb2d81240 avm2: Add Mutex.isSupported property 2023-03-07 23:38:24 -08:00
Aaron Hill 7ab7c31bb6 avm2: Run orphan framescripts that didn't get a chance to run
This is necessary to make Steambirds get past the preloader screen.
All of the previous tests continue to pass with this change.

This commit modifies the existing test to start from within
the symbol_class constructor, instead of a frame script. In
this situation, a freshly-created orphan with a framescript will
run directly after the constructor returns, *before* an enterFrame
handler for the same orphan. I've verified that this modified test
fails without my change.
2023-03-07 18:29:23 -06:00
Aaron Hill 93834b63de avm2: Don't allow mouse picking to hit a mask
Masks restrict the region where the maskee can be hit,
but the mask cannot itself be the target of a mouse click
(assuming that it's on the stage).
2023-03-07 17:34:06 -06:00
Aaron Hill b27bcf367c avm2: Fix handling of completed timers
It's possible to call 'start()' on a timer
that has currentCount >= repeatCount. This will
cause the timer to tick exactly once, and then stop agian.

We were incorrectly reporting 'timer.running' in such a scenario:
'running' should be reported as 'true' up until just before the
'TimerEvent.TIMER_COMPLETE' is fired.

This fixes gaining money from bloon popping / level completion
in BTD5.
2023-03-07 16:56:29 -06:00
Aaron Hill 92776645b8 avm2: Initialize LoaderStream and Loader child before catchup_display_object_to_frame
Depending on when loading completes, calling
`catchup_display_object_to_frame` might trigger an
`addedToStageEvent` inside the loaded SWF. The event listener
will expect the SWF content to have 'DisplayObject.stage' accessible,
so we need to make sure that we've added our loaded content as
a child of the `Loader` *before* any event handlers run.

I've been unable to come up with a self-contained test for this,
but it's necessary for Bloons Tower Defense 5
2023-03-07 16:36:21 -06:00
Aaron Hill b8f0de8171
avm2: Export Vector classes in public __AS3__.vec namespace (#9879)
Previously, the Vector$ classes were only exported in the internal 'AS3.vec' namespace, which is used by older ActionScript code. However, newer ActionScript code can also access these classes through the public 'AS3.vec' namespace, via 'getDefintionByName'.

We now export these classes in both namespaces. In the public 'AS3.vec' namespace, they are exported like 'Vector.' instead of 'Vector$uint'
2023-03-07 22:22:24 +00:00
TÖRÖK Attila 2fca22bd4a tests: Add radial gradient visual regression test 2023-03-07 20:35:29 +01:00
TÖRÖK Attila d356b7258a wgpu: Fix gradient regression 2023-03-07 20:35:29 +01:00
Oleksandr Kalko aca4b03c0b chore: Run `npm audit fix`
npm update causes dependency conflict
This gets rid of vulnerability warning after `npm install`
2023-03-07 18:25:55 +01:00
Jesse Talavera-Greenberg 17688dd652
core: Derive Clone and Copy in PlayerEvent (#9882) 2023-03-07 16:37:56 +00:00
Nathan Adams b15463d3fd avm2: Stub BitmapData.hitTest 2023-03-07 09:10:26 -06:00
Aaron Hill 1a7022c30b avm2: Consider noninteractive child/drawing when mouseEnabled=false
We still want to propagate these hits to the parent, which may
be able to handle them. My existing tests missed this case,
since all of the parent objects had content which was
behind the child content. When the only clickable content
comes from a child with 'mouseEnabled=false', we should
still fire an event targeting the parent (when applicable
based on the parent's flags).

This fixes dragging on the background (without any scenery present)
in Steambirds.
2023-03-07 08:14:22 -06:00
Lord-McSweeney 046af7bc4a avm2: Add EventPhase to globals.as
This was missed
2023-03-06 23:13:12 -06:00
Aaron Hill d72a8e7125 core: Run frames for 'orphan' AVM2 MovieClips
When a MovieClip is an 'orphan' (it has no parent),
it still has frames run (including frame scripts). Some SWFS
like SteamBirds and 'This is the Only Level TOO' rely on this behavior,
so we need to implement it.

The overall idea is straightforward - we keep a global list of
orphan movies, which we add to whenever we unset the parent for a movie.
This list stores weak references for consistency with Flash.
When we run a frame, we process entries in the root movie list,
in addition to the normal recursive processing from the `Stage`.

However, exactly matching Flash's output turned out to be quite tricky.
The particular sequence of calls I make in `run_all_phases_avm2` makes Ruffle
pass two complicated test cases, but there could still be lurking bugs.

This is enough to get SteamBirds to the first level (which doesn't
render due to a different error).
2023-03-06 20:53:35 -06:00
Nathan Adams c5f30dcae1 chore: Tell renovate to maintain lock files 2023-03-07 00:04:55 +01:00
Nathan Adams 026efe7f18 render: Moved out some Gradient fields into webgl as it's no longer needed in wgpu 2023-03-06 23:22:09 +01:00
Nathan Adams 0cca4983e4 wgpu: Merge gradient shaders together 2023-03-06 23:22:09 +01:00
Nathan Adams 622abe60d1 wgpu: Extract T->Color lookup from gradient shader to Mesh construction 2023-03-06 23:22:09 +01:00
Aaron Hill fde46a72a4 avm2: Fix mouse picking on MovieClip in 'button mode'
We were previously performing a redundant 'self.hit_test_shape'
call in 'avm2_mouse_pick'. All of the logic in that function
is handled in `avm2_mouse_pick.` Additionally, this call happened
before we tested out children, which would result in us targeting
a parent's drawing instead of aa child.
2023-03-06 15:57:46 -06:00