Commit Graph

2112 Commits

Author SHA1 Message Date
David Wendt e952d20976 Open the window asked for, if specified 2019-09-16 20:04:30 -07:00
David Wendt 0f9db1744b Add a backend for controlling the enclosing web browser. 2019-09-16 20:04:30 -07:00
David Wendt 4502ad54c2 Allow dynamic interdiction to apply to object/embed tags directly 2019-09-14 15:15:26 -05:00
David Wendt a942eb3ab2 Support data parameter for SWF url. 2019-09-14 15:15:26 -05:00
Mike Welsh dbbeccaacd web: More accurate radial gradients on canvas 2019-09-12 01:02:46 -07:00
David Wendt 84759f8cea Fix our previous changes to the Ruffle core loader so that both the extension and demo work 2019-09-11 20:28:58 -04:00
Mike Welsh 8fcee704c0 chore: cargo fmt 2019-09-09 20:42:08 -05:00
Mike Welsh ce9a0a8ef6 web: Initial masking support
Also add web/src/utils.rs for some methods to ease management
of errors for wasm_bindgen.
2019-09-09 20:42:08 -05:00
Mike Welsh 28f0ce3c83 Mask work 2019-09-09 20:42:08 -05:00
David Wendt 287870ec03 Get rid of the superfluous bootstrap file as it appears to be causing Webpack problems 2019-09-04 23:16:44 -04:00
Mike Welsh 1ff86012ae chore: Fix jpeg-decoder warnings in Cargo.toml 2019-09-04 15:56:10 -07:00
David Wendt f59d62516e Fix demo site regressions. 2019-09-03 18:38:05 -04:00
David Wendt 9dd01494f3 build.sh should be executable 2019-09-01 11:49:27 -06:00
David Wendt 406cc746ce The MimeType for `application/x-shockwave-flash` should list it's extension as `swf`, not `spl`. 2019-08-31 18:57:26 -04:00
David Wendt fc67f0872f Don't break Ruffle if we encounter an embed or object without a size. 2019-08-30 22:27:51 -04:00
David Wendt adc1a79155 Place the extension related build system back .
Built extension files now live in `web/extension/build`.
2019-08-30 22:27:51 -04:00
David Wendt b4b38057e4 Add checks for the Ruffle element being connected.
When a Ruffle player element is disconnected, attempts to play SWF files
fail semi-silently.

We also check for nested objects, since only the top should be
successful in loading.
2019-08-30 22:27:50 -04:00
David Wendt f01f479f54 Don't forget random bits of object tag contents! 2019-08-30 22:27:50 -04:00
David Wendt 2b2f27afad Falsify a better-sounding version of Flash.
This is at least the version Chrome claims to have.
2019-08-30 22:27:50 -04:00
David Wendt 0d8b72acce Don't try to wrap text nodes, it won't end well. 2019-08-30 22:27:50 -04:00
David Wendt 190666fe91 Interdict Flash tags that use ActiveX. 2019-08-30 22:27:50 -04:00
David Wendt 21454b327b Fix incorrect centering on homestarrunner.net its dot com 2019-08-30 22:27:49 -04:00
David Wendt 61171037cd Recognize really old FutureSplash era tags as Flash 2019-08-30 22:27:49 -04:00
David Wendt 9ec4892ae7 Fix regression caused by the extension file move 2019-08-30 22:27:49 -04:00
David Wendt de00145755 Add icons for the extension 2019-08-30 22:27:49 -04:00
David Wendt cdf50e29bd Move the build system and package files out of the extension directory.
This keeps the node_modules out of the extension package.
2019-08-30 22:27:49 -04:00
David Wendt ce5ab95a9a Compatibility with Chrome's extension environment 2019-08-30 22:27:48 -04:00
David Wendt fa5a3164ea should be executable on unixlikes 2019-08-30 22:27:48 -04:00
David Wendt c02b4c111b Overwrite navigator.plugins to defeat flash detects 2019-08-30 22:27:48 -04:00
David Wendt 101b1e5715 Fix not being able to handle multiple embeds.
This is caused by `HTMLCollection` being too smart for it's own good and
removing elements behind the loop's back.
2019-08-30 22:27:48 -04:00
David Wendt 6fbdc6f1f4 Respect the page's width and height settings in our custom elements 2019-08-30 22:27:47 -04:00
David Wendt 8060802465 Kill `bootstrap.js`, load the WASM ourselves.
Instead of forcing a chunk load on Webpack just so we can have Webpack prepare the WASM for us, we're now using the `no-modules` mode of `wasm-pack` manually and loading the resulting files ourselves.

I still have to force Ruffle to load outside of the extension sandbox though...
2019-08-30 22:27:47 -04:00
David Wendt 7c6ad57443 Let's completely force webpack to run outside of the extension sandbox.
This idea was stolen from @devsnek, whom I'm currently writing an explanation for.
2019-08-30 22:27:47 -04:00
David Wendt 7a6169275d Tell webpack about the extension resource URLs 2019-08-30 22:27:47 -04:00
David Wendt 385b9f807e Fix most (though not all) of our extension bugs.
I still can't figure out how to keep Webpack from making requests to the
injected site...
2019-08-30 22:27:47 -04:00
David Wendt de5a2c31c0 Add embed support. 2019-08-30 22:27:47 -04:00
David Wendt 9529893437 Add console error logging for failed SWF loads 2019-08-30 22:27:46 -04:00
David Wendt ee8b6d57ba Don't pull params until after we've been connected.
Otherwise, we don't have any params yet...
2019-08-30 22:27:46 -04:00
David Wendt 5655ad44a3 It turns out, we don't need to wait for DOMContentLoaded. 2019-08-30 22:27:46 -04:00
David Wendt c0e6866745 Fix the demo file upload option 2019-08-30 22:27:46 -04:00
David Wendt be21a0dbbb Configure the `<ruffle-object>` tag to style as a
block element, like `<object>`
2019-08-30 22:27:45 -04:00
David Wendt 2a2dbba21f Use a custom element to actually house the Ruffle
instance, even though we can't really upgrade `<object>` directly...
2019-08-30 22:27:45 -04:00
David Wendt 6f32fc022c Copy attributes from hijacked Flash objects 2019-08-30 22:27:45 -04:00
David Wendt 0414e24ce2 First start on extension packaging 2019-08-30 22:27:45 -04:00
David Wendt bac5ecfe8d Alter the demo a bit so that it latches onto an
already-existing object tag and replaces it with ruffle.
2019-08-30 22:27:45 -04:00
Mike Welsh 35652ae87e chore: Update dependencies
Run cargo update. Remove git dependency on jpeg-decoder (the latest
version was published to crates.io). Update swf-rs to latest to
disable smoothing in SWFv7 and lower (addresses #28).
2019-08-29 14:57:12 -07:00
Mike Welsh 6a5c5ab1df chore: Add rustfmt.toml and rustfmt pass 2019-08-26 16:38:48 -07:00
Mike Welsh 3a795fff47 web: image-rendering: pixelated for nonsmoothed bitmaps
TODO: Firefox uses crisp-edges, Chrome uses pixelated. Clean this up
at some point.

Addresses #28.
2019-08-24 10:59:56 -05:00
Mike Welsh 324a410cb1 render: Properly render premultiplied alpha bitmaps 2019-08-22 15:24:50 -07:00
Mike Welsh 022a0746ca web: Add hack for Firefox additive alpha cxforms
This hack removes additive alpha components from color transforms
on Firefox. See #38.
2019-08-22 14:13:37 -07:00
Mike Welsh 3933b00000 web: Use initial timestamp from requestAnimationFrame
Previously Performance.now() was used to grab the initial timestamp
for calculating dt in requestAnimationFrame. However, this doesn't
seem to be reliable and resulted in negative dt values in Chrome.

Now we just use an Option for the timestamp and initialize it to None.
The first animation callback will set the timestamp.
2019-08-22 13:28:06 -07:00
Mike Welsh 5fdc7168a7 web: Fix DefineBitsJPEG3 + alpha
DefineBitsJPEG3 tags also include a zlib-encoded alpha channel.
This wasn't working on web (it was trying to use the raw RBGA also
an image!) Now these are re-encoded to PNG.

Addresses #27.
2019-08-20 16:23:46 -07:00
Mike Welsh d021b02e90 web: Disable alpha on canvas 2019-08-19 23:33:12 -07:00
Mike Welsh 9cbeacd7b2 core: Transform mouse coordinates from viewport to stage 2019-08-19 22:27:38 -07:00
Mike Welsh 637588fae5 core: Store view matrix in player
Player is now in charge of scaling/cropping/translating the content
to fit the viewport size supplied by the frontend.

Added backend::render::Letterbox, which stores the margin sizes
for letter/pillarboxing.
2019-08-19 22:27:38 -07:00
Mike Welsh f3f4fa6179 web: Add mouse up/down/move handlers 2019-08-19 22:27:38 -07:00
Mike Welsh 7005dd7621 web: Remove debug spew in web renderer 2019-08-19 17:29:08 -07:00
Mike Welsh d0413da381 web: Set preserveAspectRatio to none on SVGs
Firefox would fudge with the dimensions of the SVG when we tried
to draw a scaled SVG to the canvas. Disabling preserveAspectRatio
prevents that. Fixes part of #24.
2019-08-18 13:44:44 -07:00
Mike Welsh fecb981b13 web: Fix color transforms in Firefox
Firefox required the color matrix filter to be inside and <svg>
tag. Also, set color-interpolation-filters to sRGB to ensure
color transforms match Flash's output.
2019-08-18 13:18:22 -07:00
Mike Welsh 4666d211a7 core: Add dyn to fix Rust 1.37 warnings
Omitting dyn on trait objects now emits a warning, so add missing
dyn where necessary.
2019-08-15 13:54:20 -07:00
Mike Welsh 72307e981f web: Update demo style 2019-08-15 07:15:37 -07:00
Mike Welsh 4c6395bd83 core: Use latest git branch for jpeg-decoder
The current version of jpeg-decoder on crates.io (0.1.15) panics
when encountering a valid JPEG marker of length 2. Some SWF files
contained JPEGs with a COM segment of length 2. This is fixed
on the master branch of jpeg-decoder.
2019-08-14 23:19:10 -07:00
Mike Welsh 746b9d8518 core: Support for DefineBitsJPEG3/4
TODO: Pull out all JPEG decoding into core, remove jpeg-decoder
dependency from backend crates.
2019-08-12 16:44:49 -07:00
Mike Welsh a3998b657b core: Remove invalid JPEG data from DefineBitsJPEG
DefineBitsJPEG tags can have some extraneous bytes inside the
stream. Splice these out when decoding the JPEG.

TODO: Docs say this should only happen for SWF versions before 8?
2019-08-12 15:45:40 -07:00
Mike Welsh 23db688e6f core: Add DefineBitsLossless decoding function
Pulled out the code for decoding DefinieBitsLossless tags into
backend::render::define_bits_lossless_to_rgba. Switch to libflate
for zlib decoding.
2019-08-12 15:45:40 -07:00
Mike Welsh f1cc436544 web: Update demo page w/ black background 2019-08-11 21:02:38 -07:00
Mike Welsh 1177388413 web: Dynamically resize and letterbox movie 2019-08-11 20:50:31 -07:00
Mike Welsh 2bfc8767d0 desktop: Add letterbox to viewport
Add getters to Player to allow access to the type Renderer.
Letter/pillarboxes added as window resized.
2019-08-11 18:07:02 -07:00
Mike Welsh 24fc403e06 core: Make player generic over backend 2019-08-09 22:34:15 -07:00
Mike Welsh 2accd5bdd4 core: Remove audio struct 2019-08-09 16:03:13 -07:00
Mike Welsh 3edc3c3d3e web: Disable auto-play, add click-to-play 2019-08-09 14:50:20 -07:00
Mike Welsh a2b95eb12a Fix color transforms on web
The color matrix filter was not being applied to the vector art.
2019-08-08 15:59:32 -07:00
Mike Welsh e64e306137 Rework audio to allow for streaming decoding 2019-08-08 15:59:32 -07:00
Mike Welsh 725cdae6c5 Begin AVM1 cleanup 2019-08-08 15:58:45 -07:00
Mike Welsh 24b25e66da Update lodash 2019-08-08 15:57:10 -07:00
Mike Welsh ce5faefe1f Work 2019-08-08 15:57:10 -07:00
Mike Welsh fd8f58c6c2 Work 2019-07-10 21:04:59 -07:00
Mike Welsh 5610001eae Remove listbox from demo page (for now) 2019-06-25 16:30:35 -07:00
Mike Welsh 3263255e60 Add color filter SVG as child of canvas element
Avoid adding to body, which can affect document layout.
2019-06-25 15:50:22 -07:00
Mike Welsh 64d6ea6f3f Move web demo into web/demo
Keep the root web folder as a pure NPM package. Move demo webpack
config separetly into web/demo.
2019-06-25 11:27:04 -07:00
Mike Welsh 7512275847 web: Bump wasm-bindgen to 0.2.44 2019-05-17 17:35:29 -07:00
Mike Welsh 3cefeeba6a Use twips for internal calculations
Switch from pixels to twips for internal calculations. swf crate
was updated to add a Twips wrapper-type. Ruffle will use this type
internally for transforms and shapes. This fixes some precision
errors in rendering (see heroes_of_cybertron.swf) and will match
what the Flash Player does internally more closely. (e.g.
DisplayObject x and y will be quantized to 1/20 pixel units). It
is up to the renderer to convert units from twip space to pixels
when rendering.
2019-05-17 13:40:56 -07:00
Mike Welsh 023406aa2b web: Move requestAnimationFrame loop into Rust 2019-05-16 19:14:37 -07:00
Mike Welsh 4e3eecb016 core: Improve SVG strokes
Use stroke properties to apply stroke styles from the SWF.
2019-05-12 13:35:03 -04:00
Mike Welsh 79b3a7007d core: Initial morph shape implementation 2019-05-12 12:55:48 -04:00
Mike Welsh cc7ef196e9 web: Clean up Player interface
Use generational_arena indices for the JS-side Player handle.
2019-05-10 09:06:47 -07:00
Mike Welsh af33b8538e desktop: Better event sounds 2019-05-09 17:43:53 -07:00
Mike Welsh efe3270ce0 web: Decode streams completely on preload (for now) 2019-05-09 12:43:26 -07:00
Mike Welsh 58311e20a9 web: Re-organize npm/webpack files
Use wasm-pack-plugin npm package.
2019-05-08 11:32:44 -07:00
Mike Welsh 62ae3b0c46 Rename project 2019-05-08 09:46:19 -07:00
Mike Welsh 14b6c59a3c web: Update demo page 2019-05-07 16:07:23 -07:00
Mike Welsh bfc735e3b7 web: Allow specifying SWF in query params 2019-05-07 10:03:45 -07:00
Mike Welsh 67b96119e3 Fix padding on 8-bit PNGs 2019-05-07 09:51:06 -07:00
Mike Welsh 2f2f4b0c0b Quick palettized RGBA PNG support 2019-05-07 00:22:52 -07:00
Mike Welsh ebbcc828ff web: Skip SeekSamples in MP3 event sounds 2019-05-06 10:42:48 -07:00
Mike Welsh e0acb7cb30 Fix crash when drawing an empty shape in Firefox 2019-05-06 10:37:25 -07:00
Mike Welsh 61ec4b2436 web: Add player.destroy() method 2019-05-06 03:52:27 -07:00
Mike Welsh 401da0e68a Spruce up the sample HTML page 2019-05-06 03:52:27 -07:00
Mike Welsh 8262db3991 ADPCM decoder 2019-05-06 02:34:45 -07:00
Mike Welsh e99b4a6fcf web: Add support for uncompressed event sounds 2019-05-05 22:13:22 -07:00
Mike Welsh cf2091477d Support uncompressed event sounds 2019-05-05 22:04:35 -07:00
Mike Welsh 4a824069af web: First pass of event sounds 2019-05-05 16:43:19 -07:00
Mike Welsh 1a4734896d Event sounds and text on web 2019-05-05 15:55:27 -07:00
Mike Welsh 2480469c2c First pass of static text 2019-05-04 11:45:11 -07:00
Mike Welsh 6e8082f01b Reorganized backend structure 2019-05-02 19:56:17 -07:00
Mike Welsh ae8df0486b Use a handle for the JS<->Rust Player object 2019-05-02 17:17:02 -07:00
Mike Welsh 5e88f43280 Color transforms 2019-05-01 09:55:54 -07:00
Mike Welsh 9957206aee Work 2019-04-30 04:38:04 -07:00
Mike Welsh eb6c23d967 Work 2019-04-30 01:53:21 -07:00
Mike Welsh 663ad9f663 Work 2019-04-29 13:24:29 -07:00
Mike Welsh ee64cc77bc Reforactor 2019-04-27 23:08:59 -07:00
Mike Welsh b7ac6dc2ce Refactor 2019-04-27 18:15:43 -07:00