Nathan Adams
760da753fb
render: Moved Transform from core to render
2022-08-14 18:38:14 -07:00
Nathan Adams
f088d8ac3a
render: Moved color_transform from core to render
2022-08-14 18:38:14 -07:00
Nathan Adams
35082b687f
render: Moved shape_utils from core to render
2022-08-14 18:38:14 -07:00
Nathan Adams
b3afb59b53
render: Moved BoundingBox from core to render
2022-08-14 18:38:14 -07:00
Nathan Adams
91a7047ebb
render: Moved Matrix from core to render
2022-08-14 18:38:14 -07:00
Nathan Adams
9fd8fd938e
render: Moved render utils from core to render
2022-08-14 18:38:14 -07:00
Nathan Adams
bc0c7cbccb
render: Made new render crate, moved Bitmap stuff to it
2022-08-14 18:38:14 -07:00
Nathan Adams
94282dfe73
core: Moved render utils into own module
2022-08-14 18:38:14 -07:00
Nathan Adams
0bb14193c6
core: Moved Bitmap into its own module for refactoring rendering
2022-08-14 18:38:14 -07:00
Nathan Adams
beab50cde7
core: Moved NullRenderer into its own module in preparation for refactoring
2022-08-14 18:38:14 -07:00
relrelb
d70697b4f3
web: Refactor `WebNavigatorBackend`
...
Store `base_url` as `Option<Url>` instead of `Option<String>`, so
we don't need to parse it on each URL resolve.
2022-08-14 17:49:05 -07:00
Aaron Hill
a99c7e381b
avm2: Improve `Debug` impl for `StageObject`
...
This builds off of the previous work for `ScriptObject` and
`ClassObject`. We now print both the class name and the stored
`DisplayObject`.
2022-08-14 15:31:53 -05:00
Aaron Hill
d6532c87c2
avm2: Stub TimerEvent.updateAfterEvent
...
This is the last stub needed for Wonderputt to reach the
main game screen.
As far as I know, ActionScript cannot observe a frame being rendered,
so implementing this method isn't actually necessary for correctness.
The benefit of implementing this would be to make certain animations
appear smoother, since we'll render changes to the scene without
needing to wait for the next frame. However, actually rendering
*immediately* after the event would require some refactoring -
we have a `&mut UpdateContext` while running timers, but we'd need
to bail out and obtain a `&mut Player`.
2022-08-13 19:24:56 +02:00
Aaron Hill
ef4a955e65
avm2: Always get loaderInfo from the root object
2022-08-13 02:06:38 -07:00
relrelb
8a7e96b0d5
avm2: Split `names.rs`
...
Into `namespace.rs`, `multiname.rs` and `qname.rs`, for better code
organization.
2022-08-13 02:12:53 +03:00
Nathan Adams
7dff19b559
core: Use a fixed seed when using deterministic feature
2022-08-12 13:11:46 +03:00
Aaron Hill
4a42bae333
avm2: Fix ApplicationDomain property declarations
...
Many of the class property defintiions were wrong -
instance methods were defined as class properties,
and class properties were defined as instance properties.
2022-08-12 10:45:03 +02:00
Aaron Hill
91993eb872
avm2: Stub URLRequest.data
...
This allows Wonderputt to get further (it deliberately assigns
'null' to 'URLRequest.data'). We throw an exception for any other
value, to prevent confusing errors caused by attempting an
unexpected request to a web server with a missig body.
2022-08-12 10:14:36 +02:00
Aaron Hill
9d1f27484b
avm2: Implement 'throw' opcode
...
We currently lack the ability to preserve the original
`Value<'gc>` in the error, so we're forced to stringify the error.
This means that only typeless 'catch' blocks will work properly -
however, they're the only kind of 'catch' block that we currently
implement. Implementing support for typed 'catch' blocks will naturally
allow us to preserve the original 'Value<'gc>' in the 'throw'
implementation, since we'll need to switch to a custom `Error<'gc>`
type.
2022-08-11 17:20:53 -05:00
Adrian Wielgosik
4a7cb51148
avm2: Make missing props on sealed classes throw properly
2022-08-11 21:28:18 +02:00
Aaron Hill
71571b9594
avm2: Add URLRequest.method and use it URLLoader
2022-08-11 19:50:58 +02:00
Aaron Hill
ed0512ca9d
avm2: Show class name in `ClassObject` Debug impl
...
Before: `ClassObject(GcCell(Gc { ptr: 0x7f69f8300a28 }))`
After: `ClassObject { name: flash.net::URLRequest, ptr: 0x7fe9cc2e7820 }`
2022-08-11 18:54:11 +02:00
TÖRÖK Attila
d5b86f60a1
avm2: Add `flash.system.LoaderContext`, stub `flash.system.SecurityDomain`
...
Also add AS stubs for the preexisting `flash.display.DisplayObjectContainer`
and `flash.system.ApplicationDomain` natively defined classes.
2022-08-11 10:01:03 +02:00
dowgird
b6fd670410
address review comments
2022-08-10 01:34:08 +02:00
dowgird
38f50f83ef
removed a now unused function, added a test
2022-08-10 01:34:08 +02:00
dowgird
e5b0937461
changed catch_scope() back to taking MutationContext
2022-08-10 01:34:08 +02:00
dowgird
5ccc981357
Used install_instance_slots() instead of adding slots manually
2022-08-10 01:34:08 +02:00
dowgird
fb0a984415
Rebase and fix clippy warnings.
2022-08-10 01:34:08 +02:00
dowgird
31ed697acd
Fixes from review
2022-08-10 01:34:08 +02:00
dowgird
26b41199fb
avm2: Implemented newcatch and basic exception handling
2022-08-10 01:34:08 +02:00
Adrian Wielgosik
54f9824ce0
avm1: Update drag in stopDrag() in case it wasn't called before
2022-08-10 00:20:09 +02:00
Nathan Adams
07da3f6c0f
exporter: Add --skip-unsupported to skip (and not crash) avm2 movies
2022-08-09 23:19:42 +02:00
Nathan Adams
8efd69b525
core: Track 'actions since timeout check' globally instead of per Activation
2022-08-09 20:56:18 +03:00
Nathan Adams
fb1ebcb9cc
avm1: loadMovieNum with blank url is an unload, not a load - fixes #7337
2022-08-09 18:53:57 +03:00
Nathan Adams
4b19910791
audio: Avoid panic with supposed MP3s that are too small
2022-08-09 17:59:02 +03:00
dependabot[bot]
4603e5964e
build(deps): bump serde from 1.0.141 to 1.0.143
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.141 to 1.0.143.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.141...v1.0.143 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-09 11:54:47 +03:00
dependabot[bot]
ab44ff8c13
build(deps): bump syn from 1.0.98 to 1.0.99
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.98 to 1.0.99.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.98...1.0.99 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-09 09:25:48 +03:00
dependabot[bot]
8acb77dc2c
build(deps): bump proc-macro2 from 1.0.42 to 1.0.43
...
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2 ) from 1.0.42 to 1.0.43.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.42...1.0.43 )
---
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-08-09 08:51:01 +03:00
dependabot[bot]
ed1ebe8fb5
build(deps): bump quote from 1.0.20 to 1.0.21
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.20 to 1.0.21.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.20...1.0.21 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 23:58:43 +02:00
TÖRÖK Attila
5e2804f992
avm2: Implement `flash.geom.Vector3D`
2022-08-08 22:15:09 +03:00
CUB3D
05bfa3770e
chore: Fix warnings with cargo doc
2022-08-08 20:20:18 +03:00
relrelb
e42a6b62e6
core: Require `target` in `NavigatorBackend::navigate_to_url`
...
Make the `target` parameter just a `String` instead of an `Option<String>`.
`None` is not needed as it's totally equivalent to an empty string.
2022-08-06 11:20:03 +03:00
Aaron Hill
2f8dde86af
avm2: Include class name in ScriptObject debug ( #7512 )
...
* avm2: Include class name in ScriptObject debug
Currently, the `ScriptObject` debug impl is almost useless -
while you determine if two printed objects are the same
by comparing the pointer value, you'll have no idea what
kind of object it actually is.
This PR now formats the `ScriptObject` output as a struct,
printing a (fake) "class" field containing the class name.
Before/after:
```
[ERROR ruffle_core::avm2::activation] AVM2 error: Cannot coerce Object(ScriptObject(ScriptObject(GcCell(Gc { ptr: 0x55f863936db8 })))) to an QName { ns: Private("Test.as$38"), name: "Second" }
[ERROR ruffle_core::avm2::activation] AVM2 error: Cannot coerce Object(ScriptObject(ScriptObject { class: "Object", ptr: 0x55ee0ad161e0 })) to an QName { ns: Private("Test.as$38"), name: "Second" }
```
Getting access to the class name from a `Debug` impl is tricky:
Developers can (and should be able to) insert logging statements
whereever they want, so any `GcCell` may be mutably borrowed.
Panics in debug impls are extremely frustrating to deal with,
so I've ensured that we only use `try_borrow` at each step.
If any of the attempted borrows fail, we print out an error message
in the "class_name" field, but we're still able to print the
rest of the `ScriptObject`.
Additionally, we have no access to a `MutationContext`, so we
cannot allocate a new `AvmString`. To get around this,
I've created a new method `QName::to_qualified_name_no_mc`,
which uses an `Either` to return a `WString` instead of allocating
an `AvmString`. This is more cumbersome to work with than the
nrmal `QName::to_qualified_name`, so we'll only want to use
it when we have no other choice.
2022-08-04 22:13:00 -07:00
Aaron Hill
2383e6850f
avm2: Continue to process event when a handler produces an error
...
An exception thrown by one event handler shoud not prevent other event
handlers from running on this same event. Some SWFs like Wonderputt
depend on this behavior, as they have buggy event handlers that throw
errors.
2022-08-03 22:29:41 +03:00
Aaron Hill
ad19c29c03
Remove `null` from `getChildByName` for missing child
...
This matches the behavior of Flash - no error is produced.
2022-08-03 21:45:59 +03:00
dependabot[bot]
f7f84418f9
build(deps): bump proc-macro2 from 1.0.41 to 1.0.42
...
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2 ) from 1.0.41 to 1.0.42.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.41...1.0.42 )
---
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-08-02 22:37:35 +03:00
dependabot[bot]
3b7f6976a4
build(deps): bump serde from 1.0.140 to 1.0.141
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.140 to 1.0.141.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.140...v1.0.141 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-02 19:34:44 +03:00
Adrian Wielgosik
e214dd5ce5
avm2: Implement BitmapData.scroll/copyPixels, stub lock()
2022-08-01 22:31:42 +03:00
Adrian Wielgosik
17f090d1d5
avm2: Stub Loader.contentLoaderInfo
2022-08-01 22:31:42 +03:00
TÖRÖK Attila
820196d066
audio: Handle AudioCompression::UncompressedUnknownEndian in AudioMixer::make_seekable_decoder()
...
The same way as it is done in decoders::make_decoder().
2022-08-01 21:39:01 +03:00
Aaron Hill
2ce6679643
avm2: Store PropertyClass in `VtableData`
...
Calling `get_trait` copies the returned `Property`, so the caching
we performed in `PropertyClass` was never actually getting used.
Instead, we now store our `PropertyClass` values in a `Vec`
indexed by slot id. `set_property` and `init_property` now perform
coercions by going through the `VTable,` which writes the updated
`PropertyClass` back into the array.
2022-07-30 17:58:50 -07:00
Adrian Wielgosik
5be7f425f0
avm2: Migrate all Events to AS, remove EventData.
2022-07-30 12:34:12 -07:00
relrelb
d01a03b4ca
avm1: Correct `ActionURShift`
...
In SWF8 and SWF9, unsigned right shift actually has a signed result.
2022-07-29 14:44:21 -07:00
Ali MJ Al-Nasrawy
67fbc84ba3
don't rely on a rustc bug
...
context: https://github.com/rust-lang/rust/pull/98835
2022-07-29 15:27:46 -05:00
Aaron Hill
0d3e046b0e
avm2: Allow classes to reference their own type from a static variable
...
FP allows code like
`class Foo { static var INSTANCE: Foo = new Foo(); }`
However, this breaks our current property type coercion setup -
we cannot resolve the type `Foo` when setting the property `INSTANCE`,
since `Foo` is still being constructed.
Fortunately, we can perform this 'coercion' by just checking if
the object's class name and domain match the type name and domain
of the property.
2022-07-29 13:24:37 -07:00
relrelb
79f36964b4
web: Bump wasm-bindgen to 0.2.82
...
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
2022-07-29 09:40:14 -07:00
Mike Welsh
30b185cbd4
audio: Reset symphonia decoder on loop
2022-07-28 21:25:33 -07:00
TÖRÖK Attila
7249db9052
audio: Fix crash/gap at the end of MP3 loops
2022-07-28 21:25:33 -07:00
Mike Welsh
ffb57467eb
audio: Add `AudioBackend::position_resolution`
...
This returns the approximate interval that the audio backend
updates the sound position information. This is used for syncing
animation to embedded "stream" audio tracks, and fixes some
stuttering in cases where the syncing was being too strict.
2022-07-28 21:25:33 -07:00
Mike Welsh
405c7194b0
audio: Remove `AudioBackend::preload_sound_stream` fns
...
No longer necessary now that web audio mixing is done on Rust side.
2022-07-28 21:25:33 -07:00
Aaron Hill
f2deeb4de8
Fix typo
2022-07-27 22:38:49 -07:00
Aaron Hill
49d1a985ca
avm2: Store `LoaderInfo` object on `MovieClip` and `Stage`
...
Previously, we would create a fresh `LoaderInfo` object each
time the `loaderInfo` property was accessed. However, users can
add event handlers to a `LoaderInfo`, so we need to create and
store exactly one `LoaderInfo` object per movie (and stage).
To verify that we're correctly handling the storage of `LoaderInfo`,
I've implemented firing the "init" event. This required a new
`on_frame_exit` hook, so that we can properly fire the "init"
event after the "exitFrame" for the initial frame but before
the "enterFrame" of the next frame.
2022-07-27 22:38:49 -07:00
EmperorBale
d14b868c4f
core: Simplify new_utf8_bytes
2022-07-25 10:52:56 -07:00
EmperorBale
a2261cd556
chore: Formatting
2022-07-25 10:52:56 -07:00
EmperorBale
d6604f538c
wstr: Implement custom UTF-8 decoding routine
2022-07-25 10:52:56 -07:00
EmperorBale
6dab6ca557
avm2: Update set_data to convert bytes to string lossily
2022-07-25 10:52:56 -07:00
EmperorBale
d79c68bbcd
core: Implement AvmString::new_utf8_bytes_lossy
2022-07-25 10:52:56 -07:00
Aaron Hill
515c7bf518
Fix behavior when setting repeatCount, and improve tests
2022-07-24 20:43:00 -07:00
Aaron Hill
b4f98190e9
avm2: Implement flash.utils.Timer and associated events
...
The current 'setInterval/setTimeout' implementation is
moved to 'core/src/timers.rs', and now works with both
AVM1 and AVM2 objects. The `flash.utils.Timer` class is implemented
mostly in ActionScript, with minimal modifications to the actual
Ruffle timer code.
2022-07-24 20:43:00 -07:00
relrelb
3bfe736262
core: Remove `From<Position<Twips>> for Transform`
...
Simply use `Matrix::translate` directly, which is more explicit and
intuitive.
2022-07-24 19:07:05 -07:00
relrelb
bbfd272c15
avm1: Use `Matrix::scale`
...
Instead of a directly initialzed `Matrix`.
2022-07-24 22:11:31 +03:00
relrelb
fc87a35572
core: Remove some dead `DisplayObject` methods
2022-07-23 22:22:20 +03:00
relrelb
8d30833d02
core: Don't use `saturating_sub` for `width` / `height`
...
Use regular subtraction, since it should never overflow.
Also remove `swf::Twips::saturating_sub`, which is now unused.
2022-07-23 10:33:12 -07:00
relrelb
29ae39a2d1
core: Remove unused parameter of `Avm1Button::from_swf_tag`
2022-07-23 10:18:53 -07:00
Rafał Dowgird
fac32b488b
avm2: implement string replace(string, function) ( #7456 )
...
* avm2: implement string replace where pattern is string and replacement is a function
* * removed unnecessary vec!
* fixed "no newline at the end of file"
2022-07-22 17:32:02 +03:00
Aaron Hill
bb6f07ee1a
avm2: Add support for playerglobal instance allocators
...
This commit adds support for combining instance allocators with
ActionScript playerglobal class definitions. This is activated
by defining the metadata `[Ruffle(InstanceAllocator = "true")]`
on the ActionScript class definition.
The implementation of this feature is very similar to native methods:
`build_playerglobal` checks for the metadata described above,
and defines a const `NATIVE_INSTANCE_ALLOCATOR_TABLE` mapping
class ids to function pointers.
To demonstrate this feature, I've converted `Event` to ActionScript
(keeping the existing instance allocator function).
I've also converted `ActivityEvent` and `ContextMenuEvent` to
`ActionScript`, to demonstrate how this simplifies inheritance.
In a future PR, we can convert the remaining events to ActionScript,
and remove the `EventData` enum entirely.
Unfortunately, `flex-sdk`'s `asc.jar` compiler strips out all metadata
when the `-optimize` option is passed. As a result, I forked
`flex-sdk` and disabled this behavior:
https://github.com/ruffle-rs/flex-sdk/releases/tag/ruffle-1.0.0
The modified `asc.jar` (built from the forked repository)
is included in this PR, and replaces the our previous 'asc.jar'
downloaded from the official Flex SDK release.
* Change metadata to `[Ruffle(InstanceAllocator)]`
* Strip out metadata before saving bytecode
2022-07-20 23:11:46 -07:00
Mike Welsh
ef838a3536
avm1: lineStyle scale mode defaults to normal
2022-07-19 15:01:17 -07:00
Mike Welsh
1980d6f420
canvas: Scale stroke width based on shape transform
2022-07-19 15:01:17 -07:00
relrelb
23fdc2b2ee
chore: Appease clippy
2022-07-19 09:26:46 +03:00
Rafał Dowgird
934cb05371
avm2: implement string.replace(...) with fn, for now regex only. ( #7429 )
...
* avm2: implement string.replace(...) with fn, for now regex only.
* string - added path for replacing regex with fn (replacing string
with fn is still unimplemented)
* regex - factored out common replace logic for when replacement is
a string and when it is a function
* added tests
* Addressed review comments
* removed tinkering cruft; formatting
* addressed review comments
2022-07-19 08:47:57 +03:00
dependabot[bot]
2ffded778b
build(deps): bump symphonia from 0.5.0 to 0.5.1
...
Bumps [symphonia](https://github.com/pdeljanov/Symphonia ) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/pdeljanov/Symphonia/releases )
- [Commits](https://github.com/pdeljanov/Symphonia/compare/v0.5.0...v0.5.1 )
---
updated-dependencies:
- dependency-name: symphonia
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 00:31:17 +03:00
relrelb
0e65617d4a
avm2: Small cleanup in `RegExp::effective_replacement`
...
`char_indicies()` isn't really needed because the position is never
used.
So use the simpler `chars()` method instead.
2022-07-18 10:53:18 +03:00
Adrian Wielgosik
22d2810ef9
avm2: Migrate ContextMenu-related classes to AS
2022-07-17 11:05:37 -07:00
relrelb
cad3cd8dbf
avm2: Inline `Activation::run_stack_frame_for_script`
...
This reduces some complexity.
2022-07-15 17:15:14 -05:00
Aaron Hill
af4f181856
avm2: Implement support for native methods in `playerglobal`
...
This commit adds support for marking methods as `native`
in ActionScript classes defined in playerglobal. The
`build_playerglobal` now checks for native methods, and
generates Rust code linking them to a corresponding Rust
function definition in the codebase.
To test this functionality, I've reimplemented several
functions as native methods (and moved related code to
pure ActionScript).
2022-07-15 11:43:49 -05:00
EmperorBale
95809f8a9b
avm2: Make escape output for unicode characters, as well as characters that need padding
2022-07-15 15:29:55 +03:00
dowgird
cfc9f51c5d
avm2: implement $ patterns in regex replace
2022-07-13 15:48:25 -06:00
dependabot[bot]
90ecdfaff5
build(deps): bump serde from 1.0.138 to 1.0.139
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.138 to 1.0.139.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.138...v1.0.139 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 23:35:30 +03:00
Rafał Dowgird
80d1a8449a
avm2: implement string.split for regex ( #7363 )
...
* avm2: implement string.split for regex
* Compressed the testing for regexp and unwrapping thereof
* * Moved the split logic into the regex object
* Factored out a method for utf-16 matching
* Added tests
* formatting
* * replaced manual counting with storage.length()
* clippy cleanup
* Address review comments
* fix import path for WString
* remove redundant variable in return statement
* error passing via '?' instead of unwrap()
2022-07-11 19:47:05 +03:00
relrelb
9856a03797
avm1: Inline `apply_to_display_object`
2022-07-10 07:29:38 +03:00
relrelb
78ebf06f55
avm2: Extract `MethodFlags` enum
2022-07-09 20:34:53 +03:00
relrelb
f643048c1c
core: Introduce `Request`
...
Which holds both a URL and what was `RequestOptions` formerly.
2022-07-09 09:43:42 +03:00
relrelb
115f15806e
chore: Fix `needless_borrow` clippy lints
...
Though https://github.com/rust-lang/rust-clippy/pull/8355 has been
merged, it seems to still report false-positives on nightly channel.
For now just fix the instances reported by stable clippy, and keep
`needless_borrow` allowed.
2022-07-08 14:14:30 +03:00
relrelb
2f4e31c6be
avm1: Avoid allocation of some static strings
...
Prefer creating a static `AvmString` over allocating an owned one.
2022-07-06 09:19:12 +03:00
relrelb
9c1a05aaaf
avm2: Re-use code in `coerce_to_number`
...
Use `string_to_f64` and `string_to_int`, as [`MathUtils::convertStringToNumber`](858d034a3b/core/MathUtils.cpp (L453-L466)
)
in avmplus does.
2022-07-06 09:04:15 +03:00
dependabot[bot]
55e985da8c
build(deps): bump serde from 1.0.137 to 1.0.138
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.137 to 1.0.138.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.137...v1.0.138 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 08:43:27 +03:00
dependabot[bot]
52bc7a39b4
build(deps): bump smallvec from 1.8.1 to 1.9.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.8.1 to 1.9.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.8.1...v1.9.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-07-04 23:32:26 +03:00
Mike Welsh
1963e47392
avm1: Increment register when preloading super ( fix #7338 )
...
The register index was not being increment when preloading the
`super` register which would cause issues when multiple registers
were preloaded.
Fixes #7338 .
2022-07-03 12:51:07 -07:00
relrelb
f0db6d8c60
avm1: Correct `parseFloat()`
...
Rewrite the implementation of `string_to_f64()` to match Flash behavior.
This affects `parseFloat()` as well as any `Value` to `f64` coercion.
2022-07-02 18:08:08 -07:00
relrelb
10af9435ae
avm2: Minor `parseInt()/parseFloat()` tweaks
...
Alongside comment wordings, fix handling of non-`u8` characters by
replacing `as u8` conversions with `u8::try_from()`, that doesn't
wrap around, but rather fails gracefully.
2022-07-02 17:48:19 -07:00
relrelb
65be2adc63
wgpu: Bump to `0.13.0`
...
Based on the work in #6717 , plus additional adaptions mentioned in
https://github.com/gfx-rs/wgpu/blob/master/CHANGELOG.md#wgpu-013-2022-06-30 ,
and more not-mentioned but required changes.
Also bump `wasm-bindgen` to `0.2.81` (along with its helper crates), as
required by the new `wgpu` version.
Note that I don't fully understand some of the required changes, notably:
* `wgpu::PresentMode::Mailbox` no longer works on my machine (Windows 11) -
The `wgpu` documentation says that `wgpu::PresentMode::Fifo` is the
only guaranteed to be supported, so I switched over to it instead.
* `self.staging_belt.recall()` doesn't return a `Future` anymore -
I assume it became synchronous so I simply removed the `executor`
from there.
2022-07-02 16:44:37 -07:00
Toad06
e219cb3b1c
avm1: Fire `onData` function and event when calling `loadVariables`
2022-07-02 10:22:48 -07:00
relrelb
981fa0568c
chore: `derive(Default)` for enums
...
It's available since stable Rust 1.62.0.
2022-07-02 09:23:04 -07:00
Aaron Hill
b56eace008
avm2: Implement property type coercions
...
Properties can be declared with a type
(e.g. `var foo:MyClass = new MyClass();`). When
`set_property`/`init_property` is invoked for that property,
the VM will attempt to coerce the value to the provided type,
throwing an error if this fails. This can have observable behavior
consequences - if a property has type `integer`, for example, then
storing a floating point `Number` to that property will cause the
value to be coerced to an integer. Some SWFs (e.g. 'Solarmax') rely
on this behavior in order to implicitly coerce a floating point value
that's later used for array indexing.
This PR implements property type coercions in Ruffle. There are several
important considerations:
* The class lookup for property types needs to be done lazily, since
we can have a cycle between two classes (e.g. `var prop1:Class2;`
and `var prop2:Class1` in two different classes).
* The class lookup uses special rules (different from
`resolve_definition`), and does *not* use `ScopeStack/`ScopeTree`
This means that a private class can specified as a property name -
the lookup will succeed without using a scope, even though
`flash.utils.getDefinitionByName` would fail with the same name
* The specialized 'Vector' classes (e.g "Vector$int") can be used
as property types, even though they cannot be lookup up normally.
Some Ruffle class definitions were previously using nonexistent
classes as property types (e.g. "BareObject") - these are fixed
in this PR.
2022-06-30 21:34:26 -07:00
Moulins
c7bf11ece5
avm1: More accurate handling of preload/suppress flags in functions
...
- Handle the case where both preload aud suppress flags are
set for the same variable;
- Remove `arguments` field in `Activation`; instead use a normal
local definition;
- When `suppress_this` is set, inherit the `this` value from parent
activation. (This isn't entirely correct, as FP's `this` is mutable
and seems to be part of the scope chain, but this would require a
larger refactoring)
2022-06-29 16:02:13 -07:00
Moulins
aa1e53e0e3
avm1: Refactor Executable::exec
...
- reduce rightwards drift by exiting early
- outline some code into separate methods on Avm1Function
2022-06-29 16:02:13 -07:00
Aaron Hill
a79aa08f08
core: Free render backend resources on `BitmapData.dispose`
...
Currently, all three render backends hold on texture-related
resources indefinitely (`register_bitmap` pushes to a `Vec`,
and never removes anything). As a result, the resources used
by the render backend (which may include GPU memory) will grow
over time, even if the corresponding `BitmapData` has been deallocated.
This commit adds a new `unregister_bitmap` method, which is called from
`BitmapData.dispose`. All render backs are changed to now use an
`FnvHashMap<BitmapHandle, _>` instead of a `Vec`, allowing us to
remove individual entries.
Currently, we only call `unregister_bitmap in response to
`BitmapData.dispose` - when `BitmapData` is freed by the
garbage collector, `unregister_bitmap` is *not* called.
This will be addressed in a future PR.
2022-06-29 15:16:43 -07:00
Adrian Wielgosik
4d1bf7e00c
avm2: Refactor AVM2 bare object creation
2022-06-29 15:12:39 -07:00
Adrian Wielgosik
f31d4c2498
avm2: Remove SystemPrototypes.
2022-06-29 15:12:39 -07:00
Aaron Hill
1c5312d6c8
avm2: Declare 'dataFormat' property on URLLoader
...
This ensures that a sealed subclass can still access it.
2022-06-28 09:30:58 +03:00
dependabot[bot]
2fce315938
build(deps): bump gif from 0.11.3 to 0.11.4
...
Bumps [gif](https://github.com/image-rs/image-gif ) from 0.11.3 to 0.11.4.
- [Release notes](https://github.com/image-rs/image-gif/releases )
- [Changelog](https://github.com/image-rs/image-gif/blob/master/Changes.md )
- [Commits](https://github.com/image-rs/image-gif/compare/v0.11.3...v0.11.4 )
---
updated-dependencies:
- dependency-name: gif
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-28 00:51:23 +03:00
dependabot[bot]
c043093f13
build(deps): bump quote from 1.0.19 to 1.0.20
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.19 to 1.0.20.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.19...1.0.20 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-28 00:09:48 +03:00
dependabot[bot]
d6171f8a06
build(deps): bump smallvec from 1.8.0 to 1.8.1
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.8.0...v1.8.1 )
---
updated-dependencies:
- dependency-name: smallvec
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-28 00:09:36 +03:00
dependabot[bot]
94e670c7c5
build(deps): bump indexmap from 1.9.0 to 1.9.1
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.9.0 to 1.9.1.
- [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.0...1.9.1 )
---
updated-dependencies:
- dependency-name: indexmap
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-28 00:09:12 +03:00
David Wendt
632052f49e
core: Manually fire late `added`/`addedToStage` events on AVM2 roots
2022-06-26 19:50:35 -07:00
Aaron Hill
9f1cd4dea8
avm2: Don't try to set MovieClip child with default name
...
Flash Player only sets children with explicit names.
2022-06-26 19:34:21 -07:00
Aaron Hill
53cdba96d3
avm2: Convert flash.geom.Matrix to ActionScript
...
I've kept the rust `flash.geom` module, even though it's now empty,
since we'll need to add things like `flash.geom.Transform` native
methods in the future.
2022-06-24 12:34:12 -05:00
relrelb
48e4d80d0a
avm2: Implement `flash.net.SharedObjectFlushStatus`
2022-06-24 18:28:33 +03:00
relrelb
13d8565b12
avm2: Implement `flash.net.URLRequestMethod`
2022-06-24 18:28:33 +03:00
relrelb
4e29df5796
avm2: Implement `flash.net.URLRequestHeader`
2022-06-24 18:28:33 +03:00
relrelb
8398dc4ae8
avm2: Port `flash.net.URLLoaderDataFormat` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
781954bd86
avm2: Implement `flash.display.TriangleCulling`
2022-06-24 18:28:33 +03:00
relrelb
32df3b762c
avm2: Port `flash.display.StageScaleMode` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
29692b4a49
avm2: Port `flash.display.StageQuality` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
121d17dd94
avm2: Port `flash.display.StageDisplayState` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
1f1c2b91cd
avm2: Port `flash.display.StageAlign` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
1a8f6ef6aa
avm2: Port `flash.display.SpreadMethod` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
206aee3d28
avm2: Implement `flash.display.ShaderPrecision`
2022-06-24 18:28:33 +03:00
relrelb
f51d20ca64
avm2: Implement `flash.display.ShaderParameterType`
2022-06-24 18:28:33 +03:00
relrelb
790880a508
avm2: Port `flash.display.Scene` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
5817c1761b
avm2: Stub `Array` in ActionScript
2022-06-24 18:28:33 +03:00
relrelb
3745ab57db
avm2: Port `flash.display.SWFVersion` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
14830adb54
avm2: Port `flash.display.PixelSnapping` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
d6e1b8bbc1
avm2: Implement `flash.display.PNGEncoderOptions`
2022-06-24 18:28:33 +03:00
relrelb
f0a8ba9b87
avm2: Port `flash.display.LineScaleMode` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
8b8b320064
avm2: Port `flash.display.JointStyle` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
e5806bb3d4
avm2: Implement `flash.display.JPEGXREncoderOptions`
2022-06-24 18:28:33 +03:00
relrelb
53401cc51d
avm2: Implement `flash.display.JPEGEncoderOptions`
2022-06-24 18:28:33 +03:00
relrelb
6779e406ce
avm2: Port `flash.display.InterpolationMethod` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
7c992b4664
avm2: Implement `flash.display.GraphicsPathWinding`
2022-06-24 18:28:33 +03:00
relrelb
3655e85f6c
avm2: Implement `flash.display.GraphicsPathCommand`
2022-06-24 18:28:33 +03:00
relrelb
033d4ba6ad
avm2: Stub `int` in ActionScript
2022-06-24 18:28:33 +03:00
relrelb
ad4b06917b
avm2: Port `flash.display.GradientType` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
a119bfa102
avm2: Implement `flash.display.FocusDirection`
2022-06-24 18:28:33 +03:00
relrelb
3165e942d8
avm2: Implement `flash.display.ColorCorrectionSupport`
2022-06-24 18:28:33 +03:00
relrelb
c7a391ec36
avm2: Implement `flash.display.ColorCorrection`
2022-06-24 18:28:33 +03:00
relrelb
1ad020566e
avm2: Port `flash.display.CapsStyle` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
0081b03c6e
avm2: Implement `flash.display.BlendMode`
2022-06-24 18:28:33 +03:00
relrelb
23e5b3f0bb
avm2: Implement `flash.display.BitmapEncodingColorSpace`
2022-06-24 18:28:33 +03:00
relrelb
c7664206b3
avm2: Implement `flash.display.BitmapDataChannel`
2022-06-24 18:28:33 +03:00
relrelb
761d746c38
avm2: Port `flash.display.ActionScriptVersion` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
c6e04dfd2a
avm2: Implement `flash.text.TextLineMetrics`
2022-06-24 18:28:33 +03:00
relrelb
546662a4f7
avm2: Implement `flash.text.TextInteractionMode`
2022-06-24 18:28:33 +03:00
relrelb
d24c03349e
avm2: Port `flash.text.TextFormatAlign` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
6108be135e
avm2: Port `flash.text.TextFieldType` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
976cf2da39
avm2: Port `flash.text.TextFieldAutoSize` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
11f6e4abfb
avm2: Implement `flash.text.TextExtent`
2022-06-24 18:28:33 +03:00
relrelb
dcfe158f6c
avm2: Implement `flash.text.TextDisplayMode`
2022-06-24 18:28:33 +03:00
relrelb
613bd8924a
avm2: Implement `flash.text.TextColorType`
2022-06-24 18:28:33 +03:00
relrelb
8d024f2140
avm2: Implement `flash.text.GridFitType`
2022-06-24 18:28:33 +03:00
relrelb
d1a22cf083
avm2: Implement `flash.text.FontType`
2022-06-24 18:28:33 +03:00
relrelb
45aff8f7ef
avm2: Implement `flash.text.FontStyle`
2022-06-24 18:28:33 +03:00
relrelb
3abfac8ea6
avm2: Port `flash.utils.Endian` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
8228f7af6c
avm2: Port `flash.utils.CompressionAlgorithm` to ActionScript
2022-06-24 18:28:33 +03:00
relrelb
801d95cdfa
avm2: Implement `flash.geom.Orientation3D`
2022-06-24 18:28:33 +03:00
relrelb
b38afb6c75
avm2: Implement `flash.geom.ColorTransform`
2022-06-24 18:28:33 +03:00
relrelb
668a25c404
avm2: Stub `uint` in ActionScript
2022-06-24 18:28:33 +03:00
Aaron Hill
6eb4b485f0
Merge pull request #7095 from adrian17/avm2-fix-bare-function-scope
...
avm2: Pull methods' scopes from vtable, not class
2022-06-23 00:10:17 -05:00
relrelb
017e35a82f
avm2: Refactor `parseInt` implementation
...
Re-use some helper functions introduced in #7212 , and fix some
minor inaccuracies.
2022-06-23 01:07:15 +03:00
Adrian Wielgosik
97cfaff347
avm2: Refactor a (class,scope,method) tuple to a ClassBoundMethod
2022-06-23 00:03:07 +02:00
Callum Thomson
1310f433f2
avm2: Implement escape() toplevel ( #7281 )
...
* AVM2: Implement escape()
* chore: Fix formatting
* avm2: Escape resolves non strings to null and use push to append
* chore: Fix nits
* avm2: Escape should coerce objects, add early returns
2022-06-22 08:43:22 +03:00
dependabot[bot]
87c3463510
build(deps): bump syn from 1.0.96 to 1.0.98
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.96 to 1.0.98.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.96...1.0.98 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-21 09:59:10 +03:00
relrelb
335ce09cb1
core: Remove `indexmap` version restriction
...
Seems like the cyclic package dependency has been resolved in `1.9.0`,
so bring it back as usual.
2022-06-21 09:26:10 +03:00
dependabot[bot]
678ff2420d
build(deps): bump indexmap from 1.6.2 to 1.9.0
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.6.2 to 1.9.0.
- [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.6.2...1.9.0 )
---
updated-dependencies:
- dependency-name: indexmap
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-21 09:26:10 +03:00
dependabot[bot]
65538839f5
build(deps): bump quote from 1.0.18 to 1.0.19
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.18 to 1.0.19.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.18...1.0.19 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-21 08:54:07 +03:00
relrelb
0e0045425e
avm2: Re-implement `parseFloat`
...
The AVM2 `parseFloat` implementation used to call into the AVM1 one,
which was not 100% accurate. De-couple it as a new implementation,
based on `MathUtils::convertStringToDouble` in `avmplus`:
https://github.com/adobe/avmplus/blob/master/core/MathUtils.cpp#L1229-L1439
2022-06-21 08:02:40 +03:00
relrelb
754579eb07
avm2: Port `AccessibilityProperties` to ActionScript
2022-06-18 20:00:56 +03:00
relrelb
786e8d92fb
avm2: Introduce ActionScript entry-points
...
Previously all the `.as` files compiled into `playerglobal.swf`
were detected automatically using `walkdir`. While this might be
convenient, it can cause unexpected results when untracked `.as`
files exist. So instead, introduce two entry points - `stubs.as`
and `globals.as`, which include all stub ActionScript definitions,
and actual class implementations, respectively. This also simplifies
the `playerglobal.swf` build script a bit.
2022-06-18 18:26:57 +03:00
Aaron Hill
21eac9364f
avm2: Use '.stub.as' suffix to indicate stub class
...
This removes the need for keeping an updating list in
'build_playerglobal', and made things easier for me
when porting classes to ActionScript.
2022-06-17 00:03:40 +03:00
relrelb
4e805bb109
avm2: Pass `-optimize` to `asc`
...
In order to reduce builtins size even further.
2022-06-16 23:09:36 +03:00
relrelb
f9596543c6
avm2: Remove unused `Rectangle` and `Point` classes/prototypes
...
They are now both implemented in pure ActionScript, and no Rust code
ever references them.
2022-06-16 22:42:50 +03:00
relrelb
a9915c71bc
avm2: Port `flash.geom.Rectangle` to ActionScript
...
`flash.geom.Rectangle` is a good candidate, since it doesn't have
any native function, and it depends only on `flash.geom.Point`,
which was already been ported to ActionScript in #7071 .
2022-06-16 22:42:50 +03:00
Aaron Hill
f629a91e53
avm2: Allow implementing classes in ActionScript in custom `playerglobal`
...
This PR adds support for building a custom `playerglobal.swf`, which can be used
to implement builtin Flash classes in ActionScript. This file is embedded into Ruffle
using `include_bytes!`, and loaded during initialization.
As an example, the `Point` class is reimplemented
in ActionScript, and `flash.text.AntiAliasType` is added.
The ActionScript compilation process is performed by `core/build.rs`.
See that file, along with `core/src/avm2/globals/README.md`, for
more details.
2022-06-15 22:00:17 +03:00
dependabot[bot]
b8cdd59877
build(deps): bump bitstream-io from 1.3.0 to 1.5.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.3.0 to 1.5.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/compare/v1.3.0...v1.5.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-06-13 23:54:10 +03:00
relrelb
bd88e5e95a
render: Remove unused `unmultiply_alpha_rgba`
2022-06-11 08:28:24 +03:00
Aaron Hill
3d84eb7d45
Remove now-unused `lowest_depth` method
2022-06-11 00:59:18 +03:00
Aaron Hill
6d9d155b15
avm2: Use render_list instead of depth_list in most cases
...
The `render_list` for a container always contains all of the children
under both AVM1 and AVM2 - howver, the depth_list may not contain
some children under AVM2.
When we're not performing some AVM1-specific operation
(e.g. `getInstanceAtDepth`, or dumping out AVM1 variables),
we should be using the render list.
2022-06-11 00:59:18 +03:00
Aaron Hill
cc90796d8a
avm2: More filter-related stubs
...
This stubs out BlurFilter, adds properties to GlowFilter,
and make the getter for DisplayObject.filters return
an empty array instead of Undefined.
This is all of the filter-related code that 'Solarmax'
needs in order to reach the main screen (combined with
other unrelated changes I have yet to submit)
2022-06-10 19:35:48 +03:00
Aaron Hill
dde21a2a60
chore: Fix latest Clippy warnings
2022-06-08 07:19:56 +03:00
Aaron Hill
487017e7c5
avm2: Properly handle Dictionary enumerants
...
Previously, there was an off-by-one bug in `get_enumerant_name`,
which caused us to produce a spurious 'null' as a key.
However, the 'dictionary_foreach' test only checked that certain
keys were present, so the presence of an additional key didn't break
the test.
This commit makes Dictionary enumerants behave in the same way as
Array enumerants - all of the object-specific enumerants
(in this case, the non-primitive dicitonar keys) come first,
followed by 'base' enumerants from ScriptObject (in this case,
primtive/String keys). Additionally, `setPropertyIsEnumerable` is now
ignored for `Dictionary`, consistent with Flash's behavior.
The `dictionary_foreach` test is updated to print out all of
the keys when inspecting the dictionary. Since the enumeration
order is unstable (under both Flash and Ruffle) due to the dependency
on pointer hashing, the test sorts the keys before printing them.
This ensures that we get stable output which is consistent between
Ruffle and Flash.
2022-06-07 00:39:42 +02:00
Aaron Hill
a4b3dbed79
avm2: Allow accessing `stage.loaderInfo.loaderURL`
...
Flash Player allows this, and returns the path to the root SWF file.
The test only checks that the returned path contains 'test.swf',
to avoid depending on a platform-specific path.
2022-06-06 22:08:54 +03:00
dependabot[bot]
63b11ad535
build(deps): bump syn from 1.0.95 to 1.0.96
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.95 to 1.0.96.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.95...1.0.96 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-06-06 20:25:25 +03:00
Aaron Hill
9e4d13f201
avm2: Make `Array.pop` actually pop from the back
...
The loop to search for a `non_hole` was missing
a `break;`, so it would actually find the *first*
non-hole, rather than than the last. This was not caught
by the test, since there was only one "real" element
in the array (the other one was set on 'Array.prototype')
2022-06-04 23:28:06 +03:00
relrelb
53ef80f514
render: Introduce `RenderBackend::register_bitmap`
...
Since all `RenderBackend::register_bitmap_*` implementations are
identical now, move them to the default implementation of `RenderBackend`.
Also, turn `RenderBackend::register_bitmap_raw` into `RenderBackend::register_bitmap`,
which accepts a single `Bitmap` parameter.
2022-06-02 15:27:29 -07:00
relrelb
4fb77edfb1
render: Move `srgb_to_linear` to `common_tess`
...
Since it's the only user of it. Also make it mutate the float array
parameter instead of returning a new one, just to simply things a
bit.
2022-05-31 21:48:11 +03:00
dependabot[bot]
3ce6412a2e
build(deps): bump flate2 from 1.0.23 to 1.0.24
...
Bumps [flate2](https://github.com/rust-lang/flate2-rs ) from 1.0.23 to 1.0.24.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases )
- [Commits](https://github.com/rust-lang/flate2-rs/commits )
---
updated-dependencies:
- dependency-name: flate2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-30 23:36:08 +03:00
relrelb
cec9850a33
core: Use `swf::Matrix::translate` in more places
...
Replace direct instatiations of `swf::Matrix` where only `tx` and
`ty` are specified, and other fields are default.
This results in a slightly more shorter, readable code.
2022-05-29 21:33:53 +03:00
Toad06
61fa38e70f
avm1: Correct `Value::as_bool(String)` in SWFv6 and below
2022-05-27 23:05:55 +03:00
Adrian Wielgosik
f169070106
avm2: Pull methods' scopes from vtable, not class
2022-05-26 20:53:41 +02:00
Aaron Hill
15cb9a9ce6
Use `instance_scope` when making `super` method call
...
A method called with `super` is always an instance method,
so we should be using `instance_scope` for consistency with
`call_property`. This fixes a bug where a method cannot
access static class members (via `getlex`) when called bia
`super.method()`
2022-05-24 18:49:47 -06:00
Aaron Hill
fd2d14618d
core: Correctly calculate the length passed to `resize_to_reader`
...
In several places, we read some data from a tag, and then pass
the original tag length to `resize_to_reader`. This is incorrect -
the provided length is used an an offset from the current position
in the reader, so we will extend past the end of the current tag if
we've already read some bytes.
In practice, this doesn't appear to cause any problems - AVM bytecode
has internal length fields, which end up ensuring that we will never
try to read past where the slice *should* end. However, if a `DoAbc`
tag is the last tag in the file, then we'll end up trying to use
`resize_to_reader` with an offset past the end of the movie.
This commit subtracts the number of already-read bytes from `tag_len`,
to ensure that we always construct a correctly-sized `SwfSlice`
2022-05-24 11:46:16 -07:00
Toad06
580a499e56
core: Run `update_drag` in `Player::handle_event`
2022-05-23 19:05:35 -07:00
Mike Welsh
32bf7e1412
chore: Appease clippy
2022-05-22 02:34:18 -07:00
bbb651
cf820b4f95
desktop: Add fullscreen command line option
2022-05-20 19:51:22 -07:00
relrelb
e3da0d2bfd
avm1: Simplify `XML.xmlDecl`
...
Store just the XML declaration string itself, rather than the attributes
it consists of. Then simply return it in ActionScript's `XML.xmlDecl`
property, without using `quick_xml::Writer` at all. This also matches
Flash behavior by capturing the XML declaration as-is, preserving
whitespaces, quotes, casing etc.
2022-05-20 18:46:19 -07:00
Daniel Jacobs
cddf5796a3
avm2: Add more Event classes' methods and properties
2022-05-20 18:42:07 -07:00
David Wendt
e926af7796
core: Prevent recursive execution of frame scripts on the same movie clip.
...
To be clear, recursive execution of frame scripts between *different* movie clips is still allowed.
2022-05-20 18:37:42 -07:00
David Wendt
85d98d8c07
core: Always clear the `EXECUTING_AVM2_FRAME_SCRIPT` flag, even if we didn't actually execute frames.
...
Prior to this commit, executing frame scripts on a movie that doesn't have them for this frame, or didn't advance to a new frame, would cause the the movie to ignore all gotos until the next time it ran a frame script.
2022-05-20 18:37:42 -07:00
Aaron Hill
eaeecfcfbc
Adjust error message
2022-05-20 11:41:17 -07:00
Aaron Hill
613a255fb3
Use binary literal
2022-05-20 11:41:17 -07:00
Aaron Hill
d3689de25d
Use QName::dynamic_name
2022-05-20 11:41:17 -07:00
Aaron Hill
7a870ad10a
Make some methods private
2022-05-20 11:41:17 -07:00
Aaron Hill
8d8a7600d8
avm2: Partially implement `URLLoader` and related classes
...
This PR implements the `URLLoader` class, allowing AVM2 scripts
to load data from a URL. This requires several other related
classes (`URLLoaderDataFormat`, `URLRequest`, `IOError`) to be
implemented as well.
Currently implemented:
* Fetching from URLs using the 'navigator' backend
* The `text` and `binary` data formats (which store data
in a `String` or `ByteArray` respectively)
* The `open`, `complete`, and `ioError` events
* The `bytesLoaded`, `bytesTotal`, and `data` properties
Not yet implemented:
* The HTTP and security events
* All of the properties of `IOError`
* The properties on `URLRequest` (besides `url`)
* The "variables" data format
This should be enough to get some basic uses of `URLLoader` working
(e.g. simple GET requests to a particular website).
Note that in Flash's `playerglobal`, the `URLLoader` class is just
a think wrapper around the more general `URLStream`. However,
implementing `URLStream` will require changes to `Navigator``
to support notifications when data arrives in the stream. When
that happens, we should be able to re-use a large amount of the
code in this PR.
2022-05-20 11:41:17 -07:00
Toad06
39e46e5bd3
avm1: Remove `Value::from_bool`
2022-05-19 20:24:53 -06:00
TÖRÖK Attila
81749f900b
avm2: Implement GradientType, InterpolationMethod, SpreadMethod in flash.display
2022-05-19 23:47:55 +02:00
Mike Welsh
de99dcd37b
core: Add `BitmapFormat::bytes_per_pixel`
2022-05-19 10:43:54 -07:00
Mike Welsh
48f7ff5f4d
core: Add `Bitmap::to_rgba`
2022-05-19 10:43:54 -07:00
Mike Welsh
e710f3fa0e
core: Clean up `render::Bitmap`
...
* Make `BitmapFormat` a fieldless enum and move `data` to its own
field for ease of use.
* Make `Bitmap` fields private.
2022-05-19 10:43:54 -07:00
Mike Welsh
6615ed17f9
core: Verify bitmap length after decoding
...
Guarantee bitmap data after decoding has the expected length for
the given width+height+format. This eases the burden from backends
to worry about this. Pad or truncate the data if it doesn't have
the expected size.
2022-05-19 10:43:54 -07:00
Mike Welsh
b88e77573d
core: Handle greyscale PNGs
...
`render::decode_png` now handles greyscale or greyscale+alpha PNGs.
2022-05-19 10:43:54 -07:00
Toad06
b50f1201e1
avm1: `action_enumerate` can handle paths
2022-05-18 19:30:48 -07:00
dependabot[bot]
4dc9fd7adf
build(deps): bump syn from 1.0.94 to 1.0.95
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.94 to 1.0.95.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.94...1.0.95 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-16 17:45:21 -07:00
David Wendt
1809ca611b
avm2: Make dispatch list initialization lazy, so that it can run before constructors if necessary.
...
Due to various quirks of how timeline-initiated symbols interact with AVM2, it is possible for user code to gain a reference to uninitialized objects (especially `SimpleButton` which doesn't initialize until after `exitFrame`). It is still possible to attach event handlers to them that fire correctly, and movies expect to be able to.
2022-05-16 17:13:35 -07:00
dependabot[bot]
fc4cd11959
build(deps): bump syn from 1.0.92 to 1.0.94
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.92 to 1.0.94.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.92...1.0.94 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-16 13:54:32 -07:00
Mike Welsh
d1b65d9092
avm1: Pass ExecutionReason to `Object::call_method`
...
Internal function calls such as `toString` and event handlers
always used the base clip from the function itself, so add an
`ExecutionReason::InternalCall` to signify this and pass it along
to `call_method`.
2022-05-14 22:29:44 -07:00
Mike Welsh
4904b2cc97
avm1: Fix scope of function calls in SWFv5 vs. SWFv6+
...
Fix various scope behavior when executing a function:
* For function calls in SWFv6+, functions are proper closures and
close over the SWF version, base clip, and scope of their
defining function.
* Function calls in SWFv5 are not closures, and use the version,
base clip, and scope of `this` when the function is called.
Fixes #5502 .
2022-05-14 22:29:44 -07:00
Aaron Hill
a453aa73af
avm2: Don't consider declared return type for unchecked functions check
...
Testing under Flash shows that methods can be considered 'unchecked'
(allowing them to be called with more arguments than declared
parameters) even if they have a declared return type.
This is relied on by SteamBirds, which registers an event handler
which takes 0 parameters and an explicitly declared return type
2022-05-13 09:32:05 -07:00
Aaron Hill
8ff720dd9d
avm1: Allow new `unused_macro_rules` lint on `declare_properties`
...
This was recently added in https://github.com/rust-lang/rust/pull/96150
Some of the `__version` rules are currently unused, but I assume
that we still want to keep them for potential future use.
2022-05-13 09:31:46 -07:00
relrelb
cab49ae6e1
swf: Introduce `Color::WHITE`
...
And use it where possible, to improve code readablity.
2022-05-12 12:12:06 -07:00
relrelb
0b0f8a1a7a
swf: Introduce `Color::BLACK`
...
And use it where possible, to improve code readablity.
2022-05-12 12:12:06 -07:00
Aaron Hill
938d80146c
avm2: Implement `TextField.background` getter/setter
...
There's already a `has_background` field on the underlying object
data, so we can just map this property to it.
2022-05-11 15:42:19 -07:00
Aaron Hill
e39cfa8027
Define `String.fromCharCode` as both a public and AS3 method
...
This is relied on by SteamBirds
(https://www.kongregate.com/games/weasello/steambirds )
2022-05-11 15:42:19 -07:00
Mike Welsh
f550abd18d
web: Fix some warnings
...
Fix warnings caused by desktop-only code.
2022-05-09 22:28:43 -07:00
Mike Welsh
6547fcdf99
avm1: Remove `avm1::globals::display_object` module
...
This module is now mostly empty, so move the items up to `globals`.
`getDepth` was the only shared method, so declare this property
inline in each display object type. `Video` was also incorrectly
declaring `getDepth`.
2022-05-09 17:39:49 -07:00
Mike Welsh
a97ae38008
avm1: Remove `toString` from display objects
...
`MovieClip` and others do not have a `toString`; instead, stage
objects are special cased to return their path when coerced to
string.
2022-05-09 17:39:49 -07:00
Mike Welsh
35d2f69396
avm1: Improve `StageObject::get_local_stored`
...
* Avoid an extraneous check to `ScriptObject::has_own_property`.
* Avoid magic property branches if property name does not start
with `_`.
2022-05-09 17:39:49 -07:00
Mike Welsh
2683686014
avm1: `_root`, `_parent`, `_global` are magic properties ( fix #768 )
...
Remove `_root`, `_parent` and `_global` from `MovieClip.prototype`.
Instead, these are "magic" properties similar to `_x` and `_y`.
Add `StageObject::resolve_path_property` to handle these, alongside
the `_levelN` property.
Fixes #768 .
2022-05-09 17:39:49 -07:00
relrelb
781d091d42
swf: Return concrete data types in `Reader` methods
...
Where possible, return the specific data type instead of the generic
`Tag` type. Most reader methods do this already, so this brings the
rest in-line.
2022-05-09 14:59:38 -07:00
dependabot[bot]
7352aca3bc
build(deps): bump jpeg-decoder from 0.2.5 to 0.2.6
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.5 to 0.2.6.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.5...v0.2.6 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-09 13:46:12 -07:00
relrelb
bce4075c69
core: Remove `url_from_relative_path`
...
The remaining caller was `SwfMovie::from_path`, which is now changed
to be simpler, and a little stricter (panics if `Url::from_file_path`
fails, though it shouldn't happen with canonicalized paths).
2022-05-09 10:06:52 -07:00
nosamu
f39537f984
docs: Correct issue number in code comment
2022-05-08 14:27:15 +03:00
relrelb
b46134dc43
avm1: Tiny cleanup in `Activation::set_target`
...
Use `Option::filter`.
2022-05-07 22:46:35 -07:00
Mike Welsh
f20f53f555
avm1: Grab SWF version from executing clip
...
Remove the `swf_version` parameter from `Activation` constructors,
because this was incorrectly using the global or root SWF version
most times.
Instead, grab the SWF version for the activation directly from the
base clip.
2022-05-07 10:25:10 -07:00
Mike Welsh
1e9c464d94
avm1: Add version to MovieClip properties
2022-05-07 10:25:10 -07:00
Mike Welsh
4fa4c6ca84
avm1: Implement property version checking
...
Check SWF version of AVM1 properties and return undefined if they
are gated to a later version.
2022-05-07 10:25:10 -07:00
Mike Welsh
e6cadf7de4
avm1: Use u16 for Property::attributes
2022-05-07 10:25:10 -07:00
relrelb
401f423ffa
xml: Remove `XmlAttributesObject`
...
Use a bare `ScriptObject` instead. This matches Flash's behavior in
many aspects:
* Attribute values can now store arbitrary AVM1 values, rather than
just strings. These are coerced to string lazily on demand (e.g.
when coercing the whole XML node to a string).
* Attributes iteration order is the same as their definition order,
not sorted by their name.
Also fix some bugs in `XmlNode::lookup_namespace_uri` (renamed from
`lookup_uri_for_namespace`):
* Iterate attributes by their definition order, so the first matching
one is returned.
* The empty prefix matches every attribute that starts with "xmlns"
(with/without a colon).
And inline `XmlNode::lookup_namespace_for_uri` into `get_prefix_for_namespace`,
and fix some bugs in there as well:
* Iterate attributes by their definition order, so the first matching
one is returned.
* Match any attribute that start with "xmlns" (with/without a colon).
2022-05-07 10:24:45 -07:00
Mike Welsh
5730c8db94
core: Clamp color values in DefineBitsJPEG3 ( fix #6893 )
...
The colors in a DefineBitsJPEG3 tag should be premultiplied alpha,
but in some SWFs they are incorrectly not premultiplied. Flash
Player clamps the color values to the alpha in this case to allow
these images to work more as expected.
Fixes #6893 .
2022-05-07 09:46:44 -07:00
relrelb
87ce0f56b7
core: Remove `NavigatorBackend::resolve_relative_url`
...
The resolved URL only used by `NavigatorBackend::fetch`. So simply
inline `NavigatorBackend::resolve_relative_url` into `NavigatorBackend::fetch`,
per implementation.
2022-05-07 09:06:53 -07:00
relrelb
ea665d91f2
core: Introduce and use `Response::url`
2022-05-07 09:06:53 -07:00
relrelb
2517d8de4b
core: Introduce struct `Response`
...
Currently it's a trivial wrapper around `Vec<u8>`, but more fields
will be added in the future (e.g. response URL, HTTP status code).
2022-05-07 09:06:53 -07:00
Mike Welsh
82ed6fcba7
core: Cleanup PlaceObject comments
2022-05-06 11:33:52 -07:00
Mike Welsh
0833bd0d18
core: Clip events can only be set on initial placement
2022-05-06 11:33:52 -07:00
Mike Welsh
8bf0114fdf
core: DisplayObject clip depth can only be set on initial placement
2022-05-06 11:33:52 -07:00
Mike Welsh
32252b2ed4
core: DisplayObject name can only be set on initial placement
2022-05-06 11:33:52 -07:00
Mike Welsh
aa66c31d6c
core: Add comment about rewind behavior of is_visible
2022-05-06 11:33:52 -07:00
Mike Welsh
b46c07830e
core: Stub DisplayObject::background_color
2022-05-06 11:33:52 -07:00
Mike Welsh
f8698d1cc9
core: Stub DisplayObject::blend_mode
2022-05-06 11:33:52 -07:00
Mike Welsh
2cebd47ad2
core: Stub DisplayObject:is_bitmap_cached
2022-05-06 11:33:52 -07:00
relrelb
f6153ff7c1
chore: Appease clippy
2022-05-06 10:36:38 -07:00
relrelb
d1d6b56615
avm1: Remove a stale TODO
...
Forgotten in #6785 .
2022-05-03 10:22:43 -07:00
relrelb
beee6cb067
avm1: Correct and cleanup `Array.sort` and `Array.sortOn`
...
* Mimic Flash's quicksort algorithm, rather than using Rust's
`sort_unstable_by`.
* Rename `flags` to `options`, as they are named in AS2 reference.
* Organize different sorting options using 3 simple functions:
`sort_compare`, `sort_compare_custom` and `sort_on_compare`.
2022-05-03 09:47:38 -07:00
dependabot[bot]
fcc199b0e5
build(deps): bump jpeg-decoder from 0.2.4 to 0.2.5
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.4 to 0.2.5.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.4...v0.2.5 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 14:48:42 -07:00
dependabot[bot]
e68f88d37e
build(deps): bump syn from 1.0.91 to 1.0.92
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.91 to 1.0.92.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.91...1.0.92 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 14:48:25 -07:00
dependabot[bot]
86e3f6c82a
build(deps): bump serde from 1.0.136 to 1.0.137
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.136 to 1.0.137.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.136...v1.0.137 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 13:41:28 -07:00
Adrian Wielgosik
b2f309fc35
avm1: Implement LocalConnection.domain()
2022-04-30 16:14:16 -07:00
relrelb
babf49aaf9
chore: `.filter_map(..).next()` -> `.find_map(..)`
...
Per the rust-analyzer diagnostic: https://rust-analyzer.github.io/manual.html#replace-filter-map-next-with-find-map
2022-04-30 10:41:46 -07:00
Mike Welsh
1eb06908c8
core: Make PlayerBuilder::build infallible
2022-04-29 09:14:32 -07:00
Mike Welsh
3e15ca4cad
core: Use `Arc::new_cyclic` in player initialization
...
Co-authored-by: relrelb <relrelbachar@gmail.com>
Change `UpdateContext::player` to not be an `Option`
2022-04-29 09:14:32 -07:00
Mike Welsh
ddc28310f8
core: Clean up test_utils
2022-04-29 09:14:32 -07:00
Mike Welsh
f48182ef3d
core: Add various settings to PlayerBuilder
2022-04-29 09:14:32 -07:00
Mike Welsh
895508a0fb
core: Remove Player::new
...
PlayerBuilder is effectively the Player constructor.
2022-04-29 09:14:32 -07:00
Mike Welsh
e1e2b1008a
core: Add PlayerBuilder
2022-04-29 09:14:32 -07:00
Mike Welsh
2453626dec
core: Add MemoryStorageBackend::new
2022-04-29 09:14:32 -07:00
David Wendt
155672d482
core: Remove AS3-related `coerce_to_object` calls in `MovieClip`
2022-04-24 16:54:19 -07:00
David Wendt
fe50e98f87
avm2: Remove `coerce_to_object` calls in `flash.text.TextField`
2022-04-24 16:54:19 -07:00
David Wendt
afdae1f6c6
avm2: Remove `coerce_to_object` calls in `flash.media.Sound`
2022-04-24 16:54:19 -07:00
David Wendt
818526069e
avm2: Remove `coerce_to_object` calls in `flash.events.MouseEvent`
2022-04-24 16:54:19 -07:00
David Wendt
5dc5ca06e3
avm2: Remove `coerce_to_object` calls in `flash.events.EventDispatcher`
2022-04-24 16:54:19 -07:00
David Wendt
4c736094c1
avm2: Remove `coerce_to_object` calls in `flash.display.Stage`
2022-04-24 16:54:19 -07:00
David Wendt
cbc9937fcf
avm2: Remove `coerce_to_object` calls in `flash.display.SimpleButton`
2022-04-24 16:54:19 -07:00
David Wendt
40ecae28d0
avm2: Remove `coerce_to_object` in `flash.display.MovieClip`
2022-04-24 16:54:19 -07:00
David Wendt
85b598a8da
avm2: Remove `coerce_to_object` calls in `flash.display.DisplayObjectContainer`
2022-04-24 16:54:19 -07:00
David Wendt
7e7ee14d3b
avm2: Remove `coerce_to_object` calls in `flash.display.DisplayObject`.
2022-04-24 16:54:19 -07:00
David Wendt
5f5f98ecdc
avm2: Remove `coerce_to_object` calls in `flash.display.Bitmap`
2022-04-24 16:54:19 -07:00
David Wendt
5b5313bf95
avm2: Remove `coerce_to_object` calls in `String` impls
2022-04-24 16:54:19 -07:00
David Wendt
e851b73570
avm2: Remove calls to `coerce_to_object` in `JSON` impls
2022-04-24 16:54:19 -07:00
David Wendt
88f4ebc2a3
avm2: Remove calls to `coerce_to_object` in `Function` impls
2022-04-24 16:54:19 -07:00
David Wendt
26e65368df
avm2: Remove `coerce_to_object` calls in `Array` where possible, and replace with more descriptive error messages otherwise
2022-04-24 16:54:19 -07:00
David Wendt
1383901a94
avm2: Remove unnecessary usage of `coerce_to_object` in `avm2::globals`.
2022-04-24 16:54:19 -07:00
David Wendt
90b239f30d
avm2: Add descriptive error messages for when `Vector` methods encounter `null`/`undefined`.
2022-04-24 16:54:19 -07:00
David Wendt
e486efb4c6
avm2: Remove unnecessary usage of `coerce_to_object` in `ClassObject`.
2022-04-24 16:54:19 -07:00
David Wendt
0f2b77c138
avm2: Alter basic object operations to use more descriptive error messages.
2022-04-24 16:54:19 -07:00
David Wendt
4185acc5a8
avm2: Remove unnecessary usage of `coerce_to_object` in `avm2::events`.
2022-04-24 16:54:19 -07:00
David Wendt
bb70086238
avm2: Replace a number of `coerce_to_object` calls with the previous commits' new messages as appropriate
2022-04-24 16:54:19 -07:00
David Wendt
bea6744682
avm2: Add methods to `Value` and `Activation` for performing common coercions and returning a relevant error if they fail.
...
Those methods are:
* `Value.coerce_to_receiver`: coerce to object for receivers
* `Value.as_callable`: as_object for callables
* `Activation.superclass_object`: get superclass of currently-called object
* `Activation.resolve_class`: resolve scope value, unwrap `ClassObject`, and error out if either step fails
This accounts for ~80% of coercion-related errors in `Activation`.
2022-04-24 16:54:19 -07:00
David Wendt
2ec606c5cb
avm2: Add utilities for formatting `Multiname`s and class instances' names.
2022-04-24 16:54:19 -07:00
relrelb
3dbde841df
avm1: Remove `TObject::type_of`
...
It can be simply determined in `Value::type_of`.
2022-04-23 17:55:48 -07:00
Daniel Jacobs
aa92c3c1bc
core: scale_mode -> window_mode for set_window_mode
2022-04-22 19:31:23 +03:00
Mike Welsh
e2e7ad0df2
avm2: Implement `flash.ui.Keyboard`
...
Add `Keyboard` key code constants and stub out other properties.
2022-04-21 21:40:04 -07:00
Mike Welsh
1cb3d389e8
core: Add some KeyCode variants
2022-04-21 21:40:04 -07:00
TÖRÖK Attila
7cbba5bc8f
avm2: Stub flash.accessibility.AccessibilityProperties
2022-04-19 09:55:09 -07:00
relrelb
25d47da528
render: Improve CMYK to RGB conversion
...
Use integer arithmetic, which is more accurate and efficient.
2022-04-18 22:00:48 -07:00
Mike Welsh
cdccc2a2db
avm1: Array.sortOn does not inspect proto or virtual properties
...
`Array.sortOn` only looks at raw properties and does not inspect
the prototype chain or call virtual properties.
2022-04-18 08:34:04 -07:00
Mike Welsh
3305ac69c4
web: Support wmode parameter
2022-04-17 08:33:51 -07:00
relrelb
87e85e16da
render: Make `rgb5_component` a lambda
...
This way the `compressed` parameter becomes implicit.
2022-04-16 13:52:59 -07:00
relrelb
8feeadf578
render: Use `std::borrow::Cow`
...
Also apply some nearby refactors.
2022-04-16 13:52:59 -07:00
relrelb
eeaec947b3
render: Remove unneeded `pub`s
...
And remove the dead `glue_swf_jpeg_to_tables` function.
2022-04-16 13:52:59 -07:00
relrelb
9b4108444f
render: Strip 16-bit PNG samples to 8-bit
...
PNGs with 16-bit samples were not being normalized to 8-bit, screwing up their
appearance.
Add the `STRIP_16` transformation using `Transformations::normalize_to_color8()`,
which is equivalent to `Transformations::EXPAND | Transformations::STRIP_16`.
Also warn in case `png` outputs a color type other than `Rgb` and `Rgba`.
Due to the `EXPAND` transformation, this may be only `Grayscale` or
`GrayscaleAlpha`. `Indexed` is converted to either `Rgb` or `Rgba`.
Fixes #6662 .
2022-04-16 12:45:55 -07:00
Mike Welsh
bce9398c0d
avm1: Add Accessibility stub
2022-04-16 09:05:16 -07:00
Toad06
b2b1b5fa25
avm1: Correct `Add`, `Equals`, `Less` and `GetProperty` actions
2022-04-13 22:00:25 -07:00
Mike Welsh
146b8adc68
swf: Clean up LineStyle
...
* Remove LineStyle::color, instead using fill_style with
FillStyle::Color to indicate solid color.
* Store `flags` in the struct instead of separate bools/values.
* Add getters/setters for ease of use.
* Add builder-style methods for setting LineStyle properties.
* Fix misnamed ALLOW_CLOSE flag to NO_CLOSE.
2022-04-11 22:50:40 -07:00
Mike Welsh
c0dff98d84
chore: Fix len_zero warning in symphonia Mp3Decoder
2022-04-11 20:15:13 -07:00
Mike Welsh
24f00238a7
audio: Fix symphonia feature
...
This feature stopped building with the bump to symphonia 0.5, which
added a `Sync` bound to its traits.
* Add `Sync` bounds to our own internal audio traits to match.
* nellymoser::Decoder was also tweaked to add a Sync bound.
* Lock the nellymoser dependency to a specific git commit.
2022-04-11 15:25:15 -07:00
dependabot[bot]
a5f7fccca2
build(deps): bump quote from 1.0.17 to 1.0.18
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.17 to 1.0.18.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.17...1.0.18 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 13:51:20 -07:00
dependabot[bot]
5973ecc7d9
build(deps): bump flate2 from 1.0.22 to 1.0.23
...
Bumps [flate2](https://github.com/rust-lang/flate2-rs ) from 1.0.22 to 1.0.23.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases )
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.22...1.0.23 )
---
updated-dependencies:
- dependency-name: flate2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 13:51:09 -07:00
Toad06
c6c1f553d5
avm1: Correct `Action::RandomNumber`
2022-04-11 11:02:08 -07:00
Toad06
e2528b04a7
avm1: Coerce booleans to `"1"` or `"0"` in SWFv4
2022-04-10 20:03:39 -07:00
Toad06
b221485288
avm1: Fix `Action::Divide` in SWFv4
2022-04-09 23:17:39 -07:00
Mike Welsh
91346f5fad
avm1: Format floating-point numbers
...
Co-authored-by: Toad06 <gd.productions@laposte.net>
2022-04-09 22:40:59 -07:00
Mike Welsh
478f970fc8
chore: Appease clippy
2022-04-09 18:23:51 -07:00
Aaron Hill
d7532ae654
avm2: Add stubs for `BitmapFilter`, `GlowFilter`, and `DisplayObject.filters`
...
This gets 'Rolling Hero' further in the startup process,
since it just tries to set a filter on an object.
2022-04-08 16:53:16 -07:00
relrelb
ad42b9908f
xml: Refactor `XmlNode` creation methods
...
Unify the previous 3 creation methods to a single `XmlNode::new`.
This allows supporting arbitrary `nodeType` values passed to the
`XMLNode` constructor.
2022-04-08 16:34:57 -07:00
relrelb
7497fb7008
core: Change `Player::set_root_movie` to accept a `SwfMovie`
...
Move the `Arc::new` to within the function.
2022-04-08 15:16:25 -07:00
Toad06
12737b8431
avm1: Fix `Number(String | Object)` in SWFv4
2022-04-08 10:41:21 -07:00
dependabot[bot]
1339d8b93a
build(deps): bump syn from 1.0.90 to 1.0.91
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.90 to 1.0.91.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.90...1.0.91 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 10:40:43 -07:00
dependabot[bot]
860c2e313f
build(deps): bump encoding_rs from 0.8.30 to 0.8.31
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.30 to 0.8.31.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.30...v0.8.31 )
---
updated-dependencies:
- dependency-name: encoding_rs
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 10:40:26 -07:00
relrelb
eeb5eb18f6
web: Bump wasm-bindgen to 0.2.80
...
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
2022-04-08 09:56:23 -07:00
dependabot[bot]
e456fb3ed6
build(deps): bump jpeg-decoder from 0.2.3 to 0.2.4
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.3 to 0.2.4.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.3...v0.2.4 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-04 14:42:32 -07:00
Mike Welsh
6ec3049e02
desktop: Use floats for audio start/endpoints calculation ( fix #6569 )
...
Integer math was used when calculating a sound's start/endpoints,
because it was assumed that the sound sample rate was always an
even divisor of 44100Hz. However, some third party tools can embed
MP3s with other samples rates, such as #6569 which has a 16000Hz
MP3. This could also occur for dynamically loaded MP3s. This
results in the sound starting at an incorrect position.
Use floating point math to ensure the correct position is
caluclated.
Fixes #6569 .
2022-04-03 15:50:43 -07:00
Mike Welsh
9687365885
core: Remove morph shape preloading
...
Remove the preload step that would pre-create the shapes for each
morph shape ratio on SWF load. Instead, lazily crate the shapes
when they are needed.
2022-04-03 13:50:09 -07:00
Mike Welsh
b1879f4b99
core: Fix divide-by-zero in Video::seek ( fix #6605 )
2022-04-03 11:33:52 -07:00
Toad06
055e1d4dc1
avm1: Fix `loadVariablesNum` / `Action::GetUrl2`
2022-04-03 10:32:31 -07:00
Toad06
e93d39fdfe
avm1: `DefineLocal` also accepts dot and slash paths
2022-04-02 14:30:56 -07:00
relrelb
c8e7bdbce2
core: Fix loading of unknown data
...
Loading unknown data is not considered an error on Flash; Both
`onLoadProgress` and `onLoadComplete` events are dispatched. But,
`onLoadProgress` reports 0 bytes loaded.
2022-04-02 12:50:43 -07:00
relrelb
e06506c2b9
render: Implement `CMYK32` jpeg pixel format
2022-04-02 01:17:38 +03:00
Aaron Hill
4f23500779
avm2: Implement most of `flash.external.ExternalInterface`
...
This re-uses the logic we have for handling AVM1's `ExternalInterface`.
For now, serialization/deserialization of non-array objects is
left unimplemented.
2022-03-31 22:40:09 -07:00
Mike Welsh
659db7facc
avm1: Add2 calls valueOf for objects
2022-03-31 16:57:07 -07:00
Adrian Wielgosik
a929a4becd
avm2: Do not borrow Object's lock just to get the bound method
2022-03-31 16:56:55 -07:00
Adrian Wielgosik
7e8738d82e
avm2: Add ContextMenuEvent stub
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
ef64413b8c
avm2: Support ContextMenuItem fields
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
ea56902d80
chore: cargo fmt
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
90b1d4722c
avm2: Add ContextMenuItem stub
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
2389422c99
avm2: Add ioErrorEvent stub
2022-03-30 21:42:48 +02:00
Adrian Wielgosik
388dc6fe31
avm2: Add customItems to ContextMenu stub
2022-03-30 21:42:48 +02:00
Mike Welsh
d920dfa9b0
core: Add padding on autosized TextFields
2022-03-29 22:22:32 -07:00
Mike Welsh
a671d2977b
core: Pre-multiply alpha when loading PNG/GIF data ( fix #6559 )
...
When decoding PNG/GIF data, convert the image to premultiplied
alpha so that it plays nicely with the renderer.
This applies to both dynamically loaded images and to PNG/GIF data
embedded inside a DefineBitsJPEG tag. This is in contrast to
DefineBitsLossless and DefineBitsJPEG tags w/ alpha, which are
already premultiplied in the SWF.
Also remove unnecessary clamps now that Rust defines casts as
saturating.
Fixes #6559 .
2022-03-29 13:41:04 -07:00
Mike Welsh
9c50770c1c
avm1: Return Value from `abstract_lt`
...
All callers converted the result to `Value` anyway.
2022-03-28 19:07:12 -07:00
Mike Welsh
98ea2f81b6
avm1: {} < {} returns false
...
The Less2 op returns false if the `valueOf` of either parameter
results in an object. The exception is display objects:
`mc < mc` returns undefined.
2022-03-28 19:07:12 -07:00
dependabot[bot]
fcb5eaec0e
build(deps): bump syn from 1.0.89 to 1.0.90
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.89 to 1.0.90.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.89...1.0.90 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-29 00:09:22 +03:00
dependabot[bot]
bf57d2c15a
build(deps): bump jpeg-decoder from 0.2.2 to 0.2.3
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.2 to 0.2.3.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.2...v0.2.3 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-29 00:09:01 +03:00
David Wendt
b9da107339
core: Refactor `MovieClipLoader` broadcast messages into separate `Loader` associated functions.
...
These are *not* methods, because we cannot borrow both the update context and the loader at the same time. At least not without making loaders free-standing objects (`GcCell`s), which I don't want to do yet.
2022-03-27 18:55:38 -07:00
David Wendt
ac7bb84e08
core: Report unexpected content type errors better.
2022-03-27 18:55:38 -07:00
David Wendt
27697c6611
chore: No, loading an image does not replace the clip with a bitmap.
2022-03-27 18:55:38 -07:00
David Wendt
e1d18be7fa
core: First pass at image loading through `loadMovie` et all
2022-03-27 18:55:38 -07:00
Toad06
4ad0253076
avm1: `String(function)` returns `[type Function]`
2022-03-27 11:39:44 -07:00
Mike Welsh
ac765bd187
chore: Update copyright
...
I (Michael R. Welsh) assign to Ruffle LLC all rights, title, and
interest to copyrights of my personal contributions to Ruffle,
effective March 26, 2022.
2022-03-26 18:13:14 -07:00
relrelb
1c576816b6
core: Refactor `LoadManager::load_form_into_load_vars`
...
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
relrelb
f3c22d930b
core: Refactor `LoadManager::load_form_into_object`
...
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
relrelb
83353e17c5
core: Refactor `LoadManager::load_movie_into_clip`
...
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
relrelb
7e4b3c1003
core: Refactor `LoadManager::load_root_movie`
...
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
Moulins
1bff5c517a
Move back AvmString into ruffle_core::string
...
This allows removing the gc_arena dependency in ruffle_wstr
2022-03-26 13:42:57 -07:00
Moulins
1911aa9a6b
Move core::string into separate ruffle_wstr crate.
2022-03-26 13:42:57 -07:00
relrelb
1230b5e713
swf: Use bitflags for `FontFlag`
2022-03-26 11:33:26 -07:00
relrelb
71a1757d29
swf: Make `Glyph::advance` non-`Option`
...
Simply use `0` instead of `None`.
2022-03-26 11:33:26 -07:00
relrelb
984342abf3
swf: Avoid some `Vec::resize` usages
...
Use the `vec![]` macro instead.
2022-03-26 11:33:26 -07:00
dependabot[bot]
f9e361ddae
build(deps): bump bitstream-io from 1.2.0 to 1.3.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/commits )
---
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-03-26 10:52:26 -07:00
dependabot[bot]
0c4806854c
build(deps): bump quote from 1.0.16 to 1.0.17
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.16 to 1.0.17.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.16...1.0.17 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 10:30:46 -07:00
relrelb
8f7b8c4b76
xml: Make `XmlNodeData` a struct
...
The difference between element nodes and text nodes is very minor.
So instead of representing them by two distinct enum members, make
`XmlNodeData` a single unified struct that can represent both. A new
`node_type` field is introduced, in order to still distinguish
between element and text nodes. Also, Ruffle made some incorrect
assumptions, which are now corrected, including:
* Nodes can have any arbitrary `u8` type. This is resolved by the
introduction of the `node_type` field which is a `u8`.
* Text nodes can have children. This is resolved by simply not checking
for text nodes in `append_child` etc.
2022-03-26 10:12:47 -07:00
relrelb
161071e8c4
core: Re-implement `NullExecutor`
...
Make it a thin abstraction layer over either the `futures` or `wasm-bindgen-futures`
crates, as already done in `render/wgpu/src/uniform_buffer.rs`,
instead of a hand-made single-thread executor.
Ideally this would also be usable on desktop, but I didn't manage to
get `LocalPool` working with `winit` (it needs to post a task to the
`EventLoopProxy` as a wake procedure).
2022-03-26 10:03:42 -07:00
Moulins
bb63ac2de7
wstr: fix memory leak
...
WString's Drop impl didn't actually drop anything
2022-03-25 18:36:00 -07:00
Toad06
c1119fdc0b
avm1: Apply autosize to a new `EditText` from an SWF `DefineEditText` tag
2022-03-21 20:00:06 -07:00
Aaron Hill
a281db3af6
Add `define_indirect_properties` helper macro for property/slot pairs
...
In both `FrameLabel` and `Scene`, we define multiple
'public property / private slot' pairs.
The public property has a getter which delegates to the private
property. There is no setter for the property, ensuring that
the private slot can only be modified from within Ruffle itself.
This PR adds a macro `define_indirect_properties` to abstract over
this pattern. Currently, it only supports the read-only property
pattern - however, it could be extended in the future to generate
a setter that invokes a caller-provided callback function.
This needs to be a macro (rather than a method) so that we can
generate a function with the property name hard-coded into it.
Using a closure that references an upvar will not work, since
`Method::from_builtin` requires a function pointer.
2022-03-21 19:00:25 -07:00
relrelb
b7a60384cf
xml: Inline `update_id_map`
...
Move its logic to `from_start_event`, where `XmlNode`s are created.
2022-03-20 11:04:48 +02:00
relrelb
724f4165d6
avm1: Implement `nodeName` and `nodeValue` setters
...
These are actually handled by the same function.
2022-03-19 16:31:24 -07:00
relrelb
f9dff4191b
xml: Remove `XmlNodeData::DocumentRoot`
...
Document roots (a.k.a. `XML` objects) are very similar to regular
element nodes (a.k.a. `XMLNode` objects). The primary difference is
that `XML` objects return `null` for their `nodeName`. But this can
be changed too; Setting `xml.nodeName = "someName"` will make `XML`
objects behave much like `XMLNode`. Moreover, many checks in Ruffle
that refuse to operate on document roots were wrong, and actually
these should be accepted as normal element nodes.
Besides the functional corrections, this also simplifies the code.
2022-03-19 16:31:24 -07:00
relrelb
fa70cc07ab
xml: Inline `text_from_text_event` and `is_whitespace_text`
2022-03-19 15:08:16 -07:00
relrelb
b31e826ee6
core: Simplify `SwfMovie` parsing in `Loader`
...
This also slightly changes behavior: Previously `SwfMovie::from_data`
errors were propagated as `FetchError` and `display_root_movie_download_failed_message`
was called, offering the user to sidestep CORS by opening the SWF
in a new tab. But that wouldn't help, obviously, because no network
error is involved. Now, these errors are propagated as `InvalidSwf`,
and `display_root_movie_download_failed_message` is not called.
2022-03-17 20:31:59 -07:00
relrelb
ad944800be
core: Perfer `Loader`'s `FetchError`
...
`NetworkError` and `NetworkUnavailable` were rarely used, and they
were very similar to `FetchError`.
2022-03-17 20:31:59 -07:00
relrelb
bf32fc8576
core: Remove unused `Loader` types
2022-03-17 20:31:59 -07:00
dependabot[bot]
d56377b166
build(deps): bump quote from 1.0.15 to 1.0.16
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.15 to 1.0.16.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.15...1.0.16 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 20:29:26 -07:00
dependabot[bot]
50bdb40914
build(deps): bump syn from 1.0.87 to 1.0.88
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.87...1.0.88 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 01:00:16 +02:00
dependabot[bot]
7fc6a7c000
build(deps): bump syn from 1.0.87 to 1.0.88
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.87...1.0.88 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 00:21:26 +02:00
relrelb
8a17d88c77
core: Remove `NavigatorBackend::time_since_launch`
...
`core` already depends on the `instant` crate which abstracts
`std::instant::Instant` and polyfills it on Web. Use it to replace
`NavigatorBackend::time_since_launch` in order to make `NavigatorBackend`
a little smaller and more simple.
2022-03-17 00:08:44 +02:00
relrelb
031126a1b8
core: Remove `LocaleBackend`
...
Previously there were 3 implementations of `LocaleBackend`:
`DesktopLocaleBackend`, `WebLocaleBackend` and `NullLocaleBackend`.
While `DesktopLocaleBackend`, `WebLocaleBackend` were identical,
`NullLocaleBackend` always returned a fixed date/time for tests
determinism.
Unify them in a single file, and use `cfg!(test)` and a new dedicated
`deterministic` feature to decide whether to mock date/time or not.
This should not cause any behavioral changes.
2022-03-16 19:57:53 +02:00
relrelb
1db29217eb
chore: Appease clippy
2022-03-16 18:51:39 +02:00
Aaron Hill
e87ad52deb
avm2: Add initial implementation of `Matrix`
...
This implements the `a, b, c, d, tx, ty` properties,
as well as the constructor, `identity`, and `scale` methods.
2022-03-16 13:52:58 +02:00
dependabot[bot]
8d7000cd67
build(deps): bump syn from 1.0.86 to 1.0.87
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.86 to 1.0.87.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.86...1.0.87 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-14 22:26:58 +02:00
relrelb
f8f2764ac7
chore: Stop using traits available in prelude
...
This commit does the same as 36353df7f7
,
cleaning up any leftovers and new code added since.
2022-03-14 01:16:00 +02:00
relrelb
9c9335dbb8
core: Small cleanup in `Font::measure`
2022-03-13 19:11:06 +02:00
relrelb
3d08f31fa7
avm1: Correct `StageObject::get_level_by_path`
...
Resolving `_levelN` had some inconsistencies with Flash:
1. `_flash` can be a prefix too.
2. The level ID parsing cannot fail; non-digit characters are ignored,
the value wraps around at `i32::MAX`, and negative values are valid.
This logic is relevant also for the `GetUrl` and `GetUrl2` opcodes.
For now only add TODOs for this.
2022-03-12 16:48:55 +02:00
relrelb
b59638935f
xml: Remove constant `process_entity` parameter
2022-03-12 16:11:39 +02:00
Aaron Hill
3bcb409bd8
Add more AVM2 'flash.' class stubs
...
This PR adds the following class stubs:
* 'flash.display.Loader'
* 'flash.net.URLRequest'
* 'flash.ui.Keyboard'
* 'flash.utils.Timer'
These are needed for 'This is the Only Level TOO' (though we'll need
actual implementations to get this game past the loading screen).
2022-03-12 15:09:41 +01:00
relrelb
b0a73d5638
avm1: Remove `TransformObject::construct`
...
`constructor` in `core/src/avm1/globals/transform.rs` should do
the same, as in other built-in classes.
2022-03-12 15:59:05 +02:00
relrelb
5a1e417526
avm1: Simplify `TDisplayObject::avm1_root()`
...
Make it infailable.
2022-03-10 01:22:52 +02:00
dependabot[bot]
71758be08b
build(deps): bump png from 0.17.4 to 0.17.5
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.17.4 to 0.17.5.
- [Release notes](https://github.com/image-rs/image-png/releases )
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md )
- [Commits](https://github.com/image-rs/image-png/compare/v0.17.4...v0.17.5 )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-03-07 23:59:02 +02:00
Aaron Hill
f4bb6fc43c
Change property definition from `loaderUrl` to `loaderURL`
...
The actual property name is `loaderURL` - it looks like
a typo was made when this was originally defined in Ruffle.
2022-03-07 09:24:01 +02:00
relrelb
88f6856723
avm1: Fix `isFinite()` for SWF<7
...
Previously, `isFinite()` with no arguments on SWF<7 incorrectly
returned `true`, as `undefined` coerced to `f64` is `0.0`, which
is finite. Fix this by not defaulting to `undefined`, similarly to
the `isNaN()` implementation.
2022-03-06 23:15:18 +01:00
Aaron Hill
8d58c6974c
Display `Muliname` when trying to lookup a non-public property
...
This will make these errors easier to debug.
2022-03-06 22:56:23 +01:00
Aaron Hill
4a534086b8
Make `Date` class prototype methods non-enumerable
2022-03-06 22:48:15 +01:00
Aaron Hill
2d1b3a2834
Also declare Date methods on class prototype
2022-03-06 22:48:15 +01:00
Aaron Hill
59ef987210
Declare AVM2 'Date' class methods in the AS3 namespace
...
We now declare these methods in the 'http://adobe.com/AS3/2006/builtin '
namespace. This corresponds to the 'AS3' namespace modifier shown on the
docs page: https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html
Previously, we would fail to lookup these methods, since the namespace
used by the SWF would not match the namespace defined by Ruffle.
2022-03-06 22:48:15 +01:00
relrelb
26f3d1e321
avm1: Fix typo
2022-03-06 23:10:09 +02:00
relrelb
d0edffaed3
avm1: Remove unneeded `pub`
2022-03-06 23:10:09 +02:00
relrelb
6504dc8ffc
avm1: Simplify `MovieClip::get_bounds`
...
The String and Object cases are already handled by `resolve_target_display_object`.
2022-03-06 23:10:09 +02:00
relrelb
2faabfb58e
xml: Remove `Error`
...
Directly use `quick_xml::Error` instead.
2022-03-02 08:56:23 +02:00
relrelb
e901999b4c
xml: Silently fail in `insert_child`
...
Instead of returning a `Result` which is anyway always handled with
a `log::warn!()`, simply `log::warn!()` in place of errors. This
removes the last 3 remaining `Error` enum members besides `InvalidXml`.
2022-03-01 19:56:36 +02:00
relrelb
48d0737cd9
xml: Inline `adopt_child` into `insert_child`
...
There's no point in calling `adopt_child` alone. This makes 2 `Error`
enum members redundant.
2022-03-01 19:56:36 +02:00
Toad06
dcca61073b
core: Display the appropriate mouse cursor after interacting with a button
2022-02-28 15:28:18 -07:00
dependabot[bot]
b5f65463b6
build(deps): bump png from 0.17.3 to 0.17.4
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.17.3 to 0.17.4.
- [Release notes](https://github.com/image-rs/image-png/releases )
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md )
- [Commits](https://github.com/image-rs/image-png/commits )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-28 22:31:11 +02:00
relrelb
7313913127
xml: Turn `remove_child` into `remove_node`
...
The 2 existing usages of `remove_node` always operated on a child and
its parent: One iterates over all of its children and removes each one,
and the other explicitly grabs the parent of a given node.
As a simplification, `remove_node` operates only on a child node,
without the need for the parent node in addition; it grabs the parent
from the child by itself. As such, it's non-failable.
2022-02-28 08:34:16 +02:00
relrelb
73c1be8dcc
xml: Remove `Error::TextNodeCantHaveChildren`
...
Text nodes are guaranteed to not be parents, as `adopt_child`
refuses to adopt children into them. So instead of returning an
`Err(Error::TextNodeCantHaveChildren)` in case of a text node parent,
mark those code paths as `unreachable!()`. This makes `orphan_child`
non-failable.
2022-02-28 08:34:16 +02:00
Toad06
66c132017f
avm1: Allow strings in `new Sound(target)`
2022-02-28 08:30:38 +02:00
relrelb
0401b3c447
avm2: Replace `json` with `serde_json`
...
The `json` crate seems unmaintained, and recently also causes compile
errors with stable Rust 1.59.0. On the other hand, `serde_json` is
very maintained and more popular.
However, from some reason a cyclic package dependency has introduced
by this change. For now use a workaround from: https://github.com/tkaitchuck/aHash/issues/95#issuecomment-903560879
2022-02-27 23:19:46 +02:00
relrelb
fa459f7547
core: Require `serde` feature
...
Enable it unconditionally as a preparation for depending on `serde_json`,
which will need `serde::Serialize`.
2022-02-27 23:19:46 +02:00
relrelb
841d0f7efd
avm1: Remove legacy JSON SharedObject deserialization
...
This is basically a revert of 61298b2be3
.
`SharedObject`s used to be saved as JSON in Ruffle, but since #4238
they're saved in AMF to match Flash's behavior. The legacy JSON
deserialization remained for backwards-compatibility, but from what it
seems, it has never worked; cd1cde1708
changed `LocalStorageBackend` to store base64-encoded strings instead
of plain ones. Therefore, Ruffle attempts to base64-decode old JSON
data, and unsurprisingly fails.
In addition, this removes 1 out of 2 usages of the unmaintained `json`
crate, which recently also causes compile errors with stable Rust 1.59.0.
2022-02-27 23:19:46 +02:00
relrelb
b645c01ce7
xml: Silently fail in `disown_parent`
...
Instead of returning a `Result` which is anyway always handled with
a `log::warn!()`, simply `log::warn!()` in place of error.
2022-02-24 18:02:52 +02:00
relrelb
f7117824df
xml: Silently fail in `set_{prev,next}_sibling`
...
Instead of returning a `Result` which is anyway always handled with
a `log::warn!()`, simply `log::warn!()` in place of errors.
2022-02-23 22:45:07 +02:00
relrelb
ce6e90c027
avm1: Store `status` in `XmlObject`, instead of `ParseError`
...
The only use of `last_parse_error` was in the `XML.prototype.status`
property, where it was converted into a number. Avoid storing it by
storing just the number.
2022-02-21 23:21:14 +02:00
dependabot[bot]
40f356a385
build(deps): bump rand from 0.8.4 to 0.8.5
...
Bumps [rand](https://github.com/rust-random/rand ) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/rust-random/rand/releases )
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-random/rand/compare/0.8.4...0.8.5 )
---
updated-dependencies:
- dependency-name: rand
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 22:34:09 +02:00
Toad06
5e8d8cc4d1
avm1: Add `trace` to globals
2022-02-14 14:50:33 +02:00
relrelb
faa1f3d6b4
avm1: Refactor `XmlNodeObject::from_xml_node`
...
Revert some of e50aea864b
for an even
better approach - Remove `XmlNodeObject::empty_node` entirely by
making `XmlNodeObject::from_xml_node` a suitable alternative. That is,
being able to accept a custom `proto` like before.
Also, make it return an `XmlNodeObject` instead of an `Object`, and
add a few `.into()` where needed.
2022-02-14 12:15:39 +02:00
dependabot[bot]
db888ad739
build(deps): bump png from 0.17.2 to 0.17.3
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.17.2 to 0.17.3.
- [Release notes](https://github.com/image-rs/image-png/releases )
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md )
- [Commits](https://github.com/image-rs/image-png/commits )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 18:43:46 +02:00
relrelb
dbddefb44d
xml: Refactor `XmlNode::into_string`
...
* Don't use `quick_xml::Writer` for formatting the XML, being much
more simple.
* Return `WString` instead of `String`, reducing `to_utf8_lossy()`
calls except when the string needs to be escaped (attribute values
and text contents).
2022-02-13 18:11:50 +02:00
dependabot[bot]
a3288fa20c
build(deps): bump serde from 1.0.133 to 1.0.136
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.133 to 1.0.136.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.133...v1.0.136 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 18:10:43 +02:00
dependabot[bot]
cc2df3e23c
build(deps): bump syn from 1.0.85 to 1.0.86
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.85 to 1.0.86.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.85...1.0.86 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:55:17 +01:00
dependabot[bot]
036218ed01
build(deps): bump jpeg-decoder from 0.2.1 to 0.2.2
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.1 to 0.2.2.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.1...v0.2.2 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:47:13 +02:00
dependabot[bot]
5f630217c6
build(deps): bump smallvec from 1.7.0 to 1.8.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.7.0...v1.8.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-02-13 16:46:59 +02:00
dependabot[bot]
281c080295
build(deps): bump symphonia from 0.4.0 to 0.5.0
...
Bumps [symphonia](https://github.com/pdeljanov/Symphonia ) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/pdeljanov/Symphonia/releases )
- [Commits](https://github.com/pdeljanov/Symphonia/compare/v0.4.0...v0.5.0 )
---
updated-dependencies:
- dependency-name: symphonia
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:13:44 +02:00
dependabot[bot]
3bef5cadf6
build(deps): bump quote from 1.0.14 to 1.0.15
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.14 to 1.0.15.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.14...1.0.15 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 15:45:11 +02:00
Jean Marchand
9969e0ce5a
avm2: Fix invalid option
2022-02-12 23:35:32 +02:00
relrelb
ad2b8ea007
avm1: Merge `XmlDocument` into `XmlObject`
...
As `XmlDocument` and `XmlObject` had 1-to-1 relation, and `XmlDocument`
is already tightly coupled with AVM1, there's no good reason for them
being separate objects.
This brings us one step closer towards an XML implementation hosted
completely in AVM1.
A future PR will merge `XmlNode` into `XmlNodeObject` in a similar
manner.
2022-02-11 19:08:02 +02:00
relrelb
aee98d81c8
avm1: Fix nightly build error
2022-02-11 18:45:32 +02:00
relrelb
360ad90a85
avm1: Call sort function with a primitive `this`
...
This is now possible thanks to #6108 .
2022-02-11 18:45:32 +02:00
Toad06
b15806d9c2
avm1: Remove `random` from globals
2022-02-11 00:55:13 +02:00
relrelb
44fd13c654
avm1: Fix builtins' attributes
...
Fixes #5827 .
2022-02-10 19:42:05 +02:00
relrelb
b6c7cc1ca3
core: Cleanup `Avm1ConstructorRegistry`
...
Instead of storing shared pointers to `Avm1ConstructorRegistry` in
`MovieLibrary`, access the `PropertyMap` directly, without an extra
abstraction.
Also, move the constructor registries to `Avm1`, for better
encapsulation.
2022-02-10 07:58:30 +02:00
Toad06
fff9cd1d63
avm1: Change cursor to arrow when the `enabled` property is set to false
2022-02-09 16:26:50 -08:00
TÖRÖK Attila
ed0aa3758c
core: Extend the embedded fake device font with more characters
...
By also embedding the "Basic Latin", "Latin I", and "Latin Extended A" sections.
2022-02-09 20:09:52 +01:00
relrelb
6c4a10792d
avm1: Remove `XmlIdMapObject`
...
Use a bare `ScriptObject` instead.
2022-02-07 22:24:42 +02:00
relrelb
e50aea864b
xml: Simplify `XmlNodeObject::from_xml_node`
...
Since it's always called with the same prototype (`XMLNode.prototype`),
this can be pulled into the function itself, greatly simplifying it.
2022-02-07 22:24:42 +02:00
relrelb
79d5a0e326
avm1: Avoid some calls to `XmlNode::introduce_script_object`
...
Instead call `XmlNode::script_object`, which internally calls
`XmlNode::introduce_script_object`. This is a preparation for changing
the signature of `XmlNodeObject::from_xml_node`.
2022-02-07 22:24:42 +02:00
relrelb
7e32f7b85d
xml: Remove `tests.rs`
...
These are already covered by the SWF tests.
2022-02-07 22:24:42 +02:00
Adrian Wielgosik
562a205f3d
chore: clippy
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
2c4b260a8c
chore: cargo fmt
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
c67579e236
avm2: Implement Object()
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
0004b9e58e
avm2: Implement RegExp()
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
c8fe2fcfb2
avm2: Implement Namespace() stub
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
8402f6637b
avm2: Implement Vector.<T>(array_like)
2022-02-07 00:49:00 +01:00
Adrian Wielgosik
db8aa42db9
avm2: Support custom Class() implementations
2022-02-07 00:49:00 +01:00
Fernando Karchiloff
0c853082dd
core: Fix bullet append with box_count check
2022-02-06 20:52:04 +02:00
Fernando Karchiloff
b7273e038c
core: fix bullet append from html
2022-02-06 20:52:04 +02:00
relrelb
48c43b731e
avm1: Remove unused `is_defined`
2022-02-05 13:43:19 +02:00
Toad06
83cc9dc308
avm1: Fire `onReleaseOutside` event even when the button is invisible
2022-01-30 14:08:47 -08:00
Mike Welsh
601918a998
core: Fix drawing API stroke rendering order ( fix #3186 )
2022-01-29 20:05:04 -08:00
Mike Welsh
705588a2ec
core: Fix incorrect fill and stroke rendering order ( fix #6129 )
2022-01-29 20:05:04 -08:00
Mike Welsh
55da3cd7d0
chore: Add .cargo/config.toml for workspace-level lint config
...
Currently it is not directly possible to configure lints for the
entire workspace via TOML, which forced us to repeat `#![allow]`
blocks in each crate.
embark pointed out this workaround to configure lints at the
workspace level via RUSTFLAGS:
https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395
Remove the common `#![allow]` blocks and switch to this method for
global lint config.
Temporarily allow `needless_borrow` lint, buggy pending this fix:
https://github.com/rust-lang/rust-clippy/pull/8355
2022-01-29 14:22:44 -08:00
relrelb
99b22b24dd
avm1: Remove unused `FunctionObjectData::primitive`
2022-01-29 12:12:39 -08:00
Daniel Jacobs
1e5956c02a
core: Fix get_text_format bullet return value
2022-01-27 22:35:18 -08:00
TÖRÖK Attila
43b21e5d4d
chore: Bump approx to 0.5.1, remove clippy lint suppressions
2022-01-25 18:34:35 -08:00
Toad06
da50d44460
core: Fix detection of button events
2022-01-24 11:48:37 -08:00
Mike Welsh
354d7f0ce6
avm1: Remove unused `this` from `Scope::resolve` and `set`
2022-01-24 02:04:57 -08:00
Mike Welsh
c35edaae82
avm1: Allow `this` to be `undefined`
...
Change `Activation::this` to be `Value` instead of `Object`.
2022-01-24 02:04:57 -08:00
Mike Welsh
9ccb3ac3e7
avm1: Fix coercion in string-object concatenation
...
Previously we called `toString` when concatenating a string to an
Object. However, Flash actually has more complex behavior, usually
calling both `valueOf` and `toString`. This is loosely based on
ToPrimitive/DefaultValue with no type hint in the ECMAScript spec.
* Call `valueOf`.
* If the result isn't a primitive, call `toString`.
* If the result still isn't primitive, return `"[type Object]"`.
* For Date objects in SWFv6 and higher, call `toString`.
* If the result isn't a primitive, call `toString` (AVM1 bug?)
* If it still isn't primitive, return `"[type Object]"`.
2022-01-23 17:19:09 -08:00
David Wendt
48f8515c03
core: `mouseEnabled` controls whether or not display objects are mouse-pickable
2022-01-22 19:58:32 -08:00
David Wendt
35cbed01fa
docs: Better document the `ClipEvent` dispatch patterns.
2022-01-22 19:58:32 -08:00
David Wendt
e5d9379740
core: Implement `mouseMove` event
2022-01-22 19:58:32 -08:00
David Wendt
6271d069d7
core: `Stage` should not include it's own transform in it's local/global matrix.
2022-01-22 19:58:32 -08:00
David Wendt
c42984a990
avm2: Implement `MouseEvent.toString`.
...
This also rearranges some things about how we construct events, because `MouseEvent` has different defaults from `Event`. When we finally support parameter metadata on methods we should remove that code.
We also remove the `value_of` code on `EventObject` as that was a mistake. Events don't do anything special in there and I misinterpreted the test results the first time around.
2022-01-22 19:58:32 -08:00
David Wendt
880211c238
core: Implement the `doubleClick` event on objects that request it.
2022-01-22 19:58:32 -08:00
David Wendt
eeea5ffea6
core: Issue `MouseWheel` events for AVM2.
2022-01-22 19:58:32 -08:00
David Wendt
87a9a543ba
chore: Fix clippy lint on nightly
2022-01-22 19:58:32 -08:00
David Wendt
84d1d5aa76
core: Issue `mouseOver`, `mouseOut`, etc when dragging.
2022-01-22 19:58:32 -08:00
David Wendt
42b606d058
core: Issue `rollOver`, `rollOut`, `mouseOut`, and `mouseOver` events to AVM2.
2022-01-22 19:58:32 -08:00
David Wendt
353a5a78d6
core: Move `mouse_pick` and `mouse_cursor` to `InteractiveObject` as no non-interactive object implements them.
...
This also cascades into other places, ultimately resulting in more things being marked as `InteractiveObject`.
2022-01-22 19:58:32 -08:00
David Wendt
d0ef15503c
avm2: Store the last-hovered or currently-hovered object on the event that notifies the clip that the hover state has changed.
2022-01-22 19:58:32 -08:00
David Wendt
f69206aaa2
core: Fire AVM2's `mouseUp` event on the correct object.
...
This requires adding another notion of mouse-release events to `ClipEvent`. We now have four:
* `MouseUp` - the mouse was released, any object on the render list can handle this event ("anycast" event)
* `MouseUpInside` - the mouse was released inside this display object, only the mouse-picked target of the event can handle it
* `Release` - the mouse was released inside the last clicked display object
* `ReleaseOutside` - the mouse was released outside the last clicked display object
For those keeping score at home, in AVM2, the valid progression of events is either...
* On the same object, `mouseDown`, `mouseUp`, and `click`
* On one object, `mouseDown`, then some mouse movement that takes the cursor out of the first object, then on another object `mouseUp`, and then finally the first object gets `releaseOutside`.
2022-01-22 19:58:32 -08:00
David Wendt
35f020f482
avm2: Allow `Stage` to receive button presses
2022-01-22 19:58:32 -08:00
David Wendt
9d4b222b29
core: AVM2 wants the same semantics as `Press`/`Release`, not `MouseDown`/`MouseUp`.
...
`MouseDown`/`MouseUp` are effectively broadcasts; they hit every movie clip that can accept them until one of them has a handler for it. AVM2 instead wants events that only apply to specific mouse-picked display objects, which means we need to use the Player-tracked events `Press`, `Release`, and `ReleaseOutside`. The only problem is that we also need to emit a `mouseUp` event on both `Release` and `ReleaseOutside`.
2022-01-22 19:58:32 -08:00
David Wendt
f0ab17c979
core: AVM2 `MovieClip`s can accept mouse events without being in button mode.
...
This technically changes the meaning of `require_button_mode` slightly to something more like "accepts input".
2022-01-22 19:58:32 -08:00
David Wendt
f56782c5c7
core: Movie clips do not have a hand cursor unless they are also in button mode.
2022-01-22 19:58:32 -08:00
David Wendt
cbeb24f3f8
core: Implement forced button mode flag for AVM2.
2022-01-22 19:58:32 -08:00
David Wendt
7b6f8aef06
avm2: Implement `flash.events.EventPhase`.
2022-01-22 19:58:32 -08:00
David Wendt
6d02248ea5
core: Add a method to fire common `InteractiveObject` events into AVM2.
2022-01-22 19:58:32 -08:00
David Wendt
18b8b227a1
avm2: Add utility method for pulling mouse event data from current context
2022-01-22 19:58:32 -08:00
David Wendt
c53130e940
avm2: Automatically select a given event's class based on it's data.
2022-01-22 19:58:32 -08:00
David Wendt
ada093938e
avm2: Expose `MouseEvent` as a system class.
2022-01-22 19:58:32 -08:00
David Wendt
ac0f62d475
avm2: Implement `MouseEvent.stageX`/`stageY`
2022-01-22 19:58:32 -08:00
David Wendt
9ee263160a
avm2: Implement `MouseEvent.relatedObject`
2022-01-22 19:58:32 -08:00
David Wendt
477b8fb87f
avm2: Implement `MouseEvent.movementX`/`movementY`
2022-01-22 19:58:32 -08:00
David Wendt
b612980ace
avm2: Impl `MouseEvent.localX`/`localY`
2022-01-22 19:58:32 -08:00
David Wendt
948b591378
avm2: Stub `MouseEvent.isRelatedObjectInaccessible`
2022-01-22 19:58:32 -08:00
David Wendt
a3c48c5e29
avm2: Implement `MouseEvent.delta`
2022-01-22 19:58:32 -08:00
David Wendt
22638f4aae
avm2: Impl `MouseEvent.buttonDown`
2022-01-22 19:58:32 -08:00
David Wendt
d790b138b0
avm2: Implement accessor methods for `altKey`, `commandKey`, `controlKey`/`ctrlKey`, and `shiftKey`.
2022-01-22 19:58:32 -08:00
David Wendt
d9bbafb0bb
avm2: Make `MouseEvent`'s constructor set event data based on it's parameters.
2022-01-22 19:58:32 -08:00
David Wendt
016cd6ccc0
avm2: Make event construction take an `EventData` parameter.
...
This also necessitated the introduction of a `FullScreenEvent` data type.
2022-01-22 19:58:32 -08:00
David Wendt
43161976c7
avm2: Add a new field to store mouse event data on dispatched events.
2022-01-22 19:58:32 -08:00
relrelb
164e1a38c0
core: Remove unnecessary parameter from `post_instantiation`
...
`display_object` was always equivalent to `self`, there's no need to
pass both.
2022-01-22 11:37:33 -08:00
Mike Welsh
e11e1e870f
avm1: Improve Object comparisons in SWFv5
...
SWFv5 always calls `Object.valueOf` at least once and sometimes
twice in the Equals2 op, even when comparing two Objects.
For example, `Object(1) == Object(1)` is true in SWFv5 but false
in SWFv6.
2022-01-21 16:40:19 -08:00
Mike Welsh
bf599d9107
avm1: Clean up Value::abstract_eq
...
Consolidate several cases and fix some issues:
* Object-to-primitive comparison always goes through `valueOf`.
* `Object(undefined) == undefined` is true; this will coerce
to a bare object with no `valueOf`, resulting in
`undefined==undefined`.
* `{valueOf:function() { return NaN; }} == NaN` is true.
2022-01-21 16:40:19 -08:00
Mike Welsh
4d8db1e64d
avm1: Fix function closures inside `with`
...
When creating a scope for a closure, any `with` scopes were being
filtered out, but this was incorrect; `with` scopes are still on
the scope chain when the function is called.
2022-01-19 20:29:26 -08:00
relrelb
1de284dc5b
html: Fix handling of end tag mismatch
...
Flash ignores mismatched end tags (i.e. end tags with a missing/different
corresponding start tag). `quick-xml` checks end tag mismatches by
default, but it cannot recover after encountering one.
Commit 7e20543578
already disabled
`quick-xml`'s check, but that caused mismatched `Event::End` to be
handled, which may empty `format_stack` and later panic on
`format_stack.last().unwrap()`.
Thus, check for mismatched end tags ourselves, in a similar manner
of `quick-xml`, but in a recoverable way.
2022-01-18 13:50:26 -08:00
David Wendt
57acf47a10
avm2: Allow access to stage properties without a valid root movie clip.
2022-01-18 11:06:23 -08:00
David Wendt
df25d1ca8b
avm2: Children of the root inherit their parent's `loaderInfo`
2022-01-18 11:06:23 -08:00
David Wendt
f041cced72
avm2: The stage's loader info object allows access to `url`, `bytes`, and `parameters`.
2022-01-18 11:06:23 -08:00
Mike Welsh
b181debff6
swf: Use bitflags for `avm1::GetUrl2`
2022-01-17 21:35:57 -08:00
Mike Welsh
4c3e14eae5
core: Clean up `DefineFunction` action
...
* Have `DefineFunction` and `DefineFunction2` go through the same
code path by implementing `From<DefineFunction>` for
`DefineFunction2`.
* Change `register` to a `Option<NonZeroU8>` for size optimization.
* Add `function::Param` to store param info instead of a tuple.
2022-01-17 21:35:57 -08:00
Mike Welsh
c618a12d14
core: Remove _ pattern in `avm1::Activation::do_action`
...
The match is exhaustive, so replace `_` with `Action::Unknown`.
2022-01-17 21:35:57 -08:00
Mike Welsh
2b2346b65e
swf: Add `avm1::Action::End`
...
Returning an `Action::End` instead of `None` when reading the end
of an action.
2022-01-17 21:35:57 -08:00
Mike Welsh
9141451ca1
swf: Use structs for avm1 `Action` variants
...
Use a struct for all variants of `avm1::Action`.
This makes the style more consistent instead of using a mix of
struct and tuple variants, and allows the data to be easily passed
around.
2022-01-17 21:35:57 -08:00
Adrian Wielgosik
5358940774
avm2: Support basic string.replace
...
Supports:
- string.replace(string, string)
- string.replace(regex, simple_string)
Does not support:
- string.replace(regex, string_with_replacement_codes)
- string.replace(any, function)
2022-01-17 20:10:20 -08:00
relrelb
3b25a3b901
avm1: Correct `MovieClipLoader.getProgress`
...
Handle strings, numbers and DisplayObject targets.
Return compressed length rather than uncompressed length.
2022-01-15 13:08:01 -08:00
relrelb
eb23f19fad
avm1: Correct `MovieClipLoader.unloadClip`
...
Handle strings, numbers and DisplayObject targets.
2022-01-15 13:08:01 -08:00
relrelb
0da8e504ab
avm1: Correct `MovieClipLoader.loadClip`
...
Handle strings, numbers and DisplayObject targets (not just MovieClips).
To support non-MovieClip targets, turn `clip.as_movie_clip().unwrap()`
to `if let Some(mc) = clip.as_movie_clip()` in `Loader`.
2022-01-15 13:08:01 -08:00
relrelb
e9607cfcbb
chore: Appease clippy
2022-01-15 11:16:24 -08:00
relrelb
25722e7abe
avm1: Fix `onLoadInit` event order
...
`onLoadInit` is queued after all `DoAction`s of the loaded clips.
That is, if clip1, clip2, clip3 are loaded in the same frame
(in this order), then actions will be executed as follows:
* `DoAction` of clip3
* `DoAction` of clip2
* `DoAction` of clip1
* `onLoadInit` of clip3
* `onLoadInit` of clip2
* `onLoadInit` of clip1
Previously, those were incorrectly executed as follows:
* `DoAction` of clip3
* `onLoadInit` of clip3
* `DoAction` of clip2
* `onLoadInit` of clip2
* `DoAction` of clip1
* `onLoadInit` of clip1
2022-01-14 17:27:14 -08:00
TÖRÖK Attila
12f9bec194
chore: Bump h263-rs git reference
...
To make use of https://github.com/ruffle-rs/h263-rs/pull/17
2022-01-14 17:09:39 -08:00
Mike Welsh
232f1dd120
chore: Appease clippy
2022-01-10 23:37:11 -08:00
dependabot[bot]
8f53449762
build(deps): bump indexmap from 1.7.0 to 1.8.0
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/bluss/indexmap/releases )
- [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.rst )
- [Commits](https://github.com/bluss/indexmap/compare/1.7.0...1.8.0 )
---
updated-dependencies:
- dependency-name: indexmap
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:08:19 -08:00
dependabot[bot]
491cc05a79
build(deps): bump syn from 1.0.84 to 1.0.85
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.84 to 1.0.85.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.84...1.0.85 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:07:29 -08:00
relrelb
b39ab9034c
core: Remove `Player::is_mouse_down`
...
Now that `InputManager` tracks the mouse button, it can be used
instead.
2022-01-10 01:18:49 -08:00
relrelb
573aa89c9a
core: Handle mouse events in `InputManager::handle_event`
2022-01-10 01:18:49 -08:00
relrelb
82b4c6ef27
core: Support mouse buttons in `KeyCode`
...
Add `MouseLeft`, `MouseRight` and `MouseMiddle` to `KeyCode` for
AVM1's `Key.isDown()` function.
2022-01-10 01:18:49 -08:00
relrelb
6396c21bc0
core: Rename `PlayerEvent::MouseLeft` to `MouseLeave`
...
So it's not consfusing with `KeyCode::MouseLeft`.
2022-01-10 01:18:49 -08:00
relrelb
c00532aed2
core: Cleanup mouse update logic
...
Move code that is exclusive to mouse events from
`Player::update_mouse_state` to `Player::handle_event`.
2022-01-10 01:18:49 -08:00
Adrian Wielgosik
86210363f0
avm2: Remove Object::derive() machinery for AS3 prototypes
2022-01-09 18:23:10 -08:00
relrelb
b79144c122
avm1: Remove `TextFormatObject::set_text_format`
...
Use `text_format_mut` instead.
2022-01-10 00:26:33 +02:00
Mike Welsh
2653c5f5c3
audio: Handle gaps in MP3 SoundStreamBlock tags ( fix #3817 )
...
An MP3 "stream" sound can sometimes have frames without a
SoundStreamBlock tag, despite the SWF spec saying there should
at least be a tag with 0 samples on each frame. Ruffle would
stop the sound in this case, but the Flash Player may or may not
stop thje sound in the audio depending on the number of "empty"
frames. This could cause the audio to stutter as it continuously
stopped and restarted.
Handle this by keeping track of how many samples we've encountered
in MP3 blocks, and deducting the amount of samples consumed by each
timeline frame. Stop the sound if we run out of samples, as opposed
to when we hit a frame without a SoundStreamBlock.
Fixes #3817 .
2022-01-07 13:23:53 -08:00
Mike Welsh
b2f7c98f88
audio: Sync animation with embedded audio streams
...
This is a first pass at syncing animation and audio playback when
and embedded audio stream is playing.
Fixes #3020 , #3663 , #3958 .
2022-01-07 13:23:53 -08:00
relrelb
8c736b9756
avm1: Fix `MovieClipLoader` event arguments
...
The first argument of all events is the target MovieClip. It was
incorrect.
Also, `onLoadComplete` accepts an additional `httpStatus` argument.
Stub it to 0.
2022-01-07 10:39:16 -08:00
relrelb
e045a9502b
core: Small cleanup in `Loader`
...
Remove unnecessary calls to `introduce_loader_handle`, which are
dominated by `add_loader` that already calls it. As a result, `add_loader`
remained the only function to call `introduce_loader_handle`, so inline
it there.
2022-01-07 10:39:16 -08:00
relrelb
c05ff4cbc8
core: Unify `Loader::Xml` into `Loader::LoadVars`
...
Since they are identical (they both load the URL as a string, then
fire the `onHTTPStatus` and `onData` events). In fact, AVM1's
`XML.prototype.load` and `LoadVars.prototype.load` functions are
both defined as `ASnative(301, 0)`, so they invoke the same native
code under the hood.
2022-01-07 09:51:27 -08:00
dependabot[bot]
a9e86a73cf
build(deps): bump serde from 1.0.132 to 1.0.133
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.132 to 1.0.133.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.132...v1.0.133 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 23:28:57 +02:00
dependabot[bot]
6533511994
build(deps): bump quote from 1.0.10 to 1.0.14
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.10 to 1.0.14.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.10...1.0.14 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 22:50:58 +02:00
Mike Welsh
34ed9cbbaa
core: Fix incorrect closing of paths in drawing API ( fix #5598 )
...
The path starting position was not being set correctly after a
moveTo command, which could cause stray strokes to appear in the
drawing.
Fixes #5598 , #5768 , #5957 .
2022-01-01 22:24:08 -08:00
relrelb
655adedc1c
xml: Remove `XmlNode::is_as2_compatible`
...
Now all `XmlNodeData` types are AS2-compatible, so `is_as2_compatible`
always returns `true`.
2022-01-02 07:36:49 +02:00
relrelb
30cd2aa4f1
xml: Remove `XmlNodeData::DocType`
...
`XmlNode::is_as2_compatible` returns `false` for `XmlNodeData::DocType`
nodes, which means they are not included in string representations of
XML documents, and they cannot be traversed using the DOM methods.
So don't create those when parsing an XML from string, but still
store the `DOCTYPE` declaration string on the `XmlDocument`, which
is accissible through the `.docTypeDecl` property.
2022-01-02 07:36:49 +02:00
relrelb
827bb6e48e
xml: Remove `XmlNodeData::Comment`
...
`XmlNode::is_as2_compatible` returns `false` for `XmlNodeData::Comment`
nodes, which means they are not included in string representations of
XML documents, and they cannot be traversed using the DOM methods.
So simply don't create those when parsing an XML from string.
2022-01-02 07:36:49 +02:00
relrelb
e477fca9e4
xml: Use OR patterns
...
This results in a slightly shorter code, and avoids some duplication.
2021-12-31 19:00:12 +02:00
relrelb
8bd144ec88
xml: Make `XmlDocumentData::root` non-`Option`
...
Since `XmlNode::document` doesn't exist anymore, so as the circular-
reference between `XmlDocument` and `XmlNode`.
2021-12-31 19:00:12 +02:00
relrelb
3676db47a3
xml: Remove unused `XmlNode::document`
2021-12-31 19:00:12 +02:00
relrelb
f7e80e3fb9
xml: Inline `XmlDocument::add_child_to_tree`
...
Include the XML root node itself as part of the stack, so appending
children to it is no longer considered a special case.
2021-12-31 09:35:09 +02:00
relrelb
e1198bd30c
xml: Inline `XmlDocument::process_event`
...
Now that `replace_with_str` is defined in `XmlDocument`, there is
no need anymore for a separate function that handles nodes which have
document-wide implications.
2021-12-31 09:35:09 +02:00
relrelb
7d148fb61d
xml: Move `XmlNode::replace_with_str` to `XmlDocument`
...
It only makes sense to call this method on document roots.
2021-12-31 09:35:09 +02:00
Adrian Wielgosik
fcab60de7e
core: register non-ascii fonts lazily
2021-12-31 01:10:48 +01:00
relrelb
0bab5f6d91
avm1: Use `XmlObject`
...
Previously Ruffle's AVM1 runtime incorrectly permitted calling `XML`
functions on `XMLNode` objects. For example:
```as
var xml = new XML("<a><b></b></a>");
trace(XML.prototype.createElement.call(xml.firstChild, "aaa")); // traces "undefined" in Flash, but "<aaa />" in Ruffle before this commit.
```
Disallow this by using the newly-reintroduced `XmlObject` for `XML` objects
(rather than `XmlNodeObject` that represents also `XMLNode` object), and check
for it in all `XML` builtins.
2021-12-30 22:13:14 +02:00
relrelb
b501b4697a
avm1: Re-introduce `XmlObject`
...
The newly-reintroduced `XmlObject` will represent `XML` document objects.
Currently it's unused, but the following commit will make use of it.
2021-12-30 22:13:14 +02:00
TÖRÖK Attila
09ca48e389
chore: Bump h263-rs git reference
2021-12-30 16:22:27 +01:00
TÖRÖK Attila
6f68938591
video/vp6: Fix keyframe detection on Vp6WithAlpha videos
2021-12-29 11:28:05 +01:00
dependabot[bot]
56b340ebf5
build(deps): bump syn from 1.0.82 to 1.0.84
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.82 to 1.0.84.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.82...1.0.84 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-27 22:32:21 +02:00
relrelb
e547fd710d
xml: Remove `XmlName`
...
Instead use a much simpler approach using `XmlNode::local_name` and
`XmlNode::prefix`.
2021-12-27 20:53:34 +02:00
relrelb
6ca1ac05da
avm1: Rename `XmlObject` to `XmlNodeObject`
...
The name `XmlObject` will be re-used in a future PR for `XML`
document objects.
2021-12-27 20:53:34 +02:00
Moulins
74ab24c0c3
core: fix wide string handling in html::text_format
...
Closes #5839
2021-12-21 22:19:13 +02:00
Adrian Wielgosik
4230d1f19f
avm2: Add Mouse.hide(), Mouse.show()
2021-12-21 17:32:57 +01:00
dependabot[bot]
fd816f3a0a
build(deps): bump serde from 1.0.131 to 1.0.132
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.131 to 1.0.132.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.131...v1.0.132 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-21 08:35:54 +02:00
relrelb
b1151b2ab2
html: Rewrite `FormatSpans::to_html`
...
The new implementation doesn't use the `xml` crate, nor `quick-xml`,
but rather just iterates the `TextSpan`s and builds the formatted HTML
string.
2021-12-20 08:31:59 +02:00
relrelb
2ad5c644b0
avm1: Make `ArrayObject` proto non-`Option`
...
It was always passed as `Some`, so there's no reason for allowing
`None`.
2021-12-18 13:39:22 +02:00
relrelb
9d87a34f25
html: Ignore tag errors
...
Flash stops parsing the XML in such cases, but still returns the
partially-processed text.
2021-12-18 11:34:31 +02:00
relrelb
c1404f6a3e
html: Expand empty elements
...
`quick-xml` has a feature to split empty elements into an `Open` and
a `Close` event. Use it to avoid duplicated code.
2021-12-18 11:34:31 +02:00
relrelb
7e20543578
html: Don't check end names
...
Flash permits mismatched closing tags (e.g. `<mytag></different_tag>`),
so turn-off this check.
2021-12-18 11:34:31 +02:00
Adrian Wielgosik
5d81a0ce64
avm2: Remove .clone() calls now that Index is Copy
2021-12-17 21:09:40 -07:00
Adrian Wielgosik
a8fb1c2b16
avm2: pass Multiname to resolve_type() by reference
2021-12-17 21:09:40 -07:00
Adrian Wielgosik
22a0711d85
avm2: Use TU's method cache for callstatic, newfunction opcodes
2021-12-17 21:09:40 -07:00
Adrian Wielgosik
4b23f4dfb7
avm2: Set correct value type in op_convert_u/i
2021-12-17 21:06:33 -07:00
TÖRÖK Attila
0a2767fcb4
video: Wire up DefineVideoStream smoothing flag to the renderer
...
With all the weird logic for when it actually takes effect
2021-12-17 21:03:57 -07:00
David Wendt
2aee3555ab
chore: Fix all new clippy lints added in latest Rust nightly
2021-12-17 20:53:26 -07:00
relrelb
07c5330456
core: Introduce `InputManager`
...
`InputManager` encapsulates the common logic that previously the
`UiBackend`s used to implement.
2021-12-15 14:20:30 -08:00
Adrian Wielgosik
726ec47f19
avm2: Support inheritance of protected traits
2021-12-15 22:26:41 +01:00
Adrian Wielgosik
11534a4b34
avm2: Implement parseInt, parseFloat
2021-12-15 22:16:49 +01:00
Adrian Wielgosik
49feb23649
avm2: Move toplevel functions to separate file
2021-12-15 22:16:49 +01:00
TÖRÖK Attila
95665bdc47
video: Extract software decoders (or glue) into their own modules, add screenvideo feature
2021-12-14 19:41:17 -07:00
TÖRÖK Attila
fdc448533d
video: Add Flash Screen Video (V1 only) decoder
...
Thanks a lot for the code and the help, Kostya!
2021-12-14 19:41:17 -07:00
Toad06
db98f0b42f
avm1: Use inner SWFs version number
2021-12-14 19:39:30 -07:00
dependabot[bot]
c6dfcb4e37
build(deps): bump serde from 1.0.130 to 1.0.131
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.130 to 1.0.131.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.130...v1.0.131 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-13 23:23:13 +02:00
dependabot[bot]
b8ff8bb185
build(deps): bump jpeg-decoder from 0.2.0 to 0.2.1
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.2.0...v0.2.1 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-13 23:23:01 +02:00
dependabot[bot]
ef679d25c7
build(deps): bump encoding_rs from 0.8.29 to 0.8.30
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.29 to 0.8.30.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.29...v0.8.30 )
---
updated-dependencies:
- dependency-name: encoding_rs
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-13 23:22:28 +02:00
EmperorBale
30f2e0f8b1
avm2: Implement JSON ( #5172 )
...
* avm2: Implement JSON.parse
* avm2: Add AvmSerializer for serializing AVM values to JSON
* avm2: Add support for replacer objects
* avm2: use *const ObjectPtr for object stack
* avm2: Add support for space parameter is JSON.stringify
* avm2: Refactor AvmSerializer design
* avm2: Restrict spaces to a maximum of 10
* avm2: Refactor map_value
* tests: Add JSON.parse test
* chore: Appease clippy
* avm2: Check if value is undefined before inserting
* tests: Add test for JSON.stringify
* tests: Improve JSON.stringify test
* chore: Replace map_or with explicit match statements
* chore: Use QName::dynamic_name
* avm2: Use Object<'gc> instead of ObjectPtr
* chore: Use explicit match in deserialize_value
* Rebase fixes
Co-authored-by: Adrian Wielgosik <adrian.wielgosik@gmail.com>
2021-12-13 18:32:04 +01:00
Adrian Wielgosik
ad1442dbaa
avm2: Add a basic ContextMenu stub
2021-12-13 18:31:03 +01:00
Adrian Wielgosik
1f5979f168
chore: clippy
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
1311b0a3d0
avm2: refactor Domain::get_defining_script
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
0fb075a309
chore: cargo fmt
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
3d8f611651
avm2: Update comments.
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
b747541709
avm2: Panic upon encountering CallMethod opcode
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
1d8c556944
avm2: Handle TODOs, throw errors where applicable
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
24247dff0b
avm2: install_const_late always appends slots
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
4bd12ae4b3
avm2: Get prototypes from classes without get_property()
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
49d16dea8b
avm2: Rip out `receiver` from get/set/call_property
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
ee0798b258
avm2: Cleanup slots/global initialization some more
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
21865edf9b
avm2: Support const slots, fill some TODOs
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
b272d8722e
avm2: Reword slot/disp_id assignment, remove Slot.
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
4d8999c012
avm2: Make all prototypes ScriptObjects; also cleanup vector enumeration, Proxy
2021-12-11 20:48:09 +01:00
Adrian Wielgosik
3706db86d2
avm2: move properties from instances to vtable
2021-12-11 20:48:09 +01:00
relrelb
d3fe4ea59a
avm1: Split `XML` and `XMLNode` definitions
...
This reduces the file size of the previous `xml.rs` file, and makes
the code a bit more organized.
2021-12-11 20:28:37 +02:00
Adrian Wielgosik
6594d4159d
avm2: Use Vec instead of HashMap for loaded constants
2021-12-11 10:03:29 +01:00
relrelb
ca3b215561
chore: Appease clippy
2021-12-10 21:06:38 +02:00
relrelb
7966d850dd
core: Normalize `\r` to `\n` in `avm_trace`
...
Fixes #3120 .
2021-12-10 19:54:35 +02:00
relrelb
eacf34d80a
avm1: Remove `Function.prototype.toString`
...
`Function.prototype` doesn't have its own `toString` method, but
rather inherts it from `Object.prototype`. So remove `Function.prototype.toString`
and move its logic to `Object.prototype.toString`.
2021-12-10 11:36:39 +02:00
relrelb
ce2eff8b25
render: Stub L16 JPEG pixel format
...
16-bit luminance (grayscale) images are very rare, so it's hard to
tell what the expected behavior should be.
2021-12-10 00:28:45 +02:00
dependabot[bot]
8007f21ffe
build(deps): bump jpeg-decoder from 0.1.22 to 0.2.0
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.1.22 to 0.2.0.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases )
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.1.22...v0.2.0 )
---
updated-dependencies:
- dependency-name: jpeg-decoder
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-10 00:28:45 +02:00
Adrian Wielgosik
d28dd3bd05
avm1: Fix up attributes of some builtins' protos
2021-12-10 00:28:21 +02:00
EmperorBale
0a25ebbc32
chore: Remove more explicit clones
2021-12-08 22:14:45 +01:00
EmperorBale
d6b7d0c915
chore: Fix formatting
2021-12-08 22:14:45 +01:00
EmperorBale
a192fbb113
chore: Remove explicit clones in avm2
2021-12-08 22:14:45 +01:00
EmperorBale
847a4fb61a
chore: Remove explicit clones in value
2021-12-08 22:14:45 +01:00
EmperorBale
1709ea94e7
chore: Remove explicit clones in object
2021-12-08 22:14:45 +01:00
EmperorBale
8ea41bc151
chore: Remove explicit clones in slot
2021-12-08 22:14:45 +01:00
EmperorBale
15378bcfde
chore: Remove explicit clones from vector
2021-12-08 22:14:45 +01:00
EmperorBale
2f71360c3b
chore: Remove explicit clones from primitive_object
2021-12-08 22:14:45 +01:00
EmperorBale
a7f86e679c
chore: Remove explicit clones from uint
2021-12-08 22:14:45 +01:00
EmperorBale
0a8b964754
chore: Remove explicit clones from number
2021-12-08 22:14:45 +01:00
EmperorBale
8f27196356
chore: Remove explicit clones in int
2021-12-08 22:14:45 +01:00
EmperorBale
a0bbc96b4a
chore: Remove explicit clones in function
2021-12-08 22:14:45 +01:00
EmperorBale
7027046588
chore: Remove explicit clones in shape
2021-12-08 22:14:45 +01:00
EmperorBale
51f909691f
chore: Remove explicit clones in movieclip
2021-12-08 22:14:45 +01:00
EmperorBale
96eb14fdab
chore: Remove explicit clones in boolean
2021-12-08 22:14:45 +01:00
EmperorBale
60fc4cd0c0
chore: Remove explicit clones in activation
2021-12-08 22:14:45 +01:00
EmperorBale
002158a1b0
chore: Remove explicit clones in array
2021-12-08 22:14:45 +01:00
EmperorBale
7fce022293
avm2: Derive Copy for Value
2021-12-08 22:14:45 +01:00
Adrian Wielgosik
685911a77c
swf: Box ShapeRecord::StyleChange variant
2021-12-08 22:14:17 +01:00
Moulins
3ff0c3d737
string: Correctly return None in `WStr::offset_in` for overlapping WStrs
2021-12-08 22:12:11 +01:00
relrelb
da4b5986b1
chore: Appease clippy
2021-12-08 22:36:55 +02:00
relrelb
5de81d4729
html: Handle attribute errors gracefully
...
`quick-xml` returns an `Err` for invalid attributes (e.g. unquoted).
Handle such errors by ignoring the HTML completely and return an
empty string instead, as Flash does.
Fix #5789 .
2021-12-05 08:40:04 +02:00
relrelb
7f7ecda8a9
core: Unify `define_bits_jpeg_3` and `define_bits_jpeg_4`
...
The only difference is the deblocking field, which is now read only
for DefineBitsJpeg4.
2021-12-04 21:32:16 +02:00
relrelb
00accf3e2a
render: Rename `register_bitmap_jpeg_3` to `register_bitmap_jpeg_3_or_4`
...
It's actually used by both DefineBitsJpeg3 and DefineBitsJpeg4 tags.
2021-12-04 21:32:16 +02:00
dependabot[bot]
963fa78f29
build(deps): bump weak-table from 0.3.0 to 0.3.2
...
Bumps [weak-table](https://github.com/tov/weak-table-rs ) from 0.3.0 to 0.3.2.
- [Release notes](https://github.com/tov/weak-table-rs/releases )
- [Changelog](https://github.com/tov/weak-table-rs/blob/main/CHANGELOG.md )
- [Commits](https://github.com/tov/weak-table-rs/compare/0.3.0...v0.3.2 )
---
updated-dependencies:
- dependency-name: weak-table
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-12-04 16:50:42 +02:00
relrelb
03aa31ec68
core: Fix a bug in `MorphShapeStatic::register_ratio`
...
The comparsion `start_change.move_to != end_change.move_to` doesn't
make sense, because even if they are identical, the positions need
to be updated.
Fix #2886 .
2021-12-04 13:46:02 +02:00
relrelb
fab4103932
chore: Appease clippy
2021-12-04 13:45:37 +02:00
David Wendt
54fcfde1cc
core: String equality should short-circuit on pointer equality
2021-12-02 16:33:56 -07:00
David Wendt
29d2df5f07
core: Hash the whole (byte-oriented) WStr without iterating it.
2021-12-02 16:33:56 -07:00
David Wendt
dbecd03110
core: When hashing `WString`, optimize for the common case (bytestrings)
2021-12-02 16:33:56 -07:00
David Wendt
9f30a9d4a6
avm2: When passing namespaces around, use a `SmallVec` of one element for memory savings.
2021-12-02 16:30:21 -07:00
David Wendt
1302ea9986
avm2: Pass everything around as `SmallVec`s.
2021-12-02 16:30:21 -07:00
David Wendt
5e03382f5d
avm2: Smallvec the property maps.
2021-12-02 16:30:21 -07:00
David Wendt
a18faeb047
avm2: Also put definition scripts in a `PropertyMap` and query them the same way we do objects
2021-12-02 16:30:21 -07:00
David Wendt
92697c9f1e
avm2: Use FNV hashing for all other parts of the VM.
2021-12-02 16:30:21 -07:00
David Wendt
3329e2a965
avm2: Use FNV hashes for property lookup.
2021-12-02 16:30:21 -07:00
David Wendt
769c45add5
avm2: Make `QName` a copy type.
2021-12-02 16:30:21 -07:00
David Wendt
d53abfebf4
avm2: Also preresolve all class traits, too.
2021-12-02 16:30:21 -07:00
David Wendt
44162ae698
avm2: Don't clone the multiname set on each lookup
2021-12-02 16:30:21 -07:00
David Wendt
3a7dd48c81
avm2: Build a flattened traits list per class and use that in lieu of a full trait lookup.
2021-12-02 16:30:21 -07:00
David Wendt
722dd6aabf
avm2: Refactor multiname resolution to take advantage of the new value storage structure.
2021-12-02 16:30:21 -07:00
David Wendt
c99231b610
avm2: Index the property map by local name and bucket all namespaces together into a single list.
2021-12-02 16:30:21 -07:00
David Wendt
0bc2ddfc7b
avm2: Remove prototype lookups from `resolve_any`
2021-12-02 16:30:21 -07:00
David Wendt
d83a7c909c
avm2: Don't scan the prototype for each multiname check.
2021-12-02 16:30:21 -07:00
Moulins
6bd3c62195
avm1: Remove unnecessary clones in shared_object::recursive_deserialize_json
2021-12-02 07:12:22 +02:00
dependabot[bot]
7d1ac9d26b
build(deps): bump syn from 1.0.81 to 1.0.82
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.81 to 1.0.82.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.81...1.0.82 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-11-29 23:04:42 +02:00
David Wendt
fa179dc63f
avm2: Unpublish a bunch of primclass methods
2021-11-28 18:40:21 -07:00
David Wendt
6d48126124
avm2: And, finally, `uint`.
2021-11-28 18:40:21 -07:00
David Wendt
640763bfda
avm2: Also do the same for `int`
2021-11-28 18:40:21 -07:00
David Wendt
593158cb04
avm2: Also allow calling `Number` methods on the prototype in the `public` namespace.
2021-11-28 18:40:21 -07:00
David Wendt
6bfca1af5f
avm2: Expose `Boolean` methods in the `public` namespace via prototypes.
2021-11-28 18:40:21 -07:00
David Wendt
3e8f13b70a
avm2: `Number.MIN_VALUE` is the machine epsilon, not the lowest possible finite value.
2021-11-28 18:40:21 -07:00
David Wendt
7569994f1f
avm2: Impl `Boolean.toString` and `Boolean.valueOf`.
2021-11-28 18:40:21 -07:00
David Wendt
aa01a682e1
avm2: Implement `uint`'s various formatting methods, too.
2021-11-28 18:40:21 -07:00
David Wendt
e43d18f7b0
avm2: Impl `int` versions of `toFixed`, `toString`, `toExponential`, and `toPrecision`
2021-11-28 18:40:21 -07:00
David Wendt
cabfe5e20c
avm2: All documented primitive class methods are in the AS3 namespace.
2021-11-28 18:40:21 -07:00
David Wendt
9e62b05157
avm2: Implement `Number.AS3::toString` and `Number.AS3::valueOf`.
...
This method has an odd flaw that we don't emulate yet. Actually, two:
1. Precision limits that are specific to the chosen radix
2. Occasional and intermittent corruption in the resulting 0 padding; usually manifesting as `x`, `W`, or `°` characters
The first could be emulated, but I've chosen not to... because the second thing listed not only isn't really possible to emulate, but actively prohibits approx-testing the results. So I'm marking the test as ignored and hoping no movies actually rely on the precision limits in `toString`.
2021-11-28 18:40:21 -07:00
David Wendt
4a09dfa3d0
avm2: Implement `Number.toFixed` and `Number.toPrecision`
2021-11-28 18:40:21 -07:00
David Wendt
55a7a1882d
avm2: Implement `Number.toExponential`
2021-11-28 18:40:21 -07:00
David Wendt
16597e0d7b
avm2: Fill out class constants for `uint`, `int`, and `Number`.
2021-11-28 18:40:21 -07:00
relrelb
2117ad8a4c
html: Ignore <p>, <li> and <br> tags in non-multiline mode
2021-11-28 22:57:48 +02:00
relrelb
9cad582e8b
html: Do not trim text in `FormatSpans::from_html`
...
Flash preserves spaces before and after text.
But since now `quick-xml` might emit empty `Text` events, those need
to be explicitly ignored in order to retain the same text format across
tags.
2021-11-28 22:57:48 +02:00
relrelb
a027d932e4
html: Use `as_ref()` instead of `clone()`
...
This should improve performance a bit.
2021-11-28 22:57:48 +02:00
Varun Ramesh
7c87f35d8d
avm2: Implement `flash.display.PixelSnapping` ( #5718 )
...
* Add flash.display.PixelSnapping enum class
* Run 'cargo format --all'
* Add 'final' class attribute
2021-11-28 07:31:39 +02:00
Moulins
9701b817f5
core: Replace WStr<'_> and WStrMut<'_> by a single DST type WStr
2021-11-27 11:20:47 -07:00
Moulins
fd8bdeb1a8
core: improve f64's FromWStr impl
...
This avoids converting the string to UTF8 if it can't possibly
be a float
2021-11-27 11:20:47 -07:00
Moulins
ee326e31b7
core: Reduce allocations in AvmString::new_utf8
...
Also remove some useless back-and-forth conversions between
AvmString and String
2021-11-27 11:20:47 -07:00
Moulins
fa30e1bc43
chore: rename AvmString::{new -> new_utf8, new_ucs2 -> new}
2021-11-27 11:20:47 -07:00
Moulins
45fe1e86ae
core: remove AvmString::as_str, and the extra UTF8 String inside
2021-11-27 11:20:47 -07:00
Moulins
e24af59197
core: remove last instances of AvmString::as_str
2021-11-27 11:20:47 -07:00
Moulins
824263d2bc
core: adapt TextField, Font & Html handling code to use WStr
2021-11-27 11:20:47 -07:00
Moulins
f149c9efce
core: remove some AvmString::as_str calls
2021-11-27 11:20:47 -07:00
Moulins
053758d77c
avm2: use WString in QName methods
2021-11-27 11:20:47 -07:00
Moulins
5ca911209b
core: implement WStr::join
2021-11-27 11:20:47 -07:00
Moulins
c496f81f13
avm1: remove AvmString::as_str usage in activation.rs and movie_clip.rs
2021-11-27 11:20:47 -07:00
Moulins
87400b829d
core: use WStrings for display object's frame and scene labels
2021-11-27 11:20:47 -07:00
Moulins
84b4e33036
core: implement FromWStr for various enum types
2021-11-27 11:20:47 -07:00
Moulins
b894d0c97f
avm1: adapt parseInt, escape & unescape to use WStr API
2021-11-27 11:20:47 -07:00
Moulins
c2349ae012
xml: use AvmString in xml code
...
This has the nice side-effect of reducing string cloning, because we can
just pass AvmStrings around instead.
2021-11-27 11:20:47 -07:00
Moulins
5db23ddbf3
avm2: use WStr in date parsing logic
2021-11-27 11:20:47 -07:00
Moulins
f49ce49d28
core: add FromWStr trait and WStr::parse
2021-11-27 11:20:47 -07:00
Moulins
8863b54db0
avm1: don't use &str for activation's path & variable logic
2021-11-27 11:20:47 -07:00
Moulins
1d9d7e6942
avm1: don't use &str methods when parsing enum parameters in MovieClip
2021-11-27 11:20:47 -07:00
Moulins
d850085d2b
avm1: partially rewrite Value::primitive_as_number
2021-11-27 11:20:47 -07:00
Moulins
4a09088d42
avm2: rewrite regexp module to not rely on AvmString::as_str
...
This is a little tricky, because we have to map the utf8 indices
returned by the regex engine to utf16 indices usable by Ruffle.
To limit the impact on performance, the regex, the string we're
currently matching on, and the last known (utf8, utf16) positions
are cached, avoiding extra utf8 conversions in common use cases
where a single string is repeatedly searched with increasing
`lastIndex`.
2021-11-27 11:20:47 -07:00
Moulins
23cbe4c2fd
core: Add `string::Pattern` trait, based on `std::str::Pattern`
...
This allows `Str::{find, rfind, split}` to accept multiple types
2021-11-27 11:20:47 -07:00
Moulins
110f568aa4
core: Remove some useless utf8<->utf16 conv. in {avm1,avm2}/activation.rs
2021-11-27 11:20:47 -07:00
Moulins
8885175550
core: Replace string::utils *_ignore_case functions by methods on WStr
2021-11-27 11:20:47 -07:00
Moulins
79d47a9863
avm1: Requires a WStr<'_> to access PropertyMap
2021-11-27 11:20:47 -07:00
Moulins
7f4af210b8
core: Reimplement AVM string methods using our UCS2 API
...
This generally means that methods are more efficient, as we
don't need to encode to UTF16 on-the-fly to have correct indices.
This also fix some bugs:
- charCode now properly handle surrogate pairs
- calling lastIndexOf with the empty pattern and an OoB index now
properly returns the string length
Still missing is AVM2's String.match
2021-11-27 11:20:47 -07:00
Moulins
32fa20b857
core: Make AvmString "two-headed" by storing a UTF8 and an UCS2 string
...
This is only temporary; once all code paths use the ruffle `WString` API
instead of dereferencing to a string, the UTF8 `String` will be removed.
2021-11-27 11:20:47 -07:00
Moulins
3d20c4acc7
core: Add owned string::WString type
2021-11-27 11:20:47 -07:00
Moulins
c1ccd3a3ac
core: Introduce `WStr` and `WStrMut` types, for representing Flash strings
...
These types represent an UCS2 string (UTF-16 with unpaired surrogates).
The string is stored either as a sequence of u8s (Bytes) or u16s (Wide);
the type of string is tracked by setting the high bit of the length of
its fat pointer.
2021-11-27 11:20:47 -07:00
relrelb
b32ec3cf6c
audio: Calculate sound transform values using 30-bit integers
...
The fix in #5218 wasn't sufficient; 30-bit arithmetic should be used
along all the way when calculating an effective sound transform.
For example, a sound transform composited by volumes `-0x80000000` and
`25` should end up as effectively 0, whereas previously it would have
been calculated as `-0x80000000 * 25 / 100 = -0x20000000`, which is a
30-bit integer that hasn't been truncated.
Fixes #5655 .
2021-11-27 12:09:33 +02:00
relrelb
e2b821e92f
chore: Replace `min` + `max` with `clamp`
...
`clamp` is a bit more efficient, in both runtime and size terms.
2021-11-26 20:54:48 +02:00
relrelb
41eb215b02
chore: Avoid using `std::char`
...
Use the `char` primitive type instead.
2021-11-26 10:45:30 +02:00
relrelb
dc6d4804ff
core: Avoid odd import
2021-11-26 10:45:30 +02:00
relrelb
0a3ede31dc
core: Remove unused `Downcast`
2021-11-26 10:45:30 +02:00
relrelb
79a0ba31ae
avm1: Use `.unwrap_or(&Value::Undefined)` in more places
2021-11-26 10:45:30 +02:00
Adrian Wielgosik
f35b2666a3
build: Use the 'union' SmallVec feature for minor memory savings
2021-11-26 00:45:09 +01:00
relrelb
79deba87f3
avm1: Small cleanup in `start_drag`
2021-11-25 07:35:33 +02:00
relrelb
a2aeadf9e1
core: Small cleanups in `Player::handle_event`
...
* Use `match` for AVM debug key combos.
* Remove redundant `if let Some(button_event)` inside an `if button_event.is_some()`.
2021-11-25 07:35:33 +02:00
relrelb
cbce91365c
desktop: Track `keys_down` by `KeyCode`
...
This makes `DesktopUiBackend::is_key_down` a simple one-line check.
Also unify the handling code of `ElementState::Pressed` and `ElementState::Released`,
which had a lot of common code.
2021-11-25 07:35:33 +02:00
Adrian Wielgosik
da4ed75bc8
avm2: Compare QNames by local name first
2021-11-22 17:59:00 -07:00
Adrian Wielgosik
c2d521df41
avm2: refactor: Merge has-setter-and-no-getter into one lookup
2021-11-22 17:59:00 -07:00
Adrian Wielgosik
370186dc3c
avm2: refactor: Make trait lookups return a single item
2021-11-22 17:59:00 -07:00
TÖRÖK Attila
0e4d2d48f5
video/vp6: Don't throw an error on skip frames, reuse the last frame instead
2021-11-22 17:08:31 +01:00
relrelb
56b5183262
avm1: Refactor and fix `BitmapData::compare`
2021-11-20 14:11:14 +02:00
bbb651
687069ba7d
avm1: Added BitmapData::compare
2021-11-20 14:11:14 +02:00
relrelb
3760e0e275
core: De-duplicate `round_to_even` function
...
Put a single implementation in `ecma_conversions.rs`.
Need to consider what to do with the similar implementation in `matrix.rs`.
2021-11-20 13:36:06 +02:00
relrelb
7c6d006862
avm2: Correct `TextFormat` properties coercion
2021-11-20 13:36:06 +02:00
relrelb
10b7c69719
avm1: Correct `TextFormat` properties coercion
2021-11-20 13:36:06 +02:00
David Wendt
068e7acc6f
avm2: Remove the need for `lazy_static`
2021-11-19 20:43:53 -07:00
David Wendt
dda8a73899
avm2: Refactor so we don't need to rebox and unbox the numbers into values.
...
Also, use an actual constant table for the ellipsises.
2021-11-19 20:43:53 -07:00
David Wendt
4665a6c210
avm2: None of `Graphics`' methods need to be `pub`.
2021-11-19 20:43:53 -07:00
David Wendt
c719e69693
avm2: Also implement `drawEllipse` using `drawRoundRect`.
2021-11-19 20:43:53 -07:00
David Wendt
ef46d780ba
avm2: Implement `Graphics.drawCircle` using `drawRoundRect`
2021-11-19 20:43:53 -07:00
David Wendt
b318eb9969
avm2: Implement `Graphics.drawRoundRect`
2021-11-19 20:43:53 -07:00
relrelb
24db13ae1e
html: Handle self-closing tags
...
"br" and "sbr" tags can appear in a self-closing form (i.e. `<br />`).
Commit 3cab464026
forgot to handle this.
2021-11-15 23:28:51 +02:00
relrelb
855bc721a8
html: Restore handling of "br" tags
...
This fully reverts commit 2119ce9
.
Seems like Flash does handle "br" tags, but ignores them under some
unknown circumstances (e.g. setting `htmlText` in AVM1).
For now handle "br" tags unconditionally.
2021-11-15 23:28:51 +02:00
relrelb
73f5982cad
avm1: Fix `Sound.setVolume()` and `Sound.setPan()` with no arguments
...
Instead of coercing `undefined` into `f64` (which results `NaN` in SWF7+),
treat the missing value argument as `0`.
2021-11-14 20:25:45 +02:00
relrelb
df514f319a
html: Restore handling of "sbr" tags
...
This partially reverts commit 2119ce9821
,
only restoring "sbr" tags handling because Flash seems to ignore only
"br" tags.
2021-11-13 12:11:48 +02:00
relrelb
2119ce9821
html: Remove handling of "br" and "sbr" tags
...
Seems like Flash just ignores them.
2021-11-13 10:21:41 +02:00
relrelb
12e8d3a82f
html: Fix typo
2021-11-13 10:21:41 +02:00
David Wendt
c0874f445d
avm2: Functions are functions.
2021-11-11 17:12:49 -07:00
David Wendt
7dd9776d40
avm2: Implement `uint`, `Number`, and `Boolean`'s constructors, too.
2021-11-11 16:34:11 -07:00
David Wendt
7cc7f0fe7f
avm2: Impl `int`'s instance initializer.
2021-11-11 16:34:11 -07:00
David Wendt
be3e126ebb
avm2: Stub the `Sprite` constructor as just creating a `MovieClip`.
2021-11-11 16:33:33 -07:00
Tal Hayon
7ed38850fd
core: implement displayState for Stage in avm1/2
2021-11-11 16:20:05 -07:00
relrelb
7b95441874
core: Re-use `EditText::html_text` in `EditText::propagate_text_binding`
2021-11-11 08:05:33 +02:00
relrelb
cf05137c1f
core: `EditText::html_text` cannot fail
2021-11-11 08:05:33 +02:00
relrelb
848b721165
xml: Remove `XmlNode::walk`
2021-11-11 08:05:33 +02:00
relrelb
c4729d733c
core: Avoid one usage of `FormatSpans::replace_text`
...
Use `FormatSpans::from_text` instead.
2021-11-11 08:05:33 +02:00
relrelb
3cab464026
core: Use `quick-xml` directly when creating `FormatSpans`
2021-11-11 08:05:33 +02:00
relrelb
8c64951b15
core: Remove unused `EditText::document`
2021-11-11 08:05:33 +02:00
relrelb
a900aae63e
core: Make `EditText::set_html_text` accept a `&str`
2021-11-11 08:05:33 +02:00
relrelb
0787662079
core: Make `EditText::set_text` accept a `&str`
2021-11-11 08:05:33 +02:00
David Wendt
67e7526517
avm2: `EventDispatcher` contains an undocumented `toString` method.
2021-11-10 18:16:26 -07:00
David Wendt
360ae1f044
avm2: Private classes in different scripts are allowed to share the same name without conflicting.
2021-11-10 17:43:02 -07:00
David Wendt
60eb88b326
avm2: Note currently incorrect behavior intended to be fixed in a future PR.
2021-11-09 17:28:33 -07:00
David Wendt
4cfa3253d5
avm2: Impl `Proxy`'s enumeration-related methods.
2021-11-09 17:28:33 -07:00
David Wendt
4289f89350
avm2: Split out enumerant values into a separate method as well.
2021-11-09 17:28:33 -07:00
David Wendt
297526269c
avm2: Allow objects to assign arbitrary enumerant indexes, by having objects drive the enumeration process rather than just counting from one
2021-11-09 17:28:33 -07:00
David Wendt
1170385c3b
avm2: Implement `Proxy.hasproperty`
2021-11-09 17:28:33 -07:00
David Wendt
427b2bf17a
avm2: Implement `Proxy.deleteproperty`
2021-11-09 17:28:33 -07:00
David Wendt
503dc08594
avm2: Refactor `Object.delete_property` to work similar to get/set
2021-11-09 17:28:33 -07:00
David Wendt
e67ca1afe0
avm2: Implement `Proxy.callproperty`
2021-11-09 17:28:33 -07:00
David Wendt
301fd1020f
avm2: Implement `Proxy.setproperty`
2021-11-09 17:28:33 -07:00
David Wendt
8f47f494e7
avm2: Implement `Proxy`'s `getproperty` behavior.
2021-11-09 17:28:33 -07:00
David Wendt
f05e92c974
avm2: Fix `RTQNameL`'s parameters being popped backwards
2021-11-09 17:28:33 -07:00
David Wendt
d225d03043
avm2: Implement `flash.utils.Proxy`
2021-11-09 17:28:33 -07:00
David Wendt
51af0f708f
core: Remove commented-out helper methods.
2021-11-09 16:48:29 -07:00
David Wendt
c78e5e31fd
core: Store `DisplayObjectBase` in `InteractiveObjectBase`.
...
This also necessitated removing the `impl_display_object` family of macros, as you cannot name a field of a field in a macro expression. I tried. So instead I've reverted to standard default method inheritance, in the same way we did with AVM2 objects.
2021-11-09 16:48:29 -07:00
David Wendt
2ea35dcbb1
avm2: Enforce the `mouseEnabled` flag.
2021-11-09 16:48:29 -07:00
David Wendt
b2e0586252
docs: Document the current event-handling flow in `Player`.
2021-11-09 16:48:29 -07:00
David Wendt
bb8ca8f136
core: Move `handle_clip_event` to `TInteractiveObject`, and split it into three pieces.
...
`handle_clip_event` is now a default trait method that calls three methods in order:
* `filter_clip_event`, to determine which events that either this object or it's children may handle
* `propagate_to_children`, to check if any children of this object want to handle an event. (This also includes AVM2 button states, which are not technically "children" in the usual sense...)
* `event_dispatch`, which does the actual "object reacts to an event" bit if no child handles the object.
These roughly correspond to phases of existing event-handling objects pre-`InteractiveObject`.
2021-11-09 16:48:29 -07:00
David Wendt
95f105aadd
core: `Stage`, `EditText`, and `Avm2Button` should also be interactive objects.
2021-11-09 16:48:29 -07:00
David Wendt
e71c749db5
avm2: Implement accessors for new `InteractiveObject` flags.
2021-11-09 16:48:29 -07:00
David Wendt
618c32f859
core: Add `InteractiveObject` trait for objects that can receive input events
2021-11-09 16:48:29 -07:00
relrelb
89718475df
avm2: Introduce `TextFormatObject`
2021-11-09 16:21:35 -07:00
relrelb
9308513ae8
chore: Appease clippy
2021-11-06 10:44:01 +02:00
David Wendt
6c7d10e4d4
avm2: Requests for instance traits instead resolve to an associated public-namespace method
2021-11-02 16:54:38 -06:00
dependabot[bot]
0ef702d415
build(deps): bump syn from 1.0.80 to 1.0.81
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.80 to 1.0.81.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.80...1.0.81 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-11-02 07:02:06 +02:00
Mike Welsh
c6e6de4a47
core: Unclosed fills in Drawing API should auto-close
2021-10-31 19:01:55 -07:00
Mike Welsh
8cf0f9b7b1
avm1: duplicateMovieClip copies drawings ( fix #5487 )
...
duplicateMovieClip also clones the drawing API state of the clip,
including in-progress drawing and style info.
Fixes #5487 .
2021-10-31 19:01:55 -07:00
Mike Welsh
0e4b0f7c62
avm1: Allow duplicateMovieClip on dynamically created clips
...
Previously duplicating a clip created with `createEmptyMovieClip`
would fail.
2021-10-31 19:01:55 -07:00
David Wendt
b0b1c79143
avm2: Split the `slot_id` and `disp_id` accessors.
2021-10-31 00:52:58 -07:00
David Wendt
0cc55df5ca
avm2: Remove `FINAL` flag and associated machinery as we now validate traits at class construction time.
2021-10-31 00:52:58 -07:00
David Wendt
a1be42abfb
avm2: Exempt system classes from class validation.
2021-10-31 00:52:58 -07:00
David Wendt
dd4717e08e
avm2: Move `final`/`override` check enforcement to class construction time.
...
This is an O(n^2) algorithm, which sucks, but at least it only runs once per class rather than per *object allocation*.
2021-10-31 00:52:58 -07:00
David Wendt
8d40e41ee1
avm2: Make `Executable` zero-alloc
2021-10-31 00:52:58 -07:00
David Wendt
cea3997396
avm2: Remove `superclass_object` and related parameters from `TObject.call` and other downstream functions.
...
Turns out there's a *lot* of downstream functions.
2021-10-31 00:52:58 -07:00
David Wendt
272b1784b8
avm2: Don't skip method binding in `callproperty` if the method requires `arguments`, as it may access `callee`.
2021-10-31 00:52:58 -07:00
David Wendt
1b5869e15a
avm2: Preserve ability to `callmethod` on slot IDs that have not yet been bound, by binding them at that time.
2021-10-31 00:52:58 -07:00
David Wendt
d0d19bcf38
avm2: Stop instantiating methods at object construction time.
2021-10-31 00:52:58 -07:00
David Wendt
bfbd2271b0
avm2: Allow uninstantiated methods to be created on-the-fly.
2021-10-31 00:52:58 -07:00
David Wendt
3562c50dee
avm2: `call_property` on classes should also call unbound methods
2021-10-31 00:52:58 -07:00
David Wendt
477add3dd0
avm2: Add `ClassObject` methods for pulling unbound methods or bound method objects from the class or instance.
2021-10-31 00:52:58 -07:00
David Wendt
9c031070b3
avm2: `ClassObject` should include class traits in `TObject` methods that reference the current object's traits.
2021-10-31 00:52:58 -07:00
David Wendt
74fb965301
avm2: Call methods directly if we can find a class with an instance trait matching it's name.
2021-10-31 00:52:58 -07:00
David Wendt
039777c41e
avm2: `Object.hasOwnProperty`, `propertyIsEnumerable`, and `setPropertyIsEnumerable` only work with public-NS properties.
2021-10-30 11:44:29 -06:00
relrelb
9aed0e7db4
core: Reset `TextFormat.color` alpha
...
Since `TextFormat.color` should preserve the alpha value, and the AVM1
getter/setter no longer reset it, we need to reset it in other places:
* `TextField.textColor` setter.
* `EditText` SWF tag handling.
* HTML parsing.
And to set it explicitly to 255 in `LayoutBox::as_renderable_text`.
2021-10-30 10:03:36 -07:00
relrelb
34d1fa5226
avm1: Introduce `TextFormatObject`
...
`TextFormat` objects differ from regular objects in that
`TextField.setTextFormat` and `TextField.setNewTextFormat` accept
only the former, and ignore the latter.
Also, `TextFormat.prototype` has native accessors that coerce the
values on get/set.
2021-10-30 10:03:36 -07:00
Mike Welsh
bc801b2b32
avm1: GotoFrame2 after bogus SetTarget affects _root
...
For example, `tellTarget("bogus!!!") { var n = 2; gotoAndPlay(n); }`
should cause the _root clip to go to frame 2.
Fixes the character freezing in Steppenwolf 3-1 mentioned in #4585 .
2021-10-28 10:18:18 -07:00
Mike Welsh
2e3154baa0
avm1: tellTarget should fail if base clip is removed
...
`tellTarget` to other clips should fail if the current base clip
has been removed. All properties of the clip return `undefined`
at this point, so traversing the target path should fail.
Fixes soft-lock in Steppenwolf 2-1 as mentioned in #4452 .
2021-10-28 10:18:18 -07:00
EmperorBale
5ac8e75239
avm2: Make ObjectEncoding C-like
2021-10-25 16:32:55 -07:00
EmperorBale
bab74f83fc
avm2: Remove all unsafe from bytearray
2021-10-25 16:32:55 -07:00
EmperorBale
9126c9297c
avm2: Derive PartialEq and Eq for enums
2021-10-25 16:32:55 -07:00
EmperorBale
69f2002d2a
avm2: Add todo comment
2021-10-25 16:32:55 -07:00
EmperorBale
da601a4984
chore: Improve safety comments
2021-10-25 16:32:55 -07:00
EmperorBale
3b2a84ef9b
chore: Small cleanups
2021-10-25 16:32:55 -07:00
EmperorBale
b257e5537c
chore: Appease clippy
2021-10-25 16:32:55 -07:00
EmperorBale
42fe351c0d
avm2: Optimize readBytes & writeBytes by implementing write_at_within
2021-10-25 16:32:55 -07:00
EmperorBale
e86bdfdc3e
avm2: Remove unneeded condition
2021-10-25 16:32:55 -07:00
EmperorBale
3f3e600820
chore: Appease clippy
2021-10-25 16:32:55 -07:00
EmperorBale
83005a7ce5
avm2: Update flash-lso version
2021-10-25 16:32:55 -07:00
EmperorBale
efb3062d98
avm2: Add flash.net.ObjectEncoding
2021-10-25 16:32:55 -07:00
EmperorBale
e5fc2c8e66
avm1: Update SharedObject
2021-10-25 16:32:55 -07:00
EmperorBale
e2c2ac8961
avm2: Implement ByteArray.readObject + flash.net.ObjectEncoding
2021-10-25 16:32:55 -07:00
EmperorBale
c191340972
avm2: Refactor readBytes & writeBytes
2021-10-25 16:32:55 -07:00
EmperorBale
67ffc7bcc8
avm2: Forward get_enumerant_name and property_is_enumerable to base when not found
2021-10-25 13:45:29 -07:00
Mike Welsh
25c56b7000
chore: Appease clippy
2021-10-24 15:59:59 -07:00
Mike Welsh
8ae8de4d51
chore: Appease clippy
...
Squelch some false positives from `question_mark` and
`match_str_case_mismatch` lints.
2021-10-24 15:33:09 -07:00
relrelb
1fec012053
avm1: Inline `Value::call`
...
It was used only in `CallableValue`, and is not very useful by itself,
as it's a tiny wrapper around `TObject::call`.
2021-10-23 10:51:21 -07:00
relrelb
e6181dfcce
Revert "avm1: Don't warn in case a method doesn't exist"
...
This reverts commit 54d417c539
,
because it no longer necessary as the warning was removed in the
previous commit.
2021-10-23 10:51:21 -07:00
relrelb
982a83ce24
avm1: Remove `base_proto` parameter of `TObject::call`
...
Use prototype depths instead. Most calls passed `base_proto = None`,
which is equivalent to `depth = 0`, and is now the default.
The few other cases were adapted to use `Executable::exec` directly,
where `depth` can be specified manually.
2021-10-23 10:51:21 -07:00
relrelb
09f72b880d
avm1: Avoid unnecessary calls to `search_prototype`
...
The signature of `search_prototype` is going to change in a following
commit.
Use `TObject::call_method` instead.
2021-10-23 10:51:21 -07:00
relrelb
d0763607e2
avm1: Remove `base_proto` parameter of `TObject::set_local`
...
The only usage of it was `ScriptObject::set_local`, where it can
be computed locally.
2021-10-23 10:51:21 -07:00
relrelb
0a66dac280
avm1: Remove `set` specialization from `impl_custom_object!`
...
`base_proto` is going to be eliminated in a following commit, so
there will no longer be a difference between the two `set_local`
variants.
2021-10-23 10:51:21 -07:00
Mike Welsh
3fc0209e03
chore: Appease clippy
2021-10-22 22:48:26 -07:00
David Wendt
5abb11482e
avm2: Make builtin class prototypes also instances of `Object`, with the sole exception of `Function`, whose prototype is an instance of it's class.
2021-10-22 20:12:48 -07:00
David Wendt
469f8cb9db
avm2: All prototypes are instances of `Object`, not their own class.
2021-10-22 20:12:48 -07:00
Adrian Wielgosik
c1850d0d54
avm2: Stub flash.net.SharedObject
...
Just enough for the following to not crash:
```
var so = SharedObject.getLocal("name");
so.data.stuff = "xyz";
so.flush();
trace(so.data.stuff);
```
2021-10-22 10:02:35 -07:00
Mike Welsh
11ae981890
audio: Fix skipping initial frame of MP3 audio
...
The changes in #5498 caused the samples from the initial MP3 frame
to be skipped. This was noticable in:
https://www.newgrounds.com/portal/view/1
This change properly removes the redundant `num_samples` variable
and considers the samples from the initial MP3 frame.
2021-10-21 10:25:47 -07:00
Adrian Wielgosik
969fab7619
refactor: Stop manually borrowing fields in mutate_with_update_context
2021-10-21 10:24:05 -07:00
Adrian Wielgosik
8cc00f32bb
chore: Stop using traits available in prelude
2021-10-21 10:24:05 -07:00
Adrian Wielgosik
bc82a4f705
build: Bump Rust edition to 2021
2021-10-21 10:24:05 -07:00
EmperorBale
70cbd13201
avm2: Global scope should be null instead of undefined by default
2021-10-19 18:39:41 -06:00
EmperorBale
903246d5af
chore: Appease clippy
2021-10-19 18:39:41 -06:00
EmperorBale
ab3ff34944
avm2: Derive Collect for NativeExecutable
2021-10-19 18:39:41 -06:00
EmperorBale
2a84b0cbbb
avm2: Instance traits and class traits should use seperate scopechains
2021-10-19 18:39:41 -06:00
EmperorBale
77bf5973a7
chore: Appease clippy
2021-10-19 18:39:41 -06:00
EmperorBale
1dd899a76f
avm2: Allow small mutations to ScopeChain
2021-10-19 18:39:41 -06:00
EmperorBale
9de7d7ba7a
chore: Add todo comment for callstatic
2021-10-19 18:39:41 -06:00
EmperorBale
a19488c048
chore: Cleanup comments
2021-10-19 18:39:41 -06:00
EmperorBale
d71188e80c
avm2: Change code_context to caller_domain
2021-10-19 18:39:41 -06:00
EmperorBale
4667921259
avm2: Push global scope when property is not found
2021-10-19 18:39:41 -06:00
EmperorBale
7e251cfe05
avm2: Add support for pushwith
2021-10-19 18:39:41 -06:00
EmperorBale
388fdbd513
avm2: Scope redesign
...
avm2: Update scopechain design
2021-10-19 18:39:41 -06:00
dependabot[bot]
5cab790bd7
build(deps): bump encoding_rs from 0.8.28 to 0.8.29
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.28 to 0.8.29.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.28...v0.8.29 )
---
updated-dependencies:
- dependency-name: encoding_rs
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 14:01:23 -07:00
dependabot[bot]
ca32fe9b90
build(deps): bump gif from 0.11.2 to 0.11.3
...
Bumps [gif](https://github.com/image-rs/image-gif ) from 0.11.2 to 0.11.3.
- [Release notes](https://github.com/image-rs/image-gif/releases )
- [Changelog](https://github.com/image-rs/image-gif/blob/master/Changes.md )
- [Commits](https://github.com/image-rs/image-gif/compare/v0.11.2...v0.11.3 )
---
updated-dependencies:
- dependency-name: gif
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 13:43:37 -07:00
Mike Welsh
7745c9137f
audio: Grab MP3 sample rate directly from MP3 data
...
MP3 data in an SWF can be of a different sample rate than
indicated in the SWF tag, so grab the sample rate from the MP3
decoder instead of passing it in from the SWF tag.
Also, a general clean up of the MP3 decoders.
Fixes #335 .
2021-10-17 20:34:15 -07:00
Mike Welsh
3dfa5ade18
audio: Ask decoder for sound sample rate
...
Don't rely on the sample rate in the SWF tags, as this could differ
from the actual sample rate of the audio (see #335 ).
2021-10-17 20:34:15 -07:00
Mike Welsh
60f5dc2477
avm2: Implement SoundChannel.position
...
Fix various issues with `SoundChannel`:
* Change `avm2::Object::as_sound_instance` to `as_sound_channel`.
* Cache sound position in `SoundChannelObject`.
* `SoundInfo::in_sample` is in units of 44100Hz.
* Clamp `num_loops` to 1.
2021-10-16 22:53:25 -07:00
Mike Welsh
6034b4a3af
avm1: Sound.position and duration are not version-gated
...
Even though they were added in SWFv6, they will be available when
playing a v5 SWF in Flash Player 6 and higher.
See #340 for an example in the wild.
2021-10-16 22:53:25 -07:00
Mike Welsh
105c889f5f
desktop: Implement AudioBackend::get_sound_position
2021-10-16 22:53:25 -07:00
Mike Welsh
bca31b2c51
audio: Grab Sound.position from audio backend
...
* Change `AudioBackend::get_sound_position` to return `f64` to
match `AudioBackend::get_sound_duration`.
* Wire up `AudioBackend::get_sound_position` to `Sound.position`.
* Remove unimplmeneted warning from `Sound.position`.
2021-10-16 22:53:25 -07:00
relrelb
e9efc2841b
avm1: Store depth in `SuperObject`
...
This is a temporary hack to calculate depth from `base_proto` and
`this`, so that changing `this.__proto__` will affect `super`.
In the future, `depth` should be passed instead of `base_proto`.
2021-10-16 11:14:38 -07:00
relrelb
299b7a778c
avm1: Correct `base_proto` for method calls
...
In case the method is found directly on `this` (normally it shouldn't
because it's usually defined on `this.__proto__`), it seems like the
`super` object behaves identically as-if the method was found on
the object's prototype.
2021-10-16 11:14:38 -07:00
relrelb
7008f9bacc
avm1: Correct `base_proto` for constructions
...
Previously constructions had `base_proto` set to the newly-created
object (`this`). However this doesn't match the `base_proto` of method
calls, which is `this.__proto__` (or more precisely where the function
is found on the prototype chain). This caused wrong behavior when using
the `super` object from within constructors.
Change `base_proto` in that case to be `this.__proto__`, which aligns
with method calls.
In order to keep things working, `SuperObject::call` needs to look-up
one level less than before.
An alternative can be changing `base_proto` for method calls instead,
but that seems to be harder because this would require `search_prototype`
to return the before-last visited object in the prototype chain.
2021-10-16 11:14:38 -07:00
relrelb
1772def6e6
avm1: Fix `SuperObject::get_local_stored`
...
It should return `None` in order to continue further walking on the
prototype chain.
2021-10-16 11:14:38 -07:00
Chris Midgley
c5ad8e76ee
audio: Fail to create invalid ADPCM decoder
2021-10-13 23:12:32 -07:00
Mike Welsh
219d3af284
avm1: Function base clip defaults to `this` if clip no longer exists
...
When a function is defined, the base clip is stored in the function
object, and used when the function is called in SWFv6+. This
affects the target clip for GotoFrame and other actions.
However, if that base clip no longer exists when the function is
called, the base clip should default to the `this` display object.
Previously Ruffle would still use the previously unloaded base clip.
2021-10-12 17:23:01 -07:00
relrelb
c0021204c6
Revert "core: Fix clip depth handling in `MovieClip::mouse_pick`"
...
This reverts commit 37e3f0903e
.
2021-10-12 22:42:11 +03:00
dependabot[bot]
72e50bd3c6
build(deps): bump quote from 1.0.9 to 1.0.10
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.9 to 1.0.10.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.9...1.0.10 )
---
updated-dependencies:
- dependency-name: quote
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-11 17:14:42 -07:00
dependabot[bot]
ce70dbb52e
build(deps): bump png from 0.17.1 to 0.17.2
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.17.1 to 0.17.2.
- [Release notes](https://github.com/image-rs/image-png/releases )
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md )
- [Commits](https://github.com/image-rs/image-png/commits )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-11 15:30:20 -07:00
dependabot[bot]
fd64530288
build(deps): bump syn from 1.0.78 to 1.0.80
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.78 to 1.0.80.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.78...1.0.80 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-11 15:29:29 -07:00
relrelb
37e3f0903e
core: Fix clip depth handling in `MovieClip::mouse_pick`
2021-10-10 18:51:59 -07:00
Mike Welsh
0786350a6f
avm2: Defer self-gotos to end of frame script execution
...
If a movieclip calls a seek operation like `gotoAndStop` on
itself while executing a frame script, this goto is not executed
until the frame script has completed. In contrast, calling a goto
on other clips will execute the goto immediately.
2021-10-10 18:27:30 -07:00
Mike Welsh
57be2397ef
avm2: Initialize slots to appropriate values when no default given
...
Slots and const traits should initialize to an appropriate value
for their type if no default is specified. Remove the `Option`
from `default_value`, and always set it to an appropriate null-ish
value (`0` for ints, `NaN` for `Number`, `null` for objects, etc.)
2021-10-10 14:01:36 -07:00
EmperorBale
34ecb32b85
avm2: Add custom implementations for get_enumerant_name and property_is_enumerable for VectorObject
2021-10-10 11:02:42 -07:00
EmperorBale
6eea0f2067
avm2: Add custom get_enumerant_name & property_is_enumerable implementations for ArrayObject
2021-10-10 11:02:42 -07:00
Chris Midgley
2dfaa33282
chore: fmt
2021-10-09 10:10:03 -07:00
Chris Midgley
c9e67d31dc
core: move avm_type from display object to update context
2021-10-09 10:10:03 -07:00
relrelb
54df49f96e
core: Random SWF-related cleanups
2021-10-08 13:22:45 -07:00
relrelb
4fcf0907ac
core: Remove `SwfSlice` usage from `MovieClip::new`
2021-10-08 13:22:45 -07:00
relrelb
b8152f431e
core: Use `SwfSlice::read_from`
2021-10-08 13:22:45 -07:00
Moulins
4ad6e1e698
avm1: Propagate AvmString<'gc>s to all methods on Object
...
Some frequently-used Object methods have an Into<impl AvmString<'gc>>
parameter to reduce the size of the changes.
2021-10-06 19:47:35 -06:00
Moulins
9aa601d43b
core: Store AvmString<'gc>s in avm1::PropertyMap
2021-10-06 19:47:35 -06:00
TÖRÖK Attila
525dfcba05
chore: Bump h263-rs and h263-rs-yuv git refs
2021-10-05 10:58:46 -07:00
TÖRÖK Attila
3869950578
video/vp6: Add VP6[A] video decoding support
...
Gated behind the "vp6" feature, enabled by default.
Utilizing a heavily stripped-down version of the NihAV project,
retaining only the VP6 decoder, relicensed under MIT.
Including VP6WithAlpha decoding, proper FrameDependency reporting,
and cropping the unwanted encoded pixels on the right/bottom manually.
2021-10-04 22:33:06 -07:00
dependabot[bot]
006275632c
build(deps): bump syn from 1.0.77 to 1.0.78
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.77 to 1.0.78.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.77...1.0.78 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-04 15:01:47 -07:00
dependabot[bot]
3d754a5d7d
build(deps): bump smallvec from 1.6.1 to 1.7.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.6.1...v1.7.0 )
---
updated-dependencies:
- dependency-name: smallvec
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-04 15:01:36 -07:00
David Wendt
ee9341cb1c
avm2: Remove `is_boxed_primitive`, as we are no longer accepting boxed primitives on the stack.
2021-10-03 15:57:43 -07:00
David Wendt
71c953b6ac
avm2: Automatically unbox any boxed primitives that happen to make their way onto the stack.
...
This particular occurance is unlikely in practice, but could become far more common as more primitive constructors are implemented.
2021-10-03 15:57:43 -07:00
relrelb
d49ea10267
swf: Rename `TryBlock` fields
...
* `try_actions` -> `try_body`
* `catch` -> `catch_body`
* `finally` -> `finally_body`
This aligns with the names used in SWF19, and is more consistent.
2021-10-02 23:01:32 +03:00
relrelb
81c864c6c8
avm1: Propagate exceptions in `Key.isDown`
...
Also change `coerce_to_f64` to `coerce_to_i32`.
2021-10-02 23:01:32 +03:00
relrelb
0a30057a63
avm1: Use enum constants instead of hard-coded numbers
2021-10-02 23:01:32 +03:00
TÖRÖK Attila
a1ee508ff8
chore: Fix nightly clippy lint: clippy::if_then_panic ( #5400 )
...
* chore: Fix nightly clippy lint: clippy::if_then_panic
* chore: Fix nightly clippy lint: clippy::if_then_panic in swf tests too
* Address review notes
2021-10-02 16:14:53 +03:00
David Wendt
f2e7457bc0
avm2: Move `QNameObject` specific methods behind an `as_qname_object` downcast.
2021-10-01 16:30:58 -06:00
David Wendt
aaca3460d4
avm2: `QName` overrides `toString` and `valueOf` in both namespaces
2021-10-01 16:30:58 -06:00
David Wendt
513965b624
avm2: `Function.call` and `Function.apply` need to be accessible in the public namespace.
...
We should be able to move the AS3 versions to traits, but that breaks two other tests.
2021-10-01 16:30:58 -06:00
David Wendt
273872e2ab
avm2: `Any` namespaces are represented as `*` in `QName`'s string form
2021-10-01 16:30:58 -06:00
David Wendt
294b0fc53e
avm2: Impl `QName`'s constructor and properties
2021-10-01 16:30:58 -06:00
David Wendt
5387b1a4e0
avm2: Add stub boxed `QName` object type and class
2021-10-01 16:30:58 -06:00
relrelb
05d8f13b26
audio: ADPCM small cleanup
2021-09-30 20:16:04 +03:00
relrelb
b9307af78f
audio: Move ADPCM's tables out of `AdpcmDecoder`
2021-09-30 20:16:04 +03:00
relrelb
50ec497c60
audio: Introduce `AdpcmDecoder::channels`
...
This reduces duplicated code.
2021-09-30 20:16:04 +03:00
relrelb
4deaaed75c
audio: Inline `AdpcmDecoder::next_sample`
2021-09-30 20:16:04 +03:00
relrelb
99827caf2b
audio: Localize `AdpcmDecoder::{left,right}_step`
...
Since they were used only in a single scope.
2021-09-30 20:16:04 +03:00
dependabot[bot]
8c123c10af
build(deps): bump syn from 1.0.76 to 1.0.77
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.76 to 1.0.77.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.76...1.0.77 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-09-28 01:27:10 +03:00
dependabot[bot]
5fe0994a3a
build(deps): bump symphonia from 0.3.0 to 0.4.0
...
Bumps [symphonia](https://github.com/pdeljanov/Symphonia ) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/pdeljanov/Symphonia/releases )
- [Commits](https://github.com/pdeljanov/Symphonia/compare/v0.3.0...v0.4.0 )
---
updated-dependencies:
- dependency-name: symphonia
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-09-28 01:26:57 +03:00
Adrian Wielgosik
5ce2266be7
chore: clippy
2021-09-27 11:03:48 +02:00
Adrian Wielgosik
87625fa302
avm2: Change core types from Object to ClassObject where possible
2021-09-27 11:03:48 +02:00
Adrian Wielgosik
83b7420a3f
avm2: Remove unneeded indirection from ClassObject methods
2021-09-27 11:03:48 +02:00
David Wendt
6753608e78
chore: Fix incorrect doccomment
2021-09-25 16:54:36 -06:00
David Wendt
c299f63784
avm2: Implement object space enumeration.
...
This required making enumerants into `Value`s, rather than `QName`s.
2021-09-25 16:54:36 -06:00
David Wendt
dbe9dffe0e
avm2: Implement object-space overrides for `getproperty`, `setproperty`, `deleteproperty`, and `in`.
2021-09-25 16:54:36 -06:00
David Wendt
925604f730
avm2: Implement `DictionaryObject` and `Dictionary`
2021-09-25 16:54:36 -06:00
EmperorBale
28b34cbe25
chore: Typo
2021-09-23 23:14:30 -06:00
EmperorBale
3f81910bb6
avm2: Remove custom_object macros
2021-09-23 23:14:30 -06:00
relrelb
54d417c539
avm1: Don't warn in case a method doesn't exist
2021-09-23 18:55:49 -06:00
David Wendt
f298a23ec8
avm2: Ensure all bare function calls pull an appropriate `superclass_object`
2021-09-23 15:59:06 -06:00
David Wendt
7ef7b80395
avm2: Prototypes are not instances of their class
2021-09-23 15:59:06 -06:00
David Wendt
b8c086eb7a
avm2: Calls to object properties should use the new `call_property` method
2021-09-23 15:59:06 -06:00
David Wendt
7cefeb2b2a
avm2: Add a `constructprop` method for objects, too.
2021-09-23 15:59:06 -06:00
David Wendt
b07ad8070c
avm2: Make `get_property`, `set_property`, `init_property`, and various other derivative methods take a `Multiname` and run the search inside `Object`.
...
This also introduces a `call_property` method.
2021-09-23 15:59:06 -06:00
David Wendt
945cb2c4bf
avm2: Global class inheritance issues should report which class cannot be found
2021-09-23 15:59:06 -06:00
David Wendt
8f8134e4f4
avm2: Add private instance slots for `FrameLabel`'s properties
2021-09-23 15:59:06 -06:00
David Wendt
5ba2421225
avm2: Add private instance slots for `Scene`'s properties
2021-09-23 15:59:06 -06:00
David Wendt
97924d20ad
avm2: Add private instance slots for `Point`'s properties
2021-09-23 15:59:06 -06:00
David Wendt
dfc90984dc
avm2: Add private instance slots for `Rectangle`'s properties
2021-09-23 15:59:06 -06:00
David Wendt
81da1aad4b
avm2: `Video` is not a subclass of `flash.media.DisplayObject` (which doesn't exist)
2021-09-23 15:59:06 -06:00
EmperorBale
1874223224
avm2: Remove ignore_next
2021-09-23 00:01:50 +02:00
EmperorBale
31abe5d9d7
avm2: Specify that date should coerce to string by default
2021-09-23 00:01:50 +02:00
EmperorBale
64eb47a65c
avm2: Remove YearType
2021-09-23 00:01:50 +02:00
EmperorBale
bd6ca72510
avm2: Implement Date.parse
2021-09-23 00:01:50 +02:00
EmperorBale
10be7ef3bf
avm2: Implement toUTCString
2021-09-23 00:01:50 +02:00
EmperorBale
292a9bda4b
avm2: Implement toLocaleString, toLocaleTimeString, toDateString, toLocaleDateString
2021-09-23 00:01:50 +02:00
EmperorBale
b9fd7f5977
avm2: Implement toString, toTimeString
2021-09-23 00:01:50 +02:00
EmperorBale
931080cd49
avm2: Implement valueOf
2021-09-23 00:01:50 +02:00
EmperorBale
aca23b744e
chore: Appease clippy
2021-09-23 00:01:50 +02:00
EmperorBale
7f8e01b426
avm2: Implement UTC
2021-09-23 00:01:50 +02:00
EmperorBale
453486265f
avm2: Implement timezoneOffset
2021-09-23 00:01:50 +02:00
EmperorBale
0732efc9d9
avm2: Impement day, dayUTC
2021-09-23 00:01:50 +02:00
EmperorBale
fe584f7508
chore: Fix typos
2021-09-23 00:01:50 +02:00
EmperorBale
97da4d1b7b
avm2: Implement UTC variants
2021-09-23 00:01:50 +02:00
EmperorBale
0dc0bc9694
avm2: Implement month, fullYear
2021-09-23 00:01:50 +02:00
EmperorBale
273ae48654
avm2: Refactor date implementation
2021-09-23 00:01:50 +02:00
EmperorBale
6ab0d89040
avm2: Implement minutes, hours, date
2021-09-23 00:01:50 +02:00
EmperorBale
d5621c1ce7
avm2: Implement time, seconds, milliseconds
2021-09-23 00:01:50 +02:00
EmperorBale
32eb9d1579
avm2: Implement Dates instance initializer
2021-09-23 00:01:50 +02:00
EmperorBale
db550b035c
avm2: Add Date stub
2021-09-23 00:01:50 +02:00
relrelb
3463e50a72
avm1: Avoid `impl Into<Value<'gc>>` parameter in `Avm1::push`
...
This might create templatized functions leading to unnecessary code bloat.
So instead use just `Value<'gc>` parameters and add `.into()` in callers
where needed.
2021-09-22 23:13:13 +02:00
kmeisthax
42275f43f3
avm2: Properly make all classes an instance of `Class`. ( #57 )
...
* avm2: Properly make all classes an instance of `Class`.
Also, does this technically mean that `Class` is a metaclass?
* avm2: Remove `Function::from_method_and_proto` as it will no longer be needed
* avm2: Ensure builtin classes are also instances of `Class`.
This requires tying a veritable gordian knot of classes; everything needs to be allocated up-front, linked together, and then properly initialized later on. This necessitated splitting the whole class construction process up into three steps:
1. Allocation via `from_class_partial`, which does everything that can be done without any other classes
2. Weaving via `link_prototype` and `link_type`, which links all of the allocated parts together correctly. This also includes initializing `SystemClasses` and `SystemPrototypes`.
3. Initialization via `into_finished_class`, which must be done *after* the weave has finished.
Once complete you have core classes that are all instances of `Class`, along with prototypes that have their usual legacy quirks.
Note that this does *not* make prototypes instances of their class. We do need to do that, but doing so breaks ES3 legacy support. This is because we currently only work with bound methods, but need to be able to call unbound methods in `callproperty`.
* tests: Add a test for all core classes' instance-of relationships
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
f8c32d3a68
avm2: Fix get_own_class_definition users to use either instance_of or as_.
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
71e41e2c92
chore: cargo fmt
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
22482ed080
avm2: Remove unwrap in get_own_class_definition
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
7736818069
avm2: Rename as_class -> get_own_class_definition
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
26e60fa8ea
avm2: Rename as_class_object_really -> as_class_object
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
008162c514
avm2: Replace all uses of as_class_object by instance_of
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
4b7f8b3dbd
avm2: inner_class_definition is not an Option
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
3e1764aa1e
avm2: Reimplement as_class_object() in terms of other methods
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
e02feb919a
avm2: Reimplement as_class() in terms of other methods
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
4380978b2a
avm2: Move instance_allocator() to ClassObject
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
1d22009c6b
avm2: Drop seemingly-unused set_class_object()
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
f3ab6c9da3
avm2: Move as_class_params() to ClassObject
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
0679fd1a9e
amv2: Move superclass_object() to ClassObject
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
2dfa875712
avm2: Move interfaces to ClassObject
2021-09-22 00:29:37 +02:00
Chris Midgley
6f0b026f13
chore: cargo fmt
2021-09-18 18:42:36 +02:00
Chris Midgley
7bab1de1e7
avm2: implement coerce_x opcodes
2021-09-18 18:42:36 +02:00
Adrian Wielgosik
ba35611c47
chore: cargo fmt
2021-09-18 18:37:46 +02:00
lukaszN
a76f2403ac
avm2: String rename PUBLIC_CLASS_METHODS to AS3_CLASS_METHODS
2021-09-18 18:37:46 +02:00
lukaszN
0f41193c3b
avm2: String.match match lastIndex behavior
2021-09-18 18:37:46 +02:00
lukaszN
d5588f3f90
avm2: String refactor index_of, match
2021-09-18 18:37:46 +02:00
lukaszN
42300d4a1e
avm2: String tests
2021-09-18 18:37:46 +02:00
lukaszN
4abde1500b
avm2: String fixes for tests
2021-09-18 18:37:46 +02:00
lukaszN
e24390ff58
avm2: String slice, substr, substring
2021-09-18 18:37:46 +02:00
lukaszN
d953fea5df
avm2: String match
2021-09-18 18:37:46 +02:00
lukaszN
91d63e4dc1
avm2: class methods can also live in the AS3 namespace
2021-09-18 18:37:46 +02:00
lukaszN
5e5d8e4fff
avm2: String concat, lastIndexOf, indexOf, fromCharCode
2021-09-18 18:37:46 +02:00
relrelb
1ab953887c
avm1: Simplify `Value::abstract_eq`
...
Make it return `bool` instead of a `Value` that can be either `true`
or `false`.
2021-09-18 17:47:25 +02:00
Giles Cope
42c2b40052
unused deps
2021-09-18 15:28:24 +02:00
Chris Midgley
758d84f549
avm2: fix button typo
2021-09-18 15:26:52 +02:00
Chris Midgley
909428943b
avm2: implement bkpt, bkptline, timestamp as no-ops
2021-09-17 23:06:59 +02:00
relrelb
ff1c29d952
avm1: Simplify `Value::abstract_lt`
...
* Change its return type to `Option<bool>`.
* Use Rust's `f64::partial_cmp` to compare two numbers, which should
be more efficient.
2021-09-16 13:46:04 +03:00
relrelb
f92926af54
avm1: Correct `Math.{min,max}`
...
Don't use `abstract_lt` because it compares strings alphabetically,
unlike `Math.min` and `Math.max` that coerce to a number before comparing.
2021-09-16 02:38:34 -07:00
dependabot[bot]
76f4b0d8cd
build(deps): bump flate2 from 1.0.21 to 1.0.22
...
Bumps [flate2](https://github.com/rust-lang/flate2-rs ) from 1.0.21 to 1.0.22.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases )
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.21...1.0.22 )
---
updated-dependencies:
- dependency-name: flate2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-09-13 14:27:26 -07:00
Moulins
73bce495c2
chore: move core::avm1::string::AvmString to core::string::AvmString
2021-09-13 03:30:17 -07:00
Moulins
87e8b44fe9
chore: move core::string_utils to core::string::utils
...
Also move case tables to a separate file.
2021-09-13 03:30:17 -07:00
Mike Welsh
d84f65874e
chore: Appease clippy
...
Debug/Clone dervies no longer squelch dead code warnings, see:
See https://github.com/rust-lang/rust/pull/85200
2021-09-11 21:50:52 -07:00
Mike Welsh
e3c05a021e
core: De-duplicate enums between Avm1Button and Avm2Button
...
Needed to appease clippy.
2021-09-11 21:50:52 -07:00
Ray Redondo
167b5a45de
avm2: move flash.display.IBitmapDrawable init
2021-09-11 15:47:20 -07:00
Ray Redondo
40d53cda59
avm2: make BitmapData and DisplayObject impl IBitmapDrawable
2021-09-11 15:47:20 -07:00
Ray Redondo
7f895473cb
avm2: IBitmapDrawable stub
2021-09-11 15:47:20 -07:00
David Wendt
1e0d259075
avm2: Allow nulling `Bitmap.bitmapData`.
...
One of the two tests in this PR relies upon the backend storing bitmap data, but the test rendering backend does not yet do this.
2021-09-11 12:11:35 -07:00
David Wendt
bfb6f03d62
avm2: Impl `Bitmap.smoothing`
...
Also, `smoothing` should be set at construction time even if we're setting up a timeline bitmap.
2021-09-11 12:11:35 -07:00
David Wendt
2ba0e12b7e
avm2: Stub `Bitmap.pixelSmoothing`
2021-09-11 12:11:35 -07:00
David Wendt
8ae669b96c
avm2: `BitmapData` should be traceable
2021-09-11 12:11:35 -07:00
David Wendt
31e3741982
avm2: Allow access to the `BitmapData` of a `Bitmap`.
2021-09-11 12:11:35 -07:00
David Wendt
7c5dc568f1
avm2: Impl `BitmapData.getPixel`.
...
This also changes the `bitmapdata_constr` test slightly to use a different starting value. Our premultiplied alpha calculations generate slightly different values from Flash Player which trips the test.
2021-09-11 12:11:35 -07:00
David Wendt
4c9bd0a6fe
avm2: Impl `BitmapData.transparent`
2021-09-11 12:11:35 -07:00
David Wendt
e18caa2fbf
core: Silence error relating to `Bitmap` symbol class associations
2021-09-11 12:11:35 -07:00
David Wendt
dca473fc2a
avm2: Impl `BitmapData.width` and `BitmapData.height`
2021-09-11 12:11:35 -07:00
David Wendt
335aec5be0
avm2: Implement `BitmapData`'s constructor.
...
This includes support for both embedded bitmap data (resolved via the SymbolClass mechanism) as well as empty bitmaps configured via arguments.
2021-09-11 12:11:35 -07:00
David Wendt
e5151d147d
core: When constructing a `Bitmap`, do not attempt to cache it's associated `BitmapData`'s handle.
...
Attempting to do so results in borrow-mut panics. Furthermore, it's unnecessary; the handle provided to this function is already derived from the bitmap data in this way.
2021-09-11 12:11:35 -07:00
David Wendt
54740d6093
core: Allow `BitmapData` to hold an AVM2 side.
2021-09-11 12:11:35 -07:00
David Wendt
10b98f72f5
core: Allow `Bitmap` to be reassociated with new `BitmapData`
2021-09-11 12:11:35 -07:00
David Wendt
a807cf7623
avm2: Stub `flash.display.BitmapData` & storage object
2021-09-11 12:11:35 -07:00
David Wendt
609b97cfb9
core: Allow `Bitmap`s to hold an AVM2 representation
2021-09-11 12:11:35 -07:00
Chris Midgley
bd26790f5b
avm1: Fix `this` inside watchers ( #5276 )
...
* fix: fix 'this' inside watchers
* tests: test value of 'this' in watcher
* lint: cargo fmt
2021-09-11 15:15:16 +03:00
relrelb
923201d2e4
chore: Appease clippy
2021-09-10 15:42:37 +02:00
Chris Midgley
3e04c2b0d2
dev: remove allow unused mut and corresponding mut
2021-09-09 19:06:49 -06:00
Daniel Jacobs
5ac9796ffd
web: Support salign, quality, & scale embed/object attributes (part of #4258 )
2021-09-08 16:25:47 -07:00
Tal Hayon
7d6eaf127d
core: Fix EditText width and height scaling ( close #3001 )
2021-09-08 02:39:01 -07:00
relrelb
c2fcc03c35
avm1: Remove `TObject::get_local` in favor of `TObject::get_local_stored`
...
`get_local` is basically equivalent to `get_local_stored` that also
handles virtual getters. So instead handle virtual getters in
`search_prototype`. This allows to inline the `get_local_sub` helper
methods into the implementations of `get_local_stored`.
The remaining usages of `get_local` were not exactly correct as they
all should ignore virtual getters. This change solves this as well
by using `get_local_stored` that ignores virtual getters.
2021-09-08 12:21:17 +03:00
relrelb
1f96c2fcb8
audio: Small cleanup
2021-09-07 18:28:17 -07:00
relrelb
65205ac6d7
audio: Store sound transform values in 30-bit integers
...
It seems like Flash stores sound transform values in 30-bit unsigned integers:
* Negative values are equivalent to their absolute value.
* Specifically, 0x40000000, -0x40000000 and -0x80000000 are equivalent to zero.
2021-09-07 18:28:17 -07:00
Chris Midgley
868706d775
avm1: call watcher, if defined, from virtual properties on prototype ( #4827 )
...
* avm1: extract get_watcher
* tests: add tests for TextField text watch
* avm1: call the watcher, if defined, from call_setter
* dev: shadow variable to avoid unused mut warning
* dev: remove value mutability
* chore: cargo fmt
* dev: unify virtual and stored property watcher cases
* tests: add test for watching prototyped property
* feat: when getting old values, ascend the proto chain ignoring virtual properties
* chore: lint
* dev: share complicated code
* chore: Small cleanups
Co-authored-by: relrelb <relrelbachar@gmail.com>
2021-09-08 03:41:18 +03:00
Mike Welsh
483995823f
core: Add symphonia as optional MP3 decoder
...
Add symphonia_mp3 feature to enable symphonia as an MP3 decoder.
This is a pure Rust MP3 decoder that could be used on web.
2021-09-07 16:48:34 -07:00
Mike Welsh
94d02fa653
core: Add AudioMixer to core
...
Pull out the audio mixing code from desktop and add it to core.
This will allow other backends to use it (such as the web audio
backend) to get consistent audio across all platforms.
2021-09-07 16:48:34 -07:00
Tal Hayon
4625ca0e0b
web: fix base param
2021-09-07 16:45:35 -07:00
dependabot[bot]
5e07d4e464
build(deps): bump syn from 1.0.75 to 1.0.76
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.75 to 1.0.76.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.75...1.0.76 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-09-06 14:33:56 -07:00
Adrian Wielgosik
9bd0b624fd
avm2: Add more Event class stubs and constants
2021-09-05 11:56:21 +02:00
David Wendt
bc4f790031
avm2: Stub `SoundMixer.areSoundsInaccessible` and `SoundMixer.computeSpectrum`
2021-09-03 16:47:02 -06:00
David Wendt
34fe35a998
avm2: Impl `SoundMixer.bufferTime`
2021-09-03 16:47:02 -06:00
David Wendt
364ee62c92
avm2: Impl `SoundChannel`'s `soundComplete` event.
...
This includes a test that is currently ignored because `NullAudioBackend` can't fire complete events.
2021-09-03 16:47:02 -06:00
David Wendt
d5718fe408
avm2: Initialize all sounds and channels at time of allocation
2021-09-03 16:47:02 -06:00
David Wendt
efcab92d97
avm2: Impl `SoundMixer.stopAll`
2021-09-03 16:47:02 -06:00
David Wendt
d73ba586d0
avm2: Impl `SoundChannel.stop()`
2021-09-03 16:47:02 -06:00
David Wendt
39305f6a38
avm2: Implement `SoundChannel.soundTransform`
2021-09-03 16:47:02 -06:00
David Wendt
9c6c64e4e3
core: `NullAudioBackend` should falsely report all sounds as not playing, like the real backends
...
This prevents sounds from being removed from the `AudioManager`, which allows sound transforms to be placed on them in tests.
2021-09-03 16:47:02 -06:00
David Wendt
6b7609ff4e
avm2: Stub `SoundChannel.position`.
...
This also comes with an ignored test for `position`, because I originally believed this to be implementable.
2021-09-03 16:47:02 -06:00
David Wendt
4e77f89e0f
avm2: Stub `SoundChannel.leftPeak` and `SoundChannel.rightPeak`
2021-09-03 16:47:02 -06:00
David Wendt
50092e6c04
avm2: Stub all remaining `Sound` methods.
2021-09-03 16:47:02 -06:00
David Wendt
b6167c2f86
avm2: Allow playing sounds with a given `SoundTransform`.
2021-09-03 16:47:02 -06:00
David Wendt
5771d4c826
avm2: Deduplicate the sound transform conversion code
2021-09-03 16:47:02 -06:00
David Wendt
116fb1f323
avm2: Impl `Sound.play`
...
This does not (yet) implement the third `SoundTransform` parameter on `play`.
2021-09-03 16:47:02 -06:00
David Wendt
8a58956f1f
avm2: Add `flash.media.SoundChannel` class & associated object storage
2021-09-03 16:47:02 -06:00
David Wendt
46de9ee46e
avm2: `soundTransform` isn't a movieclip property, so don't ask for one.
2021-09-03 16:47:02 -06:00
David Wendt
1bde07089d
avm2: Alias `SimpleButton.soundTransform` to the class property of `SoundMixer.soundTransform`
2021-09-03 16:47:02 -06:00
David Wendt
0f625e7864
avm2: Impl `SoundMixer.soundTransform` class property
2021-09-03 16:47:02 -06:00
David Wendt
8e1122104d
avm2: Correct `SoundTransform` class definition to match docs
2021-09-03 16:47:02 -06:00
David Wendt
2f6e695483
avm2: Impl `Sprite.soundTransform`
2021-09-03 16:47:02 -06:00
David Wendt
3b9f0f271d
avm2: `SoundTransform.pan` returns 0 if the transform sends sound to different channels
2021-09-03 16:47:02 -06:00
David Wendt
2b7a0bf898
avm2: `SoundTransform` stores it's values as square roots
2021-09-03 16:47:02 -06:00
David Wendt
bd3cec0d20
avm2: Impl `flash.media.SoundTransform`
2021-09-03 16:47:02 -06:00
David Wendt
3b6eea2a1d
core: Report sound duration as `f64` and round down in AS1
2021-09-03 16:47:02 -06:00
David Wendt
e4c6e29b8a
core: `NullAudioBackend` should not report latency seek data as part of the size of a sound.
2021-09-03 16:47:02 -06:00
David Wendt
d7f2f782c4
avm2: Impl `Sound.length`
...
This also adds duration tracking for `NullAudioBackend`.
2021-09-03 16:47:02 -06:00
David Wendt
e25fb732ea
avm2: Stub `Sound.isBuffering`, `Sound.isURLInaccessible`, and `Sound.url`
2021-09-03 16:47:02 -06:00
David Wendt
89b411593f
avm2: Impl `Sound.bytesTotal`
2021-09-03 16:47:02 -06:00
David Wendt
d5fb807387
avm2: Allow calling `Function.apply` without a second argument
2021-09-03 16:47:02 -06:00
David Wendt
7b31cd9a4d
avm2: Allow instantiating a SWF sound by constructing it's symbol class
2021-09-03 16:47:02 -06:00
David Wendt
37eb746989
core: Don't warn when associating sounds to AS3 classes
2021-09-03 16:47:02 -06:00
David Wendt
0c591f3370
avm2: Stub implementation of `Sound` and accompanying object type
2021-09-03 16:47:02 -06:00
David Wendt
70556e5830
avm2: Forbid `applytype` opcodes with more than one argument type.
2021-09-02 17:57:58 -06:00
David Wendt
e2bf0a9857
avm2: Prohibit naming types with more than one parameter, as they don't exist.
2021-09-02 17:57:58 -06:00
David Wendt
141b992a73
avm2: Storing past the end of a vector only works for the immediate one-off-the-end index
2021-09-02 17:57:58 -06:00
David Wendt
8cd2b4fd5e
avm2: Fill vector holes with the default value at creation time instead of storing them.
2021-09-02 17:57:58 -06:00
David Wendt
3b48216762
avm2: Don't store more than one object parameter, because there are no classes with multiple paramters.
2021-09-02 17:57:58 -06:00
David Wendt
5c740ef1e1
chore: Grammar
2021-09-02 17:57:58 -06:00
David Wendt
d1b9df61f3
avm2: Move `Vector`'s properties to the AS3 namespace and add prototype properties in the public one
2021-09-02 17:57:58 -06:00
David Wendt
cc15809f49
avm2: Add the ability to have a separate class initializer for each specialization of `Vector`
2021-09-02 17:57:58 -06:00
David Wendt
e087a27e56
avm2: `Vector.sort` actually *does* calculate an indexed sort array, but then discards it.
...
Normally we could skip sorting, but values in the vector may have side effects when coerced. So we need to make sure coercions run, at least.
2021-09-02 17:57:58 -06:00
David Wendt
280fbbde45
avm2: Pick nits in `Vector`'s `instance_init`
2021-09-02 17:57:58 -06:00
David Wendt
2095c1831a
avm2: Replace some if expressions with easier-to-read equivalents
2021-09-02 17:57:58 -06:00
David Wendt
464605d015
avm2: Pre-allocate all the things
2021-09-02 17:57:58 -06:00
David Wendt
bf4492c454
avm2: Add the legacy Vector types that old movies can use.
...
This one was rather tough to test, as I actually can't generate ABCs in Animate CC that reference these classes. I instead had to modify a compiled SWF to open the package-internal namespace that these pre-specialized classes exist in.
2021-09-02 17:57:58 -06:00
David Wendt
dcf6d87363
avm2: Accept `null` as a valid type in `applytype`.
...
In AVM2, the `*` (any) type is represented as `null`.
This requires also changing the parameters on classes and objects to be nullable, too.
We do *not* represent `null` as a particular value on the underyling vector storage object, however. We instead change it to `Object`, as that's the root of all other types.
This may require revision if non-`Object`-extending types appear in the future.
2021-09-02 17:57:58 -06:00
David Wendt
ee30f21e8e
avm2: Remove unnecessary `mut`
2021-09-02 17:57:58 -06:00
David Wendt
aaddcc598f
avm2: Impl `Vector.toLocaleString` and test `toString`
2021-09-02 17:57:58 -06:00
David Wendt
d1e49db3cc
avm2: Stub `Number.toLocaleString`
...
This exists but is undocumented, and I accidentally wrote a Vector test that needs it.
2021-09-02 17:57:58 -06:00
David Wendt
dbc6f38c34
avm2: Impl `Vector.splice`
2021-09-02 17:57:58 -06:00
David Wendt
81d0775776
avm2: Impl `Vector.sort`
2021-09-02 17:57:58 -06:00
David Wendt
9fcd846a4d
avm2: Fix ineffective Vector typechecks
2021-09-02 17:57:58 -06:00
David Wendt
44a9f13047
avm2: Impl `Vector.slice`
2021-09-02 17:57:58 -06:00
David Wendt
077fd87842
avm2: Impl `Vector.reverse`
2021-09-02 17:57:58 -06:00
David Wendt
aa2d729a44
avm2: Impl `Vector.removeAt`
2021-09-02 17:57:58 -06:00
David Wendt
a053015558
avm2: Impl `Vector.insertAt`
2021-09-02 17:57:58 -06:00
David Wendt
6b78e86ddc
avm2: Impl `Vector.shift` and `Vector.unshift`
2021-09-02 17:57:58 -06:00
David Wendt
1cfa9e0b28
avm2: Impl `Vector.push` and `.pop`
2021-09-02 17:57:58 -06:00
David Wendt
6350ce2dde
avm2: Impl `Vector.map`
2021-09-02 17:57:58 -06:00
David Wendt
7628b2b49a
avm2: Impl `Vector.lastIndexOf` (and the weird backward-index behavior of `indexOf`)
2021-09-02 17:57:58 -06:00
David Wendt
4624157ae0
avm2: Impl `Vector.indexOf`
2021-09-02 17:57:58 -06:00
David Wendt
622be142c3
avm2: Specialize generic classes when resolving types whose names have parameter names also in them.
...
Any is, as usual, special-cased. In this case, we treat it as specializing to `Object`, since all vectors should be coercible to `Object`.
2021-09-02 17:57:58 -06:00
David Wendt
c06a3c10d8
avm2: Impl `Vector.filter`
2021-09-02 17:57:58 -06:00
David Wendt
d079c647fa
avm2: Parameter types can be `*`.
2021-09-02 17:57:58 -06:00
David Wendt
f00234ce26
avm2: Consider specializations of generic classes to be of the same type as other specializations of the same class when their parameters are also of the same type.
...
For example, instances of `Vector.<Class>` are considered to be of type `Vector.<Interface>` in the same way that instances of `Class` are considered to be of type `Interface`. This assumes `Class` implements `Interface`.
This does *not* apply to the builtin coercions for numeric and string types, which do not extend to generic parameters. For example, `Vector.<uint>` is *not* coercible to `Vector.<int>`, even though it's contents *are*.
2021-09-02 17:57:58 -06:00
David Wendt
4d962f154e
avm2: Don't run initializers on vectors as they overwrite the existing vector storage.
2021-09-02 17:57:58 -06:00
David Wendt
fcc7c9e7ee
avm2: Propagate the specialized class parameter into the vector storage so that coercions happen correctly.
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
2560bdc804
chore: Drop unnecessary mut
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
846b53dc1b
avm2: Impl `Vector.forEach`
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
8a77494b2f
avm2: Impl `Vector.some`
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
519feb9af7
avm2: `Array.every/some` should early return
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
07f979b582
avm2: `Vector.every` should early return
2021-09-02 17:57:58 -06:00
David Wendt
97e6f55110
avm2: Impl `Vector.every`
2021-09-02 17:57:58 -06:00
David Wendt
aa0946c64c
avm2: Impl `Vector.fixed`
2021-09-02 17:57:58 -06:00
David Wendt
841ed4b5e4
avm2: Setting to an out-of-bounds index on a growable `Vector` should grow it
2021-09-02 17:57:58 -06:00
David Wendt
238959d7f8
avm2: Impl `Vector.join` and `toString`
2021-09-02 17:57:58 -06:00
David Wendt
1ce7e4e642
avm2: `Vector` is a final class (no matter what the docs say)
2021-09-02 17:57:58 -06:00
David Wendt
dba9b18540
avm2: Impl `Vector.concat`
2021-09-02 17:57:58 -06:00
David Wendt
96afc5a6c2
avm2: Cache all `Vector` applications on the `Vector` class object.
...
This matches Flash Player behavior: notably, multiple applications of the same types see the same class and prototype, but different applications actually create new objects that don't share properties.
2021-09-02 17:57:58 -06:00
David Wendt
888fcc85ca
avm2: Impl `Vector.length`
2021-09-02 17:57:58 -06:00
David Wendt
9d08a7c299
avm2: Impl `Vector`'s instance initializer
2021-09-02 17:57:58 -06:00
David Wendt
49d79b8e73
avm2: Vector indices are stored in a package namespace
2021-09-02 17:57:58 -06:00
David Wendt
3d3b80f8af
avm2: ES3 class instances should be treated as instances of the ES4 class `Object`.
2021-09-02 17:57:58 -06:00
David Wendt
6b377bed64
avm2: Impl `apply` for ES4 classes to allow type parameterization
2021-09-02 17:57:58 -06:00
David Wendt
65a23d5833
avm2: Move applytype next to other operations that create classes
2021-09-02 17:57:58 -06:00
David Wendt
074c093504
avm2: Implement op `ApplyType`
2021-09-02 17:57:58 -06:00
David Wendt
4b021fe92c
avm2: `Vector` lives in a separate package from other globals
2021-09-02 17:57:58 -06:00
David Wendt
74cb32dd46
avm2: Allow constructing static `TypeName`s (for naming `Vector` classes)
2021-09-02 17:57:58 -06:00
David Wendt
7e71ecac16
avm2: Add stub impl of `Vector`
2021-09-02 17:57:58 -06:00
David Wendt
6f49e62b96
avm2: First pass on implementing vector storage
2021-09-02 17:57:58 -06:00
David Wendt
f4dfc4d778
avm2: First pass at type-aware vector storage
2021-09-02 17:57:58 -06:00
David Wendt
686872812d
avm2: Add a `TObject` method for applying arguments to a generic type.
2021-09-02 17:57:58 -06:00
David Wendt
fe8373739d
avm2: Add the ability to fork a `Class` to one that holds it's type arguments.
2021-09-02 17:57:58 -06:00
David Wendt
86616b748f
avm2: Allow parsing generic typenames into a multiname
2021-09-02 17:57:58 -06:00
David Wendt
47e3b2229a
swf: Add support for the `TypeName` multiname type.
2021-09-02 17:57:58 -06:00
David Wendt
7277f14198
core: Delay execution of AVM2 constructors on buttons by one frame.
2021-08-31 21:21:54 -06:00
David Wendt
472ba6db1f
core: AVM2 buttons only emit frame construction events and frame scripts if they were timeline-constructed.
2021-08-31 21:21:54 -06:00
David Wendt
b1ba591bb9
core: Support constructing symbolclassed buttons from AVM2
2021-08-31 21:21:54 -06:00
David Wendt
7c970e144f
core: `Avm2Button` should always call it's native initializer
2021-08-31 21:21:54 -06:00
Chris Midgley
bc4422f4fe
chore: fix docstring
2021-08-31 22:47:13 +03:00
dependabot[bot]
5af5fb579e
chore: Bump flate2 from 1.0.20 to 1.0.21
...
Bumps [flate2](https://github.com/rust-lang/flate2-rs ) from 1.0.20 to 1.0.21.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases )
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.20...1.0.21 )
---
updated-dependencies:
- dependency-name: flate2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 09:04:44 +03:00
David Wendt
80c5bbcd83
avm2: Stub `Font.enumerateFonts` and `Font.registerFont`
2021-08-30 17:53:39 -06:00
David Wendt
2d57bed82e
avm2: Impl `Font.hasGlyphs`
2021-08-30 17:53:39 -06:00
David Wendt
37af9be533
avm2: Implement `Font` for embedded fonts.
2021-08-30 17:53:39 -06:00
dependabot[bot]
7f2f8a492e
chore: Bump png from 0.17.0 to 0.17.1
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.17.0 to 0.17.1.
- [Release notes](https://github.com/image-rs/image-png/releases )
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md )
- [Commits](https://github.com/image-rs/image-png/commits )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-30 23:27:18 +02:00
dependabot[bot]
3136331e85
chore: Bump serde from 1.0.128 to 1.0.130
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.128 to 1.0.130.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.128...v1.0.130 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-30 22:31:27 +02:00
Adrian Wielgosik
945bce4a85
xml: Use forked quick-xml to support loose entity parsing
2021-08-30 19:08:22 +02:00
EmperorBale
358e0641eb
avm2: Use rsplit_once instead of split_once
2021-08-29 20:41:20 -06:00
EmperorBale
05b4ee6b61
avm2: Dont panic if as_class returns None
2021-08-29 20:41:20 -06:00
EmperorBale
547aac0e85
chore: Cleanup QName::to_qualified_name
2021-08-29 20:41:20 -06:00
EmperorBale
5dd21cdf8e
avm2: Add QName::from_qualified_name and QName::to_qualified_name
2021-08-29 20:41:20 -06:00
EmperorBale
2b748a4870
avm2: Implement getQualifiedClassName, getQualifiedSuperclassName, and getDefinitionByName
2021-08-29 20:41:20 -06:00
Daniel Jacobs
3982f3af98
web: Support menu embed/object attribute (part of #4258 )
2021-08-28 14:56:35 +02:00
Adrian Wielgosik
b5ee94aff1
avm2: Stub flash.system.Security.
2021-08-26 23:50:42 +02:00
relrelb
0aed180da8
avm1: Rename `SuperObject::child` to `this`
2021-08-26 01:07:37 +03:00
relrelb
ec5a9f8ac8
avm1: Avoid `impl Into<Value<'gc>>` parameters
...
This might create templatized functions leading to unnecessary code bloat.
So instead use just `Value<'gc>` parameters and add `.into()` in callers
where needed.
2021-08-26 01:07:37 +03:00
relrelb
364f93fd92
avm1: Remove `SuperObject::as_executable`
...
It was identical to the default implementation of `TObject`, and
thus unnecessary.
2021-08-26 01:07:37 +03:00
relrelb
90a544a34a
avm1: Inline `SuperObject::super_constr`
2021-08-26 01:07:37 +03:00
relrelb
dff74dcb92
avm1: Simplify `SuperObject::from_this_and_base_proto`
2021-08-26 01:07:37 +03:00
relrelb
1bd46c6d59
avm1: Rename `ScriptObject::values` to `properties`
...
To better reflect their meaning.
2021-08-26 01:07:37 +03:00
relrelb
fd7d32bc14
avm1: `DisplayGetter` cannot fail
...
So instead of always returning `Ok` from all getters, simply return a
`Value`.
2021-08-24 02:15:43 +03:00
lukaszN
8e596c2a35
avm2: Rectangle fix clippy
2021-08-23 15:44:14 -06:00
lukaszN
b7b66ab9b8
avm2: impl Rectangle isEmpty, offset, offsetPoint, setEmpty, union
2021-08-23 15:44:14 -06:00
lukaszN
f5c491a14f
avm2: impl Rectangle intersection, intersects
2021-08-23 15:44:14 -06:00
lukaszN
e22cd6bdbd
avm2: impl Rectangle inflate, inflatePoint
2021-08-23 15:44:14 -06:00
lukaszN
129cd1af58
avm2: impl Rectangle contains, containsPoint, containsRect, copyFrom
2021-08-23 15:44:14 -06:00
lukaszN
3670676e2d
avm2: Impl Rectangle topLeft, size, clone, equals
2021-08-23 15:44:14 -06:00
lukaszN
85afeb1de7
avm2: Impl Rectangle setters and getters
2021-08-23 15:44:14 -06:00
lukaszN
ee9e70b71f
avm2: Initial rectangle impl
2021-08-23 15:44:14 -06:00
dependabot[bot]
d8457d175b
chore: Bump serde from 1.0.127 to 1.0.128
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.127 to 1.0.128.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.127...v1.0.128 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-23 23:46:47 +03:00
dependabot[bot]
f8c069442f
chore: Bump syn from 1.0.74 to 1.0.75
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.74 to 1.0.75.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.74...1.0.75 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-23 23:45:53 +03:00
TÖRÖK Attila
1674c95487
Fix a typo in a comment introduced in #5021
2021-08-22 11:45:33 +03:00
relrelb
1e7bdaa226
chore: Minor improvement
2021-08-22 01:03:10 +03:00
Tomasz Konojacki
a3747ade5e
core: fix integer overflow in ADPCM decoder
...
The maximum possible value of delta is 63483, so it needs to be
declared as u16.
Fixes #5030
2021-08-22 01:03:10 +03:00
David Wendt
57fffbe699
video: Use the new `H263State.parse_picture` convenience method
2021-08-21 14:13:55 -06:00
Mike Welsh
1f951b6b9f
core: Add h263 feature
2021-08-21 14:13:55 -06:00
Mike Welsh
a05f81b393
video: Add VideoDecoder trait
...
Change VideoStream to use a VideoDecoder trait instead of an enum.
This will make it a little easier as more codecs are added, and
allow us to easily enable/disable codecs behind features.
2021-08-21 14:13:55 -06:00
David Wendt
48fa03b87d
video: Reuse the same bitmap whenever possible
2021-08-21 14:13:55 -06:00
David Wendt
05692cee67
video: Allow pictures with half-pixels in chroma by widening the chroma buffers to the next pixel in that direction.
2021-08-21 14:13:55 -06:00
David Wendt
43f76de602
video: Move software decoding into core now that we don't need to specialize per-renderer
2021-08-21 14:13:55 -06:00
David Wendt
885805f887
core: Half-implement an H.263 decoder
2021-08-21 14:13:55 -06:00
Tal Hayon
7b9049cedf
core: Add DefineBinaryData and SymbolClass connection (Part of #1368 )
2021-08-21 12:24:46 -06:00
relrelb
41142d940c
avm1: Turn `TObject::call_setter` to `TObject::setter`
...
Remove the unused `value` parameter and rename the function to clarify
its meaning.
2021-08-21 17:23:15 +03:00
relrelb
fd0e76020f
avm1: Allow stored and virtual properties to co-exist
...
Currently properties added using `addProperty` overwrite existing
stored properties. However, there are some cases where the original
stored value can still be retrieved, which indicates that Flash
Player doesn't overwrite these properties internally.
As a solution, unify `Property::Stored` and `Property::Virtual` to
a single struct. This allows to simultaneously store regular data
and getter/setter on the same property. It also simplifies some
logic in `ScriptObject`.
2021-08-21 17:23:15 +03:00
TÖRÖK Attila
a1311443a6
avm1/bitmap: Replace BitmapData.color_transform() argument with AVM-agnostic ColorTransformParams
2021-08-20 21:29:54 -06:00
TÖRÖK Attila
b31ad28960
avm1: Make add_field_accessors! accept nested field names
2021-08-20 21:29:54 -06:00
TÖRÖK Attila
57ccb714c6
core,avm1: Extract ColorTransformParams from ColorTransformData
2021-08-20 21:29:54 -06:00
TÖRÖK Attila
2048bb9887
core,avm1: Move BitmapData implementation into core::bitmap from core::avm1::object
...
This enables exposing it to AVM2 as well in the future.
2021-08-20 21:29:54 -06:00
Ray Redondo
27e06af003
avm2: Initial MouseEvent stubs ( #5065 )
...
* avm2: Start MouseEvent stubs
* avm2: More MouseEvent work
* chore: clippy
* chore: fmt
Co-authored-by: Adrian Wielgosik <adrian.wielgosik@gmail.com>
2021-08-21 01:26:34 +02:00
Chris Midgley
58c907e985
avm2: implement string.split for undefined ( #5064 )
...
* avm2: implement string.split for undefined
* chore: cargo fmt
* dev: avoid explicit ArrayStorage
2021-08-18 18:02:41 +02:00
relrelb
da7cd453cf
chore: Fix png update
2021-08-18 09:01:21 +03:00
dependabot[bot]
0e408052b1
chore: Bump png from 0.16.8 to 0.17.0
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.16.8 to 0.17.0.
- [Release notes](https://github.com/image-rs/image-png/releases )
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md )
- [Commits](https://github.com/image-rs/image-png/commits )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-18 09:01:21 +03:00
relrelb
ac3c198bda
chore: Appease clippy
2021-08-18 08:01:57 +03:00
dependabot[bot]
b8a9e28acb
chore: Bump bitstream-io from 1.1.0 to 1.2.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/compare/v1.1.0...v1.2.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>
2021-08-17 08:24:29 +03:00
dependabot[bot]
a317a09d17
chore: Bump bitflags from 1.2.1 to 1.3.2
...
Bumps [bitflags](https://github.com/bitflags/bitflags ) from 1.2.1 to 1.3.2.
- [Release notes](https://github.com/bitflags/bitflags/releases )
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md )
- [Commits](https://github.com/bitflags/bitflags/compare/1.2.1...1.3.2 )
---
updated-dependencies:
- dependency-name: bitflags
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-16 23:41:06 +03:00
Adrian Wielgosik
f4da77c400
Use a more idiomatic pattern for unwrap-or-default
2021-08-15 21:55:49 +02:00
David Wendt
f37a06241a
chore: Clippy compliance with latest nightly compiler
2021-08-14 19:51:24 -06:00
Ray Redondo
cfb2bb99d6
chore: appease clippy
2021-08-14 00:52:38 +02:00
Ray Redondo
638eaf4a55
avm2: Rename function, add runtime warnings
2021-08-14 00:52:38 +02:00
Ray Redondo
171a41b908
avm2: Add define_public_builtin_class_traits and repair Capabilities to use it
2021-08-14 00:52:38 +02:00
Ray Redondo
c43f57e5f5
avm2: Implement `String.split`
2021-08-14 00:52:38 +02:00
Ray Redondo
22c6f7321e
avm2: start flash.system.Capabilities stubs
2021-08-14 00:52:38 +02:00
Tal Hayon
332f1d47bb
core: Reset mouse visible when loading movie to root ( Fixes #4358 )
2021-08-11 23:18:57 +02:00
David Wendt
84f17d1222
chore: Update `flash-lso`'s dependent commit ID
2021-08-09 18:47:03 -06:00
relrelb
d40cf5aee4
avm1: Log internal error on `InvalidSwf`
...
This gives more percise error logs that ease finding their root
cause. Also remove `is_halting` and express it inline instead.
2021-08-03 14:40:59 -07:00
Tal Hayon
6762675bb5
core: Fixes several text edit font and bullet issues (parts of #1167 )
2021-08-03 13:08:06 -07:00
dependabot[bot]
36e96b7272
chore: Bump serde from 1.0.126 to 1.0.127
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.126 to 1.0.127.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.126...v1.0.127 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-03 10:18:58 +03:00
Adrian Wielgosik
b940e7f00f
Extension: Sidestep CORS issues by offering to load the SWF in a tab
2021-08-02 21:28:16 +02:00
relrelb
141f886cdd
avm1: Remove `TObject::set_proto`
...
The last usage of it was in `Player`, which anyway should operate
only on newly created objects that don't have any virtual properties
nor watchers. So it is safe to replace with `define_value`, that
also cannot fail.
2021-07-30 17:42:42 -07:00
relrelb
fd3f9f34de
avm1: Store `__proto__` as a regular property
...
`__proto__` seems to behave much like a regular data property. So
simply remove the `prototype` field of `ScriptObject` in favor of
storing the prototype in the general properties hash map.
2021-07-30 17:42:42 -07:00
relrelb
6b91239e28
avm1: Don't rely on prototypes during serialization
...
Instead, rely on the `TObject::as_*` methods to tell what kind the
serialized object is.
2021-07-24 04:12:34 -07:00
relrelb
06fce44665
avm1: Fix performance regression in `BitmapData::pixels_rgba`
...
It was regressed in #4822 when changed to use `flat_map`. But
currently Rust emits suboptimal code for such case. For now use
`Vec::with_capacity` manually to avoid unnecessary re-allocations.
2021-07-24 03:28:35 -07:00
EmperorBale
1dee1e4166
avm2: Implement flash.crypto.generateRandomBytes
2021-07-21 18:09:21 +02:00
David Wendt
db86ca84b9
avm2: `get_property` does not mutate the underlying object (anymore) so it should not be flagged as mutably borrowing it.
2021-07-20 22:14:05 -04:00
David Wendt
c30014baed
avm2: Remove `ScriptObjectClass` and replace with separately implemented methods on `ClassObject`
2021-07-20 22:12:33 -04:00
David Wendt
4d89341e19
avm2: Cache the instance allocator on class objects
2021-07-20 22:12:33 -04:00
David Wendt
2c927f2b6b
avm2: Make `coerce_to_type` take a class object instead of a multiname.
2021-07-20 22:12:33 -04:00
David Wendt
bd2f758976
avm2: Don't call native initializers when coercing primitives into objects.
...
The former native initializer call was incorrect and would cause spurious coercion failures. Since existing code assumes the error fork of `coerce_to_object` means undefined or null, this was causing coercions and parameter typechecks against primitives to fail in the most general case.
Attempting to fix this by providing the primitive value as native initializer argument instead causes a stack overflow. This is because native initializer arguments still have to be typechecked, and in the most general case this means... coercing the primitive value we're already coercing into an object... into another object. This won't work.
Since primitive initializers aren't going to do anything that native coercions need to care about, I'm just removing the initializer call.
2021-07-20 22:12:32 -04:00
David Wendt
30b4c4386b
avm2: Replace the `call_strict` mechanism with checking to see if free functions are unchecked.
2021-07-20 22:12:32 -04:00
David Wendt
ddd73b3cd6
avm2: Supercalls should fall back to normal receiver access if there is no matching supertrait to use.
2021-07-20 22:12:31 -04:00
David Wendt
e9b9d64cb6
avm2: Rename `StageObject::graphics_of` to just `graphics`
2021-07-20 22:12:30 -04:00
David Wendt
7871912d92
avm2: Calling ES4 class objects is treated as a coercion to that type.
2021-07-20 22:12:28 -04:00
David Wendt
ef4b6876db
core: MovieClips should initialize their AVM2 sides by calling `call_native_init`.
2021-07-20 22:12:28 -04:00
David Wendt
b469ef8a3f
avm2: Replace `deriver` language with `allocator` language
2021-07-20 22:12:28 -04:00
David Wendt
8af0481a23
avm2: Retire the use of "constructor" outside of literal reference to class initializer or instance initializer code.
...
Instead, the following terms are used:
* Static classes, to refer to `Class<'gc>`. Shortened to "class" in contexts where this is not ambiguous.
* Class objects, to refer to objects that represent a particular class. Also shortened to "class" in non-ambiguous contexts.
Downstream of this, the `base_constr` (referring to the class that a currently called trait has been pulled from) is now called `subclass_object` and several `TObject` methods have also been renamed.
2021-07-20 22:12:23 -04:00
David Wendt
6d907a0d10
avm2: Rename `ArrayObject::empty_array` to `ArrayObject::empty`.
2021-07-20 22:10:36 -04:00
David Wendt
05b7de7453
avm2: Avoid double iteration in `Names.contains_name`
2021-07-20 22:10:36 -04:00
David Wendt
6e2e686e0d
avm2: Rename `Method::Entry` to `Method::Bytecode`
2021-07-20 22:10:35 -04:00
David Wendt
b049f2e717
avm2: Rename `Method::from_builtin_only` to `Method::from_builtin`
2021-07-20 22:10:35 -04:00
David Wendt
d4fcca9787
avm2: Rename `call_initializer` and `call_native_initializer` to `call_init` and `call_native_init`
2021-07-20 22:10:34 -04:00
David Wendt
f5431a781e
docs: Fix stale comments in avm2
2021-07-20 22:10:34 -04:00
David Wendt
ccfa605260
avm2: Use `extend_from_slice`
2021-07-20 22:10:34 -04:00
David Wendt
a60a499f31
avm2: Rename `resolve_parameter_value` to `resolve_parameter`
2021-07-20 22:10:33 -04:00
David Wendt
9e997e6571
avm2: Split out `Method` and `Executable`'s native fork into `NativeMethod` and `NativeExecutable`, respectively.
...
This also implies renaming the existing type alias of the same name to `NativeMethodImpl`.
2021-07-20 22:10:33 -04:00
David Wendt
c7858f9447
avm2: Simplify/correct the value numerical checks
2021-07-20 22:10:32 -04:00
David Wendt
5018421eef
avm2: Rename `SystemConstructors` to `SystemClasses`
2021-07-20 22:08:27 -04:00
David Wendt
2c2f03ba23
chore: Clippy compliance on Rust nightly
2021-07-20 22:05:37 -04:00
David Wendt
d0478a1f40
avm2: Allow builtins to also hold parameter type metadata.
...
This is limited by the fact that we currently cannot store type metadata in static tables. I don't think it's necessary to do so as of yet as pretty much every actual parameter type I *could* shove in here turned out to be optional and broke tests if it wasn't. Still, it's probably useful enough for new classes to include.
2021-07-20 22:05:36 -04:00
David Wendt
e38b1bc281
avm2: Make numbers appear to be of any numeric type that can represent them.
...
This also prevents an exception from being fired when testing `undefined` or `null`, which are valid inputs to `istype`.
2021-07-20 22:05:35 -04:00
David Wendt
974fe152ff
avm2: Include the parameter coercions into `op_coerce`
2021-07-20 22:05:34 -04:00
David Wendt
8b48b79f5d
avm2: Make the `pool_` and `table_` functions no longer take a superfluous mutation context.
...
This also adds a new `pool_multiname_static_any` method that treats zero as `*` instead of an error.
2021-07-20 22:05:33 -04:00
David Wendt
abc9d0800a
avm2: `undefined` is normalized to `null` for string and object coercions
2021-07-20 22:05:32 -04:00
David Wendt
b779804075
avm2: Relax the maximum arguments check for functions called from native code.
2021-07-20 22:02:11 -04:00
David Wendt
ae086d6aa7
avm2: Implement implicit coercion for primitive types
2021-07-20 22:02:10 -04:00
David Wendt
63cf6a7b47
avm2: Implement parameter typechecking for script functions.
...
This commit breaks 15 tests, mostly due to implicit coercion that happens at function call time. This will be implemented shortly.
2021-07-20 22:02:10 -04:00
David Wendt
65ffa0684b
core: Use the new construct pathway for building AVM2 `TextFormat` objects
2021-07-20 22:02:09 -04:00
David Wendt
5c6c3191ef
avm2: Enforce `final` on traits.
2021-07-20 22:02:09 -04:00
David Wendt
7d86c93ddc
Check to make sure that overrides only apply to already-installed properties.
2021-07-20 22:02:08 -04:00
David Wendt
5662527c9e
avm2: Enforce `interface` checks: classes cannot extend interfaces and cannot implement other classes.
2021-07-20 22:02:08 -04:00
David Wendt
7eca7d5331
avm2: Enforce `final` on classes
2021-07-20 22:02:07 -04:00
David Wendt
3888d5bb27
avm2: `install_dynamic_property` now checks to see if the object is sealed, and if so, throws an error.
2021-07-20 22:02:07 -04:00
David Wendt
03980f4f3d
avm2: `Function.prototype`'s properties are not methods.
2021-07-20 22:02:06 -04:00
David Wendt
c10a25fb3f
avm2: Remove the special global constructor scope mode we added two commits ago.
2021-07-20 22:02:05 -04:00
David Wendt
0e40552c2a
avm2: Don't instantiate classes or functions at trait install time.
2021-07-20 22:02:05 -04:00
David Wendt
377730301f
avm2: Add a special object mode for `globals` so that it can get it's own scope during trait installation.
...
This is very wrong: Strictly speaking, we should not be instantiating anything that needs a scope when we install the trait. We just create a slot for it to go into. Script initializers are responsible for providing a scope stack to instantiate traits into.
2021-07-20 22:02:04 -04:00
David Wendt
a112192c96
avm2: Remove `_slot_local` methods as we no longer do anything special with slots.
2021-07-20 22:02:04 -04:00
David Wendt
5dcc3a58f2
avm2: Remove lazy trait initialization
2021-07-20 22:02:03 -04:00
David Wendt
7e3c017a63
avm2: `broadcast_event` should use constructors for it's type checks.
2021-07-20 22:02:02 -04:00
David Wendt
1c72167287
avm2: Make `istype` use the constructor chain, not the prototype chain.
...
This pushes a few more ancillary changes:
* `has_proto_in_chain` no longer checks interfaces (since it exists to serve `instanceof`, which does not respect them)
* Interfaces no longer live on prototypes. They now live on class constructors.
2021-07-20 22:01:57 -04:00
David Wendt
713ab3e95c
avm2: Remove all remaining accesses to `SystemPrototypes`, save for one technicality with the global scope prototype.
2021-07-20 22:00:34 -04:00
David Wendt
f84f01b2a5
avm2: Adjust the `FunctionObject` associated constructors so that there's a path that doesn't require the user hit `SystemPrototypes`.
...
Because we have stuff running in early globals, we stlil need a more elaborate version of this function that *does* take `fn_proto`. We also can't pull `scope` from the activation since this gets called to install traits.
2021-07-20 22:00:34 -04:00
David Wendt
e4201625a1
avm2: Split `StageObject` associated constructors into two versions: allocation-only (`for_display_object`) and allocation-and-initialization (`for_display_object_childless`).
...
The latter is intended for display objects that *do not* have children and can be both allocated and initialized in one shot. Hence the name.
2021-07-20 22:00:33 -04:00
David Wendt
46a4da9dc5
avm2: Remove `XmlObject::empty_object` as it does not appear to be in use and will need further elaboration when XML is unstubbed.
2021-07-20 22:00:32 -04:00
David Wendt
602895e2de
avm2: Make `RegExpObject::from_regexp` pull it's own constructor and call it's own initializer.
...
This doesn't appear to actually be in use, but I'm doing it for completeness' sake.
2021-07-20 22:00:32 -04:00
David Wendt
c167912f52
avm2: `PrimitiveObject::from_primitive` should now select it's own class and construct it.
...
This also includes protections on `String` to prevent it from overwriting itself. All user-constructed primitive objects start out boxing `Value::Undefined` and future constructor implementations should check what's already been boxed before overwriting it with user arguments.
2021-07-20 22:00:31 -04:00
David Wendt
261cb40a22
avm2: Make `NamespaceObject`'s sole associated method build and construct a `Namespace` instance.
2021-07-20 22:00:29 -04:00
David Wendt
b30c7509ba
avm2: Make `LoaderInfo`'s associated methods call initializers and pull their constrs/protos as necessary
2021-07-20 21:59:21 -04:00
David Wendt
60eb1b4409
avm2: Don't ask for a `proto` in `EventObject::from_event`.
...
For various reasons, this is kind of incomplete:
1. We need to support native event subclasses, so we can't just pull one class from `activation` (yet).
2. We can't run native instance initializers without overwriting the native object.
I expect these to be fixed in a future PR where I start adding native event types.
2021-07-20 21:59:21 -04:00
David Wendt
22fedf4dca
avm2: Make all domain object construction (save for the global domain) pull the constructor and call it in `from_domain`.
...
This also adds `DomainObject::script_global`, which does the same thing but picks the `global` class instead of `ApplicationDomain`.
2021-07-20 21:59:20 -04:00
David Wendt
6fe44c3862
avm2: Clean up `ClassObject` initialization.
...
This also makes it more difficult to accidentally build a class without calling it's initializer. Native/builtin class initializers should also be running now, too.
The only minor bit of jank is that we need a class initialized bit to flag classes we've already run, because our current lazy-init design for traits causes classes to be constructed twice. This is temporary and I intend to remove it along with lazy-init traits.
2021-07-20 21:59:18 -04:00
David Wendt
31faf62baf
avm2: Remove all alternative `ByteArrayObject` constructors.
...
The only way to build a `ByteArrayObject` now is to invoke it's constructor.
2021-07-20 21:58:06 -04:00
David Wendt
9604b525d5
avm2: Tie `ArrayObject`'s constructors to the system `Array` class.
...
This effectively turns calling `ArrayObject`'s associated methods into an alternate constructor path. We even make sure to run instance initializers. You also no longer have to grab the `array` system constructor, so we get to remove that code.
2021-07-20 21:58:05 -04:00
David Wendt
46db756f67
avm2: Don't run `Point`'s constructor twice when natively constructing one.
2021-07-20 21:58:04 -04:00
David Wendt
c8cd6e0322
avm2: Split native and script instance initializers for non-constructable classes.
...
This also includes new errors for attempting to construct non-constructables like `System`.
2021-07-20 21:58:04 -04:00
David Wendt
dcbb5e4284
avm2: Add a notion of native instance initializers.
...
Native initializers are a separate, parallel initialization chain intended for all object construction that is not directly triggered by `Op::Construct` and friends. This allows us to implement classes that cannot be directly constructed by user code, but can be constructed by native code or supercalled into from non-native.
2021-07-20 21:58:03 -04:00
David Wendt
4bc1d37029
avm2: Remove unnecessary manual accesses of the `constructor` property on prototypes.
...
All native object allocation in the project now pulls prototypes or constructors as necessary from the following sources:
* System prototype or constructor lists
* Instance `constr`s
This also resulted in the removal of a few unnecessary prototype accesses.
2021-07-20 21:57:56 -04:00
David Wendt
afd5a65a1e
avm2: Create a new list of system constructors alongside the existing list of system prototypes.
2021-07-20 21:55:30 -04:00
David Wendt
b0c38c9d4a
avm2: `Graphic` construction shouldn't use the `Shape` proto as it's base constructor.
...
This fixes the last broken test.
2021-07-20 21:55:29 -04:00
David Wendt
6deaa6f441
avm2: Remove the prototype setter exception as prototypes no longer provide setters to instances.
2021-07-20 21:55:29 -04:00
David Wendt
a8fd0622b2
avm2: Filter traits in `call_instance_xyz` by the trait type before actually getting trait fields.
...
Fixes the `as3_virtual_properties` test, where the old approach would accidentally grab a `Getter` and then think there's no setter (there is, you just have to look further down the list).
2021-07-20 21:55:29 -04:00
David Wendt
a2cd7443e8
avm2: Do not attempt to `super_init` the `LoaderInfo` object.
...
This is a temporary fix for failing tests; it is invalid in the sense that attempting to grab loader events will now fail. We can't actually correctly init the loader without two planned changes:
1. Moving all object initialization into the object helper functions (e.g. `LoaderInfoObject::from_movie`)
2. A notion of "native-only" constructors separate from the existing constructor chain
Once those are in place, loaders should be proper event dispatchers again.
2021-07-20 21:55:29 -04:00
David Wendt
1ad512e3c9
avm2: Allow constructing activation objects (since we now force instance constructors to run)
2021-07-20 21:55:28 -04:00
David Wendt
323da9ded3
avm2: Move the class association from prototypes to instances.
...
This also incurred a large number of ancillary changes, as it turns out nearly every native object is currently pulling a prototype and sticking it into an object. Right now, I have it instead pulling the constructor out of the prototype, but a future PR will also remove `system_prototypes` as well.
Other ancillary changes include:
* `Domain` now supports partial initialization to avoid an order-of-events issue. Accessing domain memory on a partially-initialized `Domain` will panic.
* `Domain` construction requires a full `activation` now, except for `global_scope` which needs to be initialized later with valid domain memory before user code runs.
* Pretty much every native object constructor now takes a proto/constr pair
* Trait lookup was rewritten to handle this. It's still buggy - seven tests don't work
* `TObject.construct` now actually does the full object construction dance. This allows `ClassObject` to implement the ES4 object construction pathway directly while `FunctionObject` maintains ES3 compatibility.
This is a tentative commit; there are still seven failing tests that I need to fix.
2021-07-20 21:55:25 -04:00
David Wendt
f26f193508
avm2: Store instance derivers as a `Class` property instead of keeping them only as a globals concept
2021-07-20 21:47:00 -04:00
David Wendt
47de2364c1
avm2: Split `Class` and `Function` object types
2021-07-20 21:46:54 -04:00
relrelb
d2eb46d3be
chore: Reserve capacity for vectors
...
This avoids unnecessary re-allocations and thus should improve
performance in both memory and time terms.
2021-07-20 16:25:23 -07:00
dependabot[bot]
ca2d17ade6
chore: Bump env_logger from 0.8.4 to 0.9.0
...
Bumps [env_logger](https://github.com/env-logger-rs/env_logger ) from 0.8.4 to 0.9.0.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases )
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md )
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.4...v0.9.0 )
---
updated-dependencies:
- dependency-name: env_logger
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-07-19 23:49:40 +03:00
relrelb
536526a342
avm1: Rename `set_watcher` and `remove_watcher` to `watch` and `unwatch`
...
This better reflects their correspondence to `Object.watch` and
`Object.unwatch` respectively.
2021-07-18 23:19:19 +03:00
relrelb
e8e0467673
avm1: Replace `get` + `call` with `call_method`
2021-07-18 23:19:19 +03:00
relrelb
3576a199cd
avm1: Replace `set` + `set_attributes` with `define_value`
2021-07-18 23:19:19 +03:00
relrelb
c609fa937d
avm1: Remove unnecessary type annotations
2021-07-18 23:19:19 +03:00
relrelb
ea73dbc367
avm1: Remove `StageObject::as_executable`
...
It was identical to the default implementation of `TObject`, and
thus unnecessary.
2021-07-18 23:19:19 +03:00
relrelb
0367f6a8d4
avm1: Correct `ASSetPropFlags`
...
* The properties parameter is evaluated last. This is observable by
the order the `toString`/`valueOf` methods of the parameters are
called.
* Only `null` in the property list parameter configures all properties,
as opposed to `undefined`, `null`, numbers and booleans previously.
* Objects in the property list parameter are not handled specially.
Instead, they're also coerced to string and split by comma.
2021-07-18 20:03:52 +03:00
dependabot[bot]
c241ac6ace
chore: Bump regress from 0.3.0 to 0.4.1
...
Bumps [regress](https://github.com/ridiculousfish/regress ) from 0.3.0 to 0.4.1.
- [Release notes](https://github.com/ridiculousfish/regress/releases )
- [Commits](https://github.com/ridiculousfish/regress/commits )
---
updated-dependencies:
- dependency-name: regress
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 23:37:11 +03:00
relrelb
76849c485e
core: Cleanup `tag_utils.rs`
2021-07-12 23:09:29 +03:00
relrelb
3d7199d81e
core: Remove unused `SwfMovie::from_movie_and_subdata`
2021-07-12 23:09:29 +03:00
Chris Midgley
8e7ce18cc2
avm1: alphabetise text_field properties
2021-07-10 21:19:20 +03:00
Chris Midgley
156a4494aa
avm1: update attributes of text_field properties
2021-07-10 21:19:20 +03:00
Adrian Wielgosik
633c23c7f3
avm2: Do timeout check every 2000 actions, same as avm1
2021-07-09 22:09:13 +02:00
relrelb
1cbbdecccf
swf: Introduce and use `Color::to_rgba`
2021-07-09 19:56:52 +03:00
relrelb
580d8c3562
chore: Use to_le_bytes in more places
2021-07-09 19:56:52 +03:00
relrelb
87e9dda250
chore: Use from_le_bytes in more places
2021-07-09 19:56:52 +03:00
relrelb
29b3225772
core: Fix ADPCM decoder
...
Store samples and steps as i16 instead of i32.
2021-07-09 19:55:09 +03:00
relrelb
25b8013a99
core: Refactor PCM decoder a bit
...
Extract a `read_sample` method to avoid code duplication, and use
the byteorder crate as already done in other places.
2021-07-09 19:52:30 +03:00
Callum Thomson
939d467897
avm1: Correct ToInteger
...
* Coerce objects as well.
* Wrap numbers around i32.
2021-07-09 03:39:07 +03:00
Chris Midgley
ac0fc40345
avm1: implement scroll, maxscroll and bottomScroll for TextField ( #4698 )
...
* tests: add tests for scroll
* avm1: implement scroll, maxscroll, bottomScroll
* chore: fmt
* docs: note that scroll is 1-based
* fix: non-word wrapped text with manual breaks is scrollable
* chore: move magic number to const
* chore: avoid mut with extra if
* chore: moving clamping behaviour into core
* refactor: eagerly compute line data
* fix: make scroll work when text is aligned right
* chore: clippy
* docs: add more information about line_data
* tests: add more test cases for scroll
2021-07-08 19:23:30 +02:00
EmperorBale
d334e30259
avm1: Fix apply_to_display_object ( #4377 ) ( #4743 )
...
* avm1: Fix apply_to_display_object
2021-07-06 17:32:14 +02:00
TÖRÖK Attila
20080dda4e
Fix minor bug/typo in `action_get_url_2`
...
The current version just doesn't make any sense.
The fixed version is akin to the `target.starts_with("_level") && target.len() > 6` line a bit earlier in this file.
2021-07-03 22:43:29 +02:00
relrelb
3a43957db5
chore: Minor cleanups
2021-07-03 17:26:34 +03:00
relrelb
169c79fa3a
chore: Minor cleanups
2021-06-26 23:05:11 +03:00
relrelb
e3f1fe2004
chore: Prefer spelling "Graphic"
2021-06-24 14:36:45 +03:00
relrelb
7b37bf6809
chore: Avoid spelling "movieclip"
...
* Prefer "MovieClip" in comments.
* Prefer "mc" for variable names.
2021-06-24 14:36:45 +03:00
relrelb
8b35aad657
core: Take advantage of or patterns
...
Rust 1.53.0 ships with or patterns, which allow a little more
elegant code:
https://blog.rust-lang.org/2021/06/17/Rust-1.53.0.html#or-patterns
2021-06-24 01:15:22 -07:00
relrelb
3845679e6c
core: Remove `branch = "main"` in Cargo.toml
...
Cargo no longer assumes the default `HEAD` of git repositories is named
`master` (https://blog.rust-lang.org/2021/06/17/Rust-1.53.0.html#head-branch-name-support-in-cargo ).
This means we no longer need to specify `branch = "main"`.
2021-06-24 01:15:22 -07:00
relrelb
59970bf7ac
avm1: Shorten integers values
...
The .0 suffix can be omitted since into() supports integers as well.
2021-06-24 01:11:16 -07:00
relrelb
38a2650c0e
chore: Use Value into() in more places
2021-06-24 01:11:16 -07:00
Adrian Wielgosik
1a132eb22d
avm1: Don't attempt to serialize MovieClips
2021-06-23 19:18:49 -07:00
relrelb
0fd1c05fd5
chore: Use into() in more places
2021-06-22 11:49:41 -07:00
relrelb
13977d9d22
avm1: Correct some Array set_length cases
...
Array builtins (pop, shift, unshift) doesn't update the length of
non-Array objects. However, push does update the length for all
objects.
2021-06-22 10:43:10 -07:00
relrelb
c383b70336
avm1: Merge array_function with constructor
2021-06-22 10:43:10 -07:00
relrelb
7948d872dc
avm1: Correct AsBroadcaster removeListener
2021-06-22 10:43:10 -07:00
relrelb
8742f288cb
avm1: Correct AsBroadcaster addListener
2021-06-22 10:43:10 -07:00
relrelb
b0b48b5b0c
avm1: Cleanup ScriptObject constructors
2021-06-22 10:43:10 -07:00
relrelb
ab5f5b4878
avm1: Use custom array index parsing method
...
Indices can be of arbitrary size (by overflowing around i32), but
Rust's `parse` is limited to the i32 range.
2021-06-22 10:43:10 -07:00
relrelb
95c30b85e1
avm1: Extract ArrayObject
2021-06-22 10:43:10 -07:00
Chris Midgley
b7de03b5c8
avm1: implement hscroll and maxhscroll for TextField
2021-06-22 01:43:02 -07:00
EmperorBale
1ee61cca57
avm2: ByteArray updates
2021-06-22 01:26:27 -07:00
danharris-stu
e010775099
core: Fix documentation spelling
2021-06-21 20:57:49 +03:00
dependabot[bot]
a66dce3548
chore: Bump rand from 0.8.3 to 0.8.4
...
Bumps [rand](https://github.com/rust-random/rand ) from 0.8.3 to 0.8.4.
- [Release notes](https://github.com/rust-random/rand/releases )
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-random/rand/compare/0.8.3...0.8.4 )
---
updated-dependencies:
- dependency-name: rand
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-20 03:10:42 -07:00
dependabot[bot]
c22c18b809
chore: Bump bitstream-io from 1.0.0 to 1.1.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/commits )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-20 03:10:31 -07:00
Mike Welsh
e886756aab
avm1: Wire up _soundbuftime
...
Store the `_soundbuftime` property in the audio manager. This is
currently unused by Ruffle, but the value will now be stored.
2021-06-20 01:25:27 -07:00
Mike Welsh
e3d0538999
core: Add AudioManager::stream_buffer_time
2021-06-20 01:25:27 -07:00
relrelb
6d1b6009e8
avm1: Use bitflags for ChannelOptions
2021-06-18 15:30:09 -07:00
Adrian Wielgosik
867b7ffcad
core: Preallocate bitmaps for remaining cases in decode_define_bits_lossless
2021-06-17 15:43:36 -07:00
Mike Welsh
09b86cda8b
avm1: Implement ToggleHighQuality op
...
Wire up the op so that it affects the quality setting, although the
setting is still unused by Ruffle.
This op will remember whether the stage was in `High`/`Best` quality.
Split out the "bitmap downsampling" flag in `Stage` so that we can
persist this state.
2021-06-17 13:55:56 -07:00
Mike Welsh
eb12a3af17
avm1: Wire up _highquality
2021-06-17 13:55:56 -07:00
Mike Welsh
9357fd7b4f
avm2: Wire up Stage.quality
2021-06-17 13:55:56 -07:00
Mike Welsh
9370b84092
avm1: Wire up _quality
2021-06-17 13:55:56 -07:00
Mike Welsh
ee8439e55c
core: Add Stage::quality
2021-06-17 13:55:56 -07:00
Mike Welsh
a1ceb07bec
core: Fix PlaceObjectAction::Replace in gotos ( fix #4545 )
2021-06-16 20:57:43 -07:00
Mike Welsh
622f35eb71
core: Pump action queue after handling an event
2021-06-16 12:42:49 -07:00
Mike Welsh
e2659e451c
core: Fire button events after mouse move events
2021-06-16 12:42:49 -07:00
Mike Welsh
71024939e3
core: Remove self_node parameter from DisplayObject::mouse_pick
2021-06-16 12:42:49 -07:00
Mike Welsh
6894382e8e
avm1: Implement _droptarget
2021-06-16 12:42:49 -07:00
Mike Welsh
495f8d90e6
avm1: Implement dragOver/dragOut button events
2021-06-16 12:42:49 -07:00
Mike Welsh
6de7ee1a8c
core: Support drag events with magic button frame labels
2021-06-16 12:42:49 -07:00
Mike Welsh
90024a1266
core: Wire up dragOver/dragOut events for buttons
2021-06-16 12:42:49 -07:00
Mike Welsh
b0143ff918
core: Add Player::mouse_pressed_object
2021-06-16 12:42:49 -07:00
Mike Welsh
2f25887080
avm1: SetTarget of a removed clip is invalid
...
A `SetTarget` call should ignore any clip that has been removed.
This can happen in cases such as `tellTarget("_root")` seeking
to a frame where the clip no longer exists.
Fixes this issue:
https://github.com/ruffle-rs/ruffle/pull/4452#issuecomment-860747028
2021-06-14 14:04:28 -07:00
Mike Welsh
ed1bfd74fe
core: keyPress events take precedence over text input
2021-06-14 14:04:28 -07:00
Mike Welsh
4687eb6d4e
core: Ensure bitmaps run post_instantiate
2021-06-14 14:04:28 -07:00
Mike Welsh
1f96af6b64
core: Add Avm1::exec_list to manage global list of display objects
2021-06-14 14:04:28 -07:00
dependabot[bot]
cf4a1136c5
chore: Bump env_logger from 0.8.3 to 0.8.4
...
Bumps [env_logger](https://github.com/env-logger-rs/env_logger ) from 0.8.3 to 0.8.4.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases )
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md )
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.3...v0.8.4 )
---
updated-dependencies:
- dependency-name: env_logger
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 00:47:57 -07:00
dependabot[bot]
1b6b4964c9
chore: Bump syn from 1.0.72 to 1.0.73
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.72 to 1.0.73.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.72...1.0.73 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 00:47:40 -07:00
Mike Welsh
83f842faf9
avm1: Implement MovieClip.beginBitmapFill
2021-06-13 20:03:53 -07:00
Mike Welsh
554aa7fd63
core: Add backend::render::BitmapSource trait
...
This interface handles returning a bitmap given an ID and is used
by the render backend to get the bitmap used for a bitmap fill.
This will allow for bitmap fills in the drawing API, as these will
manage their own list of bitmaps.
This also removes the MovieLibrary dependency from render backends
and will allow for better decoupling in the future.
2021-06-13 20:03:53 -07:00
Chris Midgley
b6a2738dab
core: support magic button labels for avm1
2021-06-13 10:46:24 -07:00
Adrian Wielgosik
7d1bd57066
avm1: Call ContextMenu.onSelect before preparing context menu items
2021-06-13 10:37:38 -07:00
relrelb
9c5b9b7072
avm1: Rewrite TObject array methods
2021-06-13 10:37:15 -07:00
Mike Welsh
3b215d6c76
core: Use swf::ClipEventFlag in stored clip event handlers
...
* Rename movie_clip::ClipAction to movie_clip::ClipEventHandler.
* Store the swf::ClipEventFlag event flags that trigger the event
directly in the event handler. Previously we split up any event
that had multiple event flags into separate events. Now these
can be kept as a single event.
* Remove `MovieClip::has_button_event`, and instead store the
union of all event flags in `MovieClip::clip_event_flags`. This
will be useful for other cases in the future.
2021-06-11 12:54:53 -07:00
relrelb
ede9650899
chore: Avoid unused_variables annotations
...
Instead prefix the unused variables with an underscore.
2021-06-11 16:16:53 +03:00
Mike Welsh
5462b8a522
core: Allow MorphShapes and Texts to be replaced via PlaceObject
...
PR #4540 allowed shapes to replace their inner art handles via
replace PlaceObject tags. This can also happen for morph shapes and
static texts.
Add MorphShape::replace_with and Text::repalce_with. This fixes the
incorrect art in main menu buttons of Super Mario 63.
2021-06-09 23:37:38 -07:00
Mike Welsh
4fc9225e8f
avm2: Only construct Shapes once
...
Shape objects were mistakenly being reconstructed each frame in
`Graphic::construct_frame`.
2021-06-08 19:47:16 -07:00
Mike Welsh
b1318ecb01
core: PlaceObjectAction::Replace swaps out graphic handles
...
A `PlaceObjectAction::Replace` signals that a shape should
be swapped with a different shape. Previously we instantiated a
completely new `Graphic`, but this is incorrect; instead the
underlying shape handle should be swapped out, but the outer object
remains. This is visible in AVM2 where you can access `Shape` as
a normal display object.
2021-06-08 19:47:16 -07:00
Mike Welsh
93e83d7ad5
avm1: DefineFunction should respect case sensitivity
2021-06-08 16:51:59 -07:00
Mike Welsh
21c351fe5b
swf: Change Twips::zero fn to Twips::ZERO const
2021-06-08 14:57:15 -07:00
Mike Welsh
d23ea90459
swf: Change Matrix to use Fixed16 for a, b, c, d
...
Matrices in an SWF file store their scale/skew components in
in 16.16 format (fbits).
Split `ruffle_core::Matrix` and `swf::Matrix`. `swf::Matrix` now
stores its data as `Fixed16` instead of immediately converting to
`f32`.
2021-06-08 14:57:15 -07:00
relrelb
39decde5bc
avm1: Refactor ScriptObject::get_local
2021-06-08 10:48:50 -07:00
relrelb
1c0007f34f
avm1: Make TObject::get_local return Option
2021-06-08 10:48:50 -07:00
relrelb
15fa92a9fb
avm1: Add TObject::set_local
2021-06-08 10:48:50 -07:00
relrelb
c9d015d7c5
avm1: Cleanup some TObject methods
2021-06-08 10:48:50 -07:00
dependabot[bot]
2f1dc0cbb1
chore: Bump approx from 0.4.0 to 0.5.0
...
Bumps [approx](https://github.com/brendanzab/approx ) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/brendanzab/approx/releases )
- [Commits](https://github.com/brendanzab/approx/compare/v0.4.0...v0.5.0 )
---
updated-dependencies:
- dependency-name: approx
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-07 11:30:59 -07:00
relrelb
b8eae51888
swf: Move num_colors into BitmapFormat::ColorMap8
2021-06-07 11:29:28 -07:00
relrelb
ef2e581f09
core: Use casting instead of ToPrimitive
2021-06-07 11:29:28 -07:00
relrelb
aee37276ec
core: Replace num_enum with num_derive
2021-06-05 10:19:31 -07:00
relrelb
f82faf9603
chore: Appease clippy
2021-06-05 10:16:00 -07:00
Adam Gashlin
ba83f17ef7
core: Set init_object after first run_frame ( fix #2084 , #3414 )
2021-06-02 23:28:24 -07:00
dependabot[bot]
83243acc37
chore: Bump regress from 0.2.0 to 0.3.0
...
Bumps [regress](https://github.com/ridiculousfish/regress ) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/ridiculousfish/regress/releases )
- [Commits](https://github.com/ridiculousfish/regress/commits )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-31 10:06:11 -07:00
Mike Welsh
f173b81e38
swf: Use bitflags for Function flags
2021-05-30 22:14:32 -07:00
Mike Welsh
2b98c878f0
swf: Use Fixed in more places
2021-05-30 21:24:03 -07:00
Adrian Wielgosik
34d54dbc05
avm1: Fix string methods handling of negative args ( fix #4437 )
...
* Improve string.substr handling of negative args
* Add tests for more substr() combinations
2021-05-30 12:04:17 -07:00
Mike Welsh
1304b2c55a
avm2: Move Object properties to Object.prototype
2021-05-24 17:52:15 -07:00
Moulins
af5694b642
[avm1] extend impl_custom_object! to reduce boilerplate
...
This add two knobs to the impl_custom_object! macro:
- `set(...)`, for using a specific prototype in the `set`
method;
- `bare_object(...)`, for objects that are convertible to a raw object
type.
2021-05-24 17:06:47 -07:00
Mike Welsh
3ddb97d2f6
core: Add SwfMovie::frame_rate and num_frames
2021-05-23 23:02:38 -07:00
Mike Welsh
172ad82aa5
core: Add SwfMovie::uncompressed_len
2021-05-23 23:02:38 -07:00
Mike Welsh
077c7f045e
core: Add SwfMovie::stage_size
...
Change `SwfMovie::width` and `height` to return `Twips`.
2021-05-23 23:02:38 -07:00
Mike Welsh
bec6eb9dd3
core: Use SwfMovie::avm_type instead of MovieLibrary::avm_type
2021-05-23 23:02:38 -07:00
Mike Welsh
e1439f4105
swf: Add HeaderExt struct providing additional info
...
When reading an SWF, search for FileAttributes and
SetBackgroundColor and return this along with the header data
because it's useful (in particular, the AS3 flag).
2021-05-23 23:02:38 -07:00
Chris Midgley
aa7dc50385
core: Handle visible flag from PlaceObject ( fix #3403 )
2021-05-23 11:48:12 -07:00
relrelb
a6387c3c10
core: Fix build without serde feature
...
Previously `cargo build --no-default-features` failed because then
`serde` was not found.
Fix that by not implementing serde's traits in that case, similarly
to `config.rs`.
2021-05-22 22:50:20 -07:00
Mike Welsh
8960414436
swf: Use bitflags for FileAttributes
2021-05-22 15:53:02 -07:00
relrelb
3fbadbe26f
avm1: Remove unnecessary gc_context parameters
...
`add_property_with_case`, `set_watcher` and `remove_watcher` already
take an `activation`, from which the `gc_context` can be retrieved.
2021-05-22 10:49:27 -07:00
Mike Welsh
bb22a5aba2
avm1: Remove extraneous self parameters from MovieClip methods
...
Previously these were used because the methods were on `MovieClipData`
instead of `MovieClip`, but now they are no longer necessary.
2021-05-21 17:50:25 -07:00
relrelb
7717b97027
avm1: Remove unnecessary calls to create_bare_object
...
In favor of ScriptObject::object and ScriptObject::array, which
always succeed.
2021-05-21 16:13:25 -07:00
relrelb
aeb8902f8c
avm1: Remove unused TObject::as_string
2021-05-21 15:27:35 -07:00
Moulins
35b9fb7317
avm1: add property_decl::declare_properties! macro for defining built-ins
...
This allows for reduced boilerplate when defining native methods,
properties, and constants (but not values depending on other runtime
values, like built-ins objects and prototypes).
Also remove ScriptObject::force_set_function (replaced by DeclKind::Method)
2021-05-17 10:34:41 -07:00
dependabot[bot]
00194e351e
chore: Bump serde from 1.0.125 to 1.0.126
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.125 to 1.0.126.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.125...v1.0.126 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 10:13:02 -07:00
Mike Welsh
f478ee7b2f
avm2: Properly implement Avm2Button::hit_test_shape and mouse_pick
...
The hit area is not a proper child of the Avm2Button, so manually
transform the test point into local space before passing it to the
hit area.
2021-05-16 17:53:07 -07:00
Mike Welsh
dfc8c32937
core: Do not include stage transform in DisplayObject::local_to_global_matrix
...
TODO: Eventually we may want to include the stage transform here,
and the deeper ActionScript APIs transform it to remove the stage
scaling.
2021-05-16 17:53:07 -07:00
Mike Welsh
7784d8c099
avm2: Remove some AVM1 leftovers from Avm2Button
2021-05-16 17:53:07 -07:00
Mike Welsh
9b58dac841
avm2: Fix up DisplayObject root and stage properties
...
Move `MovieClip::is_swf` flag to `DisplayObject::is_root`, and use
this flag to handle the behavior of `DisplayObject.root` crawling
upwards until it hits a top-most loaded SWF/Bitmap.
Simplify `root` and `stage` so that they don't have to consider
buttons. Instead, do some trickery to ensure the button's states
see the proper values of `parent`, `root`, and `stage` during
construction.
2021-05-16 17:53:07 -07:00
Mike Welsh
2176e30e22
avm2: Use define_public_builtin_instance_properties for SimpleButton
2021-05-16 17:53:07 -07:00
David Wendt
e555a6b488
avm2: Impl `SimpleButton.useHandCursor`
2021-05-16 17:53:07 -07:00
David Wendt
6f6e2c1b9f
avm2: Impl `SimpleButton.enabled`
2021-05-16 17:53:07 -07:00
David Wendt
514c51510c
avm2: Impl `SimpleButton.trackAsMenu`
2021-05-16 17:53:07 -07:00
David Wendt
b383aec78d
tests: Move the button tests into the new test directory.
2021-05-16 17:53:07 -07:00
David Wendt
71bb0c901a
avm2: Impl the constructor parameters for `SimpleButton`
2021-05-16 17:53:07 -07:00
David Wendt
a82e78b597
tests: Don't check the `exitFrame` or `frameConstructed` events in the nested test as it appears to fire the events redundantly
2021-05-16 17:53:07 -07:00
David Wendt
cfd95e3b3b
core: `root` and `stage` should yield `None` if an inactive state child of an `Avm2Button` is involved in the parent chain.
2021-05-16 17:53:07 -07:00
David Wendt
169a99397a
core: `stage` also yields the current context's stage if there isn't one in the parent chain and we aren't in a button
2021-05-16 17:53:07 -07:00
David Wendt
bfebc3c78f
core: AVM2Button does not set the parent of the movie until after it's constructors have run
2021-05-16 17:53:07 -07:00
David Wendt
6a9249e52f
core: Store the root of each loaded movie and use it as a last-ditch way to get the root
2021-05-16 17:53:07 -07:00
David Wendt
9ded256c23
core: Implement the AVM2 concept of `stage`.
2021-05-16 17:53:07 -07:00
David Wendt
39e9ef9dc5
core: Implement a separate `avm2_root` method that provides an AS3 notion of root
2021-05-16 17:53:07 -07:00
David Wendt
e4a6a10038
tests: Add tests for what children see as their parent when constructed or shuffled between movie clips and buttons
2021-05-16 17:53:07 -07:00
David Wendt
a9d7b30dc2
core: `Avm2Button` should unparent any added children
2021-05-16 17:53:07 -07:00
David Wendt
082ecb16cb
core: `avm2_parent` always returns a container, or nothing.
2021-05-16 17:53:07 -07:00
David Wendt
157ced3dc3
core: Split the parent accessor further into `parent` and `avm1_parent`.
...
`parent` is now a bare accessor, `avm1_parent` returns what AVM1 thinks the parent should be, and `avm2_parent` returns what AVM2 thinks the parent should be.
2021-05-16 17:53:07 -07:00
David Wendt
f90cfb3bd0
core: Ensure sprite children get linked up correctly
2021-05-16 17:53:07 -07:00
David Wendt
5274df11f7
core: `Shape` should always expose it's defining movie instead of punting to the parent clip
2021-05-16 17:53:07 -07:00
David Wendt
826b20e8e4
tests: Don't assert execution order of frame scripts within buttons
2021-05-16 17:53:07 -07:00
David Wendt
ef4de4d0d7
core: Order of events for child `Avm2Button` states is hit-up-down-over.
...
Ok, it's not *actually* that - all our tests actually have different, conflicting information. As far as I can tell there doesn't seem to be a single set order for these; so I'm going to just pick one and then stop testing the order in which states run.
2021-05-16 17:53:07 -07:00
David Wendt
c936ccd4b4
avm2: When constructing new `SimpleButton`s, make sure the display object sees it's AVM2 side, else we replace all it's contents with AVM1 objects somehow(?!)
2021-05-16 17:53:07 -07:00
David Wendt
208c191d88
core: `Avm2Button` always runs a frame on set children, even if it's not the current state
2021-05-16 17:53:07 -07:00
David Wendt
bf1fb93b83
core: Allow linking `Avm2Button`'s object
2021-05-16 17:53:07 -07:00
David Wendt
d7deaf5e00
tests: Add currently-failing tests for the `SimpleButton` constructor and order-of-events.
2021-05-16 17:53:07 -07:00
David Wendt
44e82ea480
core: `Avm2Button` fires off events in this order when you set one of it's children:
...
1. `added`/`addedToStage` on the new state
2. `removed` (presumably) on the old state
3. `frameConstructed` on the new state
4. Any frame scripts on the new state
5. `exitFrame` on the new state
This is a rough approximation; I have several tests that fail in weird and interesting ways. Also, this only happens if you set the *active* state; presumably these events are all fired when the state changes but I can't automate tests for that yet.
2021-05-16 17:53:07 -07:00
David Wendt
434563da2f
avm2: `SimpleButton` should build a button when constructed
2021-05-16 17:53:07 -07:00
David Wendt
67c7f156ac
avm2: `instanceof` accepts `null` and `undefined`
2021-05-16 17:53:07 -07:00
David Wendt
7f294f5209
avm2: Constructor-based symbol instantiation should also post-instantiate before constructing a frame
2021-05-16 17:53:07 -07:00
David Wendt
ea80d999da
tests: Add an almost-passing test for buttons with multiple levels of children
2021-05-16 17:53:07 -07:00
David Wendt
07513da3ba
core: State-constructed sprites in `Avm2Button` should be post-instantiated after everything else so they get their instance numbers later
2021-05-16 17:53:07 -07:00
David Wendt
bba2ecae8e
core: `Shape` gets an instance number
2021-05-16 17:53:07 -07:00
David Wendt
3707ef7fec
tests: Add a test for child events using the same timeline structure as the structure test.
2021-05-16 17:53:07 -07:00
David Wendt
11d7fe5107
core: Correct the order of events that are fired when an `Avm2Button` is instantiated on the timeline.
2021-05-16 17:53:07 -07:00
David Wendt
6a70c1b3e0
tests: Extend the simplebutton structure test to include frame 2
2021-05-16 17:53:07 -07:00
David Wendt
a013a7dfdf
core: Initial construction should also prevent normal frame execution first frame
2021-05-16 17:53:07 -07:00
David Wendt
9f5a7f5065
core: AVM2 `Button`s run their children one frame at construction time
2021-05-16 17:53:07 -07:00
David Wendt
bfef7f9969
core: `Avm2Button` should always construct a sprite for each state, even if it's not used.
2021-05-16 17:53:07 -07:00
David Wendt
afefdb892f
tests: Add a test for timeline-constructed AS3 `SimpleButton` contents
2021-05-16 17:53:07 -07:00
David Wendt
821ed25374
avm2: `Avm2Button` should construct it's children
2021-05-16 17:53:07 -07:00
David Wendt
71b87f8935
avm2: Also impl `construct_frame` and `run_frame_scripts` for `Avm2Button`
2021-05-16 17:53:07 -07:00
David Wendt
4869ec650e
core: `Avm2Button` should construct a sprite whenever there's anything other than one child
2021-05-16 17:53:07 -07:00
David Wendt
c317d77916
core: `Avm2Button` shouldn't try to construct a Sprite using it's prototype
2021-05-16 17:53:07 -07:00
David Wendt
10bed4fe30
core: `set_avm2_constructor` works on constructors, not prototypes
2021-05-16 17:53:07 -07:00
David Wendt
d049ba8c0f
core: Child instantiation should print the error message it got when it fails
2021-05-16 17:53:07 -07:00
David Wendt
25473ac1dc
core: Allow AVM2 movies to define `Avm2Button` characters in their libraries
2021-05-16 17:53:07 -07:00
David Wendt
cb44554135
avm2: Add setters and getters for the four states of `SimpleButton`
2021-05-16 17:53:07 -07:00
David Wendt
494083673c
core: Add AVM2 version of Button
2021-05-16 17:53:07 -07:00
David Wendt
22eac776be
avm2: Stub `flash.display.SimpleButton`
2021-05-16 17:53:07 -07:00
David Wendt
cffa739a54
avm2: Store the sprite proto
2021-05-16 17:53:07 -07:00
David Wendt
c0296d9963
core: Rename `Button` to `Avm1Button`
2021-05-16 17:53:07 -07:00
Reiner Gerecke
efdb9c153d
core: Fix endless loop when layouting text
...
If a textfield has word wrapping enabled, is very small in size and
tries to layout a single character onto it, the layout code can run into
an endless loop where it's creating new lines and trying to fit the text
again.
If text doesn't fit at the start of a line, it won't fit on the next
either, so abort and display the whole text span on the line. Text will
be cut-off.
This can be reproduced with a AS2 file like this:
class Test {
static var app : Test;
function Test() {
_root.createTextField("tf",0,0,0,6,20);
_root.tf.text = "0";
_root.tf.wordWrap = true;
}
static function main(mc) {
app = new Test();
}
}
Build it with `mtasc -main -header 100💯 30 test.as -swf test.swf`
2021-05-15 18:56:51 -07:00
Mike Welsh
69a0700ca1
core: Remove collect::CollectWrapper
...
No longer necessary, it is possible to mark individual fields
as `#[collect(require_static)]`.
2021-05-13 23:24:10 -07:00
Mike Welsh
b882284fc9
core: Use bitflags for HitTestOptions
2021-05-12 23:02:06 -07:00
relrelb
85b234003f
avm1: Handle undefined/empty method name in NewMethod
...
Seems like it behaves similarly to CallMethod with an undefined/empty
method name.
2021-05-12 20:47:06 -07:00
relrelb
2589ecdde0
avm1: Correct ImplementsOp
2021-05-12 20:47:06 -07:00
relrelb
3bf3f1015d
avm1: Return undefined on invalid count in InitArray and InitObject
...
Both InitArray and InitObject should bail-out without popping anything
off the stack when the elements/properties count is negative or greater
than or equals 2147483648.
2021-05-12 20:47:06 -07:00
relrelb
72531eddff
avm1: Cleanup CallMethod
2021-05-12 20:47:06 -07:00
relrelb
2e0bc78cd6
avm1: Fix variadic arguments
...
Previously, if the arguments count was greater than the actual
stack size, then a stack underflow occurred which resulted in a
sequence of undefined values. That didn't match Flash's behavior.
Also, this prevents potential huge allocations that hang Ruffle.
In addition, num_args seems like it should use coerce_to_u32
(wraps at 4294967297). This also means that -1 ends up acting like
u32::MAX and would pop all values off of the stack.
2021-05-12 20:47:06 -07:00
dependabot[bot]
62301dea54
chore: Bump syn from 1.0.71 to 1.0.72
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.71...1.0.72 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 09:40:26 -07:00
Mike Welsh
6051ee4cb1
core: Disallow .. in shared object paths ( fix #3961 )
...
Toss out any shared objects that contain ".." in the name
to avoid accessing files outside of the Ruffle data directory.
The DiskStorageBackend also will fail any requests with a ".."
component as an extra precaution.
Fixes #3961 .
2021-05-09 23:20:32 -07:00
CUB3D
61298b2be3
avm1: Add parsing of legacy json SharedObjects for backwards compatability
2021-05-09 23:20:32 -07:00
CUB3D
f4a9446829
avm1: Fix tests for SharedObject
2021-05-09 23:20:32 -07:00
CUB3D
c398aded68
chore: Remove debug printing
2021-05-09 23:20:32 -07:00
CUB3D
cd1cde1708
avm1: Implement de/serialization of shared objects into Flash Player Lso format
2021-05-09 23:20:32 -07:00
relrelb
6b6b335440
avm1: Use bitflags for Array.sort flags
2021-05-08 01:37:05 -07:00
Mike Welsh
ba7fd1b2b9
chore: Appease clippy, bump url
...
Bump url and avoid `Url::into_string` deprecation warnings.
Fix `single_char_pattern` clippy lints.
2021-05-07 20:51:26 -07:00
relrelb
b2bc24919a
avm1: Replace `current_swf_version` with `swf_version`
...
They happen to be identical, and `swf_version` is more idomatic.
2021-05-07 13:26:20 -07:00
Mike Welsh
ef617eebad
avm1: Use `set_html_text` when initializing textfield from a variable binding
...
If a textfield was created with a variable binding, and the variable
already existed, the initial text of the textfield is set to the
variable value. However, this was not obeying the HTML setting of
the text field, so HTML tags were mistakenly shown in some content.
Fixes #3522 .
2021-05-06 16:58:33 -07:00
Adrian Wielgosik
5319a5bb81
Remove lifetime from constants
2021-05-06 10:54:33 -07:00
Adrian Wielgosik
faa0e50e89
avm2: Unify NativeMethod and GenericNativeMethod
2021-05-06 10:54:33 -07:00
Adrian Wielgosik
46ddb9be82
avm2: Generate class traits from const arrays
2021-05-06 10:54:33 -07:00
Adrian Wielgosik
8312243f42
avm2: Don't repeatedly call class.write(mc)
2021-05-06 10:54:33 -07:00
Mike Welsh
b82391726f
avm1: MovieClip.getBytesLoaded/Total should return the clip's length
...
MovieClip.getBytesLoaded and getBytesTotal return the size of that
specific clip, even if it's not a loaded SWF. The previous logic
only returned the size of the parent SWF.
If the clip is an SWF, the uncompressed size of the SWF is returned.
Otherwise, the length of the tag list inside the clip's DefineSprite
tag is returned.
2021-05-04 16:36:56 -07:00
Aaron Hill
08d0829177
Move all SWF tests out of `core` to new `tests` package
...
This allows `regressions_tests.rs` to depend on other crates in the
workspace, such as `render`, without introducing a cyclic dependency.
Split out from #4054
2021-05-04 11:47:59 -07:00
Mike Welsh
f9769451d6
avm1: Handle CDATA sections in XML
2021-05-03 16:23:04 -07:00
Moulins
78627acc92
chore: Move core::property_map to core::avm1::property_map
2021-05-03 13:47:14 -07:00
Moulins
272841729e
core: Replace SwfMovie's PropertyMap by a list of key-value pairs
...
PropertyMap is an AVM1-only concept, and shouldn't be used on cross-VM
types.
2021-05-03 13:47:14 -07:00
Mike Welsh
dca97afdd7
chore: Remove puremp3 feature
...
Wasn't being used, remove the puremp3 dependency.
2021-05-02 19:31:01 -07:00
Adrian Wielgosik
8ca22c1f02
core: Support for custom context menu items on movie root
2021-05-02 15:28:00 -07:00
Chris Midgley
31911d24ab
tests: replace existing shared object test using mtasc
2021-05-01 17:40:01 -07:00
Chris Midgley
c03bc62074
fix: SharedObject data property is not deleteable
2021-05-01 17:40:01 -07:00
Mike Welsh
e8ec02418b
avm2: Fix Array.splice
...
Fix `Array.splice` in cases where elements are added but not
deleted, and when the starting index is larger than the length
of the array.
2021-04-30 13:48:27 -07:00
Mike Welsh
2a46c72bb2
avm1: Fix Array.splice
...
Clamp the index parameters to the length of the array. This fixes
`[].splice(1, 0, 'obj');` to add the object at the proper
position (0, because the start index 1 is larger than the length).
2021-04-30 13:48:27 -07:00
dependabot-preview[bot]
b57e1a14f0
build(deps): bump syn from 1.0.70 to 1.0.71
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.70 to 1.0.71.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.70...1.0.71 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-28 10:02:43 -07:00
David Wendt
041003f256
avm2: Slot lookups don't need the whole trait list, just the first one we find.
2021-04-28 00:01:47 -07:00
David Wendt
fd08a6ebf6
avm2: Instantiate slot traits on `get_slot`, `set_slot` etc.
...
Previously, we only instantiated slot traits when named as a property, which is only half the picture.
2021-04-28 00:01:47 -07:00
David Wendt
e35d1edbf0
avm2: Allow pulling traits by slot id
2021-04-28 00:01:47 -07:00
David Wendt
07db1786f1
tests: Add a test for AVM2 nested closures (which thus tests `newactivation`)
2021-04-28 00:01:47 -07:00
David Wendt
9318028b52
avm2: `newactivation` should return an object which implements the traits listed in the associated method `body`'s trait list
2021-04-28 00:01:47 -07:00
David Wendt
6c5098d3c7
avm2: Fix order in which `setslot` takes it's parameters
2021-04-28 00:01:47 -07:00
Adrian Wielgosik
5a6117722d
core: Also hide playback controls on single-frame SWFs
2021-04-27 16:42:02 -07:00
Adrian Wielgosik
a1737b5922
avm1: Respect menu.builtInItems, but on root clip only
2021-04-27 16:42:02 -07:00
Adrian Wielgosik
c3a16cb992
avm2: Support Stage.showDefaultContextMenu
2021-04-27 16:42:02 -07:00
Adrian Wielgosik
ce4d66e0f4
avm1: support Stage.showMenu
2021-04-27 16:42:02 -07:00
Adrian Wielgosik
41a126885c
web: Minimal context menu buttons for movie control
2021-04-27 16:42:02 -07:00
TÖRÖK Attila
61fddf530e
core/display_object: Correctly draw videos that have different bounds than the size of their actual frame data
2021-04-27 11:49:16 -07:00
Mike Welsh
1f8434aee6
tests: Add test for Stage.scaleMode/align
2021-04-26 01:15:42 -07:00
Mike Welsh
a57f227bda
core: Implement Stage resize events
2021-04-26 01:15:42 -07:00
Mike Welsh
251fd55567
core: Adjust stage size by DPI factor in NoScale scale mode
2021-04-26 01:15:42 -07:00
Mike Welsh
98befe678e
avm2: Add flash.display.StageScaleMode and Stage.scaleMode
2021-04-26 01:15:42 -07:00
Mike Welsh
80bcf68634
avm1: Add StageScaleMode and StageAlign properties to Stage
2021-04-26 01:15:42 -07:00
Mike Welsh
b4717130e3
core: Add StageScaleMode and StageAlign properties to Stage
2021-04-26 01:15:42 -07:00
David Wendt
a877fe8c67
tests: Add a new test for properties unique to the `Stage`
2021-04-26 01:15:42 -07:00
David Wendt
52c3b0f1bc
avm2: `Stage.color` yields background color alpha (always 0xFF) in the high bits of the u32
2021-04-26 01:15:42 -07:00
David Wendt
41fe51e9db
avm2: Impl `flash.display.StageQuality` enum
2021-04-26 01:15:42 -07:00
David Wendt
93d7f0b450
avm2: Stub `Stage.quality`
2021-04-26 01:15:42 -07:00
David Wendt
327a425fde
avm2: Stub `Stage.allowsFullScreen` and `Stage.allowsFullScreenInteractive`
2021-04-26 01:15:42 -07:00
David Wendt
cb167e0814
avm2: Impl `Stage.stageWidth`/`Stage.stageHeight`, sorta
2021-04-26 01:15:42 -07:00
David Wendt
1ee5bbf7ba
avm2: Impl `Stage.frameRate`
2021-04-26 01:15:42 -07:00
David Wendt
5d8f70d695
avm2: Implement `Stage.focus`
2021-04-26 01:15:42 -07:00
David Wendt
524f5fe57f
avm2: Impl `Stage.color`'s setter
2021-04-26 01:15:42 -07:00
David Wendt
6c6bd74af9
avm2: Impl `Stage.displayState`'s getter
2021-04-26 01:15:42 -07:00
David Wendt
ae080fd65f
avm2: Impl `flash.display.StageDisplayState`
2021-04-26 01:15:42 -07:00
David Wendt
b858f74139
avm2: Impl `Stage.contentsScaleFactor`
2021-04-26 01:15:42 -07:00
David Wendt
247f7e3de4
avm2: Impl `Stage.color`
2021-04-26 01:15:42 -07:00
David Wendt
d7a0d15fd8
avm2: Expose `Stage.browserZoomFactor`
2021-04-26 01:15:42 -07:00
David Wendt
0c6584ca03
core: Store the viewport's scale factor on the stage
2021-04-26 01:15:42 -07:00
David Wendt
98788ef194
avm2: Impl `flash.display.StageAlign`
2021-04-26 01:15:42 -07:00
David Wendt
2a30887660
avm2: Support the half-broken `loaderInfo` on the `Stage`
2021-04-26 01:15:42 -07:00
David Wendt
ef4db9ba16
avm2: Add overrides for every property that cannot be set on the `Stage`.
...
Yes, this includes properties that aren't implemented yet. They'll return a different error, but they'll still error out regardless, so I'm fine with this.
2021-04-26 01:15:42 -07:00
David Wendt
bc9affb09d
tests: Add tests for stage access and basic display object properties
2021-04-26 01:15:42 -07:00
David Wendt
716d492006
avm2: The stage's name should be `null`, not an empty string; and setting it should except.
2021-04-26 01:15:42 -07:00
David Wendt
01f74f6eb1
avm2: Add a convenience method for marking a builtin override trait.
2021-04-26 01:15:42 -07:00
David Wendt
8452e23382
avm2: Allow access to the `Stage`, both directly and indirectly
2021-04-26 01:15:42 -07:00
David Wendt
ba66c62947
core: Ensure `Stage` always has an AVM2 representation
2021-04-26 01:15:42 -07:00
David Wendt
81de112774
avm2: Add `Stage` class stub
2021-04-26 01:15:42 -07:00
David Wendt
7f4a99ca60
core: Add a `root_clip` method for `Stage` and make everything grabbing depth 0 off the stage use it
2021-04-26 01:15:42 -07:00
David Wendt
36e486b1d0
core: We don't need `CollectWrapper` anymore
2021-04-26 01:15:42 -07:00
David Wendt
f6fe0a84a2
core: Move the viewport and stage dimensions into the `Stage`.
2021-04-26 01:15:42 -07:00
David Wendt
c09bd0520c
core: Run all of the steps of a frame update on the `Stage`
2021-04-26 01:15:42 -07:00
David Wendt
b021d04345
core: Correct order of viewport bounds in render context
2021-04-26 01:15:42 -07:00
David Wendt
4e4f1dce26
core: `Stage` should render it's children
2021-04-26 01:15:42 -07:00
David Wendt
7341fa0554
core: Remove the explicit view bounding box and instead have all the culling code ask the `Stage` what it's bounding box is
2021-04-26 01:15:42 -07:00
David Wendt
67724bfc71
core: Move most of the player rendering code into the `Stage`'s render method.
2021-04-26 01:15:42 -07:00
David Wendt
44af21b398
core: `Letterbox` should be `Collect`
2021-04-26 01:15:42 -07:00
David Wendt
6bf3206d95
core: Replace `context.levels` with a root stage
2021-04-26 01:15:42 -07:00
David Wendt
0011753914
core: Add the ability to iterate over the depth list of any container
2021-04-26 01:15:42 -07:00
David Wendt
14430b9eb0
core: Add a `Stage` display object type
2021-04-26 01:15:42 -07:00
Mike Welsh
c422a66aa6
chore: Appease clippy
...
Fix `bool_assert_comparison` and `from_iter_instead_of_collect` lints.
2021-04-24 21:42:30 -07:00
Mike Welsh
d43b033caa
tests: Add tests for BitmapData max size
2021-04-24 16:16:24 -07:00
relrelb
bab0ae8f30
avm1: Limit width and height of BitmapData
2021-04-24 16:16:24 -07:00
relrelb
c78501f2bd
avm1: Fix panic in BitmapData.loadBitmap
...
BitmapData.loadBitmap is not subject to the size limit. That is,
it can load larger bitmaps than the BitmapData constructor.
Fix panic for large bitmaps by not invoking the BitmapData constructor
directly. This should also improve performance.
Do the same for BitmapData.clone.
2021-04-24 16:16:24 -07:00
relrelb
2d3a4910fc
avm1: Correct BitmapData constructor
...
* Extract is_size_valid, which respects 3 different limits:
SWF<=9, SWF10 and SWF>=11.
* Delay is_size_valid check after all arguments coercing.
* Swap the transparency and fill_color parameters of init_pixels.
2021-04-24 16:16:24 -07:00
Mike Welsh
d34b72cc47
web: Expose SWF metadata to JavaScript
...
Add `RufflePlayer.metadata` that exposes the SWF header fields to
JavaScript.
Add `RufflePlayer.readyState` and fire a `loadedmetadata` event
once the metadata is available, mimicking the HTML5 media APIs.
2021-04-23 16:58:24 -07:00
Mike Welsh
33a73c5262
tests: Bump test script timeout
2021-04-23 16:57:28 -07:00
Mike Welsh
d58bc9b5c5
core: Disable script timeout in debug builds
2021-04-23 16:57:28 -07:00
David Wendt
f33976f4c0
avm2: Store symbol / class relationships using the class constructor, not the prototype.
2021-04-23 00:26:10 -07:00
David Wendt
0ee9e0f820
tests: Add a test for constructing symbol classes in AVM2
2021-04-23 00:26:10 -07:00
David Wendt
aa6dc600c0
avm2: Treat construction of symbol classes as symbol instantiation.
2021-04-23 00:26:10 -07:00
David Wendt
815d0fb540
core: Add `DisplayObject` method for setting the AVM2 side of a display object
2021-04-23 00:26:10 -07:00
David Wendt
9b19cc1570
Store the movie associated with a given symbol being constructed.
2021-04-23 00:26:10 -07:00
David Wendt
282508a281
core: Make the AVM2 constructor registry global
2021-04-23 00:26:10 -07:00
David Wendt
b1be111a4e
core: Store constructor prototypes in the constructor registry when defining symbols
2021-04-23 00:26:10 -07:00
David Wendt
555d97006a
core: Add an AVM2 constructor registry
2021-04-23 00:26:10 -07:00
David Wendt
68c270e7c0
avm2: Impl `Eq`, `Hash` for `Object` using ptr values
2021-04-23 00:26:10 -07:00
TÖRÖK Attila
3f583088a2
core/avm1: Coerce Rectangle and Point parameter fields to f64 first
2021-04-21 18:46:03 -07:00
TÖRÖK Attila
22306cc8d9
core/avm1: Switch to i32 in BitmapData.merge(), clamp *_mult parameters
2021-04-21 18:46:03 -07:00
TÖRÖK Attila
40eedb6405
core/avm1: Implement BitmapData.merge()
2021-04-21 18:46:03 -07:00
dependabot-preview[bot]
63e8c0c88a
build(deps): bump syn from 1.0.69 to 1.0.70
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.69 to 1.0.70.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.69...1.0.70 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-21 18:31:39 -07:00
Adrian Wielgosik
8176e0a633
avm2: minor changes to domain memory
...
* Do not use as_bytearray_mut when we don't need mutability
* Set default domain memory size to 1024b.
2021-04-21 15:08:13 -07:00
CUB3D
9812fab9f8
chore: Format and fix clippy lints
2021-04-21 00:33:11 -07:00
CUB3D
7c4eb0d7ff
avm2: Implement ApplicationDomain.domainMemory
2021-04-21 00:33:11 -07:00
CUB3D
b3b1e69fc2
avm2: Store ByteArrayObject in Domain rather than ByteArrayStorage
2021-04-21 00:33:11 -07:00
CUB3D
4dc1210b37
avm2: Use try_into for converting slice->array
2021-04-21 00:33:11 -07:00
CUB3D
98d9bd06b6
avm2: Remove more unused code from test
2021-04-21 00:33:11 -07:00
CUB3D
d6a3b5bfda
avm2: Remove unused code from test
2021-04-21 00:33:11 -07:00
CUB3D
397ceed33c
avm2: Dont panic when domain memory not available
2021-04-21 00:33:11 -07:00
CUB3D
136add866a
chore: Fix clippy lints
2021-04-21 00:33:11 -07:00
CUB3D
63120806bf
avm2: Correct Sxi8 and Sxi16
2021-04-21 00:33:11 -07:00
CUB3D
6d2339b151
avm2: Add tests for Op::Sxi1
2021-04-21 00:33:11 -07:00
CUB3D
f34579926c
chore: Format
2021-04-21 00:33:11 -07:00
CUB3D
99edb5ab2b
avm2: Implement Op::Sxi1
2021-04-21 00:33:11 -07:00
CUB3D
9ffa4f1f50
avm2: Implement Op::Lf64
2021-04-21 00:33:11 -07:00
CUB3D
b4736413fa
avm2: Implement Op::Sf64
2021-04-21 00:33:11 -07:00
CUB3D
2b4becf41f
avm2: Implement Op::Lf32
2021-04-21 00:33:11 -07:00
CUB3D
509392db8e
avm2: Implement Op::Sf32
2021-04-21 00:33:11 -07:00
CUB3D
dce2626482
avm2: Use from/to_le_bytes
2021-04-21 00:33:11 -07:00
CUB3D
35d7c5a7e3
chore: Format
2021-04-21 00:33:11 -07:00
CUB3D
ae9d5fd328
avm2: Implement Op::Li32
2021-04-21 00:33:11 -07:00
CUB3D
951d557a90
avm2: Implement Op::Si32
2021-04-21 00:33:11 -07:00
CUB3D
96ad0e3d00
avm2: Implement Op::Li16
2021-04-21 00:33:11 -07:00
CUB3D
aaaf6ace3e
avm2: Implement Op::Si16
2021-04-21 00:33:11 -07:00
CUB3D
f437539f73
avm2: Some domain memory is available by default and error when range invalid
2021-04-21 00:33:11 -07:00
CUB3D
5a0cdf60bc
avm2: Implement Op::Si8 and Op::Li8 badly
2021-04-21 00:33:11 -07:00
CUB3D
12a198f671
avm2: Implement Op::Coerce and add tests
2021-04-21 00:33:11 -07:00
CUB3D
c2969895b2
avm2: Add domain memory tests
2021-04-21 00:33:11 -07:00
CUB3D
89c01dca18
swf: Add support for AVM2 domain memory opcodes
2021-04-21 00:33:11 -07:00
TÖRÖK Attila
46ddc31254
avm2: Call the super initializer of LoaderInfo after construction
2021-04-19 18:16:47 -07:00
Mike Welsh
cbe685f8d5
tests: Update transform test to verify color transform rounding
2021-04-19 15:47:52 -07:00
Mike Welsh
0552d26551
core: Use Fixed8 and i16 for ColorTransform
...
Use the proper types for ColorTransform:
* Fixed8 (8.8) format for multiplicative component
* i16 format for additive component
This matches the behavior of Flash (for example, alpha only changes
in units of 1/256).
2021-04-19 15:47:52 -07:00
dependabot-preview[bot]
9c466c65da
build(deps): bump syn from 1.0.67 to 1.0.69
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.67 to 1.0.69.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.67...1.0.69 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-18 23:54:37 -07:00
relrelb
cd8ab813a4
avm1: Return an unboxed undefined in `TransformObject` constructor
...
This is now possible thanks to #2415 .
2021-04-17 09:27:29 -07:00
relrelb
6d68460196
tests: Expand funky_function_calls
2021-04-17 09:25:24 -07:00