Commit Graph

10693 Commits

Author SHA1 Message Date
David Wendt 782181557b core: Fix `SubstreamTagReader`'s chunk resizing 2023-08-23 15:36:20 -06:00
David Wendt cfe8b3c464 core: Add `LowerHex` and `UpperHex` representations of `Slice` and `SliceRef` for debugging. 2023-08-23 15:36:20 -06:00
David Wendt 7158039135 audio: Audio streamed from FLVs do not have the SWF MP3 header 2023-08-23 15:36:20 -06:00
David Wendt dde4579a9e core: `Substream` sounds must be started with at least one data block in them 2023-08-23 15:36:20 -06:00
David Wendt 438f53a936 core: Explicitly report a `TooManySounds` error instead of coercing all failure modes into returning `None` in `AudioManager` 2023-08-23 15:36:20 -06:00
David Wendt be3787a489 core: Fix `SubstreamCursor` not accounting for consumed bytes properly 2023-08-23 15:36:20 -06:00
David Wendt 9b29791eeb avm1: Implement `MovieClip.attachAudio`.
`NetStream`s in AVM1 do not play audio unless attached to a `MovieClip`. As far as I can tell there doesn't seem to be any equivalent API in AVM2.
2023-08-23 15:36:20 -06:00
David Wendt dbee260d79 core: Stream audio data from FLVs into the audio backend 2023-08-23 15:36:20 -06:00
David Wendt f5d6bf9fb9 audio: Add support for playing substream sounds through the audio manager 2023-08-23 15:36:20 -06:00
David Wendt 4b5398e122 audio: Implement `start_substream`.
This also removes `append_substream` since `Substream` now handles that internally.

This requires duplicating a huge chunk of the decoder code to work with `Buffer` types instead of `SwfMovie` types. Eventually we'll want to wipe out all the SWF-specific stuff and use `Buffer` exclusively.
2023-08-23 15:36:20 -06:00
David Wendt 21cedcee2e core: `Substream` now holds a shared chunk list 2023-08-23 15:36:20 -06:00
David Wendt e411dbeee5 core: Add a `Cursor` equivalent for `Slice`s 2023-08-23 15:36:20 -06:00
David Wendt b46ef355fd core: Add two new methods for managing streaming audio:
* `start_substream` plays audio data from a `Substream`, giving back a `SoundInstanceHandle` that can be manipulated the same way as the one from `start_stream`

 * `append_substream` adds more data to an already playing `Substream` backed `SoundInstance`. In the event that a sound has finished playing, `append_substream` will fail, and you have to start a new sound stream.

This is ultimately intended to replace the current streaming audio setup, which is SWF-specific and has a number of unused parameters. It is also designed to support progressive download in the future.

We also include stub impls for `NullAudioBackend`.
2023-08-23 15:36:20 -06:00
David Wendt c03aa31b21 core: Add a `Substream` type for referencing multiple slices of a `Buffer`.
A `Substream` can be read in one of two ways:

 * Converting it to an iterator that yields individual chunks of the substream in `Slice` form.
 * Converting it to a `SubstreamCursor`, which implements `Read` for bytewise read access.

Chunk-based reading is intended for code that needs to know about chunk boundaries. Self-terminating chunk formats should be read with the cursor type.
2023-08-23 15:36:20 -06:00
David Wendt 6f646f618b core: Add a new `Buffer` type for shared ownership of data.
This is ultimately intended to replace `Vec<u8>` in both `SwfMovie` and `NetStream`, but for the time being we only apply this to streams. SWF-related types are deeply embedded elsewhere and the changes to slice dereferencing will be quite invasive.

We also remove some unnecessary reader drops in `NetStream.tick` at the same time.
2023-08-23 15:36:20 -06:00
Crowdin Bot d55cc23f55 chore: Update translations from Crowdin 2023-08-22 23:06:46 +02:00
Daniel Jacobs acc315ebfb extension: Fix check for scripting permission 2023-08-22 22:47:28 +02:00
Daniel Jacobs eef65da345 extension: Remove unnecessary lambda functions 2023-08-22 22:17:18 +02:00
nosamu 89d94ae098 avm2: getStackTrace() returns null when the stack trace is unavailable
Fixes #12572
2023-08-22 20:57:10 +02:00
Nathan Adams 9d05a37f34 web: Make open-in-new-tab open the local player directly, and disable takeover of all SWF urls 2023-08-22 19:35:05 +02:00
Daniel Jacobs ba52438c27 extension: Fix-ups for extension player page 2023-08-22 17:50:37 +02:00
nosamu 20b07ff147 avm1: Fix XML=>String coercion mangling non-ascii chars
Fixes #12859
2023-08-22 17:23:56 +02:00
nosamu 2f40f0093a avm1: Unescape + to space 2023-08-22 16:38:24 +02:00
sleepycatcoding 991976e437 avm2: Implement XML pretty printing 2023-08-22 09:57:59 -04:00
sleepycatcoding 34295f25ff chore: Appease beta Clippy 2023-08-22 15:29:01 +02:00
Crowdin Bot 3de4b4e989 chore: Update translations from Crowdin 2023-08-21 23:09:03 +02:00
renovate[bot] 2f4c7d2fe3 fix(deps): update rust dependencies 2023-08-21 08:59:07 +02:00
Nathan Adams 89cc0eb31d core: EditText::is_link_at doesn't need to evaluate fonts 2023-08-20 22:31:27 +02:00
Nathan Adams 385c2d7cb0 core: Fix links in TextEdits when scrolled down 2023-08-20 22:31:27 +02:00
Nathan Adams f0d356589a core: Implement avm2 event: links in texts 2023-08-20 22:31:27 +02:00
Nathan Adams 814a900b03 avm1: asfunction goes by the parent, not root 2023-08-20 22:31:27 +02:00
Nathan Adams b8cda975f3 core: Allow clicking EditTexts if we're clicking links 2023-08-20 22:31:27 +02:00
Nathan Adams 658ac2dd9f core: Implement url handling (+asfunction) in textedits 2023-08-20 22:31:27 +02:00
Nathan Adams d32867d992 core: Fix getting correct text position by coordinates, in multiline text 2023-08-20 22:31:27 +02:00
Nathan Adams 506d1918dd core: Add span list to debug window of EditTexts 2023-08-20 22:31:27 +02:00
Daniel Jacobs 1a28f83229 extension: Address review feedback 2023-08-20 19:51:14 +02:00
Nathan Adams d5fa0f56ea web: Make loadedConfig private again, add reload() method instead 2023-08-20 19:51:14 +02:00
Daniel Jacobs e7df6d890e extension: Make the player page a local Ruffle demo 2023-08-20 19:51:14 +02:00
TÖRÖK Attila a11725c27c tests: Exclude WARP from running the acid_gradient_2 visual test (ported from Shumway)
This was the culprit for most of our recent Windows CI failures.
2023-08-20 12:49:37 +02:00
TÖRÖK Attila 891e369f48 renovate: Migrate config from "matchLanguages" -> "matchCategories" 2023-08-19 22:16:55 +02:00
TÖRÖK Attila c527eb5a13 renovate: Un-ignore "tests" - we have utilities in there 2023-08-19 22:16:55 +02:00
TÖRÖK Attila a19de45ab5 renovate: Follow "config:base" -> "config:recommended" rename 2023-08-19 22:16:55 +02:00
Kornelius Rohrschneider a50f5cd072 avm1: Remove delay to enter the unloaded state for non-root MovieClips
avm1_unload_movie has been adapted to only enter the unloaded state with
one frame delay if the MovieClip is a root MovieClip. The unloaded state
is now immediately entered for non-root MovieClips.
This fixes the regressions #12254 and #12265 which got introduced
because of this delay.

However, in Flash Player, even non-root MovieClips enter the unloaded
state one frame after the unloadMovie command has been read. Ruffle is
probably replacing a MovieClip differently to Flash, therefore
introducing these regressions when trying to emulate that delay.
Documentation explaining this all has been added to avm1_unload_movie.

Therefore, the test movieclip_library_state_values has been added. It
tests the default state and the unloaded state of a (non-root) child
MovieClip that's loaded from the library. It is marked as known_failure
because Ruffle currently doesn't implement the delay before entering the
unloaded state for non-root MovieClips.
2023-08-19 17:29:00 +02:00
Kornelius Rohrschneider f582ea572c core: Add is_root parameter to MovieClip::replace_with_movie
The method MovieClip::replace_with_movie accepts an
Option<Arc<SwfMovie>>. If no movie is given, an empty stub movie is
generated and used.
Previously, the IS_ROOT flag has been set for the new replaced SwfMovie,
depending on whether a movie was given to the method or not.
However, there are cases where an explicitely given movie should not be
set as a root movie (e.g. if a specific empty stub movie is given to the
method). Conversely, there are also cases where no movie is given, but
the stub movie should still be set as a root movie (e.g. in specific
MovieClip states).
Therefore, an is_root parameter has been added to the method. This
explicit parameter is now used to set the flag for the new replaced
SwfMovie.

All calls of replace_with_movie have been adapted to use the new
parameter correctly.
2023-08-19 17:29:00 +02:00
Kornelius Rohrschneider 0abe0b9386 avm1: Remove completed MovieUnloaders
Previously, a MovieUnloader has been kept in the LoadManager, even after
the movie has been unloaded.
This has been fixed. A remove_loader method has been added to the
LoadManager. It is now called in the avm1_unload_movie method; every
MovieUnloader will be removed after the unloaded state has been entered.

The documentation about loaders has been improved and fixed in multiple
places, clarifying how loaders are removed.
2023-08-19 17:29:00 +02:00
nosamu 050da0740a avm1: Pass flashvars in loadMovie and MovieClipLoader
Fixes #11497
2023-08-19 16:45:01 +02:00
nosamu bd82563bb6 avm2: More lenient SWF version check for invalid frame label behavior
Fixes #11987
2023-08-19 16:10:40 +02:00
renovate[bot] 98eb789f21 chore(deps): update node.js dependencies 2023-08-19 14:37:36 +02:00
Nathan Adams cdaf06838c web: Add short_name for extension 2023-08-19 10:02:53 +02:00
Nathan Adams d21520a4c7 web: Rename extension to 'Ruffle - Flash Emulator', to increase visibility for everyone searching for 'Flash' 2023-08-19 01:11:25 +02:00