Commit Graph

47 Commits

Author SHA1 Message Date
dependabot[bot] 6f430bb40d build(deps): bump serde from 1.0.151 to 1.0.152
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.151 to 1.0.152.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.151...v1.0.152)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-28 10:55:35 +02:00
dependabot[bot] 664c67ea27 build(deps): bump clap from 4.0.29 to 4.0.32
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.29 to 4.0.32.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.29...v4.0.32)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 22:04:33 +01:00
dependabot[bot] 5383ae296d build(deps): bump quote from 1.0.21 to 1.0.23
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.21 to 1.0.23.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.21...1.0.23)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 07:29:38 +02:00
dependabot[bot] 9db6ace65f build(deps): bump serde from 1.0.150 to 1.0.151
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.150 to 1.0.151.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.150...v1.0.151)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 00:48:45 +01:00
dependabot[bot] 08566ed4ba build(deps): bump proc-macro2 from 1.0.47 to 1.0.49
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.47 to 1.0.49.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.47...1.0.49)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-20 00:20:20 +01:00
Mike Welsh 696c9062d3 chore: Inherit cargo metadata from workspace
Use workspace inheritance added in Rust 1.64 to de-duplicate
various settings across all packages.
2022-12-16 15:53:59 -08:00
dependabot[bot] b1c4e6f143 build(deps): bump serde from 1.0.149 to 1.0.150
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.149 to 1.0.150.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.149...v1.0.150)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-12 21:21:45 +01:00
dependabot[bot] 3b285f8cf2 build(deps): bump serde from 1.0.148 to 1.0.149
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.148 to 1.0.149.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.148...v1.0.149)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 22:35:48 +01:00
dependabot[bot] 83487ae5d1 build(deps): bump serde from 1.0.147 to 1.0.148
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.147 to 1.0.148.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.147...v1.0.148)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-30 10:04:26 +01:00
Marco Grassi ad81b3bf14 upgrade lock and toml dependencies 2022-11-26 14:04:59 -05:00
Aaron Hill b8745f0ff1 avm2: Partially implement Stage3D for wgpu backend
This PR implements core 'stage3D' APIs. We are now able
to render at least two demos from the Context3D docs - a simple
triangle render, and a rotating cube.

Implemented in this PR:
* Stage3D access and Context3D creation
* IndexBuffer3D and VertexBuffer3D creation, uploading, and usage
* Program3D uploading and usage (via `naga-agal`)
* Context3D: configureBackBuffer, clear, drawTriangles, and present

Not yet implemented:
* Any 'dispose()' methods
* Depth and stencil buffers
* Context3D texture apis
* Scissor rectangle

General implementation strategy:

A new `Object` variant is added for each of the Stage3D objects
(VertexBuffer3D, Program3D, etc). This stores a handle to the
parent `Context3D`, and (depending on the object) a handle
to the underlying native resource, via `Rc<dyn
SomeRenderBackendTrait>`).

Calling methods on Context3D does not usually result in an immediate
call to a `wgpu` method. Instead, we queue up commands in our
`Context3D` instance, and execute them all on a call to `present`.
This avoids some nasty wgpu lifetime issues, and is very similar
to the approah we use for normal rendering.

The actual rendering happens on a `Texture`, with dimensions
determined by `createBackBuffer`. During 'Stage' rendering,
we render all of these Stage3D textures *behind* the normal
stage (but in front of the overall stage background color).
2022-11-25 21:43:00 -07:00
Aaron Hill 4b8cd45f4b
avm2: Partially implement StaticText (#8343)
This is linked to the legacy DisplayObject::Text, which can
only be created by Flash CS6 (but is allowed in AVM2 swfs).

The 'StaticText' class cannot be constructed from ActionScript.
To support this, I've added support for native initializers to
playerglobal. This allows us to throw an exception in the
ActionScript constructor in Test.as, and do nothing in the native
intiializer (so that we can construct it from a DisplayObject).

I've left StaticText.text unimplemented for now, since it will require
dealing with Glyphs

Co-authored-by: kmeisthax <dcrkid@yahoo.com>
2022-11-23 18:30:47 -05:00
Moulins 2fa3d31732 Appease Clippy on nightly 2022-11-23 22:39:45 +01:00
dependabot[bot] ccb1fa1b1b build(deps): bump clap from 4.0.24 to 4.0.26
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.24 to 4.0.26.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.24...v4.0.26)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-21 18:07:28 -07:00
dependabot[bot] b3debc96af build(deps): bump clap from 4.0.22 to 4.0.24
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.22 to 4.0.24.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.22...v4.0.24)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 09:33:20 +02:00
dependabot[bot] 9303304e3b build(deps): bump clap from 4.0.18 to 4.0.22
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.18 to 4.0.22.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.18...v4.0.22)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-08 00:25:12 +02:00
Aaron Hill 68471723b3 core: Fix clippy format string lint 2022-10-27 08:49:39 +03:00
dependabot[bot] d589130634 build(deps): bump serde from 1.0.145 to 1.0.147
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.145 to 1.0.147.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.145...v1.0.147)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:54:26 +03:00
dependabot[bot] c9f5524748 build(deps): bump clap from 4.0.15 to 4.0.18
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.15 to 4.0.18.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.15...v4.0.18)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-25 09:00:26 +03:00
dependabot[bot] 71a4f569af build(deps): bump proc-macro2 from 1.0.46 to 1.0.47
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.46 to 1.0.47.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.46...1.0.47)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-18 07:28:01 +03:00
relrelb 178bf4fe24 chore: Extract Cargo `edition` to `[workspace.package]`
This is possible since Rust 1.64.0: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#cargo-improvements-workspace-inheritance-and-multi-target-builds
2022-10-14 22:13:29 +03:00
dependabot[bot] 76f18cbc37 build(deps): bump clap from 4.0.9 to 4.0.12
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.9 to 4.0.12.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.9...v4.0.12)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-11 00:32:53 +03:00
relrelb a9dedf759a chore: Fix `clap` update
As described in https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#400---2022-09-28.
2022-10-05 21:33:34 +03:00
dependabot[bot] 32a370f803 build(deps): bump clap from 3.2.20 to 4.0.9
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.20 to 4.0.9.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.20...v4.0.9)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-05 21:33:34 +03:00
dependabot[bot] ac93f9d295 build(deps): bump serde from 1.0.144 to 1.0.145
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.144 to 1.0.145.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.144...v1.0.145)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 16:17:36 +03:00
dependabot[bot] 0547155749 build(deps): bump proc-macro2 from 1.0.43 to 1.0.46
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.43 to 1.0.46.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.43...1.0.46)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 14:14:35 +03:00
Aaron Hill f5b59f869c avm2: Show native method names in stack trace
Previously, we would display an empty string for the method name.

We can now store a `&'static str` again in `NativeMethod`,
instead of needing a `Cow`
2022-09-26 14:13:48 -05:00
EmperorBale 7aa821da4f core: Use class index for `class_id`, instead of slot_id 2022-09-17 12:31:43 -07:00
dependabot[bot] 69a43297df build(deps): bump convert_case from 0.5.0 to 0.6.0
Bumps [convert_case](https://github.com/rutrum/convert-case) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/rutrum/convert-case/releases)
- [Commits](https://github.com/rutrum/convert-case/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-13 09:20:12 +03:00
EmperorBale a9d95b7d4e core: Fix code generator creating invalid code 2022-09-07 13:54:33 -07:00
dependabot[bot] 7f40b42131 build(deps): bump serde-xml-rs from 0.5.1 to 0.6.0
Bumps [serde-xml-rs](https://github.com/RReverser/serde-xml-rs) from 0.5.1 to 0.6.0.
- [Release notes](https://github.com/RReverser/serde-xml-rs/releases)
- [Commits](https://github.com/RReverser/serde-xml-rs/compare/0.5.1...0.6.0)

---
updated-dependencies:
- dependency-name: serde-xml-rs
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-05 16:27:37 -07:00
dependabot[bot] aacc3c231a build(deps): bump clap from 3.2.18 to 3.2.20
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.18 to 3.2.20.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/v3.2.20/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.18...v3.2.20)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-05 14:47:03 -07:00
EmperorBale dd2bc1ea78
avm2: Add automatic linting for AS3 playerglobals 2022-09-04 16:33:35 -07:00
relrelb 2f106da04c avm2: Port toplevel constants to ActionScript
Declare `NaN`, `Infinity` and `undefined` in ActionScript, similarly
to how `avmplus` does in its `actionscript.lang.as`.

Note that `null` is only removed, without an ActionScript declaration,
as it seems like `avmplus` neither declares it. Probably `null` is
only usable as a compile-time constant.
2022-08-26 15:45:36 -07:00
relrelb ad91992cb5 swf: Simplify `DoAbc` tag handling
Extract `swf::Reader::read_do_abc()` which, as the name suggests,
reads a `DoAbc` tag, and use it before calling to `Avm2::load_abc`.
Finally, introduce `DoAbcFlag` using `bitflags`.
This greatly simplifies the ABC loading code.
2022-08-26 11:37:04 -07:00
EmperorBale 18bd7879e5 core: Add better error message when java could not be found 2022-08-26 10:11:35 +02:00
relrelb d152cc3e64 avm2: Port `Math` to ActionScript 2022-08-25 16:03:08 -07:00
relrelb 4e9cc919a1 avm2: Fix bindings of empty namespace
Previously native functions defined inside a `package {}` block
(without a package name) would cause a syntax error by two consecutive
`::`.
2022-08-25 16:03:08 -07:00
dependabot[bot] 8acb77dc2c build(deps): bump proc-macro2 from 1.0.42 to 1.0.43
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.42 to 1.0.43.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.42...1.0.43)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-09 08:51:01 +03:00
dependabot[bot] ed1ebe8fb5 build(deps): bump quote from 1.0.20 to 1.0.21
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.20 to 1.0.21.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.20...1.0.21)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 23:58:43 +02:00
dependabot[bot] f7f84418f9 build(deps): bump proc-macro2 from 1.0.41 to 1.0.42
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.41 to 1.0.42.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.41...1.0.42)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-02 22:37:35 +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
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
relrelb 786e8d92fb avm2: Introduce ActionScript entry-points
Previously all the `.as` files compiled into `playerglobal.swf`
were detected automatically using `walkdir`. While this might be
convenient, it can cause unexpected results when untracked `.as`
files exist. So instead, introduce two entry points - `stubs.as`
and `globals.as`, which include all stub ActionScript definitions,
and actual class implementations, respectively. This also simplifies
the `playerglobal.swf` build script a bit.
2022-06-18 18:26:57 +03:00
Aaron Hill 21eac9364f avm2: Use '.stub.as' suffix to indicate stub class
This removes the need for keeping an updating list in
'build_playerglobal', and made things easier for me
when porting classes to ActionScript.
2022-06-17 00:03:40 +03:00
relrelb 4e805bb109 avm2: Pass `-optimize` to `asc`
In order to reduce builtins size even further.
2022-06-16 23:09:36 +03:00
Aaron Hill f629a91e53
avm2: Allow implementing classes in ActionScript in custom `playerglobal`
This PR adds support for building a custom `playerglobal.swf`, which can be used
to implement builtin Flash classes in ActionScript. This file is embedded into Ruffle
using `include_bytes!`, and loaded during initialization.
As an example, the `Point` class is reimplemented
in ActionScript, and `flash.text.AntiAliasType` is added.

The ActionScript compilation process is performed by `core/build.rs`.
See that file, along with `core/src/avm2/globals/README.md`, for
more details.
2022-06-15 22:00:17 +03:00