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
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
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
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
3d29b81a8c
avm2: Support any name in XML get_property_local
...
Fixes #9999
2023-03-12 18:32:11 -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
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
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
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
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
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
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
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
Adrian Wielgosik
be2d5faa6f
avm2: Implement proxy.isAttribute()
2023-03-06 19:48:23 +01:00
Lord-McSweeney
3cb307bfb0
avm2: Implement String.toString ( #9872 )
...
Some SWFs use this property
2023-03-06 05:57:02 +00:00
EmperorBale
2b1918316d
avm2: Require multinames to be passed explicitly to QNameObject
2023-03-05 21:32:40 -08:00
EmperorBale
ac9106ccb4
chore: Cleanup multiname creation in XML
2023-03-05 21:32:40 -08:00
EmperorBale
f95599b816
avm2: Store Multiname instead of QName in QNameObject
...
avm2: Fix QName constructor
2023-03-05 21:32:40 -08:00
renovate[bot]
130144a76d
fix(deps): update rust dependencies
2023-03-05 20:43:46 -06:00
Aaron Hill
bb5e568333
avm2: Stop after the first DisplayObject-linked class in the chain
...
Surprisingly, Flash allows mutliple classes in an inheritance chain
to hav a linked `class_symbol`. When we instantiate a `DisplayObject`,
we need to stop at the first such `class_symbol` we find. This means
that any fields set from named children will *only* be set in the
first class we find, not in any of the parent classes (as their
corresponding library symbol will not be instantiated).
Previously, we would continue looping even after we found a
`class_symbol`, resulting in the furthest ancestor *winning*
the `set_object2` call.
2023-03-05 18:04:02 -06:00
Lord-McSweeney
b919889174
avm2: Stub DisplayObject.scale9Grid
2023-03-04 19:29:11 -08:00
Aaron Hill
e6bbb627d7
avm2: Implement KeyboardEvent.keyLocation getter/setter
2023-03-04 18:30:12 -06:00
relrelb
83c15b8033
render: Replace `BoundingBox` with `swf::Rectangle`
2023-03-04 21:54:23 +02:00
relrelb
5756c847cd
swf: Make `Twips::new` a `const fn`
2023-03-04 21:54:23 +02:00
Aaron Hill
3c03a769dc
avm2: Format Matrix3D.as
2023-03-03 18:32:04 -06:00
Aaron Hill
a4c8f27743
avm2: Implement Matrix3D.appendScale
...
This is based off the the MIT-licensed OpenFL code, which
just needed a few tweaks to convert it from Haxe to ActionScript.
2023-03-03 18:32:04 -06:00
Aaron Hill
1ef539e31b
avm2: Implement Capabilities.isDebugger and stub System.disposeXML
...
These are needed for Solarmax 2
2023-03-03 16:51:54 -06:00
Aaron Hill
2748b95c86
avm2: Improve Stage3D support for textures, register types, and opcodes
...
This is a very large diff, but most of it comes from test files and
output.
This PR ads partial support for the following Stage3D shader features:
* Normal (square), rectangle, and cube textures
* Varying and temporary registers
* Lots of opcodes
The combination of these allows us to get a raytracing program
fully working in Ruffle. I've included it as image test.
Currently, this test is very slow (about 90 seconds on my machine),
as the code I'm using (https://github.com/saharan/OGSL ) includes
its own shader language and compiler. THe raytracing demo
first compiles its own shader language to AGAL, and then starts
rendering the scene.
Limitations:
* Many opcodes are still unimplemented
* Most non-default texture options (e.g. mipmaps) are not implemented
2023-03-03 15:58:46 -06:00
Aaron Hill
1d883688e0
avm2: Correctly check when toJSON is missing, and use vtable properties
...
We were previously calling `get_property` to determine if a `toJSON`
property exists, but that produces an error if the method is missing
on a sealed class.
Additionally, JSON serialization wasn't taking into account properties
from the vtable. All public properties (including fields, const fields,
and getter methods) get serialized.
Unfortunately, our vtable property order currently doesn't match
Flash's. I've hand-edited the test output for now (all of the actual
properties are there, just in a different order), and added a note
2023-03-03 15:34:26 -06:00
Adrian Wielgosik
1ba3ec0bf0
avm2: Implement BitmapData.getVector
2023-03-03 12:47:54 +01:00
Aaron Hill
a07ff36726
avm2: Implement describeType
...
This includes all of the XML elements described in 'describeType' docs.
Unfortunately, the order of elements produced by Flash depends on
the iteration order of internal hashtables. As a result, the test
manually stringifies an XML object, sorting the stringified children,
to produce consistent output between Flash and Ruffle.
2023-03-02 20:37:59 -06:00
Lord-McSweeney
a2150cbbbf
avm2: Implement IExternalizable interface
2023-03-02 01:32:43 -06:00
Nathan Adams
fcaa17308c
avm2: Workaround haxe calling addChild(this) before super()
2023-03-02 00:38:24 +01:00
Nathan Adams
bcc4e63144
core: Inline to_un_multiplied_alpha_accurate
2023-03-01 23:24:35 +01:00
Nathan Adams
6bcb64e52a
core: Use slightly more accurate to_un_multiplied_alpha version in copy_pixels to fix tests
2023-03-01 23:24:35 +01:00
Nathan Adams
6e5e8b13fc
core: Use a lookup table in Color::to_un_multiplied_alpha to match Flash's output
2023-03-01 23:24:35 +01:00
CUB3D
ceda614add
avm1: Don't use stack_push when the pushed value can't be an Object
2023-03-01 22:36:39 +01:00
CUB3D
4723c0414b
avm1: Remove resolved todos, add comment and test about known reference launder issue
2023-03-01 22:36:39 +01:00
CUB3D
af9810c22e
avm1: More scope fixes
2023-03-01 22:36:39 +01:00
CUB3D
6a5eb43274
avm1: Fix getVariable when path is an object+var and object is a clip
2023-03-01 22:36:39 +01:00
CUB3D
ca0e2488cb
avm1: Dont double borrow the cache, update test output
2023-03-01 22:36:39 +01:00
CUB3D
ae9538c3c7
avm1: Fix beta clippy
2023-03-01 22:36:39 +01:00
CUB3D
6d4c04c1c3
avm1: Cleanup todos, add even more tests
2023-03-01 22:36:39 +01:00
CUB3D
0d5258fa2a
avm1: Remove some mc todos
2023-03-01 22:36:39 +01:00
CUB3D
6ba75d6045
avm1: Refactor movieclip path logic
2023-03-01 22:36:39 +01:00
CUB3D
693e29a82d
avm1: Fix test failures
2023-03-01 22:36:39 +01:00
CUB3D
d1d38091ff
avm1: Fixup clippy lints and formatting
2023-03-01 22:36:39 +01:00
CUB3D
c6ff8a801b
avm1: Fallback to resolving properties on _root when the are not in the current scope
2023-03-01 22:36:39 +01:00
CUB3D
3d3f279160
avm1: In swfv5, resolving a non MovieClip path, should resolve to the first MovieClip parent
2023-03-01 22:36:39 +01:00
CUB3D
611c86df94
avm1: Temporary fix, block events when clips are removed
2023-03-01 22:36:39 +01:00
CUB3D
a282d06ab7
avm1: Locals on removed DisplayObjects can't be accessed, should be undef
2023-03-01 22:36:39 +01:00
CUB3D
a67976f601
avm1: Fix add2 coerce
2023-03-01 22:36:39 +01:00
CUB3D
1fdd8f1a82
avm1: Timers attached to clips don't fire when the clip is removed
2023-03-01 22:36:39 +01:00
CUB3D
9b850e7615
avm1: Correctly invalidate cache on clip removal
2023-03-01 22:36:39 +01:00
CUB3D
cb3d9f99a7
avm1: Cache MovieClips in Value::MovieClip, this is required to correctly handle changing DO._name and for perf
2023-03-01 22:36:39 +01:00
CUB3D
6a9e13814a
avm1: Don't convert SuperObjects to Value::MovieClip, or you break classes
2023-03-01 22:36:39 +01:00
CUB3D
de86a51edd
avm1: AS-instantiated clips with unload handlers need to have delayed removal, fixes mochi preloader
2023-03-01 22:36:39 +01:00
CUB3D
f3cb1fc79e
avm1: Treat MovieClips as strings in add2
2023-03-01 22:36:39 +01:00
CUB3D
e6d3a99d80
avm1: MovieClips are indirectly referenced by string paths
2023-03-01 22:36:39 +01:00
Nathan Adams
6a8846ef19
chore: Appease clippy
2023-03-01 21:25:19 +01:00
Nathan Adams
e33fdfb765
core: Add test to assert that *.foo.example.com matches foo.example.com
2023-03-01 21:25:19 +01:00
Nathan Adams
07ac03eb6c
core: Add names to compatibility rulesets
2023-03-01 21:25:19 +01:00
Nathan Adams
ca9749d1f2
core: Change from regex to custom domain matching in swf compatibility rewrites
2023-03-01 21:25:19 +01:00
Nathan Adams
b10d4876d3
web: Add compatibilityRules config option to disable all compatibility rules
2023-03-01 21:25:19 +01:00
Nathan Adams
ef42a391f5
core: Add default_compatibility_rules as a feature, and document when we add rules
2023-03-01 21:25:19 +01:00
Nathan Adams
1aedb7ff8d
core: Add CompatibilityRules struct for on-the-fly replacements for compatibility. Initially konggames -> kongregate.com rules
2023-03-01 21:25:19 +01:00
Aaron Hill
f282331204
core: Call `overwrite_cpu_pixels_from_gpu` just before we draw
...
If we bail out early, we want to preserve the current GPU -> CPU
sync.
2023-03-01 12:30:22 -06:00
Aaron Hill
076016b1be
avm2: Get XMLList 'filter' syntax working
...
This requires the ability to do a limited 'set_property',
as well as `get_enumerant_value`.
To prevent modification of XMLLists derived from queries,
I've introduced a `target` field on `XMLList`. This is
`None` for lists created with `new XMLList()`, and `Some`
when the list was derived from a query on an existing `XML`
/`XMLList`. We only allow `set_property` when `target` is `None`:
this is enough for filtering to work, and prevents silent incorrect
execution when trying to modify an existing node.
2023-03-01 12:04:02 -06:00
Aaron Hill
44a301e16a
avm2: Add `attribute` and `attributes` methods to `XML/XMLList`
2023-03-01 10:51:21 -06:00
Aaron Hill
1099218fdd
avm2: Stub Mouse.supportsCursor and Mouse.supportsNativeCursor
...
Since these are static properties, Ruffle previously (correctly)
returned `undefined` for SWFs that tried to access them, intead
of throwing an error.
2023-03-01 09:30:10 -06:00
Aaron Hill
78c9de7b8f
avm2: Fix constructing empty XMLList
...
A default empty text node should only be created for XML.
2023-03-01 15:57:34 +01:00
Daniel Jacobs
584cb4c1cf
web/ui: Open the virtual keyboard when clicking an editable EditText
2023-03-01 08:15:58 +02:00
Aaron Hill
61a664fec6
core: Produce an error when BitmapData.draw call is unsupported
2023-02-28 18:20:53 -06:00
EmperorBale
9338f1daa8
avm2: Fix default domain when loading movieclip
2023-02-28 13:04:24 -08:00
Marty_SVK
9c844678b5
avm2: Stub TextField.condenseWhite
2023-02-28 21:25:01 +01:00
relrelb
203788c1c8
core: Move `F64Extension` to `avm1`
...
Since it's only used there. Also rename the trait to `Clamp`.
2023-02-28 19:22:37 +02:00
relrelb
fe23eb0553
core: Introduce and use `F64Extension::clamp_to_i32`
...
Previously there were multiple implementations scattered across the
codebase. Unify them to a single place, in a more "Rusty" way (now
it's called via dot notation, rather than as a free function).
2023-02-28 19:22:37 +02:00
relrelb
b3fd1a47c6
core: Require `SwfMovie::url`
2023-02-28 19:05:20 +02:00
Lord-McSweeney
c01edc90bc
avm2: Stub `flash.text.StyleSheet` ( #9747 )
2023-02-28 16:35:47 +00:00
relrelb
cf0c32bd70
core: Remove some unused `RenderContext` fields
2023-02-28 17:48:57 +02:00
Nathan Adams
91a54f9e41
avm2: Use flags.set(foo) instead of |= foo
2023-02-28 16:25:12 +01:00
Nathan Adams
545193b098
swf: Deduplicate GradientFilter again
2023-02-28 16:25:12 +01:00
Nathan Adams
07d441a750
core: Don't impl FilterAvm2Ext for individual Filter structs
2023-02-28 16:25:12 +01:00
Nathan Adams
f79015e201
render: Use swf Filter types where possible. Gradient types had to be split into duplicate classes to allow for different trait impls based on which gradient filter type it is.
2023-02-28 16:25:12 +01:00
Nathan Adams
b8f7c66980
core: map_point in DisplacementMapFilter is i32 not u32
2023-02-28 16:25:12 +01:00
Nathan Adams
30a114a441
tests: Add avm2/convolution_filter test for swf->core->avm2 and avm2->core->avm2 testing
2023-02-28 16:25:12 +01:00
Nathan Adams
3777210117
core: Angle from swf tag is in radians, convert it to degrees
2023-02-28 16:25:12 +01:00
Nathan Adams
acc3180db7
core: Strength in filters is a f32, not u8
2023-02-28 16:25:12 +01:00
Nathan Adams
fc00ae8eb6
core: Load filters from PlaceObject tag
2023-02-28 16:25:12 +01:00
Nathan Adams
1408252ca3
core: Switch DisplayObjectBase::filters from avm2 objects to Vec<Filter>
2023-02-28 16:25:12 +01:00
Nathan Adams
e39fbe871d
render: Add Filter::GradientGlowFilter
2023-02-28 16:25:12 +01:00
Nathan Adams
bb38a7fa55
render: Add Filter::GradientBevelFilter
2023-02-28 16:25:12 +01:00
Nathan Adams
c8030d047d
render: Add Filter::GlowFilter
2023-02-28 16:25:12 +01:00
Nathan Adams
c9656c429e
render: Add Filter::DropShadowFilter
2023-02-28 16:25:12 +01:00
Nathan Adams
dbe2efff00
render: Add Filter::DisplacementMapFilter
2023-02-28 16:25:12 +01:00
Nathan Adams
f9c7303f01
render: Add Filter::ConvolutionFilter
2023-02-28 16:25:12 +01:00
Nathan Adams
9c1f6ea129
render: Add Filter::BevelFilter
2023-02-28 16:25:12 +01:00
Nathan Adams
5ee3a4b512
avm2: Extract out the Value -> Filter logic into a trait
2023-02-28 16:25:12 +01:00
Aaron Hill
54eb6e33ca
avm2: Ignore XML comments and processing instructions by default
...
This matches the default value of the settings on XML.
2023-02-27 15:53:39 -06:00
EmperorBale
4adb7853b7
avm2: Add concurrent classes
2023-02-27 12:27:37 -08:00
EmperorBale
d166295ee1
avm2: Add Telemetry class
2023-02-27 12:13:16 -08:00
Aaron Hill
82d03b4062
avm2: Ignore XML declaration and doctype
...
These are completely ignored by AVM2
2023-02-27 13:41:18 -06:00
Aaron Hill
c04b463f1f
avm2: Implement XML.children, XMLList.children, and related methods
2023-02-27 13:25:16 -06:00
Aaron Hill
7f58b92348
avm2: Implement encodeURI and encodeURIComponent
2023-02-27 12:40:39 -06:00
Nathan Adams
cfcd257932
avm2: Xml(foo) converts foo to string
2023-02-27 17:37:28 +01:00
Nathan Adams
38d1478ffa
avm2: Implement Sprite.hitArea
2023-02-27 16:28:14 +01:00
renovate[bot]
71e24eedba
fix(deps): update rust dependencies
2023-02-27 11:48:53 +02:00
relrelb
dc9ec40d31
chore: Allow `clippy::bool_to_int_with_if`
...
Seems like Clippy no longer complains about it.
2023-02-26 13:23:38 +02:00
Lord-McSweeney
6630222ba9
avm2: Stub flash.profiler.showRedrawRegions ( #9732 )
2023-02-25 19:52:45 -05:00
Aaron Hill
f9fc4b3179
avm2: Store interfaces from superclases/superinterfaces in ClassObject ( #9728 )
2023-02-25 23:57:50 +00:00
Aaron Hill
c7709dffec
avm2: Handle Event::CData when parsing XML
2023-02-25 17:26:31 -06:00
Adrian Wielgosik
55c59da6ac
avm2: Convert TextFormat to AS
2023-02-25 23:55:43 +01:00
Adrian Wielgosik
35120e9fdc
avm2: Convert Graphics to AS
2023-02-25 23:55:43 +01:00
Adrian Wielgosik
b9dc8a4d52
avm2: Do not box primitives when doing AS-level coercions
2023-02-25 23:31:17 +01:00
Adrian Wielgosik
e063d5b5a8
avm2: Fix coerce_to_boolean on boxed primitives
2023-02-25 23:31:17 +01:00
Lord-McSweeney
16b724246c
Remove stub mention from BitmapData
2023-02-25 23:12:39 +01:00
Lord-McSweeney
f14ef0a4dd
Cleanup globals.as
2023-02-25 23:12:39 +01:00
Lord-McSweeney
9c8f99e9ce
Use AvmError instead of RustError when throwing argumentError in Stage.
2023-02-25 23:12:39 +01:00
Lord-McSweeney
91ae3ae31e
Port Stage overrides to ActionScript
...
And throw IllegalOperationError s.
2023-02-25 23:12:39 +01:00
Lord-McSweeney
e72a935f1b
Move IllegalOperationError up so Stage can use it
2023-02-25 23:12:39 +01:00
Aaron Hill
b26f2fd6fb
avm2: Initial incomplete implementation of XML ( #9647 )
2023-02-25 20:06:36 +00:00
Aaron Hill
dfee80e981
avm2: Mention interfaces in globals.as ordering comment
2023-02-24 16:08:29 -06:00
Aaron Hill
82a3f473d9
avm2: Move some class definitions after playerglobal is loaded
2023-02-24 16:08:29 -06:00
Aaron Hill
62767213a6
avm2: Use 'flash.events' internal namespace for EventDispatcher
2023-02-24 16:08:29 -06:00
Aaron Hill
24e231ae06
avm2: Convert TextField to AS
2023-02-24 16:08:29 -06:00
Aaron Hill
337149ff0e
avm2: Add TextFormat AS stub
2023-02-24 16:08:29 -06:00
Aaron Hill
bc240db517
avm2: Convert SimpleButton to AS
2023-02-24 16:08:29 -06:00
Aaron Hill
d31c686360
avm2: Convert MovieClip to AS
2023-02-24 16:08:29 -06:00
Aaron Hill
aa7dc52b82
avm2: Convert Sprite to AS
2023-02-24 16:08:28 -06:00
Aaron Hill
d996aecb04
avm2: Convert Shape to AS
2023-02-24 16:08:28 -06:00
Aaron Hill
39063a5a04
avm2: Add Graphics stub
2023-02-24 16:08:28 -06:00
Aaron Hill
8831042e8f
avm2: Convert LoaderInfo to AS
2023-02-24 16:08:28 -06:00
Aaron Hill
be16286407
avm2: Convert several flash.display and flash.events classes to AS
...
These classes all reference each other, so it's difficult to convert
them individually.
2023-02-24 16:08:28 -06:00
Aaron Hill
6ce7bd3277
avm2: Convert EventDispatcher and IEventDispatcher to AS
2023-02-24 16:08:28 -06:00
Aaron Hill
cd2770ce7e
avm2: Add SoundTransform stub
2023-02-24 14:48:51 -06:00
EmperorBale
99aa274e0f
avm2: Stop loading scripts in reverse order
2023-02-24 11:55:58 -08:00
EmperorBale
5bc3c696b5
avm2: Ignore duplicate definitions
2023-02-24 11:55:58 -08:00
feos
871a4d053d
core: add framerate to SWF load log
...
fixes #8531
2023-02-24 12:13:00 +02:00
TÖRÖK Attila
5a7cd92bfe
avm2: Use a lookup table for cosine in SoundMixer.computeSpectrum()
...
This results in 128 times fewer calls to the builtin cosf function.
2023-02-23 23:51:55 +01:00
Aaron Hill
5f4bf7b5fa
avm2: Stub Capabilities.manufacturer and Capabilities.language
...
These are needed by Steambirds: Survival
2023-02-23 12:25:34 -06:00
Nathan Adams
3a29ebc600
avm2: Comment where our RangeErrors have different-to-flash text in DOC
2023-02-23 08:12:42 -06:00
Nathan Adams
5f7978cfa5
avm2: Use avm errors for RangeErrors inside DisplayObjectContainer
2023-02-23 08:12:42 -06:00
Nathan Adams
e17b154d47
avm2: Iterate the inheritance chain for class-symbol linkage
2023-02-22 22:27:13 +01:00
Aaron Hill
203d4cd3aa
avm2: Use Value::Undefined for out-of-range Vector enumerant index
...
This makes Vector consistenht with the other implementations
of `get_enumerant_name`. This also fixes a bug where AMF object
serialization would loop all te way to `u32::MAX` when serializing
a vector, because it would never see `Value::Undefined` and break.
2023-02-22 15:03:09 -06:00
Aaron Hill
f1b0247de7
avm2: Remove install_trait_late
2023-02-22 14:41:01 -06:00
Aaron Hill
c52f1082c4
avm2: Make `early_resolve_interface` take in a `domain` directly
2023-02-22 14:41:01 -06:00
Aaron Hill
c258423dc3
avm2: Allow resolving interfaces before ClassObjects are available
...
The Adobe Animate compiler can emit a 'newclass' opcode for
a concrete class before the 'newclass' opcodes for the interfaces
it implements. As a result, we cannot rely on looking up an interface
`ClassObject` when resolving a class's interfaces.
We now store a map of exported classes in `Domain`, and use this
to lookup interfaces before their `ClassObject`s have been created.
Additionally, `link_interfaces` was failing to consider superinterfaces,
which meant that methods from superinterfaces were not being copied
into the vtable. I've fixed this along with the other changes.
2023-02-22 14:41:01 -06:00
Bale
2cfa97e84d
avm2: ByteArray.readUTF/readUTFBytes should cut off after null byte ( #9673 )
...
* avm2: Fix #9668
* tests: Extend ByteArray test
2023-02-22 18:47:59 +00:00
Marty_SVK
fac7fc0666
Stub System.pauseForGCIfCollectionImminent
...
This progresses Papas Scooperia
2023-02-22 12:34:13 -06:00
Nathan Adams
e8fcc8b194
avm2: Don't reset SimpleButtons that are created by scripts
2023-02-22 18:49:04 +01:00
Nathan Adams
aef466f8f3
avm2: Implemented BitmapData.drawWithQuality
2023-02-22 17:36:55 +01:00
Nathan Adams
6539262db7
render: Add Quality option to RenderBackend::render_offscreen
2023-02-22 17:36:55 +01:00
nosamu
70bf0a816a
core: Add options to set and force stage scale mode
2023-02-22 12:13:20 +02:00
nosamu
a505d7a6d3
core: Fix off-by-one bug with clipDepth
2023-02-21 16:39:42 +02:00
Adrian Wielgosik
f7a12698b9
core: Implement Color::to_premultiplied_alpha without floats
2023-02-19 22:25:34 +01:00
Adrian Wielgosik
92e52f2d0a
avm2: Add missing imports
2023-02-19 19:06:54 +01:00
Lord-McSweeney
89792865d0
avm2: Stub Loader.close
2023-02-18 18:35:20 +00:00
Aaron Hill
3327a9a3fd
core: Set clipDepth to 0 when swapDepths affects a clip
...
This makes "Garfield's Comic Creator" properly show
panels when you close the editor.
2023-02-17 23:11:57 -06:00
EmperorBale
158de01c92
avm2: `goto_frame` should use the movieclips scene by default
2023-02-17 18:46:43 -08:00
Aaron Hill
071306f107
avm2: Also register EventDispatcher methods in ns "flash.events:IEventDispatcher"
...
This is needed by "Steambirds: Survival"
2023-02-17 20:32:27 -06:00
EmperorBale
bc165a81ff
chore: Add comment explaining why we skip the first scope
2023-02-18 01:37:12 +01:00
EmperorBale
7ef56c1d16
avm2: Search global scope after everything else
2023-02-18 01:37:12 +01:00
CUB3D
f7b0c021a9
avm1: The this property should be mutable
2023-02-17 14:39:10 -06:00
Aaron Hill
4149913967
core: Introduce dedicated avm2 mouse picking logic ( #9565 )
...
The mouse picking behavior in AVM2 interacts in complicated
ways with `mouseEnabled` and `mouseChildren.` It's sufficiently
different from AVM1 that I decided to split the logic into separate
`mouse_pick_avm1` and `mouse_pick_avm2` methods.
The `mouseChildren` property is now fully implemented.
Additionally, the `click_block` tests now work correctly
under Ruffle.
Combined with the orphan-movie PR, this is enough to make
SteamBirds fully playable (though performance greatly degrades
over a course of a level).
2023-02-17 19:04:52 +00:00
Lord-McSweeney
559ec8356d
Port Video to Actionscript
2023-02-16 22:46:11 +02:00
relrelb
a7235febea
core: Use unnamed field in `Character::Bitmap`
...
Since `initial_data` was removed from `Character::Bitmap` in #9143 ,
it now holds a single field. Move back to an unnamed field, which
aligns with the other `Character` enum variants.
2023-02-16 19:02:57 +02:00
TÖRÖK Attila
77cfb5ab4c
core: Fix a clippy lint when building without the "mp3" feature.
2023-02-16 06:23:35 +01:00
EmperorBale
0ffdef48ab
avm2: Implement `finddef` opcode
2023-02-14 14:22:02 -08:00
Nathan Adams
eb35d6217b
avm2: DoAbc (72) seems to imply lazy loading
2023-02-14 08:51:45 +01:00
Nathan Adams
94fdc8bdb5
avm2: Support older DoAbc tag (72)
2023-02-14 08:51:45 +01:00
Nathan Adams
69f93f926e
swf: Rename DoAbc to DoAbc2
2023-02-14 08:51:45 +01:00
Adrian Wielgosik
5eb887c628
avm2: Stub describeType to have .@name work
2023-02-13 23:55:00 +01:00
Nathan Adams
a4fc39efcd
avm2: Copy Regexp methods to the Regexp prototype
2023-02-13 21:31:46 +01:00
Nathan Adams
899635f658
avm2: Copy Array methods to the Array prototype
2023-02-13 21:31:46 +01:00
Aaron Hill
a52a41de97
core: Fix stageX and stageY getters for MouseEvent
...
These getters were previously calling `local_to_global`
with the unused localX/localY coordinate set to 0. Howver,
`local_to_global` does a matrix multiplication, which in general
will depend on both the x and y values. This was causing the getters
to return incorrect results when any of the `transform.matrix` values
included a non-diagonal matrix.
We now call `local_to_transform` with the real `localX` and `localY`
values.
2023-02-13 21:19:20 +01:00
Nathan Adams
081387e047
avm2: Stub TouchEvent
2023-02-13 05:35:18 +01:00
renovate[bot]
a27bd66b58
fix(deps): update rust dependency patches
2023-02-13 04:59:31 +01:00
Aaron Hill
c597f9f996
core: Fix Clippy lints on nightly
2023-02-13 03:38:54 +01:00
renovate[bot]
fed24aa243
fix(deps): update rust dependencies - wasm-bindgen related
2023-02-13 02:57:52 +01:00
Lord-McSweeney
b848ab6860
Fix stub in DisplayObjectContainer
...
In mouse_children
2023-02-13 00:42:28 +01:00
Lord-McSweeney
eb7a96f55b
Fix stub types in security.rs
...
Change from avm2_stub_getter to avm2_stub_method
2023-02-13 00:42:28 +01:00
Adrian Wielgosik
561e118ffe
avm2: Export private traits normally, remove private_trait_scripts hack
2023-02-12 17:49:14 +01:00
Adrian Wielgosik
f717b99599
avm2: Compare private namespaces by pointer. Refactor rust-avm field sharing.
2023-02-12 17:49:14 +01:00
Adrian Wielgosik
e0e653e463
avm2: make Namespace a GC type
2023-02-12 17:49:14 +01:00
Aaron Hill
4e0dce2efa
core: Make SandboxType configurable, and set to 'remote' on web
...
The Newgrounds API checks `Security.sandboxType` to see if it should
run in debug mode or not (which determines whether or not medals
can actually be unlocked).
For now, desktop continues to use `localTrusted` as the default,
while web now uses `remote`. We might want to make this configurable
at some point, but this should be good enough for now (and better
match Flash's behavior).
2023-02-11 14:44:11 -06:00
Aaron Hill
9bce6b78d5
core: Queue up Sound and SoundChannel methods during loading
...
Flash supports calling `Sound.play`, `SoundChannel.stop`, and
`SoundChannel.soundTransform` while a sound load is in progress
(e.g. immediately after calling `Sound.load`).
To support this, we queue up information inside `SoundObject`
and `SoundChannelObject` when a load is in progress. When a load
completes, we trigger any queued `Sound.play` and `SoundChannel.stop`
calls, and apply the most recent `SoundChannel.soundTransform`
2023-02-11 11:53:56 -06:00
Aaron Hill
51fe1e9754
core: Handle `DirtyState::CpuModified` in `overwrite_cpu_pixels`
...
If we're going to overwrite the CPU pixels with the result of a
GPU operation, make sure the GPU texture is up to date with the
latest CPU pixels. I've also renamed the method to
`overwrite_cpu_pixels_from_gpu` to better reflect how it should
be used.
2023-02-11 11:37:00 -06:00
Bale
73e9fd55fb
avm2: Make sure scripts get initialized after all scripts have been loaded when lazy init is disabled ( #9478 )
...
* avm2: Initialize scripts **after** all scripts have been loaded
* tests: Add test for eager initialization
2023-02-11 00:38:38 +00:00
Aaron Hill
4b76d1b32a
core: Support using URLVariables as a POST request body ( #9489 )
...
This is needed by the Newgrounds API. We don't have the ability
to make fake requests to HTTP urls in our test frameworks,
so I haven't added any tests for this. However, I tested locally
that this allows the Newgrounds API to work (and got a medal
in Cloud Wars).
2023-02-11 00:18:10 +00:00
nosamu
c1fe3ded25
chore: remove unnecessary FromStr impl for LoadBehavior
2023-02-10 00:56:17 -08:00
nosamu
1a65a0942c
desktop: Add --letterbox option
2023-02-09 23:43:25 -08:00
EmperorBale
e7612f571d
avm2: Implement ScopeChain caching
2023-02-09 10:51:12 -08:00
golfinq
37ec94f95b
Avm2: Implement Stage.invalidate
2023-02-08 17:47:21 -07:00
Aaron Hill
a818dd0918
core: Use colorTransform in DisplayObject.setTransform
2023-02-08 20:56:46 +01:00
Adrian Wielgosik
61a5161a20
avm2: Convert most errors in get/set/initproperty to AVM errors
2023-02-07 18:50:15 -06:00
Adrian Wielgosik
c844d2ab6f
avm2: Only store actually-passed arguments to 'arguments'
2023-02-07 18:35:30 -06:00
Nathan Adams
ac9b6e3ecb
avm2: Mark Dictionary(true) and TimerEvent.updateAfterEvent() as stubs
2023-02-07 20:34:59 +01:00
Nathan Adams
e5f44b0f05
avm2: Replaced stubs in actionscript with new stub system
2023-02-07 20:34:59 +01:00
Nathan Adams
bdbf54ecd4
core: Added ability to mark stubs inside actionscript
2023-02-07 20:34:59 +01:00
Nathan Adams
dff558170e
avm2: Implement BitmapData.getPixels()
2023-02-07 19:10:25 +01:00
Nathan Adams
25cc6f3243
avm2: Change MovieClip::frame_scripts to Vec<Option<Avm2Object>>, where index is frame num
2023-02-07 18:26:27 +01:00
Nathan Adams
43d9c3deed
avm2: Make sure SoundChannel.soundTransform always returns a value
2023-02-07 18:26:27 +01:00
Nathan Adams
bc7773596b
avm2: addFrameScript allows null to unset the script, and only allows one script per frame
2023-02-07 18:26:27 +01:00
CUB3D
48f4df51a5
avm1: Correct depth calculation for AVM1 clips pending removal and add tests
2023-02-06 10:53:45 -07:00
CUB3D
2d11a250da
avm1: Retrieving the child of a container should prioritise lowest depth
2023-02-06 10:53:45 -07:00
CUB3D
a356be15fe
avm1: Only delay removals on AVM1, check for dynamic unload handlers
2023-02-06 10:53:45 -07:00
CUB3D
755425ebfa
avm1: Delay clip removals when a child has an unload listener
...
When removing a clip, first check if it has an unload event listener somewhere
it's hierarchy.
If it does, enqueue the removal to happen on the next frame, by moving it to a negative depth.
2023-02-06 10:53:45 -07:00
Nathan Adams
50fd7aeff5
core: Add quality options to the context menu
2023-02-06 16:08:04 +01:00
Nathan Adams
a220703618
core: Made PlayerBuilder take quality instead of setting it after the Player was made
2023-02-06 16:08:04 +01:00
Nathan Adams
d8e924affc
render: Add RenderBackend::set_quality method, and call it from core
2023-02-06 16:08:04 +01:00
Nathan Adams
12bd38b338
core: Changed Player::set_quality to take in a StageQuality directly
2023-02-06 16:08:04 +01:00
Nathan Adams
b270d1bbd7
render: Move StageQuality from core to render
2023-02-06 16:08:04 +01:00
Nathan Adams
00c7e8f634
avm2: Fixed bytearray compress/decompress methods setting position of resulting bytearray
2023-02-05 19:22:01 +01:00
Nathan Adams
e798d69299
avm2: Convert ByteArray EOF to avm error
2023-02-05 19:22:01 +01:00
Nathan Adams
c14f022837
core: Use overwrite_cpu_pixels in apply_filter
2023-02-05 18:41:43 +01:00
Nathan Adams
7476b3b0e0
avm2: Added a bunch of missing filter classes
2023-02-05 18:41:43 +01:00
Nathan Adams
42f3ee923f
avm2: Mark unsupported filters as stubs
2023-02-05 18:41:43 +01:00
Nathan Adams
3411a04cef
render: Made render specific Filter enum & structs, as swf ones don't map 1:1 to potential filters
2023-02-05 18:41:43 +01:00
Nathan Adams
b5a250e16f
render: Changed render_offscreen to return an Option instead of an Result
2023-02-05 18:41:43 +01:00
Nathan Adams
e73389aa71
wgpu: Implement blur filter
2023-02-05 18:41:43 +01:00
Nathan Adams
284a58c817
avm2: Implement BitmapData.apply_filter for ColorMatrixFilter
2023-02-05 18:41:43 +01:00
Lord-McSweeney
a369e71af6
Appease clippy again
2023-02-03 23:32:22 +01:00
Lord-McSweeney
83087f9f23
Change stubs to use new macro method
2023-02-03 23:32:22 +01:00
Lord-McSweeney
a6ea1ef4a7
Appease clippy
2023-02-03 23:32:22 +01:00
Lord-McSweeney
add115e97f
State "Stub" instead of "Implement"
...
...and fix a format issue.
2023-02-03 23:32:22 +01:00
Lord-McSweeney
963f3240f2
Stub DisplayObject.opaqueBackground
2023-02-03 23:32:22 +01:00
nosamu
12c67d5068
desktop: Improve --help messages
2023-02-03 21:17:56 +01:00
Nathan Adams
198e40fd2e
avm2: Changed return values of a bunch of stubs per PR feedbck
2023-02-01 21:45:12 +01:00
Nathan Adams
8e917c473e
avm2: Replaced stubs in Proxy with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
b28e921fb9
avm2: Replaced stubs in Keyboard with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
99e723a1cb
avm2: Replaced stubs in TextField with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
2a36f9b871
avm2: Replaced stubs in StaticText with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
ff768a1e73
avm2: Replaced stubs in Font with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
af73a1a292
avm2: Replaced stubs in Security with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
e48926799c
avm2: Replaced stubs in SharedObject with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
408482cd21
avm2: Replaced stubs in ObjectEncoding with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
69101af66b
avm2: Replaced stubs in SoundMixer with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
834ac93350
avm2: Replaced stubs in Sound with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
cb1fa72d6f
avm2: Replaced stubs in Transform with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
a576903f0c
avm2: Replaced stubs in IndexBuffer3D with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
24169a3577
avm2: Replaced stubs in Stage with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
6a6e81ad6a
avm2: Replaced stubs in LoaderInfo with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
33dbe82b4f
avm2: Replaced stubs in InteractiveObject with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
46ed595186
avm2: Replaced stubs in Graphics with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
0abfb79c62
avm2: Replaced stubs in DisplayObjectContainer with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
0e522fd58b
avm2: Replaced stubs in displayobject with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
fb0578ee26
avm2: Replaced stubs in bitmapdata with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
10ec9a1a74
avm2: Replaced stubs in namespace with new format (but still err as I don't know what to return otherwise)
2023-02-01 21:45:12 +01:00
Nathan Adams
8f53f5414c
avm2: Replaced stubs in bitmap with new format
2023-02-01 21:45:12 +01:00
Nathan Adams
44981af409
avm1: Replaced all existing stub warnings with new stub system
2023-02-01 21:45:12 +01:00
Nathan Adams
366f8bef43
core: Add feature known_stubs to retrieve all known stubs
2023-02-01 21:45:12 +01:00
Nathan Adams
4a0529dedc
core: Add Stub and StubCollection for tracking stubs used during a movie
2023-02-01 21:45:12 +01:00
renovate[bot]
caaf6d5c87
fix(deps): update rust dependencies
2023-01-31 09:39:42 -06:00
nosamu
5ee3b821dd
core: Fix DO render tree display
2023-01-29 11:58:59 -06:00
Moulins
e36b03bce9
core::html: correctly encode text in FormatSpans::to_html
...
Fixes issue #9327
2023-01-29 11:19:16 -06:00
CUB3D
f829157deb
avm1: Defining a local that already exists on the target of a with scope, defines it on the target not the parent
2023-01-29 18:05:25 +01:00
Aaron Hill
c6eb25194e
core: Bump flash-lso to latest commit
...
This deduplicates some dependencies, and removes
a future-incompat warning from `nom`.
2023-01-29 17:31:10 +01:00
Nathan Adams
85dc100ee9
avm2: Implement Sprite.dropTarget - though it's wrong right now
2023-01-29 00:52:52 +01:00
Daniel Jacobs
6697848b92
avm1: Don't ignore mouse_pick on static text ( fix #9274 )
2023-01-29 00:39:06 +01:00
Daniel Jacobs
b00628f45d
avm2: Add warning to MouseEvent.updateAfterEvent
2023-01-28 14:31:52 -06:00
Daniel Jacobs
65a0aaeb7b
avm2: Stub MouseEvent.updateAfterEvent
...
Basically a direct copy of https://github.com/ruffle-rs/ruffle/pull/7653
2023-01-28 14:31:52 -06:00
Aaron Hill
7ba960987c
core: Display class name in ErrorObject debug impl
...
This lets us know something about the type of error
that was thrown, and doesn't require an Activation/UpdateContext.
2023-01-24 20:38:45 -06:00
TÖRÖK Attila
e77b1e379c
core/audio: mp3: Use MpaReader instead of the deprecated Mp3Reader from Symphonia
2023-01-24 20:10:40 -06:00
renovate[bot]
8b6eef1715
fix(deps): update rust dependencies
2023-01-24 20:10:40 -06:00
Daniel Jacobs
0a04b22a79
avm2: Stub simple flash.text.engine enums
2023-01-23 13:51:26 -06:00
MartySVK
ad688b45da
avm2: added Stage.fullScreenSourceRect stub ( #9265 )
...
* avm2: added Stage.fullScreenSourceRect
* fixing checks I hope
2023-01-22 16:29:12 -05:00
Aaron Hill
e2954821ea
core: Take two - delay reading image back from render backend using `SyncHandle` ( #9184 )
...
* Take two: Delay reading image back from render backend using `SyncHandle`
This allows us to avoid blocking immediately after a `BitmapData.draw` call.
Instead, we only attempt to use the `SyncHandle` when performing an operation
that requires the CPU-side pixels (e.g. BitmapData.getPixel or BitmapData.setPixel).
In the best case, the SWF will never explicitly access the pixels of
the target BitmapData, removing the need to ever copy back the render backend
image to our BitmapData. If the SWF doesn't require access to the pixels immediately,
we can delay copying the pixels until they're actually needed, hopefully allowing
the render backend to finish processing the BitmapData.draw operation in
the backenground before we need the result.
Now that the CPU and GPU pixels can be intentionally out of sync with
each other, we need to ensure that we don't accidentally expose 'stale'
CPU-side pixels to ActionScript (which needs to remain unaware of
our internal laziness). We now use a wrapper type `BitmapDataWrapper`
to enforce that the `SyncHandle` is consumed before accessing the
underlying `BitmapData.
* core: Skip GPU->CPU sync for source and target BitmapData during draw
* Introduce DirtyState enum
2023-01-21 21:08:04 +00:00
MartySVK
6d5f6385a5
avm2: added TextField.restrict stub ( #9218 )
...
* added TextField.restrict stub
Co-authored-by: Martin Mravec <marty.devil@gmail.com>
2023-01-19 22:23:33 -05:00
Adrian Wielgosik
fb4d2d3f04
avm2: Implement TextField.maxChars
2023-01-19 01:24:47 +01:00
Nathan Adams
5f72ebaef9
core: Don't call avm2 callstack method if there's no callstack
2023-01-19 00:50:56 +01:00
Nathan Adams
f5d69f5ad8
avm2: Corrected panic messages in date code
2023-01-16 21:48:00 +01:00
EmperorBale
3287173da3
avm2: Fix edge case when setting fullYear of date
2023-01-16 21:48:00 +01:00
EmperorBale
6bb079cc60
avm2: Remove some useless else statements in date
2023-01-16 21:48:00 +01:00
MrCheeze
ebe5eed143
avm2: Fix corner case when goto same frame multiple times ( close #9018 )
...
This change makes it so that if there is a goto to a specific frame,
then a frame script is registered for that frame, and then a goto to the
same frame again, the frame script will not be skipped. At least one movie
appears to depend on this behaviour.
2023-01-16 18:37:19 +01:00
nosamu
952aa2d5f9
avm2: Correct name of rollover event
2023-01-14 20:04:33 +01:00
Aaron Hill
3a6c8d9796
core: Use BitmapData instead of separate `initial_data` field
...
Now that a `Bitmap` always stores a `BitmapData`, we can read the pixels
directly from the `BitmapData`, instead of duplicating them in an
`initial_data` field
2023-01-14 01:28:22 -05:00
Aaron Hill
b5796f9016
core: Derive Default for FramePhase
2023-01-13 20:37:52 +01:00
Calvin304
6c71f5b2a6
avm2: Naive DefineButtonSound impl for Avm2Button
2023-01-11 17:45:39 -05:00
Nathan Adams
9cd850d30e
render: Make render_offscreen return a sync handle which can be used to get the texture at a later time
2023-01-11 16:53:33 -05:00
Nathan Adams
133044b06b
avm2: Fix start_drag with negative width or height
2023-01-11 00:09:01 +01:00
MrCheeze
0597ae56e6
core: Make AVM2 frame labels case sensitive
2023-01-10 11:28:56 -05:00
renovate[bot]
630558a936
fix(deps): update rust dependencies
2023-01-10 16:37:40 +01:00
Moulins
3b1c981d25
Clears the AVM1 stack after executing bytecode
...
AVM1 bytecode may leave the operand stack unbalanced, and this will
cause a slow memory leak if the stack is never cleared.
2023-01-10 14:14:17 +01:00
CUB3D
c6bd431864
avm1: Deduplicate threshold operations
2023-01-10 13:59:06 +01:00
CUB3D
ea6ea8074a
tests: Add tests for BitmapData.threshold, fix issues found as a result
2023-01-10 13:59:06 +01:00
CUB3D
70f071b347
avm1: Implement Bitmapdata.threshold
2023-01-10 13:59:06 +01:00
CUB3D
8db909a7d4
desktop: Allow specifying player version
2023-01-10 13:13:30 +01:00
MrCheeze
bf6342bd4b
avm2: Fix hitTestPoint not transforming coordinates to world space
...
This behaviour is essentially copied from avm1 movie_clip.rs's hit_test.
Seems to fix several flashes that had broken collision until now.
2023-01-10 12:53:20 +01:00
Nathan Adams
724609e323
audio: Don't panic when reading an invalid mp3, bubble the error up
2023-01-10 11:10:46 +01:00
Nathan Adams
3b24d849e7
audio: Removed unwraps in mixer.rs and replaced with reasoned expects
2023-01-10 11:10:46 +01:00
Nathan Adams
7a9e8b4771
core: Made NullNavigatorBackend no longer use unwraps
2023-01-10 11:10:46 +01:00
CUB3D
84d0111a14
avm1: Add test for with scope nesting
2023-01-10 10:34:10 +01:00
CUB3D
ca82ff65de
avm1: Defining a local in a with scope should actually define it on the parent scope
2023-01-10 10:34:10 +01:00
Nathan Adams
a37e070724
core: Use Color::WHITE for draw_rect when we don't care, as it's just identity color transform and thus cheaper
2023-01-10 09:39:28 +01:00
Nathan Adams
53d6fa4d8b
render: Make render commands take in an actual value, not ref for immediate cloning
2023-01-10 09:39:28 +01:00
Adrian Wielgosik
14ee9b43fb
avm2: Replace ok_or by ok_or_else
2023-01-09 21:01:39 +01:00
Aaron Hill
40d8751d67
avm2: Implement clipRect parameter for BitmapData.draw
2023-01-08 16:11:55 -05:00
Aaron Hill
1b71e288fd
Remove 'gc_context lifetime
...
The latest `gc-arena` makes this unnecessary - we can just
use our `'a` lifetime for `MutationContext`
2023-01-06 19:20:39 -05:00
Moulins
d332a174c3
Bump `gc-arena` to current master revision
...
This required small changes to some Debug impls that were missed in #8964
2023-01-06 18:22:43 -05:00
Nathan Adams
a7738bec69
core: Added a few simple tracing::instruments
2023-01-06 04:25:22 +01:00
Nathan Adams
13fd830e7c
core: Switch from log to tracing
2023-01-06 04:25:22 +01:00
MrCheeze
71fcd383a3
avm2: Add ctrlKey, altKey, shiftKey, controlKey properties to KeyboardEvent
2023-01-04 16:27:09 -05:00
Nathan Adams
4d948616db
avm1: Implement BitmapData.draw with blend mode, fixes #8920
2023-01-04 12:09:08 -05:00
Nathan Adams
cd550457e1
core: Made TDisplayObject::movie() no longer an Option<>
2023-01-04 08:20:08 +01:00
Nathan Adams
40a7bb04d6
core: Removed default impl of TDisplayObject::movie(), implement it everywhere
2023-01-04 08:20:08 +01:00
Aaron Hill
10491a1be9
core: Store data in `BitmapData` instead of `Bitmap`
...
This makes `Bitmap` delegate to `BitmapData` for
all of the bitmap-related information (handle, width, and height).
As a result, we now unconditionally store a `BitmapData` in `Bitmap`.
As a result, swapping the underling `BitmapData` instance will
automatically change the properties (and rendered image) of a `Bitmap`.
This required some refactoring in the render backends in order to
get access to a `BitmapHandle` through `BitmapData`.
2023-01-03 18:01:41 -07:00
MrCheeze
41df7fdc59
avm2: For old swf versions, invalid goto labels jump to frame 1 ( fix #8954 )
...
The regression test for this was edited directly in JPEXS, so there is
no corresponding fla to compile into the swf.
2023-01-03 17:10:06 -07:00
MrCheeze
77104ca473
avm2: Improve accuracy of gotoAndPlay / gotoAndStop (partially fix #8954 )
...
Partially based on AVM1 implementation, partially based on the new
regression tests added in this commit.
2023-01-03 17:10:06 -07:00
nosamu
664a86161a
avm2: Fix `for each..in` loops over Dictionary values
2023-01-03 16:52:15 -07:00
Moulins
27307d847a
core: Replace some derived Debug impls with manual ones
...
In future versions of `gc-arena`, the `Debug` impl. of `Gc`
and `GcCell` will print the pointed-to value, which will cause
derived `Debug` impls. to enter an infinite recursion.
As such, this manually implements `Debug` on types wrapping a
`Gc/GcCell` to maintain the current behavior.
2023-01-03 18:03:23 -05:00
Nathan Adams
5a7ec70254
core: Remove blend mode unsupported message
2023-01-03 03:39:13 +01:00
Nathan Adams
ded46e20e7
render: Replace PushBlendMode/PopBlendMode with Blend
2023-01-03 03:39:13 +01:00
EmperorBale
a51ffd0e9f
avm2: Strings passed to date constructor should be parsed
2023-01-02 11:43:03 -08:00
EmperorBale
ab3a1e6148
avm2: Move date parsing into a separate function
2023-01-02 11:43:03 -08:00
MrCheeze
bf18334294
avm2: Fix calling setTextFormat without providing a beginIndex and EndIndex
...
Previous behaviour defaulted to undefined and applied the format to the
range [0,0) instead of defaulting to -1 and applying the format to the
full length of the TextField.
2023-01-01 21:03:12 -08:00
Aaron Hill
9d6763510b
core: Remove redundant 'clone' calls
2022-12-31 17:13:55 -05:00
nosamu
89e01b5598
avm2: Throw error in Loader.unload stub
2022-12-29 10:50:35 +01:00
EmperorBale
ac4d74b9ed
core: Use applicationDomain specified in context if available
2022-12-28 17:25:11 -05:00
EmperorBale
7e5018331d
core: Add new `context` parameter to loader
2022-12-28 17:25:11 -05:00
dependabot[bot]
6f430bb40d
build(deps): bump serde from 1.0.151 to 1.0.152
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.151 to 1.0.152.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.151...v1.0.152 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-28 10:55:35 +02:00
David Wendt
08fed6aeaa
core: Don't attempt to set properties on parents after construction unless the child has an explicit name.
...
This already was implemented, but the prior commits broke it.
2022-12-27 20:15:49 -07:00
David Wendt
7eb0ca8ecc
core: Unconstructed display objects should be `null`, not `undefined`.
2022-12-27 20:15:49 -07:00
David Wendt
cbf2e94aba
core: Fix AVM2 buttons getting constructed with the wrong initial state.
...
This code was always wrong; and only saved from breaking by other wrong code elsewhere. Specifically:
* `SimpleButton.construct_frame` sets the wrong initial state
* but `MovieClip.instantiate_child` fires frame events before `post_instantiation`
* and `SimpleButton.post_instantiation` sets the correct state
2022-12-27 20:15:49 -07:00
David Wendt
eb0eede07d
chore: Remove unused/superceded event issue code
2022-12-27 20:15:49 -07:00
David Wendt
b6aa035663
core: Instantiating display objects on the timeline should no longer construct them.
...
This works now because all object placement and removal happens in `enter_frame`. Constructing those objects right away causes them to drop added events.
We cannot remove other instances of `construct_frame`, however - those are in places where we actually do expect constructors to run, not just see things get placed.
2022-12-27 20:15:49 -07:00
David Wendt
4b71fff745
core: Children added to AVM2 buttons should not emit added events
2022-12-27 20:15:49 -07:00
David Wendt
0d7e9cd30e
core: All display objects that can be placed by timeline need to add themselves to their parent object.
...
This also centralizes all the code we added in the prior commit into `on_construction_complete`, which should be called whenever an AVM2 object finishes construction.
2022-12-27 20:15:49 -07:00
David Wendt
1c5e97ccc6
core: Move AVM2 `PlaceObject` processing to `enter_frame`.
...
This has a few other knock-on effects:
* AVM2 added-to-timeline events are fired by each object after it constructs its AVM2 side. This is opposed to before when we fired them after object instantiation and placement. This also gets rid of a prior hack we had for the AVM2 root movie getting added to the stage - or, more accurately, adopts it for everything.
* The supercall constructor for `DisplayObject` runs `construct_frame` on all children. This matches Flash Player behavior.
NOTE: This currently breaks the `placed_with_name` check, so there's going to be a lot of spurious can't set warnings
2022-12-27 20:15:49 -07:00
dependabot[bot]
664c67ea27
build(deps): bump clap from 4.0.29 to 4.0.32
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.29 to 4.0.32.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.29...v4.0.32 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 22:04:33 +01:00
Aaron Hill
6dc628e49f
core: Remove some manual `Collect` impls
...
Some were completely unused, while others could be replaced
with a `#[derive(Collect)]`
2022-12-24 00:33:25 -06:00
Adrian Wielgosik
7a09dd5639
avm2: Convert FrameLabel to AS3, remove define_indirect_properties
2022-12-22 00:45:02 +01:00
Adrian Wielgosik
e6e9c9edc2
avm2: Convert Dictionary to AS3
2022-12-21 23:56:48 +01:00
Adrian Wielgosik
e90d595cb3
avm2: Convert SharedObject to AS3
2022-12-21 22:21:23 +01:00
Adrian Wielgosik
f3ebb0c297
avm2: Convert JSON class to AS3
2022-12-21 22:21:23 +01:00
Lord-McSweeney
5cf5c8d5e5
Update Loader.as
...
Stub `flash.display.Loader.unload`
2022-12-20 16:58:55 -06:00
dependabot[bot]
d12e1ebd6e
build(deps): bump syn from 1.0.105 to 1.0.107
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.105 to 1.0.107.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.105...1.0.107 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 07:52:42 +02:00
dependabot[bot]
5383ae296d
build(deps): bump quote from 1.0.21 to 1.0.23
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.21 to 1.0.23.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.21...1.0.23 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 07:29:38 +02:00
dependabot[bot]
9db6ace65f
build(deps): bump serde from 1.0.150 to 1.0.151
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.150 to 1.0.151.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.150...v1.0.151 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 00:48:45 +01:00
dependabot[bot]
08566ed4ba
build(deps): bump proc-macro2 from 1.0.47 to 1.0.49
...
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2 ) from 1.0.47 to 1.0.49.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.47...1.0.49 )
---
updated-dependencies:
- dependency-name: proc-macro2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 00:20:20 +01:00
dependabot[bot]
502b03a882
build(deps): bump rustversion from 1.0.9 to 1.0.11
...
Bumps [rustversion](https://github.com/dtolnay/rustversion ) from 1.0.9 to 1.0.11.
- [Release notes](https://github.com/dtolnay/rustversion/releases )
- [Commits](https://github.com/dtolnay/rustversion/compare/1.0.9...1.0.11 )
---
updated-dependencies:
- dependency-name: rustversion
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-19 21:37:54 +01:00
CUB3D
7b564ccd97
avm2: Stub registerClassAlias
2022-12-19 11:06:52 -08:00
Adrian Wielgosik
24a6f74b3c
avm2: Convert Proxy to AS3
2022-12-19 18:25:25 +01:00
Adrian Wielgosik
96950f424e
avm2: Stub InteractiveObject.focusRect
2022-12-18 14:36:08 -07:00
CUB3D
80cf98f501
avm2: Check for state parent in hit_test_shape as well as mouse_pick
2022-12-18 13:32:24 -07:00
CUB3D
2edbe3092b
avm2: Ignore mouse_pick on static text
2022-12-18 13:32:24 -07:00
CUB3D
b46a4186ab
chore: Fmt
2022-12-18 13:32:24 -07:00
CUB3D
6f214c2165
chore: Fix clippy lint
2022-12-18 13:32:24 -07:00
CUB3D
ef9483d961
avm2: hitTestPoint requires do to be on stage, only if shape_flag=true
2022-12-18 13:32:24 -07:00
CUB3D
d7156e9a58
avm2: Dont transform mouse_pick point in button if hit_area has a parent
2022-12-18 13:32:24 -07:00
CUB3D
55926932e0
avm2: MouseUpInside clip events should be handled by avm2 buttons
2022-12-18 13:32:24 -07:00
CUB3D
8ddba5432c
avm2: hitTestPoint requires the object to be on the stage
2022-12-18 13:32:24 -07:00
CUB3D
1013a6a162
avm2: Button bounds_with_transform should include bounds of current state child
2022-12-18 13:32:24 -07:00
CUB3D
391b3a9dfb
avm2: Selecting the child of a SimpleButton should select the button, not the child
...
This fixes ingame menu buttons in BLOCnog
2022-12-18 13:32:24 -07:00
CUB3D
fa44d61bc5
avm2: MouseEnabled shouldn't affect abillity to select children
...
Fixes #8694
2022-12-18 13:32:24 -07:00
CUB3D
690191dbdf
avm2: Fix SimpleButton bounds
2022-12-18 13:32:24 -07:00
CUB3D
f1401d6837
avm2: Fix hittests on depth=0 children
2022-12-18 13:32:24 -07:00
Mike Welsh
c30eb38741
audio: Rename symphonia feature to mp3
2022-12-17 22:48:42 -08:00
Mike Welsh
d162363c2f
audio: Remove minimp3 feature
2022-12-17 22:48:42 -08:00
Moulins
625f09a91a
avm1: remove unused GcCell in ArrayObject and SuperObject
2022-12-17 21:12:43 -08:00
Moulins
62e64c714e
avm1: remove most of the contents of impl_custom_object! macro
...
The delegating methods are moved to default implementations on the
TObject trait, delegating to self.raw_script_object()
2022-12-17 21:12:43 -08:00
Moulins
eadbf92454
avm1: rename TObject::{as => raw}_script_object & remove Option in ret. type
...
Usage of TObject::as_script_object was always followed by an unwrap, and
only SuperObject returned None.
The name change is intended to make clearer the fact that using the
returned object may bypass special behavior.
2022-12-17 21:12:43 -08:00
David Wendt
1255bf1c59
core: Don't fire init events on AVM2 until the first frame has been constructed.
2022-12-17 20:47:49 -08:00
Mike Welsh
696c9062d3
chore: Inherit cargo metadata from workspace
...
Use workspace inheritance added in Rust 1.64 to de-duplicate
various settings across all packages.
2022-12-16 15:53:59 -08:00
Adrian Wielgosik
870745e0ef
avm2: Make pop_stack #[must_use]
2022-12-16 14:40:22 -08:00
Adrian Wielgosik
7df920b255
avm2: Support indexing with QNames
2022-12-16 14:40:22 -08:00
Adrian Wielgosik
d2dfdb9a0b
avm2: Collapse PackageNamespace to Namespace
2022-12-16 12:51:01 -08:00
relrelb
14747f26fd
chore: Fix `clippy::uninlined_format_args` for `avm_debug!`
...
Though this is not currently enforced by Clippy.
2022-12-15 08:59:38 +02:00
relrelb
bd9078addf
chore: Fix `clippy::uninlined_format_args` lints
2022-12-15 08:59:38 +02:00
nosamu
f904f20796
avm2: Stub SharedObject.clear and SharedObject.size
2022-12-15 08:41:28 +02:00
Adrian Wielgosik
92998e2c91
avm2: Translate ExternalInterface to AS
2022-12-14 17:57:45 +01:00
Adrian Wielgosik
5e115ed038
avm2: Stub more parts of LocalConnection and UrlRequest
2022-12-13 10:22:20 +01:00
Adrian Wielgosik
c8314da8d3
avm2: Fix aliasing in BitmapData.copyChannel
2022-12-13 01:24:49 +01:00
Callum Thomson
20c9a3d765
AVM2: Implement System.setClipboard ( #8751 )
...
* avm2: Implement System.setClipboard
* web: Add comment to set_clipboard_content
2022-12-13 01:05:23 +01:00
CUB3D
02360b28dc
avm2: Implement basic flash.net.navigateToURL
2022-12-13 00:34:10 +01:00
dependabot[bot]
b1c4e6f143
build(deps): bump serde from 1.0.149 to 1.0.150
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.149 to 1.0.150.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.149...v1.0.150 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-12 21:21:45 +01:00
nosamu
1aaaf6d421
avm2: Stub SharedObject.close
2022-12-10 21:38:19 -06:00
Adrian Wielgosik
2bb4e2e549
core: Fix failing builds without avm_debug feature
2022-12-07 00:34:01 +01:00
David Wendt
8678325686
core: `Loader` must pass enter/construct frame lifecycle events to children or loaded SWFs won't work
2022-12-06 20:10:30 +01:00
Adrian Wielgosik
e351f9f19b
core: use ctrl+alt+f to dump DO render tree
2022-12-05 19:49:41 -07:00
Adrian Wielgosik
7b64fcf5fa
avm2: Fix indirect event dispatching
2022-12-06 00:44:17 +01:00
dependabot[bot]
061f261c50
build(deps): bump syn from 1.0.104 to 1.0.105
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.104 to 1.0.105.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.104...1.0.105 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 23:15:10 +01:00
dependabot[bot]
3b285f8cf2
build(deps): bump serde from 1.0.148 to 1.0.149
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.148 to 1.0.149.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.148...v1.0.149 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 22:35:48 +01:00
kmeisthax
f79208c75f
avm2: Fix no-op gotos ( #8667 )
...
* tests: Add a test for issue #8630
* core: No-op gotos in AS3 do not actually do anything, even though they emit events
Fixes issue #8630
* tests: Add more tests for various #8630-adjacent cases
* tests: Ignore the tests with script removal as they expect MovieClip children to be nulled upon removal
* chore: Case sensitive filesystem fix
Co-authored-by: Adrian Wielgosik <adrian.wielgosik@gmail.com>
2022-12-05 18:19:29 +01:00
wsxarcher
c8e39da1e0
avm2: Implement filefilter filereference
2022-12-04 15:10:48 +01:00
Toad06
dcf1fb4ffd
avm1: Various minor fixes in filters
2022-12-04 14:19:41 +01:00
Aaron Hill
1b3070ab85
core: Make `BitmapHandle` hold a trait object instead of an id
...
`BitmapHandle` now holds `Arc<dyn BitmapHandleImpl>`.
This allows us to move all of the per-bitmap backend data into
`BitmapHandle`, instead of holding an id to a backend-specific
hashmap.
This fixes the memory leak issue with bitmaps. Once the AVM side of a
bitmap (`Bitmap`/`BitmapData`) gets garbage-collected, the
`BitmapHandle` will get dropped, freeing all of the GPU resources
assoicated with the bitmap.
2022-12-03 19:44:44 -06:00
Adrian Wielgosik
0861153626
swf: make Clippy happy
2022-12-03 22:18:22 +01:00
David Wendt
ce35313094
Revert "Revert "avm2: Implement `TextField` scrolling parameters""
...
This reverts commit f08aa19cb7
.
2022-12-02 21:41:20 -05:00
Adrian Wielgosik
f08aa19cb7
Revert "avm2: Implement `TextField` scrolling parameters"
...
This reverts commit 230ef315a2
.
2022-12-02 18:22:19 -07:00
David Wendt
230ef315a2
avm2: Implement `TextField` scrolling parameters
2022-12-02 22:40:22 +01:00
Marco Bartoli
f2080e6d57
avm2: implement get and set of displayobject filters ( #8623 )
2022-12-01 02:31:35 +01:00
dependabot[bot]
83487ae5d1
build(deps): bump serde from 1.0.147 to 1.0.148
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.147 to 1.0.148.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.147...v1.0.148 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-30 10:04:26 +01:00
dependabot[bot]
e3923e0d3d
build(deps): bump syn from 1.0.103 to 1.0.104
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.103 to 1.0.104.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.103...1.0.104 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 20:47:36 -07:00
Calvin304
5d5a56a7a3
avm2: Address feedback to DropShadowFilter stub
2022-11-27 09:46:18 -05:00
Calvin304
e46fc4fe8a
avm2: stub DropShadowFilter
2022-11-27 09:46:18 -05:00
Marco Grassi
0c851ecfde
don't include all the features in chrono to avoid including the vulnerable time dependency
2022-11-26 14:04:59 -05:00
Marco Grassi
ad81b3bf14
upgrade lock and toml dependencies
2022-11-26 14:04:59 -05:00
Aaron Hill
b8745f0ff1
avm2: Partially implement Stage3D for wgpu backend
...
This PR implements core 'stage3D' APIs. We are now able
to render at least two demos from the Context3D docs - a simple
triangle render, and a rotating cube.
Implemented in this PR:
* Stage3D access and Context3D creation
* IndexBuffer3D and VertexBuffer3D creation, uploading, and usage
* Program3D uploading and usage (via `naga-agal`)
* Context3D: configureBackBuffer, clear, drawTriangles, and present
Not yet implemented:
* Any 'dispose()' methods
* Depth and stencil buffers
* Context3D texture apis
* Scissor rectangle
General implementation strategy:
A new `Object` variant is added for each of the Stage3D objects
(VertexBuffer3D, Program3D, etc). This stores a handle to the
parent `Context3D`, and (depending on the object) a handle
to the underlying native resource, via `Rc<dyn
SomeRenderBackendTrait>`).
Calling methods on Context3D does not usually result in an immediate
call to a `wgpu` method. Instead, we queue up commands in our
`Context3D` instance, and execute them all on a call to `present`.
This avoids some nasty wgpu lifetime issues, and is very similar
to the approah we use for normal rendering.
The actual rendering happens on a `Texture`, with dimensions
determined by `createBackBuffer`. During 'Stage' rendering,
we render all of these Stage3D textures *behind* the normal
stage (but in front of the overall stage background color).
2022-11-25 21:43:00 -07:00
Toad06
460458812b
avm1: Correct some properties in SWFv4
2022-11-25 20:35:59 -07:00
Aaron Hill
3bef8c4fd6
render: Remove `get_bitmap_pixels` and store data in `Character::Bitmap`
...
We only called `get_bitmap_pixels` when creating a `BitmapData`
for an SWF-provided `Bitmap`. We now store the initial pixels
in `Character::Bitmap`, and use them to initialize a `BitmapData`
when needed.
This lets us simplify the wgpu backend, which no longer needs
to store a `Bitmap` object. In addition to saving space for
`BitmapData` objects that lack an SWF `Bitmap`, this will make
it easier to move data from `bitmap_registry` into `BitmapHandle`
itself.
2022-11-25 16:08:42 -07:00
Mark Richins
d345523d02
Fix conflicts
2022-11-23 20:45:37 -07:00
Mark Richins
9941701b3a
Fix: change twips_2d to use x and y and fix bug
2022-11-23 20:45:37 -07:00
Mark Richins
63a291ac4b
Fix promblems caused by moving Twips
2022-11-23 20:45:37 -07:00
EmperorBale
7a0f3d5d32
chore: Formatting
2022-11-23 17:28:28 -07:00
EmperorBale
e922a118d8
avm2: Improve inlining of stack related functions
2022-11-23 17:28:28 -07:00
EmperorBale
c919890a1e
chore: Use if/else instead of matching cmp
2022-11-23 17:28:28 -07:00
EmperorBale
657f54b2f1
chore: Cleanup clippy lint
2022-11-23 17:28:28 -07:00
EmperorBale
35219cf592
avm2: `op_get_scope_object` should start at the scope depth.
2022-11-23 17:28:28 -07:00
EmperorBale
eb9ce4073e
avm2: Clear stack & scope when execution is complete.
2022-11-23 17:28:28 -07:00
EmperorBale
4d151931f8
chore: Improve doc comments
2022-11-23 17:28:28 -07:00
EmperorBale
601f36df33
avm2: Introduce `clear_stack` & `clear_scope`.
2022-11-23 17:28:28 -07:00
EmperorBale
98d3b8f3c1
avm2: Enforce max scope depth & minimum scope depth
...
when pushing/popping from scope stack.
2022-11-23 17:28:28 -07:00
EmperorBale
7a48014d36
avm2: Enforce max stack & stack depth when pushing/popping from stack
2022-11-23 17:28:28 -07:00
EmperorBale
d46b2c39ca
avm2: Share scope stack across AVM2
2022-11-23 17:28:28 -07:00
EmperorBale
16805a350b
avm2: Store stack information in activations
2022-11-23 17:28:28 -07:00
Moulins
c10244b0a4
core: Only unload D.O.s when they are removed from the render list
...
D.O.s removed by the timeline may only be removed from the depth list
(if they were manipulated by AS3 scripts), but their unload method
would still be called, which is wrong.
2022-11-23 16:44:38 -07:00
Moulins
53010544db
core: Simplify core::do::container::Lists bitflags into boolean enum
...
Callsites only ever used two values, as children in the display list are
always in the render list.
2022-11-23 16:44:38 -07:00
Moulins
58e39623a5
core: Make all ChildContainer's methods private
...
And also, remove some dead code
2022-11-23 16:44:38 -07:00
Aaron Hill
4b8cd45f4b
avm2: Partially implement StaticText ( #8343 )
...
This is linked to the legacy DisplayObject::Text, which can
only be created by Flash CS6 (but is allowed in AVM2 swfs).
The 'StaticText' class cannot be constructed from ActionScript.
To support this, I've added support for native initializers to
playerglobal. This allows us to throw an exception in the
ActionScript constructor in Test.as, and do nothing in the native
intiializer (so that we can construct it from a DisplayObject).
I've left StaticText.text unimplemented for now, since it will require
dealing with Glyphs
Co-authored-by: kmeisthax <dcrkid@yahoo.com>
2022-11-23 18:30:47 -05:00
Moulins
9529a1cbdb
avm1: address Scope nitpicks
2022-11-23 15:50:45 -07:00
Moulins
05e3e6434b
avm1: Remove all allocations in `Activation::from_nothing`
...
This is done by:
- using the global constant pool instead of a fresh empty one:
- OK, as no call-site is directly executing arbitrary bytecode that
could care about the contents of the constant pool.
- pre-allocating the global scope object in the `Avm1` context
- using the global scope directly instead of allocating a local scope:
- OK, because no call-site is directly defining locals on the
returned Activation's scope.
2022-11-23 15:50:45 -07:00
Moulins
5faba34eb2
avm1: remove 'globals' parameter from Activation::from_nothing
...
Across all invocations, this is always set to the global object so it
can be hard-coded inside the call.
2022-11-23 15:50:45 -07:00
Moulins
ea03aa04b8
avm1: make scope references immutable; they were never actually modified
...
Rewrite Scope::new_target_scope, as the previous approach is unusable
now that Scope doesn't have interior mutability anymore.
2022-11-23 15:50:45 -07:00
Moulins
8cb0b47d1f
avm1: make constant pool reference immutable; it was never actually modified
2022-11-23 15:50:45 -07:00
TÖRÖK Attila
a9c94513a0
avm2,audio: Implement leftPeak and rightPeak in SoundChannel
2022-11-23 15:38:41 -07:00
michiel2005
50724448c8
Update array.rs
2022-11-23 15:19:07 -07:00
michiel2005
7c5f2805ef
Avoid code duplication
...
Avoided code duplication in avm1 array.rs as asked
2022-11-23 15:19:07 -07:00
Moulins
2fa3d31732
Appease Clippy on nightly
2022-11-23 22:39:45 +01:00
Toad06
eb2ee06588
avm1: Fix `ExternalInterface.call` with blank strings in SWFv8
2022-11-22 16:51:59 -07:00
Aaron Hill
bdadb17a95
render: Don't use BitmapHandle in tessellator
...
Currently, we rely on ShapeTessellator being able to get a BitmapHandle
without a RenderBackend. With the upcoming BitmapData refactor,
we will always need a RenderBackend to get a BitmapHandle, which creates
borrow-checker issues in ShapeTessellator (which is stored in a
RenderBackend).
To solve this, we split BitmapSource.bitmap into two methods -
BitmapSource.bitmap and BitmapSource.bitmap_handle. ShapeTessellator
continues to use BitmapSource.bitmap, and uses the u16 bitmap id
instead of a BitmapHandle. The BitmapSource.bitmap_handle method
is used inside each render backend to convert the id to a BitmapHandle,
avoiding borrow-checker issues.
2022-11-21 21:04:40 -07:00
David Wendt
0aec23b468
chore: Upgrade deprecated timezone code.
...
This doesn't actually add any new places for code to panic, since the deprecated functions all `unwrap`'d internally.
2022-11-21 18:50:46 -07:00
dependabot[bot]
1b6e91393e
build(deps): bump indexmap from 1.9.1 to 1.9.2
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.9.1 to 1.9.2.
- [Release notes](https://github.com/bluss/indexmap/releases )
- [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.md )
- [Commits](https://github.com/bluss/indexmap/compare/1.9.1...1.9.2 )
---
updated-dependencies:
- dependency-name: indexmap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 18:27:58 -07:00
dependabot[bot]
ccb1fa1b1b
build(deps): bump clap from 4.0.24 to 4.0.26
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.24 to 4.0.26.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.24...v4.0.26 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 18:07:28 -07:00
dependabot[bot]
25664778f3
build(deps): bump bitstream-io from 1.5.0 to 1.6.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/compare/v1.5.0...v1.6.0 )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 17:16:38 -07:00
Toad06
caecc519cd
avm1: Minimal implementation of `LoadVars.getBytesTotal` and `LoadVars.getBytesLoaded`
2022-11-20 22:00:36 -07:00
David Wendt
ecdef4c6f4
core: Empty text lines should still have a height.
2022-11-20 17:13:48 -07:00
David Wendt
425bea45f8
avm1: `TextFormat.getTextExtent` uses the height of all boxes in the layout
2022-11-20 17:13:48 -07:00
David Wendt
66bf03908b
avm1: Implement `TextFormat.getTextExtent`
2022-11-20 17:13:48 -07:00
David Wendt
83db53202e
core: Add empty boxes for empty lines *without* breaking multiple-format lines.
2022-11-20 17:13:48 -07:00
David Wendt
88c3cf0c72
core: The leading for a given line is stated using the text format's leading, not the font's leading.
2022-11-20 17:13:48 -07:00
David Wendt
59f01a40f1
core: Empty lines should also generate a layout box.
2022-11-20 17:13:48 -07:00
David Wendt
5f7344259a
avm2: Impl `TextField.numLines` and `.getLineMetrics`
2022-11-20 17:13:48 -07:00
David Wendt
1efa29baa6
core: Add methods for introspecting text metrics on an `EditText`.
2022-11-20 17:13:48 -07:00
Adrian Wielgosik
7e2b876ab3
avm2: Refactor context menu field bool checks into macro
2022-11-17 22:03:54 -05:00
Adrian Wielgosik
e840d1f71c
core: Support AVM2 context menu (sans callbacks)
2022-11-17 22:03:54 -05:00
Toad06
182c3b78e4
avm1: onData fails if the loaded data is an empty string
2022-11-17 20:51:11 -05:00
dependabot[bot]
b3debc96af
build(deps): bump clap from 4.0.22 to 4.0.24
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.22 to 4.0.24.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.22...v4.0.24 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 09:33:20 +02:00
TÖRÖK Attila
08270efee7
avm2: Implement SoundMixer.computeSpectrum()
2022-11-10 19:11:29 -05:00
TÖRÖK Attila
2b4d8d9c6e
core,desktop: Add and implement AudioBackend::get_sample_history()
2022-11-10 19:11:29 -05:00
Moulins
fb8caad783
core: rename TInteractiveObject::{ibase => raw_interactive}(_mut)
...
To match with TDisplayObjectContainer::raw_container(_mut) introduced
in previous commit.
2022-11-09 23:39:15 -05:00
Moulins
0bc01c239f
core: remove impl_display_object_container! macro
...
It is replaced by two accessor methods on the trait + default
implementations of all other methods.
2022-11-09 23:39:15 -05:00
dependabot[bot]
9303304e3b
build(deps): bump clap from 4.0.18 to 4.0.22
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.18 to 4.0.22.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.18...v4.0.22 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 00:25:12 +02:00
relrelb
c516fef65d
swf: Simplify read of `PlaceObject` tags
...
`tag_length` isn't really necessary since each tag is read using
a dedicated `swf::Reader`, which keeps track of the tag boundary
internally.
As a result, `tag_len` can be avoided passed around many times in
`movie_clip.rs`.
2022-11-08 00:05:41 +02:00
moulins
8cbd527e4c
avm1: Small cleanups in ActionQueue ( #8486 )
...
- Use a fixed-size array instead of a Vec for the queues
- Remove unwanted plurals in methods and types names
2022-11-06 07:39:11 +02:00
Moulins
e121c82b10
avm1: remove manual bit-wrangling in declare_properties! macro
...
Now that the relevant compiler ICE is fixed, we can use the Attribute
constants directly
2022-11-03 09:19:11 +02:00
Adrian Wielgosik
3458cd92e4
avm2: Support DO.getBounds, (partial) getRect
2022-11-01 22:46:34 +01:00
relrelb
89f3445d62
swf: Introduce and use `Rectangle::width()` and `Rectangle::height()`
2022-11-01 09:49:04 +02:00
Aaron Hill
68471723b3
core: Fix clippy format string lint
2022-10-27 08:49:39 +03:00
relrelb
fb7ba9c9a0
core: Extract `Graphic::drawing`
...
That returns a non-`Option` `Drawing`, and has no `.unwrap()`s.
2022-10-26 09:05:42 +03:00
relrelb
7dfc5b6e2e
core: Extract `MovieClip::drawing`
...
That returns a non-`Option` `Drawing`. This avoids many `.unwrap()`s
in AVM1.
2022-10-26 09:05:42 +03:00
relrelb
d3c6d9d148
avm1: Require a `MovieClip` in `MovieClip.duplicateMovie`
...
A `MovieClip` must be instantiated from an ID of a `MovieClip`.
2022-10-26 09:05:42 +03:00
dependabot[bot]
d589130634
build(deps): bump serde from 1.0.145 to 1.0.147
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.145 to 1.0.147.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.145...v1.0.147 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:54:26 +03:00
dependabot[bot]
3c7e9235f6
build(deps): bump futures from 0.3.24 to 0.3.25
...
Bumps [futures](https://github.com/rust-lang/futures-rs ) from 0.3.24 to 0.3.25.
- [Release notes](https://github.com/rust-lang/futures-rs/releases )
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.24...0.3.25 )
---
updated-dependencies:
- dependency-name: futures
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:19:27 +03:00
dependabot[bot]
c9f5524748
build(deps): bump clap from 4.0.15 to 4.0.18
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.15 to 4.0.18.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.15...v4.0.18 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:00:26 +03:00
dependabot[bot]
6cedd3c04d
build(deps): bump syn from 1.0.102 to 1.0.103
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.102 to 1.0.103.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.102...1.0.103 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 01:14:33 +02:00
Aaron Hill
7dcb333991
avm2: Remove dead code from MovieClip constructor
...
The call to `super_init` will initialize a `DisplayObject` (if unset)
in the `Sprite` constructor, using exactly the same logic that we're
attempting to use. The code in `MovieClip` is unreachable, and can
be deleted.
2022-10-24 11:46:20 -05:00
DragonGamesStudios
84f3739ece
core: Fixed a typo in messages on pressing Ctrl+Alt+D ( #8360 )
2022-10-23 16:44:33 +03:00
Aaron Hill
919b38f20b
avm2: Stub Graphics.beginGradientFill
2022-10-22 17:58:13 -05:00
Aaron Hill
9dd0914bda
core: Add root movie URL spoofing (desktop only).
...
The desktop player now takes a `--spoof-url` argument, which overrides
the movie URL provided to ActionScript. This does not affect non-root
movies loaded through `Loader`.
2022-10-22 15:24:14 -05:00
Adrian Wielgosik
7ccf7a4c69
avm2: Add missing set_object2 impl to Bitmap
2022-10-22 19:42:24 +02:00
Aaron Hill
4cb122461e
avm2: Implement DisplayObject.cacheAsBitmap
...
The underlying flag currently does nothing, but this allows
SWFs to continue executing.
2022-10-20 18:37:35 -05:00
David Wendt
058a7a8b66
desktop: Allow specifying the load behavior for desktop
2022-10-18 16:47:49 -06:00
David Wendt
74d77a3df0
core: Add a player setting for if movies are allowed to execute before loading finishes
2022-10-18 16:47:49 -06:00
dependabot[bot]
71a4f569af
build(deps): bump proc-macro2 from 1.0.46 to 1.0.47
...
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2 ) from 1.0.46 to 1.0.47.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.46...1.0.47 )
---
updated-dependencies:
- dependency-name: proc-macro2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-18 07:28:01 +03:00
Adrian Wielgosik
bdc041677a
render: Bail on attempts on panicking recursive render, part 2.
2022-10-17 18:02:21 -05:00
Aaron Hill
45515be0a3
render: Improve support for BitmapData.draw
...
This PR fixes a numbe of interconnected bugs:
* We weren't consistently uploading a dirty BitmapData to the render
backend before drawing to/from it.
* BitmapData.draw should *not* add a fill color - it should draw over
the current contents of the BitmapData
* After drawing to a non-transparent BitmapData, we need to manually
set the opacity back to 255 for each pixel (the drawing process
takes transparency into account, but the opacity information is
thrown away at the end).
2022-10-17 12:53:38 -05:00
relrelb
86ef4bd7fe
core: Simplify `Bitmap` creation
...
Change `Bitmap::new()` to accept a `ruffle_render::bitmap::Bitmap`
directly, instead of `width`, `height` and `bitmap_handle`. As a
consequence, all `RenderBackend::register_bitmap_*` methods are no
longer necessary - we can use `ruffle_redner::utils::*` to obtain
a `ruffle_render::bitmap::Bitmap` right before calling `Bitmap::new()`.
2022-10-17 20:05:30 +03:00
David Wendt
36844e5e2f
chore: Use explicit `.clamp`
...
Also, update the tests to confirm that this doesn't break NaN handling.
2022-10-16 14:55:07 -06:00
David Wendt
10ad603566
avm1: Implement `TextField.antiAliasType`, `.gridFitType`, `.sharpness`, and `.thickness`.
...
Notably this required removing a few parameter checks from core that turned out to be AS3-only.
2022-10-16 14:55:07 -06:00
David Wendt
7155f88601
avm2: Implement `TextField.antiAliasType`, `.gridFitType`, `.sharpness`, and `.thickness`.
2022-10-16 14:55:07 -06:00
David Wendt
b8693a3932
core: Retain Advanced render settings in Normal mode, even though they won't be used there.
2022-10-16 14:55:07 -06:00
relrelb
760f9e29df
avm1: Migrate `BevelFilter` to `NativeObject`
2022-10-16 11:48:59 +03:00
relrelb
1cbc906b04
avm1: Migrate `BlurFilter` to `NativeObject`
2022-10-15 16:00:30 +03:00
relrelb
178bf4fe24
chore: Extract Cargo `edition` to `[workspace.package]`
...
This is possible since Rust 1.64.0: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds
2022-10-14 22:13:29 +03:00
relrelb
dbfd28e708
web: Bump `wasm-bindgen` to 0.2.83
...
This restores commit 084b252030
.
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
2022-10-14 21:49:40 +03:00
David Wendt
81ed624c26
avm2: Loaders should not be opaque to mouse events.
2022-10-14 12:27:31 -05:00
Tal Hayon
052ec75e2a
avm2: BitmapData.perlinNoise and DisplacementMapFilter
2022-10-14 11:22:26 -05:00
relrelb
bc73301592
avm1: Require some more prototypes
...
Since they are never `None`.
2022-10-14 00:23:12 +03:00
Aaron Hill
feda41d6c1
avm2: Add LoaderInfo.uncaughtErrorEvents
...
We don't currently fire any events, but we store the object
so that listeners will be correctly registered.
2022-10-12 17:26:14 -05:00
relrelb
967ff56e3b
avm1: Rewrite `Date` implementation
...
The new implementation is simpler, and supports many AVM1 quirks not
supported before.
In addition, migrate `Date` to `NativeObject`.
2022-10-13 00:49:50 +03:00
relrelb
21e24936b7
avm1: Correct `Number.toString` edge-case
...
`NaN` and large numbers are actually treated like `i32::MIN`. As described
in https://github.com/ruffle-rs/ruffle/issues/7772#issuecomment-1235977709 ,
Flash (at least 7+) fails to convert `i32::MIN` to a string due to a bug.
Since `i32::MIN` has no `i32` positive counterpart, digits extracted using
modulo are actually negative and characters before ASCII `'0'` are selected.
Flash 6- somehow return just `0` in those cases. This was Ruffle's behavior
up until this commit. This commit matches Ruffle behavior to latest Flash
Player, as we usually prefer. A `TODO` is still there in case we ever add
player version emulation.
2022-10-13 00:05:25 +03:00
relrelb
f504804379
avm1: Require `fn_proto` in `FunctionObject::bare_function`
...
It was never `None`, except for 3 tests in `script_object.rs`,
which now use `activation.context.avm1.prototypes().function`.
2022-10-12 21:01:18 +03:00
dependabot[bot]
76f18cbc37
build(deps): bump clap from 4.0.9 to 4.0.12
...
Bumps [clap](https://github.com/clap-rs/clap ) from 4.0.9 to 4.0.12.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.9...v4.0.12 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 00:32:53 +03:00
dependabot[bot]
bdd7c27965
build(deps): bump syn from 1.0.101 to 1.0.102
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.101 to 1.0.102.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.101...1.0.102 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-10 23:42:49 +03:00
EmperorBale
d72ef587f2
avm2: Add digest property to URLRequest
2022-10-10 12:48:35 -07:00
EmperorBale
5c9bf3ffc0
swf: Support SWZ files
2022-10-10 12:48:35 -07:00
Adrian Wielgosik
10c19fef57
render: Bail on attempts on panicking recursive render. ( #8248 )
2022-10-09 14:33:57 -05:00
relrelb
bf0ace0b88
chore: Appease clippy
2022-10-09 13:46:28 +05:45
relrelb
5c94714363
avm2: Port `flash.ui.Keyboard` to ActionScript
2022-10-07 12:27:56 +03:00
David Wendt
23b5eb6d72
avm2: Implement `BitmapData.clone`.
2022-10-07 01:41:48 -05:00
David Wendt
1b0d23e569
core: Don't desync on frames with no audio blocks.
...
Fixes regression caused by me in 85cf383c84
2022-10-06 21:41:59 -06:00
Tal Hayon
a8b96b676a
avm2: Add More BitMapData methods
...
This also fixes a small bug in copyChannels
2022-10-06 18:53:06 -06:00
Aaron Hill
4b2907ead5
avm2: Fix 'hasDefinition' and 'getDefinition' for ApplicationDomain
...
These methods were incorrectly treating the argument as a local name,
instead of a qualified name. Additionally, 'getDefinition' now throws
an AVM error.
2022-10-05 16:45:29 -05:00
relrelb
a9dedf759a
chore: Fix `clap` update
...
As described in https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#400---2022-09-28 .
2022-10-05 21:33:34 +03:00
dependabot[bot]
32a370f803
build(deps): bump clap from 3.2.20 to 4.0.9
...
Bumps [clap](https://github.com/clap-rs/clap ) from 3.2.20 to 4.0.9.
- [Release notes](https://github.com/clap-rs/clap/releases )
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md )
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.20...v4.0.9 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-05 21:33:34 +03:00
Aaron Hill
9b055645d3
avm2: Support calling 'new Function()' objects
...
This appears to create a dummy function, which ignores all
of its arguments and always returned `undefined`
2022-10-05 08:57:12 -05:00
Adrian Wielgosik
4745a897eb
avm2: Add MovieClip::enabled
2022-10-04 20:14:09 +02:00
Adrian Wielgosik
0ac3341d57
avm2: Fix typing of add/removeChild methods
2022-10-04 19:51:26 +02:00
dependabot[bot]
ac93f9d295
build(deps): bump serde from 1.0.144 to 1.0.145
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.144 to 1.0.145.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.144...v1.0.145 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 16:17:36 +03:00
dependabot[bot]
0547155749
build(deps): bump proc-macro2 from 1.0.43 to 1.0.46
...
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2 ) from 1.0.43 to 1.0.46.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.43...1.0.46 )
---
updated-dependencies:
- dependency-name: proc-macro2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 14:14:35 +03:00
dependabot[bot]
356877c88e
build(deps): bump enumset from 1.0.11 to 1.0.12
...
Bumps [enumset](https://github.com/Lymia/enumset ) from 1.0.11 to 1.0.12.
- [Release notes](https://github.com/Lymia/enumset/releases )
- [Changelog](https://github.com/Lymia/enumset/blob/master/RELEASES.md )
- [Commits](https://github.com/Lymia/enumset/compare/v1.0.11...v1.0.12 )
---
updated-dependencies:
- dependency-name: enumset
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 12:52:47 +03:00
dependabot[bot]
dbac0ca420
build(deps): bump syn from 1.0.99 to 1.0.101
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.99 to 1.0.101.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.99...1.0.101 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 12:22:45 +03:00
David Wendt
7861dfff79
avm2: Stub `tabChildren`, `tabIndex`, and `tabEnabled`.
2022-10-04 01:06:25 -05:00
dependabot[bot]
a0ef304ae9
build(deps): bump smallvec from 1.9.0 to 1.10.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.9.0...v1.10.0 )
---
updated-dependencies:
- dependency-name: smallvec
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 01:44:21 +03:00
Aaron Hill
046ed2c0ba
avm2: Stub Graphics.beginBitmapFill
...
This is needed by Pixel Legions
2022-10-03 15:01:01 -05:00
Adrian Wielgosik
286755962f
avm2: Array push/unshift return new length, like Vector
2022-10-02 17:52:25 +02:00
Aaron Hill
8f72842b2f
avm2: Stub LocalConnection
2022-09-28 13:46:25 -05:00
dowgird
5ac4f4358d
avm2: Added flash.net.URLVariables
2022-09-27 13:43:30 -05:00
Aaron Hill
53f42e0bec
avm2: Fix getQualifiedClassName for null and undefined
2022-09-27 00:05:06 -05:00
nosamu
66fa67cdcc
Revert "avm1: Remove `Value::to_primitive_num`"
...
This reverts commit 2c50a04e37
.
2022-09-26 18:40:39 -05:00
Aaron Hill
f5b59f869c
avm2: Show native method names in stack trace
...
Previously, we would display an empty string for the method name.
We can now store a `&'static str` again in `NativeMethod`,
instead of needing a `Cow`
2022-09-26 14:13:48 -05:00
relrelb
65ecb4fe8f
avm2: Remove `From<Box<dyn std::error::Error>> for Error<'gc>`
2022-09-26 19:51:38 +03:00
relrelb
cc531ff7db
avm2: `playerglobal.swf` should be valid
2022-09-26 19:51:38 +03:00
relrelb
1f6368b946
avm2: Ignore `write!()` errors
...
As it cannot fail.
2022-09-26 19:51:38 +03:00
relrelb
e3e4aeb248
avm2: Throw `flash.errors.IOError` from `ByteArray`
...
Instead of propagating the underlying compression library errors.
Also, make `ByteArray.deflate` and `ByteArray.inflate` pure-ActionScript
methods that call into the native `ByteArray.compress` and `ByteArray.uncompress`
native methods, respectively.
2022-09-26 19:51:38 +03:00
relrelb
95de87ad0a
avm2: Throw `VerifyError` for invalid ABC files
2022-09-26 19:51:38 +03:00
relrelb
a894ec5ca8
avm2: JSON serialization cannot fail
2022-09-26 19:51:38 +03:00
relrelb
a8f869329e
web: Fix config with `serde-wasm-bindgen`
...
Since `serde-wasm-bindgen` doesn't support `#[serde(default)]` (https://github.com/cloudflare/serde-wasm-bindgen/issues/20 ),
we no longer able to deserialize a partial `Config` object. As a solution,
take care to pass a full object from the TypeScript side.
2022-09-26 17:23:32 +03:00
relrelb
c9ca7e2095
avm2: Port `flash.ui.Mouse` to ActionScript
2022-09-25 16:50:03 +03:00
relrelb
e1d01b0a5e
swf: Extract `Rectangle` to a separate file
...
And make it generic, as a first step towards making it a general-purpose
data structure for the whole codebase. Some potential replacements are:
* `BoundingBox` in `render/src/bounding_box.rs`.
* `BoxBounds` in `core/src/html/dimensions.rs`.
* Parameters to a bunch of `BitmapData` methods in
`core/src/bitmap/bitmap_data.rs`.
2022-09-25 10:37:56 +03:00
relrelb
898ccfba5d
avm1: Migrate `ColorTransform` to `NativeObject`
2022-09-25 02:43:53 +03:00
golfinq
ceb877c55f
avm2: Implement error types for avm2
2022-09-25 02:27:59 +03:00
dowgird
e448f5e027
avm2: implemented flash.utils.unescapeMultiByte
2022-09-25 01:19:11 +03:00
relrelb
c532d70844
avm2: Port `flash.net.ObjectEncoding` to ActionScript
...
Along with the `flash.net.IDynamicPropertyOutput` and `flash.net.IDynamicPropertyWriter`
interfaces.
2022-09-25 00:36:31 +03:00
EmperorBale
98edcc4dc0
avm2: Add non-debug version of ErrorObject::display_full
2022-09-24 22:29:55 +02:00
Aaron Hill
66df5ea3de
avm2: Implement typed 'catch' blocks
...
Now that we have a custom `Error` enum, this is very straightforwawrd.
I've converted `getDefinitionByName` return an AVM error, since this
is commonly used by games to test for a class.
2022-09-24 13:03:29 -05:00
relrelb
b5084eef25
Revert "web: Bump `wasm-bindgen` to 0.2.83"
...
This reverts commit 1954f6162f
.
2022-09-24 09:52:25 +03:00
Aaron Hill
b571b43375
avm2: Fix some `avm_debug!` calls.
...
These were debug-printing `Gc<Multiname>` instead of `Multiname`
2022-09-24 09:16:35 +03:00
Aaron Hill
7b0bc0fb74
avm2: Implement undocumented 'Function.length' property
...
This returns the function's parameter count, and is used by the Starling
framework to implement a custom event dispatcher.
2022-09-23 18:36:23 -05:00
Aaron Hill
25f176995a
avm2: Stub flash.ui.Multitouch
...
This is needed by Starling
2022-09-23 16:04:30 -05:00
kmeisthax
d09ea7514e
chore: Oops, I meant to clamp to total frames.
...
Pointed out by @n0samu
2022-09-23 11:45:52 -06:00
David Wendt
aca1c0fb50
avm1: Clamp `WaitForFrame` ops to the total frame count of the movie clip being tested.
2022-09-23 11:45:52 -06:00
relrelb
1954f6162f
web: Bump `wasm-bindgen` to 0.2.83
...
This reverts commit cf721d45f9
and restores
commit 084b252030
, this time without updating
`web-sys`, due to being coupled to `wgpu`.
2022-09-23 17:23:35 +03:00
relrelb
4828a9c5cf
avm1: Remove `get_` prefix from `ColorTransformObject` getters
...
To match Rust naming conventions.
2022-09-23 11:10:12 +03:00
relrelb
e7643c731b
core: `ColorTransform` cleanup
...
Main changes:
* Merge `ColorTransformParams` into `ColorTransformObject`, as it's only relevant for AVM1.
* Make `BitmapData::color_transform` work with a generic `ColorTransform`, which uses fixed-point
arithmetic.
Note that Ruffle still calculates color transforms slightly different from Flash. This is probably
caused by inaccuracy of the current `ColorTransformObject` to `ColorTransform` conversion and/or the
`ColorTransform` application logic itself. Since this requires further research, it'll be fixed in a
future PR.
2022-09-23 11:10:12 +03:00
EmperorBale
a17352a01a
avm2: Switch XML & XMLList to actionscript
2022-09-22 15:18:23 -07:00
EmperorBale
1cc765d675
avm2: Implement checkfilter opcode
2022-09-22 15:18:23 -07:00
EmperorBale
6dea1fa264
avm2: Implement TypeError
2022-09-22 15:18:23 -07:00
relrelb
2c50a04e37
avm1: Remove `Value::to_primitive_num`
...
Use `Value::to_primitive` instead.
2022-09-22 22:40:07 +03:00
relrelb
d5209c4c43
core: Refactor `Percent` type
...
Unconditionally represet percentages as `f64` between `0.0` and `100.0`.
2022-09-22 04:17:44 +03:00
relrelb
9d4ab37ef6
core: Replace consecutive `push`es with `extend`
...
This should be slightly more efficient.
2022-09-22 03:00:02 +03:00
EmperorBale
fe951b4989
avm2: Implement ByteArray.writeObject
...
While doing this I also noticed that we were incorrectly producing AmfValue::Integer if our
target AMF version is AMF0. This is incorrect because AMF0 is based on AS2, which does not
recognise Integer as a valid type, and therefore must be represented with Number instead.
2022-09-21 13:39:58 -07:00
Daniel Jacobs
eefaca1e05
avm2: Add a few missed ActionScript enums
2022-09-21 20:54:36 +02:00
Aaron Hill
6ad72d0ef9
avm2: Assign 'prototype.name' through class object
...
This makes the files compile under mxmlc
2022-09-21 12:37:37 -05:00
Aaron Hill
e99c7fa4af
Add size assertions for Result<Value, Error> and Value
2022-09-21 12:37:37 -05:00
Aaron Hill
93b7de2fe6
avm2: Use custom Error instead of std::error::Error
2022-09-21 12:37:37 -05:00
Adrian Wielgosik
d1ffaad927
avm2: Support enumerating null/undefined
2022-09-21 00:03:44 +02:00
Aaron Hill
9b9c95bfe2
avm2: Add GameInput and GameInputEvent
2022-09-18 11:37:02 -05:00
EmperorBale
bfca30fed7
avm2: Implement IDataOutput
2022-09-17 12:31:43 -07:00
EmperorBale
b1aff49673
avm2: Implement IDataInput
2022-09-17 12:31:43 -07:00
EmperorBale
7aa821da4f
core: Use class index for `class_id`, instead of slot_id
2022-09-17 12:31:43 -07:00
EmperorBale
e1eaa9770a
avm2: Switch ByteArray to AS
...
avm2: Fix ByteArray
avm2: Implement ByteArray.defaultObjectEncoding
avm2: Rename ByteArray allocator
2022-09-17 12:31:43 -07:00
David Wendt
173b04cc5c
avm2: Allow access to `Stage.loaderInfo.url`
2022-09-17 12:32:15 -06:00
David Wendt
0925412110
avm2: `LoaderInfo` needs to specifically know if it's the stage's loader or not.
2022-09-17 12:32:15 -06:00
David Wendt
dbe6eb324c
avm2: Explicitly delay all frame construction until the first frame is loaded.
...
This prevents the root from being constructed until we know its `SymbolClass`, and is roughly equivalent to delaying the work until `ShowFrame`. (We don't actually run any work on `ShowFrame` in our current movieclip impl.)
2022-09-16 21:44:11 -06:00
David Wendt
247a28d7e9
avm2: Impl `Sprite.useHandCursor`
2022-09-16 19:25:46 -06:00
David Wendt
6f1509d4cd
avm2: Don't attempt to print registers that are out-of-bounds.
2022-09-16 15:46:36 -06:00
David Wendt
38c6369f6e
avm2: Fix `avm_debug` not printing debugging information
2022-09-16 15:46:36 -06:00
David Wendt
187352b1db
chore: Fix stubs to use the new `Error<'gc>` property
2022-09-15 20:25:21 -06:00
David Wendt
e7379a26e9
docs: Mark `z` as needing a version-gate once we have that set up
2022-09-15 20:25:21 -06:00
David Wendt
2b2089e9cb
docs: Bitmap subclasses tickle the "initialized by movie" code path because the DisplayObject code actually does its job here
2022-09-15 20:25:21 -06:00
David Wendt
bd8ff4f024
avm2: Add support for Bitmaps being associated to subclasses of `flash.display.Bitmap`
2022-09-15 20:25:21 -06:00
David Wendt
fc02715faa
avm2: Stub `z`, `scaleZ`, and all 3D rotation properties
2022-09-15 20:25:21 -06:00
David Wendt
3c0b9b9f62
avm1: Implement `ActionWaitForFrame` and `ActionWaitForFrame2`.
2022-09-15 19:14:41 -06:00
David Wendt
aa9e24fb9d
core: Limit gotos to the currently loaded frame count
2022-09-15 19:14:41 -06:00
David Wendt
c7e29e4173
chore: Various nitpicks and compilation fixes
2022-09-15 19:14:41 -06:00
David Wendt
af9db3e9c7
docs: Drop "action" language for `ExecutionLimit` as that is confusable for AVM actions.
...
We now call them "operations" and clarify that they could be either AVM actions or SWF bytes.
2022-09-15 19:14:41 -06:00
David Wendt
44f1cdfdec
avm2: `LoaderInfo` reports correct total size for SWFs loaded in-memory
2022-09-15 19:14:41 -06:00
David Wendt
f3ca7f7673
avm2: Still-loading SWFs do not report a `url`
2022-09-15 19:14:41 -06:00
David Wendt
8f5afe09a1
core: Refactor `movie_loader` and its `loadBytes` variant to call into the same code.
2022-09-15 19:14:41 -06:00
David Wendt
86ecf6076e
core: `loadBytes` does not emit `open`
2022-09-15 19:14:41 -06:00
TÖRÖK Attila
d0277f7fe8
avm2: Add `Loader.loadBytes`
2022-09-15 19:14:41 -06:00
David Wendt
006269e1f8
core: Delay completion events until after the SWF is reported as fully loaded.
2022-09-15 19:14:41 -06:00
David Wendt
0a25f265d6
core: `LoaderInfo` now optionally contains a reference to the root clip in the not-loaded state so that things like `bytesLoaded` work
2022-09-15 19:14:41 -06:00
David Wendt
4976dc973d
core: Emit a progress event after every preload tick.
...
This does not cover root movies, which already get progress events as part of a prior commit.
2022-09-15 19:14:41 -06:00
David Wendt
e589df650f
core: Centralize compressed length calculations into `movieclip.rs`
2022-09-15 19:14:41 -06:00
David Wendt
1323355a69
avm2: Fire progress events when the root movie is preloaded.
...
This is currently somewhat buggy, `homestuck_02791.swf` stops at 12% for some reason. I tried handing it both compressed and uncompressed lengths with no luck.
2022-09-15 19:14:41 -06:00
David Wendt
07bd7dda2e
core: Do not overflow when querying loaded bytes on a fully-loaded movie.
2022-09-15 19:14:41 -06:00
David Wendt
029fecaa94
avm2: Implement `LoaderInfo.bytesLoaded`.
...
This requires estimating a count of bytes loaded of the original compressed stream, even though we only have uncompressed byte totals at this point. I instead rescale the uncompressed bytes by the compressed count to roughly estimate what would be the `bytesLoaded` had we been actually streaming bytes in and preloading them synchronously.
2022-09-15 19:14:41 -06:00
David Wendt
bd08a6ebfe
avm1: Expose preload progress to AVM1 via `getBytesLoaded`
2022-09-15 19:14:41 -06:00
David Wendt
0eff0bf91a
core: Remove all synchronous preloading from core.
...
Backends that need synchronous preload behavior now explicitly ask for it as follows:
* `tests` - repeatedly call `preload` in a loop with an exhausted execution limit to stress-test the chunked preload
* `exporter`, `scanner` - synchronous/unlimited preload to match prior behavior
These may change in the future.
2022-09-15 19:14:41 -06:00
David Wendt
3d799acd96
core: Report to callers of preload if all preloading work was done or not.
2022-09-15 19:14:41 -06:00
David Wendt
10e944a911
core: Turns out this is NOT redundant, I just misread the loop points
2022-09-15 19:14:41 -06:00
David Wendt
15b781ff04
chore: Remove old version of code left behind during rebasing
2022-09-15 19:14:41 -06:00
David Wendt
89fcca4f0b
core: Only mark the end of the frame if we hit the end of the tag stream.
2022-09-15 19:14:41 -06:00
David Wendt
f272cba7e6
core: If we're marked as finished, set the preload position to `u64::MAX` so that the repeated call protection trips
2022-09-15 19:14:41 -06:00
David Wendt
31802ea96f
chore: Reduce the number of necessary reads of the preload progress
2022-09-15 19:14:41 -06:00
David Wendt
ea284ed6bf
core: Preload should always start from the place we left off from.
2022-09-15 19:14:41 -06:00
David Wendt
afd29d19a4
core: Don't do any work if a clip is preloaded after finishing preload.
2022-09-15 19:14:41 -06:00
David Wendt
86f9ee4821
core: Add a "preload everything we know about" method
2022-09-15 19:14:41 -06:00
David Wendt
940de4bb7e
core: Add a special loader state for "downloaded but still parsing", and a function that ticks the preload.
...
Currently we do this automatically with no execution limit.
2022-09-15 19:14:41 -06:00
David Wendt
70e638b21f
core: Actually decrease the current action limit correctly
2022-09-15 19:14:41 -06:00
David Wendt
a05827eb90
core: Add a concept of an `ExecutionLimit` that checks both actions and runtime.
...
Actions are abstract; here we're using it to count bytes loaded (as a proxy for execution time). AVM code could potentially be adapted to count operations run instead.
2022-09-15 19:14:41 -06:00
David Wendt
c80abff3a9
core: Allow chunked preloading within a `DefineSprite` tag
2022-09-15 19:14:41 -06:00
David Wendt
3a265adcc4
core: Ensure empty movie clips are born preloaded.
...
An "empty clip" is any clip created by the `new` or `new_with_avm2` function, intended for dynamically-created movie clips with no association to a movie symbol.
2022-09-15 19:14:41 -06:00
David Wendt
f96017e6f3
avm2: Preload dynamically created movie clips
...
If we don't preload every movie clip we make, then they'll indicate themselves as not having been fully loaded yet, even though they are.
2022-09-15 19:14:41 -06:00
David Wendt
0f2237e171
core: Make frame loaded count no longer be off by one
...
The preload frame counting logic starts from one and continues to the end of the file, which results in a completely preloaded movie having one more frame "loaded" than there is in the file. This fixes that.
2022-09-15 19:14:41 -06:00
David Wendt
079b20a4f2
core: On unexpected EOF, mark the clip preload as completed
2022-09-15 19:14:41 -06:00
David Wendt
85cf383c84
core: Allow callers of `decode_tags` to flag when they would like decoding to stop
2022-09-15 19:14:41 -06:00
David Wendt
f7f5316b71
core: Prohibit playing movie clip frames that haven't been preloaded yet.
2022-09-15 19:14:41 -06:00
David Wendt
0ab10d9ab0
core: Make the preload chunk size configurable per caller.
...
Right now, we do not actually set a chunk limit, as we still need infrastructure for backgrounding the preload calls.
2022-09-15 19:14:41 -06:00
David Wendt
b5cbfaf093
core: When preloading other movie clips, forcibly preload them synchronously.
2022-09-15 19:14:41 -06:00
David Wendt
4e9bb3a173
core: Implement chunked decoding infrastructure.
...
We currently do not actually enforce a decoding limit; just add the functionality necessary to do so.
2022-09-15 19:14:41 -06:00
golfinq
c63f915ae2
avm2: Implement missing enums
2022-09-15 15:42:29 -07:00
Daniel Jacobs
cf721d45f9
Revert "web: Bump `wasm-bindgen` to 0.2.83"
...
This reverts commit 084b252030
.
2022-09-15 22:33:07 +02:00
relrelb
084b252030
web: Bump `wasm-bindgen` to 0.2.83
...
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
Due to https://github.com/rustwasm/wasm-bindgen/pull/3031 , use the
`serde-wasm-bindgen` crate as a replacement to the deprecated
`JsValue::from_serde` function.
2022-09-14 09:03:31 +03:00
Aaron Hill
e08f8d47ab
Allow clippy::needless_lifetimes to keep explicit 'gc parameter
...
This makes it clear what the lifetime is used for.
2022-09-13 18:55:08 -05:00
Aaron Hill
c4ce06a500
avm2: Use Box<dyn std::error::Error> for FromWStr impl
...
We don't currently have an `Activation` available in this
method, and we can't specify a 'gc lifetime without modifying
the trait itself.
2022-09-13 18:55:08 -05:00
Aaron Hill
3e65a554fa
avm2: Add 'gc lifetime parameter to avm2::Error
2022-09-13 18:55:08 -05:00
relrelb
b1760063ec
avm2: Implement `flash.filters.DisplacementMapFilterMode`
2022-09-13 21:20:55 +03:00
relrelb
5d5093f0fd
avm2: Implement `flash.filters.BitmapFilterType`
2022-09-13 21:20:55 +03:00
dependabot[bot]
cf26158030
build(deps): bump url from 2.2.2 to 2.3.1
...
Bumps [url](https://github.com/servo/rust-url ) from 2.2.2 to 2.3.1.
- [Release notes](https://github.com/servo/rust-url/releases )
- [Commits](https://github.com/servo/rust-url/compare/v2.2.2...v2.3.1 )
---
updated-dependencies:
- dependency-name: url
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 09:42:27 +03:00
dependabot[bot]
69a43297df
build(deps): bump convert_case from 0.5.0 to 0.6.0
...
Bumps [convert_case](https://github.com/rutrum/convert-case ) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/rutrum/convert-case/releases )
- [Commits](https://github.com/rutrum/convert-case/commits )
---
updated-dependencies:
- dependency-name: convert_case
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 09:20:12 +03:00
dependabot[bot]
e86b3f0efb
build(deps): bump percent-encoding from 2.1.0 to 2.2.0
...
Bumps [percent-encoding](https://github.com/servo/rust-url ) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/servo/rust-url/releases )
- [Commits](https://github.com/servo/rust-url/compare/percent-encoding-v2.1.0...v2.2.0 )
---
updated-dependencies:
- dependency-name: percent-encoding
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 08:45:46 +03:00
Adrian Wielgosik
1c940009a1
avm2: Convert Capabilities, System to AS
2022-09-12 02:03:34 +02:00
TÖRÖK Attila
866f5c83c5
avm2: Add `flash.filters.BitmapFilterQuality`
2022-09-11 22:05:15 +02:00
Aaron Hill
fbcefc49dc
avm2: Fix "Property does not exist" error message
...
The `multiname` is now a `Gc`, so we need to dereference it
to get a useful Debug impl.
2022-09-11 11:34:52 -05:00
Aaron Hill
81a5f3f10a
core: Always check mergeAlpha in BitmapData.copyPixels
...
Previously, we would only use mergeAlpha if alphaBitmapData
and alphaPoint. However, mergeAlpha can be used even when
those parameters are null.
Some of the AVM1 argument handling was also incorrect - I've fixed
it, and extended the existing test with the output-based test
added for AVM2.
2022-09-11 11:12:09 -05:00
Aaron Hill
1d6b3b6f57
chore: Fix Clippy lints and allow `clippy::bool_to_int_with_if`
...
In several cases, the current code seems preferable to the
code required by `clippy::bool_to_int_with_if`. Let's suppress
this for now to get the build passing, and decide later if this
is something that we want to enable.
2022-09-11 13:31:46 +02:00
Nathan Adams
267ea0fd13
render: Introduced render commands, moved to a command list model instead of direct rendering
2022-09-11 09:07:53 +02:00
Aaron Hill
a638b0498e
core: Render Bitmap even if bitmap_data is None
...
We only need to access bitmap_data to check if we need to
update a dirty texture.
2022-09-11 07:06:11 +03:00
Aaron Hill
8370bc792d
core: Use correct background alpha in BitmapData.draw
...
Previously, we would always use a transparent background,
even if the BitmapData is not transparent. This would normally
be corrected on the next frame when we copied the pixels to the
CPU. However, if an SWF ran `BitmapData.draw` on every frame,
this would never be corrected.
2022-09-09 19:24:21 -05:00
Aaron Hill
5de21428f5
core: Update dirty BitmapData before rendering
...
We now have a `MutationContext` available, so this doesn't need
to be done in `run_frame`
2022-09-09 16:36:40 -07:00
Adrian Wielgosik
4421fbff6a
avm2: Convert all Qname::new(...).into() to Multiname::new() ( #7930 )
2022-09-09 23:33:30 +02:00
Aaron Hill
ca030169f7
avm2: Implement BitmapData.rect and stub BitmapData.applyFilter
...
These are the last BitmapData methods needed for Solarmax
(the victory screen after beating the last level now renders).
2022-09-09 13:05:13 -05:00