EmperorBale
292a9bda4b
avm2: Implement toLocaleString, toLocaleTimeString, toDateString, toLocaleDateString
2021-09-23 00:01:50 +02:00
EmperorBale
b9fd7f5977
avm2: Implement toString, toTimeString
2021-09-23 00:01:50 +02:00
EmperorBale
931080cd49
avm2: Implement valueOf
2021-09-23 00:01:50 +02:00
EmperorBale
aca23b744e
chore: Appease clippy
2021-09-23 00:01:50 +02:00
EmperorBale
7f8e01b426
avm2: Implement UTC
2021-09-23 00:01:50 +02:00
EmperorBale
453486265f
avm2: Implement timezoneOffset
2021-09-23 00:01:50 +02:00
EmperorBale
0732efc9d9
avm2: Impement day, dayUTC
2021-09-23 00:01:50 +02:00
EmperorBale
fe584f7508
chore: Fix typos
2021-09-23 00:01:50 +02:00
EmperorBale
97da4d1b7b
avm2: Implement UTC variants
2021-09-23 00:01:50 +02:00
EmperorBale
0dc0bc9694
avm2: Implement month, fullYear
2021-09-23 00:01:50 +02:00
EmperorBale
273ae48654
avm2: Refactor date implementation
2021-09-23 00:01:50 +02:00
EmperorBale
6ab0d89040
avm2: Implement minutes, hours, date
2021-09-23 00:01:50 +02:00
EmperorBale
d5621c1ce7
avm2: Implement time, seconds, milliseconds
2021-09-23 00:01:50 +02:00
EmperorBale
32eb9d1579
avm2: Implement Dates instance initializer
2021-09-23 00:01:50 +02:00
EmperorBale
db550b035c
avm2: Add Date stub
2021-09-23 00:01:50 +02:00
relrelb
3463e50a72
avm1: Avoid `impl Into<Value<'gc>>` parameter in `Avm1::push`
...
This might create templatized functions leading to unnecessary code bloat.
So instead use just `Value<'gc>` parameters and add `.into()` in callers
where needed.
2021-09-22 23:13:13 +02:00
kmeisthax
42275f43f3
avm2: Properly make all classes an instance of `Class`. ( #57 )
...
* avm2: Properly make all classes an instance of `Class`.
Also, does this technically mean that `Class` is a metaclass?
* avm2: Remove `Function::from_method_and_proto` as it will no longer be needed
* avm2: Ensure builtin classes are also instances of `Class`.
This requires tying a veritable gordian knot of classes; everything needs to be allocated up-front, linked together, and then properly initialized later on. This necessitated splitting the whole class construction process up into three steps:
1. Allocation via `from_class_partial`, which does everything that can be done without any other classes
2. Weaving via `link_prototype` and `link_type`, which links all of the allocated parts together correctly. This also includes initializing `SystemClasses` and `SystemPrototypes`.
3. Initialization via `into_finished_class`, which must be done *after* the weave has finished.
Once complete you have core classes that are all instances of `Class`, along with prototypes that have their usual legacy quirks.
Note that this does *not* make prototypes instances of their class. We do need to do that, but doing so breaks ES3 legacy support. This is because we currently only work with bound methods, but need to be able to call unbound methods in `callproperty`.
* tests: Add a test for all core classes' instance-of relationships
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
f8c32d3a68
avm2: Fix get_own_class_definition users to use either instance_of or as_.
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
71e41e2c92
chore: cargo fmt
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
22482ed080
avm2: Remove unwrap in get_own_class_definition
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
7736818069
avm2: Rename as_class -> get_own_class_definition
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
26e60fa8ea
avm2: Rename as_class_object_really -> as_class_object
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
008162c514
avm2: Replace all uses of as_class_object by instance_of
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
4b7f8b3dbd
avm2: inner_class_definition is not an Option
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
3e1764aa1e
avm2: Reimplement as_class_object() in terms of other methods
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
e02feb919a
avm2: Reimplement as_class() in terms of other methods
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
4380978b2a
avm2: Move instance_allocator() to ClassObject
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
1d22009c6b
avm2: Drop seemingly-unused set_class_object()
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
f3ab6c9da3
avm2: Move as_class_params() to ClassObject
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
0679fd1a9e
amv2: Move superclass_object() to ClassObject
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
2dfa875712
avm2: Move interfaces to ClassObject
2021-09-22 00:29:37 +02:00
Chris Midgley
6f0b026f13
chore: cargo fmt
2021-09-18 18:42:36 +02:00
Chris Midgley
7bab1de1e7
avm2: implement coerce_x opcodes
2021-09-18 18:42:36 +02:00
Adrian Wielgosik
ba35611c47
chore: cargo fmt
2021-09-18 18:37:46 +02:00
lukaszN
a76f2403ac
avm2: String rename PUBLIC_CLASS_METHODS to AS3_CLASS_METHODS
2021-09-18 18:37:46 +02:00
lukaszN
0f41193c3b
avm2: String.match match lastIndex behavior
2021-09-18 18:37:46 +02:00
lukaszN
d5588f3f90
avm2: String refactor index_of, match
2021-09-18 18:37:46 +02:00
lukaszN
42300d4a1e
avm2: String tests
2021-09-18 18:37:46 +02:00
lukaszN
4abde1500b
avm2: String fixes for tests
2021-09-18 18:37:46 +02:00
lukaszN
e24390ff58
avm2: String slice, substr, substring
2021-09-18 18:37:46 +02:00
lukaszN
d953fea5df
avm2: String match
2021-09-18 18:37:46 +02:00
lukaszN
91d63e4dc1
avm2: class methods can also live in the AS3 namespace
2021-09-18 18:37:46 +02:00
lukaszN
5e5d8e4fff
avm2: String concat, lastIndexOf, indexOf, fromCharCode
2021-09-18 18:37:46 +02:00
relrelb
1ab953887c
avm1: Simplify `Value::abstract_eq`
...
Make it return `bool` instead of a `Value` that can be either `true`
or `false`.
2021-09-18 17:47:25 +02:00
Giles Cope
42c2b40052
unused deps
2021-09-18 15:28:24 +02:00
Chris Midgley
758d84f549
avm2: fix button typo
2021-09-18 15:26:52 +02:00
Chris Midgley
909428943b
avm2: implement bkpt, bkptline, timestamp as no-ops
2021-09-17 23:06:59 +02:00
relrelb
ff1c29d952
avm1: Simplify `Value::abstract_lt`
...
* Change its return type to `Option<bool>`.
* Use Rust's `f64::partial_cmp` to compare two numbers, which should
be more efficient.
2021-09-16 13:46:04 +03:00
relrelb
f92926af54
avm1: Correct `Math.{min,max}`
...
Don't use `abstract_lt` because it compares strings alphabetically,
unlike `Math.min` and `Math.max` that coerce to a number before comparing.
2021-09-16 02:38:34 -07:00
dependabot[bot]
76f4b0d8cd
build(deps): bump flate2 from 1.0.21 to 1.0.22
...
Bumps [flate2](https://github.com/rust-lang/flate2-rs ) from 1.0.21 to 1.0.22.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases )
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.21...1.0.22 )
---
updated-dependencies:
- dependency-name: flate2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-09-13 14:27:26 -07:00
Moulins
73bce495c2
chore: move core::avm1::string::AvmString to core::string::AvmString
2021-09-13 03:30:17 -07:00
Moulins
87e8b44fe9
chore: move core::string_utils to core::string::utils
...
Also move case tables to a separate file.
2021-09-13 03:30:17 -07:00
Mike Welsh
d84f65874e
chore: Appease clippy
...
Debug/Clone dervies no longer squelch dead code warnings, see:
See https://github.com/rust-lang/rust/pull/85200
2021-09-11 21:50:52 -07:00
Mike Welsh
e3c05a021e
core: De-duplicate enums between Avm1Button and Avm2Button
...
Needed to appease clippy.
2021-09-11 21:50:52 -07:00
Ray Redondo
167b5a45de
avm2: move flash.display.IBitmapDrawable init
2021-09-11 15:47:20 -07:00
Ray Redondo
40d53cda59
avm2: make BitmapData and DisplayObject impl IBitmapDrawable
2021-09-11 15:47:20 -07:00
Ray Redondo
7f895473cb
avm2: IBitmapDrawable stub
2021-09-11 15:47:20 -07:00
David Wendt
1e0d259075
avm2: Allow nulling `Bitmap.bitmapData`.
...
One of the two tests in this PR relies upon the backend storing bitmap data, but the test rendering backend does not yet do this.
2021-09-11 12:11:35 -07:00
David Wendt
bfb6f03d62
avm2: Impl `Bitmap.smoothing`
...
Also, `smoothing` should be set at construction time even if we're setting up a timeline bitmap.
2021-09-11 12:11:35 -07:00
David Wendt
2ba0e12b7e
avm2: Stub `Bitmap.pixelSmoothing`
2021-09-11 12:11:35 -07:00
David Wendt
8ae669b96c
avm2: `BitmapData` should be traceable
2021-09-11 12:11:35 -07:00
David Wendt
31e3741982
avm2: Allow access to the `BitmapData` of a `Bitmap`.
2021-09-11 12:11:35 -07:00
David Wendt
7c5dc568f1
avm2: Impl `BitmapData.getPixel`.
...
This also changes the `bitmapdata_constr` test slightly to use a different starting value. Our premultiplied alpha calculations generate slightly different values from Flash Player which trips the test.
2021-09-11 12:11:35 -07:00
David Wendt
4c9bd0a6fe
avm2: Impl `BitmapData.transparent`
2021-09-11 12:11:35 -07:00
David Wendt
e18caa2fbf
core: Silence error relating to `Bitmap` symbol class associations
2021-09-11 12:11:35 -07:00
David Wendt
dca473fc2a
avm2: Impl `BitmapData.width` and `BitmapData.height`
2021-09-11 12:11:35 -07:00
David Wendt
335aec5be0
avm2: Implement `BitmapData`'s constructor.
...
This includes support for both embedded bitmap data (resolved via the SymbolClass mechanism) as well as empty bitmaps configured via arguments.
2021-09-11 12:11:35 -07:00
David Wendt
e5151d147d
core: When constructing a `Bitmap`, do not attempt to cache it's associated `BitmapData`'s handle.
...
Attempting to do so results in borrow-mut panics. Furthermore, it's unnecessary; the handle provided to this function is already derived from the bitmap data in this way.
2021-09-11 12:11:35 -07:00
David Wendt
54740d6093
core: Allow `BitmapData` to hold an AVM2 side.
2021-09-11 12:11:35 -07:00
David Wendt
10b98f72f5
core: Allow `Bitmap` to be reassociated with new `BitmapData`
2021-09-11 12:11:35 -07:00
David Wendt
a807cf7623
avm2: Stub `flash.display.BitmapData` & storage object
2021-09-11 12:11:35 -07:00
David Wendt
609b97cfb9
core: Allow `Bitmap`s to hold an AVM2 representation
2021-09-11 12:11:35 -07:00
Chris Midgley
bd26790f5b
avm1: Fix `this` inside watchers ( #5276 )
...
* fix: fix 'this' inside watchers
* tests: test value of 'this' in watcher
* lint: cargo fmt
2021-09-11 15:15:16 +03:00
relrelb
923201d2e4
chore: Appease clippy
2021-09-10 15:42:37 +02:00
Chris Midgley
3e04c2b0d2
dev: remove allow unused mut and corresponding mut
2021-09-09 19:06:49 -06:00
Daniel Jacobs
5ac9796ffd
web: Support salign, quality, & scale embed/object attributes (part of #4258 )
2021-09-08 16:25:47 -07:00
Tal Hayon
7d6eaf127d
core: Fix EditText width and height scaling ( close #3001 )
2021-09-08 02:39:01 -07:00
relrelb
c2fcc03c35
avm1: Remove `TObject::get_local` in favor of `TObject::get_local_stored`
...
`get_local` is basically equivalent to `get_local_stored` that also
handles virtual getters. So instead handle virtual getters in
`search_prototype`. This allows to inline the `get_local_sub` helper
methods into the implementations of `get_local_stored`.
The remaining usages of `get_local` were not exactly correct as they
all should ignore virtual getters. This change solves this as well
by using `get_local_stored` that ignores virtual getters.
2021-09-08 12:21:17 +03:00
relrelb
1f96c2fcb8
audio: Small cleanup
2021-09-07 18:28:17 -07:00
relrelb
65205ac6d7
audio: Store sound transform values in 30-bit integers
...
It seems like Flash stores sound transform values in 30-bit unsigned integers:
* Negative values are equivalent to their absolute value.
* Specifically, 0x40000000, -0x40000000 and -0x80000000 are equivalent to zero.
2021-09-07 18:28:17 -07:00
Chris Midgley
868706d775
avm1: call watcher, if defined, from virtual properties on prototype ( #4827 )
...
* avm1: extract get_watcher
* tests: add tests for TextField text watch
* avm1: call the watcher, if defined, from call_setter
* dev: shadow variable to avoid unused mut warning
* dev: remove value mutability
* chore: cargo fmt
* dev: unify virtual and stored property watcher cases
* tests: add test for watching prototyped property
* feat: when getting old values, ascend the proto chain ignoring virtual properties
* chore: lint
* dev: share complicated code
* chore: Small cleanups
Co-authored-by: relrelb <relrelbachar@gmail.com>
2021-09-08 03:41:18 +03:00
Mike Welsh
483995823f
core: Add symphonia as optional MP3 decoder
...
Add symphonia_mp3 feature to enable symphonia as an MP3 decoder.
This is a pure Rust MP3 decoder that could be used on web.
2021-09-07 16:48:34 -07:00
Mike Welsh
94d02fa653
core: Add AudioMixer to core
...
Pull out the audio mixing code from desktop and add it to core.
This will allow other backends to use it (such as the web audio
backend) to get consistent audio across all platforms.
2021-09-07 16:48:34 -07:00
Tal Hayon
4625ca0e0b
web: fix base param
2021-09-07 16:45:35 -07:00
dependabot[bot]
5e07d4e464
build(deps): bump syn from 1.0.75 to 1.0.76
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.75 to 1.0.76.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.75...1.0.76 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-09-06 14:33:56 -07:00
Adrian Wielgosik
9bd0b624fd
avm2: Add more Event class stubs and constants
2021-09-05 11:56:21 +02:00
David Wendt
bc4f790031
avm2: Stub `SoundMixer.areSoundsInaccessible` and `SoundMixer.computeSpectrum`
2021-09-03 16:47:02 -06:00
David Wendt
34fe35a998
avm2: Impl `SoundMixer.bufferTime`
2021-09-03 16:47:02 -06:00
David Wendt
364ee62c92
avm2: Impl `SoundChannel`'s `soundComplete` event.
...
This includes a test that is currently ignored because `NullAudioBackend` can't fire complete events.
2021-09-03 16:47:02 -06:00
David Wendt
d5718fe408
avm2: Initialize all sounds and channels at time of allocation
2021-09-03 16:47:02 -06:00
David Wendt
efcab92d97
avm2: Impl `SoundMixer.stopAll`
2021-09-03 16:47:02 -06:00
David Wendt
d73ba586d0
avm2: Impl `SoundChannel.stop()`
2021-09-03 16:47:02 -06:00
David Wendt
39305f6a38
avm2: Implement `SoundChannel.soundTransform`
2021-09-03 16:47:02 -06:00
David Wendt
9c6c64e4e3
core: `NullAudioBackend` should falsely report all sounds as not playing, like the real backends
...
This prevents sounds from being removed from the `AudioManager`, which allows sound transforms to be placed on them in tests.
2021-09-03 16:47:02 -06:00
David Wendt
6b7609ff4e
avm2: Stub `SoundChannel.position`.
...
This also comes with an ignored test for `position`, because I originally believed this to be implementable.
2021-09-03 16:47:02 -06:00
David Wendt
4e77f89e0f
avm2: Stub `SoundChannel.leftPeak` and `SoundChannel.rightPeak`
2021-09-03 16:47:02 -06:00
David Wendt
50092e6c04
avm2: Stub all remaining `Sound` methods.
2021-09-03 16:47:02 -06:00
David Wendt
b6167c2f86
avm2: Allow playing sounds with a given `SoundTransform`.
2021-09-03 16:47:02 -06:00
David Wendt
5771d4c826
avm2: Deduplicate the sound transform conversion code
2021-09-03 16:47:02 -06:00
David Wendt
116fb1f323
avm2: Impl `Sound.play`
...
This does not (yet) implement the third `SoundTransform` parameter on `play`.
2021-09-03 16:47:02 -06:00
David Wendt
8a58956f1f
avm2: Add `flash.media.SoundChannel` class & associated object storage
2021-09-03 16:47:02 -06:00
David Wendt
46de9ee46e
avm2: `soundTransform` isn't a movieclip property, so don't ask for one.
2021-09-03 16:47:02 -06:00
David Wendt
1bde07089d
avm2: Alias `SimpleButton.soundTransform` to the class property of `SoundMixer.soundTransform`
2021-09-03 16:47:02 -06:00
David Wendt
0f625e7864
avm2: Impl `SoundMixer.soundTransform` class property
2021-09-03 16:47:02 -06:00
David Wendt
8e1122104d
avm2: Correct `SoundTransform` class definition to match docs
2021-09-03 16:47:02 -06:00
David Wendt
2f6e695483
avm2: Impl `Sprite.soundTransform`
2021-09-03 16:47:02 -06:00
David Wendt
3b9f0f271d
avm2: `SoundTransform.pan` returns 0 if the transform sends sound to different channels
2021-09-03 16:47:02 -06:00
David Wendt
2b7a0bf898
avm2: `SoundTransform` stores it's values as square roots
2021-09-03 16:47:02 -06:00
David Wendt
bd3cec0d20
avm2: Impl `flash.media.SoundTransform`
2021-09-03 16:47:02 -06:00
David Wendt
3b6eea2a1d
core: Report sound duration as `f64` and round down in AS1
2021-09-03 16:47:02 -06:00
David Wendt
e4c6e29b8a
core: `NullAudioBackend` should not report latency seek data as part of the size of a sound.
2021-09-03 16:47:02 -06:00
David Wendt
d7f2f782c4
avm2: Impl `Sound.length`
...
This also adds duration tracking for `NullAudioBackend`.
2021-09-03 16:47:02 -06:00
David Wendt
e25fb732ea
avm2: Stub `Sound.isBuffering`, `Sound.isURLInaccessible`, and `Sound.url`
2021-09-03 16:47:02 -06:00
David Wendt
89b411593f
avm2: Impl `Sound.bytesTotal`
2021-09-03 16:47:02 -06:00
David Wendt
d5fb807387
avm2: Allow calling `Function.apply` without a second argument
2021-09-03 16:47:02 -06:00
David Wendt
7b31cd9a4d
avm2: Allow instantiating a SWF sound by constructing it's symbol class
2021-09-03 16:47:02 -06:00
David Wendt
37eb746989
core: Don't warn when associating sounds to AS3 classes
2021-09-03 16:47:02 -06:00
David Wendt
0c591f3370
avm2: Stub implementation of `Sound` and accompanying object type
2021-09-03 16:47:02 -06:00
David Wendt
70556e5830
avm2: Forbid `applytype` opcodes with more than one argument type.
2021-09-02 17:57:58 -06:00
David Wendt
e2bf0a9857
avm2: Prohibit naming types with more than one parameter, as they don't exist.
2021-09-02 17:57:58 -06:00
David Wendt
141b992a73
avm2: Storing past the end of a vector only works for the immediate one-off-the-end index
2021-09-02 17:57:58 -06:00
David Wendt
8cd2b4fd5e
avm2: Fill vector holes with the default value at creation time instead of storing them.
2021-09-02 17:57:58 -06:00
David Wendt
3b48216762
avm2: Don't store more than one object parameter, because there are no classes with multiple paramters.
2021-09-02 17:57:58 -06:00
David Wendt
5c740ef1e1
chore: Grammar
2021-09-02 17:57:58 -06:00
David Wendt
d1b9df61f3
avm2: Move `Vector`'s properties to the AS3 namespace and add prototype properties in the public one
2021-09-02 17:57:58 -06:00
David Wendt
cc15809f49
avm2: Add the ability to have a separate class initializer for each specialization of `Vector`
2021-09-02 17:57:58 -06:00
David Wendt
e087a27e56
avm2: `Vector.sort` actually *does* calculate an indexed sort array, but then discards it.
...
Normally we could skip sorting, but values in the vector may have side effects when coerced. So we need to make sure coercions run, at least.
2021-09-02 17:57:58 -06:00
David Wendt
280fbbde45
avm2: Pick nits in `Vector`'s `instance_init`
2021-09-02 17:57:58 -06:00
David Wendt
2095c1831a
avm2: Replace some if expressions with easier-to-read equivalents
2021-09-02 17:57:58 -06:00
David Wendt
464605d015
avm2: Pre-allocate all the things
2021-09-02 17:57:58 -06:00
David Wendt
bf4492c454
avm2: Add the legacy Vector types that old movies can use.
...
This one was rather tough to test, as I actually can't generate ABCs in Animate CC that reference these classes. I instead had to modify a compiled SWF to open the package-internal namespace that these pre-specialized classes exist in.
2021-09-02 17:57:58 -06:00
David Wendt
dcf6d87363
avm2: Accept `null` as a valid type in `applytype`.
...
In AVM2, the `*` (any) type is represented as `null`.
This requires also changing the parameters on classes and objects to be nullable, too.
We do *not* represent `null` as a particular value on the underyling vector storage object, however. We instead change it to `Object`, as that's the root of all other types.
This may require revision if non-`Object`-extending types appear in the future.
2021-09-02 17:57:58 -06:00
David Wendt
ee30f21e8e
avm2: Remove unnecessary `mut`
2021-09-02 17:57:58 -06:00
David Wendt
aaddcc598f
avm2: Impl `Vector.toLocaleString` and test `toString`
2021-09-02 17:57:58 -06:00
David Wendt
d1e49db3cc
avm2: Stub `Number.toLocaleString`
...
This exists but is undocumented, and I accidentally wrote a Vector test that needs it.
2021-09-02 17:57:58 -06:00
David Wendt
dbc6f38c34
avm2: Impl `Vector.splice`
2021-09-02 17:57:58 -06:00
David Wendt
81d0775776
avm2: Impl `Vector.sort`
2021-09-02 17:57:58 -06:00
David Wendt
9fcd846a4d
avm2: Fix ineffective Vector typechecks
2021-09-02 17:57:58 -06:00
David Wendt
44a9f13047
avm2: Impl `Vector.slice`
2021-09-02 17:57:58 -06:00
David Wendt
077fd87842
avm2: Impl `Vector.reverse`
2021-09-02 17:57:58 -06:00
David Wendt
aa2d729a44
avm2: Impl `Vector.removeAt`
2021-09-02 17:57:58 -06:00
David Wendt
a053015558
avm2: Impl `Vector.insertAt`
2021-09-02 17:57:58 -06:00
David Wendt
6b78e86ddc
avm2: Impl `Vector.shift` and `Vector.unshift`
2021-09-02 17:57:58 -06:00
David Wendt
1cfa9e0b28
avm2: Impl `Vector.push` and `.pop`
2021-09-02 17:57:58 -06:00
David Wendt
6350ce2dde
avm2: Impl `Vector.map`
2021-09-02 17:57:58 -06:00
David Wendt
7628b2b49a
avm2: Impl `Vector.lastIndexOf` (and the weird backward-index behavior of `indexOf`)
2021-09-02 17:57:58 -06:00
David Wendt
4624157ae0
avm2: Impl `Vector.indexOf`
2021-09-02 17:57:58 -06:00
David Wendt
622be142c3
avm2: Specialize generic classes when resolving types whose names have parameter names also in them.
...
Any is, as usual, special-cased. In this case, we treat it as specializing to `Object`, since all vectors should be coercible to `Object`.
2021-09-02 17:57:58 -06:00
David Wendt
c06a3c10d8
avm2: Impl `Vector.filter`
2021-09-02 17:57:58 -06:00
David Wendt
d079c647fa
avm2: Parameter types can be `*`.
2021-09-02 17:57:58 -06:00
David Wendt
f00234ce26
avm2: Consider specializations of generic classes to be of the same type as other specializations of the same class when their parameters are also of the same type.
...
For example, instances of `Vector.<Class>` are considered to be of type `Vector.<Interface>` in the same way that instances of `Class` are considered to be of type `Interface`. This assumes `Class` implements `Interface`.
This does *not* apply to the builtin coercions for numeric and string types, which do not extend to generic parameters. For example, `Vector.<uint>` is *not* coercible to `Vector.<int>`, even though it's contents *are*.
2021-09-02 17:57:58 -06:00
David Wendt
4d962f154e
avm2: Don't run initializers on vectors as they overwrite the existing vector storage.
2021-09-02 17:57:58 -06:00
David Wendt
fcc7c9e7ee
avm2: Propagate the specialized class parameter into the vector storage so that coercions happen correctly.
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
2560bdc804
chore: Drop unnecessary mut
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
846b53dc1b
avm2: Impl `Vector.forEach`
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
8a77494b2f
avm2: Impl `Vector.some`
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
519feb9af7
avm2: `Array.every/some` should early return
2021-09-02 17:57:58 -06:00
Adrian Wielgosik
07f979b582
avm2: `Vector.every` should early return
2021-09-02 17:57:58 -06:00
David Wendt
97e6f55110
avm2: Impl `Vector.every`
2021-09-02 17:57:58 -06:00
David Wendt
aa0946c64c
avm2: Impl `Vector.fixed`
2021-09-02 17:57:58 -06:00
David Wendt
841ed4b5e4
avm2: Setting to an out-of-bounds index on a growable `Vector` should grow it
2021-09-02 17:57:58 -06:00
David Wendt
238959d7f8
avm2: Impl `Vector.join` and `toString`
2021-09-02 17:57:58 -06:00
David Wendt
1ce7e4e642
avm2: `Vector` is a final class (no matter what the docs say)
2021-09-02 17:57:58 -06:00
David Wendt
dba9b18540
avm2: Impl `Vector.concat`
2021-09-02 17:57:58 -06:00
David Wendt
96afc5a6c2
avm2: Cache all `Vector` applications on the `Vector` class object.
...
This matches Flash Player behavior: notably, multiple applications of the same types see the same class and prototype, but different applications actually create new objects that don't share properties.
2021-09-02 17:57:58 -06:00
David Wendt
888fcc85ca
avm2: Impl `Vector.length`
2021-09-02 17:57:58 -06:00
David Wendt
9d08a7c299
avm2: Impl `Vector`'s instance initializer
2021-09-02 17:57:58 -06:00
David Wendt
49d79b8e73
avm2: Vector indices are stored in a package namespace
2021-09-02 17:57:58 -06:00
David Wendt
3d3b80f8af
avm2: ES3 class instances should be treated as instances of the ES4 class `Object`.
2021-09-02 17:57:58 -06:00
David Wendt
6b377bed64
avm2: Impl `apply` for ES4 classes to allow type parameterization
2021-09-02 17:57:58 -06:00
David Wendt
65a23d5833
avm2: Move applytype next to other operations that create classes
2021-09-02 17:57:58 -06:00
David Wendt
074c093504
avm2: Implement op `ApplyType`
2021-09-02 17:57:58 -06:00
David Wendt
4b021fe92c
avm2: `Vector` lives in a separate package from other globals
2021-09-02 17:57:58 -06:00
David Wendt
74cb32dd46
avm2: Allow constructing static `TypeName`s (for naming `Vector` classes)
2021-09-02 17:57:58 -06:00
David Wendt
7e71ecac16
avm2: Add stub impl of `Vector`
2021-09-02 17:57:58 -06:00
David Wendt
6f49e62b96
avm2: First pass on implementing vector storage
2021-09-02 17:57:58 -06:00
David Wendt
f4dfc4d778
avm2: First pass at type-aware vector storage
2021-09-02 17:57:58 -06:00
David Wendt
686872812d
avm2: Add a `TObject` method for applying arguments to a generic type.
2021-09-02 17:57:58 -06:00
David Wendt
fe8373739d
avm2: Add the ability to fork a `Class` to one that holds it's type arguments.
2021-09-02 17:57:58 -06:00
David Wendt
86616b748f
avm2: Allow parsing generic typenames into a multiname
2021-09-02 17:57:58 -06:00
David Wendt
47e3b2229a
swf: Add support for the `TypeName` multiname type.
2021-09-02 17:57:58 -06:00
David Wendt
7277f14198
core: Delay execution of AVM2 constructors on buttons by one frame.
2021-08-31 21:21:54 -06:00
David Wendt
472ba6db1f
core: AVM2 buttons only emit frame construction events and frame scripts if they were timeline-constructed.
2021-08-31 21:21:54 -06:00
David Wendt
b1ba591bb9
core: Support constructing symbolclassed buttons from AVM2
2021-08-31 21:21:54 -06:00
David Wendt
7c970e144f
core: `Avm2Button` should always call it's native initializer
2021-08-31 21:21:54 -06:00
Chris Midgley
bc4422f4fe
chore: fix docstring
2021-08-31 22:47:13 +03:00
dependabot[bot]
5af5fb579e
chore: Bump flate2 from 1.0.20 to 1.0.21
...
Bumps [flate2](https://github.com/rust-lang/flate2-rs ) from 1.0.20 to 1.0.21.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases )
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.20...1.0.21 )
---
updated-dependencies:
- dependency-name: flate2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 09:04:44 +03:00
David Wendt
80c5bbcd83
avm2: Stub `Font.enumerateFonts` and `Font.registerFont`
2021-08-30 17:53:39 -06:00
David Wendt
2d57bed82e
avm2: Impl `Font.hasGlyphs`
2021-08-30 17:53:39 -06:00
David Wendt
37af9be533
avm2: Implement `Font` for embedded fonts.
2021-08-30 17:53:39 -06:00
dependabot[bot]
7f2f8a492e
chore: Bump png from 0.17.0 to 0.17.1
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.17.0 to 0.17.1.
- [Release notes](https://github.com/image-rs/image-png/releases )
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md )
- [Commits](https://github.com/image-rs/image-png/commits )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-30 23:27:18 +02:00
dependabot[bot]
3136331e85
chore: Bump serde from 1.0.128 to 1.0.130
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.128 to 1.0.130.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.128...v1.0.130 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-30 22:31:27 +02:00
Adrian Wielgosik
945bce4a85
xml: Use forked quick-xml to support loose entity parsing
2021-08-30 19:08:22 +02:00
EmperorBale
358e0641eb
avm2: Use rsplit_once instead of split_once
2021-08-29 20:41:20 -06:00
EmperorBale
05b4ee6b61
avm2: Dont panic if as_class returns None
2021-08-29 20:41:20 -06:00
EmperorBale
547aac0e85
chore: Cleanup QName::to_qualified_name
2021-08-29 20:41:20 -06:00
EmperorBale
5dd21cdf8e
avm2: Add QName::from_qualified_name and QName::to_qualified_name
2021-08-29 20:41:20 -06:00
EmperorBale
2b748a4870
avm2: Implement getQualifiedClassName, getQualifiedSuperclassName, and getDefinitionByName
2021-08-29 20:41:20 -06:00
Daniel Jacobs
3982f3af98
web: Support menu embed/object attribute (part of #4258 )
2021-08-28 14:56:35 +02:00
Adrian Wielgosik
b5ee94aff1
avm2: Stub flash.system.Security.
2021-08-26 23:50:42 +02:00
relrelb
0aed180da8
avm1: Rename `SuperObject::child` to `this`
2021-08-26 01:07:37 +03:00
relrelb
ec5a9f8ac8
avm1: Avoid `impl Into<Value<'gc>>` parameters
...
This might create templatized functions leading to unnecessary code bloat.
So instead use just `Value<'gc>` parameters and add `.into()` in callers
where needed.
2021-08-26 01:07:37 +03:00
relrelb
364f93fd92
avm1: Remove `SuperObject::as_executable`
...
It was identical to the default implementation of `TObject`, and
thus unnecessary.
2021-08-26 01:07:37 +03:00
relrelb
90a544a34a
avm1: Inline `SuperObject::super_constr`
2021-08-26 01:07:37 +03:00
relrelb
dff74dcb92
avm1: Simplify `SuperObject::from_this_and_base_proto`
2021-08-26 01:07:37 +03:00
relrelb
1bd46c6d59
avm1: Rename `ScriptObject::values` to `properties`
...
To better reflect their meaning.
2021-08-26 01:07:37 +03:00
relrelb
fd7d32bc14
avm1: `DisplayGetter` cannot fail
...
So instead of always returning `Ok` from all getters, simply return a
`Value`.
2021-08-24 02:15:43 +03:00
lukaszN
8e596c2a35
avm2: Rectangle fix clippy
2021-08-23 15:44:14 -06:00
lukaszN
b7b66ab9b8
avm2: impl Rectangle isEmpty, offset, offsetPoint, setEmpty, union
2021-08-23 15:44:14 -06:00
lukaszN
f5c491a14f
avm2: impl Rectangle intersection, intersects
2021-08-23 15:44:14 -06:00
lukaszN
e22cd6bdbd
avm2: impl Rectangle inflate, inflatePoint
2021-08-23 15:44:14 -06:00
lukaszN
129cd1af58
avm2: impl Rectangle contains, containsPoint, containsRect, copyFrom
2021-08-23 15:44:14 -06:00
lukaszN
3670676e2d
avm2: Impl Rectangle topLeft, size, clone, equals
2021-08-23 15:44:14 -06:00
lukaszN
85afeb1de7
avm2: Impl Rectangle setters and getters
2021-08-23 15:44:14 -06:00
lukaszN
ee9e70b71f
avm2: Initial rectangle impl
2021-08-23 15:44:14 -06:00
dependabot[bot]
d8457d175b
chore: Bump serde from 1.0.127 to 1.0.128
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.127 to 1.0.128.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.127...v1.0.128 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-23 23:46:47 +03:00
dependabot[bot]
f8c069442f
chore: Bump syn from 1.0.74 to 1.0.75
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.74 to 1.0.75.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.74...1.0.75 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-23 23:45:53 +03:00
TÖRÖK Attila
1674c95487
Fix a typo in a comment introduced in #5021
2021-08-22 11:45:33 +03:00
relrelb
1e7bdaa226
chore: Minor improvement
2021-08-22 01:03:10 +03:00
Tomasz Konojacki
a3747ade5e
core: fix integer overflow in ADPCM decoder
...
The maximum possible value of delta is 63483, so it needs to be
declared as u16.
Fixes #5030
2021-08-22 01:03:10 +03:00
David Wendt
57fffbe699
video: Use the new `H263State.parse_picture` convenience method
2021-08-21 14:13:55 -06:00
Mike Welsh
1f951b6b9f
core: Add h263 feature
2021-08-21 14:13:55 -06:00
Mike Welsh
a05f81b393
video: Add VideoDecoder trait
...
Change VideoStream to use a VideoDecoder trait instead of an enum.
This will make it a little easier as more codecs are added, and
allow us to easily enable/disable codecs behind features.
2021-08-21 14:13:55 -06:00
David Wendt
48fa03b87d
video: Reuse the same bitmap whenever possible
2021-08-21 14:13:55 -06:00
David Wendt
05692cee67
video: Allow pictures with half-pixels in chroma by widening the chroma buffers to the next pixel in that direction.
2021-08-21 14:13:55 -06:00
David Wendt
43f76de602
video: Move software decoding into core now that we don't need to specialize per-renderer
2021-08-21 14:13:55 -06:00
David Wendt
885805f887
core: Half-implement an H.263 decoder
2021-08-21 14:13:55 -06:00
Tal Hayon
7b9049cedf
core: Add DefineBinaryData and SymbolClass connection (Part of #1368 )
2021-08-21 12:24:46 -06:00
relrelb
41142d940c
avm1: Turn `TObject::call_setter` to `TObject::setter`
...
Remove the unused `value` parameter and rename the function to clarify
its meaning.
2021-08-21 17:23:15 +03:00
relrelb
fd0e76020f
avm1: Allow stored and virtual properties to co-exist
...
Currently properties added using `addProperty` overwrite existing
stored properties. However, there are some cases where the original
stored value can still be retrieved, which indicates that Flash
Player doesn't overwrite these properties internally.
As a solution, unify `Property::Stored` and `Property::Virtual` to
a single struct. This allows to simultaneously store regular data
and getter/setter on the same property. It also simplifies some
logic in `ScriptObject`.
2021-08-21 17:23:15 +03:00
TÖRÖK Attila
a1311443a6
avm1/bitmap: Replace BitmapData.color_transform() argument with AVM-agnostic ColorTransformParams
2021-08-20 21:29:54 -06:00
TÖRÖK Attila
b31ad28960
avm1: Make add_field_accessors! accept nested field names
2021-08-20 21:29:54 -06:00
TÖRÖK Attila
57ccb714c6
core,avm1: Extract ColorTransformParams from ColorTransformData
2021-08-20 21:29:54 -06:00
TÖRÖK Attila
2048bb9887
core,avm1: Move BitmapData implementation into core::bitmap from core::avm1::object
...
This enables exposing it to AVM2 as well in the future.
2021-08-20 21:29:54 -06:00
Ray Redondo
27e06af003
avm2: Initial MouseEvent stubs ( #5065 )
...
* avm2: Start MouseEvent stubs
* avm2: More MouseEvent work
* chore: clippy
* chore: fmt
Co-authored-by: Adrian Wielgosik <adrian.wielgosik@gmail.com>
2021-08-21 01:26:34 +02:00
Chris Midgley
58c907e985
avm2: implement string.split for undefined ( #5064 )
...
* avm2: implement string.split for undefined
* chore: cargo fmt
* dev: avoid explicit ArrayStorage
2021-08-18 18:02:41 +02:00
relrelb
da7cd453cf
chore: Fix png update
2021-08-18 09:01:21 +03:00
dependabot[bot]
0e408052b1
chore: Bump png from 0.16.8 to 0.17.0
...
Bumps [png](https://github.com/image-rs/image-png ) from 0.16.8 to 0.17.0.
- [Release notes](https://github.com/image-rs/image-png/releases )
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md )
- [Commits](https://github.com/image-rs/image-png/commits )
---
updated-dependencies:
- dependency-name: png
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-18 09:01:21 +03:00
relrelb
ac3c198bda
chore: Appease clippy
2021-08-18 08:01:57 +03:00
dependabot[bot]
b8a9e28acb
chore: Bump bitstream-io from 1.1.0 to 1.2.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/compare/v1.1.0...v1.2.0 )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-17 08:24:29 +03:00
dependabot[bot]
a317a09d17
chore: Bump bitflags from 1.2.1 to 1.3.2
...
Bumps [bitflags](https://github.com/bitflags/bitflags ) from 1.2.1 to 1.3.2.
- [Release notes](https://github.com/bitflags/bitflags/releases )
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md )
- [Commits](https://github.com/bitflags/bitflags/compare/1.2.1...1.3.2 )
---
updated-dependencies:
- dependency-name: bitflags
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-16 23:41:06 +03:00
Adrian Wielgosik
f4da77c400
Use a more idiomatic pattern for unwrap-or-default
2021-08-15 21:55:49 +02:00
David Wendt
f37a06241a
chore: Clippy compliance with latest nightly compiler
2021-08-14 19:51:24 -06:00
Ray Redondo
cfb2bb99d6
chore: appease clippy
2021-08-14 00:52:38 +02:00
Ray Redondo
638eaf4a55
avm2: Rename function, add runtime warnings
2021-08-14 00:52:38 +02:00
Ray Redondo
171a41b908
avm2: Add define_public_builtin_class_traits and repair Capabilities to use it
2021-08-14 00:52:38 +02:00
Ray Redondo
c43f57e5f5
avm2: Implement `String.split`
2021-08-14 00:52:38 +02:00
Ray Redondo
22c6f7321e
avm2: start flash.system.Capabilities stubs
2021-08-14 00:52:38 +02:00
Tal Hayon
332f1d47bb
core: Reset mouse visible when loading movie to root ( Fixes #4358 )
2021-08-11 23:18:57 +02:00
David Wendt
84f17d1222
chore: Update `flash-lso`'s dependent commit ID
2021-08-09 18:47:03 -06:00
relrelb
d40cf5aee4
avm1: Log internal error on `InvalidSwf`
...
This gives more percise error logs that ease finding their root
cause. Also remove `is_halting` and express it inline instead.
2021-08-03 14:40:59 -07:00
Tal Hayon
6762675bb5
core: Fixes several text edit font and bullet issues (parts of #1167 )
2021-08-03 13:08:06 -07:00
dependabot[bot]
36e96b7272
chore: Bump serde from 1.0.126 to 1.0.127
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.126 to 1.0.127.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.126...v1.0.127 )
---
updated-dependencies:
- dependency-name: serde
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-08-03 10:18:58 +03:00
Adrian Wielgosik
b940e7f00f
Extension: Sidestep CORS issues by offering to load the SWF in a tab
2021-08-02 21:28:16 +02:00
relrelb
141f886cdd
avm1: Remove `TObject::set_proto`
...
The last usage of it was in `Player`, which anyway should operate
only on newly created objects that don't have any virtual properties
nor watchers. So it is safe to replace with `define_value`, that
also cannot fail.
2021-07-30 17:42:42 -07:00
relrelb
fd3f9f34de
avm1: Store `__proto__` as a regular property
...
`__proto__` seems to behave much like a regular data property. So
simply remove the `prototype` field of `ScriptObject` in favor of
storing the prototype in the general properties hash map.
2021-07-30 17:42:42 -07:00
relrelb
6b91239e28
avm1: Don't rely on prototypes during serialization
...
Instead, rely on the `TObject::as_*` methods to tell what kind the
serialized object is.
2021-07-24 04:12:34 -07:00
relrelb
06fce44665
avm1: Fix performance regression in `BitmapData::pixels_rgba`
...
It was regressed in #4822 when changed to use `flat_map`. But
currently Rust emits suboptimal code for such case. For now use
`Vec::with_capacity` manually to avoid unnecessary re-allocations.
2021-07-24 03:28:35 -07:00
EmperorBale
1dee1e4166
avm2: Implement flash.crypto.generateRandomBytes
2021-07-21 18:09:21 +02:00
David Wendt
db86ca84b9
avm2: `get_property` does not mutate the underlying object (anymore) so it should not be flagged as mutably borrowing it.
2021-07-20 22:14:05 -04:00
David Wendt
c30014baed
avm2: Remove `ScriptObjectClass` and replace with separately implemented methods on `ClassObject`
2021-07-20 22:12:33 -04:00
David Wendt
4d89341e19
avm2: Cache the instance allocator on class objects
2021-07-20 22:12:33 -04:00
David Wendt
2c927f2b6b
avm2: Make `coerce_to_type` take a class object instead of a multiname.
2021-07-20 22:12:33 -04:00
David Wendt
bd2f758976
avm2: Don't call native initializers when coercing primitives into objects.
...
The former native initializer call was incorrect and would cause spurious coercion failures. Since existing code assumes the error fork of `coerce_to_object` means undefined or null, this was causing coercions and parameter typechecks against primitives to fail in the most general case.
Attempting to fix this by providing the primitive value as native initializer argument instead causes a stack overflow. This is because native initializer arguments still have to be typechecked, and in the most general case this means... coercing the primitive value we're already coercing into an object... into another object. This won't work.
Since primitive initializers aren't going to do anything that native coercions need to care about, I'm just removing the initializer call.
2021-07-20 22:12:32 -04:00
David Wendt
30b4c4386b
avm2: Replace the `call_strict` mechanism with checking to see if free functions are unchecked.
2021-07-20 22:12:32 -04:00
David Wendt
ddd73b3cd6
avm2: Supercalls should fall back to normal receiver access if there is no matching supertrait to use.
2021-07-20 22:12:31 -04:00
David Wendt
e9b9d64cb6
avm2: Rename `StageObject::graphics_of` to just `graphics`
2021-07-20 22:12:30 -04:00
David Wendt
7871912d92
avm2: Calling ES4 class objects is treated as a coercion to that type.
2021-07-20 22:12:28 -04:00
David Wendt
ef4b6876db
core: MovieClips should initialize their AVM2 sides by calling `call_native_init`.
2021-07-20 22:12:28 -04:00
David Wendt
b469ef8a3f
avm2: Replace `deriver` language with `allocator` language
2021-07-20 22:12:28 -04:00
David Wendt
8af0481a23
avm2: Retire the use of "constructor" outside of literal reference to class initializer or instance initializer code.
...
Instead, the following terms are used:
* Static classes, to refer to `Class<'gc>`. Shortened to "class" in contexts where this is not ambiguous.
* Class objects, to refer to objects that represent a particular class. Also shortened to "class" in non-ambiguous contexts.
Downstream of this, the `base_constr` (referring to the class that a currently called trait has been pulled from) is now called `subclass_object` and several `TObject` methods have also been renamed.
2021-07-20 22:12:23 -04:00
David Wendt
6d907a0d10
avm2: Rename `ArrayObject::empty_array` to `ArrayObject::empty`.
2021-07-20 22:10:36 -04:00
David Wendt
05b7de7453
avm2: Avoid double iteration in `Names.contains_name`
2021-07-20 22:10:36 -04:00
David Wendt
6e2e686e0d
avm2: Rename `Method::Entry` to `Method::Bytecode`
2021-07-20 22:10:35 -04:00
David Wendt
b049f2e717
avm2: Rename `Method::from_builtin_only` to `Method::from_builtin`
2021-07-20 22:10:35 -04:00
David Wendt
d4fcca9787
avm2: Rename `call_initializer` and `call_native_initializer` to `call_init` and `call_native_init`
2021-07-20 22:10:34 -04:00
David Wendt
f5431a781e
docs: Fix stale comments in avm2
2021-07-20 22:10:34 -04:00
David Wendt
ccfa605260
avm2: Use `extend_from_slice`
2021-07-20 22:10:34 -04:00
David Wendt
a60a499f31
avm2: Rename `resolve_parameter_value` to `resolve_parameter`
2021-07-20 22:10:33 -04:00
David Wendt
9e997e6571
avm2: Split out `Method` and `Executable`'s native fork into `NativeMethod` and `NativeExecutable`, respectively.
...
This also implies renaming the existing type alias of the same name to `NativeMethodImpl`.
2021-07-20 22:10:33 -04:00
David Wendt
c7858f9447
avm2: Simplify/correct the value numerical checks
2021-07-20 22:10:32 -04:00
David Wendt
5018421eef
avm2: Rename `SystemConstructors` to `SystemClasses`
2021-07-20 22:08:27 -04:00
David Wendt
2c2f03ba23
chore: Clippy compliance on Rust nightly
2021-07-20 22:05:37 -04:00
David Wendt
d0478a1f40
avm2: Allow builtins to also hold parameter type metadata.
...
This is limited by the fact that we currently cannot store type metadata in static tables. I don't think it's necessary to do so as of yet as pretty much every actual parameter type I *could* shove in here turned out to be optional and broke tests if it wasn't. Still, it's probably useful enough for new classes to include.
2021-07-20 22:05:36 -04:00
David Wendt
e38b1bc281
avm2: Make numbers appear to be of any numeric type that can represent them.
...
This also prevents an exception from being fired when testing `undefined` or `null`, which are valid inputs to `istype`.
2021-07-20 22:05:35 -04:00
David Wendt
974fe152ff
avm2: Include the parameter coercions into `op_coerce`
2021-07-20 22:05:34 -04:00
David Wendt
8b48b79f5d
avm2: Make the `pool_` and `table_` functions no longer take a superfluous mutation context.
...
This also adds a new `pool_multiname_static_any` method that treats zero as `*` instead of an error.
2021-07-20 22:05:33 -04:00
David Wendt
abc9d0800a
avm2: `undefined` is normalized to `null` for string and object coercions
2021-07-20 22:05:32 -04:00
David Wendt
b779804075
avm2: Relax the maximum arguments check for functions called from native code.
2021-07-20 22:02:11 -04:00
David Wendt
ae086d6aa7
avm2: Implement implicit coercion for primitive types
2021-07-20 22:02:10 -04:00
David Wendt
63cf6a7b47
avm2: Implement parameter typechecking for script functions.
...
This commit breaks 15 tests, mostly due to implicit coercion that happens at function call time. This will be implemented shortly.
2021-07-20 22:02:10 -04:00
David Wendt
65ffa0684b
core: Use the new construct pathway for building AVM2 `TextFormat` objects
2021-07-20 22:02:09 -04:00
David Wendt
5c6c3191ef
avm2: Enforce `final` on traits.
2021-07-20 22:02:09 -04:00
David Wendt
7d86c93ddc
Check to make sure that overrides only apply to already-installed properties.
2021-07-20 22:02:08 -04:00
David Wendt
5662527c9e
avm2: Enforce `interface` checks: classes cannot extend interfaces and cannot implement other classes.
2021-07-20 22:02:08 -04:00
David Wendt
7eca7d5331
avm2: Enforce `final` on classes
2021-07-20 22:02:07 -04:00
David Wendt
3888d5bb27
avm2: `install_dynamic_property` now checks to see if the object is sealed, and if so, throws an error.
2021-07-20 22:02:07 -04:00
David Wendt
03980f4f3d
avm2: `Function.prototype`'s properties are not methods.
2021-07-20 22:02:06 -04:00
David Wendt
c10a25fb3f
avm2: Remove the special global constructor scope mode we added two commits ago.
2021-07-20 22:02:05 -04:00
David Wendt
0e40552c2a
avm2: Don't instantiate classes or functions at trait install time.
2021-07-20 22:02:05 -04:00
David Wendt
377730301f
avm2: Add a special object mode for `globals` so that it can get it's own scope during trait installation.
...
This is very wrong: Strictly speaking, we should not be instantiating anything that needs a scope when we install the trait. We just create a slot for it to go into. Script initializers are responsible for providing a scope stack to instantiate traits into.
2021-07-20 22:02:04 -04:00
David Wendt
a112192c96
avm2: Remove `_slot_local` methods as we no longer do anything special with slots.
2021-07-20 22:02:04 -04:00
David Wendt
5dcc3a58f2
avm2: Remove lazy trait initialization
2021-07-20 22:02:03 -04:00
David Wendt
7e3c017a63
avm2: `broadcast_event` should use constructors for it's type checks.
2021-07-20 22:02:02 -04:00
David Wendt
1c72167287
avm2: Make `istype` use the constructor chain, not the prototype chain.
...
This pushes a few more ancillary changes:
* `has_proto_in_chain` no longer checks interfaces (since it exists to serve `instanceof`, which does not respect them)
* Interfaces no longer live on prototypes. They now live on class constructors.
2021-07-20 22:01:57 -04:00
David Wendt
713ab3e95c
avm2: Remove all remaining accesses to `SystemPrototypes`, save for one technicality with the global scope prototype.
2021-07-20 22:00:34 -04:00
David Wendt
f84f01b2a5
avm2: Adjust the `FunctionObject` associated constructors so that there's a path that doesn't require the user hit `SystemPrototypes`.
...
Because we have stuff running in early globals, we stlil need a more elaborate version of this function that *does* take `fn_proto`. We also can't pull `scope` from the activation since this gets called to install traits.
2021-07-20 22:00:34 -04:00
David Wendt
e4201625a1
avm2: Split `StageObject` associated constructors into two versions: allocation-only (`for_display_object`) and allocation-and-initialization (`for_display_object_childless`).
...
The latter is intended for display objects that *do not* have children and can be both allocated and initialized in one shot. Hence the name.
2021-07-20 22:00:33 -04:00
David Wendt
46a4da9dc5
avm2: Remove `XmlObject::empty_object` as it does not appear to be in use and will need further elaboration when XML is unstubbed.
2021-07-20 22:00:32 -04:00
David Wendt
602895e2de
avm2: Make `RegExpObject::from_regexp` pull it's own constructor and call it's own initializer.
...
This doesn't appear to actually be in use, but I'm doing it for completeness' sake.
2021-07-20 22:00:32 -04:00
David Wendt
c167912f52
avm2: `PrimitiveObject::from_primitive` should now select it's own class and construct it.
...
This also includes protections on `String` to prevent it from overwriting itself. All user-constructed primitive objects start out boxing `Value::Undefined` and future constructor implementations should check what's already been boxed before overwriting it with user arguments.
2021-07-20 22:00:31 -04:00
David Wendt
261cb40a22
avm2: Make `NamespaceObject`'s sole associated method build and construct a `Namespace` instance.
2021-07-20 22:00:29 -04:00
David Wendt
b30c7509ba
avm2: Make `LoaderInfo`'s associated methods call initializers and pull their constrs/protos as necessary
2021-07-20 21:59:21 -04:00
David Wendt
60eb1b4409
avm2: Don't ask for a `proto` in `EventObject::from_event`.
...
For various reasons, this is kind of incomplete:
1. We need to support native event subclasses, so we can't just pull one class from `activation` (yet).
2. We can't run native instance initializers without overwriting the native object.
I expect these to be fixed in a future PR where I start adding native event types.
2021-07-20 21:59:21 -04:00
David Wendt
22fedf4dca
avm2: Make all domain object construction (save for the global domain) pull the constructor and call it in `from_domain`.
...
This also adds `DomainObject::script_global`, which does the same thing but picks the `global` class instead of `ApplicationDomain`.
2021-07-20 21:59:20 -04:00
David Wendt
6fe44c3862
avm2: Clean up `ClassObject` initialization.
...
This also makes it more difficult to accidentally build a class without calling it's initializer. Native/builtin class initializers should also be running now, too.
The only minor bit of jank is that we need a class initialized bit to flag classes we've already run, because our current lazy-init design for traits causes classes to be constructed twice. This is temporary and I intend to remove it along with lazy-init traits.
2021-07-20 21:59:18 -04:00
David Wendt
31faf62baf
avm2: Remove all alternative `ByteArrayObject` constructors.
...
The only way to build a `ByteArrayObject` now is to invoke it's constructor.
2021-07-20 21:58:06 -04:00
David Wendt
9604b525d5
avm2: Tie `ArrayObject`'s constructors to the system `Array` class.
...
This effectively turns calling `ArrayObject`'s associated methods into an alternate constructor path. We even make sure to run instance initializers. You also no longer have to grab the `array` system constructor, so we get to remove that code.
2021-07-20 21:58:05 -04:00
David Wendt
46db756f67
avm2: Don't run `Point`'s constructor twice when natively constructing one.
2021-07-20 21:58:04 -04:00
David Wendt
c8cd6e0322
avm2: Split native and script instance initializers for non-constructable classes.
...
This also includes new errors for attempting to construct non-constructables like `System`.
2021-07-20 21:58:04 -04:00
David Wendt
dcbb5e4284
avm2: Add a notion of native instance initializers.
...
Native initializers are a separate, parallel initialization chain intended for all object construction that is not directly triggered by `Op::Construct` and friends. This allows us to implement classes that cannot be directly constructed by user code, but can be constructed by native code or supercalled into from non-native.
2021-07-20 21:58:03 -04:00
David Wendt
4bc1d37029
avm2: Remove unnecessary manual accesses of the `constructor` property on prototypes.
...
All native object allocation in the project now pulls prototypes or constructors as necessary from the following sources:
* System prototype or constructor lists
* Instance `constr`s
This also resulted in the removal of a few unnecessary prototype accesses.
2021-07-20 21:57:56 -04:00
David Wendt
afd5a65a1e
avm2: Create a new list of system constructors alongside the existing list of system prototypes.
2021-07-20 21:55:30 -04:00
David Wendt
b0c38c9d4a
avm2: `Graphic` construction shouldn't use the `Shape` proto as it's base constructor.
...
This fixes the last broken test.
2021-07-20 21:55:29 -04:00
David Wendt
6deaa6f441
avm2: Remove the prototype setter exception as prototypes no longer provide setters to instances.
2021-07-20 21:55:29 -04:00
David Wendt
a8fd0622b2
avm2: Filter traits in `call_instance_xyz` by the trait type before actually getting trait fields.
...
Fixes the `as3_virtual_properties` test, where the old approach would accidentally grab a `Getter` and then think there's no setter (there is, you just have to look further down the list).
2021-07-20 21:55:29 -04:00
David Wendt
a2cd7443e8
avm2: Do not attempt to `super_init` the `LoaderInfo` object.
...
This is a temporary fix for failing tests; it is invalid in the sense that attempting to grab loader events will now fail. We can't actually correctly init the loader without two planned changes:
1. Moving all object initialization into the object helper functions (e.g. `LoaderInfoObject::from_movie`)
2. A notion of "native-only" constructors separate from the existing constructor chain
Once those are in place, loaders should be proper event dispatchers again.
2021-07-20 21:55:29 -04:00
David Wendt
1ad512e3c9
avm2: Allow constructing activation objects (since we now force instance constructors to run)
2021-07-20 21:55:28 -04:00
David Wendt
323da9ded3
avm2: Move the class association from prototypes to instances.
...
This also incurred a large number of ancillary changes, as it turns out nearly every native object is currently pulling a prototype and sticking it into an object. Right now, I have it instead pulling the constructor out of the prototype, but a future PR will also remove `system_prototypes` as well.
Other ancillary changes include:
* `Domain` now supports partial initialization to avoid an order-of-events issue. Accessing domain memory on a partially-initialized `Domain` will panic.
* `Domain` construction requires a full `activation` now, except for `global_scope` which needs to be initialized later with valid domain memory before user code runs.
* Pretty much every native object constructor now takes a proto/constr pair
* Trait lookup was rewritten to handle this. It's still buggy - seven tests don't work
* `TObject.construct` now actually does the full object construction dance. This allows `ClassObject` to implement the ES4 object construction pathway directly while `FunctionObject` maintains ES3 compatibility.
This is a tentative commit; there are still seven failing tests that I need to fix.
2021-07-20 21:55:25 -04:00
David Wendt
f26f193508
avm2: Store instance derivers as a `Class` property instead of keeping them only as a globals concept
2021-07-20 21:47:00 -04:00
David Wendt
47de2364c1
avm2: Split `Class` and `Function` object types
2021-07-20 21:46:54 -04:00
relrelb
d2eb46d3be
chore: Reserve capacity for vectors
...
This avoids unnecessary re-allocations and thus should improve
performance in both memory and time terms.
2021-07-20 16:25:23 -07:00
dependabot[bot]
ca2d17ade6
chore: Bump env_logger from 0.8.4 to 0.9.0
...
Bumps [env_logger](https://github.com/env-logger-rs/env_logger ) from 0.8.4 to 0.9.0.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases )
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md )
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.4...v0.9.0 )
---
updated-dependencies:
- dependency-name: env_logger
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-07-19 23:49:40 +03:00
relrelb
536526a342
avm1: Rename `set_watcher` and `remove_watcher` to `watch` and `unwatch`
...
This better reflects their correspondence to `Object.watch` and
`Object.unwatch` respectively.
2021-07-18 23:19:19 +03:00
relrelb
e8e0467673
avm1: Replace `get` + `call` with `call_method`
2021-07-18 23:19:19 +03:00
relrelb
3576a199cd
avm1: Replace `set` + `set_attributes` with `define_value`
2021-07-18 23:19:19 +03:00
relrelb
c609fa937d
avm1: Remove unnecessary type annotations
2021-07-18 23:19:19 +03:00
relrelb
ea73dbc367
avm1: Remove `StageObject::as_executable`
...
It was identical to the default implementation of `TObject`, and
thus unnecessary.
2021-07-18 23:19:19 +03:00
relrelb
0367f6a8d4
avm1: Correct `ASSetPropFlags`
...
* The properties parameter is evaluated last. This is observable by
the order the `toString`/`valueOf` methods of the parameters are
called.
* Only `null` in the property list parameter configures all properties,
as opposed to `undefined`, `null`, numbers and booleans previously.
* Objects in the property list parameter are not handled specially.
Instead, they're also coerced to string and split by comma.
2021-07-18 20:03:52 +03:00
dependabot[bot]
c241ac6ace
chore: Bump regress from 0.3.0 to 0.4.1
...
Bumps [regress](https://github.com/ridiculousfish/regress ) from 0.3.0 to 0.4.1.
- [Release notes](https://github.com/ridiculousfish/regress/releases )
- [Commits](https://github.com/ridiculousfish/regress/commits )
---
updated-dependencies:
- dependency-name: regress
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 23:37:11 +03:00
relrelb
76849c485e
core: Cleanup `tag_utils.rs`
2021-07-12 23:09:29 +03:00
relrelb
3d7199d81e
core: Remove unused `SwfMovie::from_movie_and_subdata`
2021-07-12 23:09:29 +03:00
Chris Midgley
8e7ce18cc2
avm1: alphabetise text_field properties
2021-07-10 21:19:20 +03:00
Chris Midgley
156a4494aa
avm1: update attributes of text_field properties
2021-07-10 21:19:20 +03:00
Adrian Wielgosik
633c23c7f3
avm2: Do timeout check every 2000 actions, same as avm1
2021-07-09 22:09:13 +02:00
relrelb
1cbbdecccf
swf: Introduce and use `Color::to_rgba`
2021-07-09 19:56:52 +03:00
relrelb
580d8c3562
chore: Use to_le_bytes in more places
2021-07-09 19:56:52 +03:00
relrelb
87e9dda250
chore: Use from_le_bytes in more places
2021-07-09 19:56:52 +03:00
relrelb
29b3225772
core: Fix ADPCM decoder
...
Store samples and steps as i16 instead of i32.
2021-07-09 19:55:09 +03:00
relrelb
25b8013a99
core: Refactor PCM decoder a bit
...
Extract a `read_sample` method to avoid code duplication, and use
the byteorder crate as already done in other places.
2021-07-09 19:52:30 +03:00
Callum Thomson
939d467897
avm1: Correct ToInteger
...
* Coerce objects as well.
* Wrap numbers around i32.
2021-07-09 03:39:07 +03:00
Chris Midgley
ac0fc40345
avm1: implement scroll, maxscroll and bottomScroll for TextField ( #4698 )
...
* tests: add tests for scroll
* avm1: implement scroll, maxscroll, bottomScroll
* chore: fmt
* docs: note that scroll is 1-based
* fix: non-word wrapped text with manual breaks is scrollable
* chore: move magic number to const
* chore: avoid mut with extra if
* chore: moving clamping behaviour into core
* refactor: eagerly compute line data
* fix: make scroll work when text is aligned right
* chore: clippy
* docs: add more information about line_data
* tests: add more test cases for scroll
2021-07-08 19:23:30 +02:00
EmperorBale
d334e30259
avm1: Fix apply_to_display_object ( #4377 ) ( #4743 )
...
* avm1: Fix apply_to_display_object
2021-07-06 17:32:14 +02:00
TÖRÖK Attila
20080dda4e
Fix minor bug/typo in `action_get_url_2`
...
The current version just doesn't make any sense.
The fixed version is akin to the `target.starts_with("_level") && target.len() > 6` line a bit earlier in this file.
2021-07-03 22:43:29 +02:00
relrelb
3a43957db5
chore: Minor cleanups
2021-07-03 17:26:34 +03:00
relrelb
169c79fa3a
chore: Minor cleanups
2021-06-26 23:05:11 +03:00
relrelb
e3f1fe2004
chore: Prefer spelling "Graphic"
2021-06-24 14:36:45 +03:00
relrelb
7b37bf6809
chore: Avoid spelling "movieclip"
...
* Prefer "MovieClip" in comments.
* Prefer "mc" for variable names.
2021-06-24 14:36:45 +03:00
relrelb
8b35aad657
core: Take advantage of or patterns
...
Rust 1.53.0 ships with or patterns, which allow a little more
elegant code:
https://blog.rust-lang.org/2021/06/17/Rust-1.53.0.html#or-patterns
2021-06-24 01:15:22 -07:00
relrelb
3845679e6c
core: Remove `branch = "main"` in Cargo.toml
...
Cargo no longer assumes the default `HEAD` of git repositories is named
`master` (https://blog.rust-lang.org/2021/06/17/Rust-1.53.0.html#head-branch-name-support-in-cargo ).
This means we no longer need to specify `branch = "main"`.
2021-06-24 01:15:22 -07:00
relrelb
59970bf7ac
avm1: Shorten integers values
...
The .0 suffix can be omitted since into() supports integers as well.
2021-06-24 01:11:16 -07:00
relrelb
38a2650c0e
chore: Use Value into() in more places
2021-06-24 01:11:16 -07:00
Adrian Wielgosik
1a132eb22d
avm1: Don't attempt to serialize MovieClips
2021-06-23 19:18:49 -07:00
relrelb
0fd1c05fd5
chore: Use into() in more places
2021-06-22 11:49:41 -07:00
relrelb
13977d9d22
avm1: Correct some Array set_length cases
...
Array builtins (pop, shift, unshift) doesn't update the length of
non-Array objects. However, push does update the length for all
objects.
2021-06-22 10:43:10 -07:00
relrelb
c383b70336
avm1: Merge array_function with constructor
2021-06-22 10:43:10 -07:00
relrelb
7948d872dc
avm1: Correct AsBroadcaster removeListener
2021-06-22 10:43:10 -07:00
relrelb
8742f288cb
avm1: Correct AsBroadcaster addListener
2021-06-22 10:43:10 -07:00
relrelb
b0b48b5b0c
avm1: Cleanup ScriptObject constructors
2021-06-22 10:43:10 -07:00
relrelb
ab5f5b4878
avm1: Use custom array index parsing method
...
Indices can be of arbitrary size (by overflowing around i32), but
Rust's `parse` is limited to the i32 range.
2021-06-22 10:43:10 -07:00
relrelb
95c30b85e1
avm1: Extract ArrayObject
2021-06-22 10:43:10 -07:00
Chris Midgley
b7de03b5c8
avm1: implement hscroll and maxhscroll for TextField
2021-06-22 01:43:02 -07:00
EmperorBale
1ee61cca57
avm2: ByteArray updates
2021-06-22 01:26:27 -07:00
danharris-stu
e010775099
core: Fix documentation spelling
2021-06-21 20:57:49 +03:00
dependabot[bot]
a66dce3548
chore: Bump rand from 0.8.3 to 0.8.4
...
Bumps [rand](https://github.com/rust-random/rand ) from 0.8.3 to 0.8.4.
- [Release notes](https://github.com/rust-random/rand/releases )
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-random/rand/compare/0.8.3...0.8.4 )
---
updated-dependencies:
- dependency-name: rand
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-20 03:10:42 -07:00
dependabot[bot]
c22c18b809
chore: Bump bitstream-io from 1.0.0 to 1.1.0
...
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io ) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases )
- [Commits](https://github.com/tuffy/bitstream-io/commits )
---
updated-dependencies:
- dependency-name: bitstream-io
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-20 03:10:31 -07:00
Mike Welsh
e886756aab
avm1: Wire up _soundbuftime
...
Store the `_soundbuftime` property in the audio manager. This is
currently unused by Ruffle, but the value will now be stored.
2021-06-20 01:25:27 -07:00
Mike Welsh
e3d0538999
core: Add AudioManager::stream_buffer_time
2021-06-20 01:25:27 -07:00
relrelb
6d1b6009e8
avm1: Use bitflags for ChannelOptions
2021-06-18 15:30:09 -07:00
Adrian Wielgosik
867b7ffcad
core: Preallocate bitmaps for remaining cases in decode_define_bits_lossless
2021-06-17 15:43:36 -07:00
Mike Welsh
09b86cda8b
avm1: Implement ToggleHighQuality op
...
Wire up the op so that it affects the quality setting, although the
setting is still unused by Ruffle.
This op will remember whether the stage was in `High`/`Best` quality.
Split out the "bitmap downsampling" flag in `Stage` so that we can
persist this state.
2021-06-17 13:55:56 -07:00
Mike Welsh
eb12a3af17
avm1: Wire up _highquality
2021-06-17 13:55:56 -07:00
Mike Welsh
9357fd7b4f
avm2: Wire up Stage.quality
2021-06-17 13:55:56 -07:00
Mike Welsh
9370b84092
avm1: Wire up _quality
2021-06-17 13:55:56 -07:00
Mike Welsh
ee8439e55c
core: Add Stage::quality
2021-06-17 13:55:56 -07:00
Mike Welsh
a1ceb07bec
core: Fix PlaceObjectAction::Replace in gotos ( fix #4545 )
2021-06-16 20:57:43 -07:00
Mike Welsh
622f35eb71
core: Pump action queue after handling an event
2021-06-16 12:42:49 -07:00
Mike Welsh
e2659e451c
core: Fire button events after mouse move events
2021-06-16 12:42:49 -07:00
Mike Welsh
71024939e3
core: Remove self_node parameter from DisplayObject::mouse_pick
2021-06-16 12:42:49 -07:00
Mike Welsh
6894382e8e
avm1: Implement _droptarget
2021-06-16 12:42:49 -07:00
Mike Welsh
495f8d90e6
avm1: Implement dragOver/dragOut button events
2021-06-16 12:42:49 -07:00
Mike Welsh
6de7ee1a8c
core: Support drag events with magic button frame labels
2021-06-16 12:42:49 -07:00
Mike Welsh
90024a1266
core: Wire up dragOver/dragOut events for buttons
2021-06-16 12:42:49 -07:00
Mike Welsh
b0143ff918
core: Add Player::mouse_pressed_object
2021-06-16 12:42:49 -07:00
Mike Welsh
2f25887080
avm1: SetTarget of a removed clip is invalid
...
A `SetTarget` call should ignore any clip that has been removed.
This can happen in cases such as `tellTarget("_root")` seeking
to a frame where the clip no longer exists.
Fixes this issue:
https://github.com/ruffle-rs/ruffle/pull/4452#issuecomment-860747028
2021-06-14 14:04:28 -07:00
Mike Welsh
ed1bfd74fe
core: keyPress events take precedence over text input
2021-06-14 14:04:28 -07:00
Mike Welsh
4687eb6d4e
core: Ensure bitmaps run post_instantiate
2021-06-14 14:04:28 -07:00
Mike Welsh
1f96af6b64
core: Add Avm1::exec_list to manage global list of display objects
2021-06-14 14:04:28 -07:00
dependabot[bot]
cf4a1136c5
chore: Bump env_logger from 0.8.3 to 0.8.4
...
Bumps [env_logger](https://github.com/env-logger-rs/env_logger ) from 0.8.3 to 0.8.4.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases )
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md )
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.8.3...v0.8.4 )
---
updated-dependencies:
- dependency-name: env_logger
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 00:47:57 -07:00
dependabot[bot]
1b6b4964c9
chore: Bump syn from 1.0.72 to 1.0.73
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.72 to 1.0.73.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.72...1.0.73 )
---
updated-dependencies:
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 00:47:40 -07:00
Mike Welsh
83f842faf9
avm1: Implement MovieClip.beginBitmapFill
2021-06-13 20:03:53 -07:00
Mike Welsh
554aa7fd63
core: Add backend::render::BitmapSource trait
...
This interface handles returning a bitmap given an ID and is used
by the render backend to get the bitmap used for a bitmap fill.
This will allow for bitmap fills in the drawing API, as these will
manage their own list of bitmaps.
This also removes the MovieLibrary dependency from render backends
and will allow for better decoupling in the future.
2021-06-13 20:03:53 -07:00
Chris Midgley
b6a2738dab
core: support magic button labels for avm1
2021-06-13 10:46:24 -07:00
Adrian Wielgosik
7d1bd57066
avm1: Call ContextMenu.onSelect before preparing context menu items
2021-06-13 10:37:38 -07:00
relrelb
9c5b9b7072
avm1: Rewrite TObject array methods
2021-06-13 10:37:15 -07:00
Mike Welsh
3b215d6c76
core: Use swf::ClipEventFlag in stored clip event handlers
...
* Rename movie_clip::ClipAction to movie_clip::ClipEventHandler.
* Store the swf::ClipEventFlag event flags that trigger the event
directly in the event handler. Previously we split up any event
that had multiple event flags into separate events. Now these
can be kept as a single event.
* Remove `MovieClip::has_button_event`, and instead store the
union of all event flags in `MovieClip::clip_event_flags`. This
will be useful for other cases in the future.
2021-06-11 12:54:53 -07:00
relrelb
ede9650899
chore: Avoid unused_variables annotations
...
Instead prefix the unused variables with an underscore.
2021-06-11 16:16:53 +03:00
Mike Welsh
5462b8a522
core: Allow MorphShapes and Texts to be replaced via PlaceObject
...
PR #4540 allowed shapes to replace their inner art handles via
replace PlaceObject tags. This can also happen for morph shapes and
static texts.
Add MorphShape::replace_with and Text::repalce_with. This fixes the
incorrect art in main menu buttons of Super Mario 63.
2021-06-09 23:37:38 -07:00
Mike Welsh
4fc9225e8f
avm2: Only construct Shapes once
...
Shape objects were mistakenly being reconstructed each frame in
`Graphic::construct_frame`.
2021-06-08 19:47:16 -07:00
Mike Welsh
b1318ecb01
core: PlaceObjectAction::Replace swaps out graphic handles
...
A `PlaceObjectAction::Replace` signals that a shape should
be swapped with a different shape. Previously we instantiated a
completely new `Graphic`, but this is incorrect; instead the
underlying shape handle should be swapped out, but the outer object
remains. This is visible in AVM2 where you can access `Shape` as
a normal display object.
2021-06-08 19:47:16 -07:00
Mike Welsh
93e83d7ad5
avm1: DefineFunction should respect case sensitivity
2021-06-08 16:51:59 -07:00
Mike Welsh
21c351fe5b
swf: Change Twips::zero fn to Twips::ZERO const
2021-06-08 14:57:15 -07:00
Mike Welsh
d23ea90459
swf: Change Matrix to use Fixed16 for a, b, c, d
...
Matrices in an SWF file store their scale/skew components in
in 16.16 format (fbits).
Split `ruffle_core::Matrix` and `swf::Matrix`. `swf::Matrix` now
stores its data as `Fixed16` instead of immediately converting to
`f32`.
2021-06-08 14:57:15 -07:00
relrelb
39decde5bc
avm1: Refactor ScriptObject::get_local
2021-06-08 10:48:50 -07:00
relrelb
1c0007f34f
avm1: Make TObject::get_local return Option
2021-06-08 10:48:50 -07:00
relrelb
15fa92a9fb
avm1: Add TObject::set_local
2021-06-08 10:48:50 -07:00
relrelb
c9d015d7c5
avm1: Cleanup some TObject methods
2021-06-08 10:48:50 -07:00
dependabot[bot]
2f1dc0cbb1
chore: Bump approx from 0.4.0 to 0.5.0
...
Bumps [approx](https://github.com/brendanzab/approx ) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/brendanzab/approx/releases )
- [Commits](https://github.com/brendanzab/approx/compare/v0.4.0...v0.5.0 )
---
updated-dependencies:
- dependency-name: approx
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-07 11:30:59 -07:00
relrelb
b8eae51888
swf: Move num_colors into BitmapFormat::ColorMap8
2021-06-07 11:29:28 -07:00
relrelb
ef2e581f09
core: Use casting instead of ToPrimitive
2021-06-07 11:29:28 -07:00
relrelb
aee37276ec
core: Replace num_enum with num_derive
2021-06-05 10:19:31 -07:00
relrelb
f82faf9603
chore: Appease clippy
2021-06-05 10:16:00 -07:00
Adam Gashlin
ba83f17ef7
core: Set init_object after first run_frame ( fix #2084 , #3414 )
2021-06-02 23:28:24 -07:00
dependabot[bot]
83243acc37
chore: Bump regress from 0.2.0 to 0.3.0
...
Bumps [regress](https://github.com/ridiculousfish/regress ) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/ridiculousfish/regress/releases )
- [Commits](https://github.com/ridiculousfish/regress/commits )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-31 10:06:11 -07:00
Mike Welsh
f173b81e38
swf: Use bitflags for Function flags
2021-05-30 22:14:32 -07:00
Mike Welsh
2b98c878f0
swf: Use Fixed in more places
2021-05-30 21:24:03 -07:00
Adrian Wielgosik
34d54dbc05
avm1: Fix string methods handling of negative args ( fix #4437 )
...
* Improve string.substr handling of negative args
* Add tests for more substr() combinations
2021-05-30 12:04:17 -07:00
Mike Welsh
1304b2c55a
avm2: Move Object properties to Object.prototype
2021-05-24 17:52:15 -07:00
Moulins
af5694b642
[avm1] extend impl_custom_object! to reduce boilerplate
...
This add two knobs to the impl_custom_object! macro:
- `set(...)`, for using a specific prototype in the `set`
method;
- `bare_object(...)`, for objects that are convertible to a raw object
type.
2021-05-24 17:06:47 -07:00
Mike Welsh
3ddb97d2f6
core: Add SwfMovie::frame_rate and num_frames
2021-05-23 23:02:38 -07:00
Mike Welsh
172ad82aa5
core: Add SwfMovie::uncompressed_len
2021-05-23 23:02:38 -07:00
Mike Welsh
077c7f045e
core: Add SwfMovie::stage_size
...
Change `SwfMovie::width` and `height` to return `Twips`.
2021-05-23 23:02:38 -07:00
Mike Welsh
bec6eb9dd3
core: Use SwfMovie::avm_type instead of MovieLibrary::avm_type
2021-05-23 23:02:38 -07:00
Mike Welsh
e1439f4105
swf: Add HeaderExt struct providing additional info
...
When reading an SWF, search for FileAttributes and
SetBackgroundColor and return this along with the header data
because it's useful (in particular, the AS3 flag).
2021-05-23 23:02:38 -07:00
Chris Midgley
aa7dc50385
core: Handle visible flag from PlaceObject ( fix #3403 )
2021-05-23 11:48:12 -07:00
relrelb
a6387c3c10
core: Fix build without serde feature
...
Previously `cargo build --no-default-features` failed because then
`serde` was not found.
Fix that by not implementing serde's traits in that case, similarly
to `config.rs`.
2021-05-22 22:50:20 -07:00
Mike Welsh
8960414436
swf: Use bitflags for FileAttributes
2021-05-22 15:53:02 -07:00
relrelb
3fbadbe26f
avm1: Remove unnecessary gc_context parameters
...
`add_property_with_case`, `set_watcher` and `remove_watcher` already
take an `activation`, from which the `gc_context` can be retrieved.
2021-05-22 10:49:27 -07:00
Mike Welsh
bb22a5aba2
avm1: Remove extraneous self parameters from MovieClip methods
...
Previously these were used because the methods were on `MovieClipData`
instead of `MovieClip`, but now they are no longer necessary.
2021-05-21 17:50:25 -07:00
relrelb
7717b97027
avm1: Remove unnecessary calls to create_bare_object
...
In favor of ScriptObject::object and ScriptObject::array, which
always succeed.
2021-05-21 16:13:25 -07:00
relrelb
aeb8902f8c
avm1: Remove unused TObject::as_string
2021-05-21 15:27:35 -07:00
Moulins
35b9fb7317
avm1: add property_decl::declare_properties! macro for defining built-ins
...
This allows for reduced boilerplate when defining native methods,
properties, and constants (but not values depending on other runtime
values, like built-ins objects and prototypes).
Also remove ScriptObject::force_set_function (replaced by DeclKind::Method)
2021-05-17 10:34:41 -07:00
dependabot[bot]
00194e351e
chore: Bump serde from 1.0.125 to 1.0.126
...
Bumps [serde](https://github.com/serde-rs/serde ) from 1.0.125 to 1.0.126.
- [Release notes](https://github.com/serde-rs/serde/releases )
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.125...v1.0.126 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-17 10:13:02 -07:00
Mike Welsh
f478ee7b2f
avm2: Properly implement Avm2Button::hit_test_shape and mouse_pick
...
The hit area is not a proper child of the Avm2Button, so manually
transform the test point into local space before passing it to the
hit area.
2021-05-16 17:53:07 -07:00
Mike Welsh
dfc8c32937
core: Do not include stage transform in DisplayObject::local_to_global_matrix
...
TODO: Eventually we may want to include the stage transform here,
and the deeper ActionScript APIs transform it to remove the stage
scaling.
2021-05-16 17:53:07 -07:00
Mike Welsh
7784d8c099
avm2: Remove some AVM1 leftovers from Avm2Button
2021-05-16 17:53:07 -07:00
Mike Welsh
9b58dac841
avm2: Fix up DisplayObject root and stage properties
...
Move `MovieClip::is_swf` flag to `DisplayObject::is_root`, and use
this flag to handle the behavior of `DisplayObject.root` crawling
upwards until it hits a top-most loaded SWF/Bitmap.
Simplify `root` and `stage` so that they don't have to consider
buttons. Instead, do some trickery to ensure the button's states
see the proper values of `parent`, `root`, and `stage` during
construction.
2021-05-16 17:53:07 -07:00
Mike Welsh
2176e30e22
avm2: Use define_public_builtin_instance_properties for SimpleButton
2021-05-16 17:53:07 -07:00
David Wendt
e555a6b488
avm2: Impl `SimpleButton.useHandCursor`
2021-05-16 17:53:07 -07:00
David Wendt
6f6e2c1b9f
avm2: Impl `SimpleButton.enabled`
2021-05-16 17:53:07 -07:00
David Wendt
514c51510c
avm2: Impl `SimpleButton.trackAsMenu`
2021-05-16 17:53:07 -07:00
David Wendt
b383aec78d
tests: Move the button tests into the new test directory.
2021-05-16 17:53:07 -07:00
David Wendt
71bb0c901a
avm2: Impl the constructor parameters for `SimpleButton`
2021-05-16 17:53:07 -07:00
David Wendt
a82e78b597
tests: Don't check the `exitFrame` or `frameConstructed` events in the nested test as it appears to fire the events redundantly
2021-05-16 17:53:07 -07:00
David Wendt
cfd95e3b3b
core: `root` and `stage` should yield `None` if an inactive state child of an `Avm2Button` is involved in the parent chain.
2021-05-16 17:53:07 -07:00
David Wendt
169a99397a
core: `stage` also yields the current context's stage if there isn't one in the parent chain and we aren't in a button
2021-05-16 17:53:07 -07:00
David Wendt
bfebc3c78f
core: AVM2Button does not set the parent of the movie until after it's constructors have run
2021-05-16 17:53:07 -07:00
David Wendt
6a9249e52f
core: Store the root of each loaded movie and use it as a last-ditch way to get the root
2021-05-16 17:53:07 -07:00
David Wendt
9ded256c23
core: Implement the AVM2 concept of `stage`.
2021-05-16 17:53:07 -07:00
David Wendt
39e9ef9dc5
core: Implement a separate `avm2_root` method that provides an AS3 notion of root
2021-05-16 17:53:07 -07:00
David Wendt
e4a6a10038
tests: Add tests for what children see as their parent when constructed or shuffled between movie clips and buttons
2021-05-16 17:53:07 -07:00
David Wendt
a9d7b30dc2
core: `Avm2Button` should unparent any added children
2021-05-16 17:53:07 -07:00
David Wendt
082ecb16cb
core: `avm2_parent` always returns a container, or nothing.
2021-05-16 17:53:07 -07:00
David Wendt
157ced3dc3
core: Split the parent accessor further into `parent` and `avm1_parent`.
...
`parent` is now a bare accessor, `avm1_parent` returns what AVM1 thinks the parent should be, and `avm2_parent` returns what AVM2 thinks the parent should be.
2021-05-16 17:53:07 -07:00
David Wendt
f90cfb3bd0
core: Ensure sprite children get linked up correctly
2021-05-16 17:53:07 -07:00
David Wendt
5274df11f7
core: `Shape` should always expose it's defining movie instead of punting to the parent clip
2021-05-16 17:53:07 -07:00
David Wendt
826b20e8e4
tests: Don't assert execution order of frame scripts within buttons
2021-05-16 17:53:07 -07:00
David Wendt
ef4de4d0d7
core: Order of events for child `Avm2Button` states is hit-up-down-over.
...
Ok, it's not *actually* that - all our tests actually have different, conflicting information. As far as I can tell there doesn't seem to be a single set order for these; so I'm going to just pick one and then stop testing the order in which states run.
2021-05-16 17:53:07 -07:00
David Wendt
c936ccd4b4
avm2: When constructing new `SimpleButton`s, make sure the display object sees it's AVM2 side, else we replace all it's contents with AVM1 objects somehow(?!)
2021-05-16 17:53:07 -07:00
David Wendt
208c191d88
core: `Avm2Button` always runs a frame on set children, even if it's not the current state
2021-05-16 17:53:07 -07:00
David Wendt
bf1fb93b83
core: Allow linking `Avm2Button`'s object
2021-05-16 17:53:07 -07:00
David Wendt
d7deaf5e00
tests: Add currently-failing tests for the `SimpleButton` constructor and order-of-events.
2021-05-16 17:53:07 -07:00
David Wendt
44e82ea480
core: `Avm2Button` fires off events in this order when you set one of it's children:
...
1. `added`/`addedToStage` on the new state
2. `removed` (presumably) on the old state
3. `frameConstructed` on the new state
4. Any frame scripts on the new state
5. `exitFrame` on the new state
This is a rough approximation; I have several tests that fail in weird and interesting ways. Also, this only happens if you set the *active* state; presumably these events are all fired when the state changes but I can't automate tests for that yet.
2021-05-16 17:53:07 -07:00
David Wendt
434563da2f
avm2: `SimpleButton` should build a button when constructed
2021-05-16 17:53:07 -07:00
David Wendt
67c7f156ac
avm2: `instanceof` accepts `null` and `undefined`
2021-05-16 17:53:07 -07:00
David Wendt
7f294f5209
avm2: Constructor-based symbol instantiation should also post-instantiate before constructing a frame
2021-05-16 17:53:07 -07:00
David Wendt
ea80d999da
tests: Add an almost-passing test for buttons with multiple levels of children
2021-05-16 17:53:07 -07:00
David Wendt
07513da3ba
core: State-constructed sprites in `Avm2Button` should be post-instantiated after everything else so they get their instance numbers later
2021-05-16 17:53:07 -07:00
David Wendt
bba2ecae8e
core: `Shape` gets an instance number
2021-05-16 17:53:07 -07:00
David Wendt
3707ef7fec
tests: Add a test for child events using the same timeline structure as the structure test.
2021-05-16 17:53:07 -07:00
David Wendt
11d7fe5107
core: Correct the order of events that are fired when an `Avm2Button` is instantiated on the timeline.
2021-05-16 17:53:07 -07:00
David Wendt
6a70c1b3e0
tests: Extend the simplebutton structure test to include frame 2
2021-05-16 17:53:07 -07:00
David Wendt
a013a7dfdf
core: Initial construction should also prevent normal frame execution first frame
2021-05-16 17:53:07 -07:00
David Wendt
9f5a7f5065
core: AVM2 `Button`s run their children one frame at construction time
2021-05-16 17:53:07 -07:00
David Wendt
bfef7f9969
core: `Avm2Button` should always construct a sprite for each state, even if it's not used.
2021-05-16 17:53:07 -07:00
David Wendt
afefdb892f
tests: Add a test for timeline-constructed AS3 `SimpleButton` contents
2021-05-16 17:53:07 -07:00
David Wendt
821ed25374
avm2: `Avm2Button` should construct it's children
2021-05-16 17:53:07 -07:00
David Wendt
71b87f8935
avm2: Also impl `construct_frame` and `run_frame_scripts` for `Avm2Button`
2021-05-16 17:53:07 -07:00
David Wendt
4869ec650e
core: `Avm2Button` should construct a sprite whenever there's anything other than one child
2021-05-16 17:53:07 -07:00
David Wendt
c317d77916
core: `Avm2Button` shouldn't try to construct a Sprite using it's prototype
2021-05-16 17:53:07 -07:00
David Wendt
10bed4fe30
core: `set_avm2_constructor` works on constructors, not prototypes
2021-05-16 17:53:07 -07:00
David Wendt
d049ba8c0f
core: Child instantiation should print the error message it got when it fails
2021-05-16 17:53:07 -07:00
David Wendt
25473ac1dc
core: Allow AVM2 movies to define `Avm2Button` characters in their libraries
2021-05-16 17:53:07 -07:00
David Wendt
cb44554135
avm2: Add setters and getters for the four states of `SimpleButton`
2021-05-16 17:53:07 -07:00
David Wendt
494083673c
core: Add AVM2 version of Button
2021-05-16 17:53:07 -07:00
David Wendt
22eac776be
avm2: Stub `flash.display.SimpleButton`
2021-05-16 17:53:07 -07:00
David Wendt
cffa739a54
avm2: Store the sprite proto
2021-05-16 17:53:07 -07:00
David Wendt
c0296d9963
core: Rename `Button` to `Avm1Button`
2021-05-16 17:53:07 -07:00
Reiner Gerecke
efdb9c153d
core: Fix endless loop when layouting text
...
If a textfield has word wrapping enabled, is very small in size and
tries to layout a single character onto it, the layout code can run into
an endless loop where it's creating new lines and trying to fit the text
again.
If text doesn't fit at the start of a line, it won't fit on the next
either, so abort and display the whole text span on the line. Text will
be cut-off.
This can be reproduced with a AS2 file like this:
class Test {
static var app : Test;
function Test() {
_root.createTextField("tf",0,0,0,6,20);
_root.tf.text = "0";
_root.tf.wordWrap = true;
}
static function main(mc) {
app = new Test();
}
}
Build it with `mtasc -main -header 100💯 30 test.as -swf test.swf`
2021-05-15 18:56:51 -07:00
Mike Welsh
69a0700ca1
core: Remove collect::CollectWrapper
...
No longer necessary, it is possible to mark individual fields
as `#[collect(require_static)]`.
2021-05-13 23:24:10 -07:00
Mike Welsh
b882284fc9
core: Use bitflags for HitTestOptions
2021-05-12 23:02:06 -07:00
relrelb
85b234003f
avm1: Handle undefined/empty method name in NewMethod
...
Seems like it behaves similarly to CallMethod with an undefined/empty
method name.
2021-05-12 20:47:06 -07:00
relrelb
2589ecdde0
avm1: Correct ImplementsOp
2021-05-12 20:47:06 -07:00
relrelb
3bf3f1015d
avm1: Return undefined on invalid count in InitArray and InitObject
...
Both InitArray and InitObject should bail-out without popping anything
off the stack when the elements/properties count is negative or greater
than or equals 2147483648.
2021-05-12 20:47:06 -07:00
relrelb
72531eddff
avm1: Cleanup CallMethod
2021-05-12 20:47:06 -07:00
relrelb
2e0bc78cd6
avm1: Fix variadic arguments
...
Previously, if the arguments count was greater than the actual
stack size, then a stack underflow occurred which resulted in a
sequence of undefined values. That didn't match Flash's behavior.
Also, this prevents potential huge allocations that hang Ruffle.
In addition, num_args seems like it should use coerce_to_u32
(wraps at 4294967297). This also means that -1 ends up acting like
u32::MAX and would pop all values off of the stack.
2021-05-12 20:47:06 -07:00
dependabot[bot]
62301dea54
chore: Bump syn from 1.0.71 to 1.0.72
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.71...1.0.72 )
Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 09:40:26 -07:00
Mike Welsh
6051ee4cb1
core: Disallow .. in shared object paths ( fix #3961 )
...
Toss out any shared objects that contain ".." in the name
to avoid accessing files outside of the Ruffle data directory.
The DiskStorageBackend also will fail any requests with a ".."
component as an extra precaution.
Fixes #3961 .
2021-05-09 23:20:32 -07:00
CUB3D
61298b2be3
avm1: Add parsing of legacy json SharedObjects for backwards compatability
2021-05-09 23:20:32 -07:00
CUB3D
f4a9446829
avm1: Fix tests for SharedObject
2021-05-09 23:20:32 -07:00
CUB3D
c398aded68
chore: Remove debug printing
2021-05-09 23:20:32 -07:00
CUB3D
cd1cde1708
avm1: Implement de/serialization of shared objects into Flash Player Lso format
2021-05-09 23:20:32 -07:00
relrelb
6b6b335440
avm1: Use bitflags for Array.sort flags
2021-05-08 01:37:05 -07:00
Mike Welsh
ba7fd1b2b9
chore: Appease clippy, bump url
...
Bump url and avoid `Url::into_string` deprecation warnings.
Fix `single_char_pattern` clippy lints.
2021-05-07 20:51:26 -07:00
relrelb
b2bc24919a
avm1: Replace `current_swf_version` with `swf_version`
...
They happen to be identical, and `swf_version` is more idomatic.
2021-05-07 13:26:20 -07:00
Mike Welsh
ef617eebad
avm1: Use `set_html_text` when initializing textfield from a variable binding
...
If a textfield was created with a variable binding, and the variable
already existed, the initial text of the textfield is set to the
variable value. However, this was not obeying the HTML setting of
the text field, so HTML tags were mistakenly shown in some content.
Fixes #3522 .
2021-05-06 16:58:33 -07:00
Adrian Wielgosik
5319a5bb81
Remove lifetime from constants
2021-05-06 10:54:33 -07:00
Adrian Wielgosik
faa0e50e89
avm2: Unify NativeMethod and GenericNativeMethod
2021-05-06 10:54:33 -07:00
Adrian Wielgosik
46ddb9be82
avm2: Generate class traits from const arrays
2021-05-06 10:54:33 -07:00
Adrian Wielgosik
8312243f42
avm2: Don't repeatedly call class.write(mc)
2021-05-06 10:54:33 -07:00
Mike Welsh
b82391726f
avm1: MovieClip.getBytesLoaded/Total should return the clip's length
...
MovieClip.getBytesLoaded and getBytesTotal return the size of that
specific clip, even if it's not a loaded SWF. The previous logic
only returned the size of the parent SWF.
If the clip is an SWF, the uncompressed size of the SWF is returned.
Otherwise, the length of the tag list inside the clip's DefineSprite
tag is returned.
2021-05-04 16:36:56 -07:00
Aaron Hill
08d0829177
Move all SWF tests out of `core` to new `tests` package
...
This allows `regressions_tests.rs` to depend on other crates in the
workspace, such as `render`, without introducing a cyclic dependency.
Split out from #4054
2021-05-04 11:47:59 -07:00
Mike Welsh
f9769451d6
avm1: Handle CDATA sections in XML
2021-05-03 16:23:04 -07:00
Moulins
78627acc92
chore: Move core::property_map to core::avm1::property_map
2021-05-03 13:47:14 -07:00
Moulins
272841729e
core: Replace SwfMovie's PropertyMap by a list of key-value pairs
...
PropertyMap is an AVM1-only concept, and shouldn't be used on cross-VM
types.
2021-05-03 13:47:14 -07:00
Mike Welsh
dca97afdd7
chore: Remove puremp3 feature
...
Wasn't being used, remove the puremp3 dependency.
2021-05-02 19:31:01 -07:00
Adrian Wielgosik
8ca22c1f02
core: Support for custom context menu items on movie root
2021-05-02 15:28:00 -07:00
Chris Midgley
31911d24ab
tests: replace existing shared object test using mtasc
2021-05-01 17:40:01 -07:00
Chris Midgley
c03bc62074
fix: SharedObject data property is not deleteable
2021-05-01 17:40:01 -07:00
Mike Welsh
e8ec02418b
avm2: Fix Array.splice
...
Fix `Array.splice` in cases where elements are added but not
deleted, and when the starting index is larger than the length
of the array.
2021-04-30 13:48:27 -07:00
Mike Welsh
2a46c72bb2
avm1: Fix Array.splice
...
Clamp the index parameters to the length of the array. This fixes
`[].splice(1, 0, 'obj');` to add the object at the proper
position (0, because the start index 1 is larger than the length).
2021-04-30 13:48:27 -07:00
dependabot-preview[bot]
b57e1a14f0
build(deps): bump syn from 1.0.70 to 1.0.71
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.70 to 1.0.71.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.70...1.0.71 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-28 10:02:43 -07:00
David Wendt
041003f256
avm2: Slot lookups don't need the whole trait list, just the first one we find.
2021-04-28 00:01:47 -07:00
David Wendt
fd08a6ebf6
avm2: Instantiate slot traits on `get_slot`, `set_slot` etc.
...
Previously, we only instantiated slot traits when named as a property, which is only half the picture.
2021-04-28 00:01:47 -07:00
David Wendt
e35d1edbf0
avm2: Allow pulling traits by slot id
2021-04-28 00:01:47 -07:00
David Wendt
07db1786f1
tests: Add a test for AVM2 nested closures (which thus tests `newactivation`)
2021-04-28 00:01:47 -07:00
David Wendt
9318028b52
avm2: `newactivation` should return an object which implements the traits listed in the associated method `body`'s trait list
2021-04-28 00:01:47 -07:00
David Wendt
6c5098d3c7
avm2: Fix order in which `setslot` takes it's parameters
2021-04-28 00:01:47 -07:00
Adrian Wielgosik
5a6117722d
core: Also hide playback controls on single-frame SWFs
2021-04-27 16:42:02 -07:00
Adrian Wielgosik
a1737b5922
avm1: Respect menu.builtInItems, but on root clip only
2021-04-27 16:42:02 -07:00
Adrian Wielgosik
c3a16cb992
avm2: Support Stage.showDefaultContextMenu
2021-04-27 16:42:02 -07:00
Adrian Wielgosik
ce4d66e0f4
avm1: support Stage.showMenu
2021-04-27 16:42:02 -07:00
Adrian Wielgosik
41a126885c
web: Minimal context menu buttons for movie control
2021-04-27 16:42:02 -07:00
TÖRÖK Attila
61fddf530e
core/display_object: Correctly draw videos that have different bounds than the size of their actual frame data
2021-04-27 11:49:16 -07:00
Mike Welsh
1f8434aee6
tests: Add test for Stage.scaleMode/align
2021-04-26 01:15:42 -07:00
Mike Welsh
a57f227bda
core: Implement Stage resize events
2021-04-26 01:15:42 -07:00
Mike Welsh
251fd55567
core: Adjust stage size by DPI factor in NoScale scale mode
2021-04-26 01:15:42 -07:00
Mike Welsh
98befe678e
avm2: Add flash.display.StageScaleMode and Stage.scaleMode
2021-04-26 01:15:42 -07:00
Mike Welsh
80bcf68634
avm1: Add StageScaleMode and StageAlign properties to Stage
2021-04-26 01:15:42 -07:00
Mike Welsh
b4717130e3
core: Add StageScaleMode and StageAlign properties to Stage
2021-04-26 01:15:42 -07:00
David Wendt
a877fe8c67
tests: Add a new test for properties unique to the `Stage`
2021-04-26 01:15:42 -07:00
David Wendt
52c3b0f1bc
avm2: `Stage.color` yields background color alpha (always 0xFF) in the high bits of the u32
2021-04-26 01:15:42 -07:00
David Wendt
41fe51e9db
avm2: Impl `flash.display.StageQuality` enum
2021-04-26 01:15:42 -07:00
David Wendt
93d7f0b450
avm2: Stub `Stage.quality`
2021-04-26 01:15:42 -07:00
David Wendt
327a425fde
avm2: Stub `Stage.allowsFullScreen` and `Stage.allowsFullScreenInteractive`
2021-04-26 01:15:42 -07:00
David Wendt
cb167e0814
avm2: Impl `Stage.stageWidth`/`Stage.stageHeight`, sorta
2021-04-26 01:15:42 -07:00
David Wendt
1ee5bbf7ba
avm2: Impl `Stage.frameRate`
2021-04-26 01:15:42 -07:00
David Wendt
5d8f70d695
avm2: Implement `Stage.focus`
2021-04-26 01:15:42 -07:00
David Wendt
524f5fe57f
avm2: Impl `Stage.color`'s setter
2021-04-26 01:15:42 -07:00
David Wendt
6c6bd74af9
avm2: Impl `Stage.displayState`'s getter
2021-04-26 01:15:42 -07:00
David Wendt
ae080fd65f
avm2: Impl `flash.display.StageDisplayState`
2021-04-26 01:15:42 -07:00
David Wendt
b858f74139
avm2: Impl `Stage.contentsScaleFactor`
2021-04-26 01:15:42 -07:00
David Wendt
247f7e3de4
avm2: Impl `Stage.color`
2021-04-26 01:15:42 -07:00
David Wendt
d7a0d15fd8
avm2: Expose `Stage.browserZoomFactor`
2021-04-26 01:15:42 -07:00
David Wendt
0c6584ca03
core: Store the viewport's scale factor on the stage
2021-04-26 01:15:42 -07:00
David Wendt
98788ef194
avm2: Impl `flash.display.StageAlign`
2021-04-26 01:15:42 -07:00
David Wendt
2a30887660
avm2: Support the half-broken `loaderInfo` on the `Stage`
2021-04-26 01:15:42 -07:00
David Wendt
ef4db9ba16
avm2: Add overrides for every property that cannot be set on the `Stage`.
...
Yes, this includes properties that aren't implemented yet. They'll return a different error, but they'll still error out regardless, so I'm fine with this.
2021-04-26 01:15:42 -07:00
David Wendt
bc9affb09d
tests: Add tests for stage access and basic display object properties
2021-04-26 01:15:42 -07:00
David Wendt
716d492006
avm2: The stage's name should be `null`, not an empty string; and setting it should except.
2021-04-26 01:15:42 -07:00
David Wendt
01f74f6eb1
avm2: Add a convenience method for marking a builtin override trait.
2021-04-26 01:15:42 -07:00
David Wendt
8452e23382
avm2: Allow access to the `Stage`, both directly and indirectly
2021-04-26 01:15:42 -07:00
David Wendt
ba66c62947
core: Ensure `Stage` always has an AVM2 representation
2021-04-26 01:15:42 -07:00
David Wendt
81de112774
avm2: Add `Stage` class stub
2021-04-26 01:15:42 -07:00
David Wendt
7f4a99ca60
core: Add a `root_clip` method for `Stage` and make everything grabbing depth 0 off the stage use it
2021-04-26 01:15:42 -07:00
David Wendt
36e486b1d0
core: We don't need `CollectWrapper` anymore
2021-04-26 01:15:42 -07:00
David Wendt
f6fe0a84a2
core: Move the viewport and stage dimensions into the `Stage`.
2021-04-26 01:15:42 -07:00
David Wendt
c09bd0520c
core: Run all of the steps of a frame update on the `Stage`
2021-04-26 01:15:42 -07:00
David Wendt
b021d04345
core: Correct order of viewport bounds in render context
2021-04-26 01:15:42 -07:00
David Wendt
4e4f1dce26
core: `Stage` should render it's children
2021-04-26 01:15:42 -07:00
David Wendt
7341fa0554
core: Remove the explicit view bounding box and instead have all the culling code ask the `Stage` what it's bounding box is
2021-04-26 01:15:42 -07:00
David Wendt
67724bfc71
core: Move most of the player rendering code into the `Stage`'s render method.
2021-04-26 01:15:42 -07:00
David Wendt
44af21b398
core: `Letterbox` should be `Collect`
2021-04-26 01:15:42 -07:00
David Wendt
6bf3206d95
core: Replace `context.levels` with a root stage
2021-04-26 01:15:42 -07:00
David Wendt
0011753914
core: Add the ability to iterate over the depth list of any container
2021-04-26 01:15:42 -07:00
David Wendt
14430b9eb0
core: Add a `Stage` display object type
2021-04-26 01:15:42 -07:00
Mike Welsh
c422a66aa6
chore: Appease clippy
...
Fix `bool_assert_comparison` and `from_iter_instead_of_collect` lints.
2021-04-24 21:42:30 -07:00
Mike Welsh
d43b033caa
tests: Add tests for BitmapData max size
2021-04-24 16:16:24 -07:00
relrelb
bab0ae8f30
avm1: Limit width and height of BitmapData
2021-04-24 16:16:24 -07:00
relrelb
c78501f2bd
avm1: Fix panic in BitmapData.loadBitmap
...
BitmapData.loadBitmap is not subject to the size limit. That is,
it can load larger bitmaps than the BitmapData constructor.
Fix panic for large bitmaps by not invoking the BitmapData constructor
directly. This should also improve performance.
Do the same for BitmapData.clone.
2021-04-24 16:16:24 -07:00
relrelb
2d3a4910fc
avm1: Correct BitmapData constructor
...
* Extract is_size_valid, which respects 3 different limits:
SWF<=9, SWF10 and SWF>=11.
* Delay is_size_valid check after all arguments coercing.
* Swap the transparency and fill_color parameters of init_pixels.
2021-04-24 16:16:24 -07:00
Mike Welsh
d34b72cc47
web: Expose SWF metadata to JavaScript
...
Add `RufflePlayer.metadata` that exposes the SWF header fields to
JavaScript.
Add `RufflePlayer.readyState` and fire a `loadedmetadata` event
once the metadata is available, mimicking the HTML5 media APIs.
2021-04-23 16:58:24 -07:00
Mike Welsh
33a73c5262
tests: Bump test script timeout
2021-04-23 16:57:28 -07:00
Mike Welsh
d58bc9b5c5
core: Disable script timeout in debug builds
2021-04-23 16:57:28 -07:00
David Wendt
f33976f4c0
avm2: Store symbol / class relationships using the class constructor, not the prototype.
2021-04-23 00:26:10 -07:00
David Wendt
0ee9e0f820
tests: Add a test for constructing symbol classes in AVM2
2021-04-23 00:26:10 -07:00
David Wendt
aa6dc600c0
avm2: Treat construction of symbol classes as symbol instantiation.
2021-04-23 00:26:10 -07:00
David Wendt
815d0fb540
core: Add `DisplayObject` method for setting the AVM2 side of a display object
2021-04-23 00:26:10 -07:00
David Wendt
9b19cc1570
Store the movie associated with a given symbol being constructed.
2021-04-23 00:26:10 -07:00
David Wendt
282508a281
core: Make the AVM2 constructor registry global
2021-04-23 00:26:10 -07:00
David Wendt
b1be111a4e
core: Store constructor prototypes in the constructor registry when defining symbols
2021-04-23 00:26:10 -07:00
David Wendt
555d97006a
core: Add an AVM2 constructor registry
2021-04-23 00:26:10 -07:00
David Wendt
68c270e7c0
avm2: Impl `Eq`, `Hash` for `Object` using ptr values
2021-04-23 00:26:10 -07:00
TÖRÖK Attila
3f583088a2
core/avm1: Coerce Rectangle and Point parameter fields to f64 first
2021-04-21 18:46:03 -07:00
TÖRÖK Attila
22306cc8d9
core/avm1: Switch to i32 in BitmapData.merge(), clamp *_mult parameters
2021-04-21 18:46:03 -07:00
TÖRÖK Attila
40eedb6405
core/avm1: Implement BitmapData.merge()
2021-04-21 18:46:03 -07:00
dependabot-preview[bot]
63e8c0c88a
build(deps): bump syn from 1.0.69 to 1.0.70
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.69 to 1.0.70.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.69...1.0.70 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-21 18:31:39 -07:00
Adrian Wielgosik
8176e0a633
avm2: minor changes to domain memory
...
* Do not use as_bytearray_mut when we don't need mutability
* Set default domain memory size to 1024b.
2021-04-21 15:08:13 -07:00
CUB3D
9812fab9f8
chore: Format and fix clippy lints
2021-04-21 00:33:11 -07:00
CUB3D
7c4eb0d7ff
avm2: Implement ApplicationDomain.domainMemory
2021-04-21 00:33:11 -07:00
CUB3D
b3b1e69fc2
avm2: Store ByteArrayObject in Domain rather than ByteArrayStorage
2021-04-21 00:33:11 -07:00
CUB3D
4dc1210b37
avm2: Use try_into for converting slice->array
2021-04-21 00:33:11 -07:00
CUB3D
98d9bd06b6
avm2: Remove more unused code from test
2021-04-21 00:33:11 -07:00
CUB3D
d6a3b5bfda
avm2: Remove unused code from test
2021-04-21 00:33:11 -07:00
CUB3D
397ceed33c
avm2: Dont panic when domain memory not available
2021-04-21 00:33:11 -07:00
CUB3D
136add866a
chore: Fix clippy lints
2021-04-21 00:33:11 -07:00
CUB3D
63120806bf
avm2: Correct Sxi8 and Sxi16
2021-04-21 00:33:11 -07:00
CUB3D
6d2339b151
avm2: Add tests for Op::Sxi1
2021-04-21 00:33:11 -07:00
CUB3D
f34579926c
chore: Format
2021-04-21 00:33:11 -07:00
CUB3D
99edb5ab2b
avm2: Implement Op::Sxi1
2021-04-21 00:33:11 -07:00
CUB3D
9ffa4f1f50
avm2: Implement Op::Lf64
2021-04-21 00:33:11 -07:00
CUB3D
b4736413fa
avm2: Implement Op::Sf64
2021-04-21 00:33:11 -07:00
CUB3D
2b4becf41f
avm2: Implement Op::Lf32
2021-04-21 00:33:11 -07:00
CUB3D
509392db8e
avm2: Implement Op::Sf32
2021-04-21 00:33:11 -07:00
CUB3D
dce2626482
avm2: Use from/to_le_bytes
2021-04-21 00:33:11 -07:00
CUB3D
35d7c5a7e3
chore: Format
2021-04-21 00:33:11 -07:00
CUB3D
ae9d5fd328
avm2: Implement Op::Li32
2021-04-21 00:33:11 -07:00
CUB3D
951d557a90
avm2: Implement Op::Si32
2021-04-21 00:33:11 -07:00
CUB3D
96ad0e3d00
avm2: Implement Op::Li16
2021-04-21 00:33:11 -07:00
CUB3D
aaaf6ace3e
avm2: Implement Op::Si16
2021-04-21 00:33:11 -07:00
CUB3D
f437539f73
avm2: Some domain memory is available by default and error when range invalid
2021-04-21 00:33:11 -07:00
CUB3D
5a0cdf60bc
avm2: Implement Op::Si8 and Op::Li8 badly
2021-04-21 00:33:11 -07:00
CUB3D
12a198f671
avm2: Implement Op::Coerce and add tests
2021-04-21 00:33:11 -07:00
CUB3D
c2969895b2
avm2: Add domain memory tests
2021-04-21 00:33:11 -07:00
CUB3D
89c01dca18
swf: Add support for AVM2 domain memory opcodes
2021-04-21 00:33:11 -07:00
TÖRÖK Attila
46ddc31254
avm2: Call the super initializer of LoaderInfo after construction
2021-04-19 18:16:47 -07:00
Mike Welsh
cbe685f8d5
tests: Update transform test to verify color transform rounding
2021-04-19 15:47:52 -07:00
Mike Welsh
0552d26551
core: Use Fixed8 and i16 for ColorTransform
...
Use the proper types for ColorTransform:
* Fixed8 (8.8) format for multiplicative component
* i16 format for additive component
This matches the behavior of Flash (for example, alpha only changes
in units of 1/256).
2021-04-19 15:47:52 -07:00
dependabot-preview[bot]
9c466c65da
build(deps): bump syn from 1.0.67 to 1.0.69
...
Bumps [syn](https://github.com/dtolnay/syn ) from 1.0.67 to 1.0.69.
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/1.0.67...1.0.69 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-18 23:54:37 -07:00
relrelb
cd8ab813a4
avm1: Return an unboxed undefined in `TransformObject` constructor
...
This is now possible thanks to #2415 .
2021-04-17 09:27:29 -07:00
relrelb
6d68460196
tests: Expand funky_function_calls
2021-04-17 09:25:24 -07:00
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