Commit Graph

1441 Commits

Author SHA1 Message Date
Sean-Thomas 4d91a202e1 web/demo: Add dropdown to select sample SWF
- replaced static polyfill embed on web demo with JS API code.
- added swf_lib JSON file for sample SWFs.
- added console logs for when a Ruffle instance is created or destroyed in ruffle-player.js.
- more minor styling changes to the web demo index page.
2020-04-13 04:55:57 -07:00
dependabot-preview[bot] 6d837d69d4 build(deps): bump svg from 0.7.1 to 0.7.2
Bumps [svg](https://github.com/bodoni/svg) from 0.7.1 to 0.7.2.
- [Release notes](https://github.com/bodoni/svg/releases)
- [Commits](https://github.com/bodoni/svg/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-13 11:15:12 +00:00
Mike Welsh b7d464f367 chore: Bump enumset to 1.0.0 2020-04-13 04:14:29 -07:00
dependabot-preview[bot] ecb15eac04 build(deps): bump structopt from 0.3.12 to 0.3.13
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.12 to 0.3.13.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-09 23:49:59 +00:00
dependabot-preview[bot] 2146c42863 build(deps): bump smallvec from 1.2.0 to 1.3.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.2.0...v1.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-09 21:19:11 +00:00
dependabot-preview[bot] bb71aa677f build(deps): bump image from 0.23.2 to 0.23.3
Bumps [image](https://github.com/image-rs/image) from 0.23.2 to 0.23.3.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.23.2...v0.23.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-09 21:12:00 +00:00
dependabot-preview[bot] c20f3736ca build(deps): bump png from 0.16.1 to 0.16.2
Bumps [png](https://github.com/image-rs/image-png) from 0.16.1 to 0.16.2.
- [Release notes](https://github.com/image-rs/image-png/releases)
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image-png/compare/v0.16.1...v0.16.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-04 07:03:37 +00:00
dependabot-preview[bot] f87704742f build(deps): bump serde from 1.0.105 to 1.0.106
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.105 to 1.0.106.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.105...v1.0.106)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-04 07:01:10 +00:00
Mike Welsh 47e936fcc2 tests: Add tests for Array.sort 2020-04-01 18:46:12 -07:00
Mike Welsh bd0d2031bc avm1: Implement Array.sort and constants 2020-04-01 18:46:12 -07:00
Justin-CB ba19e6c2e1
web: Add additional flash MIME types to polyfill
Co-authored-by: Justin Bester <justin@frankenmando.local>
2020-04-01 18:45:32 -07:00
Mike Welsh 2bdbac9247 tests: Test that Color has no effect when target is undefined 2020-03-30 01:09:05 -07:00
Mike Welsh e47c2aa356 avm1: Color object has no effect if target is undefined/empty 2020-03-30 01:01:37 -07:00
Mike Welsh d5bd7c2dd8 avm1: Math.round rounds towards infinity 2020-03-29 18:44:28 -07:00
Mike Welsh 0c0d3dfd41 core: Add Navigator::time_since_launch to use for getTimer
Change `ActionGetTime` (`getTimer`) to use a new backend method.
This allows it to return updated times if it is called multiple
times in a single frame. This fixes hangs caused by games that use
busy-loop "frame limiter" code.
2020-03-28 22:28:07 -07:00
Sean-Thomas ec869fa656 Tweaked styling for demo page 2020-03-28 19:42:15 -07:00
Mike Welsh f7375c3700 avm1: Use `PropertyMap::get_index` for stage object properties 2020-03-28 16:22:02 -07:00
Mike Welsh 4ea609cca1 tests: Don't special case enumeration tests 2020-03-28 16:22:02 -07:00
Mike Welsh 8da9487c0a avm1: Match Flash's property enumeration order (fix #153) 2020-03-28 16:22:02 -07:00
Mike Welsh 2cdf780e6f avm1: Handle case sensitivity in DisplayObject children
Alter `get_child_by_name` and alter `get_level_by_path` to respect
case sensitivity.
2020-03-28 16:22:02 -07:00
Mike Welsh 81a0bb370b tests: Add test for SWF<=6 case insensitivty 2020-03-28 16:22:02 -07:00
Mike Welsh ea245895b0 avm1: Use PropertyMap for stage object magic properties 2020-03-28 16:22:02 -07:00
Mike Welsh 7d848f4f34 avm1: Add avm parameter to TObject methods
This is necessary to get the current SWF version for properly
handing case sensitivity.
2020-03-28 16:22:02 -07:00
Mike Welsh 1ef698f2ea core: Add PropertyMap for handling AVM1 object properties
`PropertyMap` wraps over `IndexMap` to handle object properties in
AVM1. All insert/remove/get methods require and `swf_version`
parameter, and the `PropertyMap` will take care of handling case
senstivity and maintaing iteration order based on the SWF version.
2020-03-28 16:22:02 -07:00
Mike Welsh d42a402522 avm1: Add display object methods to TextField 2020-03-26 14:19:18 -07:00
Mike Welsh c1abbdacdd chore: Fix naming convention 2020-03-26 02:55:25 -07:00
Mike Welsh e237536293 web: Blacklist "Adobe Flash Player" title attribute (fix #468)
The "Click to activate Flash" box from Chrome stomps on the title
attribute of a Flash embed when you mouse over it. This causes
an annoying "Adobe Flash Player" tooltip to appear even after
Ruffle replaces the embeds.

Now we check for this specific title and remove it.
2020-03-26 02:37:25 -07:00
Mike Welsh 6aaf950b7a chore: Bump winit, glutin, glium 2020-03-26 01:05:12 -07:00
Mike Welsh 7865ec1021 avm1: Implement Button object
First implementation of Button object. Hook up to the button
display object and run onRelease etc. methods as appropriate.

Pull out common display object methods into globals::display_object.
2020-03-26 00:21:21 -07:00
Mike Welsh c2e9d5d757 web: Install plugin spoof immediately on script load
Scripts like SWFObject check for the Flash plugin immediately when
they load, so we can't defer installing the spoof. Fixes #448.
2020-03-25 20:14:31 -07:00
Mike Welsh 353eeec6c3 web: Return matching Flash Player version for MIME type description
The plugin detection spoofer would add " "Shockwave Flash 32.0 r0
(compatible; Ruffle 0.1)" to the Flash MIME type description in
the plugins array. However, this breaks SWFObject's version
detection, which does a simple String split.

Now we return the same value as the official player:
"Shockwave Flash 32.0 r0"
2020-03-25 20:14:31 -07:00
Mike Welsh 4df1128c19
core: Implement Object.registerClass (merge #344)
Implement Object.registerClass
2020-03-25 18:55:49 -07:00
Mike Welsh 774aa59210 web: Default public_path to currentScript URL
Also automatically add trailing slash on public_path if necessary.
2020-03-25 00:54:21 -07:00
Mike Welsh 5591cec0f7 web: Fix #412, incorrect bitmap rendering when cached 2020-03-24 23:08:15 -07:00
Mike Welsh fa063a6f53 web: Enable dynamic-content polyfill by default
Co-authored-by: Justin-CB <55590227+Justin-CB@users.noreply.github.com>
2020-03-24 22:13:10 -07:00
Mike Welsh e332e5c24c web: Simplify polyfill code
Addresses #464. Use `document.getElementsByTagName` to find all
object and embed tags in the document. For dynamic content,
we keep these live collections around, and re-check them whenever
a MutationObserver fires.

Co-authored-by: Justin-CB <55590227+Justin-CB@users.noreply.github.com>
2020-03-24 22:13:10 -07:00
dependabot-preview[bot] 80bfaa5f11 build(deps-dev): bump webpack from 4.42.0 to 4.42.1 in /web/selfhosted
Bumps [webpack](https://github.com/webpack/webpack) from 4.42.0 to 4.42.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.42.0...v4.42.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-24 19:29:20 +00:00
Mike Welsh 4561b591bf web: Handle percentage dimensions in polyfill (fix #433)
When Ruffle replaces a Flash embed, the width/height of the embed
are copied over to CSS of the Ruffle element. "px" was being
appended even if the dimensions were a % value, which CSS rejected.

Try to be a little smarter about parsing out the HTML dimension
attributes (HTML is more lenient). Append "px" only if the value
isn't a percentage.

Fixes #433.
2020-03-21 01:23:23 -07:00
Mike Welsh 9e6fe41a91 web: Ignore errors on `Element.setAttribute` in polyfill
Ruffle would not polyfill a Flash embed if it had bogus attributes
in the embed tag. Now these errors are silently ignored.

Fixes the other part of #457.
2020-03-20 20:47:58 -07:00
Mike Welsh 099c497a91 web: Activate polyfill if embed src ends in .swf
Fixes part of #457. Even if the MIME type/class IDs are missing
on the embed/object tags, browsers will still attempt to play
the file as Flash if it ends in a .swf extension.
2020-03-20 20:47:58 -07:00
dependabot-preview[bot] ef5ee3a889 build(deps): bump syn from 1.0.16 to 1.0.17
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.16 to 1.0.17.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.16...1.0.17)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-21 01:37:48 +00:00
Mike Welsh e9cb05aeb4 avm1: Correct order of modulo operands
Addresses part of #458.
2020-03-20 16:00:28 -07:00
hthh a16885d84b avm1: Fix string-to-number octal and whitespace handling
This conversion allows negative octal values, but not negative
hex values, and ignores only leading ASCII whitespace. A test
for this behavior is included.
2020-03-20 04:27:41 -07:00
Nathan Adams b4624fddce avm1: GetVariable and SetVariable look through the scope chain. Fixes #414
GetVariable and SetVariable attempt to resolve paths on each scope
in the scope chain.
2020-03-19 19:58:16 -07:00
dependabot-preview[bot] 265197b475 build(deps): bump structopt from 0.3.11 to 0.3.12
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.11 to 0.3.12.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.11...v0.3.12)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-18 20:35:34 +00:00
dependabot-preview[bot] f104ed2939 build(deps): bump serde from 1.0.104 to 1.0.105
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.104 to 1.0.105.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.104...v1.0.105)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-18 19:40:22 +00:00
Mike Welsh 454cd29ed6 chore: EditText::font takes self by value 2020-03-17 19:42:57 -07:00
Mike Welsh 068f4c3bee core: Edit text uses device fonts when outline flag isn't set
Specifically fall back to the device font when the UseOutlines
flag is not set in DefineEditText (SWF19 p.172). Fixes #451.

Note that since we only use a single font for "device" rendering,
this may sometimes be a different font than is specified in the
Flash IDE.
2020-03-17 19:13:20 -07:00
dependabot-preview[bot] 1ba60ebd67 build(deps): bump image from 0.23.1 to 0.23.2
Bumps [image](https://github.com/image-rs/image) from 0.23.1 to 0.23.2.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.23.1...v0.23.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-17 17:32:09 +00:00
dependabot-preview[bot] da3398c832 build(deps): bump bitstream-io from 0.8.4 to 0.8.5
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/tuffy/bitstream-io/releases)
- [Commits](https://github.com/tuffy/bitstream-io/commits/v0.8.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-17 17:08:59 +00:00