Commit Graph

423 Commits

Author SHA1 Message Date
Lord-McSweeney b5f7fa0cd0 swf: `CallMethod` takes a `disp_id`, not any sort of `Index` 2024-03-10 09:49:24 -07:00
Aaron Hill 900a8407d6 core: Implement lazy decoding of bitmaps
We hit a pathological case in House
(https://github.com/ruffle-rs/ruffle/issues/15154),
where eagerly decoding bitmaps during preloading results in
over 10GB of ram being used.

With this PR, we store the compressed bitmap, and only decode it
each time we instantiate it. In order to support bitmap fills,
we store the decoded width/height and a lazily-initialized GPU handle
in `Character::Bitmap`
2024-02-27 21:18:18 -05:00
Lord-McSweeney 2d3b23c719 swf: Remove `PushConstant` AVM2 opcode 2024-01-29 22:48:00 -08:00
Lord-McSweeney 2022321a03 avm2: Add an `Op` enum to AVM2; pre-pool double/uint/ints for `pushX` opcodes 2024-01-29 22:48:00 -08:00
Aaron Hill 1cf669c75e avm2: Convert invalid rectangle to zero rectangle in getBounds 2024-01-29 13:25:16 -05:00
Nathan Adams 6dac4958fb swf: Derive Hash for Gradient and associated types 2024-01-27 21:37:22 +01:00
Moulins ac7086528f avm1: Implement proper behavior for Gradient***Filter array setters
Among other things:
- resizing `colors` should also resize `alphas` and `ratios`
- shrinking `ratios` should also shrink `colors` and `alphas`, but
  growing it doesn't change the size
2024-01-26 18:40:06 +01:00
Moulins bd2165bd0f swf: Properly read/write ConvolutionFilters; these contain f32s, not Fixed16s 2024-01-26 18:40:06 +01:00
Aaron Hill c1fce1106f swf: Parse string as Vec<u8> instead of String in SWF
Some obfuscated SWFs may have invalid strings in their constant
pool - trying to immediately parse them as a utf-8 String throws
away information. Instead, we now store a `Vec<u8>`, which we
then use to construct an `AvmString` (or with `String::from_utf8_lossy`
for debug printing).
2024-01-22 21:50:45 -05:00
renovate[bot] 262dff83a4 fix(deps): update rust dependencies 2024-01-22 03:09:33 +01:00
Moulins 233478a273 swf: Show scaled value in `swf::FixedN`'s `Debug` implementations 2024-01-20 12:21:13 +01:00
TÖRÖK Attila d153290fd6 nits: Fix a whole bunch of typos all over the place 2024-01-17 23:59:19 +01:00
TÖRÖK Attila 217585daa8 chore: Delegate `[lints]` in `Cargo.toml` of all packages to the workspace 2024-01-05 11:28:19 +01:00
Tom Schuster dd53b4e06b avm2: Reduce the size of Op on 64bit 2024-01-04 21:15:09 +01:00
renovate[bot] 0e5ef32654 fix(deps): update rust dependencies 2023-12-18 08:16:28 +01:00
friedkeenan 834e745652 swf: Make avm2 Writer::write_op public 2023-12-17 15:41:44 +01:00
friedkeenan c7966cea77 swf: Add test for avm2 Writer::write_op 2023-12-17 15:41:44 +01:00
renovate[bot] e196a544dd fix(deps): update rust crate bitstream-io to v2 2023-12-11 11:25:12 +01:00
renovate[bot] 40b92e69f7 fix(deps): update rust dependencies 2023-12-05 21:08:16 +01:00
renovate[bot] 6da223a875 fix(deps): update rust dependencies 2023-11-27 09:44:47 +01:00
renovate[bot] 2a83274c7f fix(deps): update rust dependencies 2023-11-19 21:09:42 -05:00
renovate[bot] 32c65e6460 fix(deps): update rust dependencies 2023-11-13 09:10:26 +01:00
Nathan Adams 1ff23cdd77 swf: Fixed writing DefineFontInfo tags with wide chars 2023-10-29 14:31:45 +01:00
Nathan Adams 11e1d2f6be swf: Fixed writing out DefineText2 (we previously wrote it as DefineText 1) 2023-10-29 14:31:45 +01:00
Nathan Adams 878f1fc64e swf: Removed ButtonAction::key_code and fixed writing button tags 2023-10-29 14:31:45 +01:00
Nathan Adams 5b41db9138 swf: Fixed writing bevel filters 2023-10-29 14:31:45 +01:00
sleepycatcoding fc0f03a687 swf: Fix writing of a DefineButton2 with zero actions
Previously, `swf` crate always wrote out the action offset, but this should be 0 when there are no actions.
2023-10-27 20:27:12 +02:00
renovate[bot] cd01bfe7d6 fix(deps): update rust dependencies 2023-10-23 02:55:11 +02:00
renovate[bot] b427940431 fix(deps): update rust dependencies 2023-10-16 09:51:22 +02:00
renovate[bot] 18796a67fe fix(deps): update rust dependencies 2023-10-10 02:15:59 +02:00
Adrian Wielgosik cea0f1b1f1 swf: Add test for DefineFont2/3 roundtrips 2023-10-08 12:13:16 +02:00
Adrian Wielgosik 3e5482a761 swf: Better adjust offsets for has_wide_offsets in writer 2023-10-08 12:13:16 +02:00
Adrian Wielgosik 9ab50bcd74 swf: Fix writing an all-zeros straight ShapeRecord 2023-10-08 12:13:16 +02:00
Adrian Wielgosik f08ee6de58 swf: Add a missing offset to DefineFont2/3 offset table 2023-10-08 12:13:16 +02:00
Adrian Wielgosik cc5c46dda2 swf: Fix writing of an all-zeros curve ShapeRecord 2023-10-08 12:13:16 +02:00
renovate[bot] 37e2c06034 fix(deps): update rust dependencies 2023-09-18 00:00:45 +02:00
renovate[bot] 4e75c3890a fix(deps): update rust dependencies 2023-08-28 07:39:35 +02:00
renovate[bot] 93f08d7738 chore(deps): lock file maintenance rust dependencies 2023-08-14 23:58:45 +02:00
Nathan Adams f2ca88bb34 core: Readd max(0) to blur size 2023-08-12 13:00:27 +02:00
Nathan Adams 1a4a808c23 render: Make Filter::calculate_dest_rect work in Twips 2023-08-12 13:00:27 +02:00
Nathan Adams da090f0bd7 render: Move filter size calculation from wgpu to render/swf 2023-08-12 13:00:27 +02:00
renovate[bot] a4b179e1e0 chore(deps): lock file maintenance rust dependencies 2023-08-08 23:19:16 +02:00
TÖRÖK Attila 41377c5472 swf: Different blur impotency check 2023-07-26 13:03:11 +02:00
relrelb 5f6d8d72ea render: Skip unreasonably large bitmaps
Some SWFs report unreasonable bitmap dimensions, and trying to reserve
enough capacity for them always fails. To avoid panics, skip those bitmaps.

Fixes #1191
Fixes #2759
Fixes #10701
2023-07-24 09:37:37 +03:00
Nathan Adams b201e19cc7 wgpu: Don't create an extra fresh texture for applying filters to a CAB 2023-07-20 23:19:20 +02:00
Lord-McSweeney 5975714f75 avm2+swf+tests: Store metadata on Traits and VTable, report metadata in describeType; parse ABC metadata key-value pairs correctly; add test 2023-07-19 16:24:23 +02:00
Kornelius Rohrschneider 687c0e7516 core: Complete MovieClip error state & Change uncompressed_len to i32
Previously, the MovieClip error state contained one TODO in order to be
completely implemented: The HeaderExt variable uncompressed_len needs to
be -1 in the error state, but its type has been u32.
The type has now been changed to i32, and the variable is set to -1 in
the default_error_header function. Therefore, the MovieClip error state
is now fully implemented.

Other connected functions and variables like SwfMovie::uncompressed_len
or MovieClip::total_bytes have been adjusted to this type change. Code
has been adjusted if needed where this value is used.
2023-07-17 00:08:02 +02:00
Kornelius Rohrschneider 893052c2a6 core: Add MovieClip error state
A load_error_swf function has been added to the Loader. It makes the
MovieClip enter the error state in which some attributes have certain
error values to signal that no valid file could be loaded. This happens
if no file could be loaded or if the loaded content is no valid
supported content.
The function creates an error state movie stub using the new
SwfMovie::error_movie function (which uses a new default_error_header
function) and configures remaining variables with the
movie_not_available method.
One TODO in order for the error state to be completely implemented has
been added.

Since the error state of the MovieClip includes the final URL of the SWF
file obtained after any redirects, the load_error_swf and
movie_loader_error functions (now) take an swf_url attribute.
To get this URL in case no file could be loaded, the
NavigatorBackend::fetch method has been changed to return an
ErrorResponse struct (including the url and the actual error) in the
error case. The Response struct returned in the success case has been
renamed to SuccessResponse.
All fetch implementations have been adapted accordingly. Code has been
adjusted to return the actual error where that's needed.

Documentation has been added and improved.
2023-07-17 00:08:02 +02:00
Lord-McSweeney 3e193214df swf: Ignore bad ConstantPool string reads 2023-07-15 12:10:36 +02:00
Lord-McSweeney 61a4ded851 swf: Ignore bad ActionTry opcodes 2023-07-15 12:10:36 +02:00