Commit Graph

6869 Commits

Author SHA1 Message Date
relrelb e78bf30d58 swf: Extract `Color` to a separate file 2022-07-23 08:43:02 +03:00
Rafał Dowgird fac32b488b
avm2: implement string replace(string, function) (#7456)
* avm2: implement string replace where pattern is string and replacement is a function

* * removed unnecessary vec!

  * fixed "no newline at the end of file"
2022-07-22 17:32:02 +03:00
Aaron Hill bb6f07ee1a
avm2: Add support for playerglobal instance allocators
This commit adds support for combining instance allocators with
ActionScript playerglobal class definitions. This is activated
by defining the metadata `[Ruffle(InstanceAllocator = "true")]`
on the ActionScript class definition.

The implementation of this feature is very similar to native methods:
`build_playerglobal` checks for the metadata described above,
and defines a const `NATIVE_INSTANCE_ALLOCATOR_TABLE` mapping
class ids to function pointers.

To demonstrate this feature, I've converted `Event` to ActionScript
(keeping the existing instance allocator function).
I've also converted `ActivityEvent` and `ContextMenuEvent` to
`ActionScript`, to demonstrate how this simplifies inheritance.
In a future PR, we can convert the remaining events to ActionScript,
and remove the `EventData` enum entirely.

Unfortunately, `flex-sdk`'s `asc.jar` compiler strips out all metadata
when the `-optimize` option is passed. As a result, I forked
`flex-sdk` and disabled this behavior:
https://github.com/ruffle-rs/flex-sdk/releases/tag/ruffle-1.0.0

The modified `asc.jar` (built from the forked repository)
is included in this PR, and replaces the our previous 'asc.jar'
downloaded from the official Flex SDK release.

* Change metadata to `[Ruffle(InstanceAllocator)]`

* Strip out metadata before saving bytecode
2022-07-20 23:11:46 -07:00
nosamu 01c8c38762 web: Hide loading screen when root movie download fails 2022-07-20 19:55:12 +03:00
dependabot[bot] 7336e7cbf7 build(deps): bump terser from 5.10.0 to 5.14.2 in /web
Bumps [terser](https://github.com/terser/terser) from 5.10.0 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 20:06:20 -07:00
Mike Welsh 6f142c21fa canvas: Fix transforming of gradient/bitmap strokes 2022-07-19 15:01:17 -07:00
Mike Welsh ef838a3536 avm1: lineStyle scale mode defaults to normal 2022-07-19 15:01:17 -07:00
Mike Welsh 1980d6f420 canvas: Scale stroke width based on shape transform 2022-07-19 15:01:17 -07:00
Daniel Jacobs 56adcc5665
web: Add a loading screen (#7396)
* web: Add a loading screen

* web: Workaround sometimes overwitten remove method

* web: Completely remove exact px values from preloader

* web: Add meaningless loading animation to preloader

* web: Make preloader position relative

* web: Minor preloader CSS changes

* web: Don't change autoplay/unmuteOverlay showing logic

* demo: Use preloader-background for demo

* web: Don't fully remove preloader

* web: Hide preloader loading bar if there's no content-length

* web: Fix typo in load-ruffle

* web: Show/hide playButton and unmuteOverlay based on preloader state

* web: Address preloader feedback

* web: Revert ESLint change

* web: Remove unneeded optional chaining

* web: Change load option from hasPreloader to preloader

* web: Address some preloader feedback

* web: Change margin-bottom for preloader loading anim

* web: Simplify preloader conditional

* web: Show/hide full container when hiding/showing preloader

* web: Make preloader full-size
2022-07-19 22:20:53 +03:00
relrelb 23fdc2b2ee chore: Appease clippy 2022-07-19 09:26:46 +03:00
Rafał Dowgird 934cb05371
avm2: implement string.replace(...) with fn, for now regex only. (#7429)
* avm2: implement string.replace(...) with fn, for now regex only.

  * string - added path for replacing regex with fn (replacing string
  with fn is still unimplemented)

  * regex - factored out common replace logic for when replacement is
  a string and when it is a function

  * added tests

* Addressed review comments

* removed tinkering cruft; formatting

* addressed review comments
2022-07-19 08:47:57 +03:00
dependabot[bot] 2ffded778b build(deps): bump symphonia from 0.5.0 to 0.5.1
Bumps [symphonia](https://github.com/pdeljanov/Symphonia) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/pdeljanov/Symphonia/releases)
- [Commits](https://github.com/pdeljanov/Symphonia/compare/v0.5.0...v0.5.1)

---
updated-dependencies:
- dependency-name: symphonia
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 00:31:17 +03:00
relrelb 0e65617d4a avm2: Small cleanup in `RegExp::effective_replacement`
`char_indicies()` isn't really needed because the position is never
used.
So use the simpler `chars()` method instead.
2022-07-18 10:53:18 +03:00
Adrian Wielgosik 22d2810ef9 avm2: Migrate ContextMenu-related classes to AS 2022-07-17 11:05:37 -07:00
relrelb cad3cd8dbf avm2: Inline `Activation::run_stack_frame_for_script`
This reduces some complexity.
2022-07-15 17:15:14 -05:00
Aaron Hill af4f181856 avm2: Implement support for native methods in `playerglobal`
This commit adds support for marking methods as `native`
in ActionScript classes defined in playerglobal. The
`build_playerglobal` now checks for native methods, and
generates Rust code linking them to a corresponding Rust
function definition in the codebase.

To test this functionality, I've reimplemented several
functions as native methods (and moved related code to
pure ActionScript).
2022-07-15 11:43:49 -05:00
EmperorBale 41bfc028d2 tests: Add test for special unicode characters and characters that need padding 2022-07-15 15:29:55 +03:00
EmperorBale 95809f8a9b avm2: Make escape output for unicode characters, as well as characters that need padding 2022-07-15 15:29:55 +03:00
nosamu 245b55a832 chore: Fix lint 2022-07-13 20:36:52 -07:00
nosamu 7c55a14c36 demo: Update swfs.json example 2022-07-13 20:36:52 -07:00
nosamu 320f84dc88 demo: Improve Sample SWF dropdown 2022-07-13 20:36:52 -07:00
dowgird cfc9f51c5d avm2: implement $ patterns in regex replace 2022-07-13 15:48:25 -06:00
relrelb 13a0eb3d92 scanner: Fix `path-slash` update
As mentioned in the [CHANGELOG.md](https://github.com/rhysd/path-slash/blob/master/CHANGELOG.md#v020---05-jul-2022),
`to_slash_lossy` now returns `Cow<'_, str>` instead of `String`.
2022-07-12 00:24:50 +03:00
dependabot[bot] c3a8d11e39 build(deps): bump path-slash from 0.1.5 to 0.2.0
Bumps [path-slash](https://github.com/rhysd/path-slash) from 0.1.5 to 0.2.0.
- [Release notes](https://github.com/rhysd/path-slash/releases)
- [Changelog](https://github.com/rhysd/path-slash/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rhysd/path-slash/compare/v0.1.5...v0.2.0)

---
updated-dependencies:
- dependency-name: path-slash
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-12 00:24:50 +03:00
dependabot[bot] 80dd295748 build(deps): bump lyon from 0.17.10 to 1.0.0
Bumps [lyon](https://github.com/nical/lyon) from 0.17.10 to 1.0.0.
- [Release notes](https://github.com/nical/lyon/releases)
- [Changelog](https://github.com/nical/lyon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nical/lyon/commits)

---
updated-dependencies:
- dependency-name: lyon
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 23:36:39 +03:00
dependabot[bot] 90ecdfaff5 build(deps): bump serde from 1.0.138 to 1.0.139
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.138 to 1.0.139.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.138...v1.0.139)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 23:35:30 +03:00
nosamu a31dd2e101 Revert "web: Add a loading screen"
This reverts commit bec0710175.
2022-07-11 19:05:52 +02:00
nosamu 47d9c5220a Revert "web: Workaround sometimes overwitten remove method"
This reverts commit ed4f0b98b2.
2022-07-11 19:05:52 +02:00
nosamu 478c69f846 Revert "web: Completely remove exact px values from preloader"
This reverts commit 2c067fe5dd.
2022-07-11 19:05:52 +02:00
nosamu d79e45e49e Revert "web: Add meaningless loading animation to preloader"
This reverts commit c48ca2874b.
2022-07-11 19:05:52 +02:00
nosamu 7c522f2d66 Revert "web: Make preloader position relative"
This reverts commit ded77ab46a.
2022-07-11 19:05:52 +02:00
Rafał Dowgird 80d1a8449a
avm2: implement string.split for regex (#7363)
* avm2: implement string.split for regex

* Compressed the testing for regexp and unwrapping thereof

* * Moved the split logic into the regex object

  * Factored out a method for utf-16 matching

  * Added tests

* formatting

* * replaced manual counting with storage.length()

* clippy cleanup

* Address review comments

  * fix import path for WString
  * remove redundant variable in return statement
  * error passing via '?' instead of unwrap()
2022-07-11 19:47:05 +03:00
Daniel Jacobs ded77ab46a web: Make preloader position relative 2022-07-10 13:30:42 -07:00
Daniel Jacobs c48ca2874b web: Add meaningless loading animation to preloader 2022-07-10 13:30:42 -07:00
Daniel Jacobs 2c067fe5dd web: Completely remove exact px values from preloader 2022-07-10 13:30:42 -07:00
Daniel Jacobs ed4f0b98b2 web: Workaround sometimes overwitten remove method 2022-07-10 13:30:42 -07:00
Daniel Jacobs bec0710175 web: Add a loading screen 2022-07-10 13:30:42 -07:00
relrelb 9856a03797 avm1: Inline `apply_to_display_object` 2022-07-10 07:29:38 +03:00
relrelb 78ebf06f55 avm2: Extract `MethodFlags` enum 2022-07-09 20:34:53 +03:00
relrelb afd24cad12 desktop: Tiny cleanup 2022-07-09 11:06:39 +03:00
relrelb f643048c1c core: Introduce `Request`
Which holds both a URL and what was `RequestOptions` formerly.
2022-07-09 09:43:42 +03:00
relrelb 115f15806e chore: Fix `needless_borrow` clippy lints
Though https://github.com/rust-lang/rust-clippy/pull/8355 has been
merged, it seems to still report false-positives on nightly channel.

For now just fix the instances reported by stable clippy, and keep
`needless_borrow` allowed.
2022-07-08 14:14:30 +03:00
nosamu 7fa35f2a82 web: Construct relative SWF URLs using document base 2022-07-07 08:58:04 +03:00
relrelb c0e84e646e wstr: Implement `ToOwned` for `WStr`
Similarly to how `str` implements `ToOwned`, and `From<&str> for String`
forwards to `to_owned()`.

This will allow defining `Cow<WStr>`.
2022-07-06 09:19:12 +03:00
relrelb 2f4e31c6be avm1: Avoid allocation of some static strings
Prefer creating a static `AvmString` over allocating an owned one.
2022-07-06 09:19:12 +03:00
relrelb 9c1a05aaaf avm2: Re-use code in `coerce_to_number`
Use `string_to_f64` and `string_to_int`, as [`MathUtils::convertStringToNumber`](858d034a3b/core/MathUtils.cpp (L453-L466))
in avmplus does.
2022-07-06 09:04:15 +03:00
dependabot[bot] 265dcd2e8d build(deps): bump serde_json from 1.0.81 to 1.0.82
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.81 to 1.0.82.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.81...v1.0.82)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 09:09:03 +03:00
dependabot[bot] 55e985da8c build(deps): bump serde from 1.0.137 to 1.0.138
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.137 to 1.0.138.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.137...v1.0.138)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 08:43:27 +03:00
dependabot[bot] cfe3d37905 build(deps): bump bytemuck from 1.9.1 to 1.10.0
Bumps [bytemuck](https://github.com/Lokathor/bytemuck) from 1.9.1 to 1.10.0.
- [Release notes](https://github.com/Lokathor/bytemuck/releases)
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.9.1...v1.10.0)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 23:55:22 +03:00
dependabot[bot] 8cbb5cc4eb build(deps): bump embed-resource from 1.7.2 to 1.7.3
Bumps [embed-resource](https://github.com/nabijaczleweli/rust-embed-resource) from 1.7.2 to 1.7.3.
- [Release notes](https://github.com/nabijaczleweli/rust-embed-resource/releases)
- [Commits](https://github.com/nabijaczleweli/rust-embed-resource/compare/v1.7.2...v1.7.3)

---
updated-dependencies:
- dependency-name: embed-resource
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 23:55:09 +03:00