Commit Graph

8627 Commits

Author SHA1 Message Date
Nathan Adams 2549990e2e avm2: Implement String.prototype methods + valueOf 2023-03-16 03:43:37 +01:00
Aaron Hill 16ff2a17e3 avm2: Stub TextureBase.dispose 2023-03-15 21:13:01 -05:00
Aaron Hill e194883ef6 naga-agal: Correctly access vertex shader FunctionArgument
I had previously applied this fix to fragment shaders,
but I forgot to apply it to vertex shaders as well.
2023-03-15 20:12:21 -05:00
Aaron Hill acbc802c94 avm2: Fix VertexBuffer3D.uploadDataFromByteArray size calculation
We were ignoreing 'data32PerVertex'.
To make the code clearer, I've renamed the variable to
'data32_per_vertex', and made it a 'u8' (as it has a maximum of 64)
2023-03-15 19:52:09 -05:00
nosamu 6eeb2de213 avm2: Stub flash.text.TextFormat.display getter and setter 2023-03-15 16:51:58 -07:00
nosamu 9a7b8c7e6a avm2: Add flash.text.TextFormatDisplay class 2023-03-15 16:51:58 -07:00
Nathan Adams 9c0e199fa4 avm2: Throw AVM error for null arg in removeChild() 2023-03-16 00:14:22 +01:00
Aaron Hill 92d6d652b4 avm2: Stub generateFilterRect, setStencilReferenceValue, and setSamplerStateAt
These are needed by Fancy Pants World 4
2023-03-15 17:53:07 -05:00
Nathan Adams 1bb8515d85 chore: Update avm2 compatibility warning to be less severe 2023-03-15 15:30:25 -07:00
nosamu 0ac697059f avm2: Stub Loader.unloadAndStop 2023-03-15 15:08:13 -07:00
Aaron Hill 4618511771 avm2: Add custom call handlers and implement it for XML
The XML call handler is implemented as 'new XML(arg)',
so we get all of the related string coercions for free.

Our various native tables are starting to get somewhat wasteful -
if we add any more, we might want to consider a more compact
representation.
2023-03-15 16:47:32 -05:00
Tom Schuster d7f99527db avm2: Partly implement XML.toString 2023-03-15 16:18:35 -05:00
Bale bb2d88b1d8 chore: Fix typo in comment 2023-03-15 13:57:58 -07:00
Aaron Hill ccf263fdf4 avm2: Implement Array.removeAt 2023-03-15 14:45:57 -05:00
Daniel Jacobs e7d2906173 ci: Use latest Node 19
https://github.com/nodejs/node/releases/tag/v19.8.1 was released to fix the Node 19.8.0 issue.
2023-03-15 20:20:57 +01:00
Aaron Hill ef719c323e avm2: Add several more Matrix3D methods
These implementations are ported from the MIT-licensed OpenFL
code.
2023-03-15 11:02:27 -05:00
Jay Sackwild 4707a6b0e9
core: Enable click events on non-selectable text fields (#10005) 2023-03-15 11:01:33 +00:00
Daniel Jacobs 5a1b43008b web: Remove Config object; it was never a correct type for the config 2023-03-15 11:45:00 +01:00
Nathan Adams 9e6a1f3234 core: Slightly neater way to get root_mc in context_menu.rs 2023-03-15 10:18:32 +01:00
Nathan Adams c116f29821 core: Run avm2 timers when rootless 2023-03-15 10:18:32 +01:00
Nathan Adams 22d6d21196 tests: Add avm2/rootless test for detaching and reattaching movie roots 2023-03-15 10:18:32 +01:00
Nathan Adams a87bbfb40e core: Don't panic flushing AVM1 sharedobjects if there's no root movie 2023-03-15 10:18:32 +01:00
Nathan Adams 75bf002fc6 core: Make Stage::root_clip() return Option 2023-03-15 10:18:32 +01:00
Nathan Adams 853a2cdcc1 avm2: Implement BitmapData.threshold 2023-03-15 01:24:20 -07:00
Aaron Hill 6bf17158cf avm2: Skip running enter_frame for children as well
When we skip running a frame for a MovieCilp, we skip all
of its children as well. However, this skip 'counts' as
a skip for any children that already wanted to skip their next
frame. For example, say  we create three objects in ActionScript,
and arrange them like 'obj1 -> obj2 -> obj3'.
The first 'obj1.enter_frame' call will not run a new frame
for any of the objects, but next time, 'obj1.enter_frame'
will run a new frame for all of the objects.

This fixes jacksmith, which was missing a frame1-framescript
due to 'enter_frame' getting incorrectly run for a deeply
nested child.
2023-03-14 23:19:53 -07:00
Aaron Hill c004101bfe core: Cache 'width' and 'height' in Bitmap when BitmapData is set
If you call 'BitmapData.dispose()', any Bitmap objects using it will
continue to report the original 'width' and 'height' values to
ActionScript. The values only refresh if you explicitly do
'Bitmap.bitmapData = bitmapDataObject' (including with the same
object).

Fancy Pants Adventure World 4 relies on this - it calls
BitmapData.dispose(), and then uses the width and height from
a previously-constructed Bitmap object.
2023-03-14 23:00:08 -07:00
Tom Schuster 1f8dccf5a2 avm2: Support wildcard/any name in XMLList get_property_local
This is similar to #10018. Improves #8330.
2023-03-14 20:00:05 -05:00
Aaron Hill 570b97f270 ci: Pin node to 19.7.0
The newly released 19.8.0 is crashing
2023-03-14 18:17:20 -06:00
Lord-McSweeney a00af10182 avm2: Fix stub type for Responder 2023-03-14 08:18:56 +01:00
Nathan Adams 74d424e82f avm2: Add ParamtersExt::get_value 2023-03-14 07:35:52 +01:00
Nathan Adams df29536197 avm2: Document ParametersExt and replace get() with [] 2023-03-14 07:35:52 +01:00
Nathan Adams fb0c9fd481 avm2: Make ParametersExt expect() values to always exist from AS 2023-03-14 07:35:52 +01:00
Nathan Adams 85f1b5b428 avm2: Replace get_object_of_class with get_object as coercion already happens in AS definition 2023-03-14 07:35:52 +01:00
Nathan Adams 4fd0db2791 avm2: Introduce ParametersExt and use it inside bitmapdata 2023-03-14 07:35:52 +01:00
EmperorBale b880cfec7e core: Update regress to version 0.5 2023-03-14 07:14:17 +01:00
nosamu cd1a0326e7 tests: Extend URLVariables test 2023-03-13 16:49:43 -07:00
nosamu e1c6fc33e9 avm2: Implement URLVariables.decode 2023-03-13 16:49:43 -07:00
Aaron Hill 97d6de1a46
avm2: Improve handling of timeline-removed orphans (#9928)
When a DisplayObject is removed from its parent by a RemoveTag, it still runs its framescript for the current frame (but with 'this.parent == null'). It then stops executing entirely, unlike ActionScript-removed orphans, which continue to execute indefinitely.

Additionally, objects created by ActionScript during a frame skip their next 'enterFrame' logic (but still receive an enterFrame event). This results in the currentFrame lagging one frame behind objects that were placed by the timeline during the same frame.

The combination of these two changes lets us greatly simplify frame lifecycle handling for orphan movies. Most of the orphan stages were unencessary, and the remaining ones run in the same phase as the normal Stage-descendant objects.
2023-03-13 23:37:11 +00:00
Tom Schuster 5646e93b0c avm2: XML child/attribute should support the wildcard 2023-03-13 18:13:53 -05:00
Aaron Hill fea885f3af render: Implement Context3DTextureFormat.BGRA using an RGBA texture
Webgl doesn't support BGRA textures, so this lets us use
Stage3D textures on the web backend. As a bonus, this speeds up
uploading an BitmapData to a Context3dTextureFormat.BGRA texture,
since we no longer need to change the format before copying.

This makes Solarmax2 playable on the web backend.
2023-03-13 13:30:15 -05:00
Adrian Wielgosik 38c585a8f9 avm2: Store the activation class on method 2023-03-13 10:23:08 -05:00
Aaron Hill 66aad3ebc5 core: Use a separate matrix for stage alignment and HiDPI scaling
The stage alignment settings viewport_scale_factor should *not* be
applied to `Stage.transform.matrix`, which is only ever changed
as a result of explicit modification from ActionScript. Instead,
alignment and scaling are performed a separate step, which is
transparent to ActionScript.

I've implemented this through a new `viewport_matrix` field,
which is used during stage rendering and mouse coordinate
transformation.

This makes Stage3D instances properly scale - previously, they
would render unscaled. The linux standalone Flash Player doesn't
seem to use HiDPI mode, so I didn't realize that this was a bug
until now.

In the process of implementing this, I discovered and fixed a bug
with how we handle changing the viewport size under winit.
Calling `self.window.set_inner_size` does not immediately take
effect (at least on X11) - calling `self.window.inner_size()`
will report the old size until the next resize event.
Since build our Stage matrices from `self.window.inner_size()`
(and start running the SWF) immediately after `RuffleEvent::OnMetadata`,
we would run a few SWF frames with an incorrect viewport size. This
is visible to SWFs that have the scale mode set to "noScale", and
could break SWFs that expect the initial viewport size to be
the movie size. I've fixed this by delaying SWF execution until
we get a Resize event (if `self.window.inner_size()` does not
immediately report the size we set).
2023-03-13 02:02:40 -05:00
Nathan Adams b527054a1e
render: Make retrieve_offscreen_texture pass the raw buffer (#9936) 2023-03-13 00:00:42 +00:00
Aaron Hill de8448e00a
avm2: Implement Stage3D depth test, blend factors, and fix bugs (#9845) 2023-03-12 23:43:58 +00:00
Tom Schuster e266e941f6 tests: Add basic test for XML wildcards 2023-03-12 18:32:11 -05:00
Tom Schuster 3d29b81a8c avm2: Support any name in XML get_property_local
Fixes #9999
2023-03-12 18:32:11 -05:00
Tom Schuster 2d9c1a3829 tests: Test XML child 2023-03-12 18:06:13 -05:00
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