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
relrelb
95cffdc2f9
avm1: Pass undefined this for CallMethod with non-string method_name
...
This isn't the most accurate behavior, since it should be an unboxed
Value, but currently it's not possible due to #843 .
2021-04-17 09:25:24 -07:00
relrelb
6a34070e76
tests: Expand sound
...
Check Sound.duration and Sound.getDuration() for detached sounds.
Check rounding behavior of Sound.duration and Sound.getDuration()
behind a comment because NullAudioBackend doesn't respect durations.
TODO: Uncomment it once NullAudioBackend returns real durations.
2021-04-17 09:11:50 -07:00
relrelb
e3478248ac
avm1: Implement Sound.getDuration() and Sound.setDuration()
...
These seem to be undocumented.
Looks like Sound.getDuration() behaves exactly as Sound.duration,
and Sound.setDuration() does nothing.
2021-04-17 09:11:50 -07:00
relrelb
6310e31023
avm1: Sound.duration should return undefined when no sound is attached
...
Previously it returned 0.
2021-04-17 09:11:50 -07:00
relrelb
4d41297b04
avm1: Remove reduntant new_ret_no_self annotation
...
Per https://rust-lang.github.io/rust-clippy/master/#new_ret_no_self ,
`new_ret_no_self` applies only to functions named `new`.
`TObject::create_bare_object` used to be named `new`, but was renamed
in 79af3ffe44
.
2021-04-16 15:25:22 -07:00
relrelb
1f934c5fc6
avm1: Remove redundant newlines
2021-04-16 15:25:22 -07:00
relrelb
dac60da936
avm1: ValueObject::boxed -> coerce_to_object
2021-04-16 15:25:22 -07:00
relrelb
0f8f0986e9
chore: Use matches!(...) in more places
2021-04-16 15:25:22 -07:00
relrelb
9dc63a7831
core: Remove redundant tuple
2021-04-16 15:25:22 -07:00
relrelb
a2e162be0d
avm1: Add Value::is_primitive
...
This provides a more convenient and readable way compared to
using matches!(Value::Object(_)).
2021-04-16 15:25:22 -07:00
relrelb
2ba6cada5b
avm1: Reserve arguments capacity
...
This prevents unnecessary re-allocations.
2021-04-16 15:25:22 -07:00
Chris Midgley
d89f0bbbfe
fix: looks like contentType is ignored (at least in FP6)
2021-04-16 12:36:49 -07:00
Chris Midgley
ba185418b9
chore: fmt
2021-04-16 12:36:49 -07:00
Chris Midgley
6c619495f4
chore: fix warnings
2021-04-16 12:36:49 -07:00
Chris Midgley
8e6bba1525
avm1: implement send_and_load
2021-04-16 12:36:49 -07:00
Chris Midgley
f1b07bd75b
avm1: set contentType on xml; fix initial contentType on load_vars.
2021-04-16 12:36:49 -07:00
dependabot-preview[bot]
f90d58703a
build(deps): bump pretty_assertions from 0.7.1 to 0.7.2
...
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions ) from 0.7.1 to 0.7.2.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases )
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md )
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.7.1...v0.7.2 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-15 14:30:00 -07:00
Mike Welsh
a45a5c2bcb
avm1: _levelN should shadow children instances with the same name
...
If a child clip is named `_level0`, accessing `_level0` should
return the level and not the child clip.
Move `DisplayObject::get_level_by_path` to `StageObject`, and
change it to return an `Option<Value>`, and return
`Some(Value::Undefined)` if the path is a valid level path but
the level is not occupied. This causes get/set of `_levelN` to
be swallowed, even if the level isn't populated.
2021-04-15 13:49:17 -07:00
Mike Welsh
34886933e5
avm1: Adjust precedence of children in StageObject::get
...
Children instances should shadow display object magic properties.
For example, a child named "_x" will be returned instead of the
parent's _x position in GetMember.
2021-04-15 13:49:17 -07:00
Mike Welsh
9224e85a2d
avm1: Delete2 returns true only if a property was actually deleted
...
This was incorrectly returning true for children instances
(`delete "clip"`).
2021-04-15 13:49:17 -07:00
Mike Welsh
d04989cf49
tests: Update stage_object_children test
...
Add a few tests for shadowing of child instances vs. display
object magic properties (for example, when a child clip is named
"_x" or "_level0").
2021-04-15 13:49:17 -07:00
desuwa
0d6c548be4
tests: Add tests for Player::run_actions at timer callbacks.
2021-04-15 13:48:27 -07:00
desuwa
3030f2098a
avm1: Run Player::run_actions after every timer callback.
2021-04-15 13:48:27 -07:00
EmperorBale
04d80e5e4e
chore: Fix more typos
2021-04-15 00:02:40 -07:00
EmperorBale
0ea02919b3
chore: Fix typo
2021-04-15 00:02:40 -07:00
EmperorBale
d227c6cbce
chore: Fix formatting
2021-04-15 00:02:40 -07:00
EmperorBale
153da75304
tests: Add test for IsType
2021-04-15 00:02:40 -07:00
EmperorBale
cbf8d77006
avm2: Fix IsType
2021-04-15 00:02:40 -07:00
EmperorBale
e4ba4b074a
tests: Add test for AsType
2021-04-15 00:02:40 -07:00
EmperorBale
ca2709f594
avm2: Implement AsType
2021-04-15 00:02:40 -07:00
EmperorBale
17acebb108
chore: Fix formatting
2021-04-15 00:02:40 -07:00
EmperorBale
f459e18b1a
tests: Update regression tests
2021-04-15 00:02:40 -07:00
EmperorBale
1d0c2b78b2
tests: Add test for AsTypeLate
2021-04-15 00:02:40 -07:00
EmperorBale
c0a56b14c0
avm2: Implement AsTypeLate
2021-04-15 00:02:40 -07:00
Mike Welsh
b9d84c0a82
chore: Appease clippy
...
Honor the branches-sharing-code lint.
2021-04-15 00:02:27 -07:00
Mike Welsh
d87be39e3c
avm2: Don't parse "inf" as Infinity
2021-04-14 21:51:48 -07:00
Mike Welsh
b6945395a8
avm1: Don't parse "inf" as Infinity
...
Rust nightly 4/13 allows f64::parse to handle "infinity", case
insensitive. This broke cases such as `Number("Infinity")`, which
should return `NaN` in AVM1.
Additionally, Rust will now print "-0" for negative zero, when
previously it would print "0".
* Return NaN for inf cases ("inf", "-Infinity", "+INF", etc.)
* Add a test for `Number("inf")` (this was also incorrect before
the latest nightly)
* Add a special case for zero in `f64_to_string` to ensure
that -0.0 gets coerced to "0".
For more info, see:
https://github.com/rust-lang/rfcs/issues/1074
2021-04-14 21:51:48 -07:00
Adrian Wielgosik
b2bed7a18d
avm1: Add missing clearTimeout() ( fix #4003 )
2021-04-14 11:02:04 -07:00
Moulins
f9bbe96812
core: Remove extra Option/Results from XmlNode getters
...
This removes some special cases and simplifies the code.
2021-04-11 14:16:48 -07:00
Moulins
ae1a01d181
avm1: Allow XMLNode reparenting ( closes #3962 )
...
`XMLNode.{appendChild, insertNode}` can now be used to move
child nodes from a parent to another.
There are two special cases:
- if the node is already a child of the destination, nothing happens
- if moving the node would create a cycle, nothing happens
2021-04-11 14:16:48 -07:00
relrelb
20d6fcc128
chore: Remove unnecessary type annotations
2021-04-10 18:39:16 -07:00
Mike Welsh
11f40384da
tests: Add test for loading into _root
2021-04-10 13:48:05 -07:00
Mike Welsh
aa0707411c
avm1: Update movie parameters when loading into _root/_level0
...
The movie framerate and dimensions should be changed when a movie
is loaded into _root or level 0.
2021-04-10 13:48:05 -07:00
David Wendt
7a781179aa
core: Move all of the remaining AVM2 object allocation and/or construction into the `construct_frame` step.
2021-04-09 22:24:22 -07:00
David Wendt
dc5b30e460
core: Remove "constructor ran" flag now that we can handle that with a local bool
2021-04-09 22:24:22 -07:00
David Wendt
27d09084fb
core: Use the library's AVM type to determine how to name the root.
...
We cannot check it's constructed AVM value anymore because it is now named before construction.
2021-04-09 22:24:22 -07:00
David Wendt
ebc5c3dd64
avm2: Ensure that objects are only *ever* constructed at frame construction time.
...
This ensures that root movie classes see their children in their constructor.
2021-04-09 22:24:22 -07:00
desuwa
e8de3a5a20
tests: Add tests for `MovieClip.hitTest()` with shapeflag and masks.
2021-04-09 22:11:07 -07:00
desuwa
4f90b9d161
avm1: Support masks when mouse-picking.
2021-04-09 22:11:07 -07:00
relrelb
f8b589fc24
core: Fix panic in remove_invalid_jpeg_data
...
`data` could be shorter than 4 bytes.
2021-04-09 14:47:19 -07:00
desuwa
755409673b
avm2: Add tests for set_width / set_height setting the scale to non-finite values.
2021-04-07 17:42:28 -06:00
desuwa
3c2d467a5f
avm1: Add tests for set_width / set_height setting the scale to non-finite values.
2021-04-07 17:42:28 -06:00
desuwa
fa1fde7083
core: Ensure the new scale is finite when setting the width / height of display objects.
2021-04-07 17:42:28 -06:00
desuwa
b7bf8334b2
core: Run `update_drag` earlier in the update cycle. Fix #1511
2021-04-06 15:48:06 -06:00
relrelb
732efb27c4
render: Fix RGB15 bitmaps decoding
...
Each row should be padded to 2.
2021-04-05 20:10:35 -06:00
David Wendt
5d198952e8
chore: Fix merge conflict mis-resolution
2021-04-05 16:18:37 -06:00
David Wendt
5cba07111e
avm2: Impl `LoaderInfo.parameters`
2021-04-05 16:18:37 -06:00
David Wendt
de1b0d4d0c
core: Add support for an explicit loader URL (though nothing sets it yet) and expose it in `LoaderInfo`.
2021-04-05 16:18:37 -06:00
David Wendt
4eee8be911
avm2: Impl `SWFVersion` enumeration
2021-04-05 16:18:37 -06:00
David Wendt
4c314a47cc
avm2: Impl `LoaderInfo.bytes`
2021-04-05 16:18:37 -06:00
David Wendt
a9328b228f
avm2: Allow writing to `ByteArrayStorage`
2021-04-05 16:18:37 -06:00
David Wendt
f61ea0b290
chore: Clippy beta/nightly compliance
2021-04-05 16:18:37 -06:00
David Wendt
46bf1b33c4
avm2: Impl `LoaderInfo.width`
2021-04-05 16:18:37 -06:00
David Wendt
28a1cb4308
avm2: Impl `LoaderInfo.url`
2021-04-05 16:18:37 -06:00
David Wendt
5941d6cf66
avm2: Impl `LoaderInfo.swfVersion`
2021-04-05 16:18:37 -06:00
David Wendt
6814fb9c22
avm2: Stub `LoaderInfo.isURLInaccessible`
2021-04-05 16:18:37 -06:00
David Wendt
b6e31d8be5
avm2: Impl `LoaderInfo.height`
2021-04-05 16:18:37 -06:00
David Wendt
e795da0358
avm2: Impl `LoaderInfo.frameRate`
2021-04-05 16:18:37 -06:00
David Wendt
cbd167fd6c
avm2: Stub `LoaderInfo.contentType`
2021-04-05 16:18:37 -06:00
David Wendt
76c563146d
tests: Grab `contentType` on frame two
2021-04-05 16:18:37 -06:00
David Wendt
7b7d250ce9
avm2: This is a getter, not a method
2021-04-05 16:18:37 -06:00
David Wendt
2a01260f52
avm2: `bytesLoaded` etc reports the compressed file length, not the uncompressed length
2021-04-05 16:18:37 -06:00
David Wendt
d0ad894f70
avm2: Impl `LoaderInfo.content`
2021-04-05 16:18:37 -06:00
David Wendt
b4cb01d2c9
avm2: Impl `LoaderInfo.bytesTotal`, and `.bytesLoaded`
...
`bytesLoaded` is currently aliased to `bytesTotal` as we do not yet support streaming loads
2021-04-05 16:18:37 -06:00
David Wendt
55e448ebaa
avm2: Impl `LoaderInfo.applicationDomain`
2021-04-05 16:18:37 -06:00
David Wendt
c156cd2a16
tests: Add tests for properties that are only accessible on frame 2
2021-04-05 16:18:37 -06:00
David Wendt
12dcfe7c62
avm2: Impl `LoaderInfo.actionScriptVersion`
2021-04-05 16:18:37 -06:00
David Wendt
1a7b33a1af
avm2: Impl `ActionScriptVersion`
2021-04-05 16:18:37 -06:00
David Wendt
a492c4db4d
tests: Add a test for `LoaderInfo`'s properties
2021-04-05 16:18:37 -06:00
David Wendt
fc26c26d1d
avm2: Allow access to `loaderInfo` on root movies
2021-04-05 16:18:37 -06:00
David Wendt
60c92dde49
avm2: Add Loader Info class & object type
2021-04-05 16:18:37 -06:00
CUB3D
e2f124ee34
avm2: Rename current_position -> instruction_start
2021-04-03 16:37:47 -06:00
CUB3D
c22ebc1de3
chore: Format on stable
2021-04-03 16:37:47 -06:00
CUB3D
d5c2e5559b
avm2: Don't mutably borrow for pos()
2021-04-03 16:37:47 -06:00
CUB3D
96f89a1643
avm2: Implement Op::LookupSwitch
2021-04-03 16:37:47 -06:00
relrelb
2d37f4d23e
avm1: Migrate `search_prototype` to primitive prototype
2021-04-03 12:40:05 -06:00
relrelb
bbded90697
avm1: Rename proto_value to proto
2021-04-01 17:06:07 -06:00
relrelb
89679bba65
avm1: Delete proto and set_proto
...
In favor of the new proto_value and set_proto_value pair.
In the next commit proto_value and set_proto_value will be renamed
to proto and set_proto.
2021-04-01 17:06:07 -06:00
relrelb
2c1dfea3ce
avm1: Migrate Player to proto_value
2021-04-01 17:06:07 -06:00
relrelb
76d80061a7
avm1: Migrate Object to proto_value
2021-04-01 17:06:07 -06:00
relrelb
e712a4fd59
avm1: Migrate FunctionObject to proto_value
2021-04-01 17:06:07 -06:00
relrelb
dc174b9d9f
avm1: Migrate StageObject to proto_value
2021-04-01 17:06:07 -06:00
relrelb
be60aa5941
avm1: Migrate XmlIdMapObject to proto_value
2021-04-01 17:06:07 -06:00
relrelb
ea52562d06
avm1: Migrate XmlAttributesObject to proto_value
2021-04-01 17:06:07 -06:00
relrelb
161db474a2
avm1: Migrate SuperObject to proto_value
2021-04-01 17:06:07 -06:00
relrelb
766a5db31c
avm1: Migrate ScriptObject to proto_value
2021-04-01 17:06:07 -06:00
relrelb
18a32424bd
amv1: Migrate custom_object.rs to proto_value
2021-04-01 17:06:07 -06:00
CUB3D
209b9cec36
chore: Format
2021-03-31 18:36:24 -06:00
CUB3D
ecbf6118bb
avm2: Update tests
2021-03-31 18:36:24 -06:00
CUB3D
9453743f9f
avm2: Add test for Op::EscXElem
2021-03-31 18:36:24 -06:00
CUB3D
0ea564f75c
avm2: Implement Op::EscXAttr and Op::EscXElem
2021-03-31 18:36:24 -06:00
relrelb
e453cbf0ef
tests: Expand object_prototypes
2021-03-31 18:04:52 -06:00
relrelb
e5660bc0c7
avm1: Allow primitive prototypes
...
Prototypes can be primitive, not just objects. However, TObject's
proto() and set_proto() work with Object and not Value. To allow
easier and more incremental migration from Object to Value, this
commit introduces a new pair of proto_value/set_proto_value functions
in TObject, preserving the existing proto/set_proto functions.
Both pairs have default implementations, so it's enough to implement
only one pair in each TObject implementation.
For now only ScriptObject uses the new pair, which fixes the behavior
of incorrectly coercing __proto__ to object.
Follow-up migration plan:
1. Replace all old proto/set_proto implementations by the new
proto_value/set_proto_value in all TObject implementations on a
one-by-one basis.
2. After proto/set_proto become unused, delete them and rename
proto_value/set_proto_value to proto/set_proto for more concise code.
2021-03-31 18:04:52 -06:00
relrelb
014e85b1f0
tests: Expand funky_function_calls
2021-03-31 17:59:58 -06:00
relrelb
5beb0164dd
tests: Cleanup funky_function_calls
2021-03-31 17:59:58 -06:00
relrelb
a3727e0727
avm1: Fix "this" argument conversion in Function.prototype.{call,apply}
...
The "this" argument should fall-back to the global object only for
undefined or null. Other primitives should be coerced to an object
rather than falling-back to the global object.
As a drive-by replace `Vec::new` by `Vec::with_capacity` in
`Function.prototype.apply` to minimize unnecessary reallocations.
2021-03-31 17:59:58 -06:00
CUB3D
8d68dcb562
avm2: Update tests
2021-03-29 20:46:02 -06:00
CUB3D
68527c13da
avm2: Implement flash.utils.getTimer
2021-03-29 20:46:02 -06:00
dependabot-preview[bot]
23af83f923
build(deps): bump syn from 1.0.64 to 1.0.65
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.64 to 1.0.65.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.64...1.0.65 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-27 01:40:26 -07:00
relrelb
7e1acce150
core: Fix build without default features
...
Previously `cargo build --no-default-features` failed because then
neither implementation of `Mp3Decoder` is chosen.
Fix that by not handling mp3 sounds at all in that case.
2021-03-27 01:40:11 -07:00
Mike Welsh
f96a414036
avm2: Lazily initialize Graphics object
...
Initialize a Sprite/Shape's Graphics object on the first access,
so that `shape.graphics == shape.graphics` is `true`.
2021-03-24 13:18:06 -07:00
Mike Welsh
040da925e4
avm2: Fix incorrect color in drawing API
2021-03-24 13:18:06 -07:00
Mike Welsh
9a08b9ae4f
avm2: flash.display.Graphics is final
2021-03-24 13:18:06 -07:00
David Wendt
df466dfba1
core: Start with an empty drawing when a `Shape` is converted into a `Drawing`.
2021-03-24 13:18:06 -07:00
David Wendt
b739b8d786
core: Retain the original `swf::Shape` until dynamic behavior is needed, upon which we switch to using a `Drawing`.
2021-03-24 13:18:06 -07:00
David Wendt
ff028de8de
core: `Drawing` should accept a SWF movie to pull bitmaps from
2021-03-24 13:18:06 -07:00
David Wendt
4238d8bd2a
tests: Add another test for drawing on `MovieClip`
2021-03-24 13:18:06 -07:00
David Wendt
1d57eee369
tests: Add a test for shape drawing
2021-03-24 13:18:06 -07:00
David Wendt
1d64f38bb7
avm2: Impl `drawRect`
2021-03-24 13:18:06 -07:00
David Wendt
60f4f2c534
core: `Graphic` should expose it's `Drawing` for external access
2021-03-24 13:18:06 -07:00
David Wendt
85ee005c0f
core: `Graphic` should always use it's stored `Drawing`'s bounds
2021-03-24 13:18:06 -07:00
David Wendt
e3f2d0f213
avm2: Allow constructing new `Shape`s.
2021-03-24 13:18:06 -07:00
David Wendt
62a779444d
avm2: `graphics` is a `Sprite` property, not a `MovieClip` property
2021-03-24 13:18:06 -07:00
David Wendt
5e7327d041
avm2: Allow drawing on `Shape`s.
2021-03-24 13:18:06 -07:00
David Wendt
e8b6d1a52a
core: Migrate clip drawing commands to exposing the internal `Drawing` to mutation
2021-03-24 13:18:06 -07:00
David Wendt
1a6f401f1f
avm2: Implement `Graphics.moveTo`
2021-03-24 13:18:06 -07:00
David Wendt
15d3a1e99d
avm2: Implement `Graphics.lineTo`
2021-03-24 13:18:06 -07:00
David Wendt
9464a8800a
avm2: Implement `CapsStyle`
2021-03-24 13:18:06 -07:00
David Wendt
f7f98cc69e
avm2: Implement `LineScaleMode`
2021-03-24 13:18:06 -07:00
David Wendt
582d2447cd
avm2: Implement `JointStyle`
2021-03-24 13:18:06 -07:00
David Wendt
6396b90890
avm2: Implement `Graphics.lineStyle`
2021-03-24 13:18:06 -07:00
David Wendt
41ad756792
avm2: Implement `Graphics.endFill`
2021-03-24 13:18:06 -07:00
David Wendt
3dfeeacfcc
avm2: Implement `Graphics.curveTo`
2021-03-24 13:18:06 -07:00
David Wendt
71b6bca100
avm2: Implement `Graphics.clear`
2021-03-24 13:18:06 -07:00
David Wendt
f1febe33b9
avm2: Implement `Graphics.beginFill`
2021-03-24 13:18:06 -07:00
David Wendt
124e144d02
avm2: Add a class for `graphics`
2021-03-24 13:18:06 -07:00
dependabot-preview[bot]
20b2e55171
build(deps): bump gif from 0.11.1 to 0.11.2
...
Bumps [gif](https://github.com/image-rs/image-gif ) from 0.11.1 to 0.11.2.
- [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.1...v0.11.2 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-23 10:03:59 -07:00
dependabot-preview[bot]
19d57941ee
build(deps): bump serde from 1.0.124 to 1.0.125
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.124 to 1.0.125.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.124...v1.0.125 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-23 10:03:17 -07:00
Adrian Wielgosik
c084d575f4
tests: Speed up builds of regression tests
2021-03-20 14:50:57 -07:00
Adrian Wielgosik
2d1c60e02e
avm1: Fix binary operators not returning signed values
...
Also enabled AVM2 test that was forgotten before.
2021-03-20 14:49:55 -07:00
EmperorBale
ac9d27b2fd
avm1: Avoid panic when setMask called with no arguments ( fix #3298 )
2021-03-19 17:25:58 -07:00
Chris Midgley
aa94f6570e
avm1: fix String.substr behaviour for negative lengths ( fix #3626 )
2021-03-19 14:32:04 -07:00
David Wendt
05dc538a25
avm2: Use the actual `FromIterator` trait
2021-03-19 12:39:57 -07:00
David Wendt
1baadb93c2
chore: cargo fmt is fickle
2021-03-19 12:39:57 -07:00
David Wendt
a40755154d
avm2: `TextField` and `TextFormat` are sealed (non-dynamic) classes
2021-03-19 12:39:57 -07:00
David Wendt
6deebf0733
tests: approx the `leading` and `font_size` tests, and increase the epsilon on `autosize` by 1px.
2021-03-19 12:39:57 -07:00
David Wendt
a05423d48c
avm2: Setting a given text property also sets or resets the `html` mode (since it's not a separate property like in AS2)
2021-03-19 12:39:57 -07:00
David Wendt
f5268198b0
avm2: Don't round text metrics (`textWidth` and `textHeight`)
2021-03-19 12:39:57 -07:00
David Wendt
f908eb65fc
tests: Port AS2 edittext tests to AS3.
2021-03-19 12:39:57 -07:00
David Wendt
f188306f4f
avm2: `setTextFormat` is range-checked
2021-03-19 12:39:57 -07:00
David Wendt
78c519cce0
avm2: Don't except when creating a dynamic TextField.
2021-03-19 12:39:57 -07:00
David Wendt
4ef01000a8
avm2: Impl `TextField.setTextFormat`
2021-03-19 12:39:57 -07:00
David Wendt
a115db49ba
avm2: Impl `TextField.setSelection`
2021-03-19 12:39:57 -07:00
David Wendt
7902914aa4
avm2: Impl `TextField.replaceText`
2021-03-19 12:39:57 -07:00
David Wendt
c22f30fdf0
avm2: Impl `TextField.replaceSelectedText`
2021-03-19 12:39:57 -07:00
David Wendt
b4d97ca183
avm2: Impl `TextField.getTextFormat`
2021-03-19 12:39:57 -07:00
David Wendt
f45c9d1889
avm2: Impl `TextField.appendText`
2021-03-19 12:39:57 -07:00
David Wendt
42f717deb8
avm2: Impl `TextField.wordWrap`
2021-03-19 12:39:57 -07:00
David Wendt
4bfc3cfda4
avm2: Impl `TextField.type`
2021-03-19 12:39:57 -07:00
David Wendt
1c2ef3154a
avm2: Impl `TextFieldType`
2021-03-19 12:39:57 -07:00
David Wendt
da563266d5
avm2: Impl `TextField.textHeight` and `TextField.textWidth`
2021-03-19 12:39:57 -07:00
David Wendt
8165aa5c4a
avm2: Impl `TextField.textColor`
2021-03-19 12:39:57 -07:00
David Wendt
c0a2547be3
avm2: Impl `TextField.text`
2021-03-19 12:39:57 -07:00
David Wendt
dee937ac3a
avm2: Impl `TextField.selectable`
2021-03-19 12:39:57 -07:00
David Wendt
b6a1bf80c1
avm2: Impl `TextField.multiline`
2021-03-19 12:39:57 -07:00
David Wendt
053b6bd4cc
avm2: Impl `TextField.length`
2021-03-19 12:39:57 -07:00
David Wendt
1ce868c51e
avm2: Impl `TextField.htmlText`
2021-03-19 12:39:57 -07:00
David Wendt
89c131bf52
avm2: Impl `TextField.embedFonts`
...
This assumes `embedFonts` is the opposite of device fonts, which sounds reasonable.
2021-03-19 12:39:57 -07:00
David Wendt
62ec106afb
avm2: Impl `TextField.displayAsPassword`
2021-03-19 12:39:57 -07:00
David Wendt
fa5145b884
avm2: Impl `TextField.defaultTextFormat`
2021-03-19 12:39:57 -07:00
David Wendt
3d8bf90794
core: Also allow converting `TextFormat` back into an AVM2 object.
2021-03-19 12:39:57 -07:00
David Wendt
3d2d2072af
avm2: Impl `TextFormatAlign`
2021-03-19 12:39:57 -07:00
David Wendt
e10726ef1c
core: Add utilities for converting an AVM2 object into a `TextFormat`
2021-03-19 12:39:57 -07:00
David Wendt
50f992b9e6
avm2: Implement `TextField.borderColor`
2021-03-19 12:39:57 -07:00
David Wendt
8913297514
avm2: Fix type of `TextField.backgroundColor`
2021-03-19 12:39:57 -07:00
David Wendt
8d1e0992b5
avm2: Impl `TextField.border`
2021-03-19 12:39:57 -07:00
David Wendt
436b3b2ed3
avm2: Impl `TextField.backgroundColor`
2021-03-19 12:39:57 -07:00
David Wendt
a84acd55c3
avm2: Impl `TextFieldAutoSize`
2021-03-19 12:39:57 -07:00
David Wendt
e35f66fafe
avm2: Impl `TextField.autoSize`
2021-03-19 12:39:57 -07:00
David Wendt
b6adc18c9c
avm2: Impl `flash.text.TextFormat`
2021-03-19 12:39:57 -07:00
David Wendt
f44e54246d
avm2: Text fields on AVM2 movies should have AVM2 objects.
2021-03-19 12:39:57 -07:00
David Wendt
9e739f8ceb
avm2: Ensure constructed text fields have a DisplayObject side
2021-03-19 12:39:57 -07:00
David Wendt
b71286f1c4
avm2: Stub `flash.text.TextField`
2021-03-19 12:39:57 -07:00
relrelb
cdb2c279c0
avm2: Implement Nop
2021-03-19 12:39:23 -07:00
relrelb
72626825d3
tests: Expand bitmap_data
2021-03-18 22:04:39 -07:00
relrelb
3b6f0f0ced
avm1: Fix color_bounds_rect
2021-03-18 22:04:39 -07:00
Aaron Hill
d3744d28df
Derive `Collect` for `ActionQueue`
2021-03-18 21:56:04 -07:00
dependabot-preview[bot]
069096e3e7
build(deps): bump syn from 1.0.63 to 1.0.64
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.63 to 1.0.64.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.63...1.0.64 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-18 18:33:14 -07:00
Callum Thomson
a570d96433
avm2: Implement flash.geom.Point ( #3681 )
2021-03-18 12:03:04 -07:00
Adrian Wielgosik
1aa77b04fe
avm1: Reduce frequency of timeout checks by 10+ times
2021-03-13 01:19:58 -08:00
relrelb
d16d142c60
chore: Appease clippy
2021-03-13 00:56:04 -08:00
relrelb
e594f602b6
chore: Twips::new(0) -> Twips::zero()
2021-03-13 00:56:04 -08:00
dependabot-preview[bot]
934f95cd52
build(deps): bump syn from 1.0.62 to 1.0.63
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.62 to 1.0.63.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.62...1.0.63 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-09 12:25:56 -08:00
dependabot-preview[bot]
8bd13203a1
build(deps): bump pretty_assertions from 0.6.1 to 0.7.1
...
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions ) from 0.6.1 to 0.7.1.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases )
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md )
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.6.1...v0.7.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-09 12:25:47 -08:00
relrelb
866e143073
chore: Cleanup bounds related code
2021-03-08 14:34:26 -08:00
EmperorBale
4d7b2fa1b9
avm1: Fix #3446
...
Thanks!
2021-03-08 00:52:35 -08:00
TÖRÖK Attila
339d0330a2
avm1: Fix seeking
...
The problem was most likely with negative relative offsets
2021-03-08 00:49:16 -08:00
relrelb
8f21c17683
chore: Rename MutationContext parameters to gc_context
2021-03-06 23:30:06 -08:00
relrelb
8318d4d0ed
chore: Remove unnecessary context parameters
2021-03-06 23:30:06 -08:00
relrelb
fff6eb2ffd
chore: Use bitflags set method
2021-03-06 23:30:06 -08:00
dependabot-preview[bot]
d8c140fce1
build(deps): bump syn from 1.0.61 to 1.0.62
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.61 to 1.0.62.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.61...1.0.62 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-06 23:28:38 -08:00
dependabot-preview[bot]
c4af8114d0
build(deps): bump serde from 1.0.123 to 1.0.124
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.123 to 1.0.124.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.123...v1.0.124 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-05 22:29:54 -08:00
EmperorBale
b68eeeae26
avm2: Implement ByteArray
2021-03-05 15:01:02 -08:00
desuwa
0d98fe8b7c
core: Clear masker/maskee properties when unloading objects
2021-03-05 14:15:25 -08:00
dependabot-preview[bot]
b586c7f74e
build(deps): bump indexmap from 1.6.1 to 1.6.2
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.6.1 to 1.6.2.
- [Release notes](https://github.com/bluss/indexmap/releases )
- [Commits](https://github.com/bluss/indexmap/compare/1.6.1...1.6.2 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-05 14:10:36 -08:00
dependabot-preview[bot]
b6559214b8
build(deps): bump syn from 1.0.60 to 1.0.61
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.60 to 1.0.61.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.60...1.0.61 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-05 10:31:55 -08:00
TÖRÖK Attila
873736950e
core/avm1: Implement BitmapData.paletteMap()
2021-03-03 05:26:24 -08:00
paq
922998b4a2
tests: Add test for RegExp's exec
2021-03-03 03:37:34 -08:00
paq
71588b32f1
tests: Add test for RegExp's test
2021-03-03 03:37:34 -08:00
paq
ae2de6315d
tests: AVM2 RegExp constructor and flags
2021-03-03 03:37:34 -08:00
paq
d866f73c5e
avm2: Implement RegExp
2021-03-03 03:37:34 -08:00
paq
b8c1f1627a
chore: Add `regress` crate for implementing RegExp class.
2021-03-03 03:37:34 -08:00
David Wendt
999100a332
avm2: Only track broadcast lists for events that are actually broadcasts.
2021-03-03 03:08:01 -08:00
David Wendt
540a68fb68
avm2: Grant each event it's own, separate broadcast list.
2021-03-03 03:08:01 -08:00
David Wendt
8e8de09f63
core: Ensure absolutely nothing runs in frame scripts unless the object is AVM2.
2021-03-03 03:08:01 -08:00
David Wendt
d90ad1ab08
core: Account for the fact that AVM2 constructs objects far earlier than the frame number advances.
...
This is most certainly *not* the correct behavior; though it does work. If I track the frame number in event handlers we can see it change before `enterFrame` is broadcast. However, when I tried to do that, all hell broke loose and every AVM1 and AVM2 test failed (gating the behavior to AVM2 did *not* help).
2021-03-03 03:08:01 -08:00
David Wendt
a5b4e168d3
avm2: Stub `flash.display.Shape`.
2021-03-03 03:08:01 -08:00
David Wendt
d157a9995b
core: When a programmatic goto happens, *all* frame scripts run immediately.
2021-03-03 03:08:01 -08:00
David Wendt
452d878cd9
core: When triggered by ActionScript, clip gotos should trigger AS3 frame lifecycle events.
...
For some reason, only *some* of the events actually trigger; notably programmatic gotos do not trigger `enterFrame`.
Implicit gotos (like looping around to frame 1) also do not trigger frame scripts; they instead run at the usual time.
2021-03-03 03:08:01 -08:00
David Wendt
c9b68f600c
core: Avoid skipping queued script frames in the case where a frame script queues up additional frame scripts via gotos
2021-03-03 03:08:01 -08:00
David Wendt
f3a8eb821f
core: Gotos still trigger new frame scripts
2021-03-03 03:08:01 -08:00
David Wendt
e9f8636fe5
core: Frame scripts should run immediately and not queue
2021-03-03 03:08:01 -08:00
David Wendt
dc499a13a2
core: Gotos do not issue frame progression events on their own.
2021-03-03 03:08:01 -08:00
David Wendt
69e8a33a8e
Debug event dispatches.
2021-03-03 03:08:01 -08:00
David Wendt
a2d56016cb
avm2: Don't except when dispatching events on unconstructed objects.
2021-03-03 03:08:01 -08:00
David Wendt
50546512fe
core: Add a separate construct step before running display objects.
...
This appears to only be in use for AVM2. Objects placed on a given frame are constructed before anything else happens with it's parent - even it's constructor being called. This involves splitting AVM2 up into a bunch of steps that really don't make sense for AVM1 content. Hence, `construct_frame` is a no-op for AVM1 and pre-running the first frame when instantiated is AVM1 exclusive now.
2021-03-03 03:08:01 -08:00
David Wendt
a91273530f
tests: Display events tests should log construction events
2021-03-03 03:08:01 -08:00
David Wendt
a308b9d4f9
Re-dispatch the added event after post-instantiating an object since the automatic dispatch happens too early
2021-03-03 03:08:01 -08:00
David Wendt
ac6a206257
Fire `exitFrame`, `enterFrame`, and `frameConstructed` events as broadcasts.
2021-03-03 03:08:01 -08:00
David Wendt
d1ffa3254b
Store a list of every constructed event dispatcher so we can broadcast events on them.
2021-03-03 03:08:01 -08:00
David Wendt
731c18ad80
avm2: Issue (or attempt to issue) events for entering, exiting, and constructing, a frame.
2021-03-03 03:08:01 -08:00
David Wendt
2e38caafff
tests: Add further tests for various timeline interaction scenarios and events
2021-03-03 03:08:01 -08:00
David Wendt
3df97d8da2
avm2: Stub `System.gc`.
...
Our current garbage collector design precludes the ability to actually collect garbage during player updates, so this is a no-op.
2021-03-03 03:08:01 -08:00
David Wendt
464f388324
avm2: Unstaged display objects are treated as unrooted.
2021-03-03 03:08:01 -08:00
David Wendt
279f2d0652
core: Re-allow reinsertions into the same parent (but still gate off the extra events it would otherwise use)
2021-03-03 03:08:01 -08:00
David Wendt
cea65f95db
avm2: Dispatch `addedToStage` and `removedFromStage` events
2021-03-03 03:08:01 -08:00
David Wendt
7f78bfa51d
core: Add a utility method to check if a display object is rooted to the current stage
2021-03-03 03:08:01 -08:00
David Wendt
5acaf0bd01
core: `iter_render_list` returns a non-locking iterator and should be documented as such.
2021-03-03 03:08:01 -08:00
David Wendt
094563e28f
tests: Add a (currently failing) test for the execution order of various events in the presence of programmed display tree manipulations.
2021-03-03 03:08:01 -08:00
David Wendt
df5520f3e0
avm2: Dispatch `added` and `removed` events
2021-03-03 03:08:01 -08:00
David Wendt
76ef0d4740
avm2: Event phase should be counted from 1 in `valueOf`.
2021-03-03 03:08:01 -08:00
David Wendt
c4a5c6f4d3
avm2: Constructed events start in phase 2, not 3
2021-03-03 03:08:01 -08:00
David Wendt
4521c2b599
avm2: Manually-constructed movie clips (and their subclasses) should be accessible from the display object tree.
2021-03-03 03:08:01 -08:00
David Wendt
63af38be9a
avm2: Add convenience method for natively-dispatched events.
2021-03-03 03:08:01 -08:00
Adrian Wielgosik
14e0980226
avm1: Implement getInstanceAtDepth
2021-03-01 15:31:30 -08:00
Mads Marquart
24780003e7
swf: Deduplicate different read methods
2021-02-27 17:04:42 -08:00
Mads Marquart
dad21d4398
swf: Make avm2 Reader operate directly with byte slices
2021-02-27 17:04:42 -08:00
Tempy111
00e1f36984
core: Add missing support for Tab keycode
2021-02-27 16:44:39 -08:00
Mike Welsh
3099914374
chore: Appease clippy
2021-02-27 16:10:46 -08:00
dependabot-preview[bot]
8500a676cf
build(deps): bump quick-xml from 0.20.0 to 0.22.0
...
Bumps [quick-xml](https://github.com/tafia/quick-xml ) from 0.20.0 to 0.22.0.
- [Release notes](https://github.com/tafia/quick-xml/releases )
- [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md )
- [Commits](https://github.com/tafia/quick-xml/compare/v0.20.0...v0.22.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-26 11:44:48 -08:00
Aaron Hill
ff1aff607a
avm1: Explicitly drop `obj` when it is no longer needed
...
Explicitly drop `obj` when it is no longer needed to avoid borrow errors, and add a test case similar to #3169 .
Co-authored-by: Mike Welsh <mwelsh@gmail.com>
2021-02-19 03:30:21 -08:00
dependabot-preview[bot]
75fca8f6b6
build(deps): bump url from 2.2.0 to 2.2.1
...
Bumps [url](https://github.com/servo/rust-url ) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/servo/rust-url/releases )
- [Commits](https://github.com/servo/rust-url/compare/v2.2.0...v2.2.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-18 14:22:06 -08:00
Aaron Hill
6050dd8204
Replace most manual `Collect` impls with `#[derive(Collect)]`
...
* Replace most unsafe impls with Collect.
* Switch to local gc-arena fork.
2021-02-17 18:38:55 -08:00
desuwa
809d0a9245
avm1: Implement useHandCursor
2021-02-17 18:29:32 -08:00
Adrian Wielgosik
916bd8a9b8
core: Make EditText.border and EditText.background independent
2021-02-17 17:55:17 -08:00
Aaron Hill
f745c39a42
chore: Remove `Collect` impls from `Activation` and `UpdateContext`
...
Neither of these impls are actually used.
As a result of this change, several fields in `avm2::Activation` became
unused. I assumed that these fields will become used as more of avm2 is
implemented, so I suppressed the warnings for now
2021-02-16 20:35:26 -08:00
CUB3D
b93e556f89
avm2: Implement Op::Typeof and dummy XML/XMLList
2021-02-16 20:21:40 -08:00
David Wendt
df5e97481c
core: Adjust documentation
2021-02-16 19:03:48 -08:00
David Wendt
5e9d91710d
core: Future-proof the non-keyframe seek for other stream types.
2021-02-16 19:03:48 -08:00
TÖRÖK Attila
b3992dbc1a
core/video: Loop to frame modulo num_frames. Fixes z0r.de/1843
2021-02-16 19:03:48 -08:00
TÖRÖK Attila
2e6d3eae18
core/video: Make seeking to non-keyframes possible.
2021-02-16 19:03:48 -08:00
David Wendt
8709bb2489
chore: Clippy wants this too
2021-02-16 19:03:48 -08:00
David Wendt
0bc101dbde
chore: Spelling matters
2021-02-16 19:03:48 -08:00
David Wendt
5fcdb79528
core: Rename the video dependency enums to better describe their meaning.
2021-02-16 19:03:48 -08:00
David Wendt
4d0b73feeb
core: Seeks before instantiation are valid and should be cached for later execution
2021-02-16 19:03:48 -08:00
David Wendt
4905e9a83d
avm2: `Video` is a sealed class.
2021-02-16 19:03:48 -08:00
David Wendt
d9541e1ea6
core: Fix various documentation errors in video
2021-02-16 19:03:48 -08:00
David Wendt
c5fa9eb4a8
chore: Clippy compliance for stub video backend
2021-02-16 19:03:48 -08:00
David Wendt
964b1c4359
video: Frames with no data associated are treated as empty Pframes.
2021-02-16 19:03:48 -08:00
David Wendt
93ef62bac0
video: Snap seeks to nearest keyframe
2021-02-16 19:03:48 -08:00
David Wendt
02b94649c3
avm2: Stub the `Video` class.
2021-02-16 19:03:48 -08:00
David Wendt
aa98fad126
avm1: Stub impl the `Video` class.
2021-02-16 19:03:48 -08:00
David Wendt
828ff39802
video: Warn if duplicate video frames are encountered
2021-02-16 19:03:48 -08:00
David Wendt
0e2b328073
video: Warn if we are missing a frame to render.
2021-02-16 19:03:48 -08:00
David Wendt
c6a9e27916
video: Report what frame gave an error
2021-02-16 19:03:48 -08:00
David Wendt
5b546bf2d8
video: Always decode the first frame
2021-02-16 19:03:48 -08:00
David Wendt
368c1cf3c5
video: Implement a very basic video decoding loop
2021-02-16 19:03:48 -08:00
David Wendt
6dc96f5d58
core: Allow instantiation of videos
2021-02-16 19:03:48 -08:00
David Wendt
50d61b07f2
video: Stub seeking.
...
`PlaceObject`'s `ratio` field is treated as a seek parameter for video streams.
2021-02-16 19:03:48 -08:00
David Wendt
b78baeb41d
core: Add software video backend, separate from the null backend, to store software decoders.
2021-02-16 19:03:48 -08:00
David Wendt
57dab4327e
core: Further adjustment to video backend type
2021-02-16 19:03:48 -08:00
David Wendt
1e3cc60f05
core: Also implement `VideoFrame` tag.
...
This is far more awkward and copy-heavy than it needs to be.
2021-02-16 19:03:48 -08:00
David Wendt
9b161889f8
core: Parse `DefineVideoStream` and use it to put videos into the character library.
2021-02-16 19:03:48 -08:00
David Wendt
34577057e4
core: Add video display object
2021-02-16 19:03:48 -08:00
David Wendt
80bceeacab
core: Add `VideoBackend` to host video decoders
2021-02-16 19:03:48 -08:00
bunnyhero
6b58afa408
avm1: Make disabled MovieClips handle more events
...
Fixes #3250 .
2021-02-15 09:48:18 -08:00
Mike Welsh
ecd873eb39
tests: Add test for TextField.autoSize/background
2021-02-13 06:34:20 -08:00
Adrian Wielgosik
df6aa85948
text: Implement TextField.background, disable it by default
2021-02-13 06:34:20 -08:00
Adrian Wielgosik
26ffbdfe23
text: Improve autoSize logic for non-wrapping text layout
2021-02-13 06:34:20 -08:00
Mads Marquart
8ba4fdbbbe
core: Enable logging in tests, which makes it easier to spot mistakes
2021-02-13 03:49:12 -08:00
relrelb
bb89391f3a
chore: Avoid deprecated constants
...
The Rust documentation considers numeric constants prefixed with std::
as deprecated.
For example: https://doc.rust-lang.org/std/u16/constant.MAX.html .
2021-02-12 06:36:17 -08:00
Mike Welsh
e5fb1f09e7
chore: Appease clippy
...
* #[derive(Collect)] should be before #[collect]
* Replace redunant `&buf[..]` with `buf`
* Changes most cases of UPPERCase to UpperCase
* Allow upper_case_acronym on most SWF types, as they are from
SWF spec/more annoying to change.
2021-02-12 06:32:42 -08:00
dependabot-preview[bot]
2fbbbe81b8
build(deps): bump quote from 1.0.8 to 1.0.9
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.8 to 1.0.9.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.8...1.0.9 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-12 02:32:42 -08:00
Adrian Wielgosik
da86f7fc5a
avm1: Don't mutably borrow display_properties for reading
...
Fixes #3199 .
2021-02-11 13:41:03 -08:00
Mike Welsh
16bd7fade6
web: Use case-insensitive check for detecting javascript scheme
2021-02-08 03:41:16 -08:00
paq
5cca3884d6
avm2: Implement `Array.length`'s setter
2021-02-07 23:49:52 -08:00
paq
8aaead90de
avm2: Implement String.charCodeAt
2021-02-07 16:11:24 -08:00
paq
c7c025277f
avm2: Implement String.charAt
2021-02-07 16:11:24 -08:00
paq
2ec21bdd07
avm2: Implement String.length
2021-02-07 16:11:24 -08:00
paq
4a87d707f0
avm2: Implement String constructor
2021-02-07 16:11:24 -08:00
David A Roberts
6af18c1c4d
avm1: Implement MovieClip.setMask - #17 #263
2021-02-05 13:53:54 -08:00
Mike Welsh
937393ce07
core: Fix panic from negative array indices in SharedObject ( fix #3094 )
2021-02-04 19:56:29 -08:00
Mike Welsh
cfbb5751e8
tests: Add test for local SharedObject
2021-02-04 19:56:29 -08:00
Adrian Wielgosik
1454e0d126
core: Don't copy Glyphs around; make Font methods take &self
2021-02-04 11:54:17 -08:00
dependabot-preview[bot]
dd4860c469
build(deps): bump encoding_rs from 0.8.26 to 0.8.28
...
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs ) from 0.8.26 to 0.8.28.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases )
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.26...v0.8.28 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-04 11:22:31 -08:00
Adrian Wielgosik
d78e4e5e00
Core: Avoid framerate dropping down 5x if frames can't be handled in time.
2021-02-03 17:04:03 -08:00
Adrian Wielgosik
ac47b56fef
chore: Revert "build(deps): bump quick-xml from 0.20.0 to 0.21.0"
...
This reverts commit 0c6c339a64
.
2021-02-03 14:36:13 -08:00
dependabot-preview[bot]
0c6c339a64
build(deps): bump quick-xml from 0.20.0 to 0.21.0
...
Bumps [quick-xml](https://github.com/tafia/quick-xml ) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/tafia/quick-xml/releases )
- [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md )
- [Commits](https://github.com/tafia/quick-xml/compare/v0.20.0...v0.21.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-03 11:09:26 -08:00
Mike Welsh
47f0f980b8
core: Handle PlaceObject tags with malformed clip actions
...
Some SWFs in the wild have PlaceObject tags with ending ClipActions
that are 2 bytes instead of the required 4 bytes (see #2899 ).
Swallow the error in this case so that the tag can run.
2021-02-02 23:56:48 -08:00
paq
48d59c0340
chore: Minor refactor names.rs
2021-02-02 10:16:41 -08:00
relrelb
074731e1a4
audio: Add Nellymoser support
2021-02-02 00:41:01 -08:00
Adrian Wielgosik
2c2a9367ae
avm1: Respect case-(in)sensitivity in text bindings
...
Fixes #3031 .
2021-02-01 18:09:32 -08:00
Mike Welsh
02d99c3686
core: CSMTextSettings tag alters text hit testing
...
Normally, a hit test on static text will consider the text glyphs.
However, a CSMTextSettings tag can change the text to use the
"advanced rendering engine", which causes hit tests to only consider
the bounds. This is toggled by the "Anti-alias for readibility"
setting in the Flash IDE.
Wire up the CSMTextSettings tag and adjust hit test behavior based
on this flag.
Fixes #2987 .
2021-02-01 17:17:41 -08:00
Mads Marquart
1990e51639
avm2: Add UiBackend::display_unsupported_message
...
To allow displaying rich content when unsupported ActionScript 3 content is encountered.
2021-01-31 23:04:20 -08:00
Brian Gontowski
31dd2729e2
web: Add an onFSCommand callback into JavaScript
2021-01-31 18:03:31 -08:00
EmperorBale
4122e8a1b0
core: Implement TextField.password property
2021-01-31 12:26:58 -08:00
relrelb
7431cd9b10
core: Merge InputBackend into UiBackend
2021-01-30 16:36:45 -08:00
CUB3D
206ac43703
avm1: Correct ToInteger for undefined, null and object inputs
2021-01-29 19:44:32 -08:00
relrelb
02dfb23c67
core: Remove unneeded pub
2021-01-29 13:05:37 -08:00
relrelb
eaf0441f9a
avm1: Small refactors
2021-01-29 13:05:37 -08:00
relrelb
beff73b815
core: Small refactor
2021-01-29 13:05:37 -08:00
dependabot-preview[bot]
67f793549e
build(deps): bump flate2 from 1.0.19 to 1.0.20
...
Bumps [flate2](https://github.com/rust-lang/flate2-rs ) from 1.0.19 to 1.0.20.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases )
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.19...1.0.20 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-29 11:43:05 -08:00
dependabot-preview[bot]
6f14490f84
build(deps): bump jpeg-decoder from 0.1.21 to 0.1.22
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.1.21 to 0.1.22.
- [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.21...v0.1.22 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-29 11:42:19 -08:00
Mike Welsh
477fa06daf
avm1: Fix off-by-one error in String.lastIndexOf
...
Fixes #2873 .
Co-authored-by: Toad06 <gd.productions@laposte.net>
2021-01-29 02:59:14 -08:00
Mike Welsh
92e4d781e7
tests: Add test for #2870
2021-01-28 16:36:42 -08:00
Mike Welsh
008f0f596c
core: Clip event slices are from parent movie in PlaceObject
...
Since 19034b7
, clip event scripts are returned as slices from the
SWF. This caused a panic when a movie was loaded into a clip,
because the loaded clip's `movie` would be used as the source for
clip events. However, clip events are placed by the parent's
PlaceObject tags, so the movie in this case should be the parent's
movie.
Fixes #2870 .
2021-01-28 16:36:42 -08:00
Mads Marquart
39aa7536df
core: Remove unsafe NonZeroU32 creation in shape utils
2021-01-28 14:39:35 -08:00
Mike Welsh
0f5bab3e78
core: Use dirty flag for updating sound transforms
2021-01-27 15:25:04 -08:00
Mike Welsh
7eb5389630
core: Avoid vec allocation in AudioManager::update_sounds
2021-01-27 15:25:04 -08:00
Mike Welsh
a4699a3ca5
audio: Sound transforms apply to stream sounds
...
This unifies the code path for event sounds and stream sounds.
Both `AudioBackend::start_stream` and `start_sound` return a
`SoundHandle`. `stop_stream` is removed (`stop_sound` can be
used for both cases).
Also removes references to `CharacterId` from the `AudioBackend`
(instead, an increasing ID is returned to identiy streams while
loading).
2021-01-27 15:25:04 -08:00
Mike Welsh
4c33464115
tests: Add test for Sound
2021-01-27 15:25:04 -08:00
Mike Welsh
95ce2abf17
audio: Remove AudioBackend::stop_sounds_with_handle/is_sound_playing_with_handle
2021-01-27 15:25:04 -08:00
Mike Welsh
da2dd3b36c
core: Implement sound transforms and Sound.setPan
2021-01-27 15:25:04 -08:00
Mike Welsh
98e6c54c3b
avm1: Implement Sound.onSoundComplete
2021-01-27 15:25:04 -08:00
Mike Welsh
34f60b127a
core: Add AudioManager to handle actively playing sounds
...
Add an AudioManager struct to handle this list of actively playing
sounds. This will maintain information for each sound instance,
such as the owning display object, AVM1 object, etc.
This will allow us to implement the awkward AVM1 Sound API in a
fairly backend-agnostic way.
2021-01-27 15:25:04 -08:00
TÖRÖK Attila
a89eb6b9b8
avm1: Implement BitmapData.perlinNoise()
2021-01-27 11:53:05 -08:00
Adrian Wielgosik
937b371e30
core: Support grayscale JPEGs
2021-01-26 17:14:27 -08:00
dependabot-preview[bot]
8172ddb1ba
build(deps): bump rand from 0.8.2 to 0.8.3
...
Bumps [rand](https://github.com/rust-random/rand ) from 0.8.2 to 0.8.3.
- [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/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-26 08:52:20 -08:00
dependabot-preview[bot]
7856cdd3d7
build(deps): bump serde from 1.0.122 to 1.0.123
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.122 to 1.0.123.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.122...v1.0.123 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-25 14:14:33 -08:00
Mike Welsh
306d2ead7f
core: Avoid panic in EditText::on_changed ( fix #2809 )
2021-01-24 19:52:30 -08:00
dependabot-preview[bot]
64983cde22
build(deps): bump serde from 1.0.121 to 1.0.122
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.121 to 1.0.122.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.121...v1.0.122 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 17:26:09 -08:00
dependabot-preview[bot]
32fd3fb71b
build(deps): bump syn from 1.0.59 to 1.0.60
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.59 to 1.0.60.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.59...1.0.60 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 14:23:03 -08:00
paq
e9ad1587a4
chore: Rename Namespace::public_namespace to Namespace::public
2021-01-24 11:53:43 -08:00
paq
b58fcf3b05
chore: Use Namespace::public_namespace() instead of Namespace::package("")
2021-01-24 11:53:43 -08:00
dependabot-preview[bot]
239ccb3511
build(deps): bump jpeg-decoder from 0.1.20 to 0.1.21
...
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder ) from 0.1.20 to 0.1.21.
- [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/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 11:52:39 -08:00
dependabot-preview[bot]
86b4c20809
build(deps): bump serde from 1.0.120 to 1.0.121
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.120 to 1.0.121.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.120...v1.0.121 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-23 14:12:08 -08:00
Adrian Wielgosik
0a64c34e73
Make avm11::Value Copy
2021-01-23 12:04:47 -08:00
Adrian Wielgosik
2065812d1a
Preallocate AVM1 Values when preparing constant pool
2021-01-23 12:04:47 -08:00
relrelb
19662503ca
swf: Convert ButtonActionCondition to bitflags
2021-01-23 11:59:24 -08:00
relrelb
7f4845d777
swf: Convert ButtonState to bitflags
2021-01-23 11:59:24 -08:00
paq
c088c18517
chore: Remove Flash's recovery file and add it to .gitignore
2021-01-23 00:29:25 -08:00
dependabot-preview[bot]
c0ac8a4a77
build(deps): bump syn from 1.0.58 to 1.0.59
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.58 to 1.0.59.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.58...1.0.59 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-23 00:29:02 -08:00
CUB3D
0cf3a4abed
core: Invert pixel fill order for BitmapData.noise
2021-01-22 13:16:19 -08:00
CUB3D
d57fd172f9
core: More special casing for noise
2021-01-22 13:16:19 -08:00
CUB3D
00fe7b6468
avm1: Generate correct values for negative seeds for BitmapData.noise()
2021-01-22 13:16:19 -08:00
CUB3D
9ba38784ef
avm1: Properly implement BitmapData.noise() for positive seeds
2021-01-22 13:16:19 -08:00
Mike Welsh
82fd9dfd4e
chore: Appease clippy
2021-01-21 18:52:43 -08:00
Mike Welsh
78f85d96f0
chore: Remove some debug spew
2021-01-21 18:22:42 -08:00
Aaron Hill
b2f5f807de
avm2: Print full multiname for "Property does not exist" errors ( #2740 )
...
This makes it easy to see when the error is a result of something in the
"flash" package being unimplemented.
2021-01-21 17:52:17 -08:00
relrelb
b05c6540e1
chore: Migrate from enumset to bitflags
2021-01-21 16:35:46 -08:00
relrelb
ab92bc1b98
tests: Add tests for target clip in SWF6
2021-01-21 14:52:52 -08:00
relrelb
286bf7ac3f
tests: Add tests for target clip in SWF5
2021-01-21 14:52:52 -08:00
Toad06
9866a4baef
web: Use enum instead of arbitrary values
2021-01-21 14:52:52 -08:00
Mike Welsh
60a95f3ea0
core: Gracefully handle tag length past EOF
2021-01-21 14:04:46 -08:00
Mike Welsh
34e0763cfe
avm1: Don't unwrap in ColorTransform methods
2021-01-21 11:48:26 -08:00
Mike Welsh
6e7e5395aa
tests: Add test for subclassing a native type
2021-01-21 11:48:26 -08:00
Mike Welsh
5582da9f8a
avm1: create_bare_object should properly wire up proto
...
When a native class was extended, most native types were grabbing
their normal prototype instead of using the user's supplied prototype.
e.g. `class MyColorTransform extends ColorTransform`.
2021-01-21 11:48:26 -08:00
Mike Welsh
a6ea28d9b4
avm1: Create proper underlying type when extending native objects ( fix #2682 )
2021-01-21 11:48:26 -08:00
Mike Welsh
e8efe22dee
tests: Add test for SWF5 string encoding
2021-01-20 15:02:31 -08:00
Mike Welsh
66256dd3be
swf: SwfStr no longer contains encoding
...
SwfStr is now an unsized slice analogous to `str` or `bstr`.
The desired encoding must be supplied when converting to String.
2021-01-20 15:02:31 -08:00
Mike Welsh
61628a74fc
swf: Rename and organize some util methods
...
* SwfRead -> SwfReadExt
* SwfWrite -> SwfWriteExt
* read_swf_header -> decompress_swf
* read_swf -> parse_swf
2021-01-20 15:02:31 -08:00
Mike Welsh
1d9c11e145
swf: Add SwfStr type to handle encodings in SWF<6
2021-01-20 15:02:31 -08:00
Mike Welsh
19034b76e4
swf: Return slices in swf::Reader
...
Avoid copies by returning slices of the decompressed input.
2021-01-20 15:02:31 -08:00
klemens
9488a3fb97
spelling fixes
2021-01-18 22:07:39 -08:00
Mike Welsh
da1e2801a2
chore: Appease clippy
2021-01-18 21:23:50 -08:00
relrelb
c284a2e47e
tests: Add export_assets
2021-01-15 11:48:29 -08:00
relrelb
abfa08c964
core: Allow exports to be overridden
...
Per SWF19 p.54, the latter export name is used.
2021-01-15 11:48:29 -08:00
TÖRÖK Attila
a01ea70514
core/avm1: Implement BitmapData.copyPixels()
2021-01-14 13:02:55 -08:00
cheezeygeek
1911708ad1
avm1: Fix onChange firing, remove unwraps, revert as_broadcaster
2021-01-13 15:47:20 -08:00
cheezeygeek
b3cd9b0f89
avm1: Implement listeners and onChanged for TextField ( close #2297 )
2021-01-13 15:47:20 -08:00
Mike Welsh
df82194823
tests: Add test for case insensitive Object.registerClass in SWF6
2021-01-13 15:38:38 -08:00
Mike Welsh
3c31336c93
chore: Rename some getters
2021-01-13 15:38:38 -08:00
Moulins
26a2b6e4f7
core: Add test for `Object.registerClass` return values
2021-01-13 15:38:38 -08:00
Moulins
f394953331
core: Reimplement `Object.registerClass`.
...
Maintain an external mapping from symbol names to registered
constructors to properly handle `registerClass` being called on
not-yet-available symbols.
SWFs v6 and v7+ each have a separate global mapping, with
different case sensitivities.
Also returns the correct boolean value to the AVM.
Fixes #2343 and #1864 .
2021-01-13 15:38:38 -08:00
Mike Welsh
9bb36885bb
web: Add backgroundColor option and support bgcolor attribute
...
Add `backgroundColor` setting to the config options, allowing
a user to override the background color of an SWF. The polyfill
will now look for the `bgcolor` HTML attribute on the embed
and fill in this setting appropriately.
2021-01-13 11:57:19 -08:00
Mike Welsh
4820d5b044
core: Change Player::background_color to an Option
...
Player::background_color is now an Option. SetBackgroundColor will
change the background color of the player only when this is None,
i.e. only if no background color has yet been set.
This matches the behavior of the offical Flash Player, for example,
if a parent SWF is missing a SetBackgroundColor tag and loads a
child SWF, the child SWF's SetBackgroundColor tag takes effect.
This is anticipating adding a `bgcolor` option to the web builds,
allowing the HTML embed to override the bgcolor.
2021-01-13 11:57:19 -08:00
Adrian Wielgosik
7242bfb5f0
avm1: In ASSetPropFlags, don't crash on flags > 7
2021-01-13 11:55:35 -08:00
dependabot-preview[bot]
a73e85ea6d
build(deps): bump rand from 0.8.1 to 0.8.2
...
Bumps [rand](https://github.com/rust-random/rand ) from 0.8.1 to 0.8.2.
- [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.1...0.8.2 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 04:17:41 -08:00
Mike Welsh
63f2b4f02f
avm1: Remove Error::ConstructorFailed
...
Not necessary now that native constructors can return differing
types. `new BitmapData` can return undefined.
2021-01-12 09:13:24 -08:00
Mike Welsh
cd68d4f76a
avm1: Properly implement Object constructor
2021-01-12 09:13:24 -08:00
Mike Welsh
e93f3b5d3b
tests: Add test for Object constructor
2021-01-12 09:13:24 -08:00
Mike Welsh
df500282cd
avm1: Use the return value of built-in ctors as `this`
...
* Built-in constructors now return the newly constructed object,
which will be used as `this`. This allows for constructors such
as `new Object` which can return differing types.
* Adjust `FunctionObject::constructor` to take both a constructor
and a function. Add `constructor_to_fn!` macro to turn most
simple native constructors into a function that discards the
return value.
* Change `TObject::construct` to return `Value` instead of `Object`.
This is necessary for constructors that return primitive values.
2021-01-12 09:13:24 -08:00
Mike Welsh
4e27818952
core: Don't recreate objects when switching button states
...
When switching button states, previously we cleared all children
and recreated children for the new state. Now any children that
exist in both states are persisted and not recreated.
Fixes #2354 .
2021-01-11 14:06:22 -08:00
Mike Welsh
6b2b0eb2c6
core: Allow mouse picking of children inside buttons
...
Particularly fixes cases of button-inside-button (#2354 ).
2021-01-11 14:06:22 -08:00
Toad06
7480e836ec
web: Changes from review
2021-01-11 13:16:00 -08:00
TÖRÖK Attila
cce3a8199d
web: Add a config option to disable the message about unsupported content
2021-01-10 16:02:23 -08:00
Mike Welsh
484ac03ca8
tests: Test removeMovieClip on non-movieclips
2021-01-09 18:31:04 -08:00
Mike Welsh
bab88ede8c
fix
2021-01-09 18:31:04 -08:00
MrCheeze
ff15b67192
avm1: Allow RemoveSprite/removeMovieClip on any display object
2021-01-09 18:31:04 -08:00
Mike Welsh
6638aebde8
tests: Add test verifying proper getBytesTotal value
2021-01-09 14:29:19 -08:00
MrCheeze
5915f2a841
core: Return uncompressed length for getBytesLoaded/Total
2021-01-09 14:29:19 -08:00
Adrian Wielgosik
828dbcb00c
Don't panic on invalid JPEG sizes in DefineBitsJpeg*
2021-01-08 13:38:41 -08:00
dependabot-preview[bot]
f80d74a3d7
build(deps): bump smallvec from 1.6.0 to 1.6.1
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.6.0...v1.6.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-08 12:09:49 -08:00
relrelb
030ff398ef
desktop: Handle fullscreen keyboard shortcut in its own case
2021-01-08 11:59:08 -08:00
relrelb
abe608fd4d
desktop: Add fullscreen keyboard shortcut
2021-01-07 12:49:36 -08:00
Mike Welsh
44e9185a5f
core: Adjust culling area based on letterbox setting
2021-01-07 11:46:07 -08:00
Mike Welsh
01aca9f861
web: Remove upgrade_to_https param from Ruffle::new
...
Grab it from the `config` directly instead of using an extra param.
2021-01-07 11:46:07 -08:00
Mike Welsh
bacb66b97b
core: Move Letterbox to config module
2021-01-07 11:46:07 -08:00
Mike Welsh
8728804f28
web: Add letterbox config option
2021-01-07 11:46:07 -08:00
Mike Welsh
e9da6a13f0
core: Add letterbox setting
...
Player::set_letterbox can be used to control the letterbox behavior.
* Letterbox::Off => no letterbox (flash behavior)
* Letterbox::Fullscreen => letterbox only in fullscreen (web default)
* Letterbox::On => always letterbox (desktop default)
2021-01-07 11:46:07 -08:00
Mike Welsh
03b5edd4d1
render: Remove RenderBackend::draw_letterbox
...
Move letterbox draw logic to `Player`, using renderer.draw_rect
2021-01-07 11:46:07 -08:00
CUB3D
063c8a1234
chore: Fix formatting
2021-01-06 18:06:30 -08:00
CUB3D
01557fba5a
core: Add flash.filters.GradientGlowFilter
2021-01-06 18:06:30 -08:00
CUB3D
0cab167e4c
core: Add flash.filters.GradientBevelFilter + refactor existing filters
2021-01-06 18:06:30 -08:00
Moulins
02c591958e
core/avm1: don't run onLoadInit handler if movie loading failed
...
Replace Loader::Movie::loader_complete flag by an enum to distinguish
between success and failure.
Fixes #2123
2021-01-06 16:00:58 -08:00
relrelb
468b2ca487
core: Ignore SetBackgroundColor in child movie clips
2021-01-06 16:00:11 -08:00
Callum Thomson
75081c8149
avm1: Implement flash.filters.ConvolutionFilter avm1 built-in
2021-01-04 18:26:11 -08:00
relrelb
9a8edda8a6
chore: Update lyon to 0.17.1
2021-01-04 18:08:14 -08:00
relrelb
de761f5b7c
chore: Update bitstream-io to 1.0.0
2021-01-04 15:23:36 -08:00
TÖRÖK Attila
21e071384d
core/avm1: Handle object aliasing in BitmapData.copyChannel by cloning
2021-01-04 15:10:01 -08:00
dependabot-preview[bot]
51641dad60
build(deps): bump rand from 0.8.0 to 0.8.1
...
Bumps [rand](https://github.com/rust-random/rand ) from 0.8.0 to 0.8.1.
- [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.0...0.8.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-04 15:08:40 -08:00
Mike Welsh
fae1d6fd6a
chore: Appease clippy
2021-01-04 13:17:26 -08:00
Adrian Wielgosik
de38bb48eb
core: Fake passage of time to fool busy-loop frame limiters
2021-01-04 12:19:20 -08:00
Kamil Gierada
49a69c8109
core: ADPCM decoder produces less artifacts
2021-01-02 16:44:28 -08:00
Mike Welsh
4c12f27e46
tests: Add tests for #1671
2021-01-02 16:19:08 -08:00
Mike Welsh
146d41c971
avm1: Bail out of swapDepths on dead clips
2021-01-02 16:19:08 -08:00
paq
72be136fb9
avm1: Implement unescape
2021-01-02 14:37:03 -08:00
dependabot-preview[bot]
219f4664d6
build(deps): bump minimp3 from 0.5.0 to 0.5.1
...
Bumps [minimp3](https://github.com/germangb/minimp3-rs ) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/germangb/minimp3-rs/releases )
- [Commits](https://github.com/germangb/minimp3-rs/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-02 14:22:38 -08:00
CUB3D
03e69c5c0b
core: Update DisplacementMapFilter tests
2021-01-02 03:12:07 -08:00
CUB3D
631d185014
core: Implmement flash.filters.DisplacementMapFilter
2021-01-02 03:12:07 -08:00
TÖRÖK Attila
3b14437b25
core/avm1: Implement BitmapData.scroll
2021-01-01 19:44:56 -08:00
dependabot-preview[bot]
83c32e8693
build(deps): bump syn from 1.0.56 to 1.0.57
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.56 to 1.0.57.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.56...1.0.57 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-01 13:46:35 -08:00
Mike Welsh
a5b5ba46ba
avm1: Unspecified arguments should be set to undefined ( fix #2166 )
...
Unspecified arguments should be set to undefined to prevent
assignments from leaking to the parent scope, for example:
```
function f(arg0) {
arg0 = "BAD"; // Previously could set _root.arg0
}
f();
```
2020-12-31 20:01:05 -08:00
Mike Welsh
22ab8df8f5
tests: Add test for #2166
2020-12-31 20:01:05 -08:00
dependabot-preview[bot]
6a3b9f9f53
build(deps): bump smallvec from 1.5.1 to 1.6.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.5.1...v1.6.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-31 14:37:38 -08:00
Mike Welsh
9b6295f33a
render: Pass library to RenderBackend::register_shape ( fix #2037 )
...
Pass the movie library to `register_shape` methods so that bitmap
charcter IDs can be resolved immediately on the proper SWF.
This fixes #2037 , which cause incorrect bitmaps to be used when
multiple movies were loaded.
2020-12-31 13:10:21 -08:00
Adrian Wielgosik
2b2a7c3c27
Remove redundant SystemPrototypes from UpdateContext.
2020-12-31 13:09:59 -08:00
Mike Welsh
ea3b6f59df
avm1: Implement XML.ignoreWhite
2020-12-30 16:00:39 -08:00
Mike Welsh
caa2d8e383
tests: Add test for XML.ignoreWhite
2020-12-30 16:00:39 -08:00
Mike Welsh
d736293425
avm1: Fix method calls with null/empty string name
...
`f[null]` should call `f["null"]`.
`f[undefined]`, `f[""]`, `f[o]` where o.toString returns the empty
string should call `f` directly.
2020-12-30 13:35:36 -08:00
CUB3D
5fb15c8f80
core: Support CallMethod with non-string method_name ( fix #2160 )
2020-12-30 13:35:36 -08:00
paq
4f980becb2
avm1: Implement escape
2020-12-30 12:42:03 -08:00
Mike Welsh
3ce4406434
core: Fix memory leak caused by unbound text variables
...
Text fields without variables would return as unbound in
EditText::try_bind_text_field_variable, causing them to be added
to the unbound textfield list even though they had no variable
setting. Return successful bidning by default to avoid adding
these textfields to the unbound list.
2020-12-29 14:18:07 -08:00
Mike Welsh
802aa9b7a7
avm1: Allow SharedObject creation even if URL is unknown ( fix #2150 )
...
Allow SharedObjects to be created even in the case that the movie
URL is None (for example, loading an SWF from bytes). Use a dummy
"localhost" URL.
2020-12-29 14:17:57 -08:00
Mike Welsh
ff5ecf9754
avm1: Fix incorrect name used for SharedObject cache ( fix #2149 )
2020-12-29 14:17:57 -08:00
Callum Thomson
7b202bd2e7
avm1: Implement flash.filters.ColorMatrixFilter avm1 built-in
2020-12-29 03:10:46 -08:00
paq
8c86434e38
avm1: Implement Matrix.deltaTransformPoint
2020-12-28 01:17:00 -08:00
paq
8baa36e801
avm2: Implement isFinite
2020-12-27 23:02:39 -08:00
paq
ce2d7efac3
avm2: Implement isNaN
2020-12-27 23:02:39 -08:00
Mike Welsh
7bdbb6c37d
text: Fix masking of text area ( fix #1496 , #1554 )
2020-12-27 23:01:24 -08:00
Mike Welsh
8d707bc6ab
core: onKeyUp/Down method handlers fire only if clip has focus ( fix #2120 )
2020-12-27 16:08:27 -08:00
paq
7bfe3f7177
avm1: Implement Matrix.transformPoint (ruffle-rs#303)
2020-12-27 14:27:04 -08:00
Mike Welsh
8222d3095b
desktop: Add --timedemo benchmark
...
Add --timedemo for benchmarking, which will run the given SWF as
quickly as possible for 5000 frames or the end of the root
timeline, whichever comes first. The total duration will be output
upon completion.
2020-12-26 23:59:12 -08:00
jmckiern
a3b4074fc4
core: Fix multiline selection bug
2020-12-26 23:18:02 -08:00
jmckiern
208a69d715
core: Move caret to start or end of selection if shift is not held
...
Previously pressing left with a selection would set `selection.to = selection.start() - 1`, now it sets it to `selection.to = selection.start()`. The same is true for right/selection.end()
2020-12-26 23:18:02 -08:00
jmckiern
464f2b63a9
chore: Fix spelling mistake
2020-12-26 23:18:02 -08:00
jmckiern
c277c1083b
core: Render selected text as white with black background
2020-12-26 23:18:02 -08:00
jmckiern
0269c31dbc
core: Change caret color to text color
2020-12-26 23:18:02 -08:00
dependabot-preview[bot]
1b4c8265b7
build(deps): bump syn from 1.0.55 to 1.0.56
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.55 to 1.0.56.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.55...1.0.56 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-26 14:01:15 -08:00
Sam Morrow
38bdb8b39a
web/desktop: Add basic dialog handling ( closes #1978 )
2020-12-23 19:08:18 -08:00
Mike Welsh
367404ddd8
core: SharedObjects are bucketed by domain
...
Key SharedObjects on the domain and path where the SWF is hosted,
and implement the localPath and secure parameters.
Fix #855 .
2020-12-22 14:18:06 -08:00
Callum Thomson
e38d559b1e
avm1: Implement flash.filters.DropShadowFilter
...
Implements the AVM object for DropShadowFilter. Actual rendering is still TODO.
2020-12-22 14:17:12 -08:00
David Wendt
b848e4c5ff
avm2: Get rid of `RufflePrivate` and just use regular private namespaces scoped to our own domain.
2020-12-21 21:47:29 -08:00
David Wendt
30d8dc21be
avm2: Remove weird `into` constructor on `EventHandler`
2020-12-21 21:47:29 -08:00
David Wendt
7baa3cc06d
avm2: Seal the `EventDispatcher` class
2020-12-21 21:47:29 -08:00
David Wendt
3ff9b87261
avm2: `RufflePrivate` namespaces should be treated as private namespaces.
2020-12-21 21:47:29 -08:00
David Wendt
19219ad0c1
avm2: Implement `dispatchEvent`.
...
Event dispatch is a surprisingly complicated procedure, so this makes sure to test:
1. Event dispatch on bare dispatchers
2. Event dispatch on hierarchial dispatchers (movieclips)
3. Event cancellation (which is reported by `dispatchEvent`)
4. The implicit `this` on unbound event handlers. I'm not yet sure if this is a special property of event dispatch or if all unbound functions inherit their global scope as `this`.
5. The execution order of handlers on both bare and hierarchial dispatchers
6. Delegation to hierarchial dispatchers
7. Modification of the dispatch list during dispatch of an event. Surprisingly enough, you can add handlers to the event you're handling and expect them to execute, *if* you added them to a further object in the order *or* you added a bubble handler in the capture phase.
2020-12-21 21:47:29 -08:00
David Wendt
f33e5f893a
avm2: Allow builtins to get at the global scope.
2020-12-21 21:47:29 -08:00
David Wendt
8efaed40a0
avm2: `event.eventPhase` is enumerated from 1
2020-12-21 21:47:29 -08:00
David Wendt
87ff679898
avm2: Implement `EventDispatcher.willTrigger`
2020-12-21 21:47:29 -08:00
David Wendt
a071800117
avm2: `EventDispatcher` should supercall, too.
2020-12-21 21:47:29 -08:00
David Wendt
e8163e43ab
avm2: Builtin constructors should supercall.
2020-12-21 21:47:29 -08:00
David Wendt
be4e37a55c
avm2: Implement `addEventListener`, `removeEventListener`, and `hasEventListener`.
2020-12-21 21:47:29 -08:00
David Wendt
2faf5259ca
avm2: Add a representation for event dispatch lists.
...
For various reasons, we store the dispatch list for an object on a separate property of an `EventDispatcher` rather than dictating that all children of `EventDispatcher` use a specific object type. This is because `EventDispatcher` is a very general class with lots of object representations it needs to cover. So instead, we introduce a new object representation for a *property* and store it in a Ruffle private namespace that is as isolated from user code as alternate object representations are.
2020-12-21 21:47:29 -08:00
David Wendt
b02897637f
avm2: Add a new namespace type to store runtime-internal properties we don't want user code being able to access ever.
2020-12-21 21:47:29 -08:00
dependabot-preview[bot]
606fd28b3b
build(deps): bump quote from 1.0.7 to 1.0.8
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.7 to 1.0.8.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.7...1.0.8 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-20 15:54:45 -08:00
Callum Thomson
69ab12fcc3
avm1: Add flash.filters.GlowFilter
2020-12-20 15:31:09 -08:00
dependabot-preview[bot]
820572f204
build(deps): bump syn from 1.0.54 to 1.0.55
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.54 to 1.0.55.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.54...1.0.55 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-20 15:19:11 -08:00
Mike Welsh
8a0e55d74a
chore: Bump to rand 0.8
2020-12-19 14:33:12 -08:00
Mike Welsh
9d6e711006
tests: Add test for #2030
2020-12-19 02:14:27 -08:00
Mike Welsh
60d7c0a742
core: Fix incorrect bounds for Bitmap ( fix #2030 )
2020-12-19 02:14:27 -08:00
Mike Welsh
981a4de9c9
tests: Uncomment arguments.caller avm1 test
2020-12-19 01:46:20 -08:00
Mike Welsh
0dd8b24fec
avm1: Implement arguments.caller
2020-12-19 01:46:20 -08:00
Mike Welsh
a3f18b80b6
tests: Add test for TextField.replaceSel
2020-12-19 00:35:26 -08:00
Mike Welsh
62a3729b55
avm1: Implement TextField.replaceSel
2020-12-19 00:35:26 -08:00
Mike Welsh
042e9a444b
tests: Add parseFloat tests
2020-12-18 02:50:09 -08:00
Mike Welsh
80d5d9cd0a
avm1: Initial implementation of parseFloat
2020-12-18 02:50:09 -08:00
Mike Welsh
326a5b6212
core: Move device font to Library ( fix #1995 )
2020-12-17 23:20:22 -08:00
Mike Welsh
a58073cabd
core: Fix Collect impl for BitmapData ( fix #2009 )
2020-12-17 19:35:26 -08:00
Mike Welsh
72a24b9800
tests: Add tests for #1906
2020-12-17 18:07:01 -08:00
Mike Welsh
25cd4ee375
avm1: Color.setTransform/setRGB sets transformed-by-AS flag ( fix #1906 )
2020-12-17 18:07:01 -08:00
Mike Welsh
7cf217a911
swf: Use lzma-rs for LZMA SWFs ( fix #405 )
...
Pure Rust decoder that functions on desktop and wasm.
Enable lzma feature by default.
TODO: Switch to lzma-rs streaming API when stable on crates.io.
Currently decodes entire stream at once.
2020-12-17 16:40:21 -08:00
jmckiern
beed570475
core: Add string_utils char boundary functions
2020-12-17 16:15:24 -08:00
jmckiern
b81cb1a3eb
core: Extend text input to deal with multibyte chars
2020-12-17 16:15:24 -08:00
David Wendt
09f9e99fbb
avm2: Implement `rest` parameters in function calls.
2020-12-17 13:21:44 -08:00
David Wendt
453e013c2c
avm2: Implement `arguments`.
2020-12-17 13:21:44 -08:00
David Wendt
217890f4a6
avm2: Implement `Function.apply`
2020-12-17 13:21:44 -08:00
Mike Welsh
369c5bda56
render: Implement Bitmap smoothing property
2020-12-15 00:04:51 -08:00
CUB3D
3556ffd778
chore: Fixes after rebase
2020-12-15 00:04:51 -08:00
CUB3D
a92b8ffded
core: All other changes from review
2020-12-15 00:04:51 -08:00
CUB3D
ccd08f14d9
core: Fix naming and safety issues
2020-12-15 00:04:51 -08:00
CUB3D
e483d0959f
core: Remove unwraps
2020-12-15 00:04:51 -08:00
CUB3D
6f91352d41
chore: Fix clippy lints
2020-12-15 00:04:51 -08:00
CUB3D
eea45d6ae6
core: Tidy up loadBitmap
2020-12-15 00:04:51 -08:00
CUB3D
23a9c7143a
core: Support failiable constructors
2020-12-15 00:04:51 -08:00
CUB3D
b3dd5c0c0b
core+renderer: Fix corner cases
2020-12-15 00:04:51 -08:00
CUB3D
666c3db9c6
core: Refactor bitmapData
2020-12-15 00:04:51 -08:00
CUB3D
74ab728cff
core: Format
2020-12-15 00:04:51 -08:00
CUB3D
22a7b1d340
core: Add handling of invalid arguments for getColorBoundsRect/colorTransform
2020-12-15 00:04:51 -08:00
CUB3D
353d5a268b
core: Add better handling of invalid arguments to BitmapData
2020-12-15 00:04:51 -08:00
CUB3D
9d46d67588
core+web+renderer: Add load/attach Bitmap and handling for invalid args with BitmapData
2020-12-15 00:04:51 -08:00
CUB3D
3c12fa6ee5
core: Implement BitmapData.floodFill and correct getPixel for invalid coordinates
2020-12-15 00:04:51 -08:00
CUB3D
3afd20063f
core: Implement get/set pixel(32) functions
2020-12-15 00:04:51 -08:00
CUB3D
e45e942a1f
core: Start implementation for flash.display.BitmapData
2020-12-15 00:04:51 -08:00
dependabot-preview[bot]
843bc74292
build(deps): bump indexmap from 1.6.0 to 1.6.1
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/bluss/indexmap/releases )
- [Commits](https://github.com/bluss/indexmap/compare/1.6.0...1.6.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-14 17:49:16 -08:00
David Wendt
acadcb8fc0
avm2: `Event` is a sealed class.
2020-12-14 16:46:33 -08:00
David Wendt
f7f51dcde2
avm2: `EventPhase` and `PropagationMode` should be `Eq`
2020-12-14 16:46:33 -08:00
David Wendt
6caaf0d222
avm2: Implement all of the `Event` class constants.
...
I'm not writing tests for these, my wrists hurt enough as is.
2020-12-14 16:46:33 -08:00
David Wendt
8a787e6153
avm2: Implement `Event.toString` (which matches it's valueof behavior)
2020-12-14 16:46:33 -08:00
David Wendt
dc32d7894c
avm2: Remove redundant event phase accessor
2020-12-14 16:46:33 -08:00
David Wendt
ec63ff55cb
avm2: Implement `Event.stopPropagation` and `Event.stopImmediatePropagation`.
...
These aren't testable yet.
2020-12-14 16:46:33 -08:00
David Wendt
d393a5f4f8
avm2: Implement `Event.preventDefault` and `Event.isDefaultPrevented`
2020-12-14 16:46:33 -08:00
David Wendt
8b9a804ae9
avm2: Implement `Event.formatToString`.
2020-12-14 16:46:33 -08:00
David Wendt
584c6c8b11
avm2: Implement `Event.clone`
2020-12-14 16:46:33 -08:00
David Wendt
3d12929914
avm2: Expose `Event.target`, `currentTarget`, and `eventPhase`.
...
These have no tests because these properties can only be updated by an event broadcaster.
2020-12-14 16:46:33 -08:00
David Wendt
90da20579c
avm2: Implement `Event.bubbles`, `cancelable`, and `type`.
2020-12-14 16:46:33 -08:00
David Wendt
58f4470dc5
avm2: Add `Event` class, object type, and native representation
2020-12-14 16:46:33 -08:00
jmckiern
709561a255
avm1: Use ? on set_text_color so errors are raised
2020-12-14 12:45:45 -08:00
jmckiern
ec1ff0be3a
avm1: Use ? instead of match Ok()'s so errors are raised
2020-12-14 12:45:45 -08:00
jmckiern
a09ac58ebd
chore: Remove TODO
2020-12-14 12:45:45 -08:00
jmckiern
cfd003de7a
avm1: Implement TextField.backgroundColor
2020-12-14 12:45:45 -08:00
jmckiern
61e3214d0a
avm1: Implement TextField.borderColor
2020-12-14 12:45:45 -08:00
Sam Morrow
c4d7b24629
web: Fix cors issues with http (close ruffle-rs#1486)
2020-12-14 05:51:28 -08:00
Zeh Fernando
8e9de8e16b
core: Implement MovieClip._lockroot in avm1
...
This also enables the (previously ignored) _lockroot tests.
2020-12-13 15:34:42 -08:00
Mike Welsh
ee74197a00
avm1: Move TextField properties to prototype
...
Remove TextField::attach_virtual properties, as properties are
on the prototype, not the textfield itself.
Use the `with_text_field_props` macro for these properties.
Also remove `get_` prefix from most getters to match naming
conventions.
2020-12-09 14:45:20 -08:00
David Wendt
ed4d51dfc1
avm1: Don't panic if we encounter an invalid display object hierarchy for AS2. Instead, yield a runtime error.
2020-12-09 14:00:06 -08:00
David Wendt
afd033898c
avm2: Implement `hitTestObject`
2020-12-09 14:00:06 -08:00
David Wendt
d9172780c5
avm2: Implement `hitTestPoint`.
2020-12-09 14:00:06 -08:00
David Wendt
b18b87e566
avm2: Implement `mouseX` and `mouseY`.
...
Note that we cannot write a reproducible test for this.
2020-12-09 14:00:06 -08:00
David Wendt
06ba2f898a
avm2: Implement `visible`.
2020-12-09 14:00:06 -08:00
David Wendt
d489aca377
avm2: Expose `DisplayObject.root`
2020-12-09 14:00:06 -08:00
David Wendt
4b9deb7106
core: Don't crash on rootless display objects.
...
Instead, crash if AVM1 ever sees a rootless display object.
2020-12-09 14:00:06 -08:00
David Wendt
0069d51dad
swf: `pushshort` should be read as a `u30` and then cast to an `i16` as it's parsed representation.
2020-12-09 14:00:06 -08:00
David Wendt
1b2a4708d6
avm2: Implement `DisplayObject.parent`.
2020-12-09 14:00:06 -08:00
David Wendt
852f26bdeb
tests: Fix name test breaking with our half-working execution order
2020-12-09 14:00:06 -08:00
David Wendt
c053f2c87c
avm2: Expose DisplayObject `name` property
2020-12-09 14:00:06 -08:00
David Wendt
ea7efe8740
core: Avoid double-borrow when moving clips between parents
2020-12-09 14:00:06 -08:00
David Wendt
a7b4f7fbd0
core: Add instantiated by timeline flag as AVM2 appears to track that
2020-12-09 14:00:06 -08:00
David Wendt
6080585d73
core: Assign `rootN` format names to top-level AVM2 movie clips.
2020-12-09 14:00:06 -08:00
David Wendt
19f9e99954
avm2: Expose and test `rotation`.
2020-12-09 14:00:06 -08:00
David Wendt
29f96e76ab
tests: Activate alpha test (since it seems to work fine)
2020-12-09 14:00:06 -08:00
David Wendt
200581e1e3
avm2: Expose `x` and `y` properties.
2020-12-09 14:00:06 -08:00
David Wendt
4784dc3c03
tests: Add more stringent height/width test that we're only accurate to within 1 twip.
2020-12-09 14:00:06 -08:00
David Wendt
abca120628
avm2: Expose `width` to AS3 code.
2020-12-09 14:00:06 -08:00
David Wendt
3225cd40e2
core: Avoid panic when display objects are manipulated in clearly invalid ways.
2020-12-09 14:00:06 -08:00
David Wendt
990401a09c
core: Allow percentages (e.g. scalex/y) to be specified, stored, and cached at either [0..1] or [0..100] scale.
2020-12-09 14:00:06 -08:00
David Wendt
6da658a845
avm2: `pushshort` has an undocumented coercion step
2020-12-09 14:00:06 -08:00
David Wendt
90e203b004
avm2: `this.height` ignores negative values
2020-12-09 14:00:06 -08:00
David Wendt
bd00bea744
avm2: Expose `alpha`, `height`, `scaleY`, and `scaleX` to script code.
2020-12-09 14:00:06 -08:00
David Wendt
69db45131b
tests: Add inactive tests for `alpha`, `height`, `rotation`, `width`, `x`, and `y`.
2020-12-09 14:00:06 -08:00
dependabot-preview[bot]
d1c79a5dd5
build(deps): bump png from 0.16.7 to 0.16.8
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.16.7 to 0.16.8.
- [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 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-08 21:13:22 -08:00
jmckiern
3cab11d18e
avm1: Implement TextField.textColor ( close #1863 )
2020-12-07 15:09:36 -08:00
dependabot-preview[bot]
17eb651682
build(deps): bump syn from 1.0.53 to 1.0.54
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.53 to 1.0.54.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.53...1.0.54 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-07 13:08:20 -08:00
Mike Welsh
9901738249
chore: Appease rustfmt
2020-12-07 10:35:40 -08:00
relrelb
989bfb8f3e
avm1: Improve loops treatment in Sound.start
...
The second argument of Sound.start, loops, can be greater than
std::u16::MAX, but previously greater values were treated as 1.
Ideally, the solution is to respect those values, but since SoundInfo
holds a u16, a short-term solution is to treat them as std::u16::MAX
instead.
2020-12-06 14:22:38 -08:00
Mike Welsh
16b9c77d02
core: Remove panic in morph shape lerp
2020-12-05 00:19:30 -08:00
dependabot-preview[bot]
f45fa80e29
build(deps): bump smallvec from 1.5.0 to 1.5.1
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.5.0...v1.5.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-04 17:54:47 -08:00
bbb651
92bd0874e1
Fixed "Swap" only working for i32
2020-12-03 15:51:37 -08:00
bbb651
8baf35e7af
Added AVM2 op "Swap"
2020-12-03 15:51:37 -08:00
Mike Welsh
758a32f5f0
core: Remove unimplemented! in decode_define_bits_lossless
2020-12-02 23:58:03 -08:00
Zeh Fernando
c018ac065c
tests: Add test for MovieClip._lockroot in avm1
2020-12-02 11:59:01 -08:00
Mike Welsh
a0d56aad44
core: Don't panic on DefineFont4
2020-12-01 23:01:35 -08:00
Mike Welsh
25e7ec99a0
core: Handle serializing arrays in SharedObjects
2020-11-30 22:15:34 -08:00
Mike Welsh
ad5028817a
core: Remove unnecssary parameter from Button::set_state
2020-11-30 01:15:43 -08:00
Mike Welsh
0d79d85d83
avm1: Fix MovieClip properties being attached to Object.prototype
2020-11-30 01:15:43 -08:00
Mike Welsh
aedddd29ab
avm1: Implement Button.enabled and MovieClip.enabled
2020-11-30 01:15:43 -08:00
dependabot-preview[bot]
827a8ee18d
build(deps): bump syn from 1.0.52 to 1.0.53
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.52 to 1.0.53.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.52...1.0.53 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-29 22:46:08 -08:00
Mike Welsh
ab200b6dc0
avm1: Don't fire button events when invisible ( fix #1521 )
2020-11-29 12:47:36 -08:00
Mike Welsh
dafe7e5027
avm1: Implement Key.getAscii
2020-11-29 02:31:10 -08:00
Mike Welsh
18addef831
core: Don't run stream sounds when stopped ( fix #1719 )
2020-11-27 21:11:15 -08:00
dependabot-preview[bot]
3d9ebbde9c
build(deps): bump syn from 1.0.51 to 1.0.52
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.51 to 1.0.52.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.51...1.0.52 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-27 15:46:54 -08:00
David Wendt
a978b649b9
core: Also gate the `set_parent` change on `remove_range` just in case
2020-11-27 13:23:34 -08:00
David Wendt
0f1d4d5248
core: Always remove children from their old render list positions regardless of what depth list position they had
2020-11-27 13:23:34 -08:00
David Wendt
e69e6fcc5e
core: Fix regression on Super Mario 63
2020-11-27 13:23:34 -08:00
David Wendt
6e565d4da2
core: Fix compliation error caused by the `TDisplayObjectContainer` refactor
2020-11-27 13:23:34 -08:00
David Wendt
5a2f17a642
core: Consistently refer to render list positions as an `index` for consistency with Rust naming conventions
2020-11-27 13:23:34 -08:00
David Wendt
c011c028de
avm2: Correctly coerce render list indicies as `i32`, not `u32`.
2020-11-27 13:23:34 -08:00
David Wendt
01539baf5d
core: Move `render_children` into `TDisplayObjectContainer`.
2020-11-27 13:23:34 -08:00
David Wendt
ba311dd5b4
core: Remove previous changes to make certain `DisplayObject` methods take `&mut self`, which noises up the PR
2020-11-27 13:23:34 -08:00
David Wendt
6d992e239a
core: Re-fix #1580 as it's fix didn't make it into the `DisplayObjectContainer` refactor the first time
2020-11-27 13:23:34 -08:00
David Wendt
8764831533
chore: cargo 1.47 changed the formatting algorithm
2020-11-27 13:23:34 -08:00
David Wendt
365601f2d9
core: New-depth children should always be placed before higher children, not after lower ones.
...
We will call this the "before-above" rule, to contrast with the previous "after-below" behavior. The main difference is how off-depth-list children are handled, which more closely matches AVM2.
The previous implementation of after-below wouldn't work unless we made the fallback case of not having a below child put it to the *end* of the list. This gave us test pass but broke animations. The first one I tried, Cirno's Perfect Math Class, prepends the entire depth list, which with the half-broken after-below behavior wound up appending to the render list.
There isn't an inverse problem with before-below and the end of the list, since we cover that case and we don't have to put weird exceptions.
2020-11-27 13:23:34 -08:00
David Wendt
74b50f2586
core: AVM2-locked children should still be removable from the depth list.
2020-11-27 13:23:34 -08:00
David Wendt
3769d24715
core: Fix incorrect placement of clips where depth placements intended to place objects at the bottom of the list instead placed them at the top.
2020-11-27 13:23:34 -08:00
David Wendt
35bc43cce2
avm2: Swapping children should lock them from depth manipulation.
2020-11-27 13:23:34 -08:00
David Wendt
c8cd4a9192
avm2: Remove outdated documentation on some internal functions.
2020-11-27 13:23:34 -08:00
David Wendt
6cb3ff9632
avm2: Stub `getObjectsUnderPoint` and `areInaccessibleObjectsUnderPoint` as we do not yet support the `Point` class
2020-11-27 13:23:34 -08:00
David Wendt
fec4e3c0a9
core: Replace direct container manipulation with `TDisplayObjectContainer` methods wherever possible.
...
The purpose of this refactor is twofold:
1. Ensure `TDisplayObjectContainer` holds all the container methods we need
2. Ensure that future adjustments to trait methods automatically apply to the display object's own use of the container, in case we want to do things in those methods that can't be done in a borrowed container
There are two places where we cannot use the new trait methods:
1. `Button.set_state` as it holds a borrow at the point we want to clear the container
2. `MovieClipData.goto_remove_object`, since it's a method on the data and thus cannot access trait methods
This particular commit generates a lot of noise as several `DisplayObject` methods were incorrectly marked as non-mutating.
2020-11-27 13:23:34 -08:00
David Wendt
9dde91e0fd
core: Store named children on AVM2 movieclips as object properties
2020-11-27 13:23:34 -08:00
David Wendt
86e1037940
avm2: Implement `stopAllMovieClips`
2020-11-27 13:23:34 -08:00
David Wendt
3cac03857c
chore: Clippy beta compliance
2020-11-27 13:23:34 -08:00
David Wendt
cad2c4ecee
tests: Add a button child execution order test.
2020-11-27 13:23:34 -08:00
David Wendt
e2e598edde
avm2: Implement `swapChildren` and `swapChildrenAt`.
2020-11-27 13:23:34 -08:00
David Wendt
71cdbd7194
avm2: Implement `setChildIndex`
2020-11-27 13:23:34 -08:00
David Wendt
cf0ab2d82f
avm2: Implement `removeChildren`.
...
This also changes the underlying `DisplayObjectContainer` method to accept any type of range. Turns out enum trait objects aren't actually trait objects and don't need to worry about object safety!
2020-11-27 13:23:34 -08:00
David Wendt
38fd29ae5f
avm2: Implement `removeChildAt`
2020-11-27 13:23:34 -08:00
David Wendt
c97ff2b024
core: Implement remove-by-range functionality
2020-11-27 13:23:34 -08:00
David Wendt
495dcf9d05
core: Remove direct execution list head manipulation and the `replace_at_depth` flag that indicates that it has occured.
...
Depending on how I'm reading the old code I replaced, it appeared to be constructing execution lists backwards. I have no idea if this was intended behavior or not. If so, then I'll need to add reverse-add capability to `replace_at_depth`.
2020-11-27 13:23:34 -08:00
David Wendt
80d7409fc5
core: Separate off container management into a separate `DisplayObjectContainer` trait
2020-11-27 13:23:34 -08:00
David Wendt
fed28a7b46
chore: Add `Default` for `ChildContainer` as per clippy
2020-11-27 13:23:34 -08:00
David Wendt
759a590d76
avm2: Implement `getChildIndex`
2020-11-27 13:23:34 -08:00
David Wendt
2454287342
tests: Enable the `removeChild` test that tests timeline manipulation.
2020-11-27 13:23:34 -08:00
David Wendt
85fa8f327d
avm2: Impl `contains` w/ test
2020-11-27 13:23:34 -08:00
David Wendt
e4b5a3f8fc
core: When removing a child from it's parent, make sure it's marked as having no parent.
2020-11-27 13:23:34 -08:00
David Wendt
a2d876bc8c
core: Remove double-ended support for `ChildIter` as it's unnecessary and wastes time
2020-11-27 13:23:34 -08:00
David Wendt
1f2c194ffd
avm2: Remove unnecessary execution list accesses and debugging statements from `DisplayObjectContainer`.
2020-11-27 13:23:34 -08:00
David Wendt
bcef9ef415
tests: Add a whole number of tests of depth/render list interaction from the AS3 side
2020-11-27 13:23:34 -08:00
David Wendt
ab4dd984e8
core: Refactor display list management into a separate `ChildContainer` struct.
...
`ChildContainer` is responsible for maintaining child lists for all display objects that can hold children. Currently, this is just `Button` and `MovieClip` since those are the only objects in AVM1 that can have children, but this will be extended to other objects in future commits.
The number of lists managed has also increased from two to three. The execution list is unchanged save for it's migration into the `ChildContainer` struct. The render list has been split in two to support AS3. Specifically, the render list is now a `Vec`. Render children are still rendered in order but they are now referenced by AS3 `id`s rather than depths. The old `BTreeMap` that served as a render list is now the depth list and serves to maintain compatibility with SWF tags and AVM1 code that refers to things on the timeline by depth.
2020-11-27 13:23:34 -08:00
David Wendt
a5f09d3c09
avm2: Implement `removeChild`.
2020-11-27 13:23:34 -08:00
David Wendt
a5ea9795f6
avm2: Implement `addChild` and `addChildAt`, with tests
2020-11-27 13:23:34 -08:00
David Wendt
c7199ff83f
core: Add a utility for placing a display object at a particular relative position (rather than a static depth) on the render list.
...
For example, let's say we had two objects on the clip at depths 5 and 6. AS3 would see them as children IDs 0 and 1. Adding something at ID 1 translates to putting something between depth 5 and 6. To do this, we shift all higher-depth children up one depth to make room for the incoming clip, producing a new order of depths 5, 6, and 7.
2020-11-27 13:23:34 -08:00
David Wendt
52efbd98a8
core: Remove child's sibling pointers when removing the child from the parent's exec list.
...
This fixes a hang in as-of-yet uncommitted AS3 tests that reused display objects, where repeated removals and additions to the same MovieClip caused the construction of a cyclic render list.
2020-11-27 13:23:34 -08:00
David Wendt
cfd6965b2c
avm2: Use order in the render list (but NOT depths) rather than the execution list for `get_child_by_id`
2020-11-27 13:23:34 -08:00
David Wendt
b263b52bca
avm2: Correctly instantiate timeline clips whose AVM2 constructor isn't specified as a `flash.display.MovieClip`.
2020-11-27 13:23:34 -08:00
David Wendt
4817e92992
avm2: `getChildAt` works in reverse execution list order, not by depth
2020-11-27 13:23:34 -08:00
David Wendt
f3ae65df93
core: Add flag for display objects which were placed by AS3.
...
In AS3. objects placed by scripts *cannot* be removed by `RemoveObject` tags. This enforces that in Ruffle.
2020-11-27 13:23:34 -08:00
David Wendt
8c9f8520b3
avm2: Implement `DisplayObjectContainer.numChildren`
2020-11-27 13:23:34 -08:00
David Wendt
f748576927
avm2: Implement `getChildByName`
2020-11-27 13:23:34 -08:00
David Wendt
827567bb58
avm2: `toString` of stage objects should work the same way as other objects
2020-11-27 13:23:34 -08:00
David Wendt
dc629af177
avm2: `getChildById` indexes by zero, but it gives me the child at depth one.
2020-11-27 13:23:34 -08:00
David Wendt
d04f131cfe
avm2: Implement `DisplayObjectContainer.getChildAt`.
...
This test doesn't work yet because it needs `avm2-domainscope` to get merged in.
2020-11-27 13:23:34 -08:00
relrelb
1d648a1d55
core: Use encoding_rs in load_vars_loader
...
This adds support for BOM.
2020-11-26 15:41:50 -08:00
Nathan Adams
d8728bbf25
avm1: Made firstChild and lastChild ignore non-node children
2020-11-26 11:18:00 -08:00
Nathan Adams
c8bb54977b
core: Fix panic loading 'invalid-ish' html in text fields - fixes #1193
2020-11-26 11:17:00 -08:00
Mike Welsh
aff34a4233
core: Seed RNG with timestamp
2020-11-26 00:07:59 -08:00
Mike Welsh
53212f192c
chore: Appease clippy, squelch unnecessary_wraps lint
2020-11-24 18:59:42 -08:00
Mike Welsh
e655cf0c08
web: Add Ruffle::audio_context getter
2020-11-24 16:36:33 -08:00
Mike Welsh
8db4482fcf
core: Avoid panic on truncated SWF ( fix #1583 )
2020-11-24 00:29:28 -08:00
dependabot-preview[bot]
6b60fbe432
build(deps): bump syn from 1.0.50 to 1.0.51
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.50 to 1.0.51.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.50...1.0.51 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-23 17:21:29 -08:00
Mike Welsh
d9ac9fa076
avm1: Array.reverse should return itself
2020-11-22 13:50:49 -08:00
Mike Welsh
7ac53be24f
avm1: Implement TextField.removeTextField
2020-11-22 01:55:46 -08:00
Mike Welsh
03ab4e28d1
chore: Bump quickxml to 0.20
2020-11-22 01:55:01 -08:00
Mike Welsh
a61d2b54ae
avm1: Implement TextField.type
2020-11-21 16:58:19 -08:00
dependabot-preview[bot]
22d695421f
build(deps): bump syn from 1.0.48 to 1.0.50
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.48 to 1.0.50.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.48...1.0.50 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-21 15:20:54 -08:00
Mike Welsh
8d78ee5172
avm1: Use f64 when calculating scale/rotation ( fix #1622 )
2020-11-21 11:39:41 -08:00
MrCheeze
5ea3814097
core: Fix issue where unloaded buttons can still trigger mouse rollout events ( close #1603 )
2020-11-21 11:36:21 -08:00
David Wendt
5d542680ae
avm1: Remove bounds checks from `ActionDefineFunction`, `ActionWith`, `ActionDefineFunction2`, and `ActionTry`.
2020-11-20 00:28:56 -08:00
David Wendt
8ff085b464
avm1: Allow execution of opcodes before the start of an action or function.
2020-11-20 00:28:56 -08:00
Mike Welsh
2d463629e2
core: Avoid borrow panic when text is removed ( fix #1580 )
2020-11-19 18:42:31 -08:00
Mike Welsh
d3265bfd60
avm1: Add allow_empty param to Activation:resolve_target_display_object
...
In some cases, the empty string path "" should resolve to the
starting clip. In other cases, it should be considered invalid.
Add a parameter to control this behavior, and set this to false
for MovieClip::hit_test to prevent `clip.hitTest("")` from
returning true.
2020-11-18 17:58:42 -08:00
Mike Welsh
4c01022a38
avm1: Allow string paths in hitTest ( fix #1559 )
2020-11-18 17:58:42 -08:00
dependabot-preview[bot]
6bfa3144c3
build(deps): bump smallvec from 1.4.2 to 1.5.0
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.4.2...v1.5.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-18 16:30:15 -08:00
relrelb
2e0509694c
docs: Miscellaneous spelling corrections
2020-11-12 13:34:05 -08:00
Mike Welsh
48ee47d88a
tests: Add test for AVM2 Math
...
Also allow specifying relative epsilon for swf_tests_approx.
2020-11-12 04:24:47 -08:00
Mike Welsh
3ce8bc3c4b
avm2: Implement Math
2020-11-12 04:24:47 -08:00
Mike Welsh
b927acb2c2
avm2: trace accepts multiple arguments
2020-11-10 17:05:56 -08:00
Mike Welsh
2e73eba6c9
tests: Add test for unload clip event
2020-11-09 17:26:19 -08:00
Mike Welsh
15d0d814a7
avm1: Exclude unload clip event from continue_if_base_clip_exists
...
Unload event handlers should not halt if their clip is removed
(because it is already removed when an unload handler starts).
This will probably get cleaner if #1535 is fixed (unload clips
stay alive for one frame).
Fixes #447 .
2020-11-09 17:26:19 -08:00
Mike Welsh
fe6ff77889
tests: Add test for initialize clip event
2020-11-09 10:43:18 -08:00
Mike Welsh
3905837679
avm1: Fire initialize clip event
...
This event fires for new clips before any construct clip events.
Split the action queue up into separate priorities, giving
initialize the highest priority.
2020-11-09 10:43:18 -08:00
Mike Welsh
316bc4e920
chore: Appease clippy
2020-11-09 01:52:57 -08:00
relrelb
930d6ebe59
core: Correct MovieClip method names in error messages
...
They all were MovieClip.attachMovie probably becuase of copy-pasting.
2020-11-06 12:33:05 -08:00
David A Roberts
1a978600c6
avm1: Swap rendering order of MovieClip
...
Renders drawing API behind siblings in the same clip.
2020-11-06 12:31:56 -08:00
dependabot-preview[bot]
fcf665fbe9
build(deps): bump url from 2.1.1 to 2.2.0
...
Bumps [url](https://github.com/servo/rust-url ) from 2.1.1 to 2.2.0.
- [Release notes](https://github.com/servo/rust-url/releases )
- [Commits](https://github.com/servo/rust-url/compare/v2.1.1...v2.2.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-06 00:45:35 -08:00
Mike Welsh
4fe5fc44a6
tests: Bump script timeout to 200 secs
2020-11-03 16:02:53 -08:00
Nathan Adams
6c270d8c3a
core: Fix double borrow in button post_init - fixes #1450 and #1190
2020-11-03 15:15:47 -08:00
Nathan Adams
8f064eea6e
core: Strip newlines when loading editboxes that contain them and are marked singleline. This appears to be the correct behaviour - they're never stripped anywhere else but on load
2020-11-02 11:43:10 -08:00
Nathan Adams
f285c990c0
avm1: _root should be allowed in text variable bindings
2020-11-02 11:43:10 -08:00
Nathan Adams
51f986e274
core: Propagate text variable bindings when text is typed
2020-11-02 11:43:10 -08:00
Nathan Adams
3b15babec6
core: Show caret on empty edit boxes
2020-11-02 11:43:10 -08:00
Nathan Adams
a067170afd
core: Rename EditText::get_selection to ::selection
2020-11-02 11:43:10 -08:00
Nathan Adams
c520ff1f50
core: Only show carets for editable text
2020-11-02 11:43:10 -08:00
Nathan Adams
e6d39658b9
core: Change text input to be a match statement
2020-11-02 11:43:10 -08:00
Nathan Adams
8abf5a5be8
core: Limit text input to only editable text
2020-11-02 11:43:10 -08:00
Nathan Adams
e856968f75
core: Allow arrow keys in edit boxes
2020-11-02 11:43:10 -08:00
Nathan Adams
5592a6ca9d
core: Perform delete & backspace in edit boxes
2020-11-02 11:43:10 -08:00
Nathan Adams
cefa42fae0
tests: Add an avm1 test for Selection
2020-11-02 11:43:10 -08:00
Nathan Adams
c910824de8
core: Fix caret position in multi layout text
2020-11-02 11:43:10 -08:00
Nathan Adams
9893972710
core: Allow typing of text in edit boxes
2020-11-02 11:43:10 -08:00
Nathan Adams
881bf3789e
core: Clicking on text will place the caret at the position clicked
2020-11-02 11:43:10 -08:00
Nathan Adams
8a43eb9972
core: Display a caret when the text selection isn't a highlight
2020-11-02 11:43:10 -08:00
Nathan Adams
01c34b97f3
core: Show highlighted text in a slightly different colour (todo: background)
2020-11-02 11:43:10 -08:00
Nathan Adams
163e9fd21b
core: Clicking on (selectable) texts will make that text focused
2020-11-02 11:43:10 -08:00
Nathan Adams
1a230bda09
core: Remove focus when the focused object is removed
2020-11-02 11:43:10 -08:00
Nathan Adams
a4a2cd00b2
avm1: Implement Selection index getters & setSelection - #271
2020-11-02 11:43:10 -08:00
Nathan Adams
3f2057b53e
core: Edit boxes are always focusable, regardless of settings
2020-11-02 11:43:10 -08:00
Nathan Adams
171e23e9e1
avm1: Implement Selection.getFocus and setFocus - #271
2020-11-02 11:43:10 -08:00
Nathan Adams
efbab816e7
avm1: Implement MovieClip.focusEnabled - #263
2020-11-02 11:43:10 -08:00
Nathan Adams
b61a72166f
avm1: Stubbed out Selection - #271
2020-11-02 11:43:10 -08:00
Nathan Adams
93acb07374
core: Introduce a focus tracker, to keep track of one (and only one) focused object
2020-11-02 11:43:10 -08:00
Nathan Adams
f72310be43
core: Change the cursor to an IBeam on selectable text
2020-11-02 11:43:10 -08:00
Nathan Adams
f6b46cb615
core: Implement EditBox.selectable - #280
2020-11-02 11:43:10 -08:00
dependabot-preview[bot]
f04f4ef961
build(deps): bump flate2 from 1.0.18 to 1.0.19
...
Bumps [flate2](https://github.com/rust-lang/flate2-rs ) from 1.0.18 to 1.0.19.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases )
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.18...1.0.19 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-02 10:52:04 -08:00
Mike Welsh
93e7f657f1
tests: Update Array.concat test to print out entire array
2020-10-31 02:42:34 -07:00
Mike Welsh
ff74f67db8
avm1: Fix Array.concat incorrectly creating arrays
2020-10-31 02:42:34 -07:00
relrelb
e74e115cd0
core: Fix bug in PcmDecoder::next
...
It looks like the mono and stereo cases were mistakenly swapped
for 8-bit sounds. This commit simply swaps them to the correct
order.
2020-10-30 12:39:57 -07:00
Mike Welsh
0f4219610d
core: Properly handle masker-inside-masker ( fix #1347 )
...
If a masker is placed inside a masker, the inner mask is inactive
and instead renders as normal art, masked by the outer mask. Properly
handle this case by only pushing new masks if we are not currently
drawing the mask stencil.
Maskee inside maskee still functions as expected. (i.e., a clip
using a mask is masked itself).
2020-10-25 20:41:31 -07:00
dependabot-preview[bot]
55d16c200a
build(deps): bump approx from 0.3.2 to 0.4.0
...
Bumps [approx](https://github.com/brendanzab/approx ) from 0.3.2 to 0.4.0.
- [Release notes](https://github.com/brendanzab/approx/releases )
- [Commits](https://github.com/brendanzab/approx/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-25 12:07:13 -07:00
Mike Welsh
bc31c33f65
avm1: Test for removed clip after a function call
...
0482d1c
made it so that a stack frame halts if its base clip gets
removed (e.g. from a goto). It actually seems like this check
only occurs after a function/method call (see #1370 ). So
and gotoAndPlay method call can cause the stack frame to pop, but
a GotoFrame action cannot.
Only check if the base clip has been removed in CallFunction,
CallMethod, NewObject, NewMethod ops.
Fixes #1370 .
2020-10-24 17:36:38 -07:00
Mike Welsh
e55346a211
tests: Test for removed clip after a function call
2020-10-24 17:36:38 -07:00
dependabot-preview[bot]
05edb73d72
build(deps): bump syn from 1.0.46 to 1.0.48
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.46 to 1.0.48.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.46...1.0.48 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-24 17:20:21 -07:00
Mike Welsh
21818a896d
text: Draw white background for bordered text fields
2020-10-23 16:13:36 -07:00
relrelb
083e2a2ff5
core: Implement getBytes{Loaded,Total} (simpler approach)
2020-10-23 13:13:00 -07:00
relrelb
14a71b69cc
core: Implement getBytes{Loaded,Total}
2020-10-23 13:13:00 -07:00
Nathan Adams
bac4d8c2bf
avm1: Ratelimit timeout check to help ease performance
2020-10-23 13:03:47 -07:00
Mike Welsh
c2d4d56f88
avm1: Allow this in GetVariable/SetVariable paths
2020-10-22 17:23:22 -07:00
Mike Welsh
8da1eeafcb
tests: Add test for this in GetVariable action
2020-10-22 17:23:22 -07:00
Mike Welsh
41f77fade1
avm1: Export names are case insensitive
...
Fixes capital letters not appearing in #1346
2020-10-21 17:09:31 -07:00
Mike Welsh
e093f05656
tests: Add case insensitivity test for attachMovie
2020-10-21 17:09:31 -07:00
dependabot-preview[bot]
3e5457f712
build(deps): bump syn from 1.0.45 to 1.0.46
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.45 to 1.0.46.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.45...1.0.46 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-21 17:08:57 -07:00
Colin Berry
c51a31fde8
desktop: Support URL paths and Proxy options
2020-10-20 23:31:23 -07:00
dependabot-preview[bot]
2fdb378e4f
build(deps): bump syn from 1.0.44 to 1.0.45
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.44 to 1.0.45.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.44...1.0.45 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-17 13:00:00 -07:00
Nathan Adams
a2d53df49c
render: Store immutable part of wgpu rendering as a reusable object, to speed up exporting
2020-10-17 04:16:24 -07:00
David Wendt
6f659db342
tests: Fix the lazyinit test so that it actually passes on Ruffle
2020-10-17 03:32:09 -07:00
David Wendt
50d6ffb510
avm2: Prevent circularly referential scripts from causing stack overflows or double-borrows.
2020-10-17 03:32:09 -07:00
David Wendt
a484861f79
tests: Add a test for lazy initialization load order.
2020-10-17 03:32:09 -07:00
David Wendt
d27360b282
avm2: Enable lazy initialization for ABCs that request it.
2020-10-17 03:32:09 -07:00
David Wendt
0d1676afda
avm2: Create a separate domain for each loaded movie and pull symbols out of each.
2020-10-17 03:32:09 -07:00
David Wendt
cdab885979
avm2: Implement `ApplicationDomain` and all methods that don't require `Vector` or domain memory
2020-10-17 03:32:09 -07:00
David Wendt
1aceb7776d
avm2: Superclasses should resolve out of the current scope stack.
2020-10-17 03:32:09 -07:00
David Wendt
00fcc5ffa4
avm2: Reference the current domain at the bottom of the scope stack.
2020-10-17 03:32:09 -07:00
David Wendt
f2caf60d3e
avm2: Scripts should run in a child of the global domain.
2020-10-17 03:32:09 -07:00
David Wendt
1792939212
avm2: Script scopes should hold the domains they are a part of.
...
Also, this means we have a `TObject` representation for domains now.
2020-10-17 03:32:09 -07:00
David Wendt
6a736b0d2b
avm2: Wrap all player globals in a separate appdomain and script.
...
This entirely abolishes the "global scope object" in AVM2. I even had to redefine several global object functions to work with the bottom of the scope stack, which seems to be where ASC likes to stick the script scope.
2020-10-17 03:32:09 -07:00
David Wendt
add7c4d43d
avm2: Collect all script definition names and associated scripts into a `Domain`.
2020-10-17 03:32:09 -07:00
David Wendt
02e05e3d7f
Add separate scope object for each script.
2020-10-17 03:32:09 -07:00
Mike Welsh
4558be948e
render: Fix masking issues on wgpu/webgl backends
...
Change the usage of the stencil buffer to avoid running out of
stencil bits when too many nested masks are active.
This also cleans things up on wgpu which requires us to make
pipeline states in advice; now we only need a few stencil states
for masking as opposed to hundreds.
2020-10-17 02:42:56 -07:00
Mike Welsh
97a3ef73a3
tests: Add tests for issue #893
2020-10-15 00:10:55 -07:00
Mike Welsh
e66b71817b
avm1: Stop execution if base clip is removed ( fix #893 )
...
Stop execution of the current stack frame if the base clip was
removed (for example, due to a goto).
2020-10-15 00:10:55 -07:00
Nathan Adams
6d9155477c
core: Add flashvars support - #312
2020-10-12 15:28:16 -07:00
Mike Welsh
a6b952e44e
core: Switch from libflate to flate2
2020-10-12 13:47:35 -07:00
Mike Welsh
2c2aa82730
chore: Remove debug message
2020-10-12 13:30:03 -07:00
Nathan Adams
fd6431f724
core: Don't use std Instant as it doesn't work for web, use a wrapper
2020-10-11 13:34:15 -07:00
Nathan Adams
4abd02e2f7
core: Implement a timeout for script execution, defaulting to 15 seconds. Fixes #554
2020-10-11 13:34:15 -07:00
Mike Welsh
137ac2887e
core: Don't mouse pick children when invisible ( fix #1242 )
2020-10-11 04:10:25 -07:00
Mike Welsh
2c9cf6802d
core: Squelch false AS3 error before initial SWF loads
2020-10-10 19:28:01 -07:00
Mike Welsh
5c3dd25638
avm1: Avoid unwrap in Sound constructor
...
At least avoid the panic in this case, but it can possibly fail
(see #701 ).
2020-10-10 18:13:08 -07:00
dependabot-preview[bot]
2c2a70e714
build(deps): bump syn from 1.0.43 to 1.0.44
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.43 to 1.0.44.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.43...1.0.44 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-10 16:35:50 -07:00
Mike Welsh
23660e49c9
core: Avoid panic due to invalid style IDs
...
If the shape converter encountered a fill/line style with an
ID > the number of styles, Ruffle would panic as it tried to grab
the non-existent style. This could occur if we mis-parsed some
shape data, or the SWF contained incorrect data. Now we the invalid
style is gracefully ignored.
2020-10-10 16:35:37 -07:00
Mike Welsh
10aaae9247
chore: Appease nightly clippy
2020-10-10 00:03:25 -07:00
dependabot-preview[bot]
4af9632761
build(deps): bump syn from 1.0.42 to 1.0.43
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.42 to 1.0.43.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.42...1.0.43 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-09 12:22:43 -07:00
David Wendt
5abebd5433
avm2: Yield an error if the caller specifies a label/scene pair and the label is not present within the scene.
2020-10-06 06:03:22 -07:00
David Wendt
1a10f1e004
avm2: Lock old movies (SWFv8 and earlier) to always use AVM1
2020-10-06 06:03:22 -07:00
David Wendt
693e56dc67
core: Always instantiate a new movie's library before creating it's root movieclip.
2020-10-06 06:03:22 -07:00
David Wendt
7c719bfb0c
Only the first tag in a SWF file should be trusted to deliver file attributes.
2020-10-06 06:03:22 -07:00
David Wendt
ddccede9d3
avm2: Make VM type non-optional.
...
This has the side effect of forcing the AVM check to happen at the time of library construction, which is already very early on in movie loading.
2020-10-06 06:03:22 -07:00
David Wendt
ef665acaec
avm2: Movie clips not explicitly granted a `symbol_class` should be constructed using the `MovieClip` class directly
2020-10-06 06:03:22 -07:00
David Wendt
12cf8022cd
core: Remove useless uses of `matches!`.
2020-10-06 06:03:22 -07:00
David Wendt
007d54b389
avm2: Remove redundant implementations of `prev_frame` and `next_frame`
2020-10-06 06:03:22 -07:00
David Wendt
4c44ca8e77
avm2: Non-integer numbers should be handled as strings and integer-parsible strings should be handled as numbers.
2020-10-06 06:03:22 -07:00
David Wendt
e2f21d0a7d
avm2: Retire old references to the "VM tendency" nomenclature
2020-10-06 06:03:22 -07:00
David Wendt
896a5b37a5
avm2: Implement `new MovieClip()`.
2020-10-06 06:03:22 -07:00
David Wendt
d399811eb8
avm2: Allow `MovieClip` to be constructed by users.
2020-10-06 06:03:22 -07:00
David Wendt
50dd9a6733
avm2: Implement the programmatically-playing flag that governs `isPlaying` behavior.
2020-10-06 06:03:22 -07:00
David Wendt
035c841eb5
tests: Add tests for `gotoAndStop` and rename the `gotoAndPlay` one
2020-10-06 06:03:22 -07:00
David Wendt
1f29497b8c
tests: Add test for AS3 movieclip play
2020-10-06 06:03:22 -07:00
David Wendt
8152400a39
avm2: Implement `MovieClip.scenes`.
2020-10-06 06:03:22 -07:00
David Wendt
c682868205
avm2: Implement `MovieClip.currentScene`
2020-10-06 06:03:22 -07:00
David Wendt
2483201bcd
avm2: Store the lengths of each scene in a movie.
2020-10-06 06:03:22 -07:00
David Wendt
8a13d5fe10
avm2: Implement `Scene` object.
2020-10-06 06:03:22 -07:00
David Wendt
5e31c44b81
All objects should default to `toString`ing with their own classname.
2020-10-06 06:03:22 -07:00
David Wendt
de186ed5f3
avm2: Implement `MovieClip.currentLabels`
2020-10-06 06:03:22 -07:00
David Wendt
77a86aef9b
avm2: Implement `FrameLabel`.
2020-10-06 06:03:22 -07:00
David Wendt
86b07c0007
tests: Add tests for `prevScene` and `nextScene`.
2020-10-06 06:03:22 -07:00
David Wendt
542147d657
avm2: Run all AVM2 frame scripts on the action queue.
...
This is the same way that AVM1 actions run and it appears that frame scripts work exactly the same way. It fixes all outstanding bugs with movie clip navigation in AVM2 and allows me to remove a lot of weird workarounds I was writing for the old, incorrect behavior.
I'm also removing the "last run script frame" rule as `run_frame_internal` already had rules to prevent stopped clips from rerunning actions.
2020-10-06 06:03:22 -07:00
David Wendt
996d7528d5
avm2: Implement `prevScene` and `nextScene`.
2020-10-06 06:03:22 -07:00
David Wendt
864c6a37f9
avm2: Dynamic properties should be retrievable before they are actually set.
2020-10-06 06:03:22 -07:00
David Wendt
6d0befad97
avm2: Implement `prevFrame` and `nextFrame`, with tests.
2020-10-06 06:03:22 -07:00
David Wendt
bcf08b5bf7
avm2: Frame scripts should run when the frame number has changed, regardless of playhead state.
2020-10-06 06:03:22 -07:00
David Wendt
97048fb8bd
avm2: Implement `stop` and `play`, with tests for the former.
2020-10-06 06:03:22 -07:00
David Wendt
c8cd4d09cd
core: Don't run frame scripts on stopped movie clips.
2020-10-06 06:03:22 -07:00
David Wendt
556c951b1c
avm2: Implement `gotoAndPlay`/`gotoAndStop`, with test.
2020-10-06 06:03:22 -07:00
David Wendt
3513918149
avm2: Allow typechecking by prototype, rather than just by constructor.
2020-10-06 06:03:22 -07:00
David Wendt
e837840bba
core: Always skip frames after the current frame when getting the current scene or label.
2020-10-06 06:03:22 -07:00
David Wendt
5b83f6b4cc
avm2: Add test for movieclip-specific properties.
2020-10-06 06:03:22 -07:00
David Wendt
3b6f8cff4e
avm2: Implement `framesLoaded`, `isPlaying`, and `totalFrames`.
2020-10-06 06:03:22 -07:00
David Wendt
7ca34452a1
avm2: Implement `currentFrameLabel` and `currentFrame`.
2020-10-06 06:03:22 -07:00
David Wendt
6124ed468f
core: Add `current_label` for getting the current label on a given clip.
...
This also fixes `current_scene` as well.
2020-10-06 06:03:22 -07:00
David Wendt
c1b14b7639
avm2: Implement `currentFrame`.
2020-10-06 06:03:22 -07:00
David Wendt
7756fd530d
core: Allow grabbing the movieclip's current scene, if scene labels are defined.
2020-10-06 06:03:22 -07:00
David Wendt
d747ef7914
core: Store scene and frame labels generated by the `DefineSceneAndFrameLabelData` tag.
2020-10-06 06:03:22 -07:00
David Wendt
55fec14a1c
tests: Add tests for timeline scripts.
2020-10-06 06:03:22 -07:00
David Wendt
c04bf7d53c
`addFrameScript` indexes by zero, not by one.
2020-10-06 06:03:22 -07:00
David Wendt
ab45b9084d
avm2: Parse `SymbolClass` package paths correctly.
2020-10-06 06:03:22 -07:00
David Wendt
a1a21500d8
core: Warn when a movie clip is AVM2-constructed without an accompanying symbol class.
2020-10-06 06:03:22 -07:00
David Wendt
8c67260e68
core: Special-case ID 0 as the current movie timeline.
...
Note: This relies on the fact that SWF files do not stick `SymbolClass` declarations in child movieclips. If this isn't the case, then it will fail horribly, and we would then need to actually store clip 0 in the library somehow.
2020-10-06 06:03:22 -07:00
David Wendt
f2c3466026
avm2: The AVM2 constructor should be an actual Class, not it's prototype.
2020-10-06 06:03:22 -07:00
David Wendt
e915a07d4f
core: ABC files should resolve at the time of discovery, not on the action queue.
2020-10-06 06:03:22 -07:00
David Wendt
7e898457b0
avm2: Implement `addFrameScript`.
2020-10-06 06:03:22 -07:00
David Wendt
d991c49774
Implement `addFrameScript`.
2020-10-06 06:03:22 -07:00
David Wendt
664152d739
avm2: Mark `EventDispatcher` as implementing `IEventDispatcher`.
...
This doesn't actually implement any of it's methods yet, which *would* cause an error *if* we were verifying that.
2020-10-06 06:03:22 -07:00
David Wendt
e72c9776ec
avm2: Implement `IEventDispatcher`.
2020-10-06 06:03:22 -07:00
David Wendt
c899b3080a
avm2: Add function to unwrap a `StageObject` as it's underlying `DisplayObject`.
2020-10-06 06:03:22 -07:00
David Wendt
a70e1be466
Add code to instantiate AVM2 movie clips correctly.
...
This also includes several bits to build an effective VM barrier.
2020-10-06 06:03:22 -07:00
David Wendt
247e79e61a
core: Track the VM each movie has pledged to execute on.
...
This uses a "VM tendency" system wherein the presence of `DoAction` or `DoInitAction` tags defaults the movie to AVM1, while the presence of `DoABC` defaults to AVM2. The presence of a `FileAttributes` tag allows setting the VM tendency in the same manner using it's AS3 bit.
Particularly malformed SWFs may cause execution issues if Flash Player uses a dramatically different system from this.
2020-10-06 06:03:22 -07:00
David Wendt
3128bbcda6
core: Implement `SymbolClass` tag.
2020-10-06 06:03:22 -07:00
David Wendt
edd31c4b83
core: Allow pulling the AVM2 Object out of a participating movie clip.
2020-10-06 06:03:22 -07:00
David Wendt
f85319aa4c
core: Allow `DisplayObject` to hold AVM2 objects.
...
This requires the use of an intermediary enum called `AvmObject` which can hold either object representation. Currently, it's mostly just being unwrapped as AVM1 objects, which we will need to fix.
2020-10-06 06:03:22 -07:00
David Wendt
63f411d231
avm2: Add `StageObject` object implementation for holding display objects in AVM2.
2020-10-06 06:03:22 -07:00
David Wendt
3fb186e5c0
avm1: Remove fscommand debug code
2020-10-01 13:53:00 -07:00
David Wendt
1a77874e04
avm1: For good measure, also unload on empty URL in `ActionGetURL`.
2020-10-01 13:53:00 -07:00
David Wendt
bb5c367e91
chore: Remove dbg statement in loaders
2020-10-01 13:53:00 -07:00
David Wendt
e73cdd7987
avm1: Actually unload movies when we get an empty URL in `GetURL2` and the target is a sprite.
2020-10-01 13:53:00 -07:00
CUB3D
f0a02f00b5
core: Changes from review
2020-09-29 11:06:56 -07:00
CUB3D
110b9ec551
core: Fix edge cases and implement rest of bevel filter
2020-09-29 11:06:56 -07:00
CUB3D
2c3ee4d94b
core: Add flash.filters.BevelFilter
2020-09-29 11:06:56 -07:00
Sean-Thomas
5701312527
desktop: Implement play/pause for CPAL backend
...
- removed default implementations for `play()` and `pause()` methods for AudioBackend trait
- Implemented `play()` and `pause()` methods for CPAL audio backend
- Implemented empty block for `play()` and `pause()` methods for NULL audio backend
2020-09-29 11:05:23 -07:00
Sean-Thomas
a9538f81d0
web: Renamed "prime_audio" and "suspend_audio"
...
Renamed "prime_audio" and "suspend_audio" to "play" and "pause" respectfully.
2020-09-29 11:05:23 -07:00
Sean-Thomas
6b54cc4311
web: Add pause method for web player
...
Adds a suspend_audio method to compliment prime_audio on WebAudioBackend, as well as logic in player.rs on the set_is_playing method to suspend audio when is_playing is set to false. Exposes pause method for the ruffle player in JavaScript with logic to display the play button when paused.
2020-09-29 11:05:23 -07:00
Mike Welsh
ead845ff33
chore: Appease clippy
2020-09-26 18:19:37 -07:00
Mike Welsh
98d2651e62
tests: Add tests for Array single-param ctor
2020-09-26 14:13:06 -07:00
Mike Welsh
366e8aa926
Array: Fix Array single-param ctor
...
The Array constructor with a single param sets the length if the
parameter is a number (no coercion is done); otherwise, it is
creates an 1-length Array containing the parameter. Previously
we coerced the parameter to a float.
2020-09-26 14:13:06 -07:00
Mike Welsh
9e13058e04
avm1: Fix list of elements in Array ctor ( fix #1195 )
2020-09-26 14:13:06 -07:00
David Wendt
6bb6bcab7a
core: Store rotations in degrees to avoid floating-point conversion discrepancies.
2020-09-26 14:12:49 -07:00
David Wendt
28bf84bd8b
core: Store object scale as percentages to avoid floating point precision problems.
...
Fixes a specific pattern of preloader design where animations were handled by just making the box bigger every frame until it's 100. Of course, direct equality of f64 is a terrible idea, but it works in Flash, which apparantly must store scale in percentages. So we must, too.
2020-09-26 14:12:49 -07:00
David Wendt
f6f084098e
tests: Add a test for floating point errors in the AVM1 representation of `_xscale`, `_yscale`, and `_rotation`.
2020-09-26 14:12:49 -07:00
dependabot-preview[bot]
c5135fc737
build(deps): bump syn from 1.0.41 to 1.0.42
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.41 to 1.0.42.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.41...1.0.42 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-26 14:11:01 -07:00
dependabot-preview[bot]
0dfac7b1ac
build(deps): bump gif from 0.11.0 to 0.11.1
...
Bumps [gif](https://github.com/image-rs/image-gif ) from 0.11.0 to 0.11.1.
- [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.0...v0.11.1 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-25 13:22:07 -07:00
Mike Welsh
802636fbbf
chore: Bump to gif 0.11.0
2020-09-21 18:30:27 -07:00
Luca Weiss
8a8075ca99
avm1: Fix registered function names for Sound object ( #1209 )
...
The functions are just stubs currently so this shouldn't change any
behavior.
2020-09-19 16:21:50 -07:00
Nathan Adams
4a83641a6c
core: Support \r newlines in texts - fixes #1071 , #808
2020-09-19 16:18:35 -07:00
Luca Weiss
d5cb396331
*: fix spelling mistakes
2020-09-19 16:17:58 -07:00
Mike Welsh
2f84d468ee
text: Default text span color should be black
...
Previosuly color defaulted to 0% alpha, causing text to be
invisible if the text field did not specify a defualt color.
2020-09-18 18:58:09 -07:00
Mike Welsh
6f2655cf95
tests: Add test for SWF4 string ops
2020-09-17 16:03:51 -07:00
Mike Welsh
7eeba10bef
avm1: Clean up SWF4 string ops
...
Clean up SWF4 string ops:
* Operate on UTF-16 code units (in SWF6+)
* StringExtract indices are 1-based
2020-09-17 16:03:51 -07:00
Mike Welsh
4f6c017bc0
avm1: Move utf16 util methods to string_utils
2020-09-17 16:03:51 -07:00
Nathan Adams
ef3d5c1538
core: Apply a mask when rendering text, fixes parts of #1167
2020-09-17 16:03:16 -07:00
Nathan Adams
e008603426
core: Add draw_rect to the render backend API
2020-09-17 16:03:16 -07:00
Mike Welsh
3cc43265bf
core: Always recurse down into movieclips when mouse picking
...
Was only consdering the world bounds, but buttons can have separate
hit areas that don't actually affect the bounds of the parent clip.
(TODO: Could have keep track of a separate mouse_bounds instead.)
Fixes regression in Mini-Putt 2 (#1120 ).
2020-09-15 02:34:32 -07:00
Mike Welsh
4593320d36
tests: Add more tests to hittest_shapeflag test
2020-09-15 02:34:32 -07:00
Mike Welsh
fe3bf5cb59
core: Implement hit_test_shape for MorphShape
2020-09-15 02:34:32 -07:00
Mike Welsh
4d26ebe9b4
core: Implement hit_test_shape for EditText
2020-09-15 02:34:32 -07:00
Mike Welsh
e9a2ef5d82
core: DisplayObject::hit_test_shape now takes UpdateContext
...
Make default implementation the same as hit_test_bounds.
2020-09-15 02:34:32 -07:00
Mike Welsh
0d111ca92f
avm1: _target of root should be /
...
Also, levels other than 0 should be appened in slash syntax, e.g
_level1/clip
2020-09-15 02:20:24 -07:00
David Wendt
f2380d828a
chore: Don't capitalize our type arguments.
2020-09-15 02:20:11 -07:00
David Wendt
7e91c45950
avm2: Move trait methods into the AS3 namespace.
...
`toString`, `toLocaleString`, and `valueOf` are still `public`, because they're not supposed to be trait methods at all.
2020-09-15 02:20:11 -07:00
David Wendt
27eda5cdf1
avm2: Remove `ArrayIterator` trait.
...
I originally added this with the anticipation that `impl` return syntax only allowed one trait plus OIBITs. This was prior experience in Rust but apparantly the compiler accepts this just fine, so I suppose my defensive coding practice was a bad/outdated idea.
2020-09-15 02:20:11 -07:00
David Wendt
de0bc93839
Fix `hasOwnProperty` yielding false on populated non-hole array indicies.
2020-09-15 02:20:11 -07:00
David Wendt
e581704559
avm2: `new Array()` should reject negative and `NaN` length arguments as errors.
2020-09-15 02:20:11 -07:00
David Wendt
582df3bd7d
avm2: Misc perf fixes and nits in Array globals.
2020-09-15 02:20:11 -07:00
David Wendt
07e14463e2
avm2: Array `join` and `toString` treat `undefined` and `null` as empty strings.
2020-09-15 02:20:11 -07:00
David Wendt
3b7922d222
avm2: Implement `Array.sortOn`
2020-09-15 02:20:11 -07:00
David Wendt
0aa2c50118
avm2: Implement `Array.sort`
2020-09-15 02:20:11 -07:00
David Wendt
bb19699739
avm2: Add convenience method for converting a `Value` into an `EnumSet`.
2020-09-15 02:20:11 -07:00
David Wendt
a653a62a93
avm2: Add array sorting constants.
2020-09-15 02:20:11 -07:00
David Wendt
ca4982029b
avm2: Impl `Array.toLocaleString`.
2020-09-15 02:20:11 -07:00
David Wendt
2ae3b6445b
avm2: Partially implement `toLocaleString` insamuch as is necessary to run Array tests on it.
...
This appears to work almost like it's own TObject method; you can run `Object.prototype.toLocaleString` on all sorts of things and it has separate behavior to what the class method for it might be. I have attempted to match Flash Player as best as I can.
2020-09-15 02:20:11 -07:00
David Wendt
dbaef812fa
avm2: Impl `Array.splice`.
2020-09-15 02:20:11 -07:00
David Wendt
53b564bb52
avm2: Implement `Array.slice`.
2020-09-15 02:20:11 -07:00
David Wendt
685fbc12e0
tests: `Array.reverse`'s test should also include a check for holes.
2020-09-15 02:20:11 -07:00
David Wendt
036f7cbb90
avm2: Implement `Array.shift` and `Array.unshift`.
...
This also updates `Array.push` to support it's ability to push multiple arguments at once.
2020-09-15 02:20:11 -07:00
David Wendt
879aff3669
avm2: Implement `Array.reverse`
2020-09-15 02:20:11 -07:00
David Wendt
1ce78388a3
avm2: Implement `Array.push` and `Array.pop`
2020-09-15 02:20:11 -07:00
David Wendt
0ece924877
avm2: Implement `indexOf` and `lastIndexOf`
2020-09-15 02:20:11 -07:00
David Wendt
7aa1ab82e4
avm2: Avoid locking the array when running user code.
...
The array being iterated is explicitly handed to all callbacks, and it is legal for the callback to mutate the array. Hence, we can't actually hold a `Ref` to the array storage when we call user code. Instead, we implement a custom `Iterator` which iterates over the object like user code would.
This actually can't be an `Iterator` impl due to limitations of the underlying trait. Hence, we have to `while let` instead of `for`.
2020-09-15 02:20:11 -07:00
David Wendt
832bbdd711
avm2: Implement `forEach`, `map`, `filter`, `every`, and `some` on `Array`.
...
This also comes with some refactoring: building the resulting array object and resolving holes is now done in helper methods.
2020-09-15 02:20:11 -07:00
David Wendt
0eeee72be6
avm2: Implement `Array.join`, `Array.toString`, and `Array.valueOf` (w/tests)
2020-09-15 02:20:11 -07:00
David Wendt
79df789028
tests: Add test for `Array.concat`.
2020-09-15 02:20:11 -07:00
David Wendt
75e6018607
tests: Add test for `newarray`.
2020-09-15 02:20:11 -07:00
David Wendt
505018c3b8
avm2: Implement `newarray`.
2020-09-15 02:20:11 -07:00
David Wendt
27793092c2
tests: Add `array_holes` test.
2020-09-15 02:20:11 -07:00
David Wendt
3d37fda1ef
tests: Add tests for `deleteproperty` on arrays.
2020-09-15 02:20:11 -07:00
David Wendt
04828663e8
avm2: `deleteproperty` should only ever yield `false` when attempting to delete unknown properties on a sealed class object.
2020-09-15 02:20:11 -07:00
David Wendt
6d9b9c9218
avm2: Attempts to get unknown properties on dynamic objects should yield `undefined`.
2020-09-15 02:20:11 -07:00
David Wendt
966dfc3902
avm2: Add method to get at the `Class` of non-class objects with a prototype.
...
The only unclassed objects should be bare objects, which are hard to get at.
2020-09-15 02:20:11 -07:00
David Wendt
cac1717780
avm2: Add utility method `is_sealed` for `Class`.
2020-09-15 02:20:11 -07:00
David Wendt
1a8f041b77
tests: Add `array_storage` test.
2020-09-15 02:20:11 -07:00
David Wendt
34ba1643dd
tests: Add test for reading properties of an array
2020-09-15 02:20:11 -07:00
David Wendt
5a29b781ec
avm2: Ensure `ArrayObject` offers access to it's array properties for reading and writing.
2020-09-15 02:20:11 -07:00
David Wendt
e054456286
avm2: Add method to check if a particular namespace is the public namespace.
2020-09-15 02:20:11 -07:00
David Wendt
1d3f5d80be
tests: Add test for `new Array`'s arguments.
2020-09-15 02:20:11 -07:00
David Wendt
a09ba9d263
avm2: Implement `length`.
2020-09-15 02:20:11 -07:00
David Wendt
aaf586e3a7
avm2: `define_instance_trait` should actually define instance traits.
2020-09-15 02:20:11 -07:00
David Wendt
45c95cae02
avm2: Impl `Array.concat`
2020-09-15 02:20:11 -07:00
David Wendt
1092bf2bc5
avm2: Add the ability to wrap an already-constructed array in an object.
2020-09-15 02:20:11 -07:00
David Wendt
bd35ebb793
avm2: Impl `Array` constructor
2020-09-15 02:20:11 -07:00
David Wendt
bedd5fa007
avm2: Add a method for mutating the array storage of an object.
2020-09-15 02:20:11 -07:00
David Wendt
d92d3023e7
avm2: Restore `as_number`.
...
This is for the sake of methods that want to change behavior based on if they're working with a number or some other kind of value. It should not be used otherwise.
2020-09-15 02:20:11 -07:00
David Wendt
16e1a1bdf3
avm2: Add Array class.
...
This code also ensures that the prototypes of each system object are created in the appropriate `TObject` impl. This ensures that, for example, `new Array` hands you back an actual array.
2020-09-15 02:20:11 -07:00
David Wendt
88fc9b1538
avm2: Implement base types for array-shaped objects.
2020-09-15 02:20:11 -07:00
dependabot-preview[bot]
f0976cffc7
build(deps): bump syn from 1.0.40 to 1.0.41
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.40 to 1.0.41.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.40...1.0.41 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-14 12:02:03 -07:00
Nathan Adams
3ff399ca6b
core: Trace only to the log backend, but have the default log backend trace to the log crate
2020-09-13 13:51:39 -07:00
Nathan Adams
319efabb47
tests: Make tests capture trace output through new backend
2020-09-13 13:51:39 -07:00
Nathan Adams
e25e03a841
core: Log to new avm_trace method where we want things to show up
2020-09-13 13:51:39 -07:00
Nathan Adams
de009c7673
core: Add Log backend, for capturing trace output specific to a movie
2020-09-13 13:51:39 -07:00
dependabot-preview[bot]
491526cc93
build(deps): bump bitstream-io from 0.8.5 to 0.9.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 0.8.5 to 0.9.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/compare/v0.8.5...v0.9.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-11 21:17:24 -07:00
Adrian Wielgosik
0fe88f23bb
avm1: Use fnv hash in PropertyMap
2020-09-09 10:44:52 -07:00
CUB3D
8a5434c956
core: Switch to enum for differentiating callable values from uncallable ones
2020-09-07 13:14:48 -07:00
CUB3D
efa7e862fd
core: Propagate this through scope and get_variable
2020-09-07 13:14:48 -07:00
CUB3D
91d5e0f74b
core: Update tests
2020-09-07 13:14:48 -07:00
CUB3D
136a5664b0
core: Pass the correct this for CallFunction when in a with scope
...
fixes #805 , #945 , #1018
2020-09-07 13:14:48 -07:00
Mike Welsh
a18e80baf2
chore: Fix clippy lints
2020-09-07 12:18:41 -07:00
dependabot-preview[bot]
08f1299595
build(deps): bump syn from 1.0.39 to 1.0.40
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.39 to 1.0.40.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.39...1.0.40 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-07 11:14:14 -07:00
dependabot-preview[bot]
07a6075765
build(deps): bump indexmap from 1.5.2 to 1.6.0
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.5.2 to 1.6.0.
- [Release notes](https://github.com/bluss/indexmap/releases )
- [Commits](https://github.com/bluss/indexmap/compare/1.5.2...1.6.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-07 11:13:54 -07:00
David Wendt
35b589b2ac
avm2: `in` should only ever query non-namespaced/public properties.
2020-09-07 11:07:07 -07:00
David Wendt
3b5411547a
avm2: Implement `in`
2020-09-07 11:07:07 -07:00
David Wendt
11b8354905
avm2: `resolve_any` should resolve prototype properties.
2020-09-07 11:07:07 -07:00
Mike Welsh
64679e8796
avm1: typeof button/text should be object ( fix #1110 )
2020-09-04 11:33:40 -07:00
Nathan Adams
b2dc564628
avm1: Fix String.lastIndexOf(undefined)
2020-09-04 11:32:16 -07:00
Nathan Adams
ea7a9758c4
avm1: Fix String.indexOf(undefined)
2020-09-04 11:32:16 -07:00
Mike Welsh
86ab300ee8
core: Call post_instantiate on initial empty root ( fix #946 )
...
The `fake_root` did not have an object, which could cause the
player to panic if the SWF was not completely loaded when playing.
Calling `post_instantiate` ensures that this dummy root has an
object.
2020-09-04 11:31:04 -07:00
Mike Welsh
3a813f1f15
tests: Test for #1104
2020-09-03 19:09:48 -07:00
Mike Welsh
5ea06b0ce6
swf: Use Option for more PlaceObject parameters
...
There is a difference between empty/default (change value to default)
and none (don't modify), so make this explicit for some PlaceObject
parameters where it wasn't.
Fixes #1104 .
2020-09-03 19:09:48 -07:00
Mike Welsh
151b13a424
avm1: ExternalInterface properties are read only
2020-09-03 18:17:44 -07:00
Nathan Adams
b5531a48d0
web: Allow reentrant ExternalInterface callbacks
2020-09-03 18:17:44 -07:00
Nathan Adams
a49e8d8587
web: Implement two-way communication with ExternalInterface
2020-09-03 18:17:44 -07:00
Nathan Adams
687c912067
core: Allow for reentry from ExternalInterface methods
2020-09-03 18:17:44 -07:00
Nathan Adams
32de953822
core: Allow passing arguments and returning values to/from ExternalInterface
2020-09-03 18:17:44 -07:00
Nathan Adams
e1b3ac79d6
core: Add ability to call out to ExternalInterfaceProviders
2020-09-03 18:17:44 -07:00
Nathan Adams
502ea98ed4
core: Add ability to call in to ExternalInterface callbacks from outside of the player (+ test)
2020-09-03 18:17:44 -07:00
Nathan Adams
169c61bf96
tests: Added ability for tests to have a before_start and before_end, and added basic ExternalInterface test that uses it
2020-09-03 18:17:44 -07:00
Nathan Adams
3784f411b4
core: Add ExternalInterface::addCallback
2020-09-03 18:17:44 -07:00
Nathan Adams
b66e9f8d16
avm1: Add ExternalInterface with only 'available' property right now
2020-09-03 18:17:44 -07:00
Nathan Adams
8f11141426
core: Add initial ExternalInterface structs
2020-09-03 18:17:44 -07:00
Nathan Adams
c5ac707fb5
avm1: Iterating xmlnode attributes should list every attribute
2020-09-03 17:03:43 -07:00
Nathan Adams
bcb64b9a62
avm1: Fix calling Function() as a function - fixes #1074
2020-09-03 17:01:20 -07:00
Nathan Adams
40cdb84656
tests: Add test for avm1 Function(foo)
2020-09-03 17:01:20 -07:00
Mike Welsh
ce2b360ab7
core: Provide default impl for DisplayObject:hit_test_bounds
2020-09-02 17:51:55 -07:00
Mike Welsh
b0c9795cad
core: Graphic::from_swf_tag takes ownership of Shape
2020-09-02 17:51:55 -07:00
Mike Welsh
f2f70cc882
core: Mouse picking for buttons uses shape hit tests
2020-09-02 17:51:55 -07:00
Mike Welsh
d7a186b2cd
avm1: Implement shape hit testing
2020-09-02 17:51:55 -07:00
Mike Welsh
2da3c0d319
tests: Add hitTest shapeflag test
2020-09-02 17:51:55 -07:00
Nathan Adams
ec407a9514
avm1: Don't blanket impl From<i64> for Value, convert it explicitly where we know it's okay
2020-09-02 17:12:31 -07:00
Nathan Adams
0b5713557b
desktop: Implement LocaleBackend for desktop
2020-09-02 17:12:31 -07:00
Nathan Adams
f50b29151c
avm1: If a NaN is provided to new Date(timestamp), fail immediately
2020-09-02 17:12:31 -07:00
Nathan Adams
9dfc20e1ba
avm1: Implement Date.UTC
2020-09-02 17:12:31 -07:00
Nathan Adams
86eb6f2e50
avm1: Implement Date - #249
2020-09-02 17:12:31 -07:00
Nathan Adams
3d30ec67e2
test: Add more cases to registerClass tests
2020-09-02 15:18:59 -07:00
Nathan Adams
2178beec87
core: When constructing objects for DisplayObjects, make sure frames are run at the right moment
2020-09-02 15:18:59 -07:00
Mike Welsh
537cca7c38
tests: Add test for #1086
2020-09-02 13:25:53 -07:00
Mike Welsh
bc08971066
core: Return version from MovieClip::swf_version ( fix #1086 )
...
MovieClip was not returning the proper SWF version, causing it to
default to the newest SWF version in some cases when it shouldn't.
2020-09-02 13:25:53 -07:00
dependabot-preview[bot]
03dcdcd494
build(deps): bump indexmap from 1.5.1 to 1.5.2
...
Bumps [indexmap](https://github.com/bluss/indexmap ) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/bluss/indexmap/releases )
- [Commits](https://github.com/bluss/indexmap/compare/1.5.1...1.5.2 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-02 12:39:18 -07:00
CUB3D
e95c1ff758
core: Make blurX and blurY floating point
2020-09-02 10:59:00 -07:00
CUB3D
143ba03754
core: Fix clippy lints and format
2020-09-02 10:59:00 -07:00
CUB3D
a2c151677b
core: Add blurFilter and test
2020-09-02 10:59:00 -07:00
CUB3D
d1ad095bad
core: Add tests for bitmap_filter
2020-09-02 10:59:00 -07:00
CUB3D
34f485ca21
core: Add basic flash.filters.(BlurFilter|BitmapFilter)
2020-09-02 10:59:00 -07:00
Nathan Adams
cb2461920b
core: HTTP request values need to preserve order
2020-08-28 11:53:32 -07:00
dependabot-preview[bot]
4137a1cac0
build(deps): bump minimp3 from 0.4.0 to 0.5.0
...
Bumps [minimp3](https://github.com/germangb/minimp3-rs ) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/germangb/minimp3-rs/releases )
- [Commits](https://github.com/germangb/minimp3-rs/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-27 13:20:14 -07:00
dependabot-preview[bot]
9db07eb997
build(deps): bump minimp3 from 0.3.5 to 0.4.0
...
Bumps [minimp3](https://github.com/germangb/minimp3-rs ) from 0.3.5 to 0.4.0.
- [Release notes](https://github.com/germangb/minimp3-rs/releases )
- [Commits](https://github.com/germangb/minimp3-rs/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-26 09:57:40 -07:00
Mike Welsh
f55bac2014
text: HTML tags and attributes are case insensitive ( fix #1021 )
...
Use eq_ignore_ascii_case when parsing HTML tags. Different versions
of Flash may export HTML tags with different cases, so this will
work a little better; however, we'll need a true HTML parser to
handle this robustly (for opening and closing tags with different
cases, for example).
2020-08-24 11:27:14 -07:00
Mike Welsh
febada8a8e
text: Fix duplicated characters when parsing HTML entities ( fix #1026 )
2020-08-24 11:27:14 -07:00
Mike Welsh
e8178c35a3
core: Add MouseWheel player event
2020-08-23 13:38:59 -07:00
kmeisthax
559bc05b6a
avm2: Implement avm2 math opcodes (merge #1037 )
...
* Implement `add`, with tests.
* Implement `add_i`.
There's no test, because for whatever reason, I can't figure out how to emit this from Animate CC 2020.
* avm2: Implement `bitand` with tests.
* Implement `bitnot` with tests.
* Implement `bitor` with tests.
* avm2: Implement `bitxor`
* avm2: Implement `declocal`, `declocal_i`, `decrement`, and `decrement_i`.
* tests: `swf_approx` tests should be allowed to print NaNs.
* avm2: Implement `divide`.
* avm2: Implement `inclocal`, `inclocal_i`, `increment`, and `increment_i`.
* avm2: Implement `lshift`.
* Implement `modulo`.
* avm2: Implement `multiply` and `multiply_i` (no tests for the latter)
* avm2: Implement `negate` and `negate_i` (no tests for the latter)
* avm2: Implement `rshift`
* avm2: Implement `subtract` and `subtract_i` (the latter without tests)
* avm2: Implement `urshift`.
2020-08-23 13:38:38 -07:00
Mike Welsh
ba05894901
avm1: Don't mutably borrow self in TObject
2020-08-23 02:19:53 -07:00
Mike Welsh
2a84d924bb
chore: Don't mutably borrow self in TDisplayObject
2020-08-22 11:56:19 -07:00
dependabot-preview[bot]
5d2ba7fee6
build(deps): bump syn from 1.0.38 to 1.0.39
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.38 to 1.0.39.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.38...1.0.39 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-21 12:54:02 -07:00
Mike Welsh
06b6d14367
avm1: Fix removeMovieClip depth range
...
removeMovieClip should only function on objects within a certain
depth range, usually to prevent removing timeline clips. However,
this wasn't working properly in some cases because the depth was
being biased incorrectly (removeMovieClip never takes a depth
parameter, so we should not bias the depth).
2020-08-21 00:55:35 -07:00
Mike Welsh
528b52ac7c
tests: Activate unused remove_movie_clip test
2020-08-21 00:55:35 -07:00
Mike Welsh
1e6a053c56
avm1: Implement TargetPath
2020-08-20 18:14:01 -07:00
Mike Welsh
bbc5e01009
tests: Add test for targetPath action
2020-08-20 18:14:01 -07:00
Mike Welsh
e9f9cda34d
tests: Rename target_path test to string_path
2020-08-20 18:14:01 -07:00
Mike Welsh
b8f5a405b9
tests: Add test for flash.geom.Transform
2020-08-20 17:29:04 -07:00
Mike Welsh
ca3ed34c2c
avm1: Implement flash.geom.Transform
2020-08-20 17:29:04 -07:00
Mike Welsh
0a81dae7bb
avm1: toString for display objects
2020-08-18 01:18:15 -07:00
Mike Welsh
cefc0ce5c1
core: Add button children to execution list
...
Children of buttons were not getting linked up into the execution
list, which would cause certain methods to be incorrect (such as
button._width).
2020-08-18 01:18:15 -07:00
Mike Welsh
d2c49c0f33
core: Remove some mut from TDisplayObject methods
2020-08-18 01:18:15 -07:00
Mike Welsh
544c1becc2
tests: Add test for button children
2020-08-18 01:18:15 -07:00
Mike Welsh
59ebd0167e
core: Fix priority of conflicting instance names
2020-08-18 01:18:15 -07:00
Mike Welsh
b5c7e1dab0
tests: Add test for conflicting instance names
2020-08-18 01:18:15 -07:00
Mike Welsh
13b4b6bbbb
chore: Fix unused variable warning in url_from_relative_path
2020-08-16 18:44:57 -07:00
Floens
95acc14190
avm1: fix array unshift
...
update array_trivial test for it
2020-08-16 04:27:09 -07:00
Mike Welsh
f782ea8020
avm2: AVM2 built-in class suport (merge #802 )
...
Initial support for defining built-ins in AVM2
2020-08-16 03:45:02 -07:00
David Wendt
4c824fcefe
Rename `trait.rs` to `traits.rs` to avoid the use of reserved keyword syntax.
2020-08-14 21:20:41 -04:00
David Wendt
7b7f0b20e6
Consolidate all of our copied `CollectWrapper`s.
2020-08-14 20:52:09 -04:00
Albert Safin
e03373bceb
avm1: parseInt
2020-08-13 00:40:20 -07:00
Mike Welsh
cbd448522a
chore: Allow unknown clippy lints
...
same_item_push was added on nightly, but is currently throwing
a false negative. I added an allow for it, but this causes a
warning on stable for an unknown lints, so allow unknown lints for
now.
2020-08-12 23:51:12 -07:00
Mike Welsh
6c89869210
chore: Fix clippy lints
2020-08-12 19:04:14 -07:00
dependabot-preview[bot]
9b6dd45439
build(deps): bump smallvec from 1.4.1 to 1.4.2
...
Bumps [smallvec](https://github.com/servo/rust-smallvec ) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/servo/rust-smallvec/releases )
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.4.1...v1.4.2 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-12 11:13:33 -07:00
David Wendt
825eb34c67
avm1: `Button` should not hold write locks on itself when instantiating children.
...
This fixes a bug where a nested textfield within a button with variable linkages would panic in Ruffle.
2020-08-12 11:08:27 -07:00
David Wendt
354b194b69
avm1: Add test for nested text fields in buttons.
2020-08-12 11:08:27 -07:00
David Wendt
32aad6176b
`FunctionObject::from_builtin_constr` should pull the scope and class off of it's given prototype and copy it onto the constructor function it returns.
2020-08-11 00:04:13 -04:00
David Wendt
11ddccfa6a
Remove the two-step initialization process and construct an ES4 class for `Object`, `Function`, and `Class`.
...
This has some particularly annoying consequences for initialization order: notably, we can't actually create any ES4 classes using the standard machinery until after the three objects I just mentioned get created. Ergo, we have to create them through lower-level means, handing prototypes around, and then initialize AVM2's system prototypes list for it.
When we start adding more system prototypes, we'll also have to fill the extras with blank objects and then slot them in as we create them.
2020-08-11 00:02:12 -04:00
David Wendt
16d8c85d20
Load player globals as soon as possible.
...
We're about to massively change the initialization process, and we really don't want to create another situation where the player can get caught with it's pants down.
2020-08-10 23:35:37 -04:00
David Wendt
a8e267ed16
Allow system prototypes to be initialized after the fact.
2020-08-10 23:35:37 -04:00
David Wendt
b1bcceaa78
Allow accessing the `Class` off of a constructor or prototype that references it.
2020-08-10 23:35:33 -04:00
David Wendt
22ec96b85e
`install_trait` and `install_foreign_trait` should return the value of the thing they installed.
2020-08-10 23:23:35 -04:00
David Wendt
df95482eb1
Allow setting `slot_id` or `disp_id` (depending on kind).
2020-08-10 23:23:34 -04:00
David Wendt
4ed5050f56
Add function to change trait attributes.
2020-08-10 23:23:34 -04:00
David Wendt
a5b62e833e
Add trait attributes, similar to that of class attributes
2020-08-10 23:23:31 -04:00
David Wendt
60d42fa558
Allow creating slot/const traits.
2020-08-10 23:19:22 -04:00
David Wendt
3ca8dfd21a
Allow constructing traits for getters, setters, and unbound free functions.
2020-08-10 23:19:22 -04:00
David Wendt
d366ceab0e
Allow setting the protected namespace of a builtin class.
2020-08-10 23:19:21 -04:00
David Wendt
9dc6cbe1ce
Allow creating builtin traits from methods.
2020-08-10 23:19:21 -04:00
David Wendt
5e932bcb75
Allow implementing interfaces in built-in classes.
2020-08-10 23:19:20 -04:00
David Wendt
94d5170277
When manually instantiating classes for globals, make sure that the classes get the global scope object when instantiated.
2020-08-10 23:19:15 -04:00
David Wendt
3585cf983b
Convert our stub implementations of all non-ECMA classes into `Class`es.
...
This was surprisingly tricky - due to the need to look up superclasses, class trait instantiation requires an active `Activation` and `UpdateContext`. We can't get those during VM instance creation, since the player needs the VM first before it can give it a context to work with. Ergo, we have to tear the global scope initialization in two. At the first possible moment, the player calls a new `load_player_globals` method that initializes all class traits in global scope.
2020-08-10 23:16:07 -04:00
David Wendt
6f284f60eb
Allow constructing a trait from a class.
2020-08-10 23:09:16 -04:00
David Wendt
b0b6cec117
Allow expanding a `QName` into a `Multiname` that selects exactly the `QName` and no more.
2020-08-10 23:09:15 -04:00
David Wendt
f09c35c4b9
`From<NativeMethod<'gc>>` doesn't always work, but using an explicit non-trait method sometimes does.
...
I have no idea why this is necessary - I was in a context where what *should* have been a `NativeMethod<'gc>` was instead being interpreted as some different function type with all the same lifetimes, but with an extra `'gc` lifetime as well. Funneling this through a non-trait method bypasses whatever is going on with the trait solver, and then at that point the trait solver knows what to do. Consider this an extra level of conversion.
2020-08-10 23:09:15 -04:00
David Wendt
4a2a456666
`Class::new` should also take the superclass name.
2020-08-10 23:09:13 -04:00
David Wendt
d96596fd8a
Add a function to manually change attributes.
2020-08-10 23:07:16 -04:00
David Wendt
44b8e5d9c7
Wrap up the existing sealed/final/interface bits in a `ClassAttributes` enumset.
2020-08-10 23:07:13 -04:00
David Wendt
bf6ccfeee1
Add some convenience functions for defining native classes.
2020-08-10 23:02:42 -04:00
David Wendt
c2cdc302c3
Remove further unnecessary primitive comparison checks
2020-08-10 16:38:04 -07:00
David Wendt
993f56798e
Extract all of the numerical conversions into a separate module and leverage them where appropriate in AVM2
2020-08-10 16:38:04 -07:00
David Wendt
566b262d60
Move all our custom object implementations into a separate module, and use a macro to implement them.
2020-08-10 16:38:04 -07:00
David Wendt
5bcd1be270
Remove another instance of `abs` for zero-checks.
2020-08-10 16:38:04 -07:00
David Wendt
2f55c08e37
`pushbyte` should generate signed integers rather than `Number`s.
2020-08-10 16:38:04 -07:00
David Wendt
7f479f24b9
Adjust `coerce_to_string` to be less silly.
2020-08-10 16:38:04 -07:00
David Wendt
a12f51903f
Non-finite covers everything here.
2020-08-10 16:38:04 -07:00
David Wendt
2e8acfe6f7
Apparantly, Rust already does not care about negative zero, so we don't need to, either.
2020-08-10 16:38:04 -07:00
David Wendt
1bb6f84beb
Avoid hitting `coerce_to_number` for integer comparison cases.
2020-08-10 16:38:04 -07:00
David Wendt
4e92352813
Don't promote to `f64` in strict-equality comparisons if we can promote to `i64` instead.
2020-08-10 16:38:04 -07:00
David Wendt
a211698464
Handle strict and abstract equality of our various number subtypes as if they were all the same type.
...
ECMA-262 3rd ed. doesn't mention anything about different number types, so the standard as-if rule applies. If we are going to distinguish number types, we have to treat them as if they were the same type, promoting to `f64` as necessary to facilitate the conversion. I took a cursory look at an ECMA-262 4th ed. draft and it appears to do the same, although it calls everything `GeneralNumber` and has some really confusing psuedo-Pascal syntax for some reason.
I am extremely glad AVM2 does not provide access to 64-bit integer types (for now, at least).
2020-08-10 16:38:04 -07:00
David Wendt
f3e47cb596
Further adjustments due to the massive refactor of `Activation`, `AvmX`, and `UpdateContext`.
2020-08-10 16:38:04 -07:00
David Wendt
ea4c42a6d1
Split `Value::Number` into separate floating-point, integer, and unsigned representations to match the three numerical classes provided by AS3.
2020-08-10 16:38:04 -07:00
David Wendt
a0895e843c
Fix `matches!` lint in nightly Rust being tripped.
2020-08-10 16:38:04 -07:00
David Wendt
b779dccdc1
Allow objects to provide a coercion hint for cases where a more obvious one is not available.
2020-08-10 16:38:04 -07:00
David Wendt
d14fa845c2
Remove `Value::Namespace`.
...
Namespaces as values adds a bunch of extra special cases to the coercion and equality rules that don't really belong there. Namespace itself just returns it's URI as a string, so we can just make `NamespaceObject` do that and then treat it the same way we treat boxed primitives.
2020-08-10 16:38:04 -07:00
David Wendt
e6aac48ae2
Add `NamespaceObject` to hold `Namespace`s.
...
The reason for this will become very apparent, very shortly.
2020-08-10 16:38:04 -07:00
David Wendt
aeb1752d0f
`PrimitiveObject`'s `toString` and `valueOf` should always yield their boxed values.
2020-08-10 16:38:04 -07:00
David Wendt
65b4392642
Remove `as_number`.
...
The only code that used it was the enumeration operations in AVM2.
2020-08-10 16:38:04 -07:00
David Wendt
4906c5a3f1
Remove uses of `as_string` in various places.
...
These include:
* Name resolution in `newobject`
* All runtime & late-bound multinames
* `Object.hasOwnProperty`
* `Object.propertyIsEnumerable`
* `Object.setPropertyIsEnumerable`
2020-08-10 16:38:04 -07:00
David Wendt
c040997be2
*Actually* fix the conversion.
...
So, I overlooked this reading the 1.45 documentation, but the first thing they did is completely change f64 conversions. Apparantly, what I was doing (and what JavaScript spec dictates) is actually considered UB in LLVM, and my ability to actually write a concise wrapping u32 conversion is actually a soundness hole in Rust. Ergo, I'm now emulating the wrapping and sign calculation, which makes this both passing it's tests again and free of soundness holes and UB.
2020-08-10 16:38:04 -07:00
David Wendt
473414e167
Explicitly request `u64` be involved with `u32` coercions.
...
I don't know why I'm doing this - tests are failing in CI but not locally, and I can only assume that the most obvious conversion is broken in some way on whatever other architecture GitHub Actions uses. This will explicitly mask the integer result as a u64, and then convert it down to u32. A not-broken compiler should treat this code identically.
2020-08-10 16:38:04 -07:00
David Wendt
962f6aa54c
Remove `as_object`.
...
AVM2 is based on ES4, which as far as I'm aware, does not distinguish between "primitive values" and "objects". Thus, it is expedient to interpret any statement requiring something to be an Object to mean "not null or undefined".
Since we internally represent register values with primitive types, it is important that the VM always coerces to object before doing any other sort of type checking. Hence, something like `as_object` is unhelpful as it accidentally enforces a primitive/object distinction that ES4 attempted to remove.
2020-08-10 16:38:04 -07:00
David Wendt
8de063a916
Implement automatic primitive boxing via `coerce_to_object`.
2020-08-10 16:38:04 -07:00
David Wendt
f12f67650b
Stub all primitive type classes.
2020-08-10 16:38:04 -07:00
David Wendt
cb0f1e9099
Add a new object variant for boxed primitives.
2020-08-10 16:38:04 -07:00
David Wendt
6ec1d453b8
Add tests for `greaterequals`, `greaterthan`, `lessequals`, and `lessthan`.
2020-08-10 16:38:04 -07:00
David Wendt
b7dfce51b8
Implement `greaterequals`, `greaterthan`, `lessequals`, and `lessthan`.
2020-08-10 16:38:04 -07:00
David Wendt
f88f2e225a
Add tests for `>`, `<`, `<=`, and `>=`.
...
Note that this does NOT completely test the full range of if instructions for abstract relational comparison. Notably, the Adobe Animate CC compiler compiles each operator into it's negated equivalent, e.g. `<` becomes `ifnlt`.
I do not know how to get it to emit `ifge` or the like, which differ only by how they handle `NaN`s.
2020-08-10 16:38:04 -07:00
David Wendt
730c47cf29
Implement `ifge`, `ifgt`, `ifle`, `iflt`, `ifnge`, `ifngt`, `ifnle`, and `ifnlt`.
2020-08-10 16:38:04 -07:00
David Wendt
70a27ccb81
Implement ECMA abstract relational comparison
2020-08-10 16:38:04 -07:00
David Wendt
2ef03c6019
Allow no-hint primitive coercion
2020-08-10 16:38:04 -07:00
David Wendt
76ab8570e4
Implement and test `equals`.
...
The test is also far more in-depth than the `if_eq`/`if_ne` tests, which use the same set of vectors as the strict-equality tests from a while ago. Interestingly, this test passed on first run
2020-08-10 16:38:04 -07:00
David Wendt
5da4e2f118
Test for `iseq` and `isne`
2020-08-10 16:38:04 -07:00
David Wendt
29d5ae9989
Implement `ifeq` and `ifne`.
2020-08-10 16:38:04 -07:00
David Wendt
ccc478e7dd
Implement ECMA-262 abstract equality.
2020-08-10 16:38:04 -07:00
David Wendt
0125a14d1f
Partially implement `ToObject` coercion.
...
Implementation is limited to generating exceptions on `null` or `undefined`. I'm not sure if primitive values don't exist in AVM2 or if this is supposed to box them like ES3, so I have decided to handle neither at this time.
2020-08-10 16:38:04 -07:00
David Wendt
86965eb674
Test for `coerce_s`.
...
I cannot yet figure out how to generate tests that use `convert_s`, so it's not covered.
2020-08-10 16:38:04 -07:00
David Wendt
0138300b5a
Implement `coerce_s` and `convert_s`.
2020-08-10 16:38:04 -07:00
David Wendt
90d2964adf
Properly handle all cases of ECMA-262 string coercions.
...
This code is slightly over/under-precise compared to AVM2. This is because we handle precision limiting in binary floats rather than as part of the float printing process. Flash Player may also be rounding differently than us. However, I'm pretty sure ECMA-262 allows us to slightly differ here.
2020-08-10 16:38:04 -07:00