Will Brindle
0814b17fd8
chore: add tests for equality and greaterthan
2019-10-08 20:45:39 +01:00
Will Brindle
e2c7af5cda
core: fix boolean strict comparison
2019-10-08 19:59:32 +01:00
Will Brindle
9cf381b0e0
core: add support for actions GreaterThan, StringGreaterThan and StrictEquals
2019-10-08 19:59:32 +01:00
Nathan Adams
d697d03cf0
Drop the `Attribute::` everywhere
2019-10-08 20:35:23 +02:00
Mike Welsh
fb442688cb
chore: Change edit_text.rs to LF line endings
2019-10-08 11:15:15 -07:00
Nathan Adams
3d09ec81e2
Add Attribute::DontEnum
2019-10-08 16:36:39 +02:00
Nathan Adams
f782aaee18
Add Attribute::ReadOnly
2019-10-08 15:24:57 +02:00
Nathan Adams
f2a4000ee2
Added object property attributes (initially just DontDelete)
2019-10-08 14:30:36 +02:00
Will Brindle
4856efe7d8
chore: add integration tests for typeof
2019-10-08 02:59:26 -07:00
Will Brindle
2e3748438a
core: define globals for NaN, Infinity, -Infinity. Should fix `typeof NaN`
2019-10-08 02:59:26 -07:00
Mike Welsh
3b288272d4
text: Hack to skip HTML in dynamic text fields
2019-10-07 23:23:45 -07:00
Mike Welsh
eded29ce6d
text: Add dummy implementation of device text
...
Embed an SWF version of Noto Sans (core/assets/*) into the player.
The player will load this font and use it to render device text.
This is a quicky implementation to get dynamic device text
rendering.
2019-10-07 23:23:45 -07:00
Mike Welsh
de1cedb653
core: Initial EditText implementation
2019-10-07 23:23:45 -07:00
Mike Welsh
9084524580
core: Render DefineFont3 at proper size ( fixes #47 )
...
Per SWF19, shape coordinates in DefineFont3 are at 20x the size of
DefineFont1/2.
2019-10-07 12:05:27 -07:00
Mike Welsh
574ede0541
avm1: Return proper root object for Avm1::root_object
...
Was returning start_clip instead. Also call
DisplayObject::post_instantiation for root after it's created in
Player::new.
2019-10-07 01:36:05 -07:00
Mike Welsh
4477e8458f
avm1: Return dummy value 1 for getBytesLoaded/getBytesTotal
...
Previously returned 0 which would cause divide by 0 in many
preloaders.
2019-10-07 00:33:30 -07:00
Mike Welsh
7ed4ea0a2b
tests: Rename integration_tests -> regression_tests
2019-10-06 23:58:52 -07:00
Mike Welsh
18a3494de2
chore: Typo supress -> suppress
2019-10-06 15:24:38 -07:00
Mike Welsh
b6eba80ebd
chore: cargo fmt
2019-10-06 14:57:43 -07:00
Mike Welsh
1c3e4406b3
chore: Fix clippy lints
...
* Remove clone calls from Copy objects
* Used Iterator::cloned() instead of manually cloning
* Pass swf::Function into AvmFunction2::new()
* Use action_clone_sprite
2019-10-06 14:57:36 -07:00
David Wendt
2d365856a7
Fix tellTarget being broken by the introduction of scopes. We now create a new scope chain based off the selected active clip.
2019-10-06 13:02:31 -07:00
David Wendt
588b2bb061
Fixes to make tests compile again
2019-10-06 13:02:31 -07:00
David Wendt
5873eefb06
Since it is possible to have virtual properties in the scope chain, overwriting them should trigger their setters.
...
Define, since it's intended for setting locals only, always uses force-set and does not trigger setters.
2019-10-06 13:02:31 -07:00
David Wendt
06d0cf5ed1
Add a stern warning to be triggered if multiple readers are open at once.
2019-10-06 13:02:31 -07:00
David Wendt
8ed09e22ba
Refactor: Since `function.rs` handles calling conventions it should just hand the avm an activation object directly
2019-10-06 13:02:31 -07:00
David Wendt
cf5420e2e1
Implement register preloading, for variables we already have implemented.
2019-10-06 13:02:31 -07:00
David Wendt
8734c036a7
Removed unused function
2019-10-06 13:02:31 -07:00
David Wendt
91cbbb4e9c
`ActionWaitForFrame`/`2` should not create their own readers either.
2019-10-06 13:02:31 -07:00
David Wendt
a5865d7c7d
Implement DefineFunction2
2019-10-06 13:02:31 -07:00
David Wendt
ec1b5c457e
Allow activations to hold their own private register set.
2019-10-06 13:02:31 -07:00
David Wendt
d822a35404
Fix `ActionIf` and `ActionJump`
2019-10-06 13:02:31 -07:00
David Wendt
171cb9f014
GetMember needs to support string coercions (e.g. `array[1]` should work)
2019-10-06 13:02:31 -07:00
David Wendt
deecd85c81
Implement `SetMember`
2019-10-06 13:02:31 -07:00
David Wendt
697a02bd05
Implement `GetMember`
2019-10-06 13:02:31 -07:00
David Wendt
51a7b426fd
Implement registers, including register pushes and `ActionStoreRegister`.
2019-10-06 13:02:31 -07:00
David Wendt
582b3a8968
Adjust GetVariable/SetVariable based on test results
2019-10-06 13:02:31 -07:00
David Wendt
17482b8810
ActionDelete and ActionDelete2 return a bool
2019-10-06 13:02:31 -07:00
David Wendt
002dd9904c
Implement `ActionDelete` / `ActionDelete2`
2019-10-06 13:02:31 -07:00
David Wendt
9b81a92516
Fix a number of bugs preventing the with-scope test from working at all:
...
1. We no longer implicitly return Undefined unless we're specifically returning from a function (this also keeps actions from filling the stack with Undefined)
2. With scopes are now always inserted behind the current set of locals rather than overriding them
3. `ActionSubtract` now subtracts (instead of adds)
2019-10-06 13:02:31 -07:00
David Wendt
fc1ce7692b
Implement ActionWith
2019-10-06 13:02:31 -07:00
David Wendt
7bf6e22714
Minor refactor/adjustment of GetVariable/SetVariable impl to explicitly check for slashpaths
2019-10-06 13:02:31 -07:00
David Wendt
face06f268
Impl `ActionEnumerate`
2019-10-06 13:02:31 -07:00
David Wendt
22f75b7a4c
Implement closure scope
2019-10-06 13:02:31 -07:00
David Wendt
d757ce0cd2
Implement arguments object.
2019-10-06 13:02:31 -07:00
David Wendt
90b0140ac2
Don't lock up when running scope operations
2019-10-06 13:02:31 -07:00
David Wendt
9ede91df4f
Move `this` into the activation object.
...
Also, change the implicit `this` on functions to `active_clip` as per the `ActionContext` docstrings.
2019-10-06 13:02:31 -07:00
David Wendt
ca1fb713a3
Execute actions in MovieClip scope
2019-10-06 13:02:31 -07:00
David Wendt
215d4f2df4
Provide arguments as local variables as some functions look for these
2019-10-06 13:02:31 -07:00
David Wendt
3ab2eecc3c
Support implicit return via boundary break
2019-10-06 13:02:31 -07:00
David Wendt
f3d83908ab
All activation frames share the same stack (and can see each other's garbage).
2019-10-06 13:02:31 -07:00
David Wendt
667b30f4b5
Add scope chains for local variable resolution.
2019-10-06 13:02:31 -07:00
David Wendt
13a88143d6
Off-the-end execution should implicitly return undefined if there's another stack frame to run.
2019-10-06 13:02:31 -07:00
David Wendt
edc37dee5d
Add support for calling bare functions and returning from them.
2019-10-06 13:02:31 -07:00
David Wendt
00b5d9ecf5
Implement DefineFunction
2019-10-06 13:02:31 -07:00
David Wendt
83c832ce86
Distinguish between Native and ActionScript functions.
2019-10-06 13:02:31 -07:00
David Wendt
728c3d18db
Allow stack frames to hold SwfSlices, which are `Rc` already.
...
Functions that manipulate the stack now run inside of `with_current_reader_mut`, which calls a given function with a Reader for the current stack frame. If the stack frame still exists after that code runs, we update it's PC with the Reader's position.
2019-10-06 13:02:31 -07:00
David Wendt
617b493733
Give AVM1 the notion of a stack frame.
...
This necessitates the use of a copy of SWF data into the GC arena, along with unsafe (and possibly unsound) pointer manipulation to get the action reader to hold a GC pointer.
2019-10-06 13:02:30 -07:00
David Wendt
693e791d75
Make `do_action` execute out of a code stack.
2019-10-06 13:02:30 -07:00
Will Brindle
06c81d6cc1
chore: combine DefineText functions into 1 and paramterise
2019-10-06 13:02:30 -07:00
Will Brindle
acfe0cc478
chore: follow naming conventions for functions
2019-10-06 13:02:30 -07:00
Will Brindle
b0f25c9266
swf: implement DefineText2
2019-10-06 13:02:30 -07:00
Will Brindle
06b0d42c8b
core: Add matrix tests ( #72 )
...
* Add matrix tests. Requires the approx crate
2019-10-03 02:44:26 -07:00
Mike Welsh
52b6832db2
chore: Move swf-rs to ruffle workspace
...
Move the swf-rs crate into the Ruffle workspace proper instead of
having a separate repo. This makes it easier to make changes to
the SWF parsing code during development. swf-rs can still be
published as its own crate from the subfolder.
2019-10-02 18:58:58 -07:00
Mike Welsh
2740f3ccc1
chore: Globally allow clippy::unneeded_field_pattern
...
Often times we want to explicty destructure instead of using ..
because the compiler will emit errors if the structure changes.
(see https://github.com/rust-lang/rust-clippy/issues/1741 and #69 )
2019-10-02 12:57:58 -07:00
Mike Welsh
b157354fef
chore: Fix clippy lints
2019-10-02 12:39:04 -07:00
Nathan Adams
2b54791cbb
Changed storage of object values to allow for dynamic (vs stored) properties
2019-10-02 10:49:08 -07:00
Will Brindle
bd5bed0327
Get rid of constant from atan2 test and remove now unneeded clippy directives
2019-09-30 10:38:42 -07:00
Will Brindle
5a36e4d78e
Fix remaining tests
2019-09-30 10:38:42 -07:00
Will Brindle
abe80806ab
Use f64 methods for tests to resolve rounding errors
2019-09-30 10:38:42 -07:00
Mike Welsh
e0811be40d
avm1: Fix Random action
2019-09-27 19:32:22 -07:00
Mike Welsh
c8cec3132f
avm1: Fix GotoFrame2 one-frame-off error
...
Frame numbers pushed/popped from the stack for GotoFrame2 are
1-based. This differs for GotoFrame which is 0-based and encodes
the frame alongside the instruction.
2019-09-27 18:09:52 -07:00
Mike Welsh
1c88de5132
avm1: Fix doc typo
2019-09-27 17:58:40 -07:00
Mike Welsh
67506e54ca
avm1: Remove debug print
2019-09-27 17:57:37 -07:00
Mike Welsh
646ad967a2
avm1: Fix Subtract action
2019-09-27 17:56:34 -07:00
Mike Welsh
4ec8765f7f
avm1: Fix Subtract action
2019-09-27 17:32:51 -07:00
Mike Welsh
06d91a2b0d
avm1: Stub out CloneSprite/RemoveSprite
2019-09-27 17:28:14 -07:00
Mike Welsh
5ee7b9c8aa
avm1: Use into_number_v1 for GetProperty ( fix #55 )
...
Flash 4 published actions using Strings, so `into_number_v1`
should be used to coerce them to numbers.
2019-09-27 17:21:50 -07:00
Mike Welsh
af163d9183
core: Support start, stop, event sounds in audio backend
...
Event sounds on the timeline in Flash have a "sync" setting,
which allows them to stop other sounds or only play if the
sound is not already playing.
2019-09-27 13:50:03 -07:00
Mike Welsh
875f250b86
chore: cargo fmt for 1.38
2019-09-26 12:25:07 -07:00
Mike Welsh
8c2113bbdf
chore: cargo fmt pcm.rs
2019-09-26 11:46:44 -07:00
Mike Welsh
b38552204d
chore: cargo fmt
2019-09-26 11:45:45 -07:00
David Wendt
a0ed4d339d
Add fscommand checking to `ActionGetUrl2`.
2019-09-20 21:38:37 -04:00
David Wendt
b61f264ac7
Add a check for `fscommand:` URLs
2019-09-20 15:11:33 -04:00
Mike Welsh
c2eb96eed0
core: Fix incorrect clamping in ADPCM decoder
...
Caused artifacts in ADPCM encoded audio.
2019-09-19 11:05:27 -07:00
Mike Welsh
547da84c9c
core: Add stop_all_sounds to audio backend
...
Implemented in web and desktop.
2019-09-19 00:47:05 -07:00
Mike Welsh
e052a70a5a
desktop: Support looping and start/end points for event sounds
...
Renamed `AudioBackend::play_sound` to `start_sound`, and this
also takes a `SoundInfo` parameter with the event sound settings
from the SWF file.
Desktop now obeys the loop and start/end point settings. Envelopes
are still TODO.
2019-09-19 00:47:05 -07:00
Mike Welsh
9c8721c127
core: Drop rodio and use only cpal for audio backend
...
Drop the rodio dependency and directly use cpal for the audio
backend. Use the sample crate for audio mixing and resampling.
2019-09-19 00:47:05 -07:00
Mike Welsh
be0bb0b803
core: Fix looping movieclips
2019-09-17 19:24:55 -05:00
Mike Welsh
a331c565b3
core: More goto fixes
2019-09-17 19:24:55 -05:00
Mike Welsh
ae80900f17
core: Add tellTarget regression test
2019-09-17 12:51:44 -05:00
Mike Welsh
7b63dc05c4
core: Initial implementation of SetTarget2
...
Implement the SetTarget2 action, which pops the target off of the
stack, and GetProperty 11, which pushes _target.
However, our implementation of _target is not accurate yet,
because it requires dynamically building the target path. Currently
we fake it by caching the last path to tellTarget.
2019-09-17 12:51:44 -05:00
Mike Welsh
856a4c6130
core: Improve TellTarget support
...
The AVM1 contains an explicit "target clip" that is used for older
Flash 4-era actions. This target clip can be set to an invalid
value, at which point Play, Stop, etc. will fail silently.
For GetVariable and SetVariable, if the target is invalid,
the variables will be modified on root ("/").
2019-09-17 12:51:44 -05:00
Mike Welsh
82c1116c42
chore: cargo fmt
2019-09-16 20:37:11 -07:00
David Wendt
f00e938299
Clean up unused functionality in preparation of a PR.
2019-09-16 20:04:30 -07:00
David Wendt
b40b10daf6
Support form submission from `getURL` function
2019-09-16 20:04:30 -07:00
David Wendt
eb1b474528
Propagate AVM locals to `NavigationBackend`.
2019-09-16 20:04:30 -07:00
David Wendt
130d9736bc
Allow builtins access to the AVM1 state directly.
2019-09-16 20:04:30 -07:00
David Wendt
7deb33c231
Fail remote SWF loads rather than jamming a download in the user's face
2019-09-16 20:04:30 -07:00
David Wendt
63e1484d38
Support legacy `GetURL`/`GetURL2` actions
2019-09-16 20:04:30 -07:00
David Wendt
359d3e4780
Propagate the RNG to the action context. This lets random work.
2019-09-16 20:04:30 -07:00