Commit Graph

5139 Commits

Author SHA1 Message Date
David Wendt 6a70c1b3e0 tests: Extend the simplebutton structure test to include frame 2 2021-05-16 17:53:07 -07:00
David Wendt a013a7dfdf core: Initial construction should also prevent normal frame execution first frame 2021-05-16 17:53:07 -07:00
David Wendt 9f5a7f5065 core: AVM2 `Button`s run their children one frame at construction time 2021-05-16 17:53:07 -07:00
David Wendt bfef7f9969 core: `Avm2Button` should always construct a sprite for each state, even if it's not used. 2021-05-16 17:53:07 -07:00
David Wendt afefdb892f tests: Add a test for timeline-constructed AS3 `SimpleButton` contents 2021-05-16 17:53:07 -07:00
David Wendt 821ed25374 avm2: `Avm2Button` should construct it's children 2021-05-16 17:53:07 -07:00
David Wendt 71b87f8935 avm2: Also impl `construct_frame` and `run_frame_scripts` for `Avm2Button` 2021-05-16 17:53:07 -07:00
David Wendt 4869ec650e core: `Avm2Button` should construct a sprite whenever there's anything other than one child 2021-05-16 17:53:07 -07:00
David Wendt c317d77916 core: `Avm2Button` shouldn't try to construct a Sprite using it's prototype 2021-05-16 17:53:07 -07:00
David Wendt 10bed4fe30 core: `set_avm2_constructor` works on constructors, not prototypes 2021-05-16 17:53:07 -07:00
David Wendt d049ba8c0f core: Child instantiation should print the error message it got when it fails 2021-05-16 17:53:07 -07:00
David Wendt 25473ac1dc core: Allow AVM2 movies to define `Avm2Button` characters in their libraries 2021-05-16 17:53:07 -07:00
David Wendt cb44554135 avm2: Add setters and getters for the four states of `SimpleButton` 2021-05-16 17:53:07 -07:00
David Wendt 494083673c core: Add AVM2 version of Button 2021-05-16 17:53:07 -07:00
David Wendt 22eac776be avm2: Stub `flash.display.SimpleButton` 2021-05-16 17:53:07 -07:00
David Wendt cffa739a54 avm2: Store the sprite proto 2021-05-16 17:53:07 -07:00
David Wendt c0296d9963 core: Rename `Button` to `Avm1Button` 2021-05-16 17:53:07 -07:00
Reiner Gerecke efdb9c153d core: Fix endless loop when layouting text
If a textfield has word wrapping enabled, is very small in size and
tries to layout a single character onto it, the layout code can run into
an endless loop where it's creating new lines and trying to fit the text
again.

If text doesn't fit at the start of a line, it won't fit on the next
either, so abort and display the whole text span on the line. Text will
be cut-off.

This can be reproduced with a AS2 file like this:

    class Test {
      static var app : Test;

      function Test() {
        _root.createTextField("tf",0,0,0,6,20);
        _root.tf.text = "0";
        _root.tf.wordWrap = true;
      }

      static function main(mc) {
        app = new Test();
      }
    }

Build it with `mtasc -main -header 100💯30 test.as -swf test.swf`
2021-05-15 18:56:51 -07:00
Mike Welsh 69a0700ca1 core: Remove collect::CollectWrapper
No longer necessary, it is possible to mark individual fields
as `#[collect(require_static)]`.
2021-05-13 23:24:10 -07:00
Ahmet Akkoç ae038ccbb1
i18n: Update Turkish localization 2021-05-13 10:30:14 -07:00
Mike Welsh b882284fc9 core: Use bitflags for HitTestOptions 2021-05-12 23:02:06 -07:00
Mike Welsh d4e3bd7ef5 tests: Add tests for various funky AVM1 ops 2021-05-12 20:47:06 -07:00
relrelb 85b234003f avm1: Handle undefined/empty method name in NewMethod
Seems like it behaves similarly to CallMethod with an undefined/empty
method name.
2021-05-12 20:47:06 -07:00
relrelb 2589ecdde0 avm1: Correct ImplementsOp 2021-05-12 20:47:06 -07:00
relrelb 3bf3f1015d avm1: Return undefined on invalid count in InitArray and InitObject
Both InitArray and InitObject should bail-out without popping anything
off the stack when the elements/properties count is negative or greater
than or equals 2147483648.
2021-05-12 20:47:06 -07:00
relrelb 72531eddff avm1: Cleanup CallMethod 2021-05-12 20:47:06 -07:00
relrelb 2e0bc78cd6 avm1: Fix variadic arguments
Previously, if the arguments count was greater than the actual
stack size, then a stack underflow occurred which resulted in a
sequence of undefined values. That didn't match Flash's behavior.

Also, this prevents potential huge allocations that hang Ruffle.

In addition, num_args seems like it should use coerce_to_u32
(wraps at 4294967297). This also means that -1 ends up acting like
u32::MAX and would pop all values off of the stack.
2021-05-12 20:47:06 -07:00
Eduardo Sánchez Muñoz e3dc8ff28e swf: SwfStr: reimplement `Debug` with `std::ascii::escape_default`
The string will now be surrounded with quotes (`"`), non-ASCII characters (UTF-8 or not) will be escaped in hexadecimal form (`\xNN`) and ASCII control characters will be escaped (`\x01`, `\n`, `\t`).
2021-05-12 10:53:26 -07:00
Mike Welsh 9538647422 tests: Fix swf::Fixed tests in --release (fix #4313)
Use `#[cfg_attr(debug_assertions, should_panic)]` to ensure that
the tests only expect to panic in debug builds.

Fixes #4313.
2021-05-11 20:53:23 -07:00
relrelb 7acf0349c3 desktop: Refactor main.rs 2021-05-11 18:58:08 -07:00
Mike Welsh ea4ea9922a chore: Bump rustfft
Bump rustfft to 5.1.1, which fixes this issue affecting our nightly
build:

https://github.com/ejmahler/RustFFT/issues/74
2021-05-10 17:33:16 -07:00
dependabot[bot] dd5894ebd6 chore: Bump wgpu from 0.8.0 to 0.8.1
Bumps [wgpu](https://github.com/gfx-rs/wgpu-rs) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/gfx-rs/wgpu-rs/releases)
- [Changelog](https://github.com/gfx-rs/wgpu-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gfx-rs/wgpu-rs/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 10:16:10 -07:00
dependabot[bot] 8e91f8dc89 chore: Bump enum-map from 1.0.0 to 1.1.0
Bumps [enum-map](https://gitlab.com/KonradBorowski/enum-map) from 1.0.0 to 1.1.0.
- [Release notes](https://gitlab.com/KonradBorowski/enum-map/tags)
- [Changelog](https://gitlab.com/KonradBorowski/enum-map/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/KonradBorowski/enum-map/commits/master)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 10:15:58 -07:00
dependabot[bot] 62301dea54 chore: Bump syn from 1.0.71 to 1.0.72
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.71...1.0.72)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-10 09:40:26 -07:00
Adrian Wielgosik c40d08e73a web: Fix context menu checkmark in web builds 2021-05-10 00:19:29 -07:00
Mike Welsh 6051ee4cb1 core: Disallow .. in shared object paths (fix #3961)
Toss out any shared objects that contain ".." in the name
to avoid accessing files outside of the Ruffle data directory.

The DiskStorageBackend also will fail any requests with a ".."
component as an extra precaution.

Fixes #3961.
2021-05-09 23:20:32 -07:00
Mike Welsh 339f0e2862 desktop: Append .sol extension to SharedObject files
Also, prefix the shared object name with # if it contains a
slash, (e.g. `#mygame/foo`). This matches Flash's directory
structure and makes it easier to transfer saved data to Ruffle.
2021-05-09 23:20:32 -07:00
CUB3D 61298b2be3 avm1: Add parsing of legacy json SharedObjects for backwards compatability 2021-05-09 23:20:32 -07:00
CUB3D f4a9446829 avm1: Fix tests for SharedObject 2021-05-09 23:20:32 -07:00
CUB3D 07336c306a avm1: Add test for generated file 2021-05-09 23:20:32 -07:00
CUB3D c398aded68 chore: Remove debug printing 2021-05-09 23:20:32 -07:00
CUB3D cd1cde1708 avm1: Implement de/serialization of shared objects into Flash Player Lso format 2021-05-09 23:20:32 -07:00
Pablo Rodríguez 3acfb5bc29
i18n: Minor improvement in Spanish translation 2021-05-09 10:57:27 -07:00
Ahmet Akkoç d2bf69d5e6
i18n: Added Turkish localization 2021-05-08 03:14:23 -07:00
relrelb 6b6b335440 avm1: Use bitflags for Array.sort flags 2021-05-08 01:37:05 -07:00
Mike Welsh ba7fd1b2b9 chore: Appease clippy, bump url
Bump url and avoid `Url::into_string` deprecation warnings.
Fix `single_char_pattern` clippy lints.
2021-05-07 20:51:26 -07:00
Mike Welsh 66b144e49b ci: Run apt-get update
GitHub Actions runners updated to Ubuntu 20.04, so run apt-get
update to ensure we can install our Linux dependencies (namely
libasound2).
2021-05-07 20:05:17 -07:00
relrelb b2bc24919a avm1: Replace `current_swf_version` with `swf_version`
They happen to be identical, and `swf_version` is more idomatic.
2021-05-07 13:26:20 -07:00
Mike Welsh e35933aeee desktop: Fix window size calculation
Change width/height CLI paramters to `f64`, and also clamp window
size to minimum of 1x1 to prevent panics from invalid window
dimensions.
2021-05-06 17:56:35 -07:00
Mike Welsh ef617eebad avm1: Use `set_html_text` when initializing textfield from a variable binding
If a textfield was created with a variable binding, and the variable
already existed, the initial text of the textfield is set to the
variable value. However, this was not obeying the HTML setting of
the text field, so HTML tags were mistakenly shown in some content.

Fixes #3522.
2021-05-06 16:58:33 -07:00