Commit Graph

265 Commits

Author SHA1 Message Date
Toad06 f48d5b424b web: Fixes and improvements in `navigate_to_url` 2021-01-11 13:16:00 -08:00
TÖRÖK Attila cce3a8199d web: Add a config option to disable the message about unsupported content 2021-01-10 16:02:23 -08:00
Mike Welsh 01aca9f861 web: Remove upgrade_to_https param from Ruffle::new
Grab it from the `config` directly instead of using an extra param.
2021-01-07 11:46:07 -08:00
Mike Welsh 8728804f28 web: Add letterbox config option 2021-01-07 11:46:07 -08:00
Mike Welsh e9da6a13f0 core: Add letterbox setting
Player::set_letterbox can be used to control the letterbox behavior.
 * Letterbox::Off => no letterbox (flash behavior)
 * Letterbox::Fullscreen => letterbox only in fullscreen (web default)
 * Letterbox::On => always letterbox (desktop default)
2021-01-07 11:46:07 -08:00
Mike Welsh e6614a8527 web: Avoid panic on fetching invalid URLs 2020-12-31 16:36:02 -08:00
Mike Welsh 972e743e34 web: Flush shared objects in unload intead of beforeunload
Fix part of #2092. A panic could occur if content navigated away
using getURL, which could trigger the shared object flush while
the frame was still executing. Move the flush to "unload" so that
it occurs after execution is complete.
2020-12-27 14:01:42 -08:00
Sam Morrow 38bdb8b39a web/desktop: Add basic dialog handling (closes #1978) 2020-12-23 19:08:18 -08:00
Mike Welsh 367404ddd8 core: SharedObjects are bucketed by domain
Key SharedObjects on the domain and path where the SWF is hosted,
and implement the localPath and secure parameters.

Fix #855.
2020-12-22 14:18:06 -08:00
Mike Welsh 739af3f8d7 web: Flush shared objects on page unload 2020-12-21 21:46:45 -08:00
Sam Morrow c4d7b24629 web: Fix cors issues with http (close ruffle-rs#1486) 2020-12-14 05:51:28 -08:00
Mike Welsh 7e35d4a4fc web: Ensure parent window/frame gets focus on click (fix #1704)
Call window.focus() on mouse down to ensure the player receives
subsequent key/mouse events when it is inside a frame.
2020-12-10 19:20:00 -08:00
Mike Welsh 3bafee63a6 web: Fix spurious keyUp events (fix #1886) 2020-12-08 21:12:59 -08:00
Mike Welsh b76d76d244 web: Properly handle multibyte characters in text input
We were checking for byte length == 1 instead of # of characters
to determine if a keyboard key was a single printable character.
Thanks to @JMcKiern for pointing this out.
2020-12-05 23:19:57 -08:00
Mike Welsh dafe7e5027 avm1: Implement Key.getAscii 2020-11-29 02:31:10 -08:00
Mike Welsh e655cf0c08 web: Add Ruffle::audio_context getter 2020-11-24 16:36:33 -08:00
Nathan Adams 5b5091b4b9 web: Rename copy_to_audio_buffer to copyToAudioBuffer 2020-11-24 16:36:33 -08:00
Nathan Adams 3ad4c0f392 web: Rename RufflePlayer.on_callback_available to
RufflePlayer.onCallbackAvailable
2020-11-24 16:36:33 -08:00
Nathan Adams 8abb8df299 web: core no longer uses webpack, but selfhosted still does 2020-11-24 16:36:33 -08:00
Nathan Adams 5ff7168fe9 web: Switched core package from javascript to typescript 2020-11-24 16:36:33 -08:00
Mike Welsh d13a95eafa web: Fail gracefully if LocalStorage is unavailable (fix #1590) 2020-11-19 22:51:02 -08:00
relrelb 9068322d24 web: Retain focus on fullscreen enter/exit
Previously, has_focus has been set to false upon window click, and
to true upon canvas click.
However, the canvas didn't receive click events when the context
menu was clicked, so fullscreen toggle led to focus loss.
Listening to player click events receives both canvas and context
menu clicks.
2020-11-18 17:50:12 -08:00
relrelb 2e0509694c docs: Miscellaneous spelling corrections 2020-11-12 13:34:05 -08:00
Mike Welsh 316bc4e920 chore: Appease clippy 2020-11-09 01:52:57 -08:00
Nathan Adams d7b94316c6 web: Always set the end point of audio clips - fixes #1304 2020-11-03 15:15:34 -08:00
Nathan Adams 32b57f15bc web: Fixed backspace and delete keys not registering in input fields 2020-11-02 11:43:10 -08:00
Mike Welsh ef4d75e7d9 web: Fix incorrect handle used in audio ended handler (fix #1405) 2020-10-27 19:54:46 -07:00
Mike Welsh 956f40a26f web: Use a Drop impl to ensure sounds are stopped 2020-10-25 20:41:20 -07:00
Mike Welsh 796805c31b web: Avoid bug in generational-arena (fix #1315)
An issue with Arena::clear allowed stale sound instance indices
to be remain valid, causing certain sounds to be removed when they
shouldn't (#1315). Workaround this issue by forcing Arena to bump
the generational index.
2020-10-25 20:41:20 -07:00
Mike Welsh 2172fef9bd web: Only fire mouse events for left clicks 2020-10-23 12:50:59 -07:00
Mike Welsh 827a80c837 web: Remove sound instances upon completion
Sounds were not being removed from the instance list when they
completed playing. This could also cause StartSound tags with
NoMultiple set to not play, because the previous sound was presumed
to be playing.

Fixes part of #1245.
2020-10-12 15:28:31 -07:00
Nathan Adams 627a1f90e1 web: Ignore any errors converting flashvars 2020-10-12 15:28:16 -07:00
Nathan Adams 6d9155477c core: Add flashvars support - #312 2020-10-12 15:28:16 -07:00
Mike Welsh 4034ef8d79 web: Use PanicInfo::to_string for displaying panic info
PanicInfo::payload wasn't giving anything useful (just resulted
in 'Unknown error') -- to_string displays all of the message,
payload, and location of the panic. Particularly the location
is helpful.
2020-10-11 00:51:00 -07:00
Sean-Thomas a9538f81d0 web: Renamed "prime_audio" and "suspend_audio"
Renamed "prime_audio" and "suspend_audio" to "play" and "pause" respectfully.
2020-09-29 11:05:23 -07:00
Sean-Thomas 6b54cc4311 web: Add pause method for web player
Adds a suspend_audio method to compliment prime_audio on WebAudioBackend, as well as logic in player.rs on the set_is_playing method to suspend audio when is_playing is set to false. Exposes pause method for the ruffle player in JavaScript with logic to display the play button when paused.
2020-09-29 11:05:23 -07:00
Mike Welsh 313b02d24f webgl: Fall back to canvas if not using hardware acceleration
Display WebGL driver info, detect whether hardware acceleration
is enabled, and fall back to the canvas backend in this case.
2020-09-25 01:22:21 -07:00
Luca Weiss d5cb396331 *: fix spelling mistakes 2020-09-19 16:17:58 -07:00
Nathan Adams e114282a4e web: Implement Show Error Details for panics 2020-09-13 15:20:44 -07:00
Nathan Adams 69d1e903fb web: Destroy shouldn't be able to throw exceptions 2020-09-13 15:20:44 -07:00
Nathan Adams 58cd1abcf2 web: Store RuffleInstances as a RefCell, so we don't lock it out from readers unless we actually need to 2020-09-13 15:20:44 -07:00
Nathan Adams 1d48073a05 web: Don't mutably lock INSTANCES if we don't need to, to allow greater odds of a successful reentry 2020-09-13 15:20:44 -07:00
Nathan Adams 95275898c7 web: If ruffle panics, inform all instances (if possible) and poison future instances 2020-09-13 15:20:44 -07:00
Nathan Adams 3ff399ca6b core: Trace only to the log backend, but have the default log backend trace to the log crate 2020-09-13 13:51:39 -07:00
Nathan Adams 4c6c8ee1f2 web: Add trace_observer to web api, which lets you capture trace output from a specific movie 2020-09-13 13:51:39 -07:00
Nathan Adams de009c7673 core: Add Log backend, for capturing trace output specific to a movie 2020-09-13 13:51:39 -07:00
Mike Welsh a18e80baf2 chore: Fix clippy lints 2020-09-07 12:18:41 -07:00
Nathan Adams 91cb597a79 web: Expose ExternalInterface callbacks on the player object, not the canvas 2020-09-03 18:17:44 -07:00
Nathan Adams 5880db43cd web: Respect allowScriptAccess, which defaults to false for streaming or 'sameDomain' for objects 2020-09-03 18:17:44 -07:00
Nathan Adams b5531a48d0 web: Allow reentrant ExternalInterface callbacks 2020-09-03 18:17:44 -07:00
Nathan Adams a49e8d8587 web: Implement two-way communication with ExternalInterface 2020-09-03 18:17:44 -07:00
Nathan Adams 43f5506418 web: Implement LocaleBackend for web 2020-09-02 17:12:31 -07:00
Nathan Adams 86eb6f2e50 avm1: Implement Date - #249 2020-09-02 17:12:31 -07:00
Nathan Adams cb2461920b core: HTTP request values need to preserve order 2020-08-28 11:53:32 -07:00
Mike Welsh cab1634624 web: Ensure Key.getCode is set on keyUp
Fixes sticking keys in #1046.
2020-08-26 15:16:46 -07:00
Mike Welsh eaff74f364 web: Wire up mouse wheel events 2020-08-23 13:38:59 -07:00
Mike Welsh cbd448522a chore: Allow unknown clippy lints
same_item_push was added on nightly, but is currently throwing
a false negative. I added an allow for it, but this causes a
warning on stable for an unknown lints, so allow unknown lints for
now.
2020-08-12 23:51:12 -07:00
Mike Welsh 6c89869210 chore: Fix clippy lints 2020-08-12 19:04:14 -07:00
David Wendt c926da8888 Refactor URL relativization into two utility methods that backends can provide base URLs and paths to. 2020-07-23 23:02:54 -04:00
David Wendt 7433bfe28f Add a `NavigatorBackend` method to resolve relative URLs. 2020-07-23 23:02:53 -04:00
David Wendt 4813942fe7 The player should always change the audio backend's framerate itself. 2020-07-23 23:02:52 -04:00
David Wendt f56d16a68d Separate player creation from root movie setup, and allow users of Ruffle to load in movies synchronously or asynchronously.
During the small period of time when a player is created but has no root movie, a temporary empty movie is installed with an assumed stage size and framerate of 550x400@12fps. This is Flash default for new projects, so it seemed appropriate. User ActionScript cannot see these values, and I'm not even sure JavaScript can, either.
2020-07-23 23:02:51 -04:00
David Wendt 6998dafdb9 Store an origin URL on every movie that is loaded. 2020-07-23 23:02:50 -04:00
Mike Welsh 8e97fdfe0c web: Fix WebAudioBackend::stop_sounds_with_handle (fix #752)
This would incorrectly stop all audio nodes whenever a Stop sound
event was encountered.
2020-06-25 23:04:47 -07:00
CUB3D 166cb60d89 chore: Clean up useage of unwrap 2020-06-24 01:46:07 +01:00
CUB3D 2538d430ff chore: Format 2020-06-24 01:46:07 +01:00
CUB3D 0644168f12 web: Scope entries in localStorage to the current url (#379) 2020-06-24 01:46:07 +01:00
CUB3D 711b202a56 web: Add storage backend based on LocalStorage 2020-06-24 01:46:07 +01:00
CUB3D 4e286b43ae chore: Format 2020-06-24 01:46:06 +01:00
CUB3D 752ffc5cca chore: Fix clippy lints and tests 2020-06-24 01:44:07 +01:00
Nathan Adams 59ccd75518 core: Rename loader::LoaderError to loader::Error 2020-06-20 15:02:00 -07:00
Nathan Adams 0f1eef9022 core: Introduce LoaderError to all Loader methods 2020-06-20 15:02:00 -07:00
Nathan Adams 5662b2d4d9 core: Make Value::coerce_to_string return a Cow<str>` 2020-06-19 12:48:28 -07:00
Mike Welsh 33cbc1fe2f web: Avoid panics on unimplemented audio codecs 2020-06-17 12:14:08 -07:00
Mike Welsh 83feeefeeb audio: Don't panic on unimplemented codecs
Remove `unimplemented` calls when encountring unsupported codecs
such as Nellymoser. Instead, return an Error that can be
gracefully handled.
2020-06-17 12:14:08 -07:00
CUB3D 54701f775e web: Add dummy set_clipboard impl 2020-06-09 22:41:11 +01:00
Nathan Adams 91b0b28aa8 web: Fixed Key.isDown(13) (enter key) detection on web 2020-06-04 13:41:10 -07:00
Mike Welsh 3a8c705e95 chore: Fix clippy lints 2020-05-30 03:47:12 -07:00
Nathan Adams b8e63045b2 web: Moved source of core into core/src, to prep for tests 2020-05-19 11:42:54 +02:00
Nathan Adams b6523324ed web: Move each web package into a packages/ directory 2020-05-19 11:42:53 +02:00
Mike Welsh d15a4ed994 web: Fallback to canvas render backend in more cases (fix #545) 2020-05-14 22:36:19 -07:00
Nathan Adams 51d9f3ef36 core: Change Player::new to take in a SwfMovie, not &[u8] 2020-05-04 16:07:38 -07:00
Mike Welsh 936b314569 web: Add features for enabling webgl/canvas backend 2020-05-02 10:39:40 -07:00
Mike Welsh fa5c09b0cd web: Add WebGL render backend 2020-05-02 10:38:18 -07:00
Mike Welsh f09bd8c079 core: Clean up tick/render loop
Don't call `render` from `Player::tick`; instead, require the
frontends to explicitly call `render` when they wish to redraw.
The frontend can query `Player::needs_render` to see if the stage
is dirty and needs a redraw. Update desktop and web to use this
new method.

This fits better with the newer winit event loop model, which
requires explicitly calling `request_redraw`, and should avoid
spurious renders.
2020-05-02 04:25:21 -07:00
Mike Welsh 87bf0f44c4 render: Move canvas renderer to separate subcrate 2020-04-29 23:26:41 -07:00
Mike Welsh 0921f18417 web: Avoid out-of-bounds slice from zero sample SoundStreamBlock 2020-04-27 07:49:59 -07:00
Mike Welsh 8aa12d181f render: Remove RenderBackend::draw_pause_overlay 2020-04-27 04:45:53 -07:00
Mike Welsh c94df5243e web: Add nicer play button 2020-04-27 04:45:53 -07:00
Mike Welsh ddfd84ecdd web: Stop playing sounds when an instance is destroyed 2020-04-13 04:57:10 -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
Mike Welsh 5591cec0f7 web: Fix #412, incorrect bitmap rendering when cached 2020-03-24 23:08:15 -07:00
Mike Welsh 26914d7b62 web: Fix off-center gradient rendering
Regression caused by 223edb9. Write twips value to SVG matrix.
Addresses some incorrect rendering in #437.
2020-03-16 02:44:32 -07:00
Mike Welsh cd334bcd3f web: Fix bitmap fills not using twips 2020-03-02 18:31:49 -08:00
Mike Welsh 223edb9bc1 core: Matrix translation is in twips 2020-02-26 12:47:47 -08:00
Mike Welsh c4c02260fb core: Implement keyUp event 2020-02-26 03:48:07 -08:00
Mike Welsh acd5f2c74f web: Fix invisible cursor 2020-02-26 01:47:08 -08:00
Mike Welsh 86ec2c6cb8 input: Add InputBackend::set_mouse_cursor. Change cursor on buttons
It doesn't feel like Flash without having the hand cursor display
when hovering over buttons. First pass at implementing this;
core communicates which mouse cursor to use via
`InputBackend::set_mouse_cursor`.

TODO: Hand cursor only displayed for Button display objects
currently. Movie clips should also display this when they are in
"button mode" (when a button mouse event is set on them in AVM1,
or `buttonMode` property in AVM2).
2020-02-25 02:50:26 -08:00
David Wendt 33d26b9149 Shorten `Pin<Box<dyn Future<Output=Result<T,E>> + 'static>>` into `OwnedFuture<T,E>`.
This is technically stricter on `fetch` impls, but right now we can't support non-`'static` futures at all.
2020-02-22 00:02:45 -05:00
David Wendt c7539872f7 Add the ability to POST data from `fetch`, and allow methods that read AVM locals into form data to `GET` or `POST` them. 2020-02-21 23:58:00 -05:00