Commit Graph

5079 Commits

Author SHA1 Message Date
nosamu 33f585fa6c avm2: Stub TextField.mouseWheelEnabled 2023-03-17 18:05:14 +01:00
Tom Schuster b791c402d2 avm2: Stub flash.net.sendToURL 2023-03-17 17:49:53 +01:00
Aaron Hill 605b5fe09a avm2: Correctly declare Array.removeAt as an AS3/prototype method
It was incorrectly declared as public method, which lead to
spurious 'missing override' errors in classes extending Array
that define a 'removeAt' method.
2023-03-17 17:00:47 +01:00
MrCheeze 8c180f97b6 core: Allow duplicate frame and scene labels (close #9943) 2023-03-17 12:54:16 +01:00
Aaron Hill 1edcbe438d core: Avoid several BitmapData GPU -> CPU sync
We don't need to perform a sync when getting the width/height,
getting or setting the 'disposed' status, or uploading to
a Context3D texture.

The Context3D change (using `copy_texture_to_texture` instead
of relying on the CPU pixels) has the added advantage of avoiding
a validation error when our source image row length isn't aligned
to `COPY_BYTES_PER_ROW_ALIGNMENT`

This dramatically speeds up the Fancy Pants World 4 loading time
(on a branch with my XML prs merged). Without this change, my
machine spends around 10 seconds on a blank white screen after
clicking 'Play'. With this change, the time spent on that screen
is reduced to around 1-2 seconds.
2023-03-17 04:56:03 -05:00
EmperorBale dd33a8a698 avm2: Make `get_lex` & `find_prop_strict` throw AVM Errors 2023-03-16 22:33:23 -07:00
Mike Welsh 0c38f9a2e1 avm2: Update `SoundChannelObject::position` on read (fix #9952)
`SoundChannel.position` was being updated by the audio manager each
tick, but the Flash Player only updates and caches the position
when `SoundChannel.position` is accessed. In contrast, an AVM1
`Sound` will constantly update its position.

This means accessing `position` only once after a sound has
finished playing will return 0.

Fixes #9952.
2023-03-16 21:25:41 -07:00
Aaron Hill c73f68207b avm2: Add support for orphan Loader instances
Despite not being MovieClips, Loader instances appear to get
the same kind of orphan handling - you can instantiate a
Loader and call 'Loader.load' without ever adding it
to a parent, and the loader will still run.

I've changed the movie code to work with a new `DisplayObjectWeak`
enum. Currently, this just supports `MovieClip` and `Loader`,
but it can easily be extended if we ever need other weak display
objects.

This also fixes a bug where we were adding the loaded MovieClip
as a child of the Loader slightly too early.
2023-03-16 20:55:06 -05:00
Aaron Hill 32f8330199 avm2: Implement xml descendants operator, and XMLList.toXMLString
This includes the 'GetDescendants' opcode, which is used by the
the 'xml..elementName' syntax. The 'XMLList.toXMLString()
impl makes it much easier to write tests for this.
2023-03-16 18:00:20 -05:00
Aaron Hill 53c6011ade render: Support more Context3D texture formats
None of these formats can currently be implemented
correctly with wgpu, so we just use Rgba8Unorm instead.

The handling of opaque compressed textures is a little
sketchy - it should work for 'normal' SWFs that upload
an opaque BitmapData, but we might need to manually
adjust the alpha values if
2023-03-16 17:40:41 -05:00
Aaron Hill 8d40734482 avm2: Convert Sound and SoundChannel to ActionScript classes 2023-03-16 23:20:59 +01:00
Nathan Adams 74c28723e5 avm2: Use object_to_matrix in new Graphics methods 2023-03-16 23:06:22 +01:00
Nathan Adams 7069cf6219 chore: Appease the as style checker 2023-03-16 23:06:22 +01:00
Nathan Adams 933dadea24 avm2: Implement Graphics.lineGradientStyle and Graphics.beginGradientFill 2023-03-16 23:06:22 +01:00
Nathan Adams 70cdf1686d avm2: Implement Graphics.lineBitmapStyle and Graphics.beginBitmapFill 2023-03-16 23:06:22 +01:00
Nathan Adams 65b9b20237 avm2: Stub various Graphics methods 2023-03-16 23:06:22 +01:00
Nathan Adams a1fc140ee1 avm2: Implement IGraphicsPath 2023-03-16 23:06:22 +01:00
Nathan Adams 878c58c7c9 avm2: Implement IGraphicsFill 2023-03-16 23:06:22 +01:00
Nathan Adams 4e98898ff9 avm2: Implement IGraphicsData 2023-03-16 23:06:22 +01:00
Nathan Adams 3071020309 avm2: Implement IGraphicsStroke 2023-03-16 23:06:22 +01:00
Tom Schuster 28b5c9051c avm22: Stub Namespace.prefix and Namespace.uri 2023-03-16 16:52:37 -05:00
Tom Schuster d2754bc599 avm2: Stub XML.namespace 2023-03-16 16:52:37 -05:00
Nathan Adams 8a2d440323 avm2: Fix BitmapData.hitTest for out-of-bounds values 2023-03-16 22:31:55 +01:00
Nathan Adams a010bd0f7a avm2: Implement BitmapData.hitTest 2023-03-16 22:31:55 +01:00
Aaron Hill 04babed66c avm2: Implement XML.appendChild for XML objects
This adds a reference to the passed-in XML object to
the children list. The object will compare === with
'parent.children()[newChildIndex]`
2023-03-16 15:48:36 -05:00
Aaron Hill 24c7ca838b avm2: Implement IndexBuffer3D.uploadFromByteArray 2023-03-16 15:22:07 -05:00
Aaron Hill 8b92b2cf7c avm2: Implement adding attribute to XML object
We only support values that are neither XML nor XMLList,
since we can't yet properly stringify those.

Attempting to modify an existing attribute throws an error.
2023-03-16 14:41:01 -05:00
EmperorBale 3412833ee2 avm2: Implement Namespace constructor 2023-03-16 12:04:29 -07:00
Nathan Adams d22b07167c avm2: Implement XML.nodeKind 2023-03-16 07:34:20 +01:00
Tom Schuster acd160674a avm2: Stub CurrencyFormatter constructor
Fixes #9729
2023-03-16 06:30:16 +01:00
Lord-McSweeney ee35dbb36e avm2: Stub DisplayObject.accessibilityProperties 2023-03-16 06:17:44 +01:00
Lord-McSweeney 352d0df71f avm2: Stub DisplayObject.accessibilityProperties 2023-03-16 06:17:44 +01:00
Aaron Hill 3232690c8e avm2: Add DoAbc2 tag name to GlobalInit call stack node
This can help determine which DoAbc2 file contains the script
initializer that appears in a stack trace (though the name
can be empty).
2023-03-16 05:57:04 +01:00
Nathan Adams 19aee77570 avm2: Replaced args.get((d+)).cloned().unwrap_or(Value::Undefined).coerce_to_string(activation) with args.get_string(activation, \d) 2023-03-16 05:43:48 +01:00
Nathan Adams 791cb4c2a8 avm2: Replaced args.get(0).unwrap_or(&Value::Undefined).coerce_to_i32(activation) with args.get_i32(activation, 0) 2023-03-16 05:43:48 +01:00
Nathan Adams 8e1097c31e avm2: Replaced args.get(0).unwrap_or(&Value::Undefined).coerce_to_u32(activation) with args.get_u32(activation, 0) 2023-03-16 05:43:48 +01:00
Nathan Adams 52f020a35e avm2: Replaced args.get(0).unwrap_or(&Value::Undefined).coerce_to_string(activation) with args.get_string(activation, 0) 2023-03-16 05:43:48 +01:00
Nathan Adams 641162d4c7 avm2: Replaced args.get((d+)).cloned().unwrap_or(Value::Undefined).coerce_to_boolean() with args.get_bool(\d) 2023-03-16 05:43:48 +01:00
Nathan Adams 7e3665d12c avm2: Simplify parameter usage in graphics 2023-03-16 05:43:48 +01:00
Nathan Adams 50cf7df15d avm2: Simplify parameter usage in display_object 2023-03-16 05:43:48 +01:00
Nathan Adams dbd3e6c4ab avm2: Simplify parameter usage in bitmap 2023-03-16 05:43:48 +01:00
Aaron Hill b140ce6d97 avm2: Implement XML construction from XML and XMLList objects 2023-03-16 05:04:26 +01:00
TÖRÖK Attila 79dfeaf715 core/avm2: Use an actual FFT library in computeSpectrum 2023-03-16 04:42:42 +01:00
TÖRÖK Attila 96d1f19e6c
chore: Port to bitflags 2.0.0
* Bump bitflags to 2.0.0
* Sprinkle Clone, Copy, Eq, PartialEq, and Debug derives where needed
* Call `bits` on bitflags, as it is now a method
* Switch from `from_bits_truncate` to `from_bits_retain` on bitflags where needed
* Bump h263-rs for the bitflags 2.0.0 dependency

As part of porting to bitflags 2.0.0, see:
https://kodraus.github.io/rust/2022/10/07/bitflags2.html#upgrading-to-2x
2023-03-15 20:06:10 -07:00
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 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