Adrian Wielgosik
4e9cdc338f
avm2: Support `newcatch` with finally-scopes
2023-04-18 22:15:57 +02:00
Lord-McSweeney
2bab9022b4
avm2: Show detailed error message...
...
...while loading ABC files.
2023-04-18 21:28:38 +02:00
Aaron Hill
78b386d775
avm2: Stub URLLoader.close
2023-04-17 15:58:46 -07:00
Lord-McSweeney
f25398898a
avm2: stageWidth/Height should be of int type ( #10712 )
2023-04-16 21:58:32 +02:00
AllinolCP
d367f38eb4
avm2: stub xml.normalize() ( #10709 )
...
* avm2: stub xml.normalize()
2023-04-16 12:41:52 -04:00
Lord-McSweeney
fef7eeed90
avm2: Stub TextField.useRichTextClipboard
2023-04-13 22:09:11 +02:00
nosamu
a6c659945e
core: Allow focusing selectable EditText fields
2023-04-13 21:48:40 +02:00
Tom Schuster
aca4329dbf
avm2: Implement XMLList.child
2023-04-11 14:49:32 -04:00
Nathan Adams
35f3a21110
core: Fix bitmapdata.floodFill() replacing X with X + test. Fixes #10642
2023-04-11 10:40:57 -04:00
Mike Welsh
7cfd4470b1
avm2: Use proper scale for `Graphics.beginBitmapFill` ( fix #10628 )
2023-04-11 11:36:49 +02:00
Toad06
aef3ed2fcb
avm1: Correct `MovieClip.focusEnabled`
2023-04-09 14:11:24 -07:00
Tom Schuster
baf9bda9e9
avm2: Partially implement XML/XMLList abstract equality
2023-04-09 12:02:20 -07:00
AllinolCP
0643426b84
avm2: stub URLRequest.requestHeaders
2023-04-08 18:31:02 -07:00
Mike Welsh
7d7fe1bfdd
core: Implement `Display` for `NavigationMethod`
2023-04-08 13:37:25 -07:00
Mike Welsh
711a012fea
avm1: Exclude shape children from `StageObject::get_keys`
...
Non-interactive children such as shapes are not returned when
iterating over the keys of a stage object in AVM1.
2023-04-08 13:37:25 -07:00
Mike Welsh
3716422b37
avm1: Grab correct variables for `MovieClip.loadVariables` and `loadMovie`
...
The request was being populated with parameters from the local
function scope, not the movieclip that is doing the loading.
2023-04-08 13:37:25 -07:00
relrelb
93a0fd43d6
avm1: Migrate `ColorMatrixFilter` to `NativeObject`
2023-04-08 13:40:32 +03:00
relrelb
3dcf246870
avm1: Migrate `DropShadowFilter` to `NativeObject`
2023-04-08 13:40:32 +03:00
relrelb
814cb00821
avm1: Migrate `GlowFilter` to `NativeObject`
2023-04-08 13:40:32 +03:00
relrelb
b74f515c34
avm1: Refactor `BevelFilter`
2023-04-08 13:40:32 +03:00
relrelb
cdffc00e94
avm1: Refactor `BlurFilter`
2023-04-08 13:40:32 +03:00
Tom Schuster
d9e69563d3
avm2: Implement XMLList.copy
2023-04-07 12:29:49 -05:00
Udeshya
54a8672390
avm2: Trim xml text nodes when being parsed ( #10341 )
2023-04-06 22:41:46 -05:00
Lord-McSweeney
60ae2edf92
avm2: Use AVM error for invalid bitmapdata error
2023-04-06 11:53:56 -05:00
Aaron Hill
6844d1bf19
avm2: Call 'AS3::concat' in ColorMatrixFilter
...
This ensures that we call the normal Array concat method
(or a method that overrides it). Some SWFs may define a *public*
concat method in an Array subclass, with a different signature.
Fixes #10552
2023-04-05 22:48:12 -07:00
Aaron Hill
962cf92223
avm2: Implement Context3D.setSamplerStateAt
...
This fixes pixelated backgrounds in Fancy Pants World 4 Part 3
2023-04-05 16:44:07 -07:00
Toad06
5e165a0682
avm1: Fix some issues with `Selection.getFocus()` and `setFocus()`
2023-04-05 15:53:18 -07:00
Mike Welsh
792cfd82c7
avm2: Implement `Context3D.setColorMask`
2023-04-05 12:22:13 -07:00
Toad06
76b9ed80ba
core: Support `maxlength` attribute in EditText
2023-04-05 11:59:17 -07:00
onkrot
19284cb1be
avm2: Add more flash.accessibility members
2023-04-05 11:10:46 -07:00
Mike Welsh
37bf6b39e6
core: Remove `RenderContext::allow_mask`
...
This is now handled by `CommandList::maskers_in_progress`, so core
code does not have to worry about whether or not it can draw a
mask.
2023-04-04 13:10:45 -07:00
Lord-McSweeney
8d527ceed2
avm2: Array-related fixes
...
1. toString and toLocaleString should only be defined on the prototype.
2. concat should only be defined as an as3 and proto property, not as an instace property.
3. Array doesn't have a valueOf defined directly on it.
2023-04-04 00:43:46 -07:00
TÖRÖK Attila
493971ab8a
render: Make RenderBackend::update_texture() take a Bitmap (like register_bitmap())
2023-04-04 00:15:07 -07:00
TÖRÖK Attila
5f94476b2a
render: Add BitmapFormat::Yuv420p and BitmapFormat::Yuva420p
2023-04-04 00:15:07 -07:00
nosamu
315a7c87e5
core: Focus EditText fields only if editable
2023-04-03 23:27:18 -07:00
Mike Welsh
bde9765864
avm2: Implement `Matrix3D.transformVector` and `deltaTransformVector`
2023-04-03 17:09:16 -07:00
Nathan Adams
3a297f8adc
core: Iterate y then x in bitmapdata operations
2023-04-03 18:25:20 +02:00
Nathan Adams
2a9288870a
core: Made operations take in MutationContext instead of &mut UpdateContext where possible
2023-04-03 18:25:20 +02:00
Nathan Adams
4477d65331
core: Made overwrite_cpu_pixels_from_gpu take in MutationContext instead of &mut UpdateContext
2023-04-03 18:25:20 +02:00
Nathan Adams
e62e2a94e8
core: Move dummy() from BitmapData to BitmapDataWrapper
2023-04-03 18:25:20 +02:00
Nathan Adams
f9a9c05863
avm2: Made fill_bitmap_data_from_symbol return a BitmapDataWrapper, instead of taking in a BitmapData
2023-04-03 18:25:20 +02:00
Nathan Adams
ab534bab87
core: Rename BitmapData (of the stage variety) to BitmapGraphicData to separate it from BitmapData of the editable data variety
2023-04-03 18:25:20 +02:00
Nathan Adams
e1e4a01f13
avm2: Make BitmapDataObject::from_bitmap_data take BitmapDataWrapper
2023-04-03 18:25:20 +02:00
Nathan Adams
103158101a
avm2: Make Object::init_bitmap_data take in BitmapDataWrapper
2023-04-03 18:25:20 +02:00
Nathan Adams
a80a1422b0
avm2: Renamed bitmap_data_wrapper into bitmap_data
2023-04-03 18:25:20 +02:00
Nathan Adams
0f81d60db2
avm1: Removed BitmapDataObject::bitmap_data() as it's no longer used (or recommended to use)
2023-04-03 18:25:20 +02:00
Nathan Adams
7ffdcccf8a
avm1: Don't sync in BitmapData.loadBitmap()
2023-04-03 18:25:20 +02:00
Nathan Adams
f8ef01d2ef
avm1: Don't sync a bitmapdata to read its width or height
2023-04-03 18:25:20 +02:00
Nathan Adams
c037e014c2
avm1: Don't sync in new Bitmap(x)
2023-04-03 18:25:20 +02:00
Nathan Adams
e593541309
avm1: Don't sync bitmapdata when disposing it
2023-04-03 18:25:20 +02:00
Nathan Adams
f7da335083
avm2: Renamed as_bitmap_data_wrapper into as_bitmap_data
2023-04-03 18:25:20 +02:00
Nathan Adams
1521c7b6ee
avm2: Removed Object::as_bitmap_data() as it's no longer used (or recommended to use)
2023-04-03 18:25:20 +02:00
Nathan Adams
b1f7fecacb
avm2: Don't sync in new Bitmap(x)
2023-04-03 18:25:20 +02:00
Nathan Adams
444e256708
avm2: Made Bitmap.bitmapData not recreate a new BitmapDataWrapper every time its called
2023-04-03 18:25:20 +02:00
Tom Schuster
b0576c2155
avm2: Improve the Sound::extract stub
2023-04-03 00:22:23 -07:00
onkrot
d047ecb130
avm2: Add X509 certificate classes
2023-04-02 23:59:37 -07:00
renovate[bot]
cd3ad90d61
chore(deps): lock file maintenance rust dependencies
2023-04-02 22:00:49 -07:00
Lord-McSweeney
d1b8ec7a7e
avm2: Stub Shader
2023-04-02 19:56:14 -07:00
Lord-McSweeney
c19031a6fc
avm2: Stub ShaderData
2023-04-02 19:56:14 -07:00
Aaron Hill
a2fa362091
wgpu: Implement double buffering for Context3D
...
This matches the Context3D docs. Calling 'present' swaps
the buffers.
I wasn't certain if we actually need a double-buffered depth
texture, but I included one just to be safe.
2023-04-02 19:24:23 -07:00
Aaron Hill
671ebdfa8f
wgpu: Execute Context3D commands immediately
...
Now that most of the complicated Context3D methods have been
implemented, we can simplify the overall design. Instead of queueing
up commands and having `present` execute them in a loop, we
can execute each command immediately. The key insight is that
a `RenderPass` is only needed for `DrawTriangles`, so we don't
have to store it in `Context3D` and deal with complicated lifetime
issues.
The old behavior gave us implicit double-buffering behavior,
since nothing would get rendered until a 'present' call.
Now that a 'drawTriangles' call will immediately submit
a draw command, we need to implement actual double buffering.
This is done in the next commit.
2023-04-02 19:24:23 -07:00
Moulins
9441182b7d
avm2: move event dispatch error handling in a single place
...
The `Avm2::{dispatch, broadcast}_event` methods now log and swallow any
AVM2 error occuring during the dispatch, instead of repeating the
handling code for each caller.
This also introduces some behavioral changes:
- Errors messages are more consistent;
- For consistency with `broadcast_event`, `dispatch_event` panics if
given a non-event object to dispatch.
2023-04-02 16:52:42 -07:00
Udeshya
34775965ea
avm2: Implement `Transform.pixelBounds`
2023-04-02 23:25:10 +00:00
AllinolCP
f0a8e50be1
avm2: implement decodeURI
2023-04-02 14:49:07 -07:00
Tom Schuster
5a18a409f7
avm2: Only reject a single explicit namespace in XML
2023-04-02 16:09:03 -05:00
Toad06
35528913bf
core: Make `ExternalInterface` support undefined values
2023-04-02 13:48:14 -07:00
Toad06
5e14aabed6
core: Make `ExternalInterface` support undefined values in browsers
2023-04-02 13:48:14 -07:00
Lord-McSweeney
4777c13528
avm2: ByteArray should have toJSON defined on...
...
...its prototype.
2023-04-01 17:17:48 -07:00
Lord-McSweeney
58cbc38983
avm2: Use RegExp.valueOf in RegExp.toString
...
This fixes flag ordering issues
2023-04-01 13:49:41 -07:00
Lord-McSweeney
17ebb8c5bc
avm2: Add RegExp.prototype.toString
2023-04-01 13:49:41 -07:00
Lord-McSweeney
ab6d5006b4
avm2: Make sure RegExp prototype is not enumerable
2023-04-01 13:49:41 -07:00
Lord-McSweeney
18bff18d0b
avm2: Fix QName's prototype
2023-04-01 13:49:41 -07:00
Tom Schuster
86395f194f
avm2: Strip BOM in ByteArray::toString
2023-04-01 12:48:22 -07:00
Aaron Hill
6ce6fd1681
avm2: Use custom_unescape wherever we unescape XML
...
When we were using a fork of quick-xml, we modified the actual
unescape method. Now that we're using the crates.io release again,
we need to go through our `custom_unescape` function.
2023-04-01 02:25:24 -05:00
Aaron Hill
18f5ba18e9
core: Don't overwrite font descriptor with a duplicate
...
If a SWF contains multiple DefineFont tags with the same
font name (but different font IDs), the first tag will win
when a font is looked up by *name*. This affects the behavior
of EditText objects, which can have embedded HTML like
`<font face="MyFontName">` which performs a font lookup by name.
This fixes Fancy Pants World 4 Part 3, which contains two
DefineFont3 tags with the name FancyFont. The second font is
missing many glyphs, so using it causes us to be unable to
render the squiggle and life count text.
2023-03-31 22:47:00 -07:00
Mike Welsh
4c13da8fcb
avm2: Unstub `BitmapData.lock` and `BitmapData.unlock`
...
These functions are intentionally no-ops in Ruffle because it has
no concept of a player dirty region, so unmark them as stubs.
The only observable difference is that Flash Player will sometimes
not re-render a `Bitmap` instance on the stage immediately if it's
`BitmapData` is locked and changed, but this is only temporary and
depends on the redraw behavior of the Flash Player.
2023-03-31 22:13:28 -07:00
Nathan Adams
1c6aaba57a
core: Use actual clone() method when cloning bitmap
2023-03-31 21:56:41 -07:00
Nathan Adams
62d30251f2
core: Move clone to bitmapdata operations
2023-03-31 21:56:41 -07:00
Nathan Adams
b07bf84da5
core: Skip a gpu->cpu sync in set_pixels_from_byte_array if we're filling the whole bmd
2023-03-31 21:32:15 -07:00
Nathan Adams
fcaf462423
core: Fix set_pixels_from_byte_array respecting the bytearray position + tests
2023-03-31 21:32:15 -07:00
Nathan Adams
445912e760
core: Move set_pixels_from_byte_array out from avm2 to bmd operations
2023-03-31 21:32:15 -07:00
Aaron Hill
7f6cb99b08
avm2: Convert QName to ActionScript
2023-03-31 22:05:18 -05:00
Aaron Hill
27092ecb76
avm2: Convert RegExp to ActionScript
2023-03-31 17:08:21 -07:00
Mike Welsh
b62040884c
core: Make `DisplayObject::global_to_local` fallible
...
* `global_to_local` returns `None` if the object has zero scale.
* Adjust AVM `globalToLocal` methods to return the untransformed
point on failure.
* Add `DisplayObject::mouse_to_local` to handle AVM `mouseX`
and `mouseY` coordinates. For zero scale objects, these end up
returning values based on the twips-to-pixels scale,
divided by 20.
2023-03-31 16:26:11 -07:00
Mike Welsh
664b168d3d
core: Make `DisplayObject::global_to_local_matrix` fallible
...
This will return `None` if the object is zero scale, and callers
can handle this appropriately.
2023-03-31 16:26:11 -07:00
Mike Welsh
54b7094c16
render: Make `Matrix::inverse` fallible
...
* Add `Matrix::determinant`.
* Rename `Matrix::invert` to `inverse`.
* `Matrix::inverse` return an `Option`, with `None` returned
for non-invertible matrices.
* AMV `Matrix::invert` duplicates the code as the behavior is
different (works in f64 and not twips, etc.)
2023-03-31 16:26:11 -07:00
Nathan Adams
6f7493f16a
avm2: Don't sync BitmapData when getting .rect
2023-03-31 21:07:38 +02:00
Nathan Adams
c51ba098f6
render: Rename PixelRegion's (min|max)_(x|y) to (x|y)_(min|max)
2023-03-31 16:57:52 +02:00
Nathan Adams
cfb18718a1
core: Remove debug output
2023-03-31 16:57:52 +02:00
Nathan Adams
fd702dabcc
core: Remove disposed checks from operations, it's responsibility of avm1 and avm2 to handle it their own way
2023-03-31 16:57:52 +02:00
Nathan Adams
66e2eb77e5
core: Rename bitmap_data_operations to just operations
2023-03-31 16:57:52 +02:00
Nathan Adams
94e5aa8f34
core: Fix calculating dirty area of BitmapData.draw() with rotation
2023-03-31 16:57:52 +02:00
Nathan Adams
c85910b46d
wgpu: Fixed panic when rendering texture to itself, by always rendering to an intermediary
2023-03-31 16:57:52 +02:00
Nathan Adams
68343369a3
core: Don't sync cpu->gpu in overwrite_cpu_pixels_from_gpu
2023-03-31 16:57:52 +02:00
Nathan Adams
cae8f89c9b
core: Remove clone from copy_pixels_with_alpha_source and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
d7b0a6f611
core: Remove clone from copy_pixels and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
f5501b57da
core: Remove clone from merge and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
44c35a5b50
core: Made palette_map not sync if copying outside of dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
b1b3eef283
core: Remove clone from threshold and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
2b84e926ec
core: Remove clone from copy_channel and don't sync if copying outside dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
966f5bc816
core: Skip bitmapdata.draw which will affect 0 pixels
2023-03-31 16:57:52 +02:00
Nathan Adams
e6d36ade7f
core: Make get_pixels_as_byte_array not sync if the pixel is outside a dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
fd0ba4a753
core: Make get_vector not sync if the pixel is outside a dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
864ee1c6df
core: Make hit test methods not sync if the pixel is outside a dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
8fc1b0d48e
core: Make get_pixel and get_pixel32 not sync if the pixel is outside a dirty region
2023-03-31 16:57:52 +02:00
Nathan Adams
e1f76bf135
core: Use map instead of and_then for MovieLibrarySource::bitmap_handle
2023-03-31 16:57:52 +02:00
Nathan Adams
b035c7f24e
core: noise and perlin_noise shouldn't perform a gpu->cpu sync
2023-03-31 16:57:52 +02:00
Nathan Adams
2b483a5953
core: Ensure MovieLibrarySource::bitmap_handle updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
d44bdc16a8
avm2: Ensure Graphics.lineBitmapStyle updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
7e2382d804
avm2: Ensure DisplacementMapFilter.mapBitmap updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
29ad46daf5
avm1: Ensure MovieClip.beginBitmapFill updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
c364deb545
avm2: Ensure Graphics.beginBitmapFill updates the bitmap handle
2023-03-31 16:57:52 +02:00
Nathan Adams
9e5c56fc4f
core: BitmapData.transparent (in both avm1 and 2) shouldn't sync the whole bmd
2023-03-31 16:57:52 +02:00
Nathan Adams
e62e05cd09
core: Move get_pixels from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
89c2fc841e
core: Move get_vector from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
e4caedcc12
core: Move draw from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
57648b6380
core: Move apply_filter from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
8bb02c38c0
core: Move copy_pixels from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
eb04738b73
core: Move set_pixel from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
a41a797b4a
core: Move merge from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
60a157224f
core: Move color_bounds_rect from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
62b90c6c8e
core: Move hit test methods from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
2c65f23eb8
core: Move compare from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
8a0cb4685e
core: Move palette_map from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
b1b0394101
core: Move scroll from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
4510eb305b
core: Move threshold from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
f476968693
core: Move color_transform from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
43716bbdc7
core: Move copy_channel from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
ea6fb1a3d4
core: Move perlin_noise from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
ffe6828e9c
core: Move noise from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
285122a1fa
core: Move flood_fill from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
c2af7b92c0
core: Move get_pixel from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
758d8f1492
core: Move get_pixel32 from BitmapData to bitmap_data_operations
2023-03-31 16:57:52 +02:00
Nathan Adams
31f46c6acf
core: Move set_pixel32 from BitmapData to bitmap_data_operations, fixed set_pixels to no longer use it
2023-03-31 16:57:52 +02:00
Nathan Adams
1024fc8be5
core: Optimise fill_rect when replacing entire region after a draw call
2023-03-31 16:57:52 +02:00
Nathan Adams
e614265c17
core: Move fill_rect from BitmapData to bitmap_data_operations, fixed a bug when using non-standard values, and added better tests for fill_rect showing the bug
2023-03-31 16:57:52 +02:00
Nathan Adams
033ab34c14
core: Extract bitmap_data_operations for common avm operations
2023-03-31 16:57:52 +02:00
Nathan Adams
311a165149
wgpu: Reintroduce texture promoting; only preassign buffer when the texture is frequently written/&read
2023-03-31 16:57:52 +02:00
Nathan Adams
579f046122
core: Don't mark anything dirty in an invalid drawRect call
2023-03-31 16:57:52 +02:00
Nathan Adams
68c87c7485
core: When drawing display objects to bitmapdatas, use their minimum bounds
2023-03-31 16:57:52 +02:00
Nathan Adams
6e859891af
render: Take in dirty region in update_texture, only upload those pixels
2023-03-31 16:57:52 +02:00
Nathan Adams
137593b6a6
render: Extract (u32, u32, u32, u32) to PixelRegion
2023-03-31 16:57:52 +02:00
Nathan Adams
e0bd911f2f
render: Only copy a possible dirty area for bitmapdata.draw & read
2023-03-31 16:57:52 +02:00
Gleb Piskunov
ed282f016b
avm1: Exclude __proto__ prop from object props enumeration
...
---------
Co-authored-by: Gleb Piskunov <emgfc@ya.ru>
2023-03-31 10:14:33 +00:00
Toad06
c81460beb0
avm1: Support strings in `MovieClip.setMask(str)`
2023-03-31 02:39:39 -07:00
Tom Schuster
8a8071e6d5
avm2: Stub XMLNode.nodeName setter and XMLNode.appendChild
2023-03-31 00:11:52 -07:00
Tom Schuster
ce4ddee792
avm2: Shim flash.xml.XMLNode using XML
2023-03-31 00:11:52 -07:00
Aaron Hill
3e97f0e223
core: Update to latest quick-xml
...
I've moved our special entity handling logic into
a `custom_unescape` function. This lets us move off
of our fork of `quick-xml` back onto the crates.io release
2023-03-30 22:25:24 -07:00
Gleb Piskunov
b18d3a2645
avm2: Add AS3 implementation of BitmapData.paletteMap ( #10344 )
...
Co-authored-by: Gleb Piskunov <emgfc@ya.ru>
2023-03-30 17:39:05 +00:00
relrelb
236a97bf31
render: Replace `ColorTransform` with `swf::ColorTransform`
2023-03-29 23:27:20 -07:00
onkrot
5632ade09c
avm2: Hookup `DisplayObject.opaqueBackground`
2023-03-29 23:11:01 -07:00
Aaron Hill
8fa00de8a8
avm2: Convert Font class to ActionScript
2023-03-29 22:46:27 -07:00
Tom Schuster
330bd37237
avm2: Stub flash.net.XMLSocket
2023-03-29 22:33:16 -07:00
EmperorBale
ac626493dd
avm2: Fix panic in regexp when a wide empty string is used
2023-03-29 18:00:07 -07:00
Aaron Hill
34e4cffeb0
avm2: Use global domain for timer Activation
2023-03-29 19:05:19 -05:00
relrelb
d71617209a
render: Remove `RenderBackend::register_glyph_shape`
...
Use just `RenderBackend::register_shape` instead.
2023-03-30 01:46:04 +03:00
Tom Schuster
b1f253775a
avm2: Implement XML.childIndex
2023-03-29 14:40:29 -05:00
Tom Schuster
c0400af1de
avm2: Implement XML.copy
2023-03-29 11:04:32 -05:00
Aaron Hill
cdba704b4b
avm2: Construct Activation with Domain when setting named child
2023-03-29 09:27:34 -05:00
Nathan Adams
3a49870689
avm2: Fix errors in LoaderInfo and stubbed remaining properties
2023-03-28 11:57:00 +02:00
TÖRÖK Attila
05e2b4c729
avm2: Stub Video.deblocking and Video.smoothing
2023-03-28 10:20:29 +03:00
TÖRÖK Attila
72802de20e
nit: Fix typo: "recieve" -> "receive"
2023-03-28 10:06:08 +03:00
renovate[bot]
5052e942b5
chore(deps): lock file maintenance rust dependencies
2023-03-28 09:31:15 +03:00
Toad06
9c37c9cd34
core: Correct `swapDepths`
2023-03-28 00:24:48 -05:00
Adrian Wielgosik
4e84632609
avm2: Fix edge cases in RegExp constructor
2023-03-27 19:09:09 -05:00
Ikko Eltociear Ashimine
fc4b51b20f
chore: fix typo in display_object.rs
...
defualt -> default
2023-03-27 20:54:16 +03:00
Mike Welsh
a7bd3737a6
avm2: Implement `SharedObject.clear`
2023-03-26 22:22:27 -05:00
Aaron Hill
a52cb7461e
wgpu: Implement MSAA support for Stage3D
...
When we receieve a nonzero 'antiAlias' parameter, we create
create a non-multisampled resolve buffer to use with WGPU.
Several tests were already requesting antialiasing, so their
output images are now anti-aliased without any changes to
the tests themselves.
2023-03-26 18:05:41 -07:00
Aaron Hill
1a352aa453
avm2: Implement ApplicationDomain constructor and fix parent handling
...
Previously, the `ApplicationDomain` constructor ignored its argument,
instead of constructing a new domain with the specified domain as
the parent.
Additionally, we were incorrectly executing code with
`Activation::from_nothing` in several places, causing
`ApplicationDomain.currentDomain` to return the system domain
instead of the correct parent domain. I've introduced a new method
`Activation::from_domain`, which allows explicitly passing in the
domain. Internally, we now store an `Option<Domain>`, and panic
when calling `caller_domain` with a `None` domain. Several places
in the codebase have been adjusted to pass in the correct domain.
2023-03-26 17:43:46 -07:00
Aaron Hill
da6384b30e
Warn instead of panicking
2023-03-26 17:22:52 -07:00
Aaron Hill
d220cad3bf
avm2: Allow duplicate (class, symbol) pairs in SymbolClass tags
2023-03-26 17:22:52 -07:00
Aaron Hill
7f829dd646
avm2: Don't overwrite symbol class entry with a different SwfMovie
...
If you use a `Loader` to load an SWF containing a class that shadows
an already-defined class, the class definition from the Loader SWF
will be ignoredin favor of the already-defined class. This commit
applies this log to symbol classes as well - the symbol registry for the class
should continue to point to the existing MovieClip in the parent.
This results in the child SWF instantiating the class from the parent
SWF when the child places the affected movie clip on the timeline.
This fixes a bug in Fancy Pants World 4 Part 3, where the sub-level
SWF was replacing the symbol class entry for the parent 'shipInteract'
class with the dummy clip provided in the sub-level SWF (instead
of continuing to use the correct clip from the parent SWF).
2023-03-26 17:22:52 -07:00
Aaron Hill
cb9d02e3dd
avm2: Fire soundComplete events immediately
...
Instead of queueing up these events in the `Activation`,
we can fire them immediately by making `AudioManager::update_sounds`
a freestanding method that takes in an `UpdateContext`
2023-03-26 14:43:07 -07:00
Gleb Piskunov
6f7e491bc5
core: Fix ChildContainer.replace_at_depth() panic
...
Avoid panic in ChildContainer.replace_at_depth() panic when previous child is not in render list.
---------
Co-authored-by: Gleb Piskunov <emgfc@ya.ru>
2023-03-26 19:47:07 +00:00
Lord-McSweeney
3b7172de8d
nit: Add error code in error message
2023-03-26 11:39:07 -07:00
yoganlava
ab263b8c6a
avm2: Handle undefined arg in XML.elements()
2023-03-25 23:12:51 -07:00
yoganlava
847465cb86
avm2: don't coerce to string before undefined check in name_to_multiname
2023-03-25 23:12:51 -07:00
yoganlava
447ada0929
avm2: Clean up XML.elements() by using name_to_multiname
...
name_to_multiname now resolves "undefined" to Multiname::any
2023-03-25 23:12:51 -07:00
yoganlava
9bf66ae3c3
chore: Fix fmt
2023-03-25 23:12:51 -07:00
yoganlava
da0b245fb8
avm2: Fully implement XML.elements()
2023-03-25 23:12:51 -07:00
Aaron Hill
9530da22e2
avm2: Convert SoundTransform and SoundMixer to ActionScript classes
...
Co-authored-by: Mike Welsh <mwelsh@gmail.com>
2023-03-25 22:28:14 -07:00
EmperorBale
7a4a4f7c9a
avm2: Fix function double borrow panic
2023-03-25 21:57:04 -07:00
Tom Schuster
53d9118834
avm2: Implement XML set for simple element cases
2023-03-25 20:40:44 -07:00
Lord-McSweeney
3bfa2deb5c
avm2: Log error message instead of error object
2023-03-26 02:20:18 +00:00
Aaron Hill
b140029e95
render: Fix BitmapData.applyFilter with non-full sourceRect
...
Previously, we were scaling down the source image to fit into
the smaller sourceRect, instead of cropping at the original scale.
This broke the background textures in Fancy Pants World 4 Part 2,
as the scaled-down output image resulted in a smaller rectangle
being returned from 'getColorBoundsRect'
We now crop the image by properly constructing the UV-coordinate
transformation matrix. We were also using the wrong value for the
'destPoint' y coordinate, which I fixed.
This slightly changes the image output of two tests - the new images
now more closely match the Flash output.
2023-03-25 18:44:01 -07:00
David Wendt
65d2fca7bd
chore: Rename `NetStream.toggle_pause` to match `StreamManager::toggle_paused`
2023-03-25 15:30:02 -06:00
David Wendt
6689b547f8
chore: Re-alphabetize `globals.as`
2023-03-25 15:30:02 -06:00
David Wendt
66efb02f46
chore: `NetStreamInfo.as` formatting
2023-03-25 15:30:02 -06:00
David Wendt
0fd6fbc6d6
chore: Explicitly type `NetStream` constants as `String`
2023-03-25 15:30:02 -06:00
David Wendt
d9dcc49bc1
core: If a timeline video gets a `NetStream` attached to it, timeline seeking should be a no-op.
2023-03-25 15:30:02 -06:00
David Wendt
afb0cd3b5e
avm1,avm2: Implement `pause`/`resume` based methods.
...
For AVM1, `pause` handles three different functions; while AVM2 splits that into `pause`, `resume`, and `togglePause`.
2023-03-25 15:30:02 -06:00
David Wendt
6217397482
avm1,avm2: Implement `NetStream.play`.
...
So far this just sticks the stream into the playback list and kicks off a download; we do not actually support decoding, seeking, or any of the other things that we expect `play` to do.
2023-03-25 15:30:02 -06:00
David Wendt
273b0a4a76
core: `NetStream` should be a self-owning pointer type.
2023-03-25 15:30:02 -06:00
David Wendt
c104413e85
core: Implement `bytesLoaded`/`bytesTotal` for streams.
...
This treats the buffer as both the loaded and total size. Future changes to allow, e.g., streaming fetch would need this code to change.
2023-03-25 15:30:02 -06:00
David Wendt
fb7ad56bca
avm2: Implement `Video.attachNetStream`.
2023-03-25 15:30:02 -06:00
David Wendt
77404de850
avm1: Implement `Video.attachVideo`
2023-03-25 15:30:02 -06:00
David Wendt
9c13232aa3
core: Add a type to hold playing streams.
...
Calling `StreamManager::tick` advances all streams to the appropriate time. This is an unlocked timestep to support things like non-stage-FPS video and the like.
2023-03-25 15:30:02 -06:00
David Wendt
6729c31623
avm2: Stub all `flash.net.NetStream` methods and related classes.
2023-03-25 15:30:02 -06:00
David Wendt
35ebdd5e97
avm2: Add stub impl of `NetStream` class & object type
2023-03-25 15:30:02 -06:00
David Wendt
ca2f5257f3
avm1: Stub implementation of the NetStream class that allows us to create streams.
2023-03-25 15:30:02 -06:00
David Wendt
38ed0dada4
core: Stub implementation of NetStream loading.
...
The actual use cases for `NetStream` almost certainly require streaming download but I'm not ready to implement that just yet.
2023-03-25 15:30:02 -06:00
David Wendt
db7ff77c4e
core: Add a stub implementation of `NetStream` videos.
2023-03-25 15:30:02 -06:00
Gleb Piskunov
2cb32e88df
avm2: Fix bad Graphics.drawRoundRectComplex() stub ( #10368 )
...
Co-authored-by: Gleb Piskunov <emgfc@ya.ru>
2023-03-25 18:30:18 +00:00
relrelb
7cdac78321
chore: Remove `static_assertions` dependency
...
`static_assertions` seems unmaintained, and anyway `assert!()` is
usable in `const` contexts since Rust 1.57.0:
https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html#panic-in-const-contexts
So simply use the suggested method instead.
Also the `rustversion` dependency is no longer needed because
https://github.com/rust-lang/rust/pull/94075 already landed in stable.
2023-03-25 15:14:36 +03:00
Mike Welsh
e1b24712cf
avm2: Throw AVM error on calling undefined function
2023-03-24 18:21:32 -07:00
Nathan Adams
eb44cc5395
render: Made ShapeHandle an Arc of an internal, droppable mesh
2023-03-23 01:44:27 -07:00
Nathan Adams
cc8ac4fde1
render: Remove RenderBackend::replace_shape
2023-03-23 01:44:27 -07:00
Toad06
ab71370cb7
avm1: Minimal implementation of `XML.getBytesTotal` and `XML.getBytesLoaded`
2023-03-22 17:51:42 -07:00
Mike Welsh
123f9e088c
avm2: Fix null parameter error message
2023-03-22 17:13:36 -07:00
EmperorBale
b2c79f9ea2
avm2: Make `resolve_parameters` throw an AVM error
2023-03-22 16:35:48 -07:00
Adrian Wielgosik
d77cf83e07
avm2: Fix si8/si16 opcodes
2023-03-22 22:55:43 +01:00
EmperorBale
fe54fb15f7
avm2: Show AS3 stack traces when logging level is `INFO`
2023-03-22 14:29:42 -07:00
EmperorBale
a63ee977fa
avm2: Reduce size of `CallNode` from 56 bytes to 24
2023-03-22 14:29:42 -07:00
Mike Welsh
1d12fc6169
render: Fix types depending on `tessellator` feature
2023-03-22 20:30:39 +01:00
Marty_SVK
de44c5494e
avm2: Stub Mouse.registerCursor and Mouse.unregisterCursor
2023-03-22 20:15:53 +01:00
Lord-McSweeney
98c19cc199
avm2: Stub NetConnection.close
2023-03-21 23:47:03 -07:00
yoganlava
2dee8338c8
avm2: Fix double borrow when setting local XMLList property
2023-03-21 19:21:18 -07:00
renovate[bot]
d7c842a139
chore(deps): lock file maintenance rust dependencies
2023-03-21 14:27:27 +01:00
Nathan Adams
edbdf224ae
avm2: Skip BOM when reading utf8 from ByteArrays
2023-03-21 12:20:43 +01:00
renovate[bot]
7c280fc171
fix(deps): update rust dependencies
...
`syn` breaking changes:
* `Method` renamed to `Fn`
* `extra-traits` feature necessary for `Debug` impls
2023-03-20 06:35:08 +01:00
Nathan Adams
bd6c3536e1
core: Fix add with overflow in BitmapData::copy_channel
2023-03-20 05:52:27 +01:00
Nathan Adams
a9ed47407d
core: Replaced all BitmapData::get_pixel_raw().unwrap() with get_pixel32_raw()
2023-03-20 05:52:27 +01:00
Nathan Adams
860a34d6e6
core: Use get_pixel32_raw in BitmapData::color_transform
2023-03-20 05:52:27 +01:00
Nathan Adams
885a7a22ca
core: Made BitmapData::get_pixel32 take u32 and use raw access
2023-03-20 05:52:27 +01:00
Nathan Adams
dc1380ef8b
core: Made BitmapData::hit_test_point use get_pixel32_raw
2023-03-20 05:52:27 +01:00
Nathan Adams
50238f2600
core: Made BitmapData::get_pixel take u32 and use raw access
2023-03-20 05:52:27 +01:00
Nathan Adams
4bd1a5b9f8
core: Remove BitmapData::set_transparency, it can only be set at creation
2023-03-20 05:52:27 +01:00
Nathan Adams
483afc4f9a
core: Made BitmapData::set_pixel32 use set_pixel32_raw
2023-03-20 05:52:27 +01:00
Nathan Adams
2e487b0661
core: Made BitmapData::set_pixel use set_pixel32_raw
2023-03-20 05:52:27 +01:00
Nathan Adams
ec0434a2bb
core: Optimized BitmapData::copy_channel
2023-03-20 05:52:27 +01:00
Nathan Adams
48cebdbbc0
core: Make BitmapData::fill_rect use set_pixel32_raw
2023-03-20 05:52:27 +01:00
Nathan Adams
69721c06a8
core: Make BitmapData::set_pixel32_raw inline
2023-03-20 05:52:27 +01:00
Nathan Adams
aa17ef695c
core: Remove set_cpu_dirty from BitmapData::set_pixel32_raw
2023-03-20 05:52:27 +01:00
renovate[bot]
f6f646a756
chore(deps): lock file maintenance rust dependencies
2023-03-19 19:45:30 -07:00
Toad06
e2415be734
core: Store correct data for loaded images
2023-03-20 01:36:04 +01:00
Huw Pritchard
645ff76bcd
avm2: Add 11 AS3 classes ( #10003 )
2023-03-20 00:19:31 +00:00
AllinolCP
19b38da394
avm2: implement XML.parent()
2023-03-19 16:06:01 -07:00
Mike Welsh
3f7ea0b07f
avm2: Implement `updateAfterEvent`
...
Implement `updateAfterEvent` for `MouseEvent`, `TimerEvent` and
`TouchEvent`.
2023-03-19 14:39:17 -07:00
Dejan Varmedja
fca4bfde25
avm2: Add AVM2 keyboard constants ( close #10248 )
2023-03-19 12:16:31 +01:00
Mike Welsh
2d6d8ea0f4
core: Fix BitmapData.colorTransform
...
* Pixels with 0 alpha are not affected by color transforms.
* Color channels should be clamped to the 0-255 range.
* A color transform with only an alpha multiplier of >1 has no
effect.
2023-03-19 09:59:13 +01:00
Lord-McSweeney
c48dfb4a72
Fix ordering of flash.xml classes.
2023-03-19 09:44:17 +01:00
Lord-McSweeney
acc05f377f
avm2: Add XMLDocument to globals
2023-03-19 09:44:17 +01:00
Lord-McSweeney
8ce16901ee
avm2: Stub flash.xml.XMLDocument
2023-03-19 09:44:17 +01:00
Lord-McSweeney
6b2dcad7f3
avm2: Implement flash.xml.XMLNode
2023-03-19 09:44:17 +01:00
Lord-McSweeney
16c2317455
avm2: Implement flash.xml.XMLNodeType
2023-03-19 09:44:17 +01:00
Nathan Adams
b5cf5bc707
avm2: Fix comment for dispatch_event
2023-03-19 09:15:42 +01:00
Nathan Adams
e94861a8ad
avm2: Convert errors to error messages at root level
2023-03-19 09:15:42 +01:00
Nathan Adams
8b5f6c3691
core: Log when an error is encountered perfoming avm2 callbacks
2023-03-19 09:15:42 +01:00
Nathan Adams
b7c061a7a2
avm2: Implement LocalConnection.domain getter
2023-03-19 09:05:00 +01:00
Nathan Adams
ea424f3d1e
avm2: Fix panic when constructing custom BitmapData from timeline
2023-03-19 07:47:40 +01:00
Nathan Adams
9cfd37cab2
core: Respect use_device_font for bullets
2023-03-19 06:55:07 +01:00
Nathan Adams
0f66f7bcb2
core: Fallback font lookup by any font with the same name
2023-03-19 06:55:07 +01:00
Nathan Adams
27f28fb547
avm2: Don't create new texts/sprites/buttons with an empty movie
2023-03-19 06:55:07 +01:00
Lord-McSweeney
e5f75ff126
avm2: Fix TextField.getTextFormat arguments
...
These are used in the Rust handler, but were not correctly set in the AS bindings, leading to errors such as "Attempted to call flash::text::TextField::getTextFormat with 2 arguments (more than 0 is prohibited)"
2023-03-18 21:59:41 -07:00
Mike Welsh
ea75dd3739
avm1: Implement BitmapData.hitTest
2023-03-18 19:47:39 -07:00
Nicholas Cioli
9876e03ece
core: Fix endless loop in `process_swf5_references`
...
This commit fixes an issue where ruffle locks up while trying to
resolve an item with non-MovieClip parents.
2023-03-18 19:25:16 -07:00
Nathan Adams
60a3765be2
core: Store winding rule in Drawing
2023-03-18 19:14:08 -07:00
Nathan Adams
6987c81623
render: Respect HAS_FILL_WINDING_RULE
2023-03-18 19:14:08 -07:00
Tom Schuster
e9e342fe23
avm2: Implement String call handler
2023-03-18 17:51:22 -07:00
Tom Schuster
5aac938e86
avm2: Implement XMLList.text()
2023-03-18 12:18:24 -07:00
Tom Schuster
c285c1eb75
avm2: Implement XML.text
2023-03-18 11:12:15 -05:00
Nathan Adams
b46f511326
avm2: Implement GraphicsTrianglePath
2023-03-18 06:27:49 +01:00
Nathan Adams
96bb0b8e2e
avm2: Lazily create commands and data in GraphicsPath
2023-03-18 06:27:49 +01:00
Nathan Adams
de8958c40b
avm2: Implement GraphicsStroke
2023-03-18 06:27:49 +01:00
Nathan Adams
2eaaa9b573
avm2: Implement GraphicsSolidFill
2023-03-18 06:27:49 +01:00
Nathan Adams
fe327dc3de
avm2: Implement GraphicsPath
2023-03-18 06:27:49 +01:00
Nathan Adams
2567bd2f42
avm2: Implement GraphicsGradientFill
2023-03-18 06:27:49 +01:00
Nathan Adams
7f7fbc2091
avm2: Implement GraphicsEndFill
2023-03-18 06:27:49 +01:00
Nathan Adams
3e84da036f
avm2: Implement GraphicsBitmapFill
2023-03-18 06:27:49 +01:00
David Wendt
47f594d108
avm2: Stub `flash.media.Microphone` and depended classes
2023-03-17 20:39:45 -06:00
Aaron Hill
1e973af747
avm2: Implement Context3D.setRenderToTexture/setRenderToBackBuffer
...
In the process, I fixed a bug where we were clearing the depth
and stencil buffers with the incorrect value.
This makes Fancy Pants World 4 Part 1 playable to completion
(though there are still some rendering issues that need
to be fixed).
2023-03-17 20:11:59 -05:00
David Wendt
fe0cbc4cb8
avm2: Stub `flash.media.Camera`
2023-03-17 18:27:45 -06:00
Nathan Adams
3a353e15d1
avm2: Convert transform to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
218b621ae3
avm2: Convert external_interface to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
2513292566
avm2: Convert event_dispatcher to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
fda3390aa1
avm2: Convert event to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
8db6375c4c
avm2: Convert display_object_container to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
37f3ea7077
avm2: Convert interactive_object to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
82fc05667c
avm2: Convert loader to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
ed9257ee39
avm2: Convert (some of) movie_clip to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
bc118109e4
avm2: Convert simple_button to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
652a8f86d6
avm2: Convert sprite to use ParametersExt
2023-03-17 20:40:33 +01:00
Nathan Adams
b19ddbe0fc
avm2: Convert stage to use ParametersExt
2023-03-17 20:40:33 +01:00
Tom Schuster
750291c993
avm2: Stub XML settings
2023-03-17 14:25:19 -05:00
Aaron Hill
9ff6ee21df
avm2: Handle early class lookup during parameter resolution
...
This factors out the early-resolution logic I added in `op_coerce`,
making it useable during paramter resolution as well. This lets
a static initializer reference the containing class in parameter
types, even though the ClassObject hasn't yet been initialized.
2023-03-17 13:23:14 -05:00
Aaron Hill
ba88b52167
avm2: Correctly apply 'skip_next_enter_frame' to Loader
...
We were missing the initial 'set_skip_next_enter_frame(true)'
call, and we weren't properly clearing it in `enter_frame`.
Loaders appear to have the same behavior as MovieClips.
This makes us correctly run the first framescript for the loaded
SWF.
2023-03-17 12:44:56 -05:00
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
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
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
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
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
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