David Wendt
8d83bbb864
Impl fetch for web
2020-02-21 23:44:05 -05:00
David Wendt
491d94c947
Pinbox all Futures.
...
Due to some strangeness with the way Rust implemented unsafe-to-move behavior, boxed futures are implicitly `Unpin`. Which is useless to us.
The reason for this is a little counter-intuitive. Actually, the fact that Rust supports memory pinning at all is a little odd, because the core language explicitly requires all types be movable. To get around this, Pin requires that all !Unpin types be *born pinned*. This is because you can't re-pin an already unpinned value in memory.
Anyway, this necessitates this silly API change.
2020-02-21 23:44:05 -05:00
David Wendt
00d25a768c
Extremely basic impl of fetch/spawn methods for getting data off the web
2020-02-21 23:44:05 -05:00
David Wendt
2137b9f1fd
Migrate `set_frame_rate` into the core `AudioBackend` trait
2020-02-21 23:44:05 -05:00
David Wendt
c1cf73ccb3
Add a public method to trigger a player update.
...
User-defined player updates are treated the same as if a stage frame had been run: queued actions are executed and garbage is collected.
2020-02-21 23:44:04 -05:00
Mike Welsh
f80c188048
core: Stop stream sounds when a clip is removed
2020-02-21 19:24:45 -08:00
Mike Welsh
6b503ac053
avm1: Fix DefineFunction2 preload order when _parent is undefined
...
The order is misdocumented in SWF19 (and also miscompiled assuming
this incorrect order by the Flash IDE!).
`_global` gets preloaded before `_parent`.
2020-02-20 12:58:26 -08:00
Mike Welsh
dc1f99e2ba
tests: Add test for misdocumented DefineFunction2 register preload
2020-02-20 12:58:26 -08:00
Mike Welsh
10fb6c7c04
tests: Add define_function2_preload test
2020-02-19 23:22:33 -08:00
Mike Welsh
19d0bf64a9
avm1: Preload _parent directly from base clip
...
When `_parent` is preloaded in a `DefineFunction2` action,
we previously resolve it on the scope chain. This could cause
double borrow panics as the parent object could already be
borrowed, and also this matches the behavior of the official Flash
player.
Addresses #398 .
2020-02-19 23:22:33 -08:00
Mike Welsh
4ffc255365
docs: Update README
...
Add sponsor and update status text.
2020-02-19 23:19:59 -08:00
Mike Welsh
8d7e58011e
avm1: undefined coerces to "" in SWFv6 and below
...
Except in the AVM1 trace op, which will print out "undefined".
2020-02-19 10:47:43 -08:00
Mike Welsh
dfde98da7d
tests: Add tests for coercing undefined to string in SWF6
2020-02-19 10:47:43 -08:00
Mike Welsh
452ac84f0e
tests: Uncomment Number.POSITIVE_INFINITY/Number.NEGATIVE_INFINITY tests
2020-02-18 10:17:55 -08:00
Mike Welsh
c073afb077
avm1: Use proper value for Number.MIN_VALUE
...
This is the smallest positive number, not the most negative value.
This is actually the smallest positive subnormal f64, which Rust
does not provide a constant for. This is ~5e-324.
2020-02-18 10:17:55 -08:00
Mike Welsh
6bbe1dbab8
avm1: Match Flash when converting exotic numbers to string ( fix #361 )
...
Match Flash's more closely when converting number to string:
* NAN -> NaN
* inf -> Infinity
* -inf -> -Infinity
* Use exponential notation for very large/very small
This is a little bit of a cheat by using Rust's number-to-string
formatting for exponentials, and shoving a sign in front of the
exponent.
2020-02-18 10:17:55 -08:00
Mike Welsh
324dd1c5e4
tests: Add swf_tests_approx macro
...
Use this macro to test numeric calculations that might have some
variance using approx_eq.
2020-02-17 15:42:29 -08:00
Mike Welsh
b6249cdb73
tests: Add localToGlobal/globalToLocal test
2020-02-17 15:42:29 -08:00
Mike Welsh
2af21d87e0
avm1: Implement MovieClip.localToGlobal/globalToLocal
2020-02-17 15:42:29 -08:00
Mike Welsh
ba60f89c28
docs: Add nightly build section
2020-02-17 15:39:43 -08:00
Mike Welsh
b3cfec0852
docs: Add link to wiki for self-hosting instructions
2020-02-17 15:39:43 -08:00
Mike Welsh
23671029a6
docs: Add sponsors to README
2020-02-17 15:39:43 -08:00
Mike Welsh
b8defda7bb
docs: Update AS support info in README
2020-02-17 15:10:31 -08:00
Mike Welsh
cd94486f7e
desktop: Fix stream audio from prematurely ending ( fix #222 )
2020-02-14 20:32:25 -08:00
Mike Welsh
7c406732c7
audio: Ensure stream sounds stop upon goto/loop ( fix #370 )
2020-02-14 20:32:25 -08:00
Mike Welsh
9ad069e11a
avm1: Improve display object property setters for weird values
...
Setting a property such as _x to undefined or null should have no
effect. This was working for v7+ SWFs because it would coerce to
NaN and we toss out NaNs. But on v6 and below, these coerce to 0
and would end up setting the property to 0.
Explicitly check for undefined/null and bail out. Fixes #380 .
Also adjust the _visible setter, since this actually coerces to a
number (because of its legacy from SWFv4). For example,
_visible = "" should have no effect.
2020-02-14 15:34:14 -08:00
Mike Welsh
3a1a73ae11
tests: Add more tests for display object properties
...
Add more _x = weirdo value tests, and copy the test into a v6 SWF.
(because undefined etc. can coerce to 0 instead of NaN in SWFv6).
2020-02-14 15:34:14 -08:00
Mike Welsh
432c605987
chore: Bump glutin/glium/winit to latest versions
...
Closes #371 , #376 .
2020-02-14 13:23:27 -08:00
Mike Welsh
7d14b98f3b
avm1: Ignore undefined values in Color.setTransform
...
If a property is not set on the object passed to Color.setTransform,
then that channel is left unmodified. This fixes invisible objects
in some games (fixes #369 , addresses #380 ).
Also improve handling of wrapping/invalid values to better match the
behavior in the Flash Player (some work pending on #193 ).
2020-02-13 18:06:27 -08:00
Mike Welsh
21f117e7bc
avm1: Add Value::coerce_to_i16
2020-02-13 18:06:27 -08:00
Mike Welsh
19df074a79
tests: Add more tests for AVM1 Color object
...
Include not defined values, wrapping values, invalid values.
2020-02-13 18:06:27 -08:00
Mike Welsh
cc90d7b0ae
chore: Actually don't optimize build dependencies in release profile
...
Previous commit incorrectly set the override in the dev profile.
2020-02-13 15:28:15 -08:00
Mike Welsh
6ea2a55207
chore: Don't optimize build dependencies
...
Rust 1.41 shipped with the ability to specify optimization level
per dependency/dev-dependency.
This speeds up a full release build by ~20% on my machine.
2020-02-12 15:43:58 -08:00
Mike Welsh
560834ff6b
chore: Bump ci to Rust 1.41
2020-02-12 13:54:11 -08:00
dependabot-preview[bot]
d9deaab5f1
build(deps-dev): bump webpack-cli in /web/selfhosted
...
Bumps [webpack-cli](https://github.com/webpack/webpack-cli ) from 3.3.10 to 3.3.11.
- [Release notes](https://github.com/webpack/webpack-cli/releases )
- [Changelog](https://github.com/webpack/webpack-cli/blob/next/CHANGELOG_v3.md )
- [Commits](https://github.com/webpack/webpack-cli/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 01:59:04 +00:00
dependabot-preview[bot]
c7405d6bc0
build(deps): bump image from 0.22.4 to 0.23.0
...
Bumps [image](https://github.com/image-rs/image ) from 0.22.4 to 0.23.0.
- [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.22.4...v0.23.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 01:33:11 +00:00
dependabot-preview[bot]
fde5e0a730
build(deps-dev): bump webpack from 4.41.5 to 4.41.6 in /web/selfhosted
...
Bumps [webpack](https://github.com/webpack/webpack ) from 4.41.5 to 4.41.6.
- [Release notes](https://github.com/webpack/webpack/releases )
- [Commits](https://github.com/webpack/webpack/compare/v4.41.5...v4.41.6 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 01:25:30 +00:00
dependabot-preview[bot]
6681e843a9
build(deps): bump byteorder from 1.3.2 to 1.3.4
...
Bumps [byteorder](https://github.com/BurntSushi/byteorder ) from 1.3.2 to 1.3.4.
- [Release notes](https://github.com/BurntSushi/byteorder/releases )
- [Changelog](https://github.com/BurntSushi/byteorder/blob/master/CHANGELOG.md )
- [Commits](https://github.com/BurntSushi/byteorder/compare/1.3.2...1.3.4 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 00:57:11 +00:00
dependabot-preview[bot]
c17fa52565
build(deps-dev): bump webpack-dev-server in /web/selfhosted
...
Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server ) from 3.10.2 to 3.10.3.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases )
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md )
- [Commits](https://github.com/webpack/webpack-dev-server/compare/v3.10.2...v3.10.3 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-12 00:53:47 +00:00
Mike Welsh
843169d0e8
core: Merge #350 , improved dynamic text support
2020-02-11 16:52:44 -08:00
David Wendt
18516c8eac
Pre-strip HTML from HTML tags, rather than skipping them.
2020-02-03 19:32:05 -05:00
David Wendt
7d225f8b55
Fix overflow when shifting `u8`s
2020-02-03 14:46:36 -05:00
David Wendt
3d6b00c1e4
Impl the remaining text layout properties
2020-02-03 14:46:36 -05:00
David Wendt
517e7ce9ff
Add word-wrap for `measure_text` and caching for word-wrap calculations
2020-02-03 14:46:36 -05:00
David Wendt
5e808c8cd6
Adjust the wordwrap machinery to work in break points (indicies where new lines start) so we can cache them later
2020-02-03 14:46:35 -05:00
David Wendt
fb8664c818
Implement wordWrap and multiline rendering, poorly
2020-02-03 14:46:35 -05:00
David Wendt
7df8eb7674
Impl `is_multiline`'s effect of respecting newlines
2020-02-03 14:46:35 -05:00
David Wendt
f95ec777de
Also impl storage of the `wordWrap` flag
2020-02-03 14:46:34 -05:00
David Wendt
819757e2b6
Fix text measurement now that the underlying SWF tags are correctly parsed as `Twips`.
...
Transform coordinates are always in twips, so we have to convert pixels to twips when evaluating the font, and then convert back when measuring.
2020-02-03 14:46:34 -05:00
David Wendt
63b7d172f4
`TextRecord.height` is also in `Twips`.
...
Notably, the `Text` rendering code does not appear to actually work in pixel scale.
2020-02-03 14:46:34 -05:00