Kornelius Rohrschneider
4d6dd38616
core: Make the form loader use Windows-1252 if SWF version <= 5
...
The form loader now loads files using Windows-1252 if the SWF version is
smaller than 6. This roughly matches Flash's behaviour (Flash uses
Windows-1252 on Windows, on macOS a slightly different custom encoding
is used).
Previously, UTF-8 has been (wrongly) used for all SWF files if
System#useCodepage hasn't been set to true, leading to incorrectly
displayed characters.
2024-06-26 02:37:44 +02:00
Kornelius Rohrschneider
0b30b7fdda
core: Use HTTP response encoding if existing
...
If System#useCodepage has been set to true, the form loader now uses the
encoding specified in the HTTP response content type field, if existing,
to decode remote text files. chardetng is now (only) used if the HTTP
response doesn't specify any encoding or if the file is local.
2024-06-26 02:37:44 +02:00
Kornelius Rohrschneider
870bdae6fd
core: Add support of non-UTF-8 encodings to the form loader
...
Flash's form loader loads text files in the local system codepage if
System#useCodepage has been set to true. Previously, Ruffle always
(wrongly) used UTF-8, leading to incorrectly displayed characters.
This has been fixed. Ruffle now supports loading files with an encoding
other than UTF-8.
As Ruffle doesn't always have access to the system codepage and as it's
not reliably the correct encoding, the crate chardetng has been added.
It's used instead of the system codepage to detect the encoding, and the
data is converted into UTF-8.
2024-06-26 02:37:44 +02:00
Crowdin Bot
e83e39ad27
chore: Update translations from Crowdin
2024-06-25 00:26:30 +02:00
dependabot[bot]
8877eebdb2
build(deps): bump the cargo-minor group across 1 directory with 4 updates
...
Bumps the cargo-minor group with 4 updates in the / directory: [bytemuck](https://github.com/Lokathor/bytemuck ), [syn](https://github.com/dtolnay/syn ), [proc-macro2](https://github.com/dtolnay/proc-macro2 ) and [libloading](https://github.com/nagisa/rust_libloading ).
Updates `bytemuck` from 1.16.0 to 1.16.1
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md )
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.16.0...v1.16.1 )
Updates `syn` from 2.0.66 to 2.0.68
- [Release notes](https://github.com/dtolnay/syn/releases )
- [Commits](https://github.com/dtolnay/syn/compare/2.0.66...2.0.68 )
Updates `proc-macro2` from 1.0.85 to 1.0.86
- [Release notes](https://github.com/dtolnay/proc-macro2/releases )
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.85...1.0.86 )
Updates `libloading` from 0.8.3 to 0.8.4
- [Commits](https://github.com/nagisa/rust_libloading/compare/0.8.3...0.8.4 )
---
updated-dependencies:
- dependency-name: bytemuck
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-minor
- dependency-name: syn
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-minor
- dependency-name: proc-macro2
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-minor
- dependency-name: libloading
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-06-25 00:08:16 +02:00
Tom Schuster
fe754d7fed
avm2: Change map().unwrap_or() to map_or()
2024-06-24 16:36:25 +02:00
Tom Schuster
0a513f273e
avm2: Cleanup some Value::Object matching
2024-06-24 16:36:25 +02:00
Kamil Jarosz
04dfd1f22f
avm2: Do not fire roll over events on focus change (yet)
...
This patch bypasses AVM2 conditionally when firing roll over events
triggered by a focus change until a proper support for AVM2 events
is implemented.
2024-06-23 13:30:27 +02:00
Lord-McSweeney
9271618185
avm2: Properly import stub_getter and stub_setter in Shader
2024-06-22 13:28:01 -07:00
Aaron Hill
dc03f541db
avm2: Match Flash behavior for DoAbc/SymbolClass script initializers
...
Flash Player handles SymbolClass tags and eager (non-lazy) DoAbc2 tags in an unusual way:
During the first time that a given frame is executed:
1. All SymbolClass tags are processed in order, triggering ClassObject loading (and the associated
script initializer execution, if it hasn't already been run)
2. All eager (non-lazy) DoAbc/DoAbc2 tags have their *final* script initializer executed.
To implement this, we now cache the needed `Script` and symbol class
data during preloading. The first time we execute a frame, we run
the symbolclass class lookup and assignment, followed by the final
script initializer for each DoAbc2 tag in the frame.
This fixes 'minidash' (and probably other crossbridge games as well).
2024-06-21 16:57:06 +02:00
Kamil Jarosz
adea7ae743
text: Refactor EditText.line_text
...
This refactor takes advantage of the
new layout structure to simplify code.
2024-06-21 16:41:56 +02:00
Kamil Jarosz
bfbd2dbd19
text: Refactor EditText.layout_metrics
...
This refactor takes advantage of the
new layout structure to simplify code.
2024-06-21 16:41:56 +02:00
Kamil Jarosz
50ade23779
text: Implement Layout.bounds
2024-06-21 16:41:56 +02:00
Kamil Jarosz
ba13386788
text: Restructure layout to include text lines
...
This patch removes `LineData` & `get_line_data` and incorporates
their logic into layout calculation adding `Layout` and `LayoutLine`.
The goal is to simplify operations on the layout, as now
line data is always present and integrated with the layout.
Specialized methods may be added to `Layout` and `LayoutLine`
in the future.
2024-06-21 16:41:56 +02:00
Kamil Jarosz
d2f5b78503
text: Move lower_from_text_spans to module level
2024-06-21 16:41:56 +02:00
Lord-McSweeney
1164dd747a
avm2: Merge locals better
2024-06-20 17:02:13 -07:00
Lord-McSweeney
1389f5fa67
avm2: Record all jump sources in verifier
2024-06-20 17:02:13 -07:00
Kamil Jarosz
8b2c9d8157
avm2: Add stub for winding behavior of drawing triangles in Graphics
...
Currently, even-odd winding rule is used to render triangles,
but FP uses non-zero.
2024-06-19 23:24:55 +02:00
Kamil Jarosz
14ac29e435
avm2: Handle wrong number of coords when drawing triangles in Graphics
...
FP throws an error when the number of coordinates is odd for the indexed
version, and when is not divisible by 6 for the non-indexed version.
2024-06-19 23:24:55 +02:00
Kamil Jarosz
86a3086808
avm2: Fix errors thrown when culling has wrong value in Graphics
...
The errors differ between Graphics.drawTriangles and GraphicsTrianglePath.
The former throws 2004, whereas the latter throws 2008.
2024-06-19 23:24:55 +02:00
Kamil Jarosz
64acc7b3ad
avm2: Ignore out of range and non-integer triangle indices in Graphics
...
This behavior imitates FP's behavior.
2024-06-19 23:24:55 +02:00
Kamil Jarosz
2b9289e1b2
avm2: Implement culling for drawing triangles in Graphics
2024-06-19 23:24:55 +02:00
Kamil Jarosz
4993d70594
avm2: Unify drawing triangles in graphics.rs
...
There were two implementations for drawing triangles: one for
Graphics.drawTriangles, and the other for GraphicsTrianglePath.
However, they behave almost identically, so this patch uses
draw_triangles_internal for both.
2024-06-19 23:24:55 +02:00
Kamil Jarosz
9e1248d130
avm2: Add make_error_1125
2024-06-19 23:24:55 +02:00
Nathan Adams
4d12e0e5b4
core: Implement LocalConnection
2024-06-19 21:54:25 +02:00
Kamil Jarosz
0f534c837f
avm2: Improve drawing paths in Graphics
...
This patch improves drawing paths in Graphics:
* no error is thrown when there are 0 commands,
* no error is thrown when there are missing data points,
* an error is thrown when the number of coordinates is odd,
* no error is thrown and command processing is stopped
when an unknown command is encountered,
* the vector with parsed commands is removed, as it's not needed.
2024-06-19 20:58:33 +02:00
Kamil Jarosz
fae1500cc6
avm2: Add make_error_2004
2024-06-19 20:58:33 +02:00
Kamil Jarosz
687e049dc1
debug_ui: Add option to draw layout boxes for EditText
2024-06-19 20:12:43 +02:00
TÖRÖK Attila
35f5227e2d
core,desktop: Update `wgpu` to `v0.20.1`, bump `egui`
2024-06-18 23:10:43 +02:00
Lord-McSweeney
9c8e4d7dce
core: Remove `DataFormat` for `URLLoader` loads since we can just check the string field
...
Also, don't set the data as variables if there is no data to set.
2024-06-18 20:56:50 +02:00
Lord-McSweeney
7a1ee0e109
core: `URLLoader` should check the data format after loading finishes, not when starting a load
2024-06-18 20:56:50 +02:00
Crowdin Bot
a731b82b54
chore: Update translations from Crowdin
2024-06-17 14:57:20 +02:00
Adrian Wielgosik
cacfb5a6a4
avm2: Fix and unify converting SWF's 1-based to 0-based slot indexing
2024-06-16 16:11:17 -07:00
Tom Schuster
4463a69c87
avm2: Implement namespace support for flash.xml
2024-06-15 22:26:57 +02:00
Crowdin Bot
8fb214ea71
chore: Update translations from Crowdin
2024-06-14 22:41:19 +02:00
Lord-McSweeney
18c50df838
avm2: Don't get the `Class` class by using `instance_of` in `into_finished_class`
2024-06-13 23:49:52 +02:00
Lord-McSweeney
1705870951
avm2: Class initializers will be called twice when constructing two `ClassObject`s for one `Class`
2024-06-13 23:49:52 +02:00
Lord-McSweeney
7e7032d908
avm2: Remove `constructor`, `native_constructor`, and `call_handler` fields from `ClassObject`
...
They were already present on `Class`
2024-06-13 23:49:52 +02:00
dependabot[bot]
52404bc3aa
build(deps): bump the cargo-minor group with 6 updates
...
Bumps the cargo-minor group with 6 updates:
| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap ) | `4.5.4` | `4.5.7` |
| [url](https://github.com/servo/rust-url ) | `2.5.0` | `2.5.1` |
| [linkme](https://github.com/dtolnay/linkme ) | `0.3.26` | `0.3.27` |
| [regex](https://github.com/rust-lang/regex ) | `1.10.4` | `1.10.5` |
| [zip](https://github.com/zip-rs/zip2 ) | `2.1.2` | `2.1.3` |
Updates `clap` from 4.5.4 to 4.5.7
- [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/clap_complete-v4.5.4...v4.5.7 )
Updates `url` from 2.5.0 to 2.5.1
- [Release notes](https://github.com/servo/rust-url/releases )
- [Commits](https://github.com/servo/rust-url/compare/v2.5.0...v2.5.1 )
Updates `linkme` from 0.3.26 to 0.3.27
- [Release notes](https://github.com/dtolnay/linkme/releases )
- [Commits](https://github.com/dtolnay/linkme/compare/0.3.26...0.3.27 )
Updates `regex` from 1.10.4 to 1.10.5
- [Release notes](https://github.com/rust-lang/regex/releases )
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-lang/regex/compare/1.10.4...1.10.5 )
Updates `zip` from 2.1.2 to 2.1.3
- [Release notes](https://github.com/zip-rs/zip2/releases )
- [Changelog](https://github.com/zip-rs/zip2/blob/master/CHANGELOG.md )
- [Commits](https://github.com/zip-rs/zip2/compare/v2.1.2...v2.1.3 )
---
updated-dependencies:
- dependency-name: clap
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-minor
- dependency-name: url
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-minor
- dependency-name: linkme
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-minor
- dependency-name: quick-xml
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: cargo-minor
- dependency-name: regex
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-minor
- dependency-name: zip
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: cargo-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2024-06-13 01:05:26 +02:00
Crowdin Bot
4fa5853f88
chore: Update translations from Crowdin
2024-06-13 00:44:49 +02:00
Nathan Adams
c9b111996f
web: Make serde (more-)optional in core
2024-06-13 00:22:33 +02:00
Kamil Jarosz
e8dbd58306
core: Use DisplayObject.movie() instead of context.swf where applicable
...
This prevents problems in case of mixed-AVM content.
2024-06-13 00:06:10 +02:00
Kamil Jarosz
39e8a15db5
core: Update focus after handling press, not before
...
Updating focus before handling press caused onRollOut
to be fired before onPress, but it should be fired after.
2024-06-12 23:49:06 +02:00
TÖRÖK Attila
516c56db15
chore: Suppress a `clippy::doc_lazy_continuation` beta lint false positive
2024-06-12 23:09:39 +02:00
TÖRÖK Attila
0d25b5dba8
chore: Fix `clippy::needless_borrows_for_generic_args` beta lint
2024-06-12 22:42:18 +02:00
TÖRÖK Attila
6b4ee7dfde
chore: Fix most `clippy::doc_lazy_continuation` beta lints
2024-06-12 22:42:18 +02:00
Lord-McSweeney
0e062c4b9b
avm2: Replace two more uses of `instance_of` with `instance_class`
2024-06-12 19:46:32 +02:00
Lord-McSweeney
97f75cc0b4
avm2: Move interface logic from `ClassObject` to `Class`
2024-06-12 19:46:32 +02:00
Lord-McSweeney
90c370d61b
avm2: Always store a Class on vtable
2024-06-12 19:46:32 +02:00
Lord-McSweeney
2c9028d2f9
avm2: Replace most uses of `instance_of` with `instance_class`
...
Also store a Class -> alias mapping instead of a ClassObject -> alias mapping for AMF.
2024-06-12 19:46:32 +02:00